/* Shared components. Colour, type size and radius come from base.css tokens. */

/* ---------- Icons ---------- */
.i { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; vertical-align: middle; }

.i-xs { width: 12px; height: 12px; }

.i-sm { width: 14px; height: 14px; }

.i-lg { width: 20px; height: 20px; }

.i-xl { width: 24px; height: 24px; }

.logo { width: 20px; height: 20px; border-radius: var(--radius-5); object-fit: contain; flex: 0 0 auto; }

.logo-lg { width: 32px; height: 32px; border-radius: var(--radius-8); }

.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); display: inline-block; flex: 0 0 auto; box-shadow: 0 0 0 3px var(--good-soft); }

.dot.warn { background: var(--warn-dot); box-shadow: 0 0 0 3px var(--warn-soft); }

.dot.bad { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }

.dot.off { background: var(--soft); box-shadow: 0 0 0 3px var(--paper); }

.dot.plain { box-shadow: none; width: 6px; height: 6px; }

.icon-btn { width: 36px; height: 36px; border-radius: var(--radius-pill); border: 1px solid var(--line); background: var(--surface); display: inline-grid; place-items: center; color: var(--muted); cursor: pointer; position: relative; flex: 0 0 auto; }

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

.icon-btn.sq { border-radius: var(--radius-sm); }

.icon-btn.sm { width: 30px; height: 30px; }

.icon-btn.ghost { border-color: transparent; background: transparent; }

.icon-btn.ghost:hover { background: var(--ink-05); }

.icon-btn .pip { position: absolute; top: 7px; right: 8px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); border: 1.5px solid var(--on-fill); }

.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--indigo-50); color: var(--indigo-700); display: inline-grid; place-items: center; font-weight: var(--weight-semibold); font-size: var(--text-sm); flex: 0 0 auto; }

.avatar.sm { width: 28px; height: 28px; font-size: var(--text-2xs); }

.avatar.pink { background: var(--pink-50); color: var(--pink-700); }

.avatar.teal { background: var(--teal-50); color: var(--teal-600); }

.avatar.warm { background: var(--paper); color: var(--ink-2); }

button.avatar { border: 0; padding: 0; cursor: pointer; }

/* ---------- Tabs (underline) ---------- */
.tabs { display: flex; gap: var(--space-6); border-bottom: 1px solid var(--line); margin-bottom: var(--space-6); overflow-x: auto; scrollbar-width: none; }

.tabs a, .tabs button { background: none; font: inherit; cursor: pointer; border-top: 0; border-left: 0; border-right: 0; display: inline-flex; gap: 8px; align-items: center; padding: 10px 2px 12px; color: var(--muted); font-weight: var(--weight-medium); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }

.tabs a:hover, .tabs button:hover { color: var(--ink); }

.tabs a.is-current, .tabs a.is-active, .tabs button.is-active, .tabs button[aria-selected="true"], .tabs button[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); font-weight: var(--weight-semibold); }

.count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--radius-pill); background: var(--paper); color: var(--muted); font-size: var(--text-2xs); font-weight: var(--weight-semibold); }

.tabs a.is-current .count, .tabs button[aria-selected="true"] .count, .tabs button[aria-current="page"] .count { background: var(--pink-50); color: var(--pink-700); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: var(--control-h); padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid transparent; font-size: var(--text-base); font-weight: var(--weight-medium); cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s, color .15s; }

.btn-primary { background: var(--primary); color: var(--on-fill); }

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

.btn-secondary { background: var(--surface); border-color: var(--line); color: var(--ink); box-shadow: var(--shadow-xs); }

.btn-secondary:hover { border-color: var(--line-strong); background: var(--surface-2); }

.btn-ghost { background: transparent; color: var(--muted); }

.btn-ghost:hover { background: var(--ink-05); color: var(--ink); }

.btn-link { background: none; border: 0; padding: 0; height: auto; color: var(--link); font-weight: var(--weight-medium); }

.btn-link:hover { text-decoration: underline; }

.btn-danger { background: var(--bad); color: var(--on-fill); }

.btn-danger-soft { background: var(--bad-soft); color: var(--bad); }

.btn-danger-soft:hover { background: var(--bad-hover); }

.btn-dark { background: var(--ink); color: var(--on-fill); }

.btn-sm { height: var(--control-h-sm); padding: 0 10px; font-size: var(--text-sm); border-radius: var(--radius-8); }

.btn-lg { height: 44px; padding: 0 18px; font-size: var(--text-lg-btn); border-radius: var(--radius-12); }

.btn-block { width: 100%; }

