/* ============================================================
   ТВОИ 10 СОТОК · DASHBOARD
   Editorial / cadastral aesthetic — warm paper, forest ink,
   terracotta accent, topographic motif.
   ============================================================ */

:root {
  /* paper / surface */
  --paper:        #F3EEE2;
  --paper-2:      #ECE5D3;
  --surface:      #FBF8F1;
  --surface-2:    #FFFFFFE6;
  --ink:          #1B1A17;
  --ink-2:        #3A372F;
  --muted:        #7A7363;
  --muted-2:      #A39C8A;
  --line:         #DDD3BD;
  --line-2:       #E8E0CB;

  /* brand */
  --forest:       #1F4A2E;
  --forest-2:     #2C5F3D;
  --sage:         #6B8C70;
  --moss:         #A8B894;
  --clay:         #B25A38;     /* terracotta */
  --clay-2:       #D17751;
  --ochre:        #C48A2C;
  --rust:         #983725;

  /* tint backgrounds */
  --forest-tint:  #E4ECDF;
  --clay-tint:    #F4E4D8;
  --ochre-tint:   #F5E7C4;
  --rust-tint:    #F0D8CF;

  /* sizing */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;

  --t-display: 'Spectral', 'Times New Roman', serif;
  --t-ui:      'Manrope', system-ui, -apple-system, sans-serif;
  --t-mono:    'JetBrains Mono', 'IBM Plex Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--t-ui);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-image:
    radial-gradient(circle at 1px 1px, rgba(31,74,46,0.07) 1px, transparent 0);
  background-size: 18px 18px;
}

/* ----- typography ----- */
.t-display {
  font-family: var(--t-display);
  font-weight: 400;
  letter-spacing: -0.01em;
  font-feature-settings: "lnum", "tnum";
}
.t-num {
  font-family: var(--t-display);
  font-feature-settings: "lnum", "tnum";
  font-variant-numeric: lining-nums tabular-nums;
}
.t-mono { font-family: var(--t-mono); font-feature-settings: "tnum"; }
.t-eyebrow {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ============================================================
   LAYOUT
   ============================================================ */
.app {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
  min-width: 1320px;
}

/* ===== SIDEBAR ===== */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}
.sidebar::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='248' height='400' viewBox='0 0 248 400'><g fill='none' stroke='%231F4A2E' stroke-width='0.5' opacity='0.06'><path d='M-20 80 Q60 60 124 90 T280 70'/><path d='M-20 120 Q60 100 124 130 T280 110'/><path d='M-20 160 Q60 140 124 170 T280 150'/><path d='M-20 200 Q60 180 124 210 T280 190'/><path d='M-20 240 Q60 220 124 250 T280 230'/><path d='M-20 280 Q60 260 124 290 T280 270'/><path d='M-20 320 Q60 300 124 330 T280 310'/></g></svg>");
  background-repeat: repeat-y;
  pointer-events: none;
}
.sidebar > * { position: relative; }

.brand {
  padding: 22px 22px 20px;
  border-bottom: 1px solid var(--line-2);
  position: relative;
}
.brand .t-eyebrow {
  letter-spacing: 0.22em;
  font-size: 10px;
  color: var(--muted);
  margin-bottom: 10px;
}
.brand-wordmark {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 12px;
  row-gap: 0;
  align-items: center;
  line-height: 1;
}
.brand-wordmark .ti {
  grid-column: 2;
  grid-row: 1;
  font-family: var(--t-display);
  font-style: italic;
  font-weight: 400;
  font-size: 15px;
  color: var(--forest);
  letter-spacing: 0.02em;
  margin-bottom: 2px;
}
.brand-wordmark .ten {
  grid-column: 1;
  grid-row: 1 / span 2;
  font-family: var(--t-display);
  font-weight: 500;
  font-size: 56px;
  letter-spacing: -0.04em;
  line-height: 0.85;
  color: var(--ink);
  font-feature-settings: "lnum";
}
.brand-wordmark .lo {
  grid-column: 2;
  grid-row: 2;
  font-family: var(--t-display);
  font-weight: 500;
  font-size: 22px;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin-top: 1px;
}

.nav-group { padding: 14px 14px 4px; }
.nav-group .t-eyebrow { font-size: 10px; letter-spacing: 0.18em; padding: 0 8px 6px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  background: transparent;
  border: none;
  border-radius: var(--r-sm);
  font-family: inherit;
  font-size: 13.5px;
  color: var(--ink-2);
  cursor: pointer;
  text-align: left;
  margin-bottom: 1px;
}
.nav-item:hover { background: var(--paper-2); color: var(--ink); }
.nav-item .icon { width: 16px; height: 16px; opacity: 0.7; }
.nav-item .badge-mini {
  margin-left: auto;
  font-size: 10.5px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--clay-tint);
  color: var(--rust);
  font-family: var(--t-mono);
}
.nav-item.active {
  background: var(--ink);
  color: var(--surface);
}
.nav-item.active .icon { opacity: 1; color: var(--moss); }

