/* Analysis pages (/analysis, /analysis/order, /analysis/orders).
   Tokens come from app.css. Own class names on purpose: mobile.css forces
   .card{grid-column:span 12} for the dashboard grid, so these pages never
   put .card inside their own grids. */

.app-shell.an-shell{ padding: 100px var(--gutter) 64px; max-width: 1040px; margin: 0 auto; }
body::after{
  content:''; position: fixed; top: 0; left: 0; right: 0; height: 84px;
  background: linear-gradient(var(--bg) 58%, transparent);
  pointer-events: none; z-index: 99;
}
.page-head{
  padding-bottom: 22px; margin-bottom: 28px; border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap;
}
.page-head > div:first-child{ min-width: 0; flex: 1 1 420px; }
.page-title{ font-family: var(--f-display); font-weight: 500; font-size: clamp(2rem, 4vw, 2.8rem); letter-spacing: -0.02em; line-height: 1.05; text-wrap: balance; }
.page-title em{ font-style: italic; color: var(--accent); }
.page-head .lede{ margin-top: 12px; max-width: 62ch; }
.back-link{ display: inline-flex; gap: 6px; align-items: center; color: var(--ink-3); font-size: 13px; text-decoration: none; margin-bottom: 12px; }
.back-link:hover{ color: var(--ink-1); }

/* Sections: a serif heading, generous space above, tight below. */
.an-section{ margin-top: 48px; }
.an-section:first-of-type{ margin-top: 0; }
.an-h2{ font-family: var(--f-display); font-weight: 500; font-size: 1.5rem; letter-spacing: -0.015em; line-height: 1.15; margin-bottom: 8px; }
.an-sub{ color: var(--ink-2); font-size: 14.5px; line-height: 1.6; max-width: 66ch; margin-bottom: 18px; }
.an-prose{ color: var(--ink-1); font-size: 15px; line-height: 1.7; max-width: 68ch; white-space: pre-wrap; overflow-wrap: anywhere; }
.muted{ color: var(--ink-3); }
.small{ font-size: 13px; }

/* A flat surface (tonal layer + hairline), no shadow at rest. */
.an-surface{ background: var(--bg-surface); border: 1px solid var(--line); border-radius: 16px; padding: 22px 24px; }
.an-surface + .an-surface{ margin-top: 14px; }

/* Row list: records separated by dashed hairlines inside one surface. */
.an-rows{ background: var(--bg-surface); border: 1px solid var(--line); border-radius: 16px; }
.an-row{ padding: 22px 24px; border-top: 1px dashed var(--line-strong); }
.an-row:first-child{ border-top: none; }
a.an-row{ display: block; color: inherit; text-decoration: none; transition: background .15s; }
a.an-row:hover{ background: color-mix(in oklab, var(--bg-soft) 70%, transparent); }
a.an-row:first-child{ border-radius: 16px 16px 0 0; }
a.an-row:last-child{ border-radius: 0 0 16px 16px; }
a.an-row:only-child{ border-radius: 16px; }

