/* ============================================================
   KAMBA — App pages (Dashboard, Legal, Builder)
   Direction C · Evolution. Depends on tokens.css + styles.css.
   ============================================================ */

.kicker { font-size: 12px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--wood-text); margin: 0 0 14px; }
.dot-sage { width: 11px; height: 11px; border-radius: 50%; background: var(--sage); display: inline-block; }
.nav-app { font-size: var(--fs-body-s); font-weight: 500; color: var(--ink-soft); text-decoration: none; }
.nav-app:hover { color: var(--kamba-green); }
.header-step { font-size: var(--fs-meta); color: var(--muted); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--sage-tint-strong); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; color: var(--kamba-green); }

/* Shared frame elevation drawing (used in previews & thumbnails) */
.frame { width: var(--frame-w); height: var(--frame-h); border: 2px solid var(--ink-soft); border-radius: 4px; background: #fff; display: flex; flex-direction: column; justify-content: space-evenly; padding: 7px 0; }
.frame .shelf { height: 2px; background: var(--sage); margin: 0 6px; }
.dim { position: absolute; font-size: 11px; font-weight: 600; color: var(--wood-text); }
.dim--top { top: -22px; left: 0; right: 0; text-align: center; }
.dim--side { top: 0; bottom: 22px; left: -28px; display: flex; align-items: center; }
.dim--side span { writing-mode: vertical-rl; transform: rotate(180deg); }
.elevation { position: relative; }
.elevation__caption { margin-top: 9px; font-size: 10px; font-weight: 700; letter-spacing: 0.06em; color: var(--kamba-green); text-align: center; }
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ============================================================
   DASHBOARD
   ============================================================ */
.dash-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-bottom: 30px; }
.counters { display: flex; gap: 12px; }
.counter { background: var(--surface); border: 1px solid var(--border-soft); border-radius: 13px; padding: 14px 20px; text-align: center; min-width: 92px; }
.counter__num { font-size: 28px; line-height: 1; color: var(--kamba-green); }
.counter__label { font-size: 12px; color: var(--muted); margin-top: 4px; }

.project-card { overflow: hidden; display: flex; flex-direction: column; }
.project-card__thumb { height: 150px; border-bottom: 1px solid var(--border-hair); display: flex; align-items: center; justify-content: center; position: relative;
  background-color: var(--surface-warm);
  background-image: repeating-linear-gradient(0deg, transparent, transparent 15px, rgba(139,168,136,.07) 15px, rgba(139,168,136,.07) 16px),
                    repeating-linear-gradient(90deg, transparent, transparent 15px, rgba(139,168,136,.07) 15px, rgba(139,168,136,.07) 16px); }
.project-card__status { position: absolute; top: 12px; right: 12px; }
.project-card__body { padding: 20px; display: flex; flex-direction: column; flex: 1; }
.project-card__meta { font-size: var(--fs-meta); color: var(--muted); margin-bottom: 14px; }
.project-card__foot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 14px; border-top: 1px solid var(--border-hair); }
.project-card__date { font-size: 12.5px; color: var(--muted); }