.btn[disabled], .btn.is-disabled { opacity: .5; cursor: not-allowed; }

.btn .kbd { margin-left: 2px; }

.kbd { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: var(--radius-5); background: var(--fill-18); font-size: var(--text-2xs); font-family: var(--font-mono); }

.btn-secondary .kbd { background: var(--paper); color: var(--muted); }

.spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--fill-40); border-top-color: var(--on-fill); animation: spin .8s linear infinite; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Segmented ---------- */
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--paper); border: 1px solid var(--line-soft); border-radius: var(--radius-12); max-width: 100%; overflow-x: auto; scrollbar-width: none; }

.seg button { border: 0; background: transparent; height: 30px; padding: 0 12px; border-radius: var(--radius-9); font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--muted); cursor: pointer; display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; }

.seg button:hover { color: var(--ink); }

.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px var(--ink-08), 0 0 0 1px var(--line); }

.seg.seg-indigo button[aria-pressed="true"] { background: var(--indigo-700); color: var(--on-fill); box-shadow: none; }

.seg.seg-sm button { height: 26px; padding: 0 10px; font-size: var(--text-xs); }

/* ---------- Forms ---------- */
.field { display: grid; gap: 6px; min-width: 0; align-content: start; }

/* C2: a hint or error under one field never pushes its neighbours down */
.label { font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--ink-2); display: flex; gap: 6px; align-items: center; }

.label .opt { color: var(--soft); font-weight: var(--weight-regular); }

.hint { font-size: var(--text-xs); color: var(--muted); margin: 0; }

.error-text { font-size: var(--text-xs); color: var(--bad); margin: 0; display: flex; gap: 6px; align-items: center; }

.input, .select, .textarea { height: var(--control-h); width: 100%; min-width: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); padding: 0 12px; font-size: var(--text-base); color: var(--ink); transition: border-color .15s, box-shadow .15s; }

.textarea { height: auto; min-height: 88px; padding: 10px 12px; resize: vertical; line-height: 1.5; }

.input::placeholder, .textarea::placeholder { color: var(--soft); }

.input:hover, .select:hover { border-color: var(--line-strong); }

.input:focus, .select:focus, .textarea:focus, .input.is-focus { outline: none; border-color: var(--indigo-700); box-shadow: var(--focus-ring); }

.input.is-error { border-color: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }

.input[disabled] { background: var(--paper); color: var(--soft); }

.input-sm { height: var(--control-h-sm); font-size: var(--text-sm); border-radius: var(--radius-8); padding: 0 10px; }

.select { appearance: none; -webkit-appearance: none; padding-right: 34px; background-image: var(--select-chevron); background-repeat: no-repeat; background-position: right 10px center; cursor: pointer; }

.affix { position: relative; display: flex; align-items: center; min-width: 0; }

.affix > .i, .affix > .pre { position: absolute; left: 12px; color: var(--soft); pointer-events: none; font-size: var(--text-base); }

.affix > .input { padding-left: 34px; }

.affix > .post { position: absolute; right: 12px; color: var(--soft); font-size: var(--text-sm); pointer-events: none; }

.affix > .input.has-post { padding-right: 36px; }

.check { display: inline-flex; gap: 10px; align-items: flex-start; font-size: var(--text-base); color: var(--ink-2); cursor: pointer; }

.check input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--indigo-700); flex: 0 0 auto; }

.check small { display: block; color: var(--muted); font-size: var(--text-xs); }

.switch { position: relative; width: 36px; height: 20px; border-radius: var(--radius-pill); background: var(--line-strong); flex: 0 0 auto; display: inline-block; vertical-align: middle; }

.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--on-fill); box-shadow: 0 1px 2px var(--black-20); transition: left .15s; }

.switch.on { background: var(--indigo-700); }

.switch.on::after { left: 18px; }

.form-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--space-4); }

.c-3 { grid-column: span 3; }

.c-4 { grid-column: span 4; }

.c-5 { grid-column: span 5; }

.c-6 { grid-column: span 6; }

.c-8 { grid-column: span 8; }

.c-12 { grid-column: 1 / -1; }

.form-section { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: var(--space-8); padding: var(--space-6) 0; border-top: 1px solid var(--line-soft); }

.form-section:first-child { border-top: 0; padding-top: 0; }

.form-section h4 { margin: 0 0 4px; font-size: var(--text-base); font-weight: var(--weight-semibold); }

.form-section p { margin: 0; color: var(--muted); font-size: var(--text-sm); }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs); min-width: 0; }

.card.is-flat { box-shadow: none; }