.sidebar-foot {
  margin-top: auto;
  padding: 14px 18px 18px;
  border-top: 1px solid var(--line-2);
  font-size: 11.5px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
}
.dot-pulse {
  width: 8px; height: 8px; border-radius: 999px;
  background: var(--forest-2);
  box-shadow: 0 0 0 0 rgba(44,95,61,0.5);
  animation: pulse 1.8s infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(44,95,61,0.5); }
  70%  { box-shadow: 0 0 0 8px rgba(44,95,61,0); }
  100% { box-shadow: 0 0 0 0 rgba(44,95,61,0); }
}

/* ===== MAIN ===== */
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: transparent;
}

.topbar {
  min-height: 84px;
  padding: 14px 32px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(8px);
}
.topbar .title-block { min-width: 0; flex: 1; }
.topbar .title-block .card-sub { max-width: 460px; margin-top: 4px; }
.topbar .title-block .t-eyebrow { margin-bottom: 2px; }
.topbar .title {
  font-family: var(--t-display);
  font-size: 28px;
  line-height: 1;
  letter-spacing: -0.015em;
}
.topbar .title em {
  font-style: italic;
  color: var(--forest);
  font-weight: 400;
}

.topbar-actions { display: flex; gap: 10px; align-items: center; }

/* segmented period */
.segmented {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
  flex-wrap: nowrap;
}
.segmented button {
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 12.5px;
  color: var(--muted);
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 500;
  letter-spacing: 0.01em;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.segmented button.active {
  background: var(--ink);
  color: var(--paper);
}
.segmented button.custom {
  border-left: 1px dashed var(--line);
  margin-left: 2px;
  padding-left: 12px;
  color: var(--ink-2);
}
.segmented button.custom.active {
  border-left: 1px solid var(--ink);
}

/* date range popover */
.period-wrap { position: relative; }
.daterange-pop {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 380px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: 0 24px 48px -16px rgba(27,26,23,0.22),
              0 0 0 1px rgba(255,255,255,0.6) inset;
  padding: 16px 16px 14px;
  z-index: 50;
  display: none;
}
.daterange-pop.open { display: block; }
.daterange-pop::before {
  content: "";
  position: absolute;
  right: 32px;
  top: -6px;
  width: 11px; height: 11px;
  background: var(--surface);
  border-left: 1px solid var(--line);
  border-top: 1px solid var(--line);
  transform: rotate(45deg);
}
.daterange-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px;
}
.daterange-head .t-eyebrow { letter-spacing: 0.14em; }
.dr-close {
  background: transparent; border: none; cursor: pointer;
  color: var(--muted); display: grid; place-items: center;
  width: 24px; height: 24px; border-radius: 50%;
}
.dr-close:hover { background: var(--paper-2); color: var(--ink); }

.dr-presets {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 14px;
}
.dr-presets button {
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 6px;
  padding: 6px 4px;
  font-family: inherit;
  font-size: 11.5px;
  color: var(--ink-2);
  cursor: pointer;
  font-weight: 500;
  letter-spacing: 0.01em;
}
.dr-presets button:hover { background: var(--paper-2); border-color: var(--muted-2); }
.dr-presets button.active {
  background: var(--ink); color: var(--paper); border-color: var(--ink);
}

.dr-inputs {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  align-items: end;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 10px 12px;
}
.dr-inputs label {
  display: flex; flex-direction: column; gap: 4px;
}
.dr-inputs label .t-eyebrow {
  font-size: 9.5px; letter-spacing: 0.16em;
}
.dr-inputs input[type="date"] {
  border: none;
  background: transparent;
  font-family: var(--t-mono);
  font-size: 13px;
  color: var(--ink);
  padding: 2px 0;
  outline: none;
  width: 100%;
  font-feature-settings: "tnum";
}
.dr-inputs input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.4);
  cursor: pointer;
}
.dr-arrow {
  display: grid; place-items: center;
  color: var(--muted);
  padding-bottom: 4px;
}

.dr-summary {
  font-size: 12px;
  color: var(--muted);
  font-family: var(--t-mono);
  padding: 10px 4px 12px;
  border-bottom: 1px dashed var(--line-2);
  margin-bottom: 12px;
}
.dr-summary b { color: var(--ink); font-family: var(--t-display); font-size: 14px; font-weight: 500; }
.dr-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.icon-btn {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  color: var(--ink-2);
}
.icon-btn:hover { background: var(--surface-2); }

