:root {
  --bg: #f4f7f8;
  --surface: #ffffff;
  --surface-soft: #eef5f3;
  --border: #d7e0e4;
  --border-strong: #afbec6;
  --text: #20242a;
  --muted: #667483;
  --accent: #287b5f;
  --accent-dark: #1e604a;
  --danger: #9d2f26;
  --danger-bg: #fff1ee;
  --warning: #b26a00;
  --warning-bg: #fff6df;
  --shadow: 0 18px 40px rgba(24, 34, 44, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  font-family: Aptos, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease;
}

button:not(:disabled):active {
  transform: translateY(1px) scale(0.98);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.sir-shell {
  min-height: 100vh;
}

.sir-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(16px, 4vw, 34px);
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(16px);
}

.brand,
.header-actions,
.action-row,
.review-toolbar,
.issue-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(20, 28, 36, 0.08);
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 2px;
}

.brand strong,
.brand small {
  display: block;
}

.brand small,
.eyebrow,
.field,
.project-card small,
.video-row small,
.issue-card small,
.pdf-card p,
.analysis-card p {
  color: var(--muted);
  font-size: 12px;
}

.sir-main {
  display: grid;
  grid-template-columns: 280px minmax(0, 1180px);
  gap: 18px;
  justify-content: center;
  padding: 22px clamp(14px, 4vw, 34px);
}

.stepper {
  position: sticky;
  top: 88px;
  display: grid;
  align-self: start;
  gap: 8px;
}

.step {
  display: flex;
  min-height: 56px;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  text-align: left;
}

.step strong {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  color: var(--accent);
  background: var(--surface-soft);
  border-radius: 999px;
}

.step span {
  font-weight: 700;
}

.step.active {
  border-color: #9ccfbe;
  box-shadow: 0 0 0 3px rgba(40, 123, 95, 0.12);
}

.workspace,
.details-form,
.project-results,
.video-list,
.issue-list,
.summary-grid {
  display: grid;
  gap: 14px;
}

.workspace {
  width: 100%;
}

.panel {
  display: grid;
  gap: 18px;
  padding: clamp(16px, 3vw, 24px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(32, 42, 54, 0.04);
}

.panel-heading {
  display: grid;
  gap: 4px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(26px, 3.4vw, 34px);
  line-height: 1.05;
}

h2 {
  font-size: 18px;
}

.primary-button,
.secondary-button,
.danger-button,
.icon-button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-weight: 800;
  text-decoration: none;
}

.primary-button {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.primary-button:hover {
  background: var(--accent-dark);
}

.secondary-button,
.icon-button {
  color: var(--text);
  background: var(--surface);
}

.danger-button {
  color: var(--danger);
  background: var(--danger-bg);
  border-color: #efc7c1;
}

.session-chip {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  padding: 0 10px;
  color: var(--text);
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 800;
}

.field {
  display: grid;
  gap: 6px;
  font-weight: 800;
  text-transform: uppercase;
}

.field.full {
  grid-column: 1 / -1;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  text-transform: none;
}

textarea {
  resize: vertical;
}

.details-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.project-result,
.project-card,
.video-row,
.analysis-card,
.pdf-card,
.summary-item,
.issue-card {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.project-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 58px;
  padding: 12px 14px;
  text-align: left;
}

.project-result-main {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.project-result-main strong {
  overflow: hidden;
  font-size: 15px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-result-main small,
.selected-project-header small,
.project-detail-grid small {
  display: block;
}

.project-result.active {
  border-color: #9ccfbe;
  box-shadow: 0 0 0 3px rgba(40, 123, 95, 0.12);
}

.project-result:hover {
  border-color: #9ccfbe;
  background: #e8f2ef;
}

.project-card,
.analysis-card,
.pdf-card {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.project-detail-grid,
.summary-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.project-detail-grid {
  display: grid;
  gap: 0;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.project-detail-grid div {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 11px 12px;
  background: #fff;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.summary-item {
  display: grid;
  gap: 4px;
  padding: 10px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.project-detail-grid div:nth-child(3n) {
  border-right: 0;
}

.project-detail-grid div:nth-last-child(-n + 3) {
  border-bottom: 0;
}

.project-detail-grid strong {
  overflow-wrap: anywhere;
  font-size: 14px;
  line-height: 1.25;
}

.selected-project-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.selected-project-header > div {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.selected-project-header strong {
  font-size: 18px;
  line-height: 1.2;
}

.status-pill {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  border: 1px solid #b9d9cf;
  border-radius: 999px;
  color: var(--accent-dark);
  background: #e6f4ef;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.status-pill::before {
  width: 7px;
  height: 7px;
  content: "";
  background: var(--accent);
  border-radius: 999px;
}

.status-pill.inactive {
  color: var(--muted);
  background: #f0f3f5;
  border-color: var(--border);
}

.status-pill.inactive::before {
  background: var(--muted);
}

.upload-zone {
  display: grid;
  gap: 8px;
  padding: 22px;
  color: var(--muted);
  background: var(--surface-soft);
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
  text-align: center;
  font-weight: 800;
}

.upload-zone input {
  margin: 0 auto;
  max-width: 340px;
  background: #fff;
}

.video-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, 0.6fr) auto;
  gap: 10px;
  padding: 12px;
}

.video-row progress,
.analysis-card progress {
  width: 100%;
  height: 10px;
  accent-color: var(--accent);
}

.issue-card {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.issue-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.issue-grid .field:nth-child(5),
.issue-grid .field:nth-child(6) {
  grid-column: 1 / -1;
}

.issue-image {
  display: grid;
  min-height: 120px;
  place-items: center;
  color: var(--muted);
  background: #fff;
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
  font-size: 13px;
}

.issue-actions {
  justify-content: flex-end;
}

.action-row,
.review-toolbar {
  justify-content: space-between;
}

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(244, 247, 248, 0.9);
}

.auth-card {
  display: grid;
  width: min(420px, 100%);
  gap: 16px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.toast-stack {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 40;
  display: grid;
  width: min(360px, calc(100vw - 32px));
  gap: 10px;
}

.toast {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.toast strong,
.toast span {
  display: block;
}

.toast span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.hidden {
  display: none !important;
}

@media (max-width: 920px) {
  .sir-main {
    grid-template-columns: 1fr;
    justify-content: stretch;
  }

  .stepper {
    position: static;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .step {
    min-height: 48px;
  }

  .step span {
    font-size: 12px;
  }
}

@media (max-width: 640px) {
  .sir-header,
  .header-actions,
  .action-row,
  .review-toolbar {
    display: grid;
    align-items: stretch;
  }

  .sir-main {
    padding: 14px;
  }

  .stepper,
  .details-form,
  .project-detail-grid,
  .summary-grid,
  .issue-grid,
  .video-row {
    grid-template-columns: 1fr;
  }

  .brand-mark {
    width: 48px;
    height: 48px;
  }

  .project-detail-grid div,
  .project-detail-grid div:nth-child(3n) {
    border-right: 0;
  }

  .project-detail-grid div:nth-last-child(-n + 3) {
    border-bottom: 1px solid var(--border);
  }

  .project-detail-grid div:last-child {
    border-bottom: 0;
  }
}
