:root {
  --bg: #0a0a0a;
  --panel: #121212;
  --panel-alt: #181818;
  --surface: #1e1e1e;
  /* Cards / inset panels (Income Projector + Data Management) */
  --bg-card: rgba(25, 25, 25, 0.72);
  --bg-chart: rgba(255, 255, 255, 0.04);
  --bg-tile: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.12);
  --text: #ececec;
  --muted: #9a9a9a;
  --muted-bright: #c4c4c4;
  --accent: #2a2a2a;
  --accent-hover: #353535;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 14px;
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  --space-xs: 0.35rem;
  --space-sm: 0.5rem;
  --space-md: 0.75rem;
  --space-lg: 1rem;
  --space-xl: 1.5rem;
  --space-2xl: 2rem;
  --leading-tight: 1.25;
  --leading-body: 1.55;
  --leading-relaxed: 1.65;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 0.9375rem;
  line-height: var(--leading-body);
  letter-spacing: 0.01em;
  background: linear-gradient(165deg, #070707 0%, #141414 55%, #101010 100%);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  margin: 0 0 var(--space-md);
  font-weight: 600;
  line-height: var(--leading-tight);
  letter-spacing: -0.02em;
  color: var(--text);
}

h1 {
  font-size: 1.65rem;
}

h2 {
  font-size: 1.2rem;
  margin-bottom: var(--space-sm);
}

h3 {
  font-size: 1.05rem;
}

p {
  color: var(--muted);
  margin: var(--space-sm) 0 0;
  line-height: var(--leading-relaxed);
  max-width: 65ch;
}

p:first-of-type {
  margin-top: var(--space-xs);
}

.container {
  width: min(1080px, 92vw);
  margin: 0 auto;
  padding: var(--space-xl) 0 var(--space-2xl);
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  box-shadow: var(--shadow);
}

/* Data Management — same visual language as Income Projector (no paper-white inline panels) */
.data-manager-scope details.card.section {
  background: var(--bg-card);
  border-color: var(--border-strong);
}

.data-manager-scope details.card.section > summary {
  border-bottom-color: var(--border-strong) !important;
}

.data-manager-scope select {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: 6px;
}

.data-manager-scope option {
  background: #1a1a1a;
  color: var(--text);
}

.card > p {
  margin-top: var(--space-sm);
}

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--space-xl);
}

.login-card {
  width: min(420px, 94vw);
}

label {
  display: block;
  margin-top: var(--space-lg);
  margin-bottom: var(--space-xs);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted-bright);
}

label:first-child,
.stack > label:first-child,
.tile > label:first-child {
  margin-top: 0;
}

input,
textarea,
select {
  width: 100%;
  margin-top: 0;
  border: 1px solid var(--border-strong);
  background: #0f0f0f;
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 0.65rem 0.85rem;
  font-size: 0.9375rem;
  line-height: var(--leading-body);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.22);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.06);
}

textarea {
  min-height: 9rem;
  resize: vertical;
  line-height: var(--leading-relaxed);
}

button {
  border: 0;
  background: var(--accent);
  color: #f5f5f5;
  padding: 0.65rem 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.875rem;
  line-height: 1.35;
  letter-spacing: 0.02em;
  transition: background 0.15s ease, transform 0.1s ease;
}

button:hover:not(:disabled) {
  background: var(--accent-hover);
}

button:active:not(:disabled) {
  transform: translateY(1px);
}

button.secondary {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
}

button.secondary:hover:not(:disabled) {
  background: #252525;
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.row {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
  align-items: stretch;
}

.row > * {
  flex: 1;
  min-width: 200px;
}

.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid var(--border);
}

.nav__left {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  min-width: 0;
  flex: 1;
  flex-wrap: nowrap;
}

.nav__menu-wrap {
  position: relative;
  flex-shrink: 0;
}

.nav__menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.nav__menu-btn:hover {
  background: var(--accent-hover);
  border-color: rgba(255, 255, 255, 0.18);
}

.nav__menu-icon,
.nav__menu-icon::before,
.nav__menu-icon::after {
  display: block;
  width: 1.1rem;
  height: 2px;
  background: var(--text);
  border-radius: 1px;
}

.nav__menu-icon {
  position: relative;
}

.nav__menu-icon::before,
.nav__menu-icon::after {
  content: "";
  position: absolute;
  left: 0;
}

.nav__menu-icon::before {
  top: -6px;
}

.nav__menu-icon::after {
  top: 6px;
}

.nav__dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 13.5rem;
  padding: 6px;
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  z-index: 200;
}

.nav__dropdown-inner {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.nav__dropdown-section {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav__dropdown-heading {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: var(--space-xs) var(--space-sm) 2px;
}

.nav__dropdown-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 5px var(--space-sm);
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font-size: 0.78rem;
  line-height: 1.35;
  cursor: pointer;
  transition: background 0.12s ease;
}

.nav__dropdown-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.nav__actions {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  align-items: center;
  margin-left: auto;
}

.brand {
  flex: 0 0 auto;
  font-weight: 650;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-lg);
}

.dashboard-main-grid {
  grid-template-columns: 1fr 1.08fr;
}

@media (max-width: 900px) {
  .dashboard-main-grid {
    grid-template-columns: 1fr;
  }
}

