﻿/*
  Visual style layer for the popup: this stylesheet defines theme tokens, layout primitives, tab/content styling,
  chart/metric presentation, dialog states, and utility classes used across the popup interface so behavior code in
  tagging.js can switch states/themes by toggling classes without owning low-level visual rules.
*/
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
[data-theme="forest"] :root,
[data-theme="forest"] {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --border: #dce3eb;
  --text: #0f172a;
  --text-muted: #475569;
  --primary: #0f766e;
  --primary-strong: #0b5f59;
  --primary-soft: #d6f3ef;
  --primary-text: var(--primary-strong);
  --danger: #b42318;
  --ok: #0f766e;
  --ring: rgba(15, 118, 110, 0.24);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
}

[data-theme="light"] :root,
[data-theme="light"] {
  color-scheme: light;
  --bg: #fbfaff;
  --surface: #ffffff;
  --surface-soft: #f1f5f9;
  --border: #d9dde5;
  --text: #111827;
  --text-muted: #475569;
  --primary: #5538f2;
  --primary-strong: #432cc7;
  --primary-soft: #ebe7ff;
  --primary-text: var(--primary-strong);
  --danger: #b91c1c;
  --ok: #0f766e;
  --ring: rgba(85, 56, 242, 0.24);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] :root,
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0e14;
  --surface: #121826;
  --surface-soft: #1b2335;
  --border: #1d2740;
  --text: #e8ecf1;
  --text-muted: #8a93a6;
  --primary: #5c7fd0;
  --primary-strong: #415ca3;
  --primary-soft: #172544;
  --primary-text: #7087c3;
  --danger: #ff8a80;
  --ok: #4db6ac;
  --ring: rgba(92, 127, 208, 0.24);
  --shadow-sm: 0 18px 40px rgba(2, 6, 23, 0.38);
}

[data-theme="aqua"] :root,
[data-theme="aqua"] {
  --bg: #e0f7fa;
  --surface: #ffffff;
  --surface-soft: #e6fbfd;
  --border: #b2ebf2;
  --text: #0b2c3d;
  --text-muted: #2c4755;
  --primary: #00bcd4;
  --primary-strong: #0097a7;
  --primary-soft: #c8f4fb;
  --primary-text: var(--primary-strong);
  --danger: #c62828;
  --ok: #0f766e;
  --ring: rgba(0, 188, 212, 0.24);
  --shadow-sm: 0 1px 2px rgba(11, 44, 61, 0.08);
}

[data-theme="violet"] :root,
[data-theme="violet"] {
  --bg: #f3e8ff;
  --surface: #ffffff;
  --surface-soft: #f8f1ff;
  --border: #e2d9f3;
  --text: #1f172a;
  --text-muted: #4b3b5f;
  --primary: #5439f2;
  --primary-strong: #3f2ac0;
  --primary-soft: #e8e4ff;
  --primary-text: var(--primary-strong);
  --danger: #c53030;
  --ok: #0f766e;
  --ring: rgba(84, 57, 242, 0.24);
  --shadow-sm: 0 1px 2px rgba(31, 23, 42, 0.08);
}

[data-theme="mono"] :root,
[data-theme="mono"] {
  --bg: #f5f5f5;
  --surface: #ffffff;
  --surface-soft: #f0f0f0;
  --border: #d6d6d6;
  --text: #1f1f1f;
  --text-muted: #4b4b4b;
  --primary: #000000;
  --primary-strong: #111111;
  --primary-soft: #e5e5e5;
  --primary-text: var(--primary-strong);
  --danger: #b91c1c;
  --ok: #0f766e;
  --ring: rgba(0, 0, 0, 0.2);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
}

body {
  --font-ui-stack: "Manrope", "Segoe UI", "Inter", "Avenir Next", Arial, sans-serif;
  --font-display-stack: var(--font-ui-stack);
  font-family: var(--font-ui-stack);
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body[data-surface="popup"] { width: 560px; }
body[data-surface="app"] { width: 100%; min-width: 0; min-height: 100vh; }
body[data-surface="app"] .header { padding-inline: clamp(12px, 2.5vw, 28px); }
body[data-surface="app"] .header-row { max-width: 1024px; margin-inline: auto; }
body[data-surface="app"] .container { max-width: 1080px; margin-inline: auto; }
body[data-surface="app"] .container { padding: clamp(12px, 2.5vw, 28px); }

[data-popup-harness] body {
  width: auto !important;
  min-width: 0;
}

[data-theme="dark"] body {
  background:
    radial-gradient(circle at top right, rgba(135, 176, 255, 0.12), transparent 42%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg) 100%);
}

.container { padding: 12px; }
.flex { display: flex; }
.grid { display: grid; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: .5rem; }
.gap-3 { gap: .75rem; }
.gap-4 { gap: 1rem; }
.mt-1 { margin-top: .25rem; }
.mt-2 { margin-top: .5rem; }
.mt-3 { margin-top: .75rem; }
.mt-4 { margin-top: 1rem; }
.ml-2 { margin-left: .5rem; }
.text-sm { font-size: .875rem; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.header {
  border-bottom: 1px solid color-mix(in srgb, var(--primary) 10%, var(--border));
  background: linear-gradient(
    140deg,
    color-mix(in srgb, var(--primary-soft) 30%, var(--surface)) 0%,
    color-mix(in srgb, var(--primary-soft) 64%, var(--surface)) 100%
  );
  padding: .75rem .95rem;
}
.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  transform: translateY(2px);
}
.header-actions {
  display: flex;
  align-items: center;
  gap: .35rem;
}
.logo-line {
  display: flex;
  align-items: center;
  gap: .55rem;
}
.logo-icon-frame {
  display: flex;
  flex: 0 0 auto;
  width: 33px;
  height: 33px;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  -webkit-mask: url("icons/box-white.svg") center / contain no-repeat;
  mask: url("icons/box-white.svg") center / contain no-repeat;
}
.logo-icon {
  width: 37px;
  height: 37px;
  border-radius: 9px;
  flex: 0 0 auto;
}
.brand-lockup {
  display: flex;
  flex-direction: column;
  gap: .08rem;
}
.brand-name {
  font-family: var(--font-display-stack);
  font-size: 17px;
  font-weight: 800;
  letter-spacing: .01em;
  color: var(--text);
  line-height: 1;
}
.logo-tagline {
  font-family: var(--font-display-stack);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.divider-bar {
  width: 1px;
  height: 22px;
  background: var(--border);
}
.small {
  font-size: 12px;
  color: var(--text-muted);
}
.badge-pill {
  font-family: var(--font-display-stack);
  border: 1px solid var(--primary-soft);
  background: var(--primary-soft);
  color: var(--primary-text);
  border-radius: 999px;
  padding: .2rem .55rem;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.badge-pill-button {
  appearance: none;
  cursor: pointer;
  text-decoration: none;
}
.badge-pill-button:hover {
  border-color: var(--primary);
  filter: brightness(.98);
}
.badge-pill-button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--ring);
}
.badge-pill-help {
  min-width: 25px;
  padding-left: .35rem;
  padding-right: .35rem;
  text-align: center;
}
.mobile-menu-button { display: none; }

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  border-bottom: 1px solid var(--border);
  padding: 0 4px;
}
.tab {
  font-family: var(--font-display-stack);
  appearance: none;
  -webkit-appearance: none;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: .55rem .05rem .62rem;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
  transition: color .15s ease, border-color .15s ease;
}
.tab:hover {
  color: var(--text);
}
.tab:focus-visible {
  outline: none;
  color: var(--text);
  box-shadow: inset 0 -2px 0 var(--ring);
}
.tab-active {
  color: var(--text);
  border-bottom-color: var(--primary);
}

