/* =========================================================
   Yeshaa Workspace — styles
   Flat, calm, data-first UI in the brand's ink, ivory & gold.
   Light + dark themes via [data-theme] (set by theme-init.js).
   ========================================================= */

:root {
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius-sm: 8px;
  --radius: 10px;
  --radius-lg: 14px;
  --sidebar-w: 244px;
  --topbar-h: 64px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);

  /* Sidebar is always ink — the brand anchor in both themes */
  --side-bg: #0F0D0B;
  --side-text: #D4CBBD;
  --side-muted: #9D9486;
  --side-line: rgba(255, 255, 255, 0.08);
  --side-active: rgba(226, 192, 122, 0.13);
  --side-gold: #EFD9A2;

  --gold-grad: linear-gradient(120deg, #B48A3C 0%, #E3C47F 48%, #C49A4D 100%);
  --on-gold: #16130F;

  /* Lead stage identity (validated categorical palette; won/lost use status colors) */
  --stage-new: #4F7CC9;
  --stage-contacted: #2A9D8F;
  --stage-site_visit: #8B6CC7;
  --stage-proposal: #C9A15A;
  --stage-negotiation: #C4577A;
}

:root,
[data-theme="light"] {
  color-scheme: light;
  --bg: #F6F4EF;
  --surface: #FFFFFF;
  --surface-2: #FAF8F4;
  --surface-3: #F0ECE4;
  --border: #E7E1D6;
  --border-strong: #D6CDBE;
  --text: #1B1814;
  --text-2: #57504A;
  --text-3: #6E665B;
  --gold: #8C6A26;
  --gold-soft: rgba(201, 161, 90, 0.16);
  --gold-line: rgba(167, 128, 47, 0.35);
  --chart-bar: #A7802F;
  --focus: #8C6A26;
  --success: #1F7A4D;
  --success-soft: #E5F4EC;
  --warning: #9A5A06;
  --warning-soft: #FDF1DE;
  --danger: #B42318;
  --danger-soft: #FCE9E7;
  --shadow-overlay: 0 24px 60px -20px rgba(27, 24, 20, 0.35);
  --shadow-card: 0 8px 22px -16px rgba(27, 24, 20, 0.35);
  --backdrop: rgba(27, 24, 20, 0.42);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0D0B09;
  --surface: #15120F;
  --surface-2: #1A1713;
  --surface-3: #241F1A;
  --border: #2B2620;
  --border-strong: #3C352C;
  --text: #F2ECE2;
  --text-2: #C3B9A9;
  --text-3: #A0968A;
  --gold: #E2C07A;
  --gold-soft: rgba(226, 192, 122, 0.12);
  --gold-line: rgba(226, 192, 122, 0.3);
  --chart-bar: #C9A15A;
  --focus: #E2C07A;
  --success: #8FD3A8;
  --success-soft: rgba(143, 211, 168, 0.12);
  --warning: #F0B866;
  --warning-soft: rgba(240, 184, 102, 0.12);
  --danger: #F2A08F;
  --danger-soft: rgba(242, 160, 143, 0.12);
  --shadow-overlay: 0 24px 60px -16px rgba(0, 0, 0, 0.75);
  --shadow-card: 0 10px 26px -18px rgba(0, 0, 0, 0.8);
  --backdrop: rgba(0, 0, 0, 0.6);
  --stage-proposal: #B07F22;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-3); }
.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.i-fill { fill: currentColor; stroke: none; }

/* ---------- boot / errors ---------- */
.boot {
  min-height: 100vh;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 18px;
}
.spinner {
  width: 22px; height: 22px;
  border: 2px solid var(--gold-line);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--side-bg);
  color: var(--side-text);
  border-right: 1px solid var(--side-line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 22px;
  text-decoration: none;
}
.brand img { width: 38px; height: auto; }
.brand-name { font-size: 15px; font-weight: 700; color: #F4EEE3; letter-spacing: 0.02em; line-height: 1.2; }
.brand-sub { font-size: 11px; font-weight: 600; letter-spacing: 0.2em; text-transform: uppercase; color: var(--side-gold); }

.nav { display: grid; gap: 2px; padding: 0 12px; }
.nav-label {
  padding: 18px 12px 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--side-muted);
}
.nav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: var(--radius);
  color: var(--side-text);
  font-weight: 500;
  font-size: 14.5px;
  text-decoration: none;
  transition: background-color 0.15s, color 0.15s;
}
.nav a:hover { background: rgba(255, 255, 255, 0.05); color: #fff; }
.nav a[aria-current="page"] { background: var(--side-active); color: var(--side-gold); font-weight: 600; }
.nav a[aria-current="page"]::before {
  content: "";
  position: absolute;
  left: -12px; top: 10px; bottom: 10px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--side-gold);
}
.nav-count {
  margin-left: auto;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 11px;
  background: var(--gold-grad);
  color: var(--on-gold);
  font-size: 12px;
  font-weight: 700;
  display: grid;
  place-items: center;
}
.nav-count.quiet { background: rgba(255, 255, 255, 0.1); color: var(--side-text); }