.tile {
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
}

.tile h3 {
  margin: 0 0 var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--border);
}

.forecast-kpis {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

/* Shop-Ware schedule: timeline / project-tracker layout */
.schedule-tracker-wrap {
  margin-top: var(--space-md);
}

.schedule-past-due {
  margin-top: var(--space-lg);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border);
}

.schedule-past-due__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.schedule-past-due__title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.schedule-past-due__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.55rem;
}

.schedule-past-due__cell {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.schedule-past-due__day {
  font-size: 0.72rem;
}

.schedule-day--empty .schedule-day__lane {
  padding: 0.35rem 0;
}

.schedule-backlog-wrap {
  margin-top: var(--space-sm);
}

.schedule-backlog-dropzone {
  min-height: 2.2rem;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 0.45rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.45rem;
}

.backlog-card {
  background: linear-gradient(145deg, rgba(30, 30, 30, 0.98) 0%, rgba(21, 21, 21, 0.99) 100%);
  border: 1px solid var(--border);
  border-left: 3px solid rgba(255, 171, 64, 0.95);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.55rem;
  cursor: grab;
}

.backlog-card:active {
  cursor: grabbing;
}

.backlog-card__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.82rem;
}

.backlog-card__sub {
  margin-top: 0.2rem;
  margin-bottom: 0.2rem;
  font-size: 0.72rem;
}

.backlog-card__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
}

.schedule-tracker {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.schedule-day {
  display: grid;
  grid-template-columns: minmax(3.75rem, 4.5rem) minmax(0, 1fr);
  gap: var(--space-md);
  align-items: stretch;
  padding-bottom: var(--space-lg);
  position: relative;
}

@media (max-width: 560px) {
  .schedule-day {
    grid-template-columns: 1fr;
    gap: var(--space-md);
    padding-bottom: var(--space-lg);
  }

  .schedule-day__rail {
    flex-direction: row;
    align-items: baseline;
    justify-content: flex-start;
    gap: var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--border);
    border-right: none;
    text-align: left;
  }

  .schedule-day__rail::before,
  .schedule-day:not(:last-child) .schedule-day__rail::after {
    display: none;
  }
}

.schedule-day__rail {
  text-align: right;
  padding-right: var(--space-md);
  border-right: 2px solid var(--border-strong);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.15rem;
  min-height: 2.5rem;
}

.schedule-day__rail::before {
  content: "";
  position: absolute;
  right: -7px;
  top: 0.35rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid rgba(110, 168, 254, 0.95);
  box-shadow: 0 0 0 3px rgba(110, 168, 254, 0.12);
  z-index: 1;
}

.schedule-day:not(:last-child) .schedule-day__rail::after {
  content: "";
  position: absolute;
  right: -1px;
  top: 1.35rem;
  bottom: calc(-1 * var(--space-xl));
  width: 2px;
  background: var(--border-strong);
  z-index: 0;
}

.schedule-day__weekday {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.schedule-day__date-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.15;
}

.schedule-day__daynum {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
}

.schedule-day__mon {
  font-size: 0.8125rem;
  color: var(--muted-bright);
}

.schedule-day__lane {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  padding-top: 0.1rem;
}

.schedule-card {
  position: relative;
  background: linear-gradient(145deg, rgba(32, 32, 32, 0.98) 0%, rgba(22, 22, 22, 0.99) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-md);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.schedule-card--compact {
  padding: 0.45rem 0.55rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28);
}

.schedule-card--planned {
  border-left-style: dashed;
}

.schedule-card--payment {
  border-left-color: rgba(255, 196, 93, 0.95);
  background: linear-gradient(145deg, rgba(37, 33, 24, 0.96) 0%, rgba(28, 24, 18, 0.98) 100%);
}

.schedule-card__row1 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  margin-bottom: 0.2rem;
}

.schedule-card__money-inline {
  margin-left: auto;
  font-size: 0.78rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #b8e0bc;
  white-space: nowrap;
}

.schedule-card__money-inline--muted {
  font-weight: 500;
  color: var(--muted);
}

.schedule-card__title--ellipsis {
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.25;
  margin-bottom: 0.15rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

.schedule-card__sub {
  font-size: 0.72rem;
  line-height: 1.2;
  margin-bottom: 0.2rem;
  opacity: 0.92;
}

.schedule-card__sub--ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schedule-card__footer--tight {
  gap: 0.25rem;
  margin-top: 0.05rem;
}

.schedule-card__pill--ro {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

.schedule-card__pill--lead {
  border-color: rgba(255, 171, 64, 0.5);
  color: #ffd7a2;
}

.schedule-card__pill--planned {
  border-color: rgba(94, 214, 186, 0.45);
  color: #b9f1e4;
}

.schedule-card__pill--payment {
  border-color: rgba(255, 196, 93, 0.5);
  color: #ffe0a5;
}

.schedule-card--a {
  border-left: 3px solid rgba(110, 168, 254, 0.95);
}

.schedule-card--b {
  border-left: 3px solid rgba(168, 130, 255, 0.9);
}

.schedule-card--c {
  border-left: 3px solid rgba(94, 214, 186, 0.9);
}

.schedule-card__time {
  font-size: 0.75rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--muted-bright);
  white-space: nowrap;
}

.schedule-card__track {
  flex: 1;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.schedule-card--a .schedule-card__track-fill {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(110, 168, 254, 0.35), rgba(110, 168, 254, 0.08));
}

.schedule-card--b .schedule-card__track-fill {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(168, 130, 255, 0.35), rgba(168, 130, 255, 0.08));
}