.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 14px 4px 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
}
.user-chip .avatar {
  width: 30px; height: 30px;
  background: var(--clay);
  color: var(--paper);
  border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 600;
  font-size: 12px;
}
.user-chip .who { font-size: 12px; line-height: 1.15; }
.user-chip .who .name { font-weight: 600; }
.user-chip .who .mail { color: var(--muted); font-size: 10.5px; }

/* ===== CONTENT ===== */
.content {
  padding: 28px 32px 64px;
  flex: 1;
  min-width: 0;
}
.tab { display: none; }
.tab.active { display: block; }

/* grid utilities */
.bento { display: grid; gap: 16px; }
.cols-4  { grid-template-columns: repeat(4, 1fr); }
.cols-3  { grid-template-columns: repeat(3, 1fr); }
.cols-2  { grid-template-columns: repeat(2, 1fr); }
.cols-12 { grid-template-columns: repeat(12, 1fr); }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.span-4 { grid-column: span 4; }
.span-5 { grid-column: span 5; }
.span-6 { grid-column: span 6; }
.span-7 { grid-column: span 7; }
.span-8 { grid-column: span 8; }
.span-9 { grid-column: span 9; }
.span-12 { grid-column: span 12; }
.row-2 { grid-row: span 2; }

/* ===== CARD ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 20px;
  position: relative;
}
.card.tight { padding: 16px; }
.card.flush { padding: 0; overflow: hidden; }
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
  gap: 12px;
}
.card-title {
  font-family: var(--t-display);
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.card-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.card-aside { font-size: 12px; color: var(--muted); display: flex; gap: 12px; align-items: center; }

.legend-dot {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px;
  color: var(--ink-2);
}
.legend-dot::before {
  content: "";
  width: 8px; height: 8px;
  border-radius: 2px;
  background: var(--forest);
}
.legend-dot.clay::before { background: var(--clay); }
.legend-dot.ochre::before { background: var(--ochre); }
.legend-dot.sage::before { background: var(--sage); }
.legend-dot.rust::before { background: var(--rust); }

/* ===== KPI CARD ===== */
.kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 18px 20px 16px;
  position: relative;
  overflow: hidden;
}
.kpi .top {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 8px;
}
.kpi .label { font-size: 11px; color: var(--muted); font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; }
.kpi .badge-icon {
  width: 28px; height: 28px;
  background: var(--forest-tint);
  color: var(--forest);
  border-radius: var(--r-sm);
  display: grid; place-items: center;
}
.kpi .badge-icon.clay { background: var(--clay-tint); color: var(--clay); }
.kpi .badge-icon.ochre { background: var(--ochre-tint); color: var(--ochre); }
.kpi .badge-icon.rust { background: var(--rust-tint); color: var(--rust); }

.kpi .value {
  font-family: var(--t-display);
  font-size: 38px;
  line-height: 1;
  letter-spacing: -0.02em;
  margin-top: 6px;
  font-feature-settings: "lnum", "tnum";
  white-space: nowrap;
}
.kpi .value .unit {
  font-size: 18px;
  color: var(--muted);
  margin-left: 4px;
}
.kpi .foot {
  margin-top: 12px;
  display: flex; align-items: center; gap: 8px;
  font-size: 12px;
  max-width: calc(100% - 88px);
  flex-wrap: wrap;
  row-gap: 4px;
}
.kpi .delta {
  display: inline-flex; align-items: center; gap: 3px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  font-family: var(--t-mono);
  font-size: 11px;
}
.kpi .delta.up    { background: var(--forest-tint); color: var(--forest); }
.kpi .delta.down  { background: var(--rust-tint);  color: var(--rust); }
.kpi .delta.flat  { background: var(--paper-2);    color: var(--muted); }
.kpi .foot .note { color: var(--muted); }
.kpi .spark {
  position: absolute;
  right: 14px;
  bottom: 14px;
  width: 80px;
  height: 28px;
  opacity: 0.7;
  pointer-events: none;
  z-index: 0;
}
.kpi .top, .kpi .value, .kpi .foot { position: relative; z-index: 1; }
.kpi.accent-clay { background: linear-gradient(180deg, var(--surface) 0%, var(--clay-tint) 300%); }
.kpi.accent-ink {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.kpi.accent-ink .label { color: var(--moss); }
.kpi.accent-ink .value { color: var(--paper); }
.kpi.accent-ink .badge-icon { background: rgba(255,255,255,0.08); color: var(--moss); }
.kpi.accent-ink .foot .note { color: var(--moss); }

/* ===== TABLE ===== */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl thead th {
  text-align: left;
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  padding: 0 12px 10px;
  border-bottom: 1px solid var(--line);
}
.tbl tbody td {
  padding: 12px 12px;
  border-bottom: 1px solid var(--line-2);
  vertical-align: middle;
}
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: var(--paper-2); }
.tbl .right { text-align: right; }
.tbl .num { font-family: var(--t-mono); font-size: 13px; font-variant-numeric: tabular-nums; }
.tbl .num.big { font-family: var(--t-display); font-size: 16px; }
.tbl .strong { font-weight: 600; color: var(--ink); }
.tbl .muted  { color: var(--muted); }

