/* Owner dashboard: sidebar + content, in the shared printed-paper look. The data is the loud part:
   panels are paper cards with ink outlines, while chart marks stay thin and flat (dataviz rules). */
body.dash { min-height: 100dvh; }
.d-shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100dvh; }
.d-side {
  position: sticky;
  top: 0;
  height: 100dvh;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: calc(18px + env(safe-area-inset-top, 0px)) 14px 18px;
  background: var(--surface) var(--grain);
  border-inline-end: 2px solid var(--outline);
}
.d-logo { display: flex; align-items: center; gap: 10px; padding: 0 6px; font-family: var(--font-display); font-weight: 800; font-size: 1.15rem; text-decoration: none; color: var(--ink); }
.d-logo img { width: 34px; height: 34px; }
.d-place { display: grid; gap: 4px; padding: 12px; border-radius: var(--r-md); background: var(--surface-2); border: 1.5px solid var(--outline); }
.d-place b { font-size: 0.98rem; line-height: 1.3; }
.d-nav { display: grid; gap: 4px; }
.d-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1.5px solid transparent;
  color: var(--ink-2);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.93rem;
}
.d-nav a:hover { background: var(--surface-2); color: var(--ink); }
.d-nav a[aria-current="page"] { background: var(--signal-soft); color: var(--signal-ink); font-weight: 700; border-color: var(--outline); box-shadow: var(--shadow-1); }
.d-nav .ic { width: 22px; text-align: center; font-size: 1.05rem; }
.d-side-foot { margin-top: auto; display: grid; gap: 8px; }

.d-main { min-width: 0; padding: calc(22px + env(safe-area-inset-top, 0px)) max(24px, env(safe-area-inset-right, 0px)) 48px max(24px, env(safe-area-inset-left, 0px)); display: grid; gap: 18px; align-content: start; }
.d-mobile-top { display: none; }
@media (max-width: 1000px) {
  .d-shell { grid-template-columns: minmax(0, 1fr); }
  .d-side { display: none; }
  .d-mobile-top {
    display: grid;
    gap: 10px;
    position: sticky;
    top: 0;
    z-index: 20;
    padding: calc(10px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px));
    background: var(--surface) var(--grain);
    border-bottom: 2px solid var(--outline);
  }
  body.dash::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 21; background: var(--surface); }
  .d-mobile-top .row { display: flex; align-items: center; gap: 10px; }
  .d-mobile-top .row b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  /* the padding keeps the active chip's hard shadow from being clipped by the scroller */
  .d-mobile-top .d-nav { display: flex; overflow-x: auto; gap: 6px; padding: 2px 2px 4px; scrollbar-width: none; }
  .d-mobile-top .d-nav::-webkit-scrollbar { display: none; }
  .d-mobile-top .d-nav a { white-space: nowrap; padding: 6px 12px; background: var(--surface-2); border-color: var(--line-strong); font-size: 0.86rem; }
  .d-mobile-top .d-nav a[aria-current="page"] { background: var(--signal-soft); border-color: var(--outline); }
  .d-main { padding: 16px max(16px, env(safe-area-inset-right, 0px)) 40px max(16px, env(safe-area-inset-left, 0px)); }
}