.schedule-card--c .schedule-card__track-fill {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(94, 214, 186, 0.35), rgba(94, 214, 186, 0.08));
}

.schedule-card__title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
  margin-bottom: var(--space-xs);
}

.schedule-card__desc {
  margin: 0 0 var(--space-sm);
  max-width: 58ch;
}

.schedule-card__footer {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  align-items: center;
}

.schedule-card .schedule-card__pill {
  font-size: 0.58rem !important;
  letter-spacing: 0.05em;
  padding: 0.12rem 0.35rem !important;
}

.schedule-card__pill--muted {
  opacity: 0.65;
}

.drop-hover {
  outline: 2px dashed rgba(110, 168, 254, 0.6);
  outline-offset: 2px;
}

.tile > p.hint {
  margin-top: 0;
  margin-bottom: var(--space-md);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.stack > *:first-child {
  margin-top: 0;
}

.pill {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  color: var(--muted-bright);
}

.pill--feature {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1rem;
  min-width: 16rem;
  margin-bottom: var(--space-sm);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-transform: none;
  color: var(--text);
}

.ai-output {
  min-height: 12rem;
  white-space: pre-wrap;
  line-height: var(--leading-relaxed);
  font-size: 0.9rem;
  padding: var(--space-md);
  background: #0f0f0f;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
}

.ai-output--muted {
  color: var(--muted);
}

.hint {
  font-size: 0.8125rem;
  line-height: var(--leading-relaxed);
  color: var(--muted);
}

.error {
  color: #e8a0a0;
  font-size: 0.8125rem;
  margin-top: var(--space-md);
  line-height: var(--leading-body);
}

/* Page rhythm */
.section {
  margin-top: var(--space-xl);
}

.section--tight {
  margin-top: var(--space-lg);
}

.btn-block {
  width: 100%;
  margin-top: var(--space-lg);
}

/* Toolbar (filters row) */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-lg) var(--space-xl);
}

.toolbar__field {
  flex: 1 1 200px;
  max-width: 280px;
  min-width: 160px;
}

/* Campaign filter: long names need more horizontal room than KPI date fields. */
.toolbar__field--grow {
  flex: 2 1 260px;
  max-width: min(560px, 100%);
  min-width: 200px;
}

.ads-campaign-select {
  width: 100%;
  padding: 0.55rem 0.65rem;
  font-size: 0.875rem;
  line-height: 1.35;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-input, rgba(12, 12, 14, 0.92));
  color: var(--text);
}

.ads-campaign-select:focus {
  outline: none;
  border-color: rgba(110, 168, 254, 0.55);
  box-shadow: 0 0 0 2px rgba(110, 168, 254, 0.15);
}

.toolbar__field label {
  margin-top: 0;
}

.toolbar__actions {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
  padding-bottom: 2px;
}

/* KPI strip inside dashboard */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--space-md);
  margin-top: var(--space-md);
}

.kpi-card {
  padding: var(--space-md) var(--space-lg);
  background: #141414;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.kpi-card .hint {
  margin: 0 0 var(--space-xs);
  font-size: 0.6875rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.kpi-card h3 {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.four-pack-status {
  align-self: center;
  margin: 0;
}

.insight-pack-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-lg);
  margin-top: var(--space-md);
}

.insight-pack-card {
  min-height: 10rem;
}

.insight-pack-card h4 {
  margin: 0 0 var(--space-sm);
  font-size: 0.95rem;
  padding-bottom: var(--space-xs);
  border-bottom: 1px solid var(--border);
  color: var(--muted-bright);
}

.insight-pack-body {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.875rem;
  line-height: var(--leading-relaxed);
  color: var(--text);
}

.insight-bubble-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  margin-top: var(--space-lg);
}

.insight-bubble {
  flex: 1 1 220px;
  max-width: 100%;
  min-width: 200px;
  padding: var(--space-md) var(--space-lg) var(--space-lg);
  border-radius: 32px 32px 24px 24px;
  border: 1px solid var(--border-strong);
  background: radial-gradient(120% 90% at 50% 0%, #2a2a2a 0%, #141414 60%);
  box-shadow: var(--shadow);
}

.insight-bubble__label {
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted-bright);
  text-align: center;
  margin-bottom: var(--space-sm);
}

.insight-bubble__row {
  display: flex;
  justify-content: center;
  margin-bottom: var(--space-sm);
}

.insight-bubble__dropdown {
  max-width: 100%;
  width: min(100%, 16rem);
  font-size: 0.8125rem;
  padding: 0.4rem 0.55rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #1a1a1a;
  color: var(--text);
}

.insight-bubble__body {
  margin: 0;
  max-height: 15rem;
  overflow: auto;
  font-size: 0.6875rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--muted);
  padding: var(--space-sm);
  background: rgba(0, 0, 0, 0.4);
  border-radius: var(--radius-md);
}

.gc-prompt-viewer-root {
  margin-top: var(--space-lg);
}