/* badges/pills */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  letter-spacing: 0.02em;
}
.pill::before {
  content: ""; width: 6px; height: 6px; border-radius: 999px;
  background: currentColor;
}
.pill.ok      { background: var(--forest-tint); color: var(--forest); }
.pill.warn    { background: var(--ochre-tint);  color: #7a5613; }
.pill.danger  { background: var(--rust-tint);   color: var(--rust); }
.pill.neutral { background: var(--paper-2);     color: var(--muted); }
.pill.solid-ink { background: var(--ink); color: var(--paper); }
.pill.solid-ink::before { background: var(--moss); }

.tag {
  display: inline-flex; align-items: center;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-weight: 500;
  letter-spacing: 0.02em;
}
.tag.basic    { color: var(--muted); }
.tag.standard { color: var(--sage); border-color: var(--moss); background: var(--forest-tint); }
.tag.premium  { color: var(--forest); border-color: var(--sage); background: var(--forest-tint); font-weight: 600; }
.tag.vip      { color: var(--clay); border-color: var(--clay); background: var(--clay-tint); font-weight: 600; }
.tag.lost     { color: var(--rust); border-color: var(--rust); background: var(--rust-tint); }

/* avatar */
.avatar-sm {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--paper);
  background: var(--forest);
  flex-shrink: 0;
}
.avatar-sm.a2 { background: var(--clay); }
.avatar-sm.a3 { background: var(--sage); }
.avatar-sm.a4 { background: var(--ochre); }
.avatar-sm.a5 { background: var(--rust); }

/* ===== chart wrappers ===== */
.chart-box { position: relative; height: 240px; }
.chart-box.h-sm { height: 180px; }
.chart-box.h-lg { height: 320px; }

/* ===== filling/progress bars ===== */
.bar {
  height: 6px;
  border-radius: 999px;
  background: var(--paper-2);
  overflow: hidden;
  position: relative;
}
.bar > i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--forest);
}
.bar.tall { height: 8px; }
.bar.warn > i { background: var(--ochre); }
.bar.danger > i { background: var(--rust); }
.bar.clay > i { background: var(--clay); }

