/* AppSmash dashboard — recreated from design/handoff (Mineral/Transmission palette). */

:root {
    --bg: #E3E5DF;
    --bg-sunken: #D8DCD3;
    --surface: #F8F9F6;
    --surface-alt: #E9ECE4;
    --border: #CBD0C6;
    --border-strong: #AEB5A6;
    --border-subtle: #E4E7DF;
    --grid-line: #DBDFD4;
    --ink: #14181A;
    --text-2: #5A6259;
    --muted: #6E7670;
    --accent: #2B4EF5;
    --accent-hover: #1E38BC;
    --accent-fg: #F2F5FF;
    --positive: #0E7C66;
    --negative: #D2402F;
    --series-2: #6B33E0;
    --series-3: #5C8A00;
    --sans: 'Public Sans', system-ui, sans-serif;
    --mono: 'IBM Plex Mono', monospace;
    --disp: 'Space Grotesk', 'Public Sans', sans-serif;
}

* { box-sizing: border-box; }

.dash-body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 14px;
}

/* ---------- Standard site header (spec: landing.css / handoff README "Sticky header") ---------- */

.site-head {
    position: sticky;
    top: 0;
    z-index: 30;
    background: rgba(227, 229, 223, .86);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}

/* Landing centres .wrap at 1180px; the dashboard shell is fluid, so the
   header row spans full width with the topbar's 26px gutter instead. */
.head-inner { height: 68px; display: flex; align-items: center; gap: 30px; padding: 0 26px; }
.spacer { flex: 1; }

.brand { display: flex; align-items: center; gap: 4px; text-decoration: none; }
.brand-tile {
    width: 34px; height: 34px; border-radius: 10px; background: var(--accent);
    display: flex; align-items: center; justify-content: center;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.32), 0 4px 10px -2px rgba(43,78,245,.5), 0 1px 2px rgba(20,24,26,.2);
}
.brand-word { font: 700 25px/1 var(--sans); letter-spacing: .01em; color: var(--ink); }

.head-nav { display: flex; align-items: center; gap: 22px; font: 500 14px/1 var(--sans); }
.head-nav a { color: var(--text-2); text-decoration: none; white-space: nowrap; }
.head-nav a:hover { color: var(--ink); }
.head-nav span { color: var(--text-2); }

.btn-signin { font: 600 14px/1 var(--sans); color: var(--text-2); text-decoration: none; }
.btn-signin:hover { color: var(--ink); }
.btn-start {
    font: 600 14px/1 var(--sans); color: var(--accent-fg) !important;
    background: var(--accent); border-radius: 10px; padding: 11px 16px; text-decoration: none;
}
.btn-start:hover { background: var(--accent-hover); }

/* Hamburger (dash pages only, rendered when dash_nav is set): opens the rail
   drawer on narrow viewports. Hidden wherever the rail itself is visible. */
.nav-burger {
    display: none;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    flex: none;
    background: none;
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-2);
    cursor: pointer;
    transition: border-color .15s ease, color .15s ease;
}

.nav-burger:hover { border-color: var(--border-strong); color: var(--ink); }

.nav-burger:focus-visible {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(43, 78, 245, .14);
}

/* Five nav items no longer fit beside the brand and CTAs below ~1120px
   (the rail still carries the dash nav until the drawer takes over at 900px). */
@media (max-width: 1120px) {
    .head-nav { display: none; }
}

/* ---------- Icon rail ---------- */

.dash-shell {
    flex: 1;
    display: flex;
    align-items: stretch;
}

.rail {
    width: 76px;
    flex: none;
    background: var(--bg-sunken);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 18px 0;
    gap: 6px;
    position: sticky;
    top: 68px;
    height: calc(100vh - 68px);
}

.rail-item {
    width: 44px;
    height: 40px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    text-decoration: none;
}

a.rail-item:hover { background: var(--surface-alt); color: var(--text-2); }

.rail-item.active { background: var(--surface-alt); color: var(--accent); }

.rail-item.is-disabled { opacity: .55; cursor: default; }

/* Item labels only exist in the mobile drawer; the desktop rail is icon-only. */
.rail-label { display: none; }

.rail-spacer { flex: 1; }

.rail-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text-2);
}

.avatar-badge {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    background: var(--border);
    color: var(--text-2);
    display: flex;
    align-items: center;
    justify-content: center;
    font: 600 12px var(--disp);
}

a.rail-avatar:hover .avatar-badge { background: var(--border-strong); color: var(--ink); }

/* Dimmed page scrim behind the open drawer (mobile only). */
.rail-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 39;
    background: rgba(20, 24, 26, .35);
    opacity: 0;
    pointer-events: none;
    transition: opacity .22s ease;
}

/* ---------- Shell ---------- */

/* Fluid width: the handoff drew the dashboard at a fixed 1440px, but in
   production the main column fills whatever the monitor offers. */
.dash-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    min-height: 64px;
    flex: none;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    flex-wrap: wrap;          /* narrow viewports drop controls to a 2nd line */
    gap: 8px 14px;
    padding: 8px 26px;
}

/* The controls strip rendered inline in the topbar (overview's single header
   row) sheds its standalone row chrome and absorbs the remaining width, its
   internal spacer pushing freshness right. */
.topbar .controls {
    padding: 0;
    border-bottom: none;
    flex: 1 1 auto;
    min-width: 0;
    flex-wrap: wrap;
}

.topbar-title {
    font: 600 19px/1 var(--disp);
    letter-spacing: -.01em;
}

.topbar-back {
    display: flex;
    align-items: center;
    gap: 7px;
    font: 500 13px/1 var(--sans);
    color: var(--text-2);
    text-decoration: none;
}

.topbar-back:hover { color: var(--ink); }

.topbar-divider { width: 1px; height: 22px; background: var(--border); }

.scope-chip {
    font: 500 11px/1 var(--mono);
    color: var(--muted);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 5px 8px;
}

.spacer { flex: 1; }

.seg {
    display: flex;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 3px;
}

.seg-item {
    font: 600 12px/1 var(--sans);
    padding: 7px 11px;
    border-radius: 6px;
    color: var(--text-2);
}

.seg-item.active { background: var(--accent); color: var(--accent-fg); }

.btn-outline {
    display: flex;
    align-items: center;
    gap: 7px;
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 8px 12px;
    font: 600 12px/1 var(--sans);
    color: var(--text-2);
    background: none;
    cursor: pointer;
}

.btn-outline:hover { border-color: var(--border-strong); color: var(--ink); }

.btn-primary {
    display: flex;
    align-items: center;
    gap: 7px;
    background: var(--accent);
    color: var(--accent-fg);
    border: none;
    border-radius: 9px;
    padding: 9px 13px;
    font: 600 12px/1 var(--sans);
    cursor: pointer;
}

.btn-primary:hover { background: var(--accent-hover); }