.insight-bubble--prompt-viewer {
  flex: 1 1 100%;
  max-width: 100%;
  min-width: 0;
}

.gc-prompt-viewer-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.gc-prompt-viewer-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-bright);
}

.gc-prompt-viewer-select {
  width: min(100%, 22rem);
  max-width: 100%;
}

.insight-bubble__body--prompt-viewer {
  max-height: min(70vh, 36rem);
}

.gc-prompt-viewer-meta {
  margin-top: var(--space-sm);
}

.insight-pack-output-title {
  margin: var(--space-xl) 0 var(--space-sm);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--muted-bright);
}

/* Nested panels inside Gemini Controller (Google Ads) */
.insight-pack-collapsible > .gc-controller-subpanel {
  margin-top: var(--space-md);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgba(12, 12, 12, 0.55);
  overflow: hidden;
}

.insight-pack-collapsible > .gc-controller-subpanel:first-of-type {
  margin-top: var(--space-sm);
}

.gc-controller-subpanel > summary.gc-controller-subpanel__summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--muted-bright);
  user-select: none;
  border-bottom: 1px solid transparent;
}

.gc-controller-subpanel[open] > summary.gc-controller-subpanel__summary {
  border-bottom-color: var(--border);
  background: rgba(255, 255, 255, 0.03);
}

.gc-controller-subpanel > summary.gc-controller-subpanel__summary::-webkit-details-marker {
  display: none;
}

.gc-controller-subpanel__chevron {
  font-size: 0.62rem;
  opacity: 0.65;
  transition: transform 0.15s ease;
}

.gc-controller-subpanel[open] > summary .gc-controller-subpanel__chevron {
  transform: rotate(-180deg);
}

.gc-controller-subpanel__body {
  padding: var(--space-md);
}

.insight-sections {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  margin-top: var(--space-sm);
}

.insight-sections--muted {
  opacity: 0.75;
}

.insight-section-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-md) var(--space-lg);
  background: rgba(20, 20, 20, 0.85);
}

.insight-section-card__title {
  margin: 0 0 var(--space-sm);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted-bright);
}

.insight-section-card__body {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.875rem;
  line-height: var(--leading-relaxed);
  color: var(--text);
  font-family: inherit;
}

.insight-section-card__rows {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.insight-row {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.55rem;
  background: rgba(255, 255, 255, 0.02);
}

.insight-row--pair {
  display: grid;
  grid-template-columns: minmax(110px, 170px) 1fr;
  gap: 0.5rem;
  align-items: start;
}

.insight-row__label {
  font-size: 0.73rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted-bright);
}

.insight-row__value {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.84rem;
  line-height: 1.45;
  color: var(--text);
}

/* Data tables */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
  line-height: var(--leading-body);
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 0.65rem 0.5rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.data-table th {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom-color: var(--border-strong);
}

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

.data-table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Google Ads dashboard — top campaigns (not muted: parent must not use .hint) */
.campaign-table-wrap {
  margin-top: var(--space-sm);
  color: var(--text);
}

.campaign-table-wrap__empty {
  margin: 0;
}

.campaign-table-wrap__footer {
  margin: var(--space-sm) 0 0;
}

.campaign-table-scroll {
  border: 1px solid var(--border-strong);
  background: rgba(10, 10, 12, 0.45);
}

.campaign-table th.campaign-table__num,
.campaign-table td.campaign-table__num {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.campaign-table td.campaign-table__name {
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
  color: var(--text);
}

@media (min-width: 900px) {
  .campaign-table td.campaign-table__name {
    max-width: 22rem;
  }
}

/* Gemini Controller / Data Studio bucket chip styling */
.gc-ds-bucket-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
  align-items: center;
}

.gc-ds-bucket-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.75rem 0.45rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  color: var(--muted-bright);
  user-select: none;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.gc-ds-bucket-chip:hover {
  border-color: rgba(110, 168, 254, 0.35);
  color: var(--text);
}

.gc-ds-bucket-chip:has(input:checked) {
  border-color: rgba(110, 168, 254, 0.55);
  background: rgba(110, 168, 254, 0.12);
  color: #e8f1ff;
}

.gc-ds-bucket-chip input {
  width: 1rem;
  height: 1rem;
  margin: 0;
  accent-color: #6ea8fe;
  cursor: pointer;
}

/* GA Data Studio shared mount: Data Management-only shortcut + nested Target / Shop preview */
.gc-studio-only-dm {
  display: none;
}

#hvDataStudioSection .gc-studio-only-dm {
  display: inline-block;
}

.gc-studio-ga-inner > .gc-controller-subpanel {
  margin-top: var(--space-md);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.02);
  overflow: hidden;
}

.insight-pack-collapsible .gc-studio-ga-inner > .gc-controller-subpanel {
  background: rgba(12, 12, 12, 0.35);
}

.gc-ds-bucket-chip__label {
  line-height: 1.2;
}

.table-scroll {
  overflow-x: auto;
  margin-top: var(--space-sm);
  -webkit-overflow-scrolling: touch;
}

/* Keyword Manager */
.km-rules {
  margin: var(--space-md) 0 0;
  padding-left: 1.25rem;
  color: var(--muted);
  max-width: 70ch;
}