.side-foot {
  margin-top: auto;
  padding: 14px 12px;
  border-top: 1px solid var(--side-line);
  display: grid;
  gap: 8px;
}
.me { display: flex; align-items: center; gap: 10px; padding: 6px 8px; }
.me .avatar { background: rgba(226, 192, 122, 0.16); color: var(--side-gold); }
.me-name { font-size: 14px; font-weight: 600; color: #F4EEE3; line-height: 1.3; }
.me-role { font-size: 12px; color: var(--side-muted); text-transform: capitalize; }
.side-actions { display: flex; gap: 6px; }
.side-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border: 1px solid var(--side-line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--side-text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s;
}
.side-btn:hover { background: rgba(255, 255, 255, 0.06); }
.side-btn .i { width: 16px; height: 16px; }

.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--topbar-h);
  padding: 0 28px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar-brand { display: none; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.page { width: 100%; max-width: 1480px; padding: 28px 28px 56px; }
.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 20px;
  margin-bottom: 22px;
}
.page-title { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.page-sub { margin-top: 4px; color: var(--text-2); }
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}
.back-link:hover { color: var(--text); }
.back-link .i { width: 16px; height: 16px; }

/* ---------- search ---------- */
.search { position: relative; width: min(460px, 100%); }
.search .i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.search input {
  width: 100%;
  height: 40px;
  padding: 0 52px 0 40px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search input:focus-visible { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.search kbd {
  position: absolute;
  right: 10px; top: 50%;
  transform: translateY(-50%);
  padding: 2px 6px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  font: 600 11px var(--font);
  color: var(--text-3);
  background: var(--surface-2);
}
.search-pop {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  z-index: 40;
  max-height: min(70vh, 460px);
  overflow-y: auto;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-overlay);
}
.search-group { padding: 8px 10px 4px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); }
.search-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 6px 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  text-align: left;
  cursor: pointer;
}
.search-item[aria-selected="true"], .search-item:hover { background: var(--surface-3); }
.search-item small { display: block; color: var(--text-3); font-size: 12.5px; }
.search-empty { padding: 16px 12px; color: var(--text-3); font-size: 14px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s, filter 0.15s;
}
.btn .i { width: 17px; height: 17px; }
.btn-primary { background: var(--gold-grad); color: var(--on-gold); box-shadow: 0 6px 16px -10px rgba(167, 128, 47, 0.8); }
.btn-primary:hover { filter: brightness(1.06); }
.btn-secondary { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.btn-secondary:hover { background: var(--surface-3); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; }
.btn-icon { width: 40px; padding: 0; }
.btn-icon.btn-sm { width: 34px; }
.btn[disabled], .btn[aria-busy="true"] { opacity: 0.6; cursor: not-allowed; }
.btn[aria-busy="true"]::before {
  content: "";
  width: 14px; height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.link-btn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--gold);
  font-weight: 600;
  font-size: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---------- forms ---------- */
.field { display: grid; gap: 6px; align-content: start; }
.field > label, .label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field .req { color: var(--danger); }
.field-hint { font-size: 12.5px; color: var(--text-3); }
.field-error { font-size: 13px; color: var(--danger); }
.input, .select, .textarea {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 14.5px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.textarea { height: auto; min-height: 92px; padding: 10px 12px; line-height: 1.5; resize: vertical; }
.select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 34px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238C857B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
.input:hover, .select:hover, .textarea:hover { border-color: color-mix(in srgb, var(--gold) 45%, var(--border-strong)); }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-soft);
}
.input[aria-invalid="true"] { border-color: var(--danger); }
.input:disabled, .select:disabled { opacity: 0.6; cursor: not-allowed; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.span-2 { grid-column: 1 / -1; }
.check-row { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 14.5px; cursor: pointer; }
.check-row input, .check input { width: 18px; height: 18px; accent-color: #B48A3C; cursor: pointer; }
.error-banner {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 14px;
}

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px 0; }
.card-title { font-size: 15.5px; font-weight: 700; }
.card-sub { font-size: 13px; color: var(--text-3); margin-top: 2px; }
.card-body { padding: 16px 20px 20px; }
.card-link { font-size: 13.5px; font-weight: 600; color: var(--gold); text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.card-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.card-link .i { width: 15px; height: 15px; }

/* ---------- chips, tags, avatars ---------- */
.chip {
  --c: var(--text-3);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 10px 0 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--c) 15%, transparent);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); flex: none; }