.new-tile { text-decoration: none; color: inherit; border: 1.5px dashed #CFC6B4; border-radius: var(--r-lg); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: 260px; background: #FBFAF6; transition: background var(--transition); }
.new-tile:hover { background: var(--alt); }
.new-tile__plus { width: 48px; height: 48px; border-radius: 50%; background: var(--sage-tint); display: flex; align-items: center; justify-content: center; font-size: 24px; line-height: 1; color: var(--kamba-green); }
.new-tile__label { font-weight: 600; font-size: 15px; color: var(--ink-soft); }
.new-tile__sub { font-size: var(--fs-meta); color: var(--muted); }

/* Empty state (reference) */
.empty-state { padding: 70px 32px; text-align: center; }
.logs { display: flex; gap: 14px; justify-content: center; margin-bottom: 26px; }
.log { border-radius: 50%; background: var(--sand); }
.log--sm { width: 52px; height: 52px; border: 3px solid var(--border); box-shadow: inset 0 0 0 7px #EFE7D8, inset 0 0 0 10px var(--border); }
.log--lg { width: 66px; height: 66px; border: 3px solid var(--wood); box-shadow: inset 0 0 0 9px #EFE7D8, inset 0 0 0 13px var(--wood); }

/* ============================================================
   LEGAL
   ============================================================ */
.legal { display: grid; grid-template-columns: 230px 1fr; gap: 48px; align-items: start; padding-top: 46px; padding-bottom: 80px; }
.legal__nav { position: sticky; top: calc(var(--header-h) + 26px); }
.legal__links { display: flex; flex-direction: column; gap: 4px; }
.legal__links a { text-align: left; font-weight: 500; font-size: var(--fs-body-s); padding: 11px 14px; border-radius: var(--r-sm); color: var(--ink-soft); text-decoration: none; transition: background var(--transition-fast), color var(--transition-fast); }
.legal__links a:hover { background: var(--alt); }
.legal__links a[aria-current="page"] { background: var(--sage-tint); color: var(--kamba-green); font-weight: 700; }
.legal__contact { margin-top: 22px; padding: 16px; background: var(--alt); border-radius: var(--r-md); font-size: 12.5px; line-height: 1.5; color: var(--muted); }
.legal__contact strong { color: var(--kamba-green); }
.legal-doc { max-width: 660px; margin-bottom: 60px; scroll-margin-top: calc(var(--header-h) + 20px); }
.legal-doc__updated { font-size: var(--fs-meta); color: var(--muted); margin: 0 0 8px; }
.legal-doc__section { margin-bottom: 30px; }
.legal-h2 { font-family: var(--font-display); font-weight: 400; font-size: 23px; margin: 0 0 10px; }
.legal-p { font-size: 15.5px; line-height: var(--lh-loose); color: var(--ink-soft); margin: 0; }
.legal-callout { background: var(--amber-bg); border: 1px solid var(--amber-border); border-radius: var(--r-lg); padding: 22px; }
.legal-callout .legal-h2 { font-size: 21px; }

/* ---- Production legal documents: content elements ----
   The export demo only needed h2 + p. Real Kamba legal pages also carry
   intro paragraphs, lists, data tables, a rights grid and several callout
   variants. These rules style that richer content inside .legal-doc while
   keeping the export's two-column shell + typography. */
.legal-doc__section p { font-size: 15.5px; line-height: var(--lh-loose); color: var(--ink-soft); margin: 0; }
.legal-doc__section[id] { scroll-margin-top: calc(var(--header-h) + 20px); }
/* vertical rhythm between blocks (paragraphs, lists, tables, callouts) */
.legal-doc__section > * + *,
.legal-doc__section > div > * + * { margin-top: 14px; }
.legal-doc__section ul,
.legal-doc__section ol { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 8px; }
.legal-doc__section li { font-size: 15.5px; line-height: var(--lh-loose); color: var(--ink-soft); }
.legal-doc__section strong { color: var(--ink); font-weight: 600; }
.legal-doc a { color: var(--kamba-green); text-decoration: none; font-weight: 500; }
.legal-doc a:hover { text-decoration: underline; }

/* Data tables (privacy: data collected / cookies / third parties) */
.data-table-wrap { overflow-x: auto; border: 1px solid var(--border-soft); border-radius: var(--r-md); }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th { text-align: left; font-weight: 700; font-size: 11.5px; letter-spacing: 0.03em; text-transform: uppercase; color: var(--wood-text); background: var(--alt); padding: 10px 14px; border-bottom: 1px solid var(--border-soft); }
.data-table td { padding: 11px 14px; color: var(--ink-soft); line-height: 1.55; border-bottom: 1px solid var(--border-hair); vertical-align: top; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table td:first-child { font-weight: 600; color: var(--ink); white-space: nowrap; }

/* Rights grid (privacy: your rights) */
.rights-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.right-card { background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--r-md); padding: 14px 16px; }
.right-card-title { font-weight: 700; font-size: 14px; color: var(--kamba-green); margin-bottom: 4px; }
.right-card p { font-size: 13.5px; line-height: 1.55; color: var(--ink-soft); margin: 0; }

/* Callout label + variants (default amber, warning red, sage green).
   Scoped under .legal-callout so the label colour wins over `.legal-callout p`. */
.legal-callout .legal-callout__label { font-size: 11.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: #8A5A14; margin: 0 0 8px; }
.legal-callout p { color: #5C4A2A; }
.legal-callout--warning { background: #FBF0EC; border-color: #E7C3B5; }
.legal-callout--warning .legal-callout__label { color: #B0442B; }
.legal-callout--warning p { color: #6B2E1E; }
.legal-callout--sage { background: var(--sage-tint); border-color: rgba(139, 168, 136, 0.30); }
.legal-callout--sage .legal-callout__label { color: var(--sage-dark); }
.legal-callout--sage p { color: var(--ink-soft); }

/* Legal hub index (legal.html): a list of policy cards (title + one-line description). */
.legal-index { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.legal-index__item { margin: 0; }
.legal-index__link { display: block; padding: 14px 18px; background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--r-md); text-decoration: none; transition: border-color var(--transition-fast), background var(--transition-fast); }
.legal-index__link:hover { border-color: var(--kamba-green); background: var(--alt); text-decoration: none; }
.legal-index__title { display: block; font-weight: 700; font-size: 15px; color: var(--kamba-green); margin-bottom: 3px; }
.legal-index__desc { display: block; font-size: 13.5px; line-height: 1.5; color: var(--ink-soft); }

/* DRAFT marker — discreet but visible banner on legal pages pending counsel review.
   Removed at legal sign-off (later lot). */
.legal-draft { display: flex; align-items: center; gap: 8px; margin: 0 0 20px; padding: 8px 14px; background: #FBF0EC; border: 1px solid #E7C3B5; border-radius: var(--r-md); font-size: 12.5px; font-weight: 600; letter-spacing: 0.02em; color: #B0442B; }

/* Publisher identity line at the foot of every legal page (e-commerce identification). */
.legal-identity { margin-top: 36px; padding-top: 18px; border-top: 1px solid var(--border-soft); font-size: 12px; line-height: 1.5; color: var(--muted); }
.legal-identity a { color: inherit; text-decoration: underline; }

/* Responsive: rights grid + table cells collapse on mobile */
@media (max-width: 860px) {
  .rights-grid { grid-template-columns: 1fr; }
  .data-table td:first-child { white-space: normal; }
}

/* ============================================================
   BUILDER
   ============================================================ */
.builder { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; align-items: start; padding-top: 32px; padding-bottom: 60px; }
.builder__title { font-size: var(--fs-display-m); line-height: 1.08; margin: 0 0 24px; }

/* Stepper */
.stepper { list-style: none; margin: 0 0 26px; padding: 0; display: flex; align-items: center; }
.stepper__item { display: flex; align-items: center; flex: 1 1 auto; min-width: 0; }
.stepper__item:last-child { flex: 0 0 auto; }
/* Button is rigid: it always takes its content width and never shrinks, so the active
   (bold) label can never overflow onto the next node. The connector line is the only
   flexible part — it absorbs the slack and shrinks first when space is tight (#PO). */
.stepper__btn { display: flex; align-items: center; gap: 9px; background: none; border: none; padding: 0; cursor: pointer; flex: 0 0 auto; }
.stepper__mark { flex: none; width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; border: 1.5px solid var(--border); background: var(--surface); color: var(--muted); transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast); }
.stepper__label { font-size: var(--fs-meta); font-weight: 500; color: var(--muted); white-space: nowrap; }
.stepper__line { flex: 1 1 8px; height: 1.5px; background: #E0DACE; margin: 0 10px; min-width: 8px; }
.stepper__line.is-filled { background: var(--sage); }
.stepper__item.is-active .stepper__mark { background: var(--kamba-green); color: #fff; border-color: transparent; }
.stepper__item.is-active .stepper__label { color: var(--ink); font-weight: 700; }
.stepper__item.is-done .stepper__mark { background: var(--sage); color: #fff; border-color: transparent; }

/* Step panels */
@keyframes stepIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.step-panel { animation: stepIn .28s ease; }
/* W-L4 (WCAG 2.3.3): honour prefers-reduced-motion — skip the panel slide-in. */
@media (prefers-reduced-motion: reduce) {
  .step-panel { animation: none; }
}
.step-panel__intro { font-size: var(--fs-body-s); line-height: 1.55; color: var(--ink-soft); margin: 0 0 18px; }
.step-panel__hint { font-size: 12.5px; color: var(--muted); margin: 16px 0 9px; }
.example-chip { text-align: left; font-family: var(--font-sans); font-size: 13px; color: var(--ink-soft); background: var(--alt); border: 1px solid var(--border-soft); border-radius: 9px; padding: 8px 12px; cursor: pointer; transition: background var(--transition-fast); }
.example-chip:hover { background: #ECE7DC; }

.control-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--border-hair); }
.control-row--last { border-bottom: none; }
.control-row__name { font-weight: 600; font-size: 15px; }
.control-row__hint { font-size: 12.5px; color: var(--muted); }
.number-control { display: flex; align-items: center; gap: 12px; }
.number-control__value { min-width: 74px; text-align: center; }
.number-control__value .display { font-size: 24px; }
/* Typed dimensions: the value is an editable numeric input that still reads as the
   big display number; +/- steppers stay. A subtle underline signals editability. */
.number-control__input {
  width: 4ch; box-sizing: content-box; font-variant-numeric: tabular-nums;
  padding: 1px 2px; margin: 0; text-align: center;
  color: inherit; background: transparent;
  /* Perceptible edit affordance at rest (≥3:1) — not only on hover/focus (WCAG 1.4.11). */
  border: none; border-bottom: 1px solid var(--border-control); border-radius: 0;
  -moz-appearance: textfield; appearance: textfield;
  transition: border-color var(--transition-fast);
}
.number-control__input::-webkit-outer-spin-button,
.number-control__input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.number-control__input:hover { border-bottom-color: var(--ink-soft); }
.number-control__input:focus { border-bottom-color: var(--ink); }
/* Visible keyboard focus ring (≥3:1 non-text) — replaces outline:none (WCAG 2.4.7). */
.number-control__input:focus-visible { outline: 2px solid var(--kamba-green); outline-offset: 2px; border-radius: 2px; }
.unit { font-size: var(--fs-meta); color: var(--muted); }
.info-note { margin-top: 18px; padding: 14px 16px; background: var(--alt); border-radius: 11px; font-size: 13.5px; line-height: 1.5; color: var(--ink-soft); }

.seg-group { display: flex; flex-wrap: wrap; gap: 8px; }

.review-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 20px; }
.review-cell { background: var(--bg); border: 1px solid var(--border-hair); border-radius: 10px; padding: 12px 14px; }
.review-cell__label { font-size: 11px; font-weight: 600; letter-spacing: 0.04em; color: var(--wood-text); }
.review-cell__val { font-size: var(--fs-body-s); font-weight: 600; margin-top: 3px; }
.validated-line { display: flex; align-items: center; gap: 9px; font-size: 13.5px; font-weight: 600; color: var(--kamba-green); margin: 0 0 20px; }
.generate-row { display: flex; align-items: center; justify-content: space-between; padding-top: 18px; border-top: 1px solid var(--border-hair); }
.generate-row__caption { font-size: 12.5px; color: var(--muted); }
.generate-row__price { font-size: 30px; line-height: 1; }

.builder__nav { display: flex; align-items: center; justify-content: space-between; margin-top: 18px; }

/* Builder aside / preview */
.builder__aside { position: sticky; top: calc(var(--header-h) + 20px); }
.preview { overflow: hidden; box-shadow: 0 24px 60px -42px rgba(45,45,45,.5); }
.preview__head { display: flex; align-items: center; justify-content: space-between; padding: 16px 22px; border-bottom: 1px solid var(--border-hair); background: var(--surface-warm); }
.preview__title { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: var(--fs-body-s); }
.preview__stage { padding: 30px; background: var(--surface-warm); border-bottom: 1px solid var(--border-hair); display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 280px; }
.preview__stage .frame { border-width: 2.5px; }
.preview__foot { padding: 22px 24px; }
.pdf-note { margin: 4px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--muted); }

.preview-empty { padding: 44px 30px; text-align: center; min-height: 360px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; border-style: dashed; border-color: var(--border); }
.preview-empty__icon { width: 56px; height: 56px; border-radius: 50%; background: var(--alt); display: flex; align-items: center; justify-content: center; }
.preview-empty__frame { width: 22px; height: 30px; border: 2px solid var(--wood); border-radius: 3px; }
.preview-empty__title { font-size: 21px; color: var(--ink-soft); }
.preview-empty__text { font-size: var(--fs-body-s); line-height: 1.55; color: var(--muted); max-width: 290px; margin: 0; }

/* ---- Responsive ---- */
/* Builder folds to a single column on tablet & phone. Split out of the shared
   860 block into its own ≤768 palier (MOB-1) so the builder gets clean phone/
   tablet breakpoints; desktop ≥835 keeps the 2-column layout unchanged. */
@media (max-width: 860px) {
  .dash-head { flex-direction: column; align-items: flex-start; }
}
/* Stepper labels only fit alongside all 4 nodes at desktop widths. Below 1050
   — folded OR narrow 2-column (835–1049) — hide the labels so the nodes never
   crowd/overlap; the numbered marks + the "Step N of 4" header carry progress.
   Desktop ≥1050 keeps the labels (unchanged) (MOB-5). */
@media (max-width: 1049px) {
  .stepper__label { display: none; }
  .stepper__line { margin: 0 6px; }
}
/* Builder folds to a single column ≤900 so iPad portrait (768–834) is
   single-column too (was ≤768 → 2-col, ~375px flow column, illegible). The
   aside preview drops below the form (not sticky). Desktop ≥901 keeps 2-col
   (MOB-1). */
@media (max-width: 900px) {
  .builder { grid-template-columns: 1fr; }
  .builder__aside { position: static; }
}
/* Tablet & phone (≤768) — fold the remaining two-column layouts to one column.
   Legal (sidebar) and the review grid share the 768 palier; desktop ≥769 keeps
   their two-column layouts unchanged (MOB-2). */
@media (max-width: 768px) {
  .legal { grid-template-columns: 1fr; gap: 24px; }
  .legal__nav { position: static; }
  /* Let the 1fr content column shrink below the table's min-content width so the
     wide table scrolls inside its wrapper instead of widening the whole page
     (grid items default to min-width:auto). */
  .legal__content { min-width: 0; }
  .review-grid { grid-template-columns: 1fr; }

  /* Wide legal tables (Subprocessors / Privacy) scroll inside their wrapper
     instead of overflowing the page. A right-edge scroll shadow hints there is
     more to the right; it fades out once scrolled to the end. The cover layer
     (background-attachment: local) rides with the content and masks the shadow
     at the end; the shadow layer (scroll) stays pinned to the wrapper edge. */
  .data-table-wrap {
    background:
      linear-gradient(to left, var(--surface), rgba(255, 255, 255, 0) 28px) 100% 0 / 32px 100% no-repeat local,
      radial-gradient(farthest-side at 100% 50%, rgba(45, 45, 45, 0.16), rgba(45, 45, 45, 0)) 100% 0 / 16px 100% no-repeat scroll;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
}
/* Phone (≤430) — shrink the empty preview placeholder so it does not eat the
   screen when the builder is stacked single-column. */
@media (max-width: 430px) {
  .preview-empty { min-height: 220px; padding: 32px 24px; }
  /* M10 (mobile lot #3) — Review cell labels are 11px on desktop; nudge to 12px
     on phones for legibility. Desktop density unchanged above this breakpoint. */
  .review-cell__label { font-size: 12px; }
}