.km-rules li {
  margin: var(--space-xs) 0;
}

.km-note {
  margin-bottom: var(--space-md);
}

#kmStatus {
  white-space: pre-wrap;
  word-break: break-word;
  max-width: 100%;
}

.km-campaigns {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

details.km-campaign {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--panel-alt);
  padding: 0 var(--space-md) var(--space-md);
}

details.km-campaign > summary {
  list-style: none;
  cursor: pointer;
  padding: var(--space-md) 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-sm) var(--space-md);
}

details.km-campaign > summary::-webkit-details-marker {
  display: none;
}

.km-campaign__title {
  font-weight: 600;
  color: var(--text);
}

.km-campaign__meta {
  font-size: 0.8125rem;
  color: var(--muted);
}

.km-campaign__summary--underperforming {
  background: rgba(185, 48, 48, 0.28);
  border: 1px solid rgba(220, 92, 92, 0.45);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.6rem !important;
  color: var(--text);
}

.km-campaign__summary--underperforming .km-campaign__title,
.km-campaign__summary--underperforming .km-campaign__meta {
  color: var(--text);
}

/* Remove rows: same weight as green "add" rows — tinted wash, not solid pink. */
.km-row--remove {
  background-color: rgba(120, 48, 52, 0.06);
}

.km-row--selected-add {
  background-color: rgba(42, 100, 65, 0.06);
}

.km-campaign__badges {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.km-badge {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 0.2rem 0.45rem;
  border-radius: var(--radius-sm);
  margin-right: 0.25rem;
}

.km-badge--remove {
  background: rgba(120, 48, 52, 0.12);
  color: #c9a0a0;
}

.km-badge--remove-strong {
  background: rgba(120, 48, 52, 0.14);
  color: #d4b0b0;
}

.km-badge--flag {
  background: rgba(200, 140, 40, 0.22);
  color: #e8c878;
}

.km-badge--warn {
  background: rgba(200, 120, 40, 0.2);
  color: #e8b070;
}

.km-badge--muted {
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted-bright);
}

.km-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.km-table th,
.km-table td {
  text-align: left;
  padding: 0.55rem 0.45rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.km-table th {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

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

.km-table .km-bucket-col {
  white-space: nowrap;
}

.km-row--remove td {
  background: rgba(120, 48, 52, 0.1);
}

.km-row--remove:hover td {
  background: rgba(120, 48, 52, 0.14);
}

.km-row--selected-remove td {
  background: rgba(120, 48, 52, 0.11) !important;
}

.km-row--selected-add td {
  background: rgba(42, 100, 65, 0.11) !important;
}

.nk-row--selected td {
  background: rgba(42, 100, 65, 0.11) !important;
}

.km-row--tried td {
  background: rgba(214, 145, 53, 0.2);
}

/* Recent-apply markers — same orange family as km-row--tried but slightly stronger
   to differentiate "applied" from "seen in report only". */
.km-row--applied td,
.nk-row--applied td {
  background: rgba(214, 145, 53, 0.32);
}
.acm-ad--applied {
  border-left: 3px solid rgba(214, 145, 53, 0.7);
  padding-left: 0.5rem;
}

.apply-marker {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0.05rem 0.4rem;
  font-size: 0.75rem;
  background: rgba(214, 145, 53, 0.3);
  color: rgb(184, 110, 22);
  border-radius: 999px;
  vertical-align: middle;
}

/* Apply Receipt panel */
.apply-receipt__host {
  margin-top: var(--space-sm);
}
.apply-receipt {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: var(--space-sm);
  background: rgba(255, 255, 255, 0.02);
  font-size: 0.85rem;
}
.apply-receipt__head {
  margin-bottom: var(--space-xs);
}
.apply-receipt__table {
  width: 100%;
  border-collapse: collapse;
}
.apply-receipt__table th,
.apply-receipt__table td {
  padding: 0.25rem 0.5rem;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  vertical-align: top;
}
.apply-receipt__icon {
  width: 1.5rem;
  font-weight: bold;
}
.apply-receipt__row--ok .apply-receipt__icon { color: rgb(58, 155, 88); }
.apply-receipt__row--skip .apply-receipt__icon { color: rgb(184, 110, 22); }
.apply-receipt__row--fail .apply-receipt__icon { color: rgb(204, 64, 64); }
.apply-receipt--error {
  border-color: rgba(204, 64, 64, 0.5);
}
.apply-receipt__err {
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
}
.apply-receipt__empty {
  text-align: center;
  color: rgba(255, 255, 255, 0.5);
  padding: 0.5rem;
}

.km-controls {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-top: var(--space-xs);
}

.km-select-cell {
  width: 3.25rem;
}

.km-select {
  width: 1rem;
  height: 1rem;
}

.km-kw {
  max-width: 22rem;
  word-break: break-word;
}

.km-url {
  max-width: 14rem;
  font-size: 0.75rem;
  color: var(--muted-bright);
  word-break: break-all;
}

.km-replacements {
  margin-top: var(--space-lg);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-md);
}

.km-replacement-card h4 {
  margin: 0;
}

.km-replacement-title {
  margin-top: var(--space-sm);
  margin-bottom: var(--space-xs);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted-bright);
}

