/* ==========================================================================
   Samia Studios — client dashboard (dash site only), design system v3
   Paper ground, paper-2 panels with 2px ink borders and a hard shadow, KPI
   tiles in the tints, Archivo 900 numerals, plain-English notes. Loads after
   samia.css and uses only its tokens. Everything reads at 375px wide.
   ========================================================================== */

body.dash { background: var(--paper); min-height: 100vh; }

/* Top bar ----------------------------------------------------------------- */
.dash-top { position: sticky; top: 0; z-index: 60; padding-top: env(safe-area-inset-top, 0px); background: var(--paper); border-bottom: var(--bw) solid var(--ink); }
.dash-top .wrap { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--s2) var(--s3); min-height: 72px; padding-block: 10px; }
.dash-top .brand .wordmark { font-size: .98rem; }
.dash-top .client { display: flex; align-items: center; gap: 12px; min-width: 0; }
.dash-top .client .who { line-height: 1.15; min-width: 0; }
.dash-top .client .who b { display: block; color: var(--ink); font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-top .client .who span { font-size: .76rem; color: var(--muted); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.dash-top .tools { display: flex; align-items: center; gap: 10px; }
.avatar { width: 40px; height: 40px; border-radius: var(--r); border: var(--bw) solid var(--ink); box-shadow: 2px 2px 0 var(--ink); background: var(--sky); color: var(--ink); display: grid; place-items: center; font-family: var(--display); font-weight: 900; font-size: 1rem; letter-spacing: -.02em; font-variation-settings: "wdth" 80; flex: none; }
.avatar.sky { background: var(--sky); } .avatar.peach { background: var(--peach); } .avatar.mint { background: var(--mint); } .avatar.rose { background: var(--rose); } .avatar.lilac { background: var(--lilac); } .avatar.lemon { background: var(--lemon); } .avatar.sun { background: var(--sun); }

/* Marketing / Finance tabs: a segmented, ink-bordered control */
.tabs { display: inline-flex; border: var(--bw) solid var(--ink); border-radius: var(--r); background: var(--paper-2); box-shadow: 3px 3px 0 var(--ink); overflow: hidden; flex: none; }
.tabs a { padding: 8px 14px; font-size: .85rem; font-weight: 700; color: var(--ink); line-height: 1.2; border-right: var(--bw) solid var(--ink); white-space: nowrap; }
.tabs a:last-child { border-right: 0; }
.tabs a:hover { text-decoration: none; background: var(--sand); }
.tabs a[aria-current="page"] { background: var(--ink); color: var(--paper); }

/* Chips: range, sample-data flag, other-client link */
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: var(--pill); background: var(--paper-2); border: 1.5px solid var(--ink); font-size: .82rem; font-weight: 700; color: var(--ink); white-space: nowrap; line-height: 1.2; flex: none; }
.chip.sample { background: var(--sun); }
.chip.range { background: var(--paper-2); }
a.chip:hover { text-decoration: none; background: var(--sand); }

@media (max-width: 900px) {
  .dash-top .wrap { grid-template-columns: auto minmax(0, 1fr); gap: 10px var(--s2); min-height: 0; }
  .dash-top .tools { grid-column: 1 / -1; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
  .dash-top .tools::-webkit-scrollbar { display: none; }
}
@media (max-width: 480px) {
  .dash-top .brand .wordmark { display: none; }
  .dash-top .client .who span { font-size: .72rem; }
}

/* Page layout: a 12-column grid, every block spans it unless told otherwise */
.dash-main { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--s3); padding-block: var(--s4) var(--s6); }
.dash-main > * { grid-column: 1 / -1; min-width: 0; }
.row-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3); }
.row-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s3); }
.row-2-1 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: var(--s3); }
.stack-cards { display: grid; gap: var(--s3); align-content: start; min-width: 0; }
@media (max-width: 1100px) { .row-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .row-3 > :last-child { grid-column: 1 / -1; } }
@media (max-width: 760px) { .row-2, .row-3, .row-2-1 { grid-template-columns: minmax(0, 1fr); } .row-3 > :last-child { grid-column: auto; } }

/* Title row */
.dash-title { display: flex; align-items: end; justify-content: space-between; gap: var(--s2); flex-wrap: wrap; }
.dash-title h1 { font-size: clamp(1.9rem, 1.4rem + 2vw, 3rem); margin: 0 0 6px; }
.dash-title .sub { color: var(--muted); font-weight: 600; font-size: .92rem; }