.btn-primary:disabled {
    opacity: .55;
    cursor: default;
}

.btn-primary:disabled:hover { background: var(--accent); }

/* ---------- Controls row (app filter, range presets, custom range picker) ---------- */

.controls {
    flex: none;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 26px;
    border-bottom: 1px solid var(--border-subtle);
}

.range-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 8px 12px;
    font: 600 12px/1 var(--sans);
    color: var(--text-2);
    cursor: pointer;
    transition: border-color .15s ease, color .15s ease;
}

.range-btn:hover {
    border-color: var(--border-strong);
    color: var(--ink);
}

.range-btn:focus-visible {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(43, 78, 245, .14);
}

.range-btn.active {
    border-color: var(--accent);
    color: var(--accent);
}

.rangewrap { position: relative; }

.rangepop {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 30;
    display: flex;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 13px;
    box-shadow: 0 24px 50px -32px rgba(20, 24, 26, .35);
    overflow: hidden;
}

.rangepop[hidden] { display: none; }

.rangepop-months {
    width: 128px;
    flex: none;
    padding: 14px 10px;
    border-right: 1px solid var(--border-subtle);
    background: var(--surface-alt);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rangepop-months .mono-label { padding: 0 6px; }

.rangepop-months button {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    border-radius: 7px;
    padding: 7px 9px;
    font: 500 12.5px/1 var(--sans);
    color: var(--text-2);
    cursor: pointer;
}

.rangepop-months button:hover { background: var(--surface); color: var(--ink); }

.rangepop-months button.active { background: var(--accent); color: var(--accent-fg); }

.rangepop-cal { padding: 14px 16px 12px; width: 268px; }

.rangepop-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.cal-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    background: none;
    border: 1px solid var(--border);
    border-radius: 7px;
    color: var(--text-2);
    cursor: pointer;
}

.cal-nav:hover { border-color: var(--border-strong); color: var(--ink); }

.cal-nav:disabled { opacity: .35; cursor: default; }

.cal-nav:disabled:hover { border-color: var(--border); color: var(--text-2); }

.cal-title {
    background: none;
    border: none;
    border-radius: 7px;
    padding: 5px 9px;
    font: 600 13px/1 var(--sans);
    color: var(--ink);
    cursor: pointer;
}

.cal-title:hover { background: var(--surface-alt); color: var(--accent); }

.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.cal-dow span {
    text-align: center;
    font: 500 10px/1 var(--mono);
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--muted);
    padding: 4px 0 6px;
}

.cal-day {
    height: 30px;
    background: none;
    border: none;
    border-radius: 7px;
    font: 500 12px/1 var(--sans);
    color: var(--ink);
    cursor: pointer;
}

.cal-day:hover { background: var(--surface-alt); }

.cal-day.is-pad { visibility: hidden; }

.cal-day.is-disabled {
    color: var(--border-strong);
    cursor: default;
}

.cal-day.is-disabled:hover { background: none; }

.cal-day.is-in {
    background: #DAE0FF;
    border-radius: 0;
}

.cal-day.is-start, .cal-day.is-end {
    background: var(--accent);
    color: var(--accent-fg);
}

.cal-day.is-start { border-radius: 7px 0 0 7px; }

.cal-day.is-end { border-radius: 0 7px 7px 0; }

.cal-day.is-start.is-end { border-radius: 7px; }

.rangepop-foot {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-subtle);
}

.cal-sel { font: 500 11px/1.3 var(--mono); color: var(--muted); }

.content {
    padding: 22px 26px 30px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.freshness {
    display: flex;
    align-items: center;
    gap: 6px;
    font: 500 11px/1 var(--mono);
    color: var(--muted);
}

.dot {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    display: inline-block;
    flex: none;
}

.dot-pos { background: var(--positive); }
.dot-neg { background: var(--negative); }

/* ---------- Cards ---------- */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
}

.card-title { font: 600 15px/1 var(--disp); }

/* ---------- KPI cards ---------- */

/* The KPI strip scrolls horizontally (tiles run off-screen rather than
   shrinking) and its tiles are drag-reorderable — see dashboard.js. */
.kpi-row {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    padding-bottom: 6px;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.kpi-row::-webkit-scrollbar { height: 7px; }

.kpi-row::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }

.kpi-row::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

.kpi-row::-webkit-scrollbar-track { background: transparent; }

.kpi-strip { position: relative; }

.kpi-card {
    flex: 1 0 250px;
    min-width: 0;
    scroll-snap-align: start;
    position: relative;
    padding: 16px 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    color: inherit;
    text-decoration: none;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

/* Corner grip: the "this tile is draggable" affordance. */
.kpi-grip {
    position: absolute;
    top: 11px;
    right: 12px;
    color: var(--border);
    transition: color .15s ease;
}

.kpi-card:hover .kpi-grip, .kpi-card.dragging .kpi-grip { color: var(--border-strong); }

/* Chevrons floated over the strip's edges while tiles are off-screen on that
   side; clicking nudges the row one tile along. dashboard.js toggles
   .visible per side from scroll position. */
.kpi-scroll-hint {
    position: absolute;
    top: calc(50% - 3px);
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    display: none;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text-2);
    cursor: pointer;
    box-shadow: 0 10px 24px -12px rgba(20, 24, 26, .45);
    z-index: 6;
}

.kpi-scroll-hint.hint-right { right: 8px; }

.kpi-scroll-hint.hint-left { left: 8px; }

.kpi-scroll-hint.visible { display: flex; }

.kpi-scroll-hint:hover {
    border-color: var(--border-strong);
    color: var(--ink);
}

a.kpi-card:hover { border-color: var(--border-strong); }

.kpi-card.dragging {
    cursor: grabbing;
    border-color: var(--border-strong);
    box-shadow: 0 24px 50px -32px rgba(20, 24, 26, .35);
    position: relative;
    z-index: 5;
}

.kpi-label, .mono-label {
    font: 500 10.5px/1 var(--mono);
    letter-spacing: .09em;
    color: var(--muted);
    text-transform: uppercase;
}

.kpi-value-row { display: flex; align-items: flex-end; gap: 9px; }

.kpi-value {
    font: 600 30px/1 var(--disp);
    letter-spacing: -.02em;
}

.delta {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font: 600 11.5px/1 var(--mono);
    padding: 4px 7px;
    border-radius: 999px;
}

.delta.up {
    color: var(--positive);
    background: rgba(14, 124, 102, .11);
    border: 1px solid rgba(14, 124, 102, .22);
}

.delta.down {
    color: var(--negative);
    background: rgba(210, 64, 47, .11);
    border: 1px solid rgba(210, 64, 47, .22);
}

/* Hovering a delta badge explains the comparison window ("vs. previous 31
   days (31 May – 30 Jun)") — the label the control row used to carry. */
.delta[data-tip] {
    position: relative;
    cursor: default;
}