.chip .i { width: 14px; height: 14px; color: var(--c); stroke-width: 2.2; }
.stage-new { --c: var(--stage-new); }
.stage-contacted { --c: var(--stage-contacted); }
.stage-site_visit { --c: var(--stage-site_visit); }
.stage-proposal { --c: var(--stage-proposal); }
.stage-negotiation { --c: var(--stage-negotiation); }
.stage-won { --c: var(--success); }
.stage-lost { --c: var(--text-3); }
.chip-gold { --c: var(--chart-bar); }
.chip-success { --c: var(--success); }
.chip-warning { --c: var(--warning); }
.chip-danger { --c: var(--danger); }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-2);
  white-space: nowrap;
}
.tag .i { width: 13px; height: 13px; }

.due { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.due .i { width: 14px; height: 14px; stroke-width: 2; }
.due-overdue { color: var(--danger); }
.due-today { color: var(--warning); }
.due-later { color: var(--text-3); }

.avatar {
  width: 28px; height: 28px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.avatar-lg { width: 44px; height: 44px; font-size: 15px; background: var(--gold-soft); color: var(--gold); }
.avatar-empty { background: transparent; border: 1.5px dashed var(--border-strong); color: var(--text-3); }

/* ---------- segmented control & toolbar ---------- */
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--radius); background: var(--surface-3); }
.seg button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}
.seg button .i { width: 16px; height: 16px; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 16px; }
.toolbar .search-field { position: relative; width: 260px; }
.toolbar .search-field .i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.toolbar .search-field .input { padding-left: 36px; }
.toolbar .select { width: auto; min-width: 150px; }
.toolbar-spacer { flex: 1; }

