/* ============================================================
   APP  —  layout shell + reusable components.

   This file rarely changes. It reads only from tokens.css, so it
   is brand-agnostic. Re-skinning a client never touches this file.
   ============================================================ */

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

html, body { height: 100%; }

body {
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; border: none; background: none; }
svg { display: block; }

/* ---------------- App grid ---------------- */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* ---------------- Sidebar ---------------- */
.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: var(--sp-4) var(--sp-3);
  gap: var(--sp-5);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-2);
}
.brand-mark {
  width: 30px; height: 30px;
  border-radius: 9px;
  background: var(--brand);
  color: var(--brand-fg);
  display: grid; place-items: center;
  font-weight: var(--fw-bold);
  font-size: var(--fs-md);
  flex: none;
}
.brand-name { font-weight: var(--fw-semibold); letter-spacing: var(--tracking-tight); }
.brand-sub { font-size: var(--fs-xs); color: var(--text-subtle); }

.nav { display: flex; flex-direction: column; gap: var(--sp-5); overflow-y: auto; flex: 1; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-heading {
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-subtle);
  padding: var(--sp-1) var(--sp-3) var(--sp-2);
}
.nav-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: var(--fw-medium);
  font-size: var(--fs-md);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.nav-item svg { width: 17px; height: 17px; flex: none; opacity: .85; }
.nav-item:hover { background: var(--surface-hover); color: var(--text); }
.nav-item.is-active {
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: var(--fw-semibold);
}
.nav-item.is-active svg { opacity: 1; }

.sidebar-foot {
  border-top: 1px solid var(--border);
  padding-top: var(--sp-3);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}
.sidebar-foot .avatar { flex: none; }
.foot-meta { min-width: 0; }
.foot-name { font-size: var(--fs-md); font-weight: var(--fw-medium); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.foot-role { font-size: var(--fs-xs); color: var(--text-subtle); }

/* ---------------- Main + topbar ---------------- */
.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: 0 var(--sp-6);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: saturate(1.2) blur(8px);
  backdrop-filter: saturate(1.2) blur(8px);
  border-bottom: 1px solid var(--border);
}
.crumbs { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-md); }
.crumbs .muted { color: var(--text-subtle); }
.crumbs .sep { color: var(--text-subtle); }
.crumbs .current { font-weight: var(--fw-semibold); letter-spacing: var(--tracking-tight); }

.topbar-right { display: flex; align-items: center; gap: var(--sp-3); }

/* Segmented control (date range) */
.segmented {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 2px;
}
.segmented button {
  padding: 4px var(--sp-3);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--text-muted);
  border-radius: 6px;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.segmented button.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.icon-btn {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.icon-btn:hover { background: var(--surface-hover); color: var(--text); }
.icon-btn svg { width: 17px; height: 17px; }

.pill-switch {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--text);
}
.pill-switch .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--positive); }

.avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text-muted);
  display: grid; place-items: center;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
}

/* ---------------- Content ---------------- */
.content {
  padding: var(--sp-6) var(--sp-6) var(--sp-10);
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
}
.page-head { margin-bottom: var(--sp-6); }
.page-title {
  font-size: var(--fs-2xl);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--tracking-tight);
}
.page-sub { color: var(--text-muted); font-size: var(--fs-md); margin-top: var(--sp-1); }

/* ---------------- Grid + cards ---------------- */
.grid { display: grid; gap: var(--sp-4); }
.grid-kpi { grid-template-columns: repeat(4, 1fr); margin-bottom: var(--sp-4); }
.grid-2 { grid-template-columns: 1.6fr 1fr; align-items: start; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}
.card-pad { padding: var(--sp-6); }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--border);
}
.card-head h3 { font-size: var(--fs-base); font-weight: var(--fw-semibold); letter-spacing: var(--tracking-tight); }
.card-head .sub { font-size: var(--fs-sm); color: var(--text-subtle); }