/* Service rows on the overview */
.svc{ display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 12px 32px; align-items: start; }
.svc__name{ font-family: var(--f-display); font-weight: 500; font-size: 1.3rem; letter-spacing: -0.01em; line-height: 1.2; }
.svc__what{ color: var(--ink-2); font-size: 14.5px; line-height: 1.65; margin-top: 8px; max-width: 64ch; }
.svc__send{ color: var(--ink-3); font-size: 13px; line-height: 1.5; margin-top: 10px; }
.svc__send b{ color: var(--ink-2); font-weight: 600; }
.svc__side{ display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.svc__price{ font-family: var(--f-display); font-weight: 600; font-size: 1.6rem; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1; }
.svc__terms{ color: var(--ink-3); font-size: 12.5px; line-height: 1.5; }
.prog-list{ margin-top: 16px; display: flex; flex-direction: column; }
.prog-item{ display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; align-items: center; padding: 12px 0; border-top: 1px dashed var(--line); }
.prog-item__t{ font-weight: 600; font-size: 14.5px; }
.prog-item__m{ color: var(--ink-3); font-size: 12.5px; margin-top: 2px; }
.prog-item__d{ color: var(--ink-2); font-size: 13.5px; line-height: 1.55; margin-top: 4px; }

/* Sample analysis */
.sample{ display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 28px; }
.sample__title{ font-family: var(--f-display); font-weight: 500; font-size: 1.2rem; line-height: 1.25; margin-bottom: 10px; }
.sample__by{ color: var(--ink-3); font-size: 12.5px; margin-top: 14px; }
.note-list{ display: flex; flex-direction: column; }
.note{ display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 12px; padding: 10px 0; border-top: 1px dashed var(--line); align-items: start; }
.note:first-child{ border-top: none; padding-top: 0; }
.note__t{
  justify-self: start; font-family: var(--f-mono); font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums;
  color: var(--accent-ink); padding: 4px 8px; border-radius: 6px; text-decoration: none;
  background: color-mix(in oklab, var(--accent) 12%, var(--bg-soft));
  border: 1px solid color-mix(in oklab, var(--accent) 40%, var(--line));
}
a.note__t:hover{ background: color-mix(in oklab, var(--accent) 22%, var(--bg-soft)); }
.note__text{ font-size: 14px; line-height: 1.6; color: var(--ink-1); overflow-wrap: anywhere; }
.note__sub{ color: var(--ink-3); font-size: 12px; margin-bottom: 2px; }

/* Proof: a short data list, labels in mono because they label data. */
.facts{ display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 12px 24px; margin-top: 18px; max-width: 720px; }
.facts dt{ font-family: var(--f-mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); padding-top: 3px; }
.facts dd{ margin: 0; color: var(--ink-1); font-size: 14.5px; line-height: 1.55; }
.facts dd .num{ font-family: var(--f-display); font-weight: 600; font-size: 1.15rem; font-variant-numeric: tabular-nums; }

/* Order form */
.order-layout{ display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
.order-main{ display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.order-side{ position: sticky; top: 92px; }
.order-side__name{ font-family: var(--f-display); font-weight: 500; font-size: 1.2rem; line-height: 1.2; }
.order-side__price{ font-family: var(--f-display); font-weight: 600; font-size: 1.5rem; margin-top: 10px; font-variant-numeric: tabular-nums; }
.order-side__eta{ color: var(--ink-3); font-size: 13px; line-height: 1.5; margin: 6px 0 18px; }
.an-surface .field + .field{ margin-top: 16px; }
/* Field labels here read as words, not data codes: sentence case, body face. */
.an-shell .field label{ font-family: var(--f-body); font-size: 13.5px; font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--ink-1); }
.field textarea{ min-height: 96px; resize: vertical; line-height: 1.5; }
.field .hint{ color: var(--ink-3); font-size: 12.5px; line-height: 1.5; }
.pair{ display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.pair + .pair, .pair + .field, .field + .pair{ margin-top: 16px; }
.pick-list{ display: flex; flex-direction: column; gap: 8px; max-height: 380px; overflow: auto; margin-top: 10px; }
.pick{ display: flex; gap: 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; background: var(--bg-soft); transition: border-color .15s, background .15s; }
.pick:hover{ border-color: var(--line-strong); }
.pick.sel{ border-color: var(--accent); background: color-mix(in oklab, var(--accent) 8%, var(--bg-soft)); }
.pick input{ flex-shrink: 0; width: 16px; height: 16px; accent-color: var(--accent); }
.pick__t{ font-weight: 600; font-size: 14px; overflow-wrap: anywhere; }
.pick__m{ color: var(--ink-3); font-size: 12.5px; margin-top: 2px; }
.check{ display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--ink-2); margin-bottom: 12px; line-height: 1.55; cursor: pointer; }
.check input{ margin-top: 3px; flex-shrink: 0; width: 16px; height: 16px; accent-color: var(--accent); }
.check a{ color: var(--accent-ink); }
.notice{ padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--bg-soft); color: var(--ink-2); font-size: 13.5px; line-height: 1.55; margin-bottom: 18px; }
.form-error{ margin-top: 10px; }

/* Orders list + summary */
.o-row{ display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 20px; align-items: center; }
.o-row__t{ font-family: var(--f-display); font-weight: 500; font-size: 1.15rem; line-height: 1.25; overflow-wrap: anywhere; }
.o-row__p{ color: var(--ink-3); font-size: 12.5px; margin-top: 2px; }
.o-row__s{ color: var(--ink-2); font-size: 13.5px; margin-top: 6px; }
.o-row__go{ color: var(--accent-ink); font-size: 13px; font-weight: 600; white-space: nowrap; }
.state-dot{ display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 8px; vertical-align: 1px; background: var(--ink-4); }
.state-dot[data-s="open"]{ background: var(--warning); }
.state-dot[data-s="done"]{ background: var(--accent); }
.rep-meta{ color: var(--ink-3); font-size: 13px; margin-top: 10px; }
.two-lists{ display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.an-list{ margin: 0; padding-left: 18px; color: var(--ink-1); font-size: 14.5px; line-height: 1.65; }
.an-list li + li{ margin-top: 6px; }
.an-h3{ font-family: var(--f-display); font-weight: 500; font-size: 1.1rem; margin-bottom: 10px; }
.drill + .drill{ margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line); }
.drill__t{ font-weight: 600; font-size: 14.5px; }
.drill__d{ color: var(--ink-2); font-size: 14px; line-height: 1.6; margin-top: 4px; white-space: pre-wrap; }
.vid-block + .vid-block{ margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.vid-block__head{ display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.vid-block__t{ font-weight: 600; font-size: 15px; overflow-wrap: anywhere; }
.kv{ display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 8px 16px; font-size: 14px; }
.kv dt{ color: var(--ink-3); }
.kv dd{ margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.empty{ padding: 48px 24px; text-align: center; background: var(--bg-surface); border: 1px dashed var(--line-strong); border-radius: 16px; }
.empty__t{ font-family: var(--f-display); font-weight: 500; font-size: 1.3rem; margin-bottom: 8px; }
.empty p{ color: var(--ink-3); font-size: 14px; margin-bottom: 16px; }
.skeleton{ height: 88px; border-radius: 16px; background: var(--bg-surface); border: 1px solid var(--line); }

@media (max-width: 860px){
  .app-shell.an-shell{ padding-left: 16px !important; padding-right: 16px !important; }
  .order-layout{ grid-template-columns: minmax(0, 1fr); }
  .order-side{ position: static; }
  .sample{ grid-template-columns: minmax(0, 1fr); gap: 20px; }
}
@media (max-width: 640px){
  .svc{ grid-template-columns: minmax(0, 1fr); }
  .svc__side{ flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
  .svc__side .btn{ width: 100%; }
  .an-row, .an-surface{ padding: 18px 16px; }
  .pair, .two-lists{ grid-template-columns: minmax(0, 1fr); }
  .facts{ grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .facts dd{ margin-bottom: 10px; }
  .kv{ grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .kv dd{ margin-bottom: 8px; }
  .o-row{ grid-template-columns: minmax(0, 1fr); }
  .prog-item{ grid-template-columns: minmax(0, 1fr); }
  .prog-item .btn{ width: 100%; }
}

/* mobile.css gives .page-head children a flex-basis meant for rows; in the
   stacked phone layout that becomes a tall empty gap under the lede. */
@media (max-width: 860px){ .an-shell .page-head > div:first-child, .an-shell .page-head > *{ flex: 0 0 auto; } }