.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: 18px var(--space-5) 0; flex-wrap: wrap; }

.card-head.has-border { padding-bottom: 16px; border-bottom: 1px solid var(--line-soft); }

.card-title { margin: 0; font-size: var(--text-md); font-weight: var(--weight-semibold); letter-spacing: -0.01em; display: flex; align-items: center; gap: 8px; }

.card-sub { margin: 2px 0 0; font-size: var(--text-sm); color: var(--muted); }

.card-body { padding: var(--space-4) var(--space-5) var(--space-5); }

.card-foot { padding: 12px var(--space-5); border-top: 1px solid var(--line-soft); display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: var(--text-sm); color: var(--muted); }

.inset { background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: var(--radius-md); padding: 12px 14px; min-width: 0; }

.card-icon { width: 32px; height: 32px; border-radius: var(--radius-sm); background: var(--paper); color: var(--ink-2); display: inline-grid; place-items: center; flex: 0 0 auto; }

.card-icon.pink { background: var(--pink-50); color: var(--pink-700); }

.card-icon.indigo { background: var(--indigo-50); color: var(--indigo-700); }

.card-icon.teal { background: var(--teal-50); color: var(--teal-600); }

/* ---------- KPI ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-4); }

.kpi { padding: 18px var(--space-5) 16px; display: flex; flex-direction: column; min-width: 0; position: relative; }

a.kpi { color: inherit; text-decoration: none; transition: border-color .15s, box-shadow .15s; }

a.kpi:hover { border-color: var(--line); box-shadow: var(--shadow-sm); }

.kpi-head { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: var(--text-sm); font-weight: var(--weight-medium); min-width: 0; }

.kpi-head .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.kpi-value { font-size: var(--text-2xl); font-weight: var(--weight-semibold); letter-spacing: -0.02em; line-height: 1.15; margin-top: 10px; white-space: nowrap; }

.kpi-value small { font-size: var(--text-md); color: var(--muted); font-weight: var(--weight-medium); margin-left: 2px; }

.kpi-foot { display: flex; align-items: center; gap: 8px; font-size: var(--text-xs); color: var(--muted); margin-top: 8px; flex-wrap: wrap; }

.kpi .spark { display: block; width: 100%; height: 40px; margin-top: 12px; }

.kpi-strip { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs); overflow: hidden; }

.kpi-strip > .kpi + .kpi { border-left: 1px solid var(--line-soft); }

.kpi-strip .kpi-value { font-size: var(--text-kpi); }

.kpi-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }

.kpi-row .spark { width: 96px; height: 34px; margin: 0; }

/* ---------- Delta, badges, tags ---------- */
.delta { display: inline-flex; align-items: center; gap: 2px; height: 22px; padding: 0 7px 0 5px; border-radius: var(--radius-7); font-size: var(--text-xs); font-weight: var(--weight-semibold); white-space: nowrap; }

.delta.up { background: var(--good-soft); color: var(--good); }

.delta.down { background: var(--bad-soft); color: var(--bad); }

.delta.flat { background: var(--paper); color: var(--muted); padding: 0 7px; }

.delta .i { width: 12px; height: 12px; stroke-width: 2.4; }

.badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: var(--radius-pill); font-size: var(--text-xs); font-weight: var(--weight-medium); background: var(--paper); color: var(--ink-2); border: 1px solid var(--line-soft); white-space: nowrap; }

.badge .i { width: 12px; height: 12px; }

.badge.good { background: var(--good-soft); color: var(--good); border-color: transparent; }

.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }

.badge.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }

.badge.info { background: var(--indigo-50); color: var(--indigo-700); border-color: transparent; }

.badge.pink { background: var(--pink-50); color: var(--pink-700); border-color: transparent; }

.badge.outline { background: var(--surface); border-color: var(--line); }

.badge.solid-good { background: var(--good); color: var(--on-fill); border-color: transparent; }

.tag { display: inline-flex; align-items: center; height: 20px; padding: 0 6px; border-radius: var(--radius-xs); border: 1px solid var(--line); color: var(--muted); font-size: var(--text-2xs); font-weight: var(--weight-semibold); letter-spacing: .04em; text-transform: uppercase; background: var(--surface); white-space: nowrap; }

.chan { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-xs); color: var(--ink-2); font-weight: var(--weight-medium); white-space: nowrap; }

.chan img { width: 14px; height: 14px; border-radius: var(--radius-3); }

/* ---------- Alerts ---------- */
.alert { display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--radius-md); border: 1px solid; align-items: flex-start; font-size: var(--text-sm); }