.pane { min-height: 520px; padding-bottom: .85rem; }
.pane-equal { padding-bottom: 1rem; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: .85rem;
  box-shadow: var(--shadow-sm);
}
.hero {
  background: linear-gradient(140deg, var(--primary) 0%, var(--primary-strong) 100%);
  color: #f8fbff;
  border-color: var(--primary);
}
.hero-title {
  font-family: var(--font-display-stack);
  font-size: 15px;
  font-weight: 700;
}
.hero-title.hero-title-spotlight {
  font-size: 16px;
  line-height: 1.3;
}
.hero-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .6rem;
  position: relative;
}
.hero-copy {
  margin-top: .35rem;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.85);
}
.hero-copy.hero-copy-spotlight {
  font-size: 13px;
  line-height: 1.45;
}
.hero-kicker {
  margin-top: .45rem;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.72);
}
.hero-copy.hero-copy-secondary {
  color: rgba(255, 255, 255, 0.72);
}
.hero-link-row {
  margin-top: .55rem;
  display: flex;
  justify-content: flex-end;
}
.hero-popover {
  position: relative;
  flex: 0 0 auto;
}
.hero-popover > summary {
  list-style: none;
}
.hero-popover > summary::-webkit-details-marker {
  display: none;
}
.info-link.info-link-hero {
  color: rgba(255, 255, 255, 0.9);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
}
.info-link.info-link-hero.info-link-hero-lower {
  letter-spacing: 0;
  text-transform: none;
}
.info-link.info-link-hero:hover {
  color: #ffffff;
}
.hero-popover-card {
  position: absolute;
  right: 0;
  top: calc(100% + .45rem);
  width: 300px;
  max-width: 360px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.2);
  padding: .7rem .75rem;
  z-index: 6;
}
.hero-popover-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}
.hero-popover-copy {
  margin-top: .2rem;
  font-size: 11px;
  line-height: 1.4;
  color: var(--text-muted);
}
.hero-popover-section {
  margin-top: .58rem;
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
}
.hero-popover-list {
  margin: .25rem 0 0;
  padding-left: 1rem;
  display: grid;
  gap: .22rem;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.35;
}
.hero-popover-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: .7rem;
}

.metric .label {
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.metric .value {
  margin-top: .2rem;
  font-family: var(--font-display-stack);
  font-weight: 700;
  font-size: 18px;
}
.metric .value-sm {
  font-size: 11px;
  line-height: 1.2;
}
.insight-chip-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .65rem;
}
.insight-chip {
  padding: .65rem .75rem;
  min-width: 0;
  overflow: hidden;
}
.insight-chip .label {
  display: block;
}
.insight-chip .value {
  display: block;
  margin-top: .22rem;
  font-family: var(--font-display-stack);
  font-weight: 700;
  font-size: 13px;
  line-height: 1.2;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.insight-chip .value-sm {
  font-size: 13px;
  line-height: 1.2;
}
.insight-chip .hint {
  margin-top: .6rem;
  font-size: 11px;
  line-height: 1.3;
  color: var(--text-muted);
}

.section-title {
  font-family: var(--font-display-stack);
  font-size: 13px;
  font-weight: 700;
}
.setting-section-title,
.major-section-title {
  font-family: var(--font-display-stack);
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}
.setting-option-title {
  font-family: var(--font-display-stack);
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
  padding-top: .5em;
}
.rank-list { display: grid; gap: .42rem; }
.rank-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: .55rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .4rem .55rem;
  background: var(--surface-soft);
}
.rank-label { font-size: 12px; }
.rank-meta {
  min-width: 0;
}
.rank-note {
  margin-top: .14rem;
  font-size: 10px;
  line-height: 1.3;
  color: var(--text-muted);
}
.rank-value {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}
.rank-bar {
  height: 4px;
  grid-column: 1 / -1;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}
.rank-bar > i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-strong));
}

.interest-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}
.interest-section-head {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
}
.interest-category-nav {
  display: flex;
  align-items: center;
  gap: .15rem;
  width: 47%;
  flex: 0 0 47%;
  min-width: 0;
  margin-left: auto;
}
.interest-category-nav[hidden] { display: none !important; }
.interest-category-carousel {
  display: flex;
  flex: 1 1 auto;
  gap: .25rem;
  min-width: 0;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  padding: .1rem .25rem;
  scrollbar-width: none;
}
.interest-category-carousel::-webkit-scrollbar { display: none; }
.interest-category-arrow,
.interest-category-button {
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 0 0 auto;
  border: 1px solid transparent;
  background: var(--surface-soft);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  height: 26px;
  padding: .38rem .58rem;
  border-radius: 6px;
  white-space: nowrap;
}
.interest-category-button { width: 100%; }
.interest-category-arrow {
  width: 32px;
  padding: 0;
  background: var(--surface);
  border-color: var(--border);
}
.interest-category-arrow svg {
  display: block;
  width: 16px;
  height: 16px;
  margin: 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}