.d-head { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.d-head h1 { font-family: var(--font-display); font-size: 1.85rem; font-weight: 800; line-height: 1.15; }
.d-head p { color: var(--muted); margin-top: 2px; }
.d-head .actions { margin-inline-start: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.d-banner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; border-radius: var(--r-md); font-weight: 500; border: 2px solid var(--outline); box-shadow: var(--shadow-1); }
.d-banner.info { background: var(--info-soft); color: var(--info-ink); }
.d-banner.warn { background: var(--warn-soft); color: var(--warn-ink); }
.d-banner.signal { background: var(--signal-soft); color: var(--signal-ink); }
.d-banner .btn { margin-inline-start: auto; }

.d-grid { display: grid; gap: 18px; grid-template-columns: repeat(12, minmax(0, 1fr)); }
.d-grid > * { min-width: 0; }
.span-12 { grid-column: span 12; }
.span-8 { grid-column: span 8; }
.span-7 { grid-column: span 7; }
.span-6 { grid-column: span 6; }
.span-5 { grid-column: span 5; }
.span-4 { grid-column: span 4; }
@media (max-width: 1180px) { .span-8, .span-7, .span-5, .span-4 { grid-column: span 6; } }
@media (max-width: 760px) { .span-8, .span-7, .span-6, .span-5, .span-4 { grid-column: span 12; } }

.panel { background: var(--surface) var(--grain); border: 2px solid var(--outline); border-radius: var(--r-lg); box-shadow: var(--shadow-2); padding: 18px; display: grid; gap: 14px; align-content: start; }
.panel-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.panel-head h2 { font-family: var(--font-display); font-size: 1.2rem; font-weight: 800; }
.panel-head p { color: var(--muted); font-size: 0.85rem; flex-basis: 100%; }
.panel-head .side { margin-inline-start: auto; }

/* KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.kpis.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1100px) { .kpis, .kpis.three { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi { background: var(--surface) var(--grain); border: 2px solid var(--outline); border-radius: var(--r-lg); box-shadow: var(--shadow-2); padding: 14px 16px; display: grid; gap: 4px; align-content: start; }
.kpi .label { font-size: 0.82rem; color: var(--muted); font-weight: 600; }
.kpi .value { font-size: 1.8rem; font-weight: 700; line-height: 1.15; }
.kpi .value small { font-size: 0.9rem; color: var(--muted); font-weight: 500; }
.kpi .delta { font-size: 0.8rem; font-weight: 600; display: inline-flex; gap: 4px; align-items: center; }
.kpi .delta.up { color: var(--good-ink); }
.kpi .delta.down { color: var(--bad-ink); }
.kpi .delta.flat { color: var(--muted); }
.kpi svg { width: 100%; height: 30px; margin-top: 4px; }

/* the headline: an ink board, like the landing page's control section */
.hero-impact { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 2fr); gap: 18px; padding: 22px; border-radius: var(--r-xl); background: #231e19 var(--grain); color: #fbf5e9; border: 2px solid #000; box-shadow: 6px 7px 0 var(--signal); }
.hero-impact .big { font-family: var(--font-display); font-size: 3.6rem; font-weight: 800; line-height: 1; }
.hero-impact p { color: #d8ccb4; }
.hero-impact .facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; align-content: center; }
.hero-impact .fact { padding: 12px; border-radius: 12px; border: 1.5px dashed #6b604f; }
.hero-impact .fact b { display: block; font-size: 1.4rem; font-weight: 700; }
.hero-impact .fact span { font-size: 0.82rem; color: #d8ccb4; }
@media (max-width: 760px) { .hero-impact { grid-template-columns: minmax(0, 1fr); } }

.live-strip { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.live-strip .pill { font-size: 0.85rem; padding: 6px 12px; }

/* charts: validated palette (--viz-1 blue, --viz-hi for the one highlighted bar), recessive grid and axis */
.chart { position: relative; width: 100%; direction: ltr; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--font-ui); }
.chart .grid { stroke: var(--viz-grid); stroke-width: 1; }
.chart .base { stroke: var(--viz-axis); stroke-width: 1; }
.chart .bar { fill: var(--viz-1); }
.chart .bar.hi { fill: var(--viz-hi); }
.chart .bar.dim { fill: color-mix(in srgb, var(--viz-1) 35%, var(--surface)); }
.chart .line { fill: none; stroke: var(--viz-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--viz-1-soft); }
.chart .dot { fill: var(--viz-1); stroke: var(--surface); stroke-width: 2; }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover + .bar, .chart .hit:focus + .bar { filter: brightness(1.12); }
.chart .val { fill: var(--ink-2); font-weight: 600; }
.tip { position: absolute; z-index: 5; pointer-events: none; padding: 6px 10px; border-radius: 8px; background: var(--ink); color: var(--plane); border: 1.5px solid var(--outline); font-size: 0.8rem; font-weight: 500; white-space: nowrap; transform: translate(-50%, calc(-100% - 10px)); box-shadow: 2px 2px 0 var(--signal); direction: rtl; }
.heat { display: grid; gap: 3px; direction: ltr; }
.heat-row { display: grid; grid-template-columns: 56px repeat(var(--cols), minmax(0, 1fr)); gap: 3px; align-items: center; }
.heat-row .rl { font-size: 0.75rem; color: var(--muted); text-align: right; padding-right: 6px; direction: rtl; }
.heat-cell { aspect-ratio: 1.3; border-radius: 4px; background: var(--surface-2); position: relative; }
.heat-cols { font-size: 0.7rem; color: var(--muted); }
.heat-legend { display: flex; align-items: center; gap: 6px; font-size: 0.75rem; color: var(--muted); }
.heat-legend i { width: 18px; height: 10px; border-radius: 3px; display: inline-block; }
.hbars { display: grid; gap: 8px; }
.hbar { display: grid; grid-template-columns: 110px minmax(0, 1fr) 48px; gap: 10px; align-items: center; font-size: 0.86rem; }
.hbar .track { height: 10px; border-radius: 0 4px 4px 0; background: var(--surface-2); overflow: hidden; }
[dir="rtl"] .hbar .track { border-radius: 4px 0 0 4px; }
.hbar .track i { display: block; height: 100%; background: var(--viz-1); border-radius: inherit; }
.hbar .num { text-align: end; font-weight: 600; font-variant-numeric: tabular-nums; }
details.as-table summary { cursor: pointer; font-size: 0.8rem; color: var(--muted); }
details.as-table table { margin-top: 8px; }

/* tables: an ink frame, hairlines inside so rows stay easy to scan */
.tbl-wrap { overflow-x: auto; border: 2px solid var(--outline); border-radius: var(--r-md); background: var(--surface); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.tbl th, .tbl td { padding: 10px 12px; text-align: start; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl th { font-size: 0.78rem; color: var(--ink-2); font-weight: 700; background: var(--surface-2); border-bottom: 1.5px solid var(--outline); position: sticky; top: 0; }
.tbl td.num, .tbl th.num { text-align: end; font-variant-numeric: tabular-nums; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .wrap { white-space: normal; min-width: 220px; }

/* comments */
.comments { display: grid; gap: 10px; }
.comment { display: grid; gap: 4px; padding: 12px; border-radius: var(--r-md); background: var(--surface-2); border: 1.5px solid var(--outline); }
.comment.low { background: var(--bad-soft); }
.comment .meta { display: flex; gap: 8px; align-items: center; font-size: 0.8rem; color: var(--muted); }
.comment .stars { color: #c98500; letter-spacing: 1px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }

/* settings */
.settings-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 22px; align-items: start; }
@media (max-width: 1180px) { .settings-layout { grid-template-columns: minmax(0, 1fr); } }
.form-stack { display: grid; gap: 18px; min-width: 0; }
.row2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 640px) { .row2 { grid-template-columns: minmax(0, 1fr); } }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; border-top: 1.5px dashed var(--line-strong); }
.toggle-row:first-of-type { border-top: 0; }
.toggle-row > div { min-width: 0; }
.toggle-row b { display: block; font-weight: 600; font-size: 0.95rem; }
.toggle-row small { color: var(--muted); }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.swatch { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--outline); padding: 0; }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--outline); }
.emoji-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.emoji-pick button { width: 42px; height: 42px; border-radius: 10px; border: 1.5px solid var(--line-strong); background: var(--surface); font-size: 1.3rem; }
.emoji-pick button[aria-pressed="true"] { border-color: var(--outline); background: var(--signal-soft); box-shadow: 2px 2px 0 var(--signal); }
.upload { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.upload .thumb { width: 64px; height: 64px; border-radius: 14px; border: 2px dashed var(--line-strong); display: grid; place-items: center; overflow: hidden; background: var(--surface-2); font-size: 1.6rem; }
.upload .thumb img { width: 100%; height: 100%; object-fit: contain; }
.lock { display: inline-flex; align-items: center; gap: 4px; font-size: 0.75rem; font-weight: 700; color: var(--warn-ink); background: var(--warn-soft); border: 1.5px solid currentColor; padding: 1px 8px; border-radius: 6px; }
.locked { opacity: 0.55; pointer-events: none; }
.list-editor { display: grid; gap: 10px; }
.list-item { display: grid; gap: 8px; padding: 12px; border-radius: var(--r-md); background: var(--surface-2); border: 1.5px solid var(--outline); }
.slice-row { display: grid; grid-template-columns: minmax(0, 1fr) 90px 92px 40px; gap: 8px; align-items: center; }
@media (max-width: 560px) { .slice-row { grid-template-columns: minmax(0, 1fr) 76px 40px; } .slice-row .pct { display: none; } }
.slice-row .pct { font-size: 0.8rem; color: var(--muted); text-align: center; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 0.86rem; font-weight: 500; }
.check input { width: 18px; height: 18px; accent-color: var(--signal); }
.game-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.game-opt { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: var(--r-md); border: 1.5px solid var(--outline); background: var(--surface); box-shadow: var(--shadow-1); cursor: pointer; }
.game-opt:has(input:checked) { background: var(--signal-soft); }
.game-opt input { width: 18px; height: 18px; accent-color: var(--signal); }
.game-opt span { font-size: 1.5rem; filter: var(--sticker); }

.preview-col { position: sticky; top: 20px; display: grid; gap: 10px; justify-items: center; }
@media (max-width: 1180px) { .preview-col { position: static; } }
/* Base mockup in core.css; --k is the scale of the 390px-wide screen. */
.phone { --k: 0.79; box-shadow: var(--shadow-3); }
@media (max-width: 400px) { .phone { --k: 0.7; } }
.savebar {
  position: sticky;
  bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--r-md);
  background: var(--ink);
  color: var(--plane);
  border: 2px solid var(--outline);
  box-shadow: 4px 5px 0 var(--signal);
  animation: pop 0.2s ease;
}
.savebar span { flex: 1; font-weight: 600; }
.savebar .btn-ghost { color: var(--plane); border-color: color-mix(in srgb, var(--plane) 40%, transparent); }

.checklist { display: grid; gap: 8px; }
.check-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--r-md); background: var(--surface-2); border: 1.5px solid var(--outline); text-decoration: none; color: var(--ink); }
.check-item .box { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--outline); background: var(--surface); font-size: 0.8rem; flex: none; }
.check-item.done .box { background: var(--good); color: #fff; }
.check-item.done span { color: var(--muted); text-decoration: line-through; }

.qr-big { width: 240px; max-width: 100%; aspect-ratio: 1; padding: 12px; border-radius: 18px; background: #fff; border: 2px solid var(--outline); box-shadow: var(--shadow-2); }
.qr-big img { width: 100%; height: 100%; display: block; }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }
.plan { display: grid; gap: 12px; align-content: start; padding: 20px; border-radius: var(--r-xl); border: 2px solid var(--outline); background: var(--surface) var(--grain); box-shadow: var(--shadow-2); }
.plan.current { box-shadow: 5px 5px 0 var(--signal); }
.plan h3 { font-family: var(--font-display); font-size: 1.3rem; font-weight: 800; }
.plan .price { font-family: var(--font-display); font-size: 2.1rem; font-weight: 800; }
.plan .price small { font-family: var(--font-ui); font-size: 0.9rem; color: var(--muted); font-weight: 500; }
.plan ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; font-size: 0.9rem; }
.plan li::before { content: "✓ "; color: var(--good); font-weight: 700; }
.dim-load { opacity: 0.55; transition: opacity 0.2s; }