/* ===== funnel ===== */
.funnel-row { display: grid; grid-template-columns: 200px 1fr 90px; gap: 18px; align-items: center; margin-bottom: 14px; }
.funnel-row .stage .name { font-weight: 600; }
.funnel-row .stage .meta { font-size: 11.5px; color: var(--muted); font-family: var(--t-mono); }
.funnel-bar {
  height: 44px;
  border-radius: 8px;
  position: relative;
  display: flex;
  align-items: center;
  padding-left: 14px;
  color: var(--paper);
  font-family: var(--t-display);
  font-size: 18px;
  letter-spacing: -0.01em;
  overflow: hidden;
}
.funnel-bar::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--forest) 0%, var(--forest-2) 70%, var(--sage) 100%);
  z-index: 0;
}
.funnel-bar > span { position: relative; z-index: 1; }
.funnel-bar.stage-1::before { background: var(--ink); }
.funnel-bar.stage-2::before { background: linear-gradient(90deg, #2a4d2f, #36603f); }
.funnel-bar.stage-3::before { background: linear-gradient(90deg, #36603f, #4f7e54); }
.funnel-bar.stage-4::before { background: linear-gradient(90deg, #4f7e54, var(--clay)); }
.funnel-bar.stage-5::before { background: linear-gradient(90deg, var(--clay), var(--clay-2)); }
.funnel-conv { text-align: right; }
.funnel-conv .v { font-family: var(--t-display); font-size: 18px; line-height: 1; }
.funnel-conv .s { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; }

/* ===== decades grid ===== */
.decade-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 14px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}
.decade-card:hover {
  transform: translateY(-2px);
  border-color: var(--muted-2);
  box-shadow: 0 14px 28px -16px rgba(27,26,23,0.18);
}
.decade-card:hover .open-hint { opacity: 1; transform: translateX(0); }
.decade-card .open-hint {
  position: absolute;
  top: 14px;
  right: 14px;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 140ms, transform 140ms;
  pointer-events: none;
}
.decade-card .head {
  display: flex; justify-content: space-between; align-items: center;
}
.decade-card .num {
  font-family: var(--t-display);
  font-size: 22px;
  letter-spacing: -0.02em;
}
.decade-card .num .hash { color: var(--muted); margin-right: 2px; }
.seats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
}
.seat {
  aspect-ratio: 1;
  border-radius: 4px;
  background: var(--paper-2);
}
.seat.taken { background: var(--forest); }
.seat.taken.warn { background: var(--ochre); }
.seat.taken.danger { background: var(--rust); }
.decade-card .meta {
  display: flex; gap: 12px;
  font-size: 11px;
  color: var(--muted);
  font-family: var(--t-mono);
}
.decade-card .meta b { color: var(--ink); font-weight: 600; }
.decade-card.is-danger { border-color: var(--rust); background: linear-gradient(180deg, var(--surface), var(--rust-tint) 280%); }
.decade-card.is-warn { border-color: var(--ochre); }

/* ===== DECADE DETAIL VIEW ===== */
.decades-view[hidden] { display: none !important; }

.detail-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 14px 18px;
}
.back-link {
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
}
.back-link:hover { background: var(--paper-2); color: var(--ink); }
.detail-title {
  display: flex;
  align-items: baseline;
  gap: 14px;
  font-family: var(--t-display);
  flex-wrap: wrap;
}
.detail-title .num {
  font-size: 38px;
  line-height: 1;
  letter-spacing: -0.025em;
  color: var(--ink);
}
.detail-title .num .hash { color: var(--muted); margin-right: 1px; }
.detail-title .label {
  font-size: 14px;
  color: var(--muted);
  font-style: italic;
  letter-spacing: 0.01em;
}

/* leader card */
.leader-card {
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--r-lg);
  padding: 22px 24px;
  position: relative;
  overflow: hidden;
}
.leader-card::before {
  content: "";
  position: absolute;
  right: -40px; top: -40px;
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(168,184,148,0.18), transparent 70%);
  pointer-events: none;
}
.leader-card .t-eyebrow {
  color: var(--moss);
  letter-spacing: 0.18em;
}
.leader-card .lead-row {
  display: flex; align-items: center; gap: 14px; margin-top: 12px;
}
.leader-card .lead-avatar {
  width: 52px; height: 52px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--clay);
  color: var(--paper);
  font-weight: 600;
  font-size: 18px;
  font-family: var(--t-display);
  box-shadow: 0 0 0 3px rgba(255,255,255,0.06),
              0 0 0 4px rgba(216,209,191,0.18);
}
.leader-card .lead-name {
  font-family: var(--t-display);
  font-size: 22px;
  letter-spacing: -0.01em;
}
.leader-card .lead-meta {
  font-size: 12px;
  color: var(--moss);
  font-family: var(--t-mono);
  margin-top: 2px;
}
.leader-card .lead-quote {
  margin-top: 16px;
  font-family: var(--t-display);
  font-style: italic;
  font-size: 14px;
  color: var(--moss);
  line-height: 1.5;
  position: relative;
  padding-left: 14px;
}
.leader-card .lead-quote::before {
  content: "";
  position: absolute;
  left: 0; top: 4px; bottom: 4px;
  width: 2px;
  background: var(--moss);
  opacity: 0.5;
}
.leader-card .lead-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(216,209,191,0.16);
}
.leader-card .lead-stats div { font-family: var(--t-display); font-size: 18px; letter-spacing: -0.01em; }
.leader-card .lead-stats div .l { font-family: var(--t-ui); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--moss); font-weight: 600; display: block; margin-bottom: 4px; }

/* members table */
.member-row {
  display: grid;
  grid-template-columns: 28px 1.7fr 0.9fr 1fr 1fr 1fr 0.8fr;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  font-size: 13px;
  transition: border-color 120ms, background 120ms;
}
.member-row + .member-row { margin-top: 6px; }
.member-row:hover { border-color: var(--muted-2); background: var(--paper); }
.member-row.is-leader {
  background: linear-gradient(90deg, var(--forest-tint) 0%, var(--surface) 50%);
  border-color: var(--sage);
}
.member-row.is-risk { border-color: var(--rust); }
.member-row.is-silent { background: var(--paper-2); }
.member-row .idx {
  font-family: var(--t-mono);
  font-size: 11px;
  color: var(--muted);
}
.member-row .who {
  display: flex; align-items: center; gap: 10px;
  min-width: 0;
}
.member-row .who .name { font-weight: 600; }
.member-row .who .vk { font-family: var(--t-mono); font-size: 11px; color: var(--muted); }