/* KPI tile */
.kpi { padding: var(--sp-4) var(--sp-5); display: flex; flex-direction: column; gap: var(--sp-3); }
.kpi-label { font-size: var(--fs-sm); color: var(--text-muted); font-weight: var(--fw-medium); }
.kpi-value { font-size: var(--fs-3xl); font-weight: var(--fw-semibold); letter-spacing: var(--tracking-tight); line-height: var(--lh-tight); }
.kpi-foot { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: var(--radius-pill);
  font-size: var(--fs-sm); font-weight: var(--fw-medium);
}
.badge-pos { background: var(--positive-soft); color: var(--positive); }
.badge-neg { background: var(--negative-soft); color: var(--negative); }
.badge-muted { background: var(--surface-2); color: var(--text-muted); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--radius-sm);
  font-size: var(--fs-md); font-weight: var(--fw-medium);
  transition: opacity var(--dur) var(--ease), background var(--dur) var(--ease);
}
.btn-primary { background: var(--primary); color: var(--primary-fg); }
.btn-primary:hover { opacity: .9; }
.btn-ghost { border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.btn-ghost:hover { background: var(--surface-hover); }

/* Placeholder slot (Phase 0 scaffolding — Phase 1 fills these) */
.slot {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: repeating-linear-gradient(-45deg, transparent, transparent 9px, var(--surface-2) 9px, var(--surface-2) 10px);
  display: grid; place-items: center;
  color: var(--text-subtle);
  font-size: var(--fs-sm);
  min-height: 120px;
  gap: var(--sp-1);
}
.slot .slot-tag {
  padding: 2px 8px; border-radius: var(--radius-pill);
  background: var(--surface); border: 1px solid var(--border);
  font-weight: var(--fw-medium);
}
.kpi .slot { min-height: 44px; }

/* ---------------- Responsive ---------------- */
@media (max-width: 1040px) {
  .grid-kpi { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 64px 1fr; }
  .sidebar { padding: var(--sp-4) var(--sp-2); }
  .brand-text, .nav-heading, .nav-item .nav-label, .foot-meta { display: none; }
  .nav-item { justify-content: center; padding: var(--sp-3); }
  .brand { justify-content: center; }
  .sidebar-foot { justify-content: center; }
}
@media (max-width: 560px) {
  .content { padding: var(--sp-4); }
  .grid-kpi { grid-template-columns: 1fr; }
  .topbar { padding: 0 var(--sp-4); }
  .segmented, .pill-switch .label { display: none; }
}

/* ---------------- Life: smooth theme flip + entrance ---------------- */
.slot-lg { min-height: 200px; }

body, .sidebar, .topbar, .card, .kpi, .slot, .nav-item, .segmented,
.segmented button, .icon-btn, .pill-switch, .badge, .brand-mark, .avatar {
  transition: background-color .22s var(--ease), border-color .22s var(--ease),
              color .18s var(--ease), box-shadow .18s var(--ease);
}

@keyframes riseIn {
  from { opacity: 0; transform: translateY(9px); }
  to   { opacity: 1; transform: none; }
}
.content > * { animation: riseIn .55s var(--ease) both; }
.content > .grid-kpi { animation-delay: .06s; }
.content > .grid-2   { animation-delay: .12s; }

@media (prefers-reduced-motion: reduce) {
  *, .content > * { animation: none !important; transition: none !important; }
}

/* ---------------- KPI foot ---------------- */
.kpi-vs { color: var(--text-subtle); font-size: var(--fs-sm); }

/* ---------------- Occupancy heatmap ---------------- */
#heatmap { display: flex; flex-direction: column; gap: var(--sp-3); }
.heat-months { display: flex; gap: 3px; padding-left: 38px; font-size: var(--fs-xs); color: var(--text-subtle); }
.heat-months span { width: 15px; flex: none; }
.heat-body { display: flex; gap: var(--sp-2); }
.heat-dows { display: grid; grid-template-rows: repeat(7, 15px); gap: 3px; width: 30px; font-size: var(--fs-xs); color: var(--text-subtle); }
.heat-dows span { line-height: 15px; }
.heat-grid { display: flex; gap: 3px; overflow-x: auto; padding-bottom: 2px; }
.heat-col { display: grid; grid-template-rows: repeat(7, 15px); gap: 3px; }
.heat-cell { width: 15px; height: 15px; border-radius: 4px; background: var(--heat-0); }
.heat-cell.b0 { background: var(--heat-0); }
.heat-cell.b1 { background: var(--heat-1); }
.heat-cell.b2 { background: var(--heat-2); }
.heat-cell.b3 { background: var(--heat-3); }
.heat-cell.b4 { background: var(--heat-4); }
.heat-cell.heat-pad { background: transparent; }
.heat-cell.is-future { opacity: .55; box-shadow: inset 0 0 0 1px var(--border-strong); }
.heat-cell[data-t] { cursor: pointer; transition: transform .1s var(--ease); }
.heat-cell[data-t]:hover { transform: scale(1.28); }
.heat-legend { display: flex; align-items: center; gap: 4px; justify-content: flex-end; font-size: var(--fs-xs); color: var(--text-subtle); }
.heat-legend .heat-cell { width: 12px; height: 12px; }
.heat-tip {
  position: fixed; z-index: 50;
  transform: translate(-50%, -100%);
  background: var(--primary); color: var(--primary-fg);
  font-size: var(--fs-sm); padding: 5px 9px; border-radius: 7px;
  pointer-events: none; opacity: 0; white-space: nowrap;
  transition: opacity .12s var(--ease); box-shadow: var(--shadow-pop);
}

/* ---------------- Attention feed ---------------- */
.att-list { display: flex; flex-direction: column; padding-top: 0; padding-bottom: 0; }
.att-item { display: flex; align-items: flex-start; gap: var(--sp-3); padding: var(--sp-3) 0; border-bottom: 1px solid var(--border); }
.att-item:last-child { border-bottom: none; }
.att-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; flex: none; }
.att-dot.warn { background: var(--warning); }
.att-dot.pos  { background: var(--positive); }
.att-dot.neg  { background: var(--negative); }
.att-main { flex: 1; min-width: 0; }
.att-title { font-size: var(--fs-md); font-weight: var(--fw-medium); }
.att-sub { font-size: var(--fs-sm); color: var(--text-muted); margin-top: 2px; }
.att-right { text-align: right; flex: none; }
.att-impact { font-size: var(--fs-md); font-weight: var(--fw-semibold); }
.att-action { font-size: var(--fs-sm); color: var(--text-muted); font-weight: var(--fw-medium); white-space: nowrap; }
.att-action:hover { color: var(--text); }