.interest-category-arrow:disabled {
  cursor: default;
  opacity: .35;
}
.interest-category-button:hover {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}
.interest-category-button[aria-pressed="true"] {
  background: var(--surface);
  border-color: var(--border);
  color: var(--primary-text);
  box-shadow: var(--shadow-sm);
}
.interest-category-button:focus-visible,
.interest-category-arrow:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}
.interest-cloud-wrap {
  position: relative;
}
.interest-cloud-wrap-collapsed {
  max-height: 408px;
  overflow: hidden;
}
.interest-cloud-wrap-expanded {
  max-height: none;
  overflow: visible;
  padding-right: 0;
}
.interest-cloud-actions {
  display: flex;
  justify-content: center;
}
.interest-cloud-empty {
  width: 100%;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
  padding: .75rem .8rem;
}
.profile-empty-state {
  min-height: 260px;
  border: 1px dashed color-mix(in srgb, var(--primary) 34%, var(--border));
  border-radius: 10px;
  background: color-mix(in srgb, var(--primary-soft) 30%, var(--surface));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .55rem;
  padding: 1.25rem;
  text-align: center;
}
.profile-empty-title {
  font-family: var(--font-display-stack);
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
}
.profile-empty-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .55rem;
}
.profile-empty-copy {
  max-width: 320px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-muted);
}
.profile-empty-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: .25rem;
}
.interest-chip {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  padding: .35rem .45rem .35rem .7rem;
  box-shadow: var(--shadow-sm);
}
.interest-name {
  font-size: 12px;
  color: var(--text);
  font-weight: 600;
  line-height: 1;
}
.interest-remove {
  min-width: 28px;
  min-height: 28px;
  padding: 2px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
}
.interest-remove:hover, .interest-remove:focus-visible { background: var(--primary-soft); color: var(--text); }
.interest-count {
  min-width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  background: var(--primary-soft);
  color: var(--primary-text);
  font-size: 12px;
  font-weight: 700;
  padding: 0 .35rem;
  line-height: 1;
}

.chart-bars {
  height: 170px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
  padding: .5rem .45rem .35rem;
  display: grid;
  grid-template-columns: repeat(14, minmax(0, 1fr));
  gap: .35rem;
  align-items: end;
}
.bar-col {
  height: 100%;
  display: grid;
  grid-template-rows: 1fr auto auto;
  align-items: end;
  gap: .2rem;
}
.bar-fill {
  width: 100%;
  border-radius: 999px;
  min-height: 6px;
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-strong) 100%);
}
.bar-num {
  font-size: 10px;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  line-height: 1;
}
.bar-label {
  font-size: 9px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1;
}

.chart-line {
  height: 170px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
  padding: .35rem .4rem;
  overflow: hidden;
}
.line-svg {
  width: 100%;
  height: 100%;
  display: block;
}
.line-axis {
  stroke: var(--border);
  stroke-width: 1.25;
}
.line-path {
  fill: none;
  stroke: var(--primary);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.line-dot {
  fill: var(--primary-strong);
  stroke: #ffffff;
  stroke-width: 1.2;
}
.line-value {
  font-size: 9px;
  font-weight: 700;
  fill: var(--text);
}
.line-x-label {
  font-size: 8px;
  fill: var(--text-muted);
}

.momentum-baseline {
  stroke: var(--border);
  stroke-width: 1.25;
}
.momentum-label {
  font-size: 8px;
  fill: var(--text-muted);
}
.momentum-value {
  font-size: 9px;
  font-weight: 700;
  fill: var(--text);
}
.momentum-legend {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem .55rem;
}
.momentum-legend-chip {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: 11px;
  color: var(--text-muted);
}
.momentum-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.65);
}

.qna-list {
  display: grid;
  gap: .55rem;
}
.qna-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
  padding: .8rem;
}
.qna-q {
  font-size: 14px;
  color: var(--primary-text);
  font-weight: 600;
}
.qna-a {
  margin-top: .3rem;
  font-size: 12px;
  color: var(--text);
  font-weight: 700;
  line-height: 1.35;
}
.qna-why {
  margin-top: .6rem;
  font-size: 11px;
  line-height: 1.35;
  color: var(--text-muted);
}
.qna-group-title {
  font-family: var(--font-display-stack);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .02em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: .85rem 0 .1rem;
}
.qna-group-title:first-child {
  margin-top: 0;
}

.interest-bars,
.interest-lollipops {
  display: grid;
  gap: .52rem;
}

.chart-pie {
  width: 100%;
}
.pie-wrap {
  display: grid;
  gap: .75rem;
  align-items: center;
}
@media (min-width: 620px) {
  .pie-wrap { grid-template-columns: 240px 1fr; }
}
.pie-figure {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}
.pie-svg {
  width: 240px;
  height: 240px;
}
.pie-center {
  position: absolute;
  text-align: center;
  color: var(--text);
}
.pie-center .title {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: .01em;
}
.pie-center .value {
  font-size: 20px;
  font-weight: 800;
}
.pie-center .caption {
  font-size: 11px;
  color: var(--text-muted);
}
.pie-legend {
  display: grid;
  gap: .55rem;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}
.pie-chip {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .4rem;
  align-items: center;
}
.pie-dot {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1px solid var(--border);
}
.pie-chip-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}
.pie-chip-meta {
  font-size: 11px;
  color: var(--text-muted);
}
.pie-chip-trend {
  display: inline-flex;
  align-items: center;
  margin-left: .2rem;
  font-weight: 700;
  line-height: 1;
}
.pie-chip-trend svg {
  width: 12px;
  height: 12px;
  display: block;
}
.pie-chip-trend path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.pie-chip-trend-up {
  color: #15803d;
}
.pie-chip-trend-down {
  color: var(--danger);
}

.ih-row,
.il-row {
  display: grid;
  grid-template-columns: minmax(110px, 1fr) minmax(0, 2fr);
  align-items: center;
  gap: .6rem;
}
.ih-label,
.il-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.ih-track {
  position: relative;
  height: 22px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-soft);
  overflow: hidden;
}
.ih-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), var(--primary-strong));
}
.ih-value {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
}

