:root {
  color-scheme: light;
  --page: #f6f5f0;
  --surface: #fffefa;
  --ink: #272b23;
  --muted: #676b60;
  --line: #e4e3d9;
  --accent: #425333;
  --accent-hover: #334328;
  --tint: #e9eddf;
  --soft: #f2f1e9;
  --side: 236px;
  --pad: clamp(24px, 4.2vw, 64px);
  font: 15px/1.45 Inter, 'Segoe UI', system-ui, sans-serif;
  color: var(--ink);
  background: var(--page);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .5; cursor: default; }
button:focus-visible, a:focus-visible, summary:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid #607746; outline-offset: 3px; }
input, textarea, select { min-width: 0; }
img { display: block; max-width: 100%; }
h1, h2, h3, p { margin: 0; }
svg { flex: none; vertical-align: middle; }
.skip { position: fixed; z-index: 10; top: 10px; left: 10px; padding: 8px 12px; transform: translateY(-200%); background: white; color: var(--ink); }
.skip:focus { transform: none; }
.skip:not(:focus) { clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; padding: 0; }

.workspace { min-height: 100dvh; display: grid; grid-template-columns: var(--side) minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; gap: 26px; padding: 24px 15px 17px; background: #fcfbf7; border-right: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 7px; font-size: 17px; font-weight: 730; letter-spacing: -.035em; white-space: nowrap; }
.brand-mark { display: grid; width: 35px; height: 35px; place-items: center; color: #f8f8ed; background: var(--accent); border-radius: 11px; }
.brand-mark svg { width: 20px; height: 20px; }
.brand-accent { color: #49563c; }
.project-tile { display: flex; gap: 10px; align-items: center; min-width: 0; padding: 10px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); }
.project-thumb { width: 39px; height: 39px; flex: none; border-radius: 8px; overflow: hidden; background: var(--soft); }
.project-thumb img { width: 100%; height: 100%; object-fit: cover; }
.project-tile span:last-child { min-width: 0; }
.project-tile strong, .project-tile small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-tile strong { font-size: 13px; font-weight: 700; }
.project-tile small { color: var(--muted); font-size: 11px; margin-top: 2px; }
.step-nav { display: grid; gap: 5px; }
.step-nav a { position: relative; display: grid; grid-template-columns: 23px 1fr 19px; align-items: center; gap: 9px; padding: 11px 10px; min-height: 44px; border-radius: 9px; text-decoration: none; color: #51564b; font-size: 13px; font-weight: 570; }
.step-nav a:hover { background: #f0f1e9; }
.step-nav a[aria-current] { background: var(--tint); color: #344529; font-weight: 740; }
.nav-icon svg { width: 17px; height: 17px; }
.step-number { font-size: 11px; color: #72786a; font-variant-numeric: tabular-nums; justify-self: end; }
.sidebar-bottom { display: flex; align-items: center; gap: 8px; margin-top: auto; border-top: 1px solid var(--line); padding: 16px 6px 0; font-size: 11px; color: var(--muted); }
.local-dot, .status-chip i { display: inline-block; width: 7px; height: 7px; flex: none; border-radius: 50%; background: #7b915d; }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar { height: 66px; display: flex; flex: none; align-items: center; justify-content: space-between; gap: 10px; padding: 0 var(--pad); background: #fcfbf7; border-bottom: 1px solid var(--line); }
.breadcrumb { display: flex; align-items: center; gap: 10px; min-width: 0; font-size: 13px; color: var(--muted); }
.breadcrumb strong { color: var(--ink); white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.status-chip { display: inline-flex; align-items: center; gap: 7px; padding: 5px 10px; font-size: 11px; font-weight: 650; border: 1px solid #dee4d4; border-radius: 99px; color: #465337; background: #f3f5eb; white-space: nowrap; }
.stage { width: 100%; max-width: 1450px; align-self: center; flex: 1; padding: 38px var(--pad) 36px; outline: none; }
.page-heading { margin-bottom: 27px; }
.page-heading h1 { font-weight: 760; font-size: clamp(34px, 4.3vw, 58px); line-height: 1; letter-spacing: -.055em; }
.page-heading p { color: var(--muted); margin-top: 12px; font-size: clamp(13px, 1.25vw, 16px); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 15px; }
h2 { font-size: 19px; font-weight: 730; letter-spacing: -.026em; }
h3 { font-size: 15px; font-weight: 700; letter-spacing: -.012em; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 9px 14px; border-radius: 9px; border: 1px solid transparent; font-size: 13px; font-weight: 650; line-height: 1.25; white-space: nowrap; }
.button svg { width: 17px; height: 17px; }
.primary { background: var(--accent); color: white; }
.primary:hover:not(:disabled) { background: var(--accent-hover); }
.secondary { background: var(--surface); border-color: var(--line); color: var(--ink); }
.secondary:hover:not(:disabled), .icon-button:hover:not(:disabled) { background: var(--tint); }
.icon-button { display: inline-grid; place-items: center; width: 33px; height: 33px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--accent); }
.icon-button svg { width: 16px; height: 16px; }

.source-top { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(260px, 1fr); gap: 19px; align-items: stretch; }
.photo-panel { display: grid; grid-template-rows: minmax(200px, 1fr) auto; gap: 10px; min-width: 0; }
.hero-photo { position: relative; overflow: hidden; min-height: 275px; border-radius: 15px; background: #e2d4bd; isolation: isolate; }
.hero-photo img { width: 100%; height: 100%; position: absolute; inset: 0; object-fit: cover; object-position: center 54%; }
.hero-photo::after { position: absolute; z-index: 1; content: ''; inset: 45% 0 0; background: linear-gradient(0deg, #1c1f15a6, #1c1f1500 95%); pointer-events: none; }
.photo-tag { position: absolute; z-index: 2; top: 15px; left: 15px; display: inline-flex; align-items: center; gap: 6px; padding: 6px 9px; font-size: 11px; font-weight: 690; border-radius: 7px; background: #fffdf2ed; color: #373b2e; }
.photo-tag svg { width: 14px; height: 14px; }
.photo-caption { position: absolute; z-index: 2; bottom: 17px; left: 21px; color: white; }
.photo-caption strong { display: block; font-size: clamp(21px, 2.6vw, 37px); font-weight: 750; letter-spacing: -.04em; line-height: 1.09; }
.photo-caption span { display: block; margin-top: 4px; font-size: 12px; color: #fffdf4; }
.photo-roles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.photo-role { display: grid; grid-template-columns: 43px minmax(0, 1fr) 14px; align-items: center; gap: 8px; min-width: 0; padding: 7px; text-align: left; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); }
.photo-role:hover:not(:disabled) { border-color: #b3bea2; background: #fbfcf4; }
.photo-role img { width: 43px; height: 42px; object-fit: cover; border-radius: 6px; }
.photo-role strong, .photo-role small { display: block; overflow: hidden; text-overflow: ellipsis; }
.photo-role strong { font-size: 12px; line-height: 1.2; }
.photo-role small { margin-top: 4px; color: var(--muted); font-size: 10.5px; white-space: nowrap; }
.role-upload { color: #606a52; width: 14px; height: 14px; }
.facts { padding: 18px 19px 14px; display: grid; gap: 10px; align-content: start; }
.facts h2 { margin-bottom: 2px; }
.field { display: grid; gap: 4px; font-size: 12px; font-weight: 620; color: #4e5349; }
.field input, .field textarea, .field select { width: 100%; padding: 8px 10px; min-height: 35px; border: 1px solid #e1e1d6; border-radius: 8px; color: var(--ink); font-size: 13px; font-weight: 530; background: #faf9f4; }
.field textarea { resize: vertical; }
.field input:hover, .field textarea:hover, .field select:hover { border-color: #c5c8b9; }
.checkbox { display: inline-flex; gap: 7px; align-items: center; font-size: 13px; color: var(--ink); }
input[type=checkbox] { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.logo-row { border-top: 1px solid var(--line); margin-top: 3px; padding-top: 10px; display: flex; gap: 7px; align-items: center; justify-content: space-between; }
.logo-row span { min-width: 0; }
.logo-row strong, .logo-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logo-row strong { font-size: 12px; }
.logo-row small { font-size: 11px; color: var(--muted); }
.upload { padding: 6px 9px; min-height: 33px; font-size: 11px; }
.upload svg { width: 14px; height: 14px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; margin: 24px 0 11px; }
.source-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
.source-card { display: grid; grid-template-columns: 37px minmax(0, 1fr); gap: 8px 11px; align-items: center; padding: 12px 13px; }
.source-card p { color: var(--muted); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.tile-icon { display: grid; width: 36px; height: 36px; place-items: center; background: var(--tint); color: var(--accent); border-radius: 9px; }
.tile-icon svg { width: 18px; height: 18px; }
.source-upload { grid-column: 1/-1; display: flex; align-items: center; justify-content: center; gap: 7px; padding: 7px 5px; border-radius: 7px; border: 1px dashed #d9ddcc; background: #f9faf4; font-size: 11.5px; font-weight: 620; color: var(--accent); }
.source-upload:hover:not(:disabled) { background: var(--tint); border-color: #aab79a; }
.source-upload svg { width: 14px; height: 14px; }

.actions { z-index: 4; position: sticky; bottom: 0; padding: 12px var(--pad); border-top: 1px solid var(--line); background: #fcfbf7f5; backdrop-filter: blur(8px); }
.actions-inner { max-width: 1320px; margin-inline: auto; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 12px; }
.actions-inner > .primary { justify-self: end; }
.quiet { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; }
.quiet svg { width: 15px; height: 15px; }
.step-count { color: var(--muted); font-size: 12px; white-space: nowrap; }

.analysis-layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); align-items: start; gap: 16px; }
.reviews-panel, .evidence-card { padding: 20px; min-width: 0; }
.panel-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 16px; }
.panel-heading > div { min-width: 0; }
.panel-heading p { font-size: 12px; color: var(--muted); margin-top: 4px; overflow-wrap: anywhere; }
.evidence { display: grid; gap: 14px; min-width: 0; }
.column-select { margin-bottom: 12px; }
.theme-list { display: grid; gap: 9px; }
.theme { padding: 11px 13px; border-radius: 9px; background: #f5f6ef; border: 1px solid #e7eadf; }
.theme-select { display: flex; gap: 8px; align-items: center; cursor: pointer; }
.theme-select strong { font-size: 14px; }
.count { margin-left: auto; min-width: 24px; padding: 2px 6px; text-align: center; font-size: 11px; font-weight: 750; border-radius: 99px; background: #e3e9d7; color: #455733; }
.theme p, .evidence-card ul, .theme ul { color: var(--muted); font-size: 13px; }
.theme p { margin: 5px 0 6px 24px; }
summary { color: var(--accent); cursor: pointer; font-size: 12px; font-weight: 670; }
.theme summary { margin-left: 24px; }
.theme ul, .evidence-card ul { margin: 8px 0 4px; padding-left: 20px; }
.theme li + li, .evidence-card li + li { margin-top: 6px; }
.method-note { color: var(--muted); font-size: 11px; margin-top: 12px; }
.evidence-card .field { margin-top: 13px; }
.evidence-media { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 8px; margin-top: 9px; }
.evidence-media figure { margin: 0; min-width: 0; }
.evidence-media img { width: 100%; height: 74px; object-fit: contain; background: var(--soft); border-radius: 6px; }
.evidence-media figcaption { font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { color: var(--muted); font-size: 13px; padding: 10px 0; }

.brief-intro { padding: 13px 15px; display: flex; align-items: center; gap: 10px; }
.brief-intro h2 { font-size: 16px; }
.brief-intro p { color: var(--muted); font-size: 12px; margin-top: 3px; }
.format-chip { display: inline-flex; padding: 4px 8px; border-radius: 7px; background: var(--soft); color: #53594e; font-size: 11px; font-weight: 650; white-space: nowrap; }
.brief-intro .format-chip { margin-left: auto; }
.brief-notes { padding: 12px 14px; background: var(--tint); border-radius: 10px; margin-top: 12px; }
.brief-notes p { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 4px; }
.brief-list { display: grid; gap: 10px; margin-top: 14px; }
.brief-row { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: start; gap: 13px; padding: 15px; }
.brief-number { display: grid; width: 36px; height: 36px; place-items: center; background: var(--soft); color: var(--muted); border-radius: 9px; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.brief-fields { display: grid; grid-template-columns: minmax(105px, .8fr) minmax(0, 1.2fr); gap: 5px 10px; }
.brief-fields p { grid-column: 1/-1; font-size: 11px; color: var(--muted); }
.brief-tools { display: grid; gap: 8px; justify-items: end; }
.pilot-chip { background: var(--tint); color: var(--accent); }
.move-controls { display: flex; gap: 4px; }

.preview-toolbar { display: flex; gap: 12px; justify-content: space-between; align-items: center; margin-bottom: 15px; }
.segmented { display: flex; gap: 3px; background: #edede4; border: 1px solid var(--line); padding: 3px; border-radius: 10px; }
.segmented button { border: 1px solid transparent; padding: 7px 11px; border-radius: 7px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 650; }
.segmented button[aria-pressed=true] { border-color: #e4e4d9; background: var(--surface); color: var(--accent); }
[data-compact][aria-pressed=true] { background: var(--tint); border-color: #cbd6bd; }
.slide-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: start; }
.slide-grid.compact { grid-template-columns: repeat(auto-fill, minmax(115px, 145px)); }
.slide-card { display: block; padding: 8px; width: 100%; min-width: 0; text-align: left; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.slide-card:hover { border-color: #aab59b; }
.slide-preview { position: relative; width: 100%; overflow: hidden; aspect-ratio: 3/4; container-type: inline-size; border-radius: 7px; font-family: Inter, 'Segoe UI', system-ui, sans-serif; }
.slide-preview > * { position: absolute; display: block; margin: 0; }
.slide-preview span { white-space: pre-wrap; overflow-wrap: anywhere; }
.slide-name { display: block; padding: 9px 2px 2px; font-size: 12px; font-weight: 680; }
.export-help { margin-top: 18px; padding: 13px 15px; }
.export-help summary svg { width: 17px; height: 17px; margin-right: 4px; }
.export-help ol { margin: 12px 0 8px; padding-left: 22px; }
.export-help li + li { margin-top: 5px; }
.export-help li, .export-help p { font-size: 13px; color: var(--muted); }
.slide-dialog { width: min(490px, 90vw, calc(65vh + 32px)); border: 1px solid var(--line); background: var(--surface); border-radius: 14px; padding: 14px; }
.slide-dialog::backdrop { background: #171c14b3; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.toast { position: fixed; z-index: 7; max-width: min(440px, calc(100vw - 28px)); bottom: 77px; right: 20px; padding: 10px 14px; border-radius: 9px; color: white; background: #384830; box-shadow: 0 5px 20px #262e2242; font-size: 13px; }
.toast.error { background: #853e2b; }

@media (min-width: 1400px) {
  :root { --side: 252px; }
  .hero-photo { min-height: 328px; }
  .facts { gap: 14px; padding: 22px; }
}

@media (max-width: 1110px) {
  :root { --side: 194px; --pad: 27px; }
  .sidebar { padding-inline: 11px; }
  .step-nav a { gap: 6px; }
  .photo-role { grid-template-columns: 34px minmax(0, 1fr); gap: 5px; }
  .photo-role img { width: 34px; height: 37px; }
  .role-upload { display: none; }
}

@media (max-width: 860px) {
  :root { --pad: 19px; }
  .workspace { display: block; }
  .sidebar { position: static; height: auto; gap: 12px; padding: 10px var(--pad); border-right: 0; border-bottom: 1px solid var(--line); }
  .project-tile, .sidebar-bottom { display: none; }
  .brand { padding: 0; font-size: 15px; }
  .brand-mark { width: 30px; height: 30px; border-radius: 8px; }
  .brand-mark svg { width: 17px; height: 17px; }
  .step-nav { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
  .step-nav a { grid-template-columns: auto 1fr; justify-content: start; gap: 5px; padding: 7px 6px; min-height: 35px; line-height: 1.18; }
  .step-number { display: none; }
  .topbar { height: 44px; }
  .stage { padding-top: 25px; }
  .main { min-height: calc(100dvh - 100px); }
}

@media (max-width: 610px) {
  :root { --pad: 14px; }
  .step-nav a { font-size: 10px; }
  .nav-icon svg { width: 14px; height: 14px; }
  .page-heading { margin-bottom: 17px; }
  .page-heading h1 { font-size: 34px; }
  .page-heading p { margin-top: 8px; }
  .source-top, .analysis-layout { grid-template-columns: 1fr; gap: 12px; }
  .hero-photo { min-height: 224px; }
  .photo-role { grid-template-columns: 31px minmax(0, 1fr); padding: 5px; }
  .photo-role img { width: 31px; height: 34px; }
  .photo-role strong { font-size: 10px; }
  .photo-role small { font-size: 9px; }
  .source-cards { grid-template-columns: 1fr; gap: 7px; }
  .source-card { grid-template-columns: 35px minmax(0, 1fr) auto; gap: 8px; padding: 8px; }
  .source-upload { grid-column: auto; font-size: 10px; max-width: 105px; }
  .source-upload svg { display: none; }
  .actions-inner { grid-template-columns: 1fr auto; }
  .step-count { display: none; }
  .quiet { line-height: 1.2; }
  .brief-row { grid-template-columns: 28px minmax(0, 1fr) auto; gap: 7px; padding: 10px 8px; }
  .brief-number { width: 27px; height: 27px; }
  .brief-fields { grid-template-columns: 1fr; }
  .brief-tools { gap: 5px; }
  .move-controls { display: grid; }
  .brief-intro { align-items: flex-start; }
  .brief-intro .tile-icon { display: none; }
  .slide-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .slide-card { padding: 6px; }
  .segmented button, .preview-toolbar > .button { font-size: 10px; padding-inline: 6px; }
  .preview-toolbar > .button svg { display: none; }
  .reviews-panel, .evidence-card { padding: 14px; }
}

@media (prefers-reduced-motion: no-preference) {
  .button, .step-nav a, .photo-role, .source-upload { transition: background-color .15s ease, border-color .15s ease; }
}