/* login / signup: the form on paper, and an ink board beside it with a ticket taped on */
.auth { min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.auth-main { display: grid; place-items: center; padding: 32px max(16px, env(safe-area-inset-right, 0px)) 32px max(16px, env(safe-area-inset-left, 0px)); }
.auth-box { width: min(440px, 100%); display: grid; gap: 18px; }
.auth-box h1 { font-family: var(--font-display); font-size: 1.9rem; font-weight: 800; }
.auth-side { position: relative; overflow: hidden; display: grid; align-content: center; gap: 22px; padding: 48px; color: #fbf5e9; background: #231e19 var(--grain); border-inline-start: 2px solid #000; }
.auth-side h2 { font-family: var(--font-display); font-size: 2.6rem; font-weight: 800; line-height: 1.1; max-width: 14ch; }
.auth-side h2 mark { color: inherit; padding-inline: 4px; background: linear-gradient(transparent 55%, color-mix(in srgb, var(--signal) 80%, transparent) 55% 90%, transparent 90%); }
.auth-side p { color: #d8ccb4; max-width: 40ch; }
.auth-side .ticket { position: relative; width: 220px; padding: 20px 18px 18px; border-radius: 18px; background: #fbf5e9; color: #201c17; border: 2px solid #000; box-shadow: 6px 7px 0 var(--signal); transform: rotate(-4deg); }
.auth-side .ticket::before { content: ""; position: absolute; top: -11px; left: 50%; width: 70px; height: 22px; margin-left: -35px; background: rgba(244, 190, 72, 0.85); transform: rotate(3deg); }
.auth-side .ticket b { font-family: var(--font-display); font-size: 3.4rem; line-height: 1; color: #e0521b; }
/* After .auth-side, so the phone layout wins. */
@media (max-width: 900px) { .auth { grid-template-columns: minmax(0, 1fr); } .auth-side { display: none; } }
.type-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 10px; }
.type-card { display: grid; justify-items: center; gap: 4px; padding: 12px 8px; border-radius: var(--r-md); border: 1.5px solid var(--outline); background: var(--surface); color: var(--ink); font-size: 0.86rem; font-weight: 600; text-align: center; box-shadow: var(--shadow-1); }
.type-card span { font-size: 1.6rem; filter: var(--sticker); }
.type-card[aria-pressed="true"] { background: var(--signal-soft); box-shadow: 3px 3px 0 var(--signal); }
.form-err { color: var(--bad-ink); font-weight: 600; min-height: 1.4em; font-size: 0.9rem; }
.auth-form { display: grid; gap: 12px; }
.auth-form[hidden] { display: none; }
.who { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.who [role="tab"] { display: grid; justify-items: start; align-content: start; gap: 2px; padding: 12px 14px; border-radius: var(--r-md); border: 1.5px solid var(--outline); background: var(--surface); color: var(--ink); text-align: start; min-height: 96px; box-shadow: var(--shadow-1); }
.who .ic { font-size: 1.5rem; line-height: 1.2; filter: var(--sticker); }
.who b { font-size: 0.95rem; line-height: 1.3; }
.who small { color: var(--muted); font-size: 0.8rem; line-height: 1.35; }
.who [aria-selected="true"] { background: var(--signal-soft); box-shadow: 3px 3px 0 var(--signal); }
.who [aria-selected="true"] small { color: var(--ink-2); }
.field-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.seg-sm button { min-height: 30px; padding: 4px 10px; font-size: 0.8rem; }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-inline-end: 56px; }
.pw-eye { position: absolute; inset-inline-end: 6px; top: 50%; transform: translateY(-50%); min-height: 32px; padding: 4px 10px; border-color: transparent; box-shadow: none; }
.pw-eye:active { transform: translateY(-50%); }
.pw-eye[aria-pressed="true"] { background: var(--surface-2); }
.role-chips { display: flex; flex-wrap: wrap; gap: 6px; }