.il-track {
  position: relative;
  height: 22px;
}
.il-line {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 2px;
  border-radius: 999px;
  background: #dbe4ec;
}
.il-stick {
  position: absolute;
  top: 50%;
  transform: translate(-1px, -50%);
  width: 2px;
  height: 12px;
  background: var(--primary-strong);
}
.il-dot {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--primary);
}
.il-value {
  position: absolute;
  top: 50%;
  transform: translate(8px, -50%);
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}
.il-value-left {
  transform: translate(calc(-100% - 8px), -50%);
}

.feed {
  display: grid;
  gap: .5rem;
}
.scroll-panel {
  max-height: 330px;
  overflow: auto;
  padding-right: .15rem;
}
.profile-history-list {
  display: grid;
  gap: .45rem;
  max-height: 320px;
  overflow: auto;
  padding-right: .15rem;
}
.profile-history-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  padding: .48rem .6rem;
}
.profile-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  flex-wrap: wrap;
}
.profile-history-main {
  display: flex;
  align-items: center;
  gap: .42rem;
  min-width: 0;
  flex: 1 1 auto;
  flex-wrap: wrap;
}
.profile-history-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  min-width: 0;
  flex: 0 1 auto;
  overflow-wrap: anywhere;
}
.profile-history-inline {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .45rem;
  flex: 0 1 auto;
  flex-wrap: wrap;
}
.profile-history-debug-tags {
  margin-top: 0;
  justify-content: flex-end;
}
.feed-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  padding: .55rem .62rem;
  /* Grid/flex children default to min-width:auto, which lets a long nowrap URL
     widen the row instead of truncating. These keep the row inside the panel so
     the Block button stays visible and the feed never scrolls sideways. */
  min-width: 0;
  overflow: hidden;
}
.feed-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  min-width: 0;
}
.feed-host {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  min-width: 0;
  flex: 1 1 auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.feed-time {
  font-size: 11px;
  color: var(--text-muted);
  flex: 0 0 auto;
  white-space: nowrap;
}
.feed-meta {
  margin-top: .2rem;
  font-size: 11px;
  color: var(--text-muted);
}
.feed-host-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .45rem;
  min-width: 0;
  flex: 1 1 auto;
}
/* The URL is the only element allowed to shrink; Block stays fully visible. */
.feed-host-row .js-block-domain {
  flex: 0 0 auto;
}
.feed-tags {
  margin-top: .35rem;
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
}
.tag {
  border: 1px solid var(--primary-soft);
  border-radius: 999px;
  padding: .15rem .45rem;
  background: var(--primary-soft);
  color: var(--primary-text);
  font-size: 11px;
  font-weight: 600;
}
.tag-history-positive {
  border-color: color-mix(in srgb, #15803d 22%, var(--border));
  background: color-mix(in srgb, #15803d 10%, var(--surface));
  color: #15803d;
}
.tag-history-negative {
  border-color: color-mix(in srgb, var(--danger) 22%, var(--border));
  background: color-mix(in srgb, var(--danger) 10%, var(--surface));
  color: var(--danger);
}
.tag-muted {
  border-color: var(--border);
  background: var(--surface-soft);
  color: var(--text-muted);
}

.pane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

button, input, select, textarea { font: inherit; color: inherit; }
.btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  border-radius: 8px;
  padding: .45rem .7rem;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1.2;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
}
.btn-nowrap {
  white-space: nowrap;
}
.btn:hover:not(:disabled):not(.btn-primary):not(.btn-danger):not(.btn-guided) {
  border-color: color-mix(in srgb, var(--primary) 42%, var(--border));
  background: color-mix(in srgb, var(--primary-soft) 22%, var(--surface));
}
.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--ring);
}
.btn:disabled {
  cursor: not-allowed;
  opacity: .58;
}
.btn-primary {
  border-color: var(--primary);
  background: var(--primary);
  color: #f0fdfa;
}
.btn-primary:hover:not(:disabled) { background: var(--primary-strong); border-color: var(--primary-strong); }
.btn-guided {
  border-color: var(--primary-strong);
  background: var(--primary-strong);
  color: #f8fafc;
  box-shadow: 0 0 0 3px var(--ring);
}
.btn-guided:hover:not(:disabled) { border-color: var(--primary-strong); background: var(--primary-strong); }
.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 26%, var(--border)); background: color-mix(in srgb, var(--danger) 12%, var(--surface)); }
.btn-danger:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--danger) 42%, var(--border));
  background: color-mix(in srgb, var(--danger) 16%, var(--surface));
}
.action-row,
.input-action-row,
.output-action-row {
  display: flex;
  align-items: center;
  gap: .5rem;
}
.action-row,
.input-action-row {
  flex-wrap: wrap;
  justify-content: flex-start;
}
.input-action-row > .input {
  flex: 1 1 180px;
  min-width: 0;
}
.input-action-row > .btn,
.output-action-row > .btn {
  flex: 0 0 auto;
}
.output-action-row {
  justify-content: flex-end;
  margin-left: auto;
}
.seg-group {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.seg-btn {
  border: none;
  border-right: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  padding: .4rem .85rem;
  cursor: pointer;
  white-space: nowrap;
}
.seg-btn:last-child { border-right: none; }
.seg-btn:hover { background: color-mix(in srgb, var(--primary) 10%, var(--surface)); }
.seg-btn.seg-active { background: var(--primary); color: #fff; }
.seg-btn.seg-active:hover { background: var(--primary-strong); }

.input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: .46rem .65rem;
  transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.input:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--primary) 42%, var(--border));
  background: color-mix(in srgb, var(--primary-soft) 22%, var(--surface));
}
select.input {
  cursor: pointer;
}
[data-theme="dark"] .input {
  color: var(--text-muted);
}
.input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--ring);
}
.input-small { width: 88px; }
.input-inline {
  width: 72px;
  display: inline-block;
  margin-left: .35rem;
}
.activity-filter-wrap {
  position: relative;
  width: 120px;
}
.activity-pane-head {
  align-items: flex-start;
  gap: .75rem;
}
.activity-filter-wrap .activity-filter-input {
  width: 100%;
}
.activity-toolbar {
  flex-wrap: wrap;
  justify-content: flex-end;
}
.activity-search-wrap {
  width: 96px;
  flex: 0 0 96px;
}
.activity-filter-input {
  background: var(--surface);
  padding-right: 1.6rem;
}
.activity-state-wrap {
  position: relative;
  display: flex;
  flex: 0 0 auto;
}
.activity-state-wrap::after {
  content: "";
  position: absolute;
  top: 50%;
  right: .85rem;
  width: .45rem;
  height: .45rem;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: translateY(-65%) rotate(45deg);
  pointer-events: none;
}
.activity-state-select {
  appearance: none;
  width: 124px;
  height: 36px;
  border-radius: 9px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  padding: .38rem 2rem .38rem .75rem;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}