/* ---------------- KPI sparkline ---------------- */
.spark { display: flex; align-items: flex-end; gap: 2px; height: 24px; flex: 1; }
.spark-bar { flex: 1; background: var(--ink-soft); border-radius: 2px 2px 0 0; min-height: 2px; transform-origin: bottom; animation: growUp .5s var(--ease) both; }
.spark-bar.now { background: var(--ink); }
.delta { font-size: var(--fs-sm); font-weight: var(--fw-medium); white-space: nowrap; }
.delta-pos { color: var(--positive); }
.delta-neg { color: var(--negative); }

/* ---------------- Revenue bars ---------------- */
.rev-total { font-size: var(--fs-xl); font-weight: var(--fw-semibold); letter-spacing: var(--tracking-tight); margin-bottom: var(--sp-4); }
.rev-total span { font-size: var(--fs-sm); font-weight: var(--fw-regular); color: var(--text-subtle); margin-left: var(--sp-2); }
.rbars { display: flex; align-items: flex-end; gap: var(--sp-3); height: 150px; }
.rbar { flex: 1; height: 100%; display: flex; align-items: flex-end; }
.rbar-fill { width: 100%; background: var(--ink); border-radius: 6px 6px 0 0; min-height: 4px; transform-origin: bottom; animation: growUp .6s var(--ease) both; }
.rbar-labels { display: flex; gap: var(--sp-3); margin-top: var(--sp-2); }
.rbar-label { flex: 1; text-align: center; font-size: var(--fs-xs); color: var(--text-subtle); }
@keyframes growUp { from { transform: scaleY(0); } to { transform: scaleY(1); } }

/* ---------------- Source bars ---------------- */
.src-row { display: grid; grid-template-columns: 84px 1fr 58px; align-items: center; gap: var(--sp-3); padding: 7px 0; }
.src-name { font-size: var(--fs-sm); color: var(--text-muted); }
.src-track { height: 8px; background: var(--surface-2); border-radius: var(--radius-pill); overflow: hidden; }
.src-fill { display: block; height: 100%; border-radius: var(--radius-pill); transform-origin: left; animation: growRight .6s var(--ease) both; }
.src-fill.direct { background: var(--ink); }
.src-fill.ota { background: var(--ink-soft); }
.src-val { font-size: var(--fs-sm); font-weight: var(--fw-medium); text-align: right; }
@keyframes growRight { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* ---------------- Table ---------------- */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: var(--fs-xs); font-weight: var(--fw-semibold); letter-spacing: .04em; text-transform: uppercase; color: var(--text-subtle); padding: 0 var(--sp-3) var(--sp-3); }
.tbl td { padding: var(--sp-3); border-top: 1px solid var(--border); font-size: var(--fs-md); }
.tbl tbody tr { transition: background-color var(--dur) var(--ease); }
.tbl tbody tr:hover { background: var(--surface-hover); }
.t-guest { font-weight: var(--fw-medium); }
.src-tag { display: inline-block; padding: 2px 8px; border-radius: var(--radius-pill); font-size: var(--fs-sm); font-weight: var(--fw-medium); }
.src-tag.direct { background: var(--surface-2); color: var(--text); }
.src-tag.ota { background: var(--surface-2); color: var(--text-muted); }