.delta[data-tip]::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(2px);
    background: var(--ink);
    color: #C8CCC5; /* text-body-on-ink */
    font: 500 10.5px/1.4 var(--mono);
    padding: 6px 9px;
    border-radius: 6px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity .15s ease, transform .15s ease;
    z-index: 20;
}

.delta[data-tip]::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 3px);
    left: 50%;
    transform: translateX(-50%) translateY(2px);
    border: 5px solid transparent;
    border-top-color: var(--ink);
    border-bottom: none;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity .15s ease, transform .15s ease;
    z-index: 20;
}

.delta[data-tip]:hover::after,
.delta[data-tip]:hover::before {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%);
}

.kpi-caption { font: 400 11.5px/1 var(--sans); color: var(--muted); }

/* ---------- Chart row ---------- */

.chart-row { display: flex; gap: 14px; align-items: stretch; }

/* Stacks the revenue + downloads chart cards to the left of the side column. */
.chart-col {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.chart-card {
    flex: 1;
    min-width: 0;
    padding: 18px 18px 14px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.chart-head { display: flex; align-items: center; gap: 12px; }

.legend { display: flex; align-items: center; gap: 14px; margin-left: 6px; }

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font: 400 12px/1 var(--sans);
    color: var(--text-2);
}

.swatch { width: 9px; height: 9px; border-radius: 3px; display: inline-block; flex: none; }

.swatch-dash { flex: none; }

.minitabs {
    display: flex;
    background: var(--surface-alt);
    border-radius: 8px;
    padding: 3px;
}

.minitab {
    font: 600 11px/1 var(--sans);
    padding: 6px 10px;
    border-radius: 5px;
    color: var(--text-2);
}

.minitab.active { background: var(--border); color: var(--ink); }

/* No data in the selected window: disabled-grey title. */
.card-title.is-empty { color: var(--border-strong); }

/* Collapse toggle: minimises a chart card to its title bar. */
.chart-collapse {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    background: none;
    border: 1px solid var(--border);
    border-radius: 7px;
    color: var(--text-2);
    cursor: pointer;
    transition: border-color .15s ease, color .15s ease;
}

.chart-collapse:hover { border-color: var(--border-strong); color: var(--ink); }

.chart-collapse svg { transition: transform .18s ease; }

.chart-card.collapsed .chart-collapse svg { transform: rotate(-90deg); }

.chart-card.collapsed .chart-wrap,
.chart-card.collapsed .axis-row,
.chart-card.collapsed .legend { display: none; }

.chart-wrap { position: relative; }

.chart-cross {
    display: none;
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: rgba(20, 24, 26, .22);
    pointer-events: none;
}

.chart-tip {
    display: none;
    position: absolute;
    top: 8px;
    background: var(--surface-alt);
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    padding: 9px 11px;
    flex-direction: column;
    gap: 5px;
    min-width: 150px;
    pointer-events: none;
    z-index: 5;
}

.tip-date { font: 500 10.5px/1 var(--mono); color: var(--muted); }

.tip-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    font: 600 12.5px/1 var(--sans);
}

.tip-key { display: flex; align-items: center; gap: 6px; color: var(--text-2); }

.axis-row {
    display: flex;
    justify-content: space-between;
    font: 500 10.5px/1 var(--mono);
    color: var(--muted);
    padding-top: 2px;
}

/* ---------- Overview panel row (donut + AI insights, 50/50) ---------- */

.panel-row {
    display: flex;
    gap: 14px;
    align-items: stretch;
}

.panel-row > .card {
    flex: 1 1 0;
    min-width: 0;
}

.donut-card { padding: 18px; display: flex; flex-direction: column; gap: 14px; }

.donut-body { display: flex; align-items: center; gap: 18px; }

.donut-legend { flex: 1; display: flex; flex-direction: column; gap: 9px; }

.donut-legend-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font: 400 12.5px/1 var(--sans);
}

.donut-legend-row .swatch { width: 8px; height: 8px; border-radius: 2px; }

.donut-legend-row .name { flex: 1; color: var(--text-2); }

.donut-legend-row .pct { font: 600 12px var(--mono); }

/* Nightly AI insight (store_insight_daily) — severity drives the accent:
   info = neutral, good = green, warning = amber. */
.insight-card {
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-top: 2px solid var(--border-strong);
}

.insight-head { display: flex; align-items: center; gap: 8px; }

.insight-head .insight-date {
    margin-left: auto;
    font: 500 10px var(--mono);
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--muted);
}

.insight-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }

.insight-card.sev-good { border-top-color: var(--positive); }
.insight-card.sev-good .insight-dot { background: var(--positive); }
.insight-card.sev-warning { border-top-color: #B25C00; }
.insight-card.sev-warning .insight-dot { background: #B25C00; }

.insight-headline { font: 600 13.5px/1.4 var(--sans); }

.insight-bullets {
    margin: 0;
    padding-left: 17px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.insight-bullets li { font: 400 12px/1.45 var(--sans); color: var(--muted); }

.insight-body-muted { font: 400 12px/1.5 var(--sans); color: var(--muted); }

.insight-enable { align-self: flex-start; }

.insight-enable.is-busy {
    opacity: .7;
    cursor: default;
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.insight-enable.is-busy .pill-dot {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: var(--accent-fg);
    animation: pill-pulse 1.6s ease-in-out infinite;
}

.insight-generating {
    display: flex;
    flex-direction: column;
    gap: 9px;
    align-items: flex-start;
}

.insight-toggle { margin-top: 2px; }

.insight-off-link {
    border: none;
    background: none;
    padding: 0;
    cursor: pointer;
    font: 500 11px var(--sans);
    color: var(--muted);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.insight-off-link:hover { color: var(--ink); }

/* ---------- Tables ---------- */

.table-card { overflow: hidden; }

.table-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
}

.tab-pills { display: flex; gap: 4px; margin-left: 8px; }

.tab-pill {
    font: 600 11px/1 var(--sans);
    padding: 6px 10px;
    border-radius: 999px;
    color: var(--text-2);
}

.tab-pill.active { background: var(--border); color: var(--ink); }

.table-link { font: 500 11.5px/1 var(--mono); color: var(--accent); text-decoration: none; }

.table-note { font: 500 11.5px/1 var(--mono); color: var(--muted); }

.table-scroll { overflow-x: auto; }

.country-grid, .breakdown-grid {
    display: grid;
    align-items: center;
    gap: 16px;
    padding: 13px 18px;
    border-bottom: 1px solid var(--border-subtle);
    min-width: 900px;
}

.country-grid { grid-template-columns: 150px 100px 1fr 130px 120px 90px; }

.breakdown-grid { grid-template-columns: 180px 1fr 130px 110px 110px 110px; }

.country-grid:last-child, .breakdown-grid:last-child { border-bottom: none; }

.grid-header {
    padding: 11px 18px;
    font: 500 10.5px/1 var(--mono);
    letter-spacing: .08em;
    color: var(--muted);
    text-transform: uppercase;
    border-bottom: 1px solid var(--border);
}

.grid-row:hover { background: var(--surface-alt); }

.cell-name { font: 600 13.5px var(--sans); }

.cell-num { text-align: right; font: 500 13px var(--mono); color: var(--text-2); }

.cell-strong { text-align: right; font: 600 13px var(--mono); color: var(--ink); }

.cell-delta { text-align: right; font: 600 13px var(--mono); }

.cell-delta.up { color: var(--positive); }
.cell-delta.down { color: var(--negative); }

.bar-track {
    height: 6px;
    border-radius: 3px;
    background: var(--surface-alt);
    display: block;
    position: relative;
}

.trend-cell {
    position: relative;
    display: flex;
    justify-content: flex-end;
}

/* Hovering the share bar or trend sparkline reveals an ink chip pinned inside
   the row (the table body scrolls, so a floating tooltip would be clipped). */
.trend-cell[data-tip]:hover::after,
.bar-track[data-tip]:hover::after {
    content: attr(data-tip);
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    background: var(--ink);
    color: #C8CCC5; /* text-body-on-ink */
    font: 500 10.5px/1 var(--mono);
    padding: 4px 7px;
    border-radius: 6px;
    white-space: nowrap;
    pointer-events: none;
    z-index: 5;
}

.grid-row.is-collapsed { display: none; }

.show-more {
    display: block;
    width: 100%;
    padding: 12px;
    background: none;
    border: none;
    border-top: 1px solid var(--border-subtle);
    font: 600 12px/1 var(--sans);
    color: var(--text-2);
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}

.show-more:hover { background: var(--surface-alt); color: var(--ink); }

.bar-fill {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--accent);
}

.breakdown-grid .bar-track { height: 8px; border-radius: 4px; }

/* ---------- Deep dive ---------- */

.deep-layout { display: flex; gap: 16px; align-items: flex-start; }

.deep-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.stat-header {
    display: flex;
    align-items: flex-end;
    gap: 24px;
    padding: 2px 2px 0;
    flex-wrap: wrap;
}

.stat-block { display: flex; flex-direction: column; gap: 7px; }

.stat-hero-row { display: flex; align-items: flex-end; gap: 10px; }

.stat-hero {
    font: 600 42px/1 var(--disp);
    letter-spacing: -.025em;
}

.stat-hero-row .delta { margin-bottom: 5px; }

.stat-value { font: 600 22px/1 var(--disp); white-space: nowrap; }

.stat-value.dim { color: var(--text-2); }

.stat-value .sub { font: 500 12px var(--mono); color: var(--muted); }

.stat-divider { width: 1px; height: 44px; background: var(--border); }

.series-chips { display: flex; gap: 6px; }

.series-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    font: 600 11.5px/1 var(--sans);
    color: var(--ink);
    background: var(--surface-alt);
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    padding: 7px 11px;
}

.series-chip .swatch { width: 8px; height: 8px; border-radius: 2px; }

.series-chip.add {
    color: var(--muted);
    background: none;
    border-style: dashed;
}

.deep-chart-body { display: flex; gap: 12px; }

.y-axis {
    width: 40px;
    flex: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    font: 500 10.5px/1 var(--mono);
    color: var(--muted);
    text-align: right;
    height: 340px;
    padding: 2px 0 18px;
}

.deep-axis-row { padding-left: 52px; }

.annotation-band {
    position: absolute;
    top: 0;
    bottom: 0;
    border-left: 1px dashed var(--border-strong);
    border-right: 1px dashed var(--border-strong);
    pointer-events: none;
}

.annotation-flag {
    position: absolute;
    top: -6px;
    background: var(--accent);
    color: var(--accent-fg);
    font: 600 10px/1 var(--mono);
    padding: 4px 6px;
    border-radius: 4px;
    z-index: 4;
}

.brush-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-left: 52px;
    padding-top: 6px;
}

.brush {
    flex: 1;
    position: relative;
    height: 44px;
    background: var(--bg-sunken);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.brush-dim { position: absolute; top: 0; bottom: 0; background: var(--bg); opacity: .6; }

.brush-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--accent);
    border-radius: 2px;
}

.brush-label {
    font: 500 11px/1.4 var(--mono);
    color: var(--muted);
    white-space: nowrap;
}

.deep-side {
    width: 300px;
    flex: none;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.side-card { padding: 16px; display: flex; flex-direction: column; gap: 12px; }

.side-card .card-title { font-size: 14px; }

.comp-bar {
    display: flex;
    height: 12px;
    border-radius: 6px;
    overflow: hidden;
    gap: 2px;
}

.comp-legend { display: flex; flex-direction: column; gap: 10px; }

.comp-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font: 400 12.5px/1 var(--sans);
}

.comp-row .swatch { width: 8px; height: 8px; border-radius: 2px; }

.comp-row .name { flex: 1; color: var(--text-2); }

.comp-row .val { font: 600 13px var(--mono); }

.driver-rows { display: flex; flex-direction: column; gap: 11px; }

.driver-row { display: flex; align-items: center; gap: 10px; }

.driver-name { flex: 1; font: 400 12.5px/1.3 var(--sans); color: var(--text-2); }

.driver-bar {
    width: 74px;
    height: 7px;
    background: var(--surface-alt);
    border-radius: 4px;
    position: relative;
    overflow: hidden;
    flex: none;
}

.driver-fill { position: absolute; top: 0; height: 100%; border-radius: 4px; }

.driver-fill.up { left: 50%; background: var(--positive); }

.driver-fill.down { right: 50%; background: var(--negative); }

.driver-amount { width: 56px; text-align: right; font: 600 12px var(--mono); flex: none; }

.driver-amount.up { color: var(--positive); }
.driver-amount.down { color: var(--negative); }

.side-footnote {
    font: 400 11.5px/1.45 var(--sans);
    color: var(--muted);
    border-top: 1px solid var(--border);
    padding-top: 10px;
}

.timeline-item { display: flex; gap: 10px; }

.timeline-rule {
    width: 8px;
    flex: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 4px;
}

.timeline-dot { width: 8px; height: 8px; border-radius: 999px; }

.timeline-line { flex: 1; width: 1px; background: var(--border); }

.timeline-body { display: flex; flex-direction: column; gap: 2px; padding-bottom: 14px; }

.timeline-item:last-child .timeline-body { padding-bottom: 0; }

.timeline-title { font: 600 12.5px/1.3 var(--sans); }

.timeline-meta { font: 500 10.5px/1 var(--mono); color: var(--muted); }

/* ---------- Responsive (desktop-first, per handoff) ---------- */

@media (max-width: 1200px) {
    .chart-row, .deep-layout { flex-wrap: wrap; }
    .deep-side { width: 100%; flex-direction: row; }
    .deep-side > .card { flex: 1; }
    .kpi-card { flex-basis: 225px; }
}