/* ---------- KPI tiles ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 20px; }
.kpi { padding: 18px 20px; display: grid; gap: 4px; text-decoration: none; color: inherit; }
a.kpi:hover { border-color: var(--border-strong); box-shadow: var(--shadow-card); }
.kpi-label { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; color: var(--text-2); }
.kpi-label .i { width: 16px; height: 16px; color: var(--gold); }
.kpi-value { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.25; }
.kpi-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; color: var(--text-3); }
.delta { display: inline-flex; align-items: center; gap: 2px; font-weight: 700; }
.delta .i { width: 14px; height: 14px; stroke-width: 2.2; }
.delta-good { color: var(--success); }
.delta-bad { color: var(--danger); }
.delta-flat { color: var(--text-3); }

/* ---------- dashboard ---------- */
.greet { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.dash-col { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }

.attention { display: grid; }
.att-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  padding: 10px 20px;
  border-top: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  background: none;
  border-left: 0; border-right: 0; border-bottom: 0;
  width: 100%;
  text-align: left;
}
.att-item { position: relative; }
.att-item:hover { background: var(--surface-2); }
/* Stretched button: the whole row opens the item, the call link stays separately clickable */
.att-main { display: grid; min-width: 0; padding: 0; border: 0; background: none; text-align: left; cursor: pointer; }
.att-main::after { content: ""; position: absolute; inset: 0; }
.att-main:focus-visible { outline: none; }
.att-main:focus-visible::after { outline: 2px solid var(--focus); outline-offset: -2px; border-radius: 4px; }
.att-side { position: relative; z-index: 1; }
.att-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); }
.att-icon .i { width: 17px; height: 17px; }
.att-icon.gold { background: var(--gold-soft); color: var(--gold); }
.att-icon.warn { background: var(--warning-soft); color: var(--warning); }
.att-icon.danger { background: var(--danger-soft); color: var(--danger); }
.att-title { font-weight: 600; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-sub { font-size: 13px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-side { display: flex; align-items: center; gap: 8px; }

/* bar list — single-series, value at tip, thin bars with a 4px rounded data-end */
.bars { display: grid; gap: 10px; }
.bar-row {
  position: relative;
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 30px;
  border-radius: 6px;
  outline-offset: 2px;
}
.bar-label { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 500; color: var(--text-2); min-width: 0; }
.bar-label span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.bar { height: 14px; min-width: 3px; border-radius: 0 4px 4px 0; background: var(--chart-bar); transition: width 0.4s var(--ease); }
.bar-value { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; font-variant-numeric: tabular-nums; }
.bar-value small { font-weight: 500; color: var(--text-3); margin-left: 4px; font-size: 12.5px; }
.bar-tip {
  position: absolute;
  left: 140px; bottom: calc(100% + 6px);
  z-index: 5;
  padding: 6px 10px;
  border-radius: 8px;
  background: #1B1814;
  color: #F2ECE2;
  font-size: 12.5px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.12s, transform 0.12s;
}
.bar-row:hover .bar-tip, .bar-row:focus-visible .bar-tip { opacity: 1; transform: none; }
.bar-baseline { border-left: 1px solid var(--border-strong); }

.meter { height: 6px; border-radius: 999px; background: var(--gold-soft); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 999px; background: var(--chart-bar); transition: width 0.4s var(--ease); }
.meter.success > span { background: var(--success); }

/* ---------- leads board ---------- */
.board {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  overflow-x: auto;
  padding-bottom: 14px;
  scroll-snap-type: x proximity;
}
.col {
  flex: 0 0 290px;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 230px);
  min-height: 220px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  scroll-snap-align: start;
  transition: border-color 0.15s, background-color 0.15s;
}
.col.is-over { border-color: var(--gold); background: var(--gold-soft); }
.col-head { display: flex; align-items: center; gap: 8px; padding: 14px 14px 10px; }
.col-title { font-size: 14px; font-weight: 700; }
.col-count { font-size: 13px; font-weight: 600; color: var(--text-3); }
.col-sum { margin-left: auto; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.col-hint { padding: 0 14px 8px; font-size: 12px; color: var(--text-3); }
.col-body { display: grid; align-content: start; gap: 10px; padding: 2px 10px 12px; overflow-y: auto; min-height: 90px; }
.col-empty { padding: 18px 10px; border: 1.5px dashed var(--border-strong); border-radius: 12px; text-align: center; font-size: 13px; color: var(--text-3); }

.lead-card {
  position: relative;
  display: grid;
  gap: 8px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, opacity 0.15s;
}
.lead-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-card); }
.lead-card.is-dragging { opacity: 0.45; }
.lead-card.is-urgent { border-left: 3px solid var(--warning); padding-left: 12px; }
.lc-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.lc-name { font-size: 14.5px; font-weight: 700; line-height: 1.3; }
.lc-value { font-size: 13px; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.lc-meta { font-size: 13px; color: var(--text-2); line-height: 1.4; }
.lc-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 12.5px; color: var(--text-3); }
.lc-foot .avatar { margin-left: auto; width: 24px; height: 24px; font-size: 10px; }
.src { display: inline-flex; align-items: center; gap: 4px; }
.src .i { width: 14px; height: 14px; }
.urgent-flag { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; color: var(--warning); }
.urgent-flag .i { width: 14px; height: 14px; stroke-width: 2.2; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  position: sticky;
  top: 0;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: left;
  white-space: nowrap;
}
.table th button { display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: none; font: inherit; color: inherit; letter-spacing: inherit; text-transform: inherit; cursor: pointer; }
.table th button .i { width: 13px; height: 13px; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { cursor: pointer; }
.table tbody tr:hover td { background: var(--surface-2); }
.table .num { text-align: right; }
.cell-main { font-weight: 600; }
.cell-sub { font-size: 12.5px; color: var(--text-3); }

/* ---------- dialogs: drawer & modal ---------- */
dialog { color: var(--text); }
dialog::backdrop { background: var(--backdrop); }
.drawer {
  margin: 0 0 0 auto;
  width: min(580px, 100vw);
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  padding: 0;
  border: 0;
  border-left: 1px solid var(--border);
  background: var(--bg);
  box-shadow: var(--shadow-overlay);
}
.drawer[open] { animation: drawer-in 0.24s var(--ease); }
@keyframes drawer-in { from { transform: translateX(32px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-inner { display: flex; flex-direction: column; height: 100%; }
.drawer-head { padding: 16px 20px; background: var(--surface); border-bottom: 1px solid var(--border); }
.drawer-body { flex: 1; overflow-y: auto; display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: 16px; padding: 16px 20px 40px; }
.drawer-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }

.modal {
  width: min(580px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-overlay);
}
.modal[open] { animation: modal-in 0.2s var(--ease); }
@keyframes modal-in { from { transform: translateY(10px) scale(0.98); opacity: 0; } to { transform: none; opacity: 1; } }
.modal form { display: flex; flex-direction: column; max-height: calc(100dvh - 34px); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 22px 4px; }
.modal-title { font-size: 18px; font-weight: 700; }
.modal-sub { margin-top: 2px; font-size: 13.5px; color: var(--text-3); }
.modal-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; padding: 14px 22px 18px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px 18px; border-top: 1px solid var(--border); }

/* ---------- lead detail ---------- */
.ld-head { display: flex; align-items: flex-start; gap: 14px; }
.ld-name { font-size: 20px; font-weight: 700; line-height: 1.25; }
.ld-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 4px; font-size: 13px; color: var(--text-3); }
.quick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.quick .btn { height: 42px; }
.stepper { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 2px; }
.stepper button {
  flex: 1 0 auto;
  min-width: 76px;
  height: 36px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
}
.stepper button:hover { border-color: var(--border-strong); }
.stepper button.done { background: color-mix(in srgb, var(--c) 10%, var(--surface)); color: var(--text); border-color: transparent; }
.stepper button[aria-current="step"] { border: 2px solid var(--c); background: color-mix(in srgb, var(--c) 16%, var(--surface)); color: var(--text); font-weight: 700; }
.stage-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

.kv { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 10px 14px; font-size: 14px; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.message { padding: 12px 14px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); font-size: 14px; white-space: pre-wrap; }
.quick-dates { display: flex; flex-wrap: wrap; gap: 6px; }
.quick-dates button { height: 30px; padding: 0 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); font-size: 12.5px; font-weight: 600; color: var(--text-2); cursor: pointer; }
.quick-dates button:hover { border-color: var(--gold); color: var(--text); }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); margin-bottom: 10px; }