.activity-filter-clear {
  position: absolute;
  top: 50%;
  right: .35rem;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: var(--text-muted);
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 999px;
  padding: 0;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.activity-filter-clear:hover {
  color: var(--text);
  background: var(--surface-soft);
}
.activity-filter-clear:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--ring);
}
.activity-filter-clear svg {
  width: .9rem;
  height: .9rem;
  fill: currentColor;
}
.filter-popover {
  position: relative;
}
.filter-popover > summary {
  list-style: none;
}
.filter-popover > summary::-webkit-details-marker {
  display: none;
}
.filter-popover-trigger {
  min-width: 58px;
  text-align: center;
}
.filter-popover-card {
  position: absolute;
  right: 0;
  top: calc(100% + .45rem);
  width: 220px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.18);
  padding: .65rem .7rem;
  z-index: 8;
}
.filter-popover-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
}
.filter-popover-card .tag {
  appearance: none;
  cursor: pointer;
}
.filter-popover-card .tag:hover {
  border-color: var(--primary-soft);
  color: var(--text);
}
.filter-popover-card .tag:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--ring);
}

.switch {
  position: relative;
  width: 42px;
  height: 22px;
  /* A flex item's default min-width is auto, so a long description in the
     sibling column squeezes the track below its fixed width and pushes it out
     of the row. Never let the control shrink. */
  flex: 0 0 42px;
  background: var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: .2s;
}
.switch[data-on="true"] { background: var(--primary); }
.switch > i {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: var(--surface);
  transition: .2s;
}
.switch[data-on="true"] > i { left: 23px; }
.switch[data-disabled="true"] {
  cursor: not-allowed;
  pointer-events: none;
  opacity: .55;
  background: var(--surface-soft);
}
.switch[data-disabled="true"] > i {
  background: var(--surface);
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.label-strong {
  font-family: var(--font-display-stack);
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}
.label-row {
  display: flex;
  align-items: center;
  gap: .55rem;
}
.info-link {
  border: none;
  background: transparent;
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  padding: 0;
  cursor: pointer;
}
.info-link:hover { color: var(--primary-strong); text-decoration: underline; }
.link-btn {
  border: none;
  background: transparent;
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
}
.link-btn:hover { color: var(--primary-strong); text-decoration: underline; }
.setting-actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: .55rem;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  line-height: 1.4;
  white-space: pre-wrap;
}
.scroll { max-height: 330px; overflow: auto; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  z-index: 50;
}
.modal-card {
  width: 100%;
  max-width: 360px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.2);
  padding: .95rem;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: .5rem;
}
.onboarding-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: .75rem;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
  padding: .75rem;
}
.onboarding-classifier-select {
  width: auto;
  min-width: 138px;
  max-width: 180px;
  padding-right: 2rem;
  white-space: nowrap;
}
.toast {
  position: fixed;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  border: 1px solid #b6efe7;
  background: #ecfffb;
  color: #115e59;
  border-radius: 999px;
  padding: .35rem .7rem;
  font-size: 12px;
  font-weight: 700;
  z-index: 60;
}
.domain-list {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
}
.site-consent-list {
  display: grid;
  gap: .55rem;
  max-height: 280px;
  overflow: auto;
  padding-right: .15rem;
}
.site-consent-empty {
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: var(--surface-soft);
  padding: .8rem .85rem;
}
.site-consent-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .85rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-soft);
  padding: .7rem .8rem;
}
.site-consent-copy {
  min-width: 0;
  flex: 1 1 auto;
}
/* ── Grant Access (directory) ───────────────────────────────────────────────── */
.btn-directory {
  width: 100%;
  justify-content: center;
  display: flex;
}
/* Hold the widest layout at all times so the dialog never resizes as the list is
   filtered — a modal that changes width under the cursor feels broken. */
.modal-card-wide { width: 460px; max-width: calc(100vw - 32px); }
.dir-filter-wrap { flex: 1 1 120px; min-width: 110px; }
.dir-filter-wrap .activity-filter-input { width: 100%; }
.dir-controls { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.dir-controls > .input,
.dir-controls .activity-filter-input { height: 36px; }
/* .input-small is a fixed 88px for numeric fields — too narrow for category
   names. Give category filters their own, clearly interactive treatment. */
.dir-category-wrap {
  position: relative;
  display: flex;
  flex: 0 0 auto;
}
.dir-category-wrap::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 1.1rem;
  width: .48rem;
  height: .48rem;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: translateY(-65%) rotate(45deg);
  pointer-events: none;
}
.dir-category-select {
  appearance: none;
  width: fit-content;
  min-width: 154px;
  height: 36px;
  border-radius: 9px;
  color: var(--text-muted);
  font-weight: 600;
  padding: .38rem 2.3rem .38rem .75rem;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  font-size: 12px;
}
.dir-tabs { display: inline-flex; height: 36px; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; flex: 0 0 auto; }
.dir-tab {
  appearance: none; border: none; background: var(--surface); cursor: pointer;
  height: 100%;
  font-size: 12px; font-weight: 600; color: var(--text-muted); padding: .38rem .8rem;
}
.dir-tab + .dir-tab { border-left: 1px solid var(--border); }
.dir-tab:hover { color: var(--text); }
.dir-tab-on { background: var(--primary-soft); color: var(--primary-text); }
/* Fixed height, not max-height: the dialog must not resize while the list is
   being filtered. Rows fill from the top; empty space below is expected. */