.km-rep-furl-wrap {
  min-width: 12rem;
  max-width: 22rem;
  vertical-align: top;
}

.km-rep-furl-lane-toggle {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
  width: fit-content;
}

.km-rep-furl-lane-pill {
  font-size: 0.65rem;
  padding: 0.2rem 0.5rem;
  margin: 0;
  border: none;
  background: transparent;
  color: var(--muted-bright);
  cursor: pointer;
}

.km-rep-furl-lane-pill:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.km-rep-furl-lane-pill--active {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text, inherit);
  font-weight: 600;
}

.km-rep-furl-lane-pill:not(:disabled):hover {
  background: rgba(255, 255, 255, 0.05);
}

/* Tile actions (home / marketing cards) */
.tile > button {
  margin-top: var(--space-md);
  align-self: flex-start;
}

.tile .row {
  margin-top: var(--space-sm);
}

.tile.stack > h3 + p.hint {
  margin-top: 0;
  margin-bottom: var(--space-xs);
}

.tile.stack > textarea {
  margin-top: 0;
}

/* Floating Perplexity console */
.px-console {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  width: min(430px, calc(100vw - 2rem));
  max-height: min(72vh, 760px);
  z-index: 9999;
  border: 1px solid var(--border-strong);
  background: rgba(10, 10, 10, 0.96);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.px-console--fab {
  width: auto;
  max-height: none;
  border: none;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}

.px-console__fab {
  position: relative;
  width: 36px;
  height: 36px;
  padding: 0;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid rgba(110, 168, 254, 0.42);
  background: rgba(18, 20, 28, 0.94);
  color: #9ec5ff;
  font-size: 0.95rem;
  font-weight: 800;
  font-family: ui-sans-serif, system-ui, sans-serif;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}

.px-console__fab:hover {
  border-color: rgba(110, 168, 254, 0.65);
  background: rgba(26, 30, 40, 0.98);
}

.px-console__fab-letter {
  display: block;
  transform: translateY(-0.5px);
}

.px-console__fab-dot {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #f59e0b;
  box-shadow: 0 0 0 2px rgba(14, 16, 22, 0.95);
}

.px-console__header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid var(--border);
  background: rgba(28, 28, 28, 0.95);
}

.px-console__title {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.px-console__meta {
  font-size: 0.72rem;
  color: var(--muted-bright);
}

.px-console__toggle {
  margin-left: auto;
  padding: 0.4rem 0.6rem;
  font-size: 0.75rem;
}

.px-console__model-toggle {
  display: inline-flex;
  gap: 0.35rem;
}

.px-console__model-btn {
  padding: 0.32rem 0.55rem;
  font-size: 0.72rem;
}

.px-console__model-btn.is-active {
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.28);
}

.px-console__body {
  display: block;
}

.px-console__body--hidden {
  display: none;
}

.px-console__tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
}

.px-console__tabs button {
  border-radius: 0;
  border: 0;
  background: transparent;
  color: var(--muted-bright);
  font-size: 0.78rem;
  padding: 0.5rem 0.65rem;
}

.px-console__tabs button.active {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.px-console__panel {
  display: none;
}

.px-console__panel.active {
  display: block;
}

.px-console__scroll {
  max-height: 42vh;
  overflow: auto;
  padding: 0.6rem 0.65rem;
}

.px-console__composer {
  border-top: 1px solid var(--border);
  padding: 0.6rem 0.65rem;
}

.px-console__composer textarea {
  min-height: 4.2rem;
  font-size: 0.82rem;
}

.px-msg {
  margin-bottom: 0.45rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.5rem;
  background: rgba(255, 255, 255, 0.02);
}

.px-msg__meta {
  font-size: 0.67rem;
  color: var(--muted);
  margin-bottom: 0.2rem;
}

.px-msg pre,
.px-req pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  font-size: 0.77rem;
  line-height: 1.35;
}

.px-msg--user {
  border-color: rgba(120, 190, 255, 0.26);
}

.px-msg--assistant {
  border-color: rgba(180, 255, 180, 0.2);
}

.px-req {
  margin-bottom: 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.5rem;
}

.px-req__top {
  display: flex;
  justify-content: space-between;
  gap: var(--space-sm);
  font-size: 0.7rem;
}

.px-req__path {
  margin: 0.2rem 0;
  font-size: 0.7rem;
  color: var(--muted-bright);
}

.px-req__label {
  margin: 0.35rem 0 0.15rem;
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
}

.px-req--pending {
  border-color: rgba(255, 210, 120, 0.4);
}

.px-req--error {
  border-color: rgba(255, 120, 120, 0.4);
}

/* Visual polish */
.card,
.tile,
details.km-campaign,
.kpi-card,
.insight-section-card,
.px-console {
  backdrop-filter: blur(10px);
}

.card {
  border-color: rgba(255, 255, 255, 0.1);
}

.tile,
details.km-campaign {
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
}

.tile:hover,
details.km-campaign:hover {
  border-color: rgba(255, 255, 255, 0.14);
}

details.tile > summary,
details.km-campaign > summary {
  border-radius: var(--radius-sm);
  transition: background 0.16s ease, border-color 0.16s ease;
}

details.tile > summary:hover,
details.km-campaign > summary:hover {
  background: rgba(255, 255, 255, 0.035);
}