.alert > .i { margin-top: 1px; width: 18px; height: 18px; }

.alert-title { font-weight: var(--weight-semibold); color: var(--ink); font-size: var(--text-base); }

.alert p { margin: 2px 0 0; color: var(--ink-2); }

.alert-actions { margin-left: auto; display: flex; gap: 8px; align-self: center; flex-wrap: wrap; }

.alert.info { background: var(--indigo-50); border-color: var(--indigo-100); color: var(--indigo-700); }

.alert.good { background: var(--good-soft); border-color: var(--good-line); color: var(--good); }

.alert.warn { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn); }

.alert.bad { background: var(--bad-soft); border-color: var(--bad-line); color: var(--bad); }

.alert.neutral { background: var(--surface); border-color: var(--line); color: var(--muted); }

.freshness { display: flex; align-items: center; gap: 10px 16px; flex-wrap: wrap; padding: 10px 14px 10px 16px; background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius-md); font-size: var(--text-sm); color: var(--muted); }

.freshness strong { color: var(--ink); font-weight: var(--weight-semibold); }

.freshness .sep { width: 1px; height: 16px; background: var(--line); }

.funnel { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0; }

.fstep { position: relative; padding: var(--space-4); min-width: 0; }

.fstep + .fstep { border-left: 1px dashed var(--line); }

.fstep .k,
.fstep .ad-pulse-k { display: block; font-size: var(--text-sm); color: var(--muted); font-weight: var(--weight-medium); text-transform: none; letter-spacing: 0; }

.fstep .v,
.fstep .ad-pulse-value { font-size: var(--text-xl); font-weight: var(--weight-semibold); letter-spacing: -0.01em; margin: var(--space-2) 0 var(--space-3); font-variant-numeric: tabular-nums; }

.fstep .rate { position: absolute; bottom: var(--space-3); left: 0; transform: translateX(-50%); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-pill); padding: 0 var(--space-2); font-size: var(--text-2xs); font-weight: var(--weight-semibold); color: var(--indigo-700); white-space: nowrap; z-index: 1; }

.fbar { height: var(--space-3); border-radius: var(--radius-2); background: var(--indigo-50); box-shadow: inset 0 0 0 1px var(--indigo-100); position: relative; overflow: hidden; }

.fbar > i { position: absolute; left: 0; bottom: 0; top: 0; border-radius: 0; background: var(--indigo-700); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; max-width: 100%; }

.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--text-base); }

.table th { text-align: left; font-size: var(--text-xs); font-weight: var(--weight-medium); color: var(--muted); padding: 10px 16px; background: var(--surface-2); border-bottom: 1px solid var(--line-soft); white-space: nowrap; }

.table th.up { text-transform: uppercase; letter-spacing: .05em; font-size: var(--text-2xs); }

.table th .sort { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }

.table th .sort.is-on { color: var(--ink); }

.table td { padding: 12px 16px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; color: var(--ink); background: var(--surface); }

.table tbody tr:hover td { background: var(--row-hover); }

.table tbody tr:last-child td { border-bottom: 0; }

.table .r { text-align: right; }

.table .c { text-align: center; }

.table .muted { color: var(--muted); }

.table tfoot td { font-weight: var(--weight-semibold); background: var(--surface-2); border-top: 1px solid var(--line); border-bottom: 0; }

.table .sticky { position: sticky; left: 0; z-index: 1; }

.table th.sticky { z-index: 2; }

.table .sticky::after { content: ""; position: absolute; top: 0; right: -1px; bottom: 0; width: 1px; background: var(--line-soft); }

.table tr.is-child td { background: var(--surface-2); }

.table tr.is-child td:first-child { padding-left: 52px; }

.table tr.is-grandchild td:first-child { padding-left: 84px; }

.table tr.is-selected td { background: var(--indigo-50); }

.table.compact td { padding: 9px 14px; }

.table.compact th { padding: 8px 14px; }

.cell { display: flex; align-items: center; gap: 10px; min-width: 0; }

.cell-title { font-weight: var(--weight-medium); color: var(--ink); overflow: hidden; text-overflow: ellipsis; }

.cell-sub { font-size: var(--text-xs); color: var(--muted); }

.exp { width: 22px; height: 22px; border-radius: var(--radius-xs); border: 1px solid var(--line); background: var(--surface); display: inline-grid; place-items: center; color: var(--muted); cursor: pointer; flex: 0 0 auto; padding: 0; }

.exp.open .i { transform: rotate(90deg); }

.gap-chip { font-size: var(--text-xs); font-weight: var(--weight-semibold); padding: 2px 6px; border-radius: var(--radius-xs); }