.dir-list {
  display: grid;
  grid-auto-rows: min-content;
  gap: .45rem;
  /* Shrinks only if the popup itself is too short for 300px + modal chrome. */
  height: min(300px, calc(100vh - 260px));
  overflow-y: auto;
  align-content: start;
}
.dir-item {
  display: flex; align-items: center; gap: .7rem; cursor: pointer;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface-soft); padding: .6rem .7rem;
}
.dir-empty { padding: 1.1rem .7rem; text-align: center; color: var(--text-muted); }
.dir-item:hover { border-color: var(--primary); }
.dir-item-done { opacity: .72; cursor: default; }
.dir-item-done:hover { border-color: var(--border); }
.dir-item input { width: 16px; height: 16px; flex: 0 0 auto; accent-color: var(--primary); }
.dir-copy { min-width: 0; flex: 1 1 auto; }
.dir-name { display: block; font-size: 13px; font-weight: 700; color: var(--text); }
.dir-meta { display: block; font-size: 11px; color: var(--text-muted); margin-top: .1rem; }
.dir-added {
  flex: 0 0 auto; font-size: 10.5px; font-weight: 700; color: var(--primary-text);
  background: var(--primary-soft); border-radius: 20px; padding: .1rem .5rem;
}
.setup-list {
  margin: 0;
  padding-left: 1.35rem;
  display: grid;
  gap: 1.15rem;
}
.setup-list li {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  padding-left: .2rem;
}
.setup-list li::marker { color: var(--text-muted); font-weight: 700; }
/* Anything after the step text (a button, a copy row) is its own block so it
   never flows into the sentence and wraps mid-instruction. */
.setup-list li > .btn,
.setup-list li > .setup-copy,
.setup-list li > .small {
  margin-top: .6rem;
}
/* The step action is a link styled as a button. It must sit on its own line
   (inline-flex would keep it in the sentence and swallow the margin), and it
   needs the anchor underline removed — .btn was only ever used on <button>. */
.setup-list li > .btn {
  display: flex;
  width: fit-content;
  text-decoration: none;
  align-items: center;
}
a.btn { text-decoration: none; }
a.btn:hover { border-color: var(--primary); color: var(--primary-text); }
.setup-copy { display: flex; gap: .4rem; }
.setup-copy .input {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 11.5px;
  padding: .42rem .55rem;
}
/* Scoped to direct children of <li> above, so the Copy button inside a
   .setup-copy row is unaffected and stays beside its input. */
.setup-copy .btn { flex: 0 0 auto; }

.site-consent-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.site-consent-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Inline affordance beside the name — deliberately unboxed so it reads as part
   of the title, not as a second button next to the toggle. */
.site-consent-open {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  line-height: 0;
}
.site-consent-open svg {
  width: 12px;
  height: 12px;
  fill: var(--text-muted);
}
.site-consent-open:hover svg {
  fill: var(--primary);
}
.site-consent-open:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--ring);
}
.site-consent-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
  /* Flex (not plain inline) so the trailing open link keeps its size while the
     name text is the only part that truncates. */
  display: flex;
  align-items: center;
  gap: .3rem;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}
.site-consent-host {
  margin-top: .08rem;
  font-size: 11px;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}
.site-consent-meta {
  margin-top: .22rem;
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.35;
}
.domain-chip {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  padding: .25rem .5rem .25rem .6rem;
}
.domain-name {
  font-size: 11px;
  color: var(--text);
  font-weight: 600;
}
.topic-list {
  max-height: 280px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
  padding: .5rem;
  display: grid;
  gap: .35rem;
}
.topic-item {
  font-size: 12px;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: .34rem .46rem;
}
.topic-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
}
.topic-item-left {
  min-width: 0;
}
.topic-item-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}
.topic-item-meta {
  margin-top: .1rem;
  font-size: 11px;
  color: var(--text-muted);
}

.cookie-name-list {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .55rem;
  background: var(--surface-soft);
  display: grid;
  gap: .45rem;
}
.cookie-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
}
.cookie-name { font-weight: 600; color: var(--text); }
.cookie-pill {
  padding: .12rem .55rem;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}
.pill-hit {
  background: var(--primary-soft);
  color: var(--primary-text);
  border: 1px solid var(--primary-soft);
}
.pill-miss {
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.js-fb-topic-check {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
  flex: 0 0 auto;
}
.modal-actions-split {
  justify-content: space-between;
}

@media (max-width: 570px) {
  .grid-cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .setting-actions { flex-wrap: wrap; justify-content: flex-start; }
  .insight-chip-row { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  body[data-surface="app"] .header {
    padding: 12px;
  }
  body[data-surface="app"] .header-row { gap: 8px; transform: none; }
  body[data-surface="app"] .brand-lockup,
  body[data-surface="app"] #overviewHowItWorksBtn { display: none; }
  body[data-surface="app"] .header-actions { gap: 10px; }
  body[data-surface="app"] .badge-pill-help,
  body[data-surface="app"] .mobile-menu-button {
    display: inline-flex;
    width: 33px;
    height: 33px;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 0;
    background: var(--primary);
    color: #fff;
    -webkit-mask: url("icons/box-white.svg") center / contain no-repeat;
    mask: url("icons/box-white.svg") center / contain no-repeat;
    padding: 0;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
  }
  body[data-surface="app"] .mobile-menu-button svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
  }
  body[data-surface="app"] .mobile-menu-button:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
  }
  body[data-surface="app"] .tabs {
    display: none;
    flex-direction: column;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    padding: 4px;
  }
  body[data-surface="app"] .tabs.menu-open { display: flex; }
  body[data-surface="app"] .tab {
    flex: 0 0 auto;
    width: 100%;
    border-bottom: 0;
    border-radius: 6px;
    padding: 10px 12px;
    text-align: left;
  }
  body[data-surface="app"] .tab-active { background: var(--primary-soft); color: var(--primary-text); }
}