.member-row .lvl {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--muted);
}
.member-row .lvl.leader  { color: var(--forest); }
.member-row .lvl.active  { color: var(--ink); }
.member-row .lvl.quiet   { color: var(--ochre); }
.member-row .lvl.risk    { color: var(--rust); }

.activity-bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 28px;
}
.activity-bars span {
  display: block;
  width: 4px;
  background: var(--forest);
  border-radius: 1px;
  min-height: 2px;
  opacity: 0.85;
}
.activity-bars.low span { background: var(--ochre); }
.activity-bars.silent span { background: var(--rust); }

.member-row .pay-line { display: flex; flex-direction: column; gap: 2px; font-family: var(--t-mono); font-size: 12px; }
.member-row .pay-line .p { color: var(--muted); }
.member-row .pay-line .e { color: var(--ink); font-weight: 600; }
.member-row .pay-line .e.warn { color: var(--ochre); }
.member-row .pay-line .e.danger { color: var(--rust); }

.member-row .last-msg { font-family: var(--t-mono); font-size: 12px; color: var(--muted); }
.member-row .last-msg.warn { color: var(--ochre); }
.member-row .last-msg.danger { color: var(--rust); }

.member-row .actions {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
}
.member-row .actions button {
  width: 28px; height: 28px;
  border-radius: 6px;
  background: transparent;
  border: 1px solid var(--line);
  cursor: pointer;
  color: var(--muted);
  display: grid; place-items: center;
}
.member-row .actions button:hover { background: var(--paper-2); color: var(--ink); border-color: var(--muted-2); }

.member-table-head {
  display: grid;
  grid-template-columns: 28px 1.7fr 0.9fr 1fr 1fr 1fr 0.8fr;
  gap: 14px;
  padding: 0 16px 10px;
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

/* activity timeline */
.timeline-wrap {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 120px;
}
.tl-day {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: var(--muted);
  font-family: var(--t-mono);
}
.tl-day .bar {
  width: 100%;
  background: var(--forest);
  border-radius: 3px 3px 0 0;
  min-height: 2px;
}
.tl-day.weekend .bar { background: var(--sage); opacity: 0.6; }
.tl-day.today .bar { background: var(--clay); }

/* risk callout */
.risk-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  background: var(--rust-tint);
  border: 1px solid var(--rust);
  border-radius: var(--r-sm);
  margin-bottom: 8px;
  font-size: 13px;
}
.risk-row .ico { color: var(--rust); }
.risk-row .who { font-weight: 600; }
.risk-row .reason { color: var(--muted); font-size: 11.5px; }
.risk-row .ago { margin-left: auto; font-family: var(--t-mono); font-size: 11.5px; color: var(--rust); font-weight: 600; }

/* ===== transitions matrix ===== */
.matrix { font-size: 13px; width: 100%; border-collapse: separate; border-spacing: 4px; }
.matrix th, .matrix td { padding: 10px 12px; text-align: center; }
.matrix th {
  font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); font-weight: 600;
}
.matrix th.row-head { text-align: left; }
.matrix td.row-head { text-align: left; font-weight: 600; color: var(--ink); background: var(--paper); border-radius: var(--r-sm); }
.matrix td.cell {
  background: var(--surface);
  border-radius: var(--r-sm);
  font-family: var(--t-display);
  font-size: 17px;
  position: relative;
}
.matrix td.cell .v { position: relative; z-index: 1; }
.matrix td.cell.empty { color: var(--muted-2); font-family: var(--t-mono); font-size: 13px; }
.matrix td.cell.diag { background: var(--forest); color: var(--paper); }
.matrix td.cell.lost { background: var(--rust-tint); color: var(--rust); }
.matrix td.cell.weak { background: var(--paper-2); }
.matrix td.cell.strong { background: var(--forest-tint); color: var(--forest); }

/* ===== recent payments list ===== */
.feed { display: flex; flex-direction: column; gap: 2px; }
.feed-item {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 4px;
  border-bottom: 1px dashed var(--line-2);
}
.feed-item:last-child { border-bottom: 0; }
.feed-item .who { font-weight: 600; font-size: 13px; }
.feed-item .meta { font-size: 11.5px; color: var(--muted); }
.feed-item .amount { font-family: var(--t-display); font-size: 17px; letter-spacing: -0.01em; }
.feed-item .kind { font-size: 10.5px; color: var(--muted); letter-spacing: 0.1em; text-transform: uppercase; }
.feed-item .kind.new { color: var(--forest); }
.feed-item .kind.renewal { color: var(--clay); }