.gap-chip.pos { background: var(--warn-soft); color: var(--warn); }

.gap-chip.neg { background: var(--indigo-50); color: var(--indigo-700); }

.toolbar { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; padding: 14px 16px; border-bottom: 1px solid var(--line-soft); }

.toolbar .spacer { flex: 1; }

.pager { display: flex; align-items: center; gap: 8px; justify-content: space-between; padding: 12px 16px; font-size: var(--text-sm); color: var(--muted); border-top: 1px solid var(--line-soft); flex-wrap: wrap; }

.pager .pages { display: flex; gap: 4px; }

.pager .pages button { min-width: 32px; height: 32px; border-radius: var(--radius-8); border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer; }

.pager .pages button.is-current { border-color: var(--line); background: var(--surface); color: var(--ink); font-weight: var(--weight-semibold); }

.mini-bar { display: inline-block; width: 64px; height: 6px; border-radius: var(--radius-pill); background: var(--paper); vertical-align: middle; margin-left: 8px; overflow: hidden; }

.mini-bar > i { display: block; height: 100%; border-radius: inherit; background: var(--indigo-700); }

/* ---------- Tooltip, menu, popover ---------- */
.tip { position: relative; display: inline-grid; }

.info-btn { width: 16px; height: 16px; border-radius: 50%; border: 0; background: transparent; color: var(--soft); padding: 0; display: inline-grid; place-items: center; cursor: help; }

.info-btn:hover { color: var(--ink-2); }

.tip-bubble { position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%); width: 240px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--ink); color: var(--on-fill); font-size: var(--text-xs); font-weight: var(--weight-regular); line-height: 1.45; opacity: 0; pointer-events: none; transition: opacity .15s; z-index: 20; box-shadow: var(--shadow-md); text-align: left; white-space: normal; text-transform: none; letter-spacing: 0; }

.tip-bubble b { display: block; margin-bottom: 2px; font-weight: var(--weight-semibold); }

.tip:hover .tip-bubble, .tip:focus-within .tip-bubble { opacity: 1; }

.tip-bubble.is-static { position: relative; opacity: 1; bottom: auto; left: auto; transform: none; display: block; }

.menu { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius-md); box-shadow: var(--shadow-md); padding: 6px; min-width: 232px; }

.menu-item { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: var(--radius-8); color: var(--ink-2); font-size: var(--text-base); text-decoration: none; cursor: pointer; }

.menu-item:hover, .menu-item.is-hover { background: var(--paper); color: var(--ink); }

.menu-item .i { color: var(--muted); }

.menu-item .end { margin-left: auto; color: var(--soft); font-size: var(--text-xs); }

.menu-item.is-on { color: var(--indigo-700); font-weight: var(--weight-medium); }

.menu-item.is-on .i { color: var(--indigo-700); }

.menu-item.danger { color: var(--bad); }

.menu-item.danger .i { color: var(--bad); }

.menu-sep { height: 1px; background: var(--line-soft); margin: 6px 0; }

.menu-label { padding: 8px 10px 4px; font-size: var(--text-2xs); font-weight: var(--weight-semibold); color: var(--soft); text-transform: uppercase; letter-spacing: .06em; }

.menu-who { padding: 10px; display: flex; gap: 10px; align-items: center; }

.menu-who strong { display: block; font-size: var(--text-sm); }

.menu-who span { font-size: var(--text-xs); color: var(--muted); }

/* ---------- Modal / drawer / toast / selection bar ---------- */
.scrim { background: var(--ink-32); padding: var(--space-10) var(--space-6); display: grid; place-items: center; border-radius: var(--radius-md); }

.modal { width: min(560px, 100%); background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); overflow: hidden; }

.modal.wide { width: min(880px, 100%); }

.modal-head { padding: 20px 24px 0; display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }

.modal-head h3 { margin: 0; font-size: var(--text-lg); font-weight: var(--weight-semibold); }

.modal-head p { margin: 4px 0 0; color: var(--muted); font-size: var(--text-sm); }

.modal-body { padding: 20px 24px; }

.modal-foot { padding: 14px 24px; border-top: 1px solid var(--line-soft); display: flex; justify-content: flex-end; gap: 8px; background: var(--surface-2); }

.modal-foot .left { margin-right: auto; }

.drawer-stage { display: grid; grid-template-columns: 1fr 460px; min-height: 560px; background: var(--ink-22); border-radius: var(--radius-md); overflow: hidden; }

.drawer { background: var(--surface); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; }