/* ---------------- Heatmap summary footer ---------------- */
.heat-summary { display: flex; flex-wrap: wrap; gap: var(--sp-5); margin-top: var(--sp-2); padding-top: var(--sp-3); border-top: 1px solid var(--border); font-size: var(--fs-sm); color: var(--text-muted); }
.heat-summary strong { color: var(--text); font-weight: var(--fw-semibold); }

/* ---------------- KPI drill-down drawer ---------------- */
.kpi { cursor: pointer; }
.kpi:hover { background: var(--surface-hover); }

.drawer-backdrop { position: fixed; inset: 0; background: rgba(8,10,13,.42); opacity: 0; visibility: hidden; transition: opacity .25s var(--ease), visibility .25s; z-index: 40; }
.drawer-backdrop.show { opacity: 1; visibility: visible; }
.drawer { position: fixed; top: 0; right: 0; height: 100vh; width: min(580px, 94vw); background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow-pop); transform: translateX(100%); transition: transform .3s var(--ease); z-index: 41; display: flex; flex-direction: column; }
.drawer.open { transform: none; }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-4); padding: var(--sp-6); border-bottom: 1px solid var(--border); }
.drawer-label { font-size: var(--fs-sm); color: var(--text-muted); font-weight: var(--fw-medium); }
.drawer-value { font-size: var(--fs-3xl); font-weight: var(--fw-semibold); letter-spacing: var(--tracking-tight); line-height: var(--lh-tight); margin-top: 2px; }
.drawer-body { padding: var(--sp-6); overflow-y: auto; display: flex; flex-direction: column; gap: var(--sp-6); }
.drawer-cmp { font-size: var(--fs-md); color: var(--text-muted); }
.drawer-cmp strong { color: var(--text); font-weight: var(--fw-semibold); }
.drawer-sub { font-size: var(--fs-sm); color: var(--text-muted); font-weight: var(--fw-medium); margin-bottom: var(--sp-3); }

/* area chart */
.chart-wrap { position: relative; }
.chart { width: 100%; height: auto; display: block; }
.ch-grid { stroke: var(--border); stroke-width: 1; stroke-dasharray: 3 4; }
.ch-ylab { fill: var(--text-subtle); font-size: 10px; }
.ch-area { animation: fadeIn .5s var(--ease) both; }
.ch-line { fill: none; stroke: var(--ink); stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.ch-g0 { stop-color: var(--ink); stop-opacity: .14; }
.ch-g1 { stop-color: var(--ink); stop-opacity: 0; }
.ch-dot { fill: var(--surface); stroke: var(--ink); stroke-width: 2; opacity: 0; transition: opacity .1s var(--ease); }
.ch-dot.on { opacity: 1; }
.ch-guide { stroke: var(--border-strong); stroke-width: 1; opacity: 0; transition: opacity .1s var(--ease); }
.ch-guide.on { opacity: 1; }
.ch-hit { fill: transparent; cursor: crosshair; }
.chart-tip { position: absolute; top: -6px; transform: translateX(-50%); background: var(--primary); color: var(--primary-fg); padding: 5px 9px; border-radius: 7px; font-size: var(--fs-sm); opacity: 0; pointer-events: none; transition: opacity .12s var(--ease); white-space: nowrap; display: flex; flex-direction: column; box-shadow: var(--shadow-pop); z-index: 2; }
.chart-tip.on { opacity: 1; }
.chart-tip strong { font-weight: var(--fw-semibold); }
.chart-tip span { font-size: var(--fs-xs); opacity: .75; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* day-of-week mini bars */
.dow-bars { display: flex; align-items: flex-end; gap: var(--sp-2); height: 92px; }
.dowb { flex: 1; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: var(--sp-1); }
.dowb-fill { width: 68%; background: var(--ink); border-radius: 5px 5px 0 0; min-height: 4px; transform-origin: bottom; animation: growUp .5s var(--ease) both; }
.dowb span { font-size: var(--fs-xs); color: var(--text-subtle); }

/* ---------------- Pages + Guests (CRM) ---------------- */
.page.is-hidden { display: none; }
.stat { padding: var(--sp-4) var(--sp-5); display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); }
.stat-ic { width: 40px; height: 40px; border-radius: 11px; background: var(--surface-2); color: var(--text-muted); display: grid; place-items: center; flex: none; }
.stat-ic svg { width: 20px; height: 20px; }
#guestTable .tbl tbody tr { cursor: pointer; }
.t-ltv { font-weight: var(--fw-semibold); }
.t-src .src-tag { margin-right: 4px; }
.gstat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-5); }
.gstat-v { font-size: var(--fs-xl); font-weight: var(--fw-semibold); letter-spacing: var(--tracking-tight); }
.gstat-l { font-size: var(--fs-sm); color: var(--text-muted); margin-top: 2px; }
@media (max-width: 560px) { .gstat-row { grid-template-columns: repeat(2, 1fr); } }