@media (max-width: 1100px) {
    .controls { flex-wrap: wrap; }
    .deep-side { flex-direction: column; }
    .panel-row { flex-direction: column; }
}

/* Tablet and below: the icon rail leaves the layout and becomes an off-canvas
   drawer (labels shown) behind the header hamburger — body.rail-open slides it in. */
@media (max-width: 900px) {
    .nav-burger { display: flex; }

    .head-inner { gap: 16px; padding: 0 16px; }

    .rail {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        height: 100vh;
        height: 100dvh;
        width: 248px;
        z-index: 40;
        align-items: stretch;
        padding: 20px 12px;
        border-right: 1px solid var(--border);
        box-shadow: 0 24px 50px -20px rgba(20, 24, 26, .4);
        transform: translateX(-100%);
        transition: transform .22s ease, visibility .22s;
        visibility: hidden;
    }

    body.rail-open .rail { transform: none; visibility: visible; }

    body.rail-open .rail-backdrop { opacity: 1; pointer-events: auto; }

    .rail-backdrop { display: block; }

    body.rail-open { overflow: hidden; }

    .rail-item {
        width: 100%;
        height: 44px;
        justify-content: flex-start;
        gap: 13px;
        padding: 0 13px;
        font: 600 13.5px/1 var(--sans);
    }

    .rail-item svg { flex: none; }

    .rail-label { display: inline; }

    .rail-avatar {
        width: 100%;
        justify-content: flex-start;
        gap: 13px;
        padding: 0 8px;
        min-height: 44px;
        border-radius: 11px;
        font: 600 13.5px/1 var(--sans);
    }

    a.rail-avatar:hover { background: var(--surface-alt); }

    .rail-avatar .avatar-badge { flex: none; width: 29px; height: 29px; font-size: 11px; }
}

/* Phones: tighten the shell gutters and let card internals breathe less. */
@media (max-width: 720px) {
    .topbar { padding: 8px 16px; }
    .controls { padding: 10px 16px; }
    .content { padding: 16px 16px 26px; gap: 14px; }
    .demo-banner { padding: 9px 16px; }

    .chart-head { flex-wrap: wrap; }
    .legend { flex-wrap: wrap; margin-left: 0; row-gap: 6px; }
    .chart-card { padding: 15px 14px 12px; }
    .donut-body { flex-wrap: wrap; }
    .donut-card, .insight-card { padding: 15px 14px; }

    .stat-header { gap: 14px 18px; }
    .stat-hero { font-size: 34px; }
    .stat-divider { display: none; }

    .watch-head { padding: 18px 16px 14px; }
    .watch-section { padding: 2px 16px 18px; }
    .watch-band { padding: 18px 16px 20px; }
    .save-banner { margin: 0 16px 6px; }

    .conn-card, .profile-card { padding: 18px 16px; }
    .conn-form-row { flex-direction: column; }
}

/* Small phones: compact header so burger + brand + CTAs fit on one line, and the
   custom-range popover pins to the viewport, presets stacked above the calendar. */
@media (max-width: 560px) {
    .head-inner { gap: 12px; }
    .brand-word { font-size: 21px; }
    .brand-tile { width: 30px; height: 30px; border-radius: 9px; }
    .brand-tile svg { width: 27px; height: 27px; }
    .btn-signin, .btn-start { white-space: nowrap; }
    .btn-start { padding: 10px 13px; }

    .rangepop {
        position: fixed;
        left: 14px;
        right: 14px;
        top: 110px;
        z-index: 60;
        flex-direction: column;
    }

    .rangepop-months {
        width: auto;
        flex-direction: row;
        align-items: center;
        overflow-x: auto;
        gap: 4px;
        padding: 10px;
        border-right: none;
        border-bottom: 1px solid var(--border-subtle);
    }

    .rangepop-months .mono-label { display: none; }

    .rangepop-months button { width: auto; flex: none; white-space: nowrap; }

    .rangepop-cal { width: auto; }
}

/* Tiny screens: the drawer already offers Sign in / Sign out, so the header
   drops its text link and keeps only the primary CTA. */
@media (max-width: 400px) {
    .btn-signin { display: none; }
}

/* Demo-mode banner (dash/base.html): shown to workspace-less users browsing sample data. */
.demo-banner {
    flex: none;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 26px;
    background: rgba(43, 78, 245, .07);
    border-bottom: 1px solid rgba(43, 78, 245, .18);
    font: 500 12.5px/1.4 var(--sans);
    color: var(--text-2);
}

.demo-banner a {
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
    white-space: nowrap;
}

.demo-banner a:hover { text-decoration: underline; }

/* Topbar display-currency picker — sized and styled to sit beside .btn-outline/.seg. */
.currency-pick select {
    appearance: none;
    -webkit-appearance: none;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 8px 28px 8px 12px;
    font: 600 12px/1 var(--sans);
    color: var(--text-2);
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='7' fill='none'%3E%3Cpath d='M1 1.5l4 4 4-4' stroke='%236E7670' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 11px center;
    transition: border-color .15s ease, color .15s ease;
}

.currency-pick select:hover {
    border-color: var(--border-strong);
    color: var(--ink);
}

.currency-pick select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(43, 78, 245, .14);
}

/* ---------- Copycat watch screen ---------- */

.watch-card {
    padding: 0;
    overflow: hidden;
}

/* Header: icon tile, title with inline intro, review pill. */
.watch-head {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 22px 24px 18px;
}

.watch-head-icon {
    flex: none;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    color: var(--text-2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.watch-head-text { min-width: 0; }

.watch-intro {
    margin: 4px 0 0;
    font: 400 13.5px/1.55 var(--sans);
    color: var(--text-2);
}

.save-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 24px 6px;
    background: rgba(14, 124, 102, .1);
    border: 1px solid rgba(14, 124, 102, .22);
    border-radius: 10px;
    padding: 11px 14px;
    font: 500 13px/1.4 var(--sans);
    color: var(--positive);
}

.watch-section { padding: 2px 24px 20px; }

.watch-sec-head {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 10px;
}

.watch-sec-hint { font: 400 12px/1 var(--sans); color: var(--muted); }

/* Match rows: bordered sub-cards. */
.match-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.match-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    border: 1px solid var(--border-subtle);
    border-radius: 13px;
    background: #FFFFFF;
    transition: border-color .15s ease, opacity .15s ease;
}

.match-row:hover { border-color: var(--border); }

/* Judged rows stay listed wearing their flag, dimmed; hover restores them. */
.match-row.is-judged { opacity: .55; }

.match-row.is-judged:hover { opacity: 1; }

.match-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid var(--border);
    flex: none;
    background: var(--surface-alt);
}