/* Panels: the shared .card look (paper-2, ink border, hard shadow) with dashboard padding */
.dash-main .card { padding: clamp(16px, 2vw, 22px); display: flex; flex-direction: column; min-width: 0; }
.card .hd { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card .hd .icon-tile { width: 44px; height: 44px; box-shadow: 2px 2px 0 var(--ink); }
.card .hd .icon-tile .icon { width: 24px; height: 24px; }
.card h3 { font-size: 1.05rem; margin: 0 0 2px; }
.card .sub { font-size: .82rem; color: var(--muted); font-weight: 600; }
.card .note { font-size: .82rem; color: var(--muted); font-weight: 600; margin-top: 10px; }
.card [data-chart] { min-width: 0; }

/* Summary: lemon panel with a thick ink rule on the left */
.summary { background: var(--lemon); border: var(--bw) solid var(--ink); border-left-width: 10px; border-radius: var(--r); box-shadow: var(--shadow); padding: clamp(18px, 2.4vw, 28px); display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: var(--s3) var(--s4); }
.summary .label { margin-bottom: 8px; }
.summary .lede { font-size: clamp(1.02rem, .98rem + .3vw, 1.2rem); line-height: 1.55; color: var(--ink); }
.summary .next { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.summary .next li { display: grid; grid-template-columns: 24px 1fr; gap: 10px; align-items: start; font-size: .94rem; color: var(--ink); }
.summary .next li i { width: 24px; height: 24px; border-radius: 2px; background: var(--paper-2); border: var(--bw) solid var(--ink); box-shadow: 2px 2px 0 var(--ink); display: grid; place-items: center; font-style: normal; font-family: var(--display); font-weight: 900; font-size: .8rem; color: var(--ink); }
@media (max-width: 860px) { .summary { grid-template-columns: minmax(0, 1fr); } }

/* KPIs: six tinted tiles, Archivo 900 numbers, a delta pill, a plain-English note */
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--s2); }
.kpi { background: var(--paper-2); border: var(--bw) solid var(--ink); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px; display: grid; gap: 6px; align-content: start; min-width: 0; min-height: 150px; }
.kpi:nth-child(1) { background: var(--sky); } .kpi:nth-child(2) { background: var(--lemon); } .kpi:nth-child(3) { background: var(--mint); } .kpi:nth-child(4) { background: var(--rose); } .kpi:nth-child(5) { background: var(--lilac); } .kpi:nth-child(6) { background: var(--peach); }
.kpi.sky { background: var(--sky); } .kpi.lemon { background: var(--lemon); } .kpi.mint { background: var(--mint); } .kpi.rose { background: var(--rose); } .kpi.lilac { background: var(--lilac); } .kpi.peach { background: var(--peach); } .kpi.paper { background: var(--paper-2); }
.kpi .l { font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink); display: flex; align-items: center; gap: 6px; }
.kpi .l .icon { width: 18px; height: 18px; color: var(--ink); }
.num { font-family: var(--display); font-weight: 900; font-size: clamp(1.7rem, 1.2rem + 1.4vw, 2.6rem); line-height: 1; color: var(--ink); letter-spacing: -.03em; font-variation-settings: "wdth" 80; }
.delta { display: inline-flex; align-items: center; gap: 4px; font-size: .74rem; font-weight: 800; padding: 3px 9px; border-radius: var(--pill); border: 1.5px solid var(--ink); background: var(--paper-2); color: var(--ink); width: max-content; max-width: 100%; }
.delta.up, .delta.good-down { background: var(--mint); }
.delta.down { background: var(--peach); }
.delta.flat { background: var(--sand); }
.kpi .why { font-size: .78rem; color: var(--ink-2); line-height: 1.4; margin-top: 2px; }
@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 600px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; } .kpi { padding: 14px 12px; min-height: 0; } .num { font-size: 1.6rem; } }

/* Legends and colour swatches (no inline styles on the pages) */
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: .8rem; font-weight: 700; color: var(--ink-2); margin-top: 8px; }
.legend i, .donut-wrap li i { width: 11px; height: 11px; border-radius: 2px; border: 1.5px solid var(--ink); display: inline-block; margin-right: 7px; vertical-align: middle; background: var(--paper-2); }
.sw-blue { background: var(--blue) !important; } .sw-red { background: var(--red) !important; } .sw-sun { background: var(--sun) !important; } .sw-green { background: var(--green) !important; } .sw-violet { background: var(--violet) !important; } .sw-pink { background: var(--pink) !important; } .sw-orange { background: var(--orange) !important; } .sw-ink { background: var(--ink) !important; } .sw-sky { background: var(--sky) !important; }