/* section label + 3-col */
.sec-label { font-size: var(--fs-xs); font-weight: var(--fw-semibold); letter-spacing: .05em; text-transform: uppercase; color: var(--text-subtle); margin: var(--sp-2) 0 var(--sp-1); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 860px) { .grid-3 { grid-template-columns: 1fr; } }

/* top guest cards */
.topg { padding: var(--sp-5); cursor: pointer; position: relative; display: flex; flex-direction: column; transition: background-color var(--dur) var(--ease); }
.topg:hover { background: var(--surface-hover); }
.topg-rank { position: absolute; top: var(--sp-4); right: var(--sp-5); font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--text-subtle); }
.topg-av { width: 44px; height: 44px; border-radius: 50%; background: var(--surface-2); color: var(--text); display: grid; place-items: center; font-weight: var(--fw-semibold); margin-bottom: var(--sp-3); }
.topg-tier { position: absolute; top: var(--sp-4); right: var(--sp-5); font-size: var(--fs-xs); font-weight: var(--fw-semibold); letter-spacing: .05em; text-transform: uppercase; }
.topg-name { font-weight: var(--fw-semibold); letter-spacing: var(--tracking-tight); }
.topg-meta { font-size: var(--fs-sm); color: var(--text-muted); margin-top: 2px; }

/* search */
.search { display: flex; align-items: center; gap: var(--sp-2); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: var(--sp-2) var(--sp-3); min-width: 210px; }
.search-ic { width: 15px; height: 15px; color: var(--text-subtle); flex: none; }
.search input { border: none; background: none; outline: none; color: var(--text); font-size: var(--fs-md); width: 100%; }
.search input::placeholder { color: var(--text-subtle); }

/* segment chips */
.chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); padding: var(--sp-4) var(--sp-5) var(--sp-3); }
.chip { display: inline-flex; align-items: center; gap: var(--sp-2); padding: var(--sp-2) var(--sp-3); border-radius: var(--radius-pill); border: 1px solid var(--border); background: var(--surface); font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--text-muted); transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease); }
.chip:hover { background: var(--surface-hover); color: var(--text); }
.chip.is-active { background: var(--primary); color: var(--primary-fg); border-color: var(--primary); }
.chip-n { font-size: var(--fs-xs); opacity: .7; }

/* row avatar + name */
.row-av { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--surface-2); color: var(--text-muted); font-size: var(--fs-xs); font-weight: var(--fw-semibold); margin-right: var(--sp-3); vertical-align: middle; }
.row-name { vertical-align: middle; }
.badge-vip { background: var(--brand-soft); color: var(--brand); }

/* sortable header */
.th-sort { cursor: pointer; -webkit-user-select: none; user-select: none; }
.th-sort:hover { color: var(--text); }
.th-caret { opacity: 0; margin-left: 3px; font-size: 9px; }
.th-sort.is-sort { color: var(--text); }
.th-sort.is-sort .th-caret { opacity: 1; }