/* Personal profile: optional first name + photo (personal-profile-ui.js). */
.personal-choice { margin-top: 1rem; }
.identity-block { margin: .25rem 0 .65rem; }
.identity-header { display: flex; align-items: center; gap: .65rem; }
.identity-header[hidden] { display: none; }
.identity-header .identity-avatar { width: 42px; height: 42px; cursor: default; }
.identity-header .identity-avatar img, .identity-header .identity-avatar .identity-initial, .identity-header .identity-avatar .identity-empty { width: 36px; height: 36px; }
.identity-header .identity-name { font-size: 18px; }
.identity-header .identity-summary { display: flex; flex-wrap: wrap; column-gap: .4rem; row-gap: 0; font-size: 12px; line-height: 1.4; }
.identity-header .identity-summary > div:not(:last-child)::after { content: ' \00b7'; margin-left: .4rem; }
.identity-header #identityEditBtn { flex: 0 0 auto; min-width: 44px; min-height: 44px; }
.identity-block > .identity-editor { margin: .5rem 0 .75rem; }
.personal-choice-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.identity-row { display: flex; align-items: center; gap: .85rem; }
.identity-avatar { width: 58px; height: 58px; flex: 0 0 auto; padding: 3px; border: 0; border-radius: 50%; cursor: pointer; display: grid; place-items: center; background: linear-gradient(140deg, var(--primary) 0%, var(--primary-strong) 100%); }
.identity-avatar:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.identity-avatar img, .identity-avatar .identity-initial, .identity-avatar .identity-empty { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; }
.identity-initial { display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 20px; }
.identity-empty { display: grid; place-items: center; background: var(--surface); color: var(--primary-text); line-height: 0; }
.identity-text { flex: 1; min-width: 0; }
.identity-name { font-family: var(--font-display-stack); font-size: 22px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; overflow-wrap: anywhere; }
.identity-editor { display: grid; gap: .75rem; }
.identity-editor[hidden], .personal-choice[hidden], .identity-block[hidden] { display: none; }
.identity-field { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: .75rem; align-items: center; font-size: 13px; }
.identity-field > span { color: var(--text-muted); }
.identity-field .input { max-width: 260px; width: 100%; }
.identity-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.identity-actions .btn[hidden] { display: none; }
.identity-swatches { display: flex; gap: .5rem; flex-wrap: wrap; }
.identity-swatches button { width: 26px; height: 26px; padding: 0; border-radius: 50%; border: 2px solid transparent; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12); cursor: pointer; }
.identity-swatches button[aria-pressed="true"] { border-color: var(--text); }
.identity-swatches button:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.identity-error { color: var(--danger); }
@media (max-width: 420px) {
  .identity-block { margin: 0 0 .4rem; }
  .identity-header { gap: .5rem; }
  .identity-header .identity-name { font-size: 16px; }
  .identity-field { grid-template-columns: 1fr; gap: .35rem; }
  .identity-name { font-size: 19px; }
}
.identity-summary { margin-top: .2rem; color: var(--text-muted); overflow-wrap: anywhere; display: grid; gap: .1rem; line-height: 1.35; }
.identity-summary[hidden], .identity-text .small[hidden] { display: none; }
.identity-section-title { margin-top: .35rem; padding-top: .75rem; border-top: 1px solid var(--border); font-weight: 700; font-size: 13px; }
.identity-section-title span { display: block; font-weight: 400; color: var(--text-muted); font-size: 12px; margin-top: .1rem; }
.identity-field-top { align-items: start; }
.identity-field-top > span { padding-top: .5rem; }
.identity-stack { display: grid; gap: .4rem; min-width: 0; }
.identity-inline { display: flex; gap: .4rem; flex-wrap: wrap; min-width: 0; }
.identity-inline .input { flex: 1 1 120px; min-width: 0; max-width: none; width: auto; }
.identity-field select.input { max-width: 260px; }
.identity-inline select.input { flex: 1 1 150px; }
.identity-chips { display: flex; gap: .4rem; flex-wrap: wrap; }
.identity-chips:empty { display: none; }
.identity-chip { display: inline-flex; align-items: center; gap: .35rem; border: 1px solid var(--border); background: var(--surface); border-radius: 10px; padding: .25rem .3rem .25rem .6rem; font-size: 13px; font-weight: 600; }
.identity-chip button { border: 0; background: none; padding: 0 .2rem; cursor: pointer; color: var(--text-muted); font-size: 15px; line-height: 1; border-radius: 6px; }
.identity-chip button:hover { color: var(--text); }
.identity-chip button:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }

/* ── Today tab ─────────────────────────────────────────────────────────────
   Daily edition (today-ui.js). Built on the theme tokens so every theme works;
   lanes are shades of the primary colour. */
#tab-today {
  --today-l-1: var(--primary-strong);
  --today-l-2: var(--primary);
  --today-l-3: color-mix(in srgb, var(--primary) 78%, var(--surface));
  --today-l-4: color-mix(in srgb, var(--primary) 62%, var(--surface));
  --today-l-5: color-mix(in srgb, var(--primary) 46%, var(--surface));
  --today-l-6: color-mix(in srgb, var(--primary-strong) 85%, var(--text));
  --today-l-7: color-mix(in srgb, var(--primary) 70%, var(--text-muted));
  --today-l-8: color-mix(in srgb, var(--primary) 32%, var(--surface));
  --today-l-9: var(--text-muted);
  display: grid;
  /* minmax(0, 1fr): the strips row scrolls inside its card instead of widening the page. */
  grid-template-columns: minmax(0, 1fr);
  gap: .85rem;
  min-width: 0;
  max-width: 100%;
}
#tab-today > *, #tab-today .today-mixbody, #tab-today .today-masters, #tab-today .today-master { min-width: 0; }
#tab-today .today-notice { border: 1px solid color-mix(in srgb, var(--primary) 25%, var(--border)); background: var(--primary-soft); color: var(--primary-text); border-radius: 12px; padding: .65rem .85rem; font-size: 13px; font-weight: 600; line-height: 1.45; }
#tab-today .today-notice[hidden] { display: none; }

#tab-today .today-mixhead { all: unset; box-sizing: border-box; display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%; cursor: pointer; border-radius: 8px; }
#tab-today .today-mixhead:focus-visible { box-shadow: 0 0 0 3px var(--ring); }
#tab-today .today-mixer { box-shadow: none; }
#tab-today .today-chev { width: 15px; height: 15px; fill: var(--text-muted); flex: 0 0 auto; transition: transform .25s ease; }
#tab-today .today-mixer.open .today-chev { transform: rotate(180deg); }
#tab-today .today-mixer:not(.open) .today-mixbody { display: none; }
#tab-today .today-hint { margin: .5rem 0 .75rem; line-height: 1.45; }
#tab-today .today-link { all: unset; cursor: pointer; color: var(--primary-text); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; border-radius: 4px; }
#tab-today .today-link:hover { color: var(--primary); }
#tab-today .today-link:focus-visible { box-shadow: 0 0 0 3px var(--ring); }
#tab-today .today-masters { display: grid; gap: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
#tab-today .today-master label { display: flex; justify-content: space-between; align-items: center; font-size: 13px; font-weight: 700; color: var(--text); }
#tab-today .today-badge { color: var(--primary-text); background: var(--primary-soft); border-radius: 6px; padding: 1px 8px; font-size: 12px; }
#tab-today .today-ends { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-muted); }
#tab-today .today-master input { width: 100%; accent-color: var(--primary); }
#tab-today .today-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