.match-initials {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ink);
    border-color: var(--ink);
    color: #F2F5FF;
    font: 600 13px/1 var(--sans);
    letter-spacing: -.02em;
}

.match-initials.is-app {
    background: var(--surface-alt);
    border-color: var(--border);
    color: var(--text-2);
}

.match-main { min-width: 0; flex: 1 1 300px; display: flex; flex-direction: column; gap: 5px; }

.match-title-row {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-wrap: wrap;
    min-width: 0;
}

.match-name { font: 600 14px/1.3 var(--sans); letter-spacing: -.01em; }

.store-chip {
    font: 500 10px/1 var(--mono);
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--text-2);
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 3px 7px;
    white-space: nowrap;
}

.match-view {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font: 600 12px/1 var(--sans);
    color: var(--accent);
    text-decoration: none;
}

.match-view:hover { text-decoration: underline; }

.match-meta {
    font: 500 10.5px/1.5 var(--mono);
    color: var(--muted);
    display: flex;
    flex-wrap: wrap;
    gap: 2px 8px;
}

.meta-dot { color: var(--border-strong); }

.meta-term { color: var(--ink); }

.match-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    flex: none;
}

.verdict-form { display: contents; }

.btn-sm { padding: 7px 11px; font-size: 11.5px; text-decoration: none; }

/* Rests neutral like its .btn-outline siblings — an unreviewed match has no
   verdict, so nothing may look pre-selected. Red only on hover/focus. */
.btn-suspect {
    display: flex;
    align-items: center;
    border-radius: 9px;
    font: 600 11.5px/1 var(--sans);
    color: var(--text-2);
    background: none;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: color .15s ease, background .15s ease, border-color .15s ease;
}

.btn-suspect:hover,
.btn-suspect:focus-visible {
    color: var(--negative);
    background: rgba(210, 64, 47, .08);
    border-color: rgba(210, 64, 47, .45);
}

.match-verdict {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font: 500 12.5px/1 var(--sans);
    color: var(--positive);
    white-space: nowrap;
}

.link-btn {
    background: none;
    border: 0;
    padding: 0;
    font: 500 12px/1 var(--sans);
    color: var(--accent);
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.match-empty {
    margin-top: 10px;
    padding: 13px 15px;
    border: 1px dashed var(--border);
    border-radius: 13px;
    background: #FFFFFF;
    font: 400 13px/1.4 var(--sans);
    color: var(--text-2);
}

.sweep-line {
    margin-top: 14px;
    display: flex;
    align-items: center;
    gap: 7px;
    font: 500 10.5px/1 var(--mono);
    color: var(--muted);
}

/* Watched-names band: tinted config zone under the matches. */
.watch-band {
    border-top: 1px solid var(--border-subtle);
    background: rgba(20, 24, 26, .02);
    padding: 20px 24px 24px;
}

.watch-help {
    margin: 2px 0 16px;
    font: 400 13px/1.5 var(--sans);
    color: var(--text-2);
    max-width: 76ch;
}

.watch-groups {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.watch-group-card {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    padding: 16px;
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    background: #FFFFFF;
}

.watch-app-col {
    flex: 1 1 220px;
    min-width: 200px;
    display: flex;
    gap: 12px;
}

.watch-app-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.watch-app-name { font: 600 14px/1.3 var(--sans); letter-spacing: -.01em; }

.store-chips { display: flex; flex-wrap: wrap; gap: 5px; }

.watch-published { font: 500 10.5px/1 var(--mono); color: var(--muted); }

.watch-fields {
    flex: 2 1 340px;
    min-width: 260px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.watch-field { display: flex; flex-direction: column; gap: 5px; }

.watch-field-label {
    font: 600 10px/1 var(--mono);
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--muted);
}

.watch-input {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #FFFFFF;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.watch-input:hover { border-color: var(--border-strong); }

.watch-input:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(43, 78, 245, .14);
}

.watch-input input {
    flex: 1;
    min-width: 0;
    height: 100%;
    border: 0;
    outline: none;
    background: none;
    font: 500 13.5px/1.2 var(--sans);
    color: var(--ink);
}

.watch-input input:disabled { color: var(--muted); cursor: not-allowed; }

.watch-clear {
    flex: none;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 999px;
    background: var(--surface-alt);
    color: var(--muted);
    cursor: pointer;
    padding: 0;
    transition: background .15s ease, color .15s ease;
}

.watch-clear:hover { background: var(--border); color: var(--ink); }

/* CSS-only visibility: the clear button only shows once the field has text. */
.watch-input input:placeholder-shown + .watch-clear { display: none; }

.watch-add {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: 1px dashed var(--border);
    border-radius: 9px;
    padding: 7px 11px;
    font: 600 11.5px/1 var(--sans);
    color: var(--text-2);
    cursor: pointer;
    transition: border-color .15s ease, color .15s ease;
}

.watch-add:hover { border-color: var(--border-strong); color: var(--ink); }

.watch-add.is-maxed { display: none; }

.watch-save-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
    margin-top: 18px;
}

.watch-save-hint { font: 400 13px/1 var(--sans); color: var(--text-2); }

/* ---------- IP Toolbox placeholder pages ---------- */

.toolbox-card { max-width: 860px; }

.toolbox-plan {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 18px;
}

.toolbox-item {
    padding: 12px 15px;
    border: 1px dashed var(--border);
    border-radius: 11px;
    background: #FFFFFF;
    font: 400 13px/1.5 var(--sans);
    color: var(--text-2);
}

.toolbox-card .btn-primary { text-decoration: none; }

/* ---------- Connections screen ---------- */

.conn-hero {
    max-width: 720px;
    margin: 10px 0 8px;
    font: 700 clamp(28px, 3.2vw, 38px)/1.1 var(--sans);
    letter-spacing: -.03em;
    color: var(--ink);
    text-wrap: balance;
}

.conn-intro {
    margin: 2px 0 18px;
    font: 400 15px/1.6 var(--sans);
    color: var(--text-2);
}

.conn-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    align-items: flex-start;
}

.conn-card {
    flex: 1 1 440px;
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.conn-head {
    display: flex;
    align-items: center;
    gap: 12px;
}

.conn-icon {
    flex: none;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-2);
}

/* Status pills: semantic colour at 10% fill / 22% border (design README). */
.status-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    border-radius: 999px;
    padding: 6px 10px;
    font: 500 10.5px/1 var(--mono);
    letter-spacing: .09em;
    text-transform: uppercase;
    white-space: nowrap;
}

.status-pill .pill-dot { width: 6px; height: 6px; border-radius: 999px; background: currentColor; }

.status-pill.is-ok {
    background: rgba(14, 124, 102, .1);
    border: 1px solid rgba(14, 124, 102, .22);
    color: #0E7C66;
}

.status-pill.is-error {
    background: rgba(210, 64, 47, .1);
    border: 1px solid rgba(210, 64, 47, .22);
    color: #D2402F;
}