/* Horizontal bars (progress charts) */
.bars-h { display: grid; gap: 10px; }
.bars-h .r { display: grid; grid-template-columns: 112px 1fr 64px; gap: 10px; align-items: center; font-size: .88rem; }
.bars-h .r b { color: var(--ink); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bars-h .r .v { text-align: right; color: var(--ink-2); font-weight: 700; white-space: nowrap; }
.bar { height: 12px; border: 1.5px solid var(--ink); border-radius: 2px; background: var(--paper); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; transition: width 1.2s var(--ease); }
@media (max-width: 400px) { .bars-h .r { grid-template-columns: 92px 1fr 56px; font-size: .82rem; } }

/* Tables inside panels (base table.data lives in samia.css) */
.card table.data td b { color: var(--ink); }
.card table.data tr:last-child td { border-bottom: 0; }
.card table.data th, .card table.data td { padding: 9px 10px; white-space: nowrap; }
.card table.data td:first-child { white-space: normal; }

/* Reviews */
.rating { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.rating .num { font-size: 2.4rem; }
.rating .stars { color: var(--sun); font-size: 1.2rem; letter-spacing: 2px; -webkit-text-stroke: 1px var(--ink); }
.quote { background: var(--paper); border: 1.5px solid var(--ink); border-left: 6px solid var(--sun); border-radius: var(--r); padding: 12px 14px; font-size: .9rem; color: var(--ink); margin-top: 12px; }
.quote span { display: block; font-size: .76rem; color: var(--muted); margin-top: 6px; font-weight: 600; }

/* Donut with a key beside it */
.donut-wrap { display: grid; grid-template-columns: 120px 1fr; gap: 16px; align-items: center; }
.donut-wrap ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: .88rem; }
.donut-wrap li { display: flex; justify-content: space-between; gap: 10px; }
.donut-wrap li b { color: var(--ink); }
@media (max-width: 400px) { .donut-wrap { grid-template-columns: minmax(0, 1fr); } .donut-wrap [data-chart] { max-width: 150px; } }

/* Approvals list */
.todo { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.todo li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: var(--r); background: var(--paper); border: 1.5px solid var(--ink); font-size: .9rem; color: var(--ink); font-weight: 600; }
.todo li .btn { padding: .5em .9em; font-size: .78rem; box-shadow: 2px 2px 0 var(--ink); }

/* Explain toggles under charts */
details.explain { margin-top: 12px; font-size: .86rem; color: var(--ink-2); }
details.explain summary { cursor: pointer; list-style: none; font-weight: 700; color: var(--blue); display: inline-flex; align-items: center; gap: 8px; }
details.explain summary::-webkit-details-marker { display: none; }
details.explain summary::before { content: "?"; width: 20px; height: 20px; border-radius: 2px; border: 1.5px solid var(--ink); background: var(--sun); color: var(--ink); display: inline-grid; place-items: center; font-family: var(--display); font-weight: 900; font-size: .75rem; box-shadow: 1.5px 1.5px 0 var(--ink); }
details.explain[open] summary::before { background: var(--ink); color: var(--sun); }
details.explain p { margin: 10px 0 0; line-height: 1.5; max-width: 46em; }

/* Connected sources grid */
.conn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.conn-card { display: grid; gap: 4px; align-content: start; padding: 12px 14px; border-radius: var(--r); background: var(--paper); border: 1.5px solid var(--ink); font-size: .85rem; min-width: 0; }
.conn-card b { color: var(--ink); } .conn-card span { color: var(--muted); font-size: .76rem; }
.conn-card .ok { color: var(--green); font-weight: 700; font-size: .76rem; }
.conn-card.add { border-style: dashed; background: transparent; color: var(--blue); font-weight: 700; place-items: center; place-content: center; }

/* Status pills in tables */
.status-pill { display: inline-block; padding: 2px 9px; border-radius: var(--pill); border: 1.5px solid var(--ink); font-size: .72rem; font-weight: 800; color: var(--ink); white-space: nowrap; }
.status-pill.paid { background: var(--mint); } .status-pill.due { background: var(--lemon); } .status-pill.late { background: var(--peach); }

/* Sources line and footer line */
.sources { font-size: .8rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.sources b { color: var(--ink-2); }
.sources .conn { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: var(--pill); background: var(--paper-2); border: 1.5px solid var(--ink); font-weight: 700; color: var(--ink); }
.sources .conn i { width: 8px; height: 8px; border-radius: 50%; background: var(--green); display: inline-block; }
.dash-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; font-size: .85rem; color: var(--muted); padding-top: var(--s2); border-top: 1.5px solid var(--line); }
.dash-foot a { font-weight: 700; }

/* Landing: client picker cards */
.client-card .avatar { width: 56px; height: 56px; font-size: 1.3rem; }
.client-card .kind { font-size: var(--fs-small); color: var(--muted); }
.client-card .links { display: flex; gap: 10px; flex-wrap: wrap; }