.insight-pack-summary {
  padding: 0.35rem 0.45rem;
}

.insight-pack-summary__title,
.km-campaign__title {
  letter-spacing: -0.01em;
}

.kpi-card {
  background: linear-gradient(180deg, rgba(28, 28, 28, 0.95), rgba(18, 18, 18, 0.95));
}

.kpi-card h3 {
  font-size: 1.28rem;
}

.data-table,
.km-table {
  border-spacing: 0;
}

.data-table th,
.km-table th {
  background: rgba(255, 255, 255, 0.025);
}

.data-table td,
.km-table td {
  transition: background 0.12s ease;
}

.table-scroll,
.ar-copy-table-wrap {
  border-radius: var(--radius-sm);
}

.km-badge {
  border: 1px solid rgba(255, 255, 255, 0.08);
}

button,
input,
textarea,
select {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
}

button:hover:not(:disabled) {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 6px 16px rgba(0, 0, 0, 0.22);
}

.px-console {
  background: rgba(10, 10, 10, 0.94);
}

.px-console__header {
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

.px-console__model-toggle {
  padding: 0.15rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.22);
}

.px-console__model-btn {
  border-radius: 6px;
}

@media (max-width: 720px) {
  .container {
    width: min(94vw, 100%);
  }

  .card,
  .tile {
    padding: var(--space-lg);
  }

  .px-console__header {
    flex-wrap: wrap;
  }

  .px-console__toggle {
    margin-left: 0;
  }

  /* Customer funnel: stack vertically on narrow screens, arrows point down. */
  .hv-funnel-row {
    flex-direction: column;
  }
  .hv-funnel-arrow {
    transform: rotate(90deg);
  }
}

/* Payment Projections Dashboard Shell */
.projection-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-bottom: var(--space-xl);
}

.projection-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1.35fr) repeat(4, minmax(0, 1fr));
  gap: var(--space-lg);
  margin-top: var(--space-lg);
  align-items: stretch;
}

@media (max-width: 1100px) {
  .projection-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .projection-grid > .projection-card--large {
    grid-column: 1 / -1;
  }
}

.monthly-breakdown {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.progress-container {
  height: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  overflow: hidden;
  display: flex;
}

.progress-bar {
  height: 100%;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-bar--collected {
  background: var(--primary);
  box-shadow: 0 0 12px var(--primary-shadow);
}

.progress-bar--projected {
  background: var(--accent);
  opacity: 0.6;
}

.split-legend {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
}

.legend-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.legend-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}

.dot--collected { background: var(--primary); }
.dot--projected { background: var(--accent); opacity: 0.6; }

.legend-label {
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.7rem;
}

.legend-value {
  font-weight: 700;
  color: var(--text);
  font-size: 1.1rem;
}

.projection-card {
  background: rgba(25, 25, 25, 0.75);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 160px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.projection-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, #6ea8fe, #a882ff);
  opacity: 0.6;
}

.projection-card:hover {
  transform: translateY(-6px);
  border-color: rgba(255, 255, 255, 0.25);
  box-shadow: 0 15px 45px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.1);
  background: rgba(30, 30, 30, 0.8);
}

.projection-card--large {
  background: linear-gradient(145deg, rgba(35, 35, 35, 0.9), rgba(20, 20, 20, 0.95));
  border: 1px solid rgba(110, 168, 254, 0.2);
}

.projection-card--large::before {
  background: linear-gradient(90deg, #6ea8fe, #5ed6ba);
  height: 6px;
  opacity: 0.9;
}

.projection-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-bright);
  margin-bottom: var(--space-sm);
}

.projection-value {
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: #fff;
  margin: var(--space-xs) 0;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 15px rgba(255, 255, 255, 0.15);
  display: inline-block;
  padding: 6px 14px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.projection-card--large .projection-value {
  font-size: 3.2rem;
  color: #6ea8fe;
  background: linear-gradient(135deg, #fff 0%, #6ea8fe 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.projection-sub {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: auto;
}

.projection-trend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  font-size: 0.8rem;
}

.projection-trend--up {
  color: #5ed6ba;
}

.projection-logic-pill {
  font-size: 0.55rem;
  color: #6ea8fe;
  background: rgba(110, 168, 254, 0.1);
  border: 1px solid rgba(110, 168, 254, 0.2);
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-left: 8px;
  vertical-align: middle;
  display: inline-block;
  transform: translateY(-2px);
}

/* CRM — Messages Inbox */
/* ─── Messenger ──────────────────────────────────────────────────────────── */
.msg-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 4px 0;
}
.msg-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.msg-filter-chip:hover {
  background: var(--accent);
}
.msg-filter-chip.active {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}
.msg-filter-chip .count {
  opacity: 0.7;
  font-weight: 400;
  font-size: 12px;
}
.msg-filter-chip.active .count {
  opacity: 0.85;
}
.msg-filter-chip .unread-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ef4444;
}