#tab-today .today-echo { width: 95%; margin-inline: auto; padding: 0 2px; }
#tab-today .today-echobar { display: flex; gap: 2px; height: 5px; border-radius: 5px; overflow: hidden; background: var(--primary-soft); }
#tab-today .today-echobar span { display: block; height: 100%; transition: width .35s ease; }
#tab-today .today-echo p { margin: .5rem 0 0; }
#tab-today .today-echo strong { color: var(--text); font-weight: 500; }

#tab-today .today-section { padding: 0 1rem; box-shadow: none; }
#tab-today .today-section-head { padding: 1rem 0 .85rem; border-bottom: 1px solid var(--border); }
#tab-today .today-section-head .major-section-title { margin: 0; }
#tab-today .today-sub { margin: .5rem 0 0; }
#tab-today .today-item { padding: 1.05rem 0 1.15rem; border-top: 1px solid color-mix(in srgb, var(--border) 65%, transparent); }
#tab-today .today-item:first-child { border-top: 0; }
#tab-today .today-item h3 { max-width: 64ch; padding-top: 0; line-height: 1.4; margin: 0 0 .45rem; overflow-wrap: anywhere; }
#tab-today .today-item h3 a { color: inherit; text-decoration: none; }
#tab-today .today-item h3 a:hover { color: var(--primary-text); text-decoration: underline; text-underline-offset: 3px; }
#tab-today .today-item h3 a:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; border-radius: 2px; }
#tab-today .today-item p { max-width: 74ch; margin: 0 0 .7rem; overflow-wrap: anywhere; }
#tab-today .today-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .7rem; font-size: 11px; line-height: 1.5; color: var(--text-muted); }
#tab-today .today-src { font-weight: 500; color: var(--text); }
#tab-today .today-why { margin-left: auto; max-width: 100%; display: inline-flex; align-items: center; gap: .35rem; font-size: 11px; font-weight: 400; color: var(--text-muted); overflow-wrap: anywhere; }
#tab-today .today-why::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--lane); flex: none; }
#tab-today .today-why b { font-weight: 500; font-size: 11px; color: var(--primary-text); font-variant-numeric: tabular-nums; }
#tab-today .today-item.wild .today-why { color: var(--primary-text); }
#tab-today .today-item.wild .today-why::before { display: none; }
#tab-today .today-wild { background: color-mix(in srgb, var(--primary-soft) 45%, var(--surface)); border-color: color-mix(in srgb, var(--primary) 14%, var(--border)); }
#tab-today .today-events .today-item { display: grid; grid-template-columns: 58px minmax(0, 1fr); gap: 0 12px; align-items: start; }
#tab-today .today-body { min-width: 0; }
#tab-today .today-when { font-weight: 600; font-size: 14px; line-height: 1.3; text-align: center; background: var(--primary-soft); color: var(--primary-text); border-radius: 6px; padding: 7px 4px; }
#tab-today .today-when small { display: block; font-weight: 400; font-size: 11px; margin-top: 2px; }
#tab-today .today-empty { color: var(--text-muted); padding: 10px 0; font-size: 13px; margin: 0; }
#tab-today .today-foot { margin: 0; padding: 0 2px; line-height: 1.5; }
@media (max-width: 420px) {
  #tab-today .today-section { padding-inline: .85rem; }
  #tab-today .today-why { margin-left: 0; }
  #tab-today .today-events .today-item { grid-template-columns: 48px minmax(0, 1fr); gap: 0 10px; }
}
@media (prefers-reduced-motion: reduce) { #tab-today * { transition: none !important; } }

/* Today states: only a ready edition (or the harness example) shows the feed. */
#tab-today:not([data-state="ready"]):not([data-state="example"]) > :not(.today-state) { display: none; }
#tab-today[data-state="ready"] .today-state, #tab-today[data-state="example"] .today-state { display: none; }
#tab-today .today-state { display: grid; justify-items: center; align-content: start; align-self: start; text-align: center; gap: .6rem; padding: 2rem 1.25rem; }
#tab-today .today-state h3 { margin: .25rem 0 0; }
#tab-today .today-state .btn { margin-top: .4rem; }
#tab-today .today-state p { margin: 0; max-width: 34ch; line-height: 1.5; color: var(--text-muted); }
#tab-today .today-state [hidden] { display: none; }
#tab-today .today-state-icon { width: 44px; height: 44px; border-radius: 50%; background: var(--primary-soft); display: grid; place-items: center; }
#tab-today .today-state-icon span { width: 18px; height: 18px; border-radius: 50%; background: var(--primary); }
#tab-today[data-state="building"] .today-state-icon span,
#tab-today[data-state="checking"] .today-state-icon span { background: none; border: 3px solid var(--primary); border-right-color: transparent; animation: today-spin 1s linear infinite; }
@keyframes today-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { #tab-today .today-state-icon span { animation: none !important; } }

/* My Mix sits on the hero gradient, like the Profile Passport and Access headers. */
#tab-today .today-mixer.hero .major-section-title,
#tab-today .today-mixer.hero .today-master label { color: #f8fbff; }
#tab-today .today-mixer.hero .today-hint,
#tab-today .today-mixer.hero .today-ends { color: rgba(255, 255, 255, 0.78); }
#tab-today .today-mixer.hero .today-chev { fill: rgba(255, 255, 255, 0.85); }
#tab-today .today-mixer.hero .today-link { color: #fff; }
#tab-today .today-mixer.hero .today-link:hover { color: rgba(255, 255, 255, 0.85); }
#tab-today .today-mixer.hero .today-link:focus-visible,
#tab-today .today-mixer.hero .today-mixhead:focus-visible { box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.55); }
#tab-today .today-mixer.hero .today-masters { border-top-color: rgba(255, 255, 255, 0.22); }
#tab-today .today-mixer.hero .today-badge { background: rgba(255, 255, 255, 0.18); color: #fff; }
#tab-today .today-mixer.hero .today-master input { accent-color: #fff; }
#tab-today .today-mixer.hero #todayReset { background: rgba(255, 255, 255, 0.14); border-color: rgba(255, 255, 255, 0.35); color: #fff; }
#tab-today .today-mixer.hero #todayReset:hover { background: rgba(255, 255, 255, 0.24); }