.status-pill.is-pending {
    background: var(--surface-alt);
    border: 1px solid var(--border);
    color: var(--text-2);
}

.status-pill.is-pending .pill-dot {
    background: var(--accent);
    animation: pill-pulse 1.6s ease-in-out infinite;
}

@keyframes pill-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }

.status-pill.is-soon {
    border: 1px solid var(--border);
    color: var(--muted);
}

.conn-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 26px;
    padding: 12px 14px;
    background: var(--surface-alt);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
}

.conn-meta > div { display: flex; flex-direction: column; gap: 5px; }

.conn-label {
    font: 500 10.5px/1 var(--mono);
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--muted);
}

.conn-value { font: 500 13px/1 var(--mono); color: var(--ink); }

.conn-note { font: 400 13.5px/1.55 var(--sans); color: var(--text-2); }

.conn-note.is-ok { color: #0E7C66; font-weight: 500; }

.conn-error-box {
    background: rgba(210, 64, 47, .1);
    border: 1px solid rgba(210, 64, 47, .22);
    color: #D2402F;
    border-radius: 10px;
    padding: 10px 12px;
    font: 500 13px/1.5 var(--sans);
}

.conn-error-top { max-width: 620px; margin-bottom: 18px; }

/* Numbered setup steps: accent tile numeral + body, per the landing "03 — SETUP" cards. */
.conn-steps {
    list-style: none;
    counter-reset: step;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.conn-steps li {
    counter-increment: step;
    position: relative;
    padding-left: 32px;
    font: 400 13.5px/1.55 var(--sans);
    color: var(--text-2);
}

.conn-steps li strong { color: var(--ink); font-weight: 600; }

.conn-steps li::before {
    content: counter(step);
    position: absolute;
    left: 0;
    top: 1px;
    width: 20px;
    height: 20px;
    border-radius: 6px;
    background: var(--accent);
    color: var(--accent-fg);
    font: 600 11px/20px var(--mono);
    text-align: center;
}

.conn-form {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.conn-form .conn-label { margin-top: 6px; }

.conn-form-row { display: flex; gap: 12px; }

.conn-form-row > div { flex: 1; display: flex; flex-direction: column; gap: 6px; }

.conn-form input[type="text"],
.conn-form input[type="file"] {
    width: 100%;
    background: #FFFFFF;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
    font: 400 13.5px/1.35 var(--sans);
    color: var(--ink);
    box-shadow: inset 0 1px 2px rgba(20, 24, 26, .04);
    transition: border-color .15s ease, box-shadow .15s ease;
}

.conn-form input::placeholder { color: var(--grey, #AEB5A6); }

.conn-form input:hover { border-color: var(--border-strong); }

.conn-form input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: inset 0 1px 2px rgba(20, 24, 26, .04), 0 0 0 3px rgba(43, 78, 245, .14);
}

.conn-form input[type="file"] { padding: 8px; font-size: 13px; color: var(--text-2); }

.conn-form input[type="file"]::file-selector-button {
    margin-right: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    padding: 6px 11px;
    font: 600 12px/1 var(--sans);
    color: var(--text-2);
    cursor: pointer;
}

.conn-form input[type="file"]::file-selector-button:hover { border-color: var(--border-strong); color: var(--ink); }

.conn-form-note {
    margin-top: 2px;
    font: 500 10.5px/1.5 var(--mono);
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--muted);
}

.conn-submit { margin-top: 8px; align-self: flex-start; }

.conn-replace summary {
    cursor: pointer;
    font: 600 13px/1 var(--sans);
    color: var(--text-2);
}

.conn-replace summary:hover { color: var(--ink); }

.conn-replace[open] summary { margin-bottom: 10px; }

.conn-remove {
    background: none;
    border: none;
    padding: 0;
    font: 600 12.5px/1 var(--sans);
    color: #D2402F;
    cursor: pointer;
    align-self: flex-start;
}

.conn-remove:hover { text-decoration: underline; }

.conn-card.is-soon .card-title,
.conn-soon-body { color: var(--text-2); }

.conn-soon-body { margin: 0; font: 400 13.5px/1.55 var(--sans); }

/* Invite-step panel shown while a Play grant propagates ("waiting" state). */
.conn-invite {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 14px;
    background: var(--surface-alt);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
}

.conn-invite-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.conn-invite-row code {
    flex: 1;
    min-width: 0;
    overflow-x: auto;
    white-space: nowrap;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 10px;
    font: 500 12px/1.3 var(--mono);
    color: var(--ink);
}

.copy-chip {
    flex: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    padding: 8px 12px;
    font: 600 12px/1 var(--sans);
    color: var(--text-2);
    cursor: pointer;
    transition: border-color .15s ease, color .15s ease;
}

.copy-chip:hover { border-color: var(--border-strong); color: var(--ink); }

.conn-invite-hint {
    font: 400 11.5px/1.5 var(--sans);
    color: var(--muted);
}

.conn-ext {
    font: 600 12px/1 var(--sans);
    color: var(--accent);
    text-decoration: none;
    white-space: nowrap;
}

.conn-ext:hover { color: var(--accent-hover); text-decoration: underline; }

/* ---------- Admin screen ---------- */

.admin-notice {
    max-width: 720px;
    margin: 2px 0 16px;
    padding: 11px 14px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--surface);
    font: 500 13.5px/1.45 var(--sans);
    color: var(--ink);
}

.admin-section-title {
    font: 600 17px/1.25 var(--sans);
    letter-spacing: -.01em;
    margin: 6px 0 12px;
}

.admin-section-title:not(:first-child) { margin-top: 28px; }

.admin-apps-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-start;
}

.admin-app-card {
    flex: 1 1 380px;
    max-width: 560px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.admin-app-head { display: flex; align-items: flex-start; gap: 12px; }

.admin-app-name { font: 600 15px/1.3 var(--sans); }

.admin-app-email { font: 500 12px/1.4 var(--mono); color: var(--text-2); }

.admin-app-date {
    font: 500 10.5px/1 var(--mono);
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--muted);
}

.admin-app-apps { display: flex; flex-wrap: wrap; gap: 6px; }

.admin-chip {
    font: 500 11.5px/1 var(--mono);
    color: var(--text-2);
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 5px 8px;
}

.admin-chip.is-invited, .admin-chip.is-onboarded { color: var(--positive); }
.admin-chip.is-declined { color: var(--negative); }

.admin-app-feedback {
    font: 400 13.5px/1.55 var(--sans);
    color: var(--text-2);
    border-left: 3px solid var(--border);
    padding-left: 12px;
    white-space: pre-line;
}

.admin-app-actions { display: flex; gap: 10px; margin-top: 2px; }

.admin-btn { padding: 9px 18px; }

.admin-btn-deny {
    font: 600 13.5px/1 var(--sans);
    color: var(--negative);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
}

.admin-btn-deny:hover { border-color: var(--negative); background: rgba(210, 64, 47, .06); }

.admin-btn-plain {
    display: inline-block;
    font: 600 13.5px/1 var(--sans);
    color: var(--text-2);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    text-decoration: none;
    transition: border-color .15s ease, color .15s ease, background .15s ease;
}

.admin-btn-plain:hover { border-color: var(--border-strong); color: var(--ink); background: var(--surface); }

.admin-notice-error { border-color: var(--negative); color: var(--negative); }

/* Copycat report edit form */

.admin-edit-form { display: flex; flex-direction: column; gap: 14px; max-width: 720px; margin-top: 14px; }

.admin-edit-row { display: flex; gap: 12px; flex-wrap: wrap; }

.admin-edit-field { display: flex; flex-direction: column; gap: 6px; }

.admin-edit-row > .admin-edit-field { flex: 1 1 240px; }

.conn-label-hint { text-transform: none; letter-spacing: .02em; color: var(--grey, #AEB5A6); }

.admin-edit-form input[type="text"],
.admin-edit-form input[type="url"],
.admin-edit-form input[type="date"],
.admin-edit-form select,
.admin-edit-form textarea {
    width: 100%;
    background: #FFFFFF;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
    font: 400 13.5px/1.35 var(--sans);
    color: var(--ink);
    box-shadow: inset 0 1px 2px rgba(20, 24, 26, .04);
    transition: border-color .15s ease, box-shadow .15s ease;
}

.admin-edit-form textarea { resize: vertical; }

.admin-edit-form input:hover,
.admin-edit-form select:hover,
.admin-edit-form textarea:hover { border-color: var(--border-strong); }

.admin-edit-form input:focus,
.admin-edit-form select:focus,
.admin-edit-form textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: inset 0 1px 2px rgba(20, 24, 26, .04), 0 0 0 3px rgba(43, 78, 245, .14);
}

.admin-edit-refetch {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font: 500 12.5px/1.5 var(--sans);
    color: var(--text-2);
    cursor: pointer;
}

.admin-edit-refetch input { margin-top: 2px; accent-color: var(--accent); }

.admin-empty {
    max-width: 560px;
    padding: 22px;
    font: 400 14px/1.55 var(--sans);
    color: var(--text-2);
}

.admin-decided {
    max-width: 720px;
    padding: 6px 18px;
    display: flex;
    flex-direction: column;
}

.admin-decided-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 0;
    border-bottom: 1px solid var(--border-subtle);
}

.admin-decided-row:last-child { border-bottom: none; }

.admin-decided-row .admin-btn { padding: 6px 11px; font-size: 12px; }
.admin-decided-row form { display: flex; }

/* Admin home — tool nav cards */

.admin-nav-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 18px 20px;
    color: inherit;
    text-decoration: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.admin-nav-card:hover { border-color: var(--border-strong); }
.admin-nav-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.admin-nav-head { display: flex; align-items: center; gap: 10px; }

.admin-nav-title { font: 600 15px/1.3 var(--sans); }

.admin-count {
    font: 500 11.5px/1 var(--mono);
    color: var(--accent);
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 5px 9px;
    white-space: nowrap;
}

.admin-count.is-quiet { color: var(--muted); }

.admin-nav-desc { margin: 0; font: 400 13.5px/1.5 var(--sans); color: var(--text-2); }

.admin-nav-go {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font: 600 13.5px/1 var(--sans);
    color: var(--accent);
}

.admin-nav-card:hover .admin-nav-go { color: var(--accent-hover); }

/* Admin users list */

.admin-users {
    max-width: 980px;
    padding: 6px 18px;
    display: flex;
    flex-direction: column;
}

.admin-user-row {
    display: grid;
    grid-template-columns: minmax(200px, 250px) 1fr 110px 80px;
    gap: 14px;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-subtle);
}