.drawer-head { padding: 20px 24px; border-bottom: 1px solid var(--line-soft); display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }

.drawer-body { padding: 20px 24px; display: grid; gap: 20px; align-content: start; }

.toast { display: inline-flex; gap: 12px; align-items: center; background: var(--ink); color: var(--on-fill); padding: 12px 12px 12px 16px; border-radius: var(--radius-md); box-shadow: var(--shadow-lg); font-size: var(--text-sm); justify-self: end; width: max-content; max-width: 100%; }

.toast .i { color: var(--toast-icon); }

.toast.bad .i { color: var(--toast-icon-bad); }

.toast a { color: var(--on-fill); font-weight: var(--weight-semibold); }

.selbar { display: inline-flex; align-items: center; gap: 4px; background: var(--ink); color: var(--on-fill); border-radius: var(--radius-md); padding: 6px; box-shadow: var(--shadow-lg); font-size: var(--text-sm); }

.selbar .n { padding: 0 10px; color: var(--fill-70); }

.selbar button { background: transparent; border: 0; color: var(--on-fill); height: 32px; padding: 0 10px; border-radius: var(--radius-9); display: inline-flex; gap: 6px; align-items: center; cursor: pointer; font-size: var(--text-sm); }

.selbar button:hover { background: var(--fill-10); }

.selbar .sep { width: 1px; height: 18px; background: var(--fill-20); margin: 0 4px; }

.selbar button.danger { color: var(--selbar-danger); }

/* ---------- States ---------- */
.sk { background: linear-gradient(90deg, var(--sk-a) 25%, var(--sk-b) 37%, var(--sk-a) 63%); background-size: 400% 100%; animation: sk 1.4s ease infinite; border-radius: var(--radius-8); }

@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

@media (prefers-reduced-motion: reduce) { .sk, .spin { animation: none; } html { scroll-behavior: auto; } }

.empty { display: grid; justify-items: center; text-align: center; gap: 6px; padding: var(--space-10) var(--space-6); }

.empty-icon { width: 48px; height: 48px; border-radius: var(--radius-md); background: var(--paper); display: grid; place-items: center; color: var(--muted); margin-bottom: 6px; }

.empty-icon.bad { background: var(--bad-soft); color: var(--bad); }

.empty-icon.warn { background: var(--warn-soft); color: var(--warn); }

.empty-icon.indigo { background: var(--indigo-50); color: var(--indigo-700); }

.empty h4 { margin: 0; font-size: var(--text-md); font-weight: var(--weight-semibold); }

.empty p { margin: 0; color: var(--muted); max-width: 46ch; font-size: var(--text-sm); }

.empty .row { margin-top: 10px; justify-content: center; }

/* ---------- Charts ---------- */
.chart { width: 100%; height: auto; display: block; overflow: visible; }

.chart text { font-family: var(--font-sans); font-size: var(--text-2xs); fill: var(--soft); }

.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: var(--text-sm); color: var(--muted); }

.legend span { display: inline-flex; align-items: center; gap: 6px; }

.sw { width: 10px; height: 10px; border-radius: var(--radius-3); display: inline-block; }

.sw.ln { width: 14px; height: 3px; border-radius: var(--radius-2); }

.sw.dash { width: 14px; height: 2px; background: repeating-linear-gradient(90deg, var(--chart-prev) 0 4px, transparent 4px 7px) !important; }

.bar { height: 8px; border-radius: var(--radius-pill); background: var(--paper); overflow: hidden; }

.bar > i { display: block; height: 100%; border-radius: inherit; background: var(--indigo-700); }

.bar.thick { height: 10px; }

.stackbar { display: flex; height: 10px; border-radius: var(--radius-pill); overflow: hidden; gap: 2px; }

.stackbar > i { display: block; height: 100%; }

/* ---------- Layout helpers ---------- */

.list { margin: 0; padding: 0; list-style: none; }

.list > li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }

.list > li:last-child { border-bottom: 0; }

/* C10 resize fail-safes */
svg.chart { display: block; width: 100%; height: auto; min-width: var(--chart-min); }

div:has(> svg.chart) { overflow-x: auto; overflow-y: hidden; }

.donut { display: flex; flex-wrap: wrap; gap: 16px 20px; align-items: center; }

.donut > svg { width: min(170px, 100%); flex: 0 0 auto; margin: 0 auto; }

.donut > .list { flex: 1 1 200px; min-width: 0; }