/* ===== ICP banner / VK-tbd info ===== */
.notice {
  background: var(--clay-tint);
  border: 1px solid var(--clay-2);
  border-radius: var(--r-md);
  padding: 14px 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 18px;
}
.notice .ico {
  width: 28px; height: 28px;
  background: var(--clay);
  color: var(--paper);
  border-radius: 50%;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.notice .body { font-size: 13px; color: var(--ink-2); }
.notice .body b { color: var(--clay); }

/* ===== forecast banner ===== */
.fc-callout {
  position: relative;
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--r-lg);
  padding: 22px 24px;
  overflow: hidden;
}
.fc-callout::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 80% 30%, rgba(168,184,148,0.18), transparent 60%),
    radial-gradient(circle at 10% 90%, rgba(178,90,56,0.28), transparent 50%);
  pointer-events: none;
}
.fc-callout > * { position: relative; }

/* ===== misc ===== */
.divider { height: 1px; background: var(--line); margin: 24px 0; }
.btn-ghost {
  font-size: 12.5px; color: var(--forest); font-weight: 600;
  background: transparent; border: none; cursor: pointer;
  display: inline-flex; align-items: center; gap: 4px;
}
.btn-primary {
  background: var(--ink); color: var(--paper);
  border: none; cursor: pointer; padding: 8px 14px;
  border-radius: 999px;
  font-family: inherit; font-weight: 600; font-size: 12.5px;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn-primary:hover { background: var(--forest); }
.btn-icon {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 6px 10px; font-size: 12px; cursor: pointer;
  color: var(--ink-2);
  display: inline-flex; align-items: center; gap: 5px;
}
.btn-icon:hover { background: var(--paper-2); }

/* ===== section toolbar (per-tab export) ===== */
.section-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  margin-bottom: 16px;
}
.section-tools .info {
  display: flex; align-items: center; gap: 14px;
  font-size: 12px; color: var(--muted);
  flex-wrap: wrap;
}
.section-tools .info .chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  color: var(--ink-2);
}
.section-tools .info .chip b {
  font-family: var(--t-mono);
  color: var(--ink);
  font-weight: 500;
}
.section-tools .info .chip i { width: 12px; height: 12px; opacity: 0.7; }
.section-tools .info .snap {
  font-style: italic;
  color: var(--clay);
  font-size: 11.5px;
  display: inline-flex; align-items: center; gap: 5px;
}

.export-group {
  position: relative;
  display: inline-flex;
}
.export-btn {
  background: var(--ink);
  color: var(--paper);
  border: none;
  cursor: pointer;
  padding: 8px 14px;
  border-radius: 999px;
  font-family: inherit;
  font-weight: 600;
  font-size: 12.5px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.export-btn:hover { background: var(--forest); }
.export-btn .chev { width: 13px; height: 13px; opacity: 0.7; margin-left: 2px; }

.export-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: 0 18px 36px -16px rgba(27,26,23,0.22);
  min-width: 260px;
  padding: 6px;
  z-index: 40;
  display: none;
}
.export-menu.open { display: block; }
.export-menu .hint {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  font-weight: 600;
  padding: 8px 10px 4px;
}
.export-menu button {
  width: 100%;
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: none;
  border-radius: 6px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}
.export-menu button:hover { background: var(--paper-2); }
.export-menu button .ext {
  font-family: var(--t-mono);
  font-size: 10.5px;
  color: var(--muted);
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 1px 6px;
  border-radius: 4px;
  letter-spacing: 0.04em;
}
.export-menu button .ico {
  width: 22px; height: 22px;
  display: grid; place-items: center;
  background: var(--forest-tint);
  color: var(--forest);
  border-radius: 5px;
}
.export-menu button .ico.clay { background: var(--clay-tint); color: var(--clay); }
.export-menu button .ico.ochre { background: var(--ochre-tint); color: var(--ochre); }
.export-menu button .ico.ink { background: var(--ink); color: var(--paper); }
.export-menu .sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 1px;
}

/* "snapshot now" variant for decades */
.export-btn.snap {
  background: var(--clay);
}
.export-btn.snap:hover { background: var(--clay-2); }

/* toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 30px);
  background: var(--ink);
  color: var(--paper);
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 18px 30px -12px rgba(27,26,23,0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms, transform 180ms;
  z-index: 200;
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
.toast .ico {
  width: 20px; height: 20px;
  background: var(--forest);
  border-radius: 50%;
  display: grid; place-items: center;
  color: var(--paper);
}
.toast .file {
  font-family: var(--t-mono);
  font-size: 12px;
  color: var(--moss);
}

.search {
  position: relative;
  flex: 1;
  max-width: 260px;
}
.search input {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 7px 14px 7px 32px;
  font: inherit; font-size: 12.5px;
  color: var(--ink);
}
.search input::placeholder { color: var(--muted-2); }
.search .ico { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); }

.users-filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.select {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 6px 26px 6px 10px;
  font: inherit; font-size: 12.5px;
  color: var(--ink-2);
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'><path fill='none' stroke='%237A7363' stroke-width='1.5' d='M2 4 L5 7 L8 4'/></svg>");
  background-repeat: no-repeat;
  background-position: right 8px center;
}

/* ===== Tweaks panel ===== */
#tweaks {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 268px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: 0 24px 40px -16px rgba(27,26,23,0.25);
  padding: 18px;
  z-index: 100;
  display: none;
}
#tweaks.open { display: block; }
#tweaks h3 { font-family: var(--t-display); font-size: 17px; margin: 0 0 12px; }
#tweaks .row { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-top: 1px solid var(--line-2); }
#tweaks .row:first-of-type { border-top: 0; }
#tweaks .row label { font-size: 12px; color: var(--ink-2); }
#tweaks .swatches { display: flex; gap: 6px; }
#tweaks .swatch {
  width: 22px; height: 22px; border-radius: 50%; cursor: pointer;
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px var(--line);
}
#tweaks .swatch.active { box-shadow: 0 0 0 2px var(--ink); }
#tweaks .seg { display: inline-flex; background: var(--paper-2); border-radius: 999px; padding: 2px; }
#tweaks .seg button {
  border: none; background: transparent; padding: 4px 10px; font: inherit; font-size: 11.5px;
  border-radius: 999px; cursor: pointer; color: var(--muted);
}
#tweaks .seg button.active { background: var(--ink); color: var(--paper); }
.tweak-toggle {
  position: fixed; right: 20px; bottom: 20px;
  background: var(--ink); color: var(--paper);
  width: 44px; height: 44px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: grid; place-items: center;
  box-shadow: 0 12px 30px -8px rgba(27,26,23,0.4);
  z-index: 99;
}

/* DENSITY VARIANTS */
body.density-compact .kpi { padding: 14px 16px 12px; }
body.density-compact .kpi .value { font-size: 30px; }
body.density-compact .card { padding: 16px; }
body.density-compact .tbl tbody td { padding: 8px 10px; }
body.density-compact .content { padding: 20px 24px 48px; }

/* DARK THEME — moss/loam */
body.theme-loam {
  --paper:        #1A1A17;
  --paper-2:      #232220;
  --surface:      #232220;
  --surface-2:    #2A2926;
  --ink:          #F2EBDB;
  --ink-2:        #D8D1BF;
  --muted:        #918B7A;
  --muted-2:      #6E695B;
  --line:         #38362F;
  --line-2:       #2D2B25;
  --forest:       #7BA37E;
  --forest-2:     #94B998;
  --sage:         #A8BDA9;
  --moss:         #D8D1BF;
  --clay:         #D17751;
  --clay-2:       #E69676;
  --ochre:        #E0AE57;
  --rust:         #D47357;
  --forest-tint:  #2A3C2E;
  --clay-tint:    #3E2C24;
  --ochre-tint:   #3D311A;
  --rust-tint:    #3E261F;
  background-image:
    radial-gradient(circle at 1px 1px, rgba(216,209,191,0.05) 1px, transparent 0);
}
body.theme-loam .topbar .title em { color: var(--forest-2); }
body.theme-loam .kpi.accent-ink {
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--ink);
}
body.theme-loam .kpi.accent-ink .label { color: var(--moss); }
body.theme-loam .nav-item.active { background: var(--paper-2); color: var(--ink); }
body.theme-loam .pill.solid-ink { background: var(--forest-2); color: var(--paper); }
body.theme-loam .funnel-bar.stage-1::before { background: var(--forest); }
body.theme-loam .matrix td.cell.diag { color: var(--paper); }

/* ACCENT VARIANTS */
body.accent-clay  { --forest: var(--clay); --forest-2: var(--clay-2); --forest-tint: var(--clay-tint); }
body.accent-ochre { --forest: var(--ochre); --forest-2: #D9A04E; --forest-tint: var(--ochre-tint); }

/* sparkline svg */
.spark path.area { fill: rgba(31,74,46,0.12); }
.spark path.line { fill: none; stroke: var(--forest); stroke-width: 1.5; }
body.accent-clay .spark path.line { stroke: var(--clay); }
body.accent-clay .spark path.area { fill: rgba(178,90,56,0.12); }