.admin-user-row:last-child { border-bottom: none; }

.admin-users-head {
    padding: 12px 0 9px;
    font: 500 10.5px/1 var(--mono);
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--muted);
}

.admin-user-id { display: flex; align-items: center; gap: 8px; min-width: 0; }
.admin-user-id .admin-app-email { overflow: hidden; text-overflow: ellipsis; }

.admin-user-apps { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }

.admin-user-workspace { font: 600 13px/1.3 var(--sans); margin-right: 4px; }

.admin-user-none { font: 400 13px/1.3 var(--sans); color: var(--muted); }

.admin-user-login { font: 500 12px/1.3 var(--mono); color: var(--text-2); }

.admin-user-actions { display: flex; justify-content: flex-end; }

.admin-user-actions .admin-btn { padding: 8px 14px; font-size: 12.5px; }

@media (max-width: 900px) {
    .admin-user-row { grid-template-columns: 1fr auto; }
    .admin-users-head { display: none; }
    .admin-user-apps { grid-column: 1 / -1; }
    .admin-user-login::before { content: "last sign-in · "; color: var(--muted); }
}

/* ---------- Profile screen ---------- */

.profile-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    align-items: flex-start;
}

.profile-card {
    flex: 1 1 380px;
    max-width: 560px;
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.profile-note { margin: 0; font: 400 13.5px/1.6 var(--sans); color: var(--text-2); }

.profile-note a { color: var(--accent); text-decoration: none; }

.profile-note a:hover { color: var(--accent-hover); text-decoration: underline; }

.profile-plan-row { display: flex; align-items: center; gap: 14px; }

.profile-plan-price { font: 600 30px/1 var(--disp); letter-spacing: -.02em; }

.profile-plan-unit { font: 500 13px/1 var(--sans); color: var(--muted); letter-spacing: 0; }

.profile-danger { border-color: rgba(210, 64, 47, .35); }

.profile-confirm {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    margin: 0 0 12px;
    font: 400 13px/1.5 var(--sans);
    color: var(--text-2);
    cursor: pointer;
}

.profile-confirm input {
    margin: 2px 0 0;
    width: 15px;
    height: 15px;
    accent-color: var(--negative);
    flex: none;
}

.conn-form-note a {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-color: rgba(43, 78, 245, .4);
    text-underline-offset: 2px;
}

.conn-form-note a:hover { color: var(--accent-hover); text-decoration-color: var(--accent-hover); }

/* "Sign in with Google" button nested inside setup step 1 */
.conn-steps .conn-form { margin-top: 10px; }

/* Both stores connected: celebratory header + big dashboard button */

.conn-done {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    margin: 10px 0 18px;
}

.conn-done .conn-hero { margin: 0; }

.conn-done-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: var(--accent);
    color: var(--accent-fg);
    text-decoration: none;
    border-radius: 13px;
    padding: 15px 28px;
    font: 600 15.5px/1 var(--sans);
    transition: background .15s ease;
}

.conn-done-btn:hover { background: var(--accent-hover); }

.conn-done-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(43, 78, 245, .3);
}