.donut > .list .sm.grow { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Date picker */
.datepop { display: grid; grid-template-columns: 180px 1fr; width: min(720px, 100%); max-width: 100%; padding: 0; }

.datepop .presets { border-right: 1px solid var(--line-soft); padding: var(--space-2); display: grid; gap: 2px; align-content: start; }

.datepop .months { padding: var(--space-4) var(--space-5); display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-6); }

.datepop .month-spacer { width: var(--control-h-sm); flex: 0 0 auto; }

.date-range-static > [data-ui-date-range-button] { display: none; }

.mcal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; font-size: var(--text-sm); }

.mcal .h { font-size: var(--text-2xs); color: var(--soft); padding: var(--space-1) 0; }

.mcal span,
.mcal button { height: 34px; display: grid; place-items: center; border-radius: var(--radius-8); color: var(--ink-2); }

.mcal button { border: 0; background: transparent; padding: 0; font: inherit; cursor: pointer; }

.mcal button:hover:not(:disabled):not(.s):not(.e) { background: var(--paper); }

.mcal button:disabled { color: var(--line-strong); cursor: default; }

.mcal span.o { color: var(--line-strong); }

.mcal span.in,
.mcal button.in { background: var(--indigo-50); border-radius: 0; color: var(--indigo-700); }

.mcal span.s,
.mcal span.e,
.mcal button.s,
.mcal button.e { background: var(--indigo-700); color: var(--on-fill); font-weight: var(--weight-semibold); }

.mcal span.s,
.mcal button.s { border-radius: var(--radius-8) 0 0 var(--radius-8); }

.mcal span.e,
.mcal button.e { border-radius: 0 var(--radius-8) var(--radius-8) 0; }

.mcal span.s.e,
.mcal button.s.e { border-radius: var(--radius-8); }

.mcal span.t,
.mcal button.t { box-shadow: inset 0 0 0 1px var(--line-strong); }

.datepop .foot { grid-column: 1 / -1; border-top: 1px solid var(--line-soft); padding: 12px 16px; display: flex; gap: 8px; align-items: center; background: var(--surface-2); }
/* Behaviour shells and reference-page pieces. Values stay on the tokens. */
.logo.sm { width: 14px; height: 14px; }
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.swatch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(150px, 100%), 1fr)); gap: var(--space-3); }
.swatch { border: 1px solid var(--line-soft); border-radius: var(--radius-md); overflow: hidden; background: var(--surface); min-width: 0; }
.swatch-chip { height: 64px; }
.swatch div { padding: 8px 10px; }
.swatch b { display: block; font-weight: var(--weight-semibold); font-size: var(--text-xs); }
.swatch code { font-family: var(--font-mono); font-size: var(--text-2xs); color: var(--muted); }
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(96px, 100%), 1fr)); gap: var(--space-2); }
.icon-cell { display: grid; justify-items: center; gap: 6px; padding: 12px 4px; border: 1px solid var(--line-soft); border-radius: var(--radius-12); background: var(--surface-2); min-width: 0; }
.code { display: block; margin: 0; max-width: 100%; overflow: auto; white-space: pre; font-family: var(--font-mono); font-size: var(--text-sm); background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: var(--radius-sm); padding: var(--space-3); color: var(--ink-2); }
.chart-frame { overflow-x: auto; overflow-y: hidden; max-width: 100%; min-width: 0; }
.chart-plot { position: relative; width: 100%; min-width: var(--chart-min); height: var(--chart-h); }
.chart-plot > canvas { display: block; }
.donut > .chart-plot { width: min(var(--chart-donut), 100%); min-width: 0; height: var(--chart-donut); flex: 0 0 auto; margin-inline: auto; }
.menu-pop { position: relative; display: inline-block; max-width: 100%; }
.menu-pop > .menu { position: absolute; z-index: 30; top: calc(100% + var(--space-1)); left: 0; }

.menu-pop > .menu.datepop:not(.is-inline) {
  width: min(720px, calc(100vw - var(--space-8)));
  max-width: min(720px, calc(100vw - var(--space-8)));
  grid-template-columns: 180px minmax(0, 1fr);
  padding: 0;
}