/* activity composer + timeline */
.composer { border: 1px solid var(--border-strong); border-radius: 12px; background: var(--surface); transition: border-color 0.15s, box-shadow 0.15s; }
.composer:focus-within { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.composer-tabs { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px 8px 0; }
.composer-tabs button { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border: 0; border-radius: 8px; background: none; color: var(--text-2); font-size: 12.5px; font-weight: 600; cursor: pointer; }
.composer-tabs button .i { width: 14px; height: 14px; }
.composer-tabs button[aria-pressed="true"] { background: var(--gold-soft); color: var(--text); }
.composer textarea { display: block; width: 100%; min-height: 70px; padding: 10px 12px; border: 0; background: transparent; resize: vertical; font-size: 14.5px; line-height: 1.5; }
.composer textarea:focus-visible { outline: none; }
.composer-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 8px 8px 12px; font-size: 12.5px; color: var(--text-3); }

.timeline { display: grid; }
.tl-item { position: relative; display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 12px; padding-bottom: 16px; }
.tl-item::before { content: ""; position: absolute; left: 15px; top: 34px; bottom: 2px; width: 2px; background: var(--border); }
.tl-item:last-child { padding-bottom: 0; }
.tl-item:last-child::before { display: none; }
.tl-icon { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-3); color: var(--text-2); }
.tl-icon .i { width: 15px; height: 15px; }
.tl-icon.gold { background: var(--gold-soft); color: var(--gold); }
.tl-icon.success { background: var(--success-soft); color: var(--success); }
.tl-text { padding-top: 5px; font-size: 14px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.tl-meta { margin-top: 2px; font-size: 12.5px; color: var(--text-3); }

/* ---------- projects ---------- */
.phase-filter { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.phase-filter button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}
.phase-filter button b { font-variant-numeric: tabular-nums; color: var(--text); }
.phase-filter button[aria-pressed="true"] { border-color: var(--gold); background: var(--gold-soft); color: var(--text); }
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 16px; }
.proj-card { display: grid; gap: 14px; padding: 18px 20px; text-decoration: none; color: inherit; transition: border-color 0.15s, box-shadow 0.15s; }
.proj-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-card); }
.proj-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.proj-name { font-size: 16px; font-weight: 700; line-height: 1.3; }
.proj-client { font-size: 13.5px; color: var(--text-3); }
.proj-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; font-size: 13px; }
.proj-stats dt { color: var(--text-3); }
.proj-stats dd { margin: 2px 0 0; font-weight: 600; }
.progress-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--text-3); margin-bottom: 6px; }