/* pager */
.pager { display: flex; align-items: center; gap: 4px; justify-content: flex-end; padding: var(--sp-4) var(--sp-5); border-top: 1px solid var(--border); }
.pg-btn { min-width: 30px; height: 30px; padding: 0 var(--sp-2); border-radius: var(--radius-sm); font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--text-muted); border: 1px solid transparent; }
.pg-btn:hover:not(:disabled) { background: var(--surface-hover); color: var(--text); }
.pg-btn.is-active { background: var(--surface-2); border-color: var(--border); color: var(--text); }
.pg-btn:disabled { opacity: .4; cursor: default; }
.pg-ell { color: var(--text-subtle); padding: 0 2px; }

/* empty */
.empty { padding: var(--sp-8); text-align: center; color: var(--text-subtle); }

/* ---------------- Guest overview group card ---------------- */
.guest-overview .card, .dash-overview .card { box-shadow: none; border: none; background: var(--surface-2); }
.guest-overview .stat-ic { background: var(--surface); }

/* avatar colours (muted; the one place colour is welcome) */
.av-0 { background: #6b7a99; color: #fff; }
.av-1 { background: #7f8a57; color: #fff; }
.av-2 { background: #a5746a; color: #fff; }
.av-3 { background: #5f8a8a; color: #fff; }
.av-4 { background: #8a7a9c; color: #fff; }
.av-5 { background: #9c8560; color: #fff; }

/* medal (gold / silver / bronze) top-guest cards */
.topg.medal-1 { background: linear-gradient(150deg, color-mix(in srgb, var(--gold) 15%, var(--surface)), var(--surface)); border: 1px solid color-mix(in srgb, var(--gold) 42%, var(--border)); }
.topg.medal-2 { background: linear-gradient(150deg, color-mix(in srgb, var(--silver) 16%, var(--surface)), var(--surface)); border: 1px solid color-mix(in srgb, var(--silver) 42%, var(--border)); }
.topg.medal-3 { background: linear-gradient(150deg, color-mix(in srgb, var(--bronze) 15%, var(--surface)), var(--surface)); border: 1px solid color-mix(in srgb, var(--bronze) 42%, var(--border)); }
.medal-1 .topg-av { box-shadow: 0 0 0 2px color-mix(in srgb, var(--gold) 55%, transparent); }
.medal-2 .topg-av { box-shadow: 0 0 0 2px color-mix(in srgb, var(--silver) 55%, transparent); }
.medal-3 .topg-av { box-shadow: 0 0 0 2px color-mix(in srgb, var(--bronze) 55%, transparent); }
.medal-1 .topg-tier { color: color-mix(in srgb, var(--gold) 75%, var(--text)); }
.medal-2 .topg-tier { color: color-mix(in srgb, var(--silver) 80%, var(--text)); }
.medal-3 .topg-tier { color: color-mix(in srgb, var(--bronze) 80%, var(--text)); }

/* rising star */
.guest-overview .rising { margin-top: var(--sp-4); padding: var(--sp-5); display: flex; align-items: center; gap: var(--sp-4); cursor: pointer; background: var(--surface); border: 1px solid var(--border); }
.rising-ic { width: 40px; height: 40px; border-radius: 11px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; flex: none; }
.rising-ic svg { width: 20px; height: 20px; }
.rising-body { flex: 1; min-width: 0; }
.rising-tag { font-size: var(--fs-xs); font-weight: var(--fw-semibold); letter-spacing: .05em; text-transform: uppercase; color: var(--brand); }
.rising-name { font-weight: var(--fw-semibold); letter-spacing: var(--tracking-tight); margin-top: 1px; }
.rising-meta { font-size: var(--fs-sm); color: var(--text-muted); margin-top: 2px; }
.rising-av { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-weight: var(--fw-semibold); flex: none; }

/* drawer guest profile */
.drawer-contact { font-size: var(--fs-md); color: var(--text-muted); }
.drawer-summary { font-size: var(--fs-md); line-height: 1.55; color: var(--text); background: var(--surface-2); border-radius: var(--radius-sm); padding: var(--sp-4); }
.prof-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
.prof { background: var(--surface-2); border-radius: var(--radius-sm); padding: var(--sp-3) var(--sp-4); }
.prof-l { font-size: var(--fs-xs); color: var(--text-subtle); text-transform: uppercase; letter-spacing: .04em; }
.prof-v { font-size: var(--fs-md); font-weight: var(--fw-medium); margin-top: 2px; }
.tag-row { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