.menu-pop > .menu.datepop:not(.is-inline) .months {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

@media (max-width: 760px) {
  .menu-pop > .menu.datepop:not(.is-inline) {
    grid-template-columns: minmax(0, 1fr);
  }

  .menu-pop > .menu.datepop:not(.is-inline) .months {
    grid-template-columns: minmax(0, 1fr);
  }
}

.datepop.is-inline { position: static; width: min(720px, 100%); }

.menu-pop.align-end > .menu { left: auto; right: 0; }

.menu form { margin: 0; }

.menu-store.inset { margin: 0 var(--space-1) var(--space-2); }

.menu-store .strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-pop > .menu[hidden] { display: none; }
button.menu-item { width: 100%; border: 0; background: transparent; text-align: left; font: inherit; color: inherit; }
button.switch { border: 0; padding: 0; cursor: pointer; }
.switch[aria-pressed="true"] { background: var(--primary); }
.switch[aria-pressed="true"]::after { left: 18px; }
.modal-root { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: var(--space-6); background: var(--scrim); }
.modal-root[hidden] { display: none; }
.modal-root .modal { max-height: calc(100vh - var(--space-12)); overflow: auto; }
.drawer-root { position: fixed; inset: 0; z-index: 40; background: var(--overlay); }
.drawer-root[hidden] { display: none; }
.drawer-root .drawer { position: absolute; top: 0; right: 0; height: 100%; width: min(460px, 100%); max-width: 100%; overflow: auto; }
.toast-host { position: fixed; z-index: 60; right: var(--space-4); bottom: var(--space-4); display: grid; gap: var(--space-2); width: min(420px, calc(100% - var(--space-8))); }
.toast .icon-btn.ghost { color: var(--on-fill); }
.toast .icon-btn.ghost:hover { background: var(--fill-10); color: var(--on-fill); }
.seg, .tabs, .table-wrap, .chart-frame, .code, .datepop, .menu-pop, .swatch-grid, .icon-grid, .form-grid { min-width: 0; max-width: 100%; }
.input.is-error:focus, .input.is-error:focus-visible, .textarea.is-error:focus-visible, .select.is-error:focus-visible { border-color: var(--bad); box-shadow: var(--focus-ring); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); }

/* Campaign cards (Ad Pulse). */
.camp { padding: 0; overflow: hidden; }
.camp-head { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--line-soft); flex-wrap: wrap; }
.rank { width: 28px; height: 28px; border-radius: var(--radius-9); background: var(--ink); color: var(--on-fill); display: inline-grid; place-items: center; font-size: var(--text-sm); font-weight: var(--weight-semibold); flex: 0 0 auto; }
.rank.is-muted { background: var(--paper); color: var(--muted); }
.camp-name { font-size: var(--text-md); font-weight: var(--weight-semibold); margin: 0; }
.camp-stats { display: flex; margin-left: auto; }
.camp-stats > div { padding: 0 var(--space-4); border-left: 1px solid var(--line-soft); text-align: right; }
.camp-stats > div:first-child { border-left: 0; }
.camp-stats > div > span { display: block; font-size: var(--text-xs); color: var(--muted); }
.camp-stats b { font-size: var(--text-md); font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums; }
.camp-body { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.2fr); }
.camp-body[hidden] { display: none; }
.camp-body > div { padding: var(--space-4) var(--space-5); min-width: 0; }
.camp-body > div + div { border-left: 1px solid var(--line-soft); }
.panel-k { font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--muted); margin: 0 0 10px; display: flex; justify-content: space-between; align-items: center; gap: var(--space-2); }
.thumbs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-2); }
button.thumb { width: 100%; padding: 0; font: inherit; color: inherit; cursor: pointer; }
.thumb { aspect-ratio: 1; border-radius: var(--radius-sm); position: relative; overflow: hidden; border: 1px solid var(--line-soft); background: var(--paper); }
.thumb .n { position: absolute; top: var(--space-1); left: var(--space-1); background: var(--scrim-photo); color: var(--on-fill); border-radius: var(--radius-5); font-size: var(--text-2xs); font-weight: var(--weight-semibold); padding: 0 var(--space-1); line-height: 16px; z-index: 1; }
.tiles2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); }
.tile { background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: var(--radius-sm); padding: var(--space-2) 10px; min-width: 0; }
.tile > span { display: block; font-size: var(--text-2xs); color: var(--muted); }
.tile b { font-size: var(--text-base); font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums; }
.mini-funnel { display: grid; gap: 6px; font-size: var(--text-xs); }
.mini-funnel > div { display: grid; grid-template-columns: minmax(0, max-content) minmax(0, 1fr) auto; gap: var(--space-2); align-items: center; }
.mini-funnel .bar { height: 6px; }
.mini-funnel .bar > i.is-sales { background: var(--chart-sales); }
.mini-funnel b { text-align: right; font-weight: var(--weight-semibold); color: var(--ink); font-variant-numeric: tabular-nums; }

/* Feedback form, opened from the top bar and the account menu. */
.feedback-status {
  min-height: 1.2em;
  margin: var(--space-2) 0 0;
  color: var(--primary);
  font-size: var(--text-sm);
}