.pd-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.pd-main, .pd-side { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
.phases { display: grid; grid-template-columns: repeat(7, minmax(84px, 1fr)); overflow-x: auto; padding: 4px 4px 2px; }
.phase { position: relative; display: grid; justify-items: center; gap: 8px; padding: 0 4px; text-align: center; border: 0; background: none; cursor: pointer; }
.phase::before { content: ""; position: absolute; top: 15px; right: 50%; width: 100%; height: 2px; background: var(--border-strong); }
.phases > li:first-child .phase::before { display: none; }
.phase.done::before, .phase.current::before { background: var(--chart-bar); }
.phase-dot {
  position: relative;
  z-index: 1;
  width: 32px; height: 32px;
  display: grid;
  place-items: center;
  border: 2px solid var(--border-strong);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-3);
  font-size: 12px;
  font-weight: 700;
}
.phase-dot .i { width: 16px; height: 16px; stroke-width: 2.4; }
.phase.done .phase-dot { border-color: var(--chart-bar); background: var(--chart-bar); color: #fff; }
.phase.current .phase-dot { border-color: var(--chart-bar); color: var(--gold); box-shadow: 0 0 0 4px var(--gold-soft); }
.phase-label { font-size: 12.5px; font-weight: 600; color: var(--text-3); line-height: 1.3; }
.phase.current .phase-label, .phase.done .phase-label { color: var(--text); }

.checklist { display: grid; gap: 2px; }
.check { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 8px 10px; border-radius: var(--radius); cursor: pointer; font-size: 14.5px; }
.check:hover { background: var(--surface-2); }
/* View-only roles: progress stays fully visible, it just isn't clickable */
.phase:disabled, .check:has(input:disabled) { cursor: default; }
.check:has(input:disabled):hover { background: none; }
.check.done span { color: var(--text-3); text-decoration: line-through; text-decoration-color: var(--border-strong); }

.pay-list { display: grid; }
.pay-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); }
.pay-row:first-child { border-top: 0; }
.pay-label { font-weight: 600; font-size: 14.5px; }
.pay-meta { font-size: 12.5px; color: var(--text-3); }
.pay-amount { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.pay-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.pay-summary div { padding: 12px; border-radius: var(--radius); background: var(--surface-2); }
.pay-summary dt { font-size: 12.5px; color: var(--text-3); }
.pay-summary dd { margin: 2px 0 0; font-weight: 700; font-size: 16px; font-variant-numeric: tabular-nums; }

/* ---------- follow-ups ---------- */
.agenda { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
.agenda-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
}
.agenda-main { min-width: 0; cursor: pointer; }
.agenda-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-weight: 600; }
.agenda-sub { font-size: 13px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agenda-actions { display: flex; gap: 6px; }

/* ---------- settings ---------- */
.settings { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; max-width: 920px; }
.endpoint { display: flex; gap: 8px; align-items: center; }
.endpoint code {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  font: 500 13px ui-monospace, SFMono-Regular, Menlo, monospace;
  overflow-x: auto;
  white-space: nowrap;
}
.team-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; padding: 12px 0; border-top: 1px solid var(--border); }
.team-row:first-child { border-top: 0; }
.steps-list { display: grid; gap: 8px; padding-left: 20px; list-style: decimal; color: var(--text-2); font-size: 14px; }