.inbox-grid {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 0;
  min-height: 600px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--panel-alt);
}
.inbox-thread-list {
  border-right: 1px solid var(--border);
  overflow-y: auto;
  max-height: 75vh;
  background: var(--panel);
}
.inbox-thread-row {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 12px;
  align-items: center;
  transition: background 0.1s;
}
.inbox-thread-row:hover {
  background: var(--accent);
}
.inbox-thread-row.selected {
  background: var(--accent-hover);
  border-left: 3px solid #2563eb;
  padding-left: 13px;
}
.channel-badge {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}
.channel-badge.sms   { background: #10b981; color: #fff; }
.channel-badge.email { background: #6366f1; color: #fff; }
.channel-badge.ig    { background: linear-gradient(45deg,#f58529,#dd2a7b,#8134af); color: #fff; }
.channel-badge.fb    { background: #1877f2; color: #fff; }
.inbox-thread-body {
  min-width: 0;
}
.inbox-thread-row-top,
.inbox-thread-row-bot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.inbox-thread-row-bot {
  margin-top: 3px;
}
.inbox-thread-name {
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}
.inbox-thread-time {
  font-size: 11px;
  flex-shrink: 0;
  color: var(--muted, #9ca3af);
}
.inbox-thread-preview {
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  color: var(--muted, #9ca3af);
}
.inbox-thread-row.has-unread .inbox-thread-name,
.inbox-thread-row.has-unread .inbox-thread-preview {
  color: var(--text);
  font-weight: 600;
}
.unread-badge {
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  flex-shrink: 0;
}
.inbox-thread-view {
  display: flex;
  flex-direction: column;
  max-height: 75vh;
  background: var(--panel-alt);
}
.inbox-view-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  display: flex;
  align-items: center;
  gap: 12px;
}
.inbox-view-header .channel-badge {
  width: 38px;
  height: 38px;
  font-size: 16px;
}
.inbox-view-name {
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--text);
}
.inbox-view-subtitle {
  font-size: 12px;
  color: var(--muted, #9ca3af);
  margin-top: 2px;
}
.inbox-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.inbox-messages-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted, #9ca3af);
  font-size: 14px;
  padding: 40px 20px;
  flex: 1;
}
.inbox-message {
  display: flex;
  flex-direction: column;
  max-width: 75%;
}
.inbox-message-out {
  align-self: flex-end;
  align-items: flex-end;
}
.inbox-message-in {
  align-self: flex-start;
  align-items: flex-start;
}
.inbox-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.45;
  font-size: 14px;
}
.inbox-message-out .inbox-bubble {
  background: #2563eb;
  color: #fff;
  border-bottom-right-radius: 4px;
}
.inbox-message-in .inbox-bubble {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.inbox-subject {
  font-size: 11px;
  font-weight: 700;
  opacity: 0.85;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.inbox-meta {
  font-size: 11px;
  margin-top: 4px;
  color: var(--muted, #9ca3af);
}

/* Email client card layout (email channel only) */
.email-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 100%;
}
.email-card-out {
  border-left: 3px solid #2563eb;
  background: color-mix(in srgb, #2563eb 6%, var(--panel));
}
.email-card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.email-card-from {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.email-card-date {
  font-size: 11px;
  color: var(--muted, #9ca3af);
  white-space: nowrap;
  flex-shrink: 0;
}
.email-card-subject {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.email-card-body {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  border-top: 1px solid var(--border);
  padding-top: 10px;
}
.email-card-body p {
  margin: 0 0 6px;
}
.email-card-body p:last-child {
  margin-bottom: 0;
}

.inbox-composer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--panel);
}
.inbox-composer-subject {
  width: 100%;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--panel-alt);
  color: var(--text);
  font-size: 13px;
}
.inbox-composer-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
.inbox-composer textarea {
  flex: 1;
  resize: none;
  min-height: 44px;
  max-height: 200px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel-alt);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}
.inbox-composer textarea:focus {
  outline: none;
  border-color: #2563eb;
}
.inbox-composer .send-btn {
  background: #2563eb;
  color: #fff;
  border: none;
  padding: 10px 22px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
}
.inbox-composer .send-btn:hover { background: #1d4ed8; }
.inbox-composer .send-btn:disabled { opacity: 0.5; cursor: wait; }

.inbox-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 40px;
  color: var(--muted, #9ca3af);
  text-align: center;
  gap: 8px;
}
.inbox-empty-state .icon {
  font-size: 48px;
  opacity: 0.5;
}

.inbox-new-form {
  padding: 20px;
  display: grid;
  gap: 14px;
}
.inbox-new-form label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted, #9ca3af);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.inbox-new-form input,
.inbox-new-form select,
.inbox-new-form textarea {
  width: 100%;
  padding: 9px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--panel-alt);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}
.inbox-new-form textarea {
  resize: vertical;
  min-height: 100px;
}

@media (max-width: 720px) {
  .inbox-grid {
    grid-template-columns: 1fr;
  }
  .inbox-thread-list {
    max-height: 260px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
}

/* ── Phone (≤480px) ─────────────────────────────────────────── */
@media (max-width: 480px) {
  .container {
    width: 100%;
    padding-left: var(--space-md);
    padding-right: var(--space-md);
  }

  .nav {
    flex-wrap: wrap;
  }
  .nav__actions {
    width: 100%;
    justify-content: flex-end;
  }

  .projection-grid {
    grid-template-columns: 1fr;
  }

  .row > * {
    min-width: 0;
    flex: 1 1 100%;
  }

  .tile,
  .card {
    padding: var(--space-md);
  }

  table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}