/* ---------- passwords, team & roles ---------- */
.pw-input { position: relative; }
.pw-input .input { padding-right: 46px; }
.pw-toggle { position: absolute; top: 0; right: 0; width: 44px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 0 var(--radius) var(--radius) 0; background: none; color: var(--text-3); cursor: pointer; }
.pw-toggle:hover, .pw-toggle[aria-pressed="true"] { color: var(--gold); }
.pw-toggle .i { width: 18px; height: 18px; }
.team-who { flex: 1 1 160px; min-width: 0; }
.team-controls { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.team-controls .select { width: auto; min-width: 116px; height: 36px; font-size: 14px; }
.perm-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.perm-table { width: 100%; min-width: 440px; border-collapse: collapse; font-size: 14px; }
.perm-table th, .perm-table td { padding: 10px 8px; border-top: 1px solid var(--border); text-align: center; vertical-align: middle; }
.perm-table thead th { border-top: 0; font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); }
.perm-table th[scope="row"] { text-align: left; font-weight: 500; color: var(--text); line-height: 1.4; }
.perm-table .mine { background: var(--gold-soft); }
.perm-table thead th.mine { color: var(--gold); border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.perm-table .yes { width: 18px; height: 18px; color: var(--success); }
.perm-table .no { color: var(--text-3); }
.role-note { display: flex; align-items: flex-start; gap: 8px; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); color: var(--text-2); font-size: 13.5px; line-height: 1.45; }
.role-note .i { width: 16px; height: 16px; flex: none; margin-top: 2px; color: var(--gold); }

/* ---------- empty states & skeletons ---------- */
.empty { display: grid; justify-items: center; gap: 10px; padding: 40px 20px; text-align: center; color: var(--text-2); }
.empty-icon { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 16px; background: var(--gold-soft); color: var(--gold); }
.empty-icon .i { width: 24px; height: 24px; }
.empty h3 { font-size: 16px; color: var(--text); }
.empty p { max-width: 44ch; font-size: 14px; }
.empty-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 6px; }

/* ---------- toasts ---------- */
.toasts {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 200;
  display: grid;
  gap: 10px;
  width: min(380px, calc(100vw - 32px));
}
.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 12px 12px 14px;
  border-left: 3px solid #8C857B;
  border-radius: 12px;
  background: #1B1814;
  color: #F2ECE2;
  box-shadow: var(--shadow-overlay);
  font-size: 14px;
  animation: toast-in 0.2s var(--ease);
}
.toast.gold { border-left-color: #E2C07A; }
.toast.success { border-left-color: #8FD3A8; }
.toast.danger { border-left-color: #F2A08F; }
.toast-msg { flex: 1; }
.toast a, .toast button.toast-action { color: #EFD9A2; font-weight: 700; text-decoration: none; background: none; border: 0; cursor: pointer; padding: 6px; }
.toast .toast-close { display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 8px; background: none; color: #BDB3A3; cursor: pointer; }
.toast .toast-close:hover { background: rgba(255, 255, 255, 0.08); }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- auth ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
.auth-art {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 40px;
  color: #F4EEE3;
  background: #0F0D0B url("/img/auth-bg.webp") center / cover no-repeat;
  isolation: isolate;
}
.auth-art::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(10, 9, 8, 0.55), rgba(10, 9, 8, 0.88)); }
.auth-art img { width: 56px; }
.auth-quote { max-width: 30ch; font-size: 26px; font-weight: 600; line-height: 1.3; letter-spacing: -0.01em; }
.auth-quote small { display: block; margin-top: 10px; font-size: 13px; font-weight: 600; letter-spacing: 0.2em; text-transform: uppercase; color: #EFD9A2; }
.auth-panel { display: grid; place-items: center; padding: 40px 24px; background: var(--bg); }
.auth-card { width: min(400px, 100%); display: grid; gap: 18px; }
.auth-card h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.auth-card .btn { height: 46px; }

/* ---------- bottom nav (mobile) ---------- */
.bottom-nav { display: none; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .dash-grid, .pd-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 1100px) and (min-width: 768px) {
  :root { --sidebar-w: 76px; }
  .brand { justify-content: center; padding: 18px 0; }
  .brand-text, .nav-label, .nav a > span:not(.nav-count), .me-text, .side-btn span { display: none; }
  .nav { padding: 0 10px; }
  .nav a { justify-content: center; padding: 0; }
  .nav a[aria-current="page"]::before { left: -10px; }
  .nav-count { position: absolute; top: 4px; right: 4px; min-width: 18px; height: 18px; font-size: 10.5px; padding: 0 5px; }
  .me { justify-content: center; padding: 6px 0; }
  .side-actions { flex-direction: column; }
}

@media (max-width: 767px) {
  body { font-size: 15px; }
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .topbar { padding: 0 12px; gap: 8px; }
  .topbar-brand { display: flex; align-items: center; }
  .topbar-brand img { width: 34px; }
  .search { width: auto; flex: 1; }
  .search kbd { display: none; }
  .search input { padding-right: 12px; }
  .topbar-actions .btn-label { display: none; }
  .topbar-actions .btn-primary { width: 44px; padding: 0; }
  .page { padding: 18px 16px calc(96px + env(safe-area-inset-bottom)); }
  .page-title, .greet { font-size: 22px; }
  .btn { height: 44px; }
  .btn-sm { height: 38px; }
  .btn-icon { width: 44px; }
  .input, .select { height: 44px; font-size: 16px; }
  .textarea, .composer textarea { font-size: 16px; }
  .toolbar .search-field { width: 100%; }
  .toolbar .select { flex: 1 1 140px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 14px; }
  .kpi-value { font-size: 22px; }
  .col { flex-basis: 84vw; max-height: none; }
  .board { margin: 0 -16px; padding: 0 16px 14px; }
  .bar-row { grid-template-columns: 100px minmax(0, 1fr); }
  .kv { grid-template-columns: 110px minmax(0, 1fr); }
  .modal { width: 100vw; max-width: 100vw; max-height: 100dvh; height: 100dvh; margin: 0; border-radius: 0; border: 0; }
  .modal form { max-height: 100dvh; height: 100%; }
  .modal-body { flex: 1; }
  .drawer { width: 100vw; border-left: 0; }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-art { min-height: 200px; padding: 24px; }
  .auth-quote { font-size: 20px; }
  .pay-summary { grid-template-columns: minmax(0, 1fr); }
  .agenda-item { grid-template-columns: minmax(0, 1fr); gap: 10px; padding: 14px 16px; }
  .agenda-item > .avatar { display: none; }
  .att-item { padding: 10px 16px; }
  .card-head { padding: 14px 16px 0; }
  .card-body { padding: 14px 16px 16px; }

  /* tables become stacked cards */
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { padding: 12px 14px; border-bottom: 1px solid var(--border); }
  .table td { padding: 2px 0; border: 0; }
  .table .hide-sm { display: none; }
  .table .num { text-align: left; }

  .toasts { right: 16px; left: 16px; width: auto; bottom: calc(76px + env(safe-area-inset-bottom)); }

  .bottom-nav {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--side-bg);
    border-top: 1px solid var(--side-line);
  }
  .bottom-nav a {
    position: relative;
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 3px;
    min-height: 60px;
    color: var(--side-muted);
    font-size: 11px;
    font-weight: 600;
    text-decoration: none;
  }
  .bottom-nav a .i { width: 21px; height: 21px; }
  .bottom-nav a[aria-current="page"] { color: var(--side-gold); }
  .bottom-nav .nav-count { position: absolute; top: 6px; left: calc(50% + 6px); min-width: 18px; height: 18px; font-size: 10.5px; padding: 0 5px; margin: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
