/* ============================================================
   Keysmith — Design System
   "Every deal, in order."
   ============================================================ */

:root {
  /* Brand palette */
  --navy: #0E2A47;
  --navy-700: #163655;
  --navy-600: #1E4368;
  --navy-300: #5C7894;
  --gold: #C9A227;
  --gold-soft: #E4C766;
  --gold-tint: #FBF4DC;
  --soft-white: #FAFAF8;
  --light-grey: #F0F1F3;
  --charcoal: #1F2933;
  --charcoal-600: #52606D;
  --charcoal-400: #9AA5B1;
  --line: #E4E7EB;
  --line-soft: #EEF0F2;

  /* Status (muted) */
  --green: #2F8F5B;
  --green-tint: #E7F3EC;
  --amber: #C9831F;
  --amber-tint: #FBF0DC;
  --red: #C0492F;
  --red-tint: #F8E7E2;
  --blue: #2C6E8F;
  --blue-tint: #E4EEF3;
  --violet: #6B5BA8;
  --violet-tint: #ECE9F5;

  /* Elevation */
  --shadow-sm: 0 1px 2px rgba(14,42,71,.06), 0 1px 3px rgba(14,42,71,.05);
  --shadow-md: 0 2px 6px rgba(14,42,71,.07), 0 6px 18px rgba(14,42,71,.07);
  --shadow-lg: 0 8px 24px rgba(14,42,71,.10), 0 24px 56px rgba(14,42,71,.12);
  --shadow-nav: 0 1px 0 rgba(255,255,255,.04) inset;

  /* Radius */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;

  /* Type */
  --font-head: 'Poppins', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;

  /* Layout */
  --nav-w: 244px;
  --nav-w-collapsed: 76px;
  --topbar-h: 64px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-body);
  color: var(--charcoal);
  background: var(--light-grey);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5 { font-family: var(--font-head); margin: 0; font-weight: 600; letter-spacing: -0.01em; }
button { font-family: var(--font-body); cursor: pointer; }
input, textarea, select { font-family: var(--font-body); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #d2d7dd; border-radius: 20px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #b9c0c8; background-clip: content-box; }

/* ---------- App shell ---------- */
#root { height: 100vh; overflow: hidden; }

.app {
  display: grid;
  grid-template-columns: var(--nav-w) 1fr;
  height: 100vh;
  background: var(--light-grey);
  transition: grid-template-columns .22s cubic-bezier(.4,0,.2,1);
}
.app.nav-collapsed { grid-template-columns: var(--nav-w-collapsed) 1fr; }

.main-col { display: flex; flex-direction: column; min-width: 0; height: 100vh; }
.content { flex: 1; overflow-y: auto; overflow-x: hidden; scroll-behavior: smooth; }
.content-pad { padding: 28px 32px 80px; max-width: 1320px; margin: 0 auto; }

/* ---------- Side nav ---------- */
.sidenav {
  background: var(--navy);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  gap: 4px;
  position: relative;
  overflow: hidden;
}
.sidenav .brand {
  display: flex; align-items: center; gap: 11px;
  padding: 8px 8px 18px;
  min-height: 46px;
}
.brand-key {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(150deg, var(--gold) 0%, var(--gold-soft) 100%);
  display: grid; place-items: center; flex: 0 0 auto;
  box-shadow: 0 2px 8px rgba(201,162,39,.4);
}
.brand-word { font-family: var(--font-head); font-weight: 600; font-size: 19px; letter-spacing: -0.02em; white-space: nowrap; }
.brand-word b { color: #fff; }

.nav-section-label { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--navy-300); padding: 14px 12px 6px; font-weight: 600; }

.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 10px;
  color: #C6D2E0; font-size: 14.5px; font-weight: 500;
  border: none; background: transparent; width: 100%; text-align: left;
  transition: background .14s, color .14s;
  white-space: nowrap; position: relative;
}
.nav-item svg { flex: 0 0 auto; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: rgba(201,162,39,.14); color: #fff; }
.nav-item.active::before {
  content: ''; position: absolute; left: -14px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 22px; background: var(--gold); border-radius: 0 3px 3px 0;
}
.nav-item .nav-badge {
  margin-left: auto; background: var(--gold); color: var(--navy);
  font-size: 11px; font-weight: 700; border-radius: 20px; padding: 1px 7px; min-width: 18px; text-align: center;
}
.app.nav-collapsed .nav-label, .app.nav-collapsed .brand-word, .app.nav-collapsed .nav-section-label, .app.nav-collapsed .nav-badge { display: none; }
.app.nav-collapsed .nav-item { justify-content: center; padding: 11px; }
.app.nav-collapsed .sidenav .brand { justify-content: center; }

.nav-footer { margin-top: auto; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.08); }
.nav-collapse-btn {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px;
  color: var(--navy-300); background: transparent; border: none; width: 100%; font-size: 13px; font-weight: 500;
}
.nav-collapse-btn:hover { background: rgba(255,255,255,.06); color: #fff; }

/* ---------- Top bar ---------- */
.topbar {
  height: var(--topbar-h); flex: 0 0 auto;
  background: var(--navy);
  display: flex; align-items: center; gap: 16px;
  padding: 0 22px;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.06);
  z-index: 30;
}
.topbar-company { display: flex; align-items: center; gap: 10px; min-width: 0; }
.company-logo { width: 30px; height: 30px; border-radius: 7px; background: #fff; display: grid; place-items: center; font-family: var(--font-head); font-weight: 700; color: var(--navy); flex: 0 0 auto; font-size: 14px; }
.company-name { font-family: var(--font-head); font-weight: 600; font-size: 15px; white-space: nowrap; }
.company-name small { display: block; font-family: var(--font-body); font-weight: 400; font-size: 11px; color: var(--navy-300); letter-spacing: .02em; }

.global-search {
  flex: 1; max-width: 460px; position: relative;
  display: flex; align-items: center;
}
.global-search input {
  width: 100%; height: 38px; border-radius: 10px; border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.07); color: #fff; padding: 0 12px 0 38px; font-size: 13.5px;
  transition: background .15s, border .15s;
}
.global-search input::placeholder { color: #8ea3bb; }
.global-search input:focus { outline: none; background: rgba(255,255,255,.12); border-color: var(--gold); }
.global-search .search-icon { position: absolute; left: 12px; color: #8ea3bb; pointer-events: none; }

.topbar-spacer { flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 6px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 10px; border: none; background: transparent; color: #C6D2E0;
  display: grid; place-items: center; position: relative; transition: background .14s;
}
.icon-btn:hover { background: rgba(255,255,255,.08); color: #fff; }
.bell-badge { position: absolute; top: 7px; right: 8px; background: var(--gold); color: var(--navy); font-size: 9px; font-weight: 800; border-radius: 10px; min-width: 15px; height: 15px; display: grid; place-items: center; padding: 0 3px; border: 2px solid var(--navy); }

.user-chip { display: flex; align-items: center; gap: 9px; padding: 4px 10px 4px 4px; border-radius: 30px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.08); cursor: pointer; transition: background .14s; }
.user-chip:hover { background: rgba(255,255,255,.12); }
.user-chip .u-meta { line-height: 1.15; text-align: left; }
.user-chip .u-name { font-size: 13px; font-weight: 600; white-space: nowrap; }
.user-chip .u-role { font-size: 10.5px; color: var(--gold-soft); font-weight: 600; letter-spacing: .03em; text-transform: uppercase; }

/* ---------- Avatars ---------- */
.avatar { border-radius: 50%; display: grid; place-items: center; font-family: var(--font-head); font-weight: 600; color: #fff; flex: 0 0 auto; overflow: hidden; user-select: none; }
.avatar-stack { display: flex; }
.avatar-stack .avatar { border: 2px solid #fff; margin-left: -8px; }
.avatar-stack .avatar:first-child { margin-left: 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 10px; border: 1px solid transparent; font-weight: 600; font-size: 13.5px;
  padding: 0 16px; height: 40px; transition: all .14s; white-space: nowrap; line-height: 1;
}
.btn svg { flex: 0 0 auto; }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-700); box-shadow: var(--shadow-md); }
.btn-gold { background: var(--gold); color: var(--navy); }
.btn-gold:hover { background: #b8932180; background: var(--gold-soft); box-shadow: 0 4px 14px rgba(201,162,39,.35); }
.btn-outline { background: #fff; color: var(--charcoal); border-color: var(--line); }
.btn-outline:hover { border-color: var(--charcoal-400); background: var(--soft-white); }
.btn-ghost { background: transparent; color: var(--charcoal-600); }
.btn-ghost:hover { background: var(--light-grey); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 8px; }
.btn-lg { height: 48px; padding: 0 24px; font-size: 15px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; pointer-events: none; }

/* ---------- Cards ---------- */
.card { background: #fff; border-radius: var(--r-md); border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.card-pad { padding: 20px; }
.card-hover { transition: box-shadow .16s, transform .16s, border-color .16s; cursor: pointer; }
.card-hover:hover { box-shadow: var(--shadow-md); border-color: #d6dbe1; transform: translateY(-2px); }

.stat-card { background: #fff; border-radius: var(--r-md); border: 1px solid var(--line); box-shadow: var(--shadow-sm); padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; position: relative; overflow: hidden; }
.stat-label { font-size: 12.5px; color: var(--charcoal-600); font-weight: 500; display: flex; align-items: center; gap: 7px; }
.stat-value { font-family: var(--font-head); font-size: 30px; font-weight: 600; line-height: 1; letter-spacing: -0.02em; }
.stat-value.gold { color: var(--gold); }
.stat-sub { font-size: 12px; color: var(--charcoal-400); font-weight: 500; display: flex; align-items: center; gap: 5px; }
.stat-trend-up { color: var(--green); font-weight: 600; }
.stat-trend-down { color: var(--red); font-weight: 600; }
.stat-icon { position: absolute; top: 16px; right: 16px; color: var(--charcoal-400); opacity: .55; }

/* ---------- Chips / pills / badges ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600;
  padding: 3px 9px; border-radius: 30px; line-height: 1.4; white-space: nowrap;
}
.chip .dot { width: 6px; height: 6px; border-radius: 50%; flex: 0 0 auto; }
.chip-navy { background: var(--navy); color: #fff; }
.chip-gold { background: var(--gold-tint); color: #94701a; }
.chip-grey { background: var(--light-grey); color: var(--charcoal-600); }
.chip-green { background: var(--green-tint); color: var(--green); }
.chip-amber { background: var(--amber-tint); color: var(--amber); }
.chip-red { background: var(--red-tint); color: var(--red); }
.chip-blue { background: var(--blue-tint); color: var(--blue); }
.chip-violet { background: var(--violet-tint); color: var(--violet); }
.chip-outline { background: #fff; border: 1px solid var(--line); color: var(--charcoal-600); }

.pill-filter {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 13px;
  border-radius: 30px; border: 1px solid var(--line); background: #fff; color: var(--charcoal-600);
  font-size: 13px; font-weight: 500; transition: all .14s;
}
.pill-filter:hover { border-color: var(--charcoal-400); }
.pill-filter.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.pill-filter .pf-count { background: rgba(0,0,0,.08); border-radius: 20px; padding: 0 6px; font-size: 11px; font-weight: 700; }
.pill-filter.active .pf-count { background: rgba(255,255,255,.2); }

/* Fit score badge */
.fit-badge {
  display: inline-flex; align-items: center; gap: 4px; font-family: var(--font-head); font-weight: 700;
  font-size: 13px; color: var(--gold); background: var(--gold-tint); padding: 3px 9px 3px 7px; border-radius: 30px;
  border: 1px solid rgba(201,162,39,.3);
}
.fit-badge.lg { font-size: 17px; padding: 5px 13px 5px 10px; }
.fit-ring { --p: 87; width: 16px; height: 16px; border-radius: 50%; background: conic-gradient(var(--gold) calc(var(--p)*1%), rgba(201,162,39,.2) 0); position: relative; }
.fit-ring::after { content: ''; position: absolute; inset: 3px; background: var(--gold-tint); border-radius: 50%; }

.permit-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; color: var(--green); background: var(--green-tint); padding: 3px 8px; border-radius: 6px; }

/* Expiry timer indicator */
.expiry { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; }
.expiry .timer-dot { width: 7px; height: 7px; border-radius: 50%; }
.expiry.ok { color: var(--charcoal-400); }
.expiry.ok .timer-dot { background: var(--charcoal-400); }
.expiry.warn { color: var(--amber); }
.expiry.warn .timer-dot { background: var(--amber); animation: pulse 2s infinite; }
.expiry.danger { color: var(--red); }
.expiry.danger .timer-dot { background: var(--red); animation: pulse 1.2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

/* Phase 2 marker */
.phase2 { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--violet); background: var(--violet-tint); padding: 3px 8px; border-radius: 6px; }
.phase3 { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--charcoal-600); background: var(--light-grey); padding: 3px 8px; border-radius: 6px; }
.phase2-overlay {
  position: relative; border: 1.5px dashed #cfd4da; border-radius: var(--r-md);
  background: repeating-linear-gradient(135deg, #fff, #fff 12px, #fbfbfa 12px, #fbfbfa 24px);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 28px; text-align: center; color: var(--charcoal-400);
}

/* Photo watermark (company logo) */
.photo-watermark { position: absolute; right: 8px; bottom: 8px; display: flex; align-items: center; gap: 5px; padding: 3px 8px 3px 4px; border-radius: 20px; background: rgba(14,42,71,.28); backdrop-filter: blur(1px); pointer-events: none; }
.photo-watermark .pw-logo { width: 16px; height: 16px; border-radius: 5px; background: rgba(255,255,255,.85); color: var(--navy); display: grid; place-items: center; font-family: var(--font-head); font-weight: 700; font-size: 10px; }
.photo-watermark .pw-name { font-size: 10px; font-weight: 600; color: rgba(255,255,255,.9); letter-spacing: .02em; }

/* Score dial */
.score-dial { position: relative; border-radius: 50%; background: conic-gradient(var(--col) calc(var(--p) * 1%), var(--light-grey) 0); display: grid; place-items: center; flex: 0 0 auto; }
.score-dial .sd-inner { position: absolute; inset: 6px; background: #fff; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; }
.score-dial .sd-num { font-family: var(--font-head); font-weight: 700; color: var(--charcoal); line-height: 1; }
.score-dial .sd-label { font-size: 8px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--charcoal-400); margin-top: 1px; }

/* Sold celebration */
.sold-celebrate { position: fixed; inset: 0; z-index: 300; display: flex; align-items: flex-start; justify-content: center; pointer-events: auto; }
.sold-celebrate .sold-banner { margin-top: 86px; display: flex; align-items: center; gap: 14px; background: linear-gradient(135deg, var(--navy) 0%, var(--navy-600) 100%); border: 1px solid rgba(201,162,39,.5); box-shadow: var(--shadow-lg); border-radius: 16px; padding: 14px 16px 14px 16px; width: min(420px, 92vw); animation: soldPop .4s cubic-bezier(.34,1.56,.64,1) both; }
.sold-celebrate .sold-key { width: 46px; height: 46px; border-radius: 12px; background: linear-gradient(150deg, var(--gold) 0%, var(--gold-soft) 100%); display: grid; place-items: center; flex: 0 0 auto; box-shadow: 0 2px 10px rgba(201,162,39,.5); }
@keyframes soldPop { from { transform: translateY(-16px) scale(.94); opacity: 0; } to { transform: none; opacity: 1; } }
.confetti-layer { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.confetti-layer span { position: absolute; top: -16px; border-radius: 2px; animation-name: confettiFall; animation-timing-function: cubic-bezier(.3,.5,.6,1); animation-iteration-count: 1; animation-fill-mode: both; }
@keyframes confettiFall { 0% { transform: translateY(-20px) rotate(0deg); opacity: 1; } 100% { transform: translateY(72vh) rotate(420deg); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .confetti-layer { display: none; } .sold-celebrate .sold-banner { animation: none; } }

/* ---------- Page headers ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-title { font-size: 25px; font-weight: 600; letter-spacing: -0.02em; }
.page-sub { font-size: 13.5px; color: var(--charcoal-600); margin-top: 3px; }
.section-title { font-size: 16px; font-weight: 600; display: flex; align-items: center; gap: 9px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 12px; }

/* ---------- Tabs ---------- */
.tabs { display: inline-flex; gap: 2px; background: var(--light-grey); padding: 4px; border-radius: 11px; }
.tab { padding: 7px 15px; border-radius: 8px; border: none; background: transparent; color: var(--charcoal-600); font-size: 13.5px; font-weight: 600; transition: all .14s; white-space: nowrap; }
.tab:hover { color: var(--charcoal); }
.tab.active { background: #fff; color: var(--navy); box-shadow: var(--shadow-sm); }

.underline-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.underline-tab { padding: 11px 4px; margin: 0 12px 0 0; border: none; background: transparent; color: var(--charcoal-600); font-size: 14px; font-weight: 600; position: relative; transition: color .14s; }
.underline-tab:first-child { margin-left: 0; }
.underline-tab:hover { color: var(--charcoal); }
.underline-tab.active { color: var(--navy); }
.underline-tab.active::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2.5px; background: var(--gold); border-radius: 3px; }

/* ---------- Tables ---------- */
.tbl-wrap { background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; box-shadow: var(--shadow-sm); }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl thead th { position: sticky; top: 0; background: var(--soft-white); z-index: 2; text-align: left; font-size: 11.5px; letter-spacing: .04em; text-transform: uppercase; color: var(--charcoal-600); font-weight: 600; padding: 12px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl tbody td { padding: 13px 16px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.tbl tbody tr { transition: background .12s; cursor: pointer; }
.tbl tbody tr:hover { background: var(--soft-white); }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl .num { font-family: var(--font-head); font-weight: 600; }

/* ---------- Slide-over ---------- */
.overlay-backdrop { position: fixed; inset: 0; background: rgba(14,42,71,.42); z-index: 100; opacity: 0; animation: fadeIn .2s forwards; backdrop-filter: blur(2px); }
@keyframes fadeIn { to { opacity: 1; } }
.slideover {
  position: fixed; top: 0; right: 0; height: 100vh; width: min(680px, 94vw); background: var(--soft-white);
  z-index: 101; box-shadow: var(--shadow-lg); display: flex; flex-direction: column;
  transform: translateX(100%); animation: slideIn .26s cubic-bezier(.4,0,.2,1) forwards;
}
@keyframes slideIn { to { transform: translateX(0); } }
.slideover-head { flex: 0 0 auto; padding: 18px 24px; border-bottom: 1px solid var(--line); background: #fff; display: flex; align-items: flex-start; gap: 14px; }
.slideover-body { flex: 1; overflow-y: auto; padding: 22px 24px; }
.slideover-foot { flex: 0 0 auto; padding: 14px 24px; border-top: 1px solid var(--line); background: #fff; display: flex; gap: 10px; }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 110; display: grid; place-items: center; padding: 24px; }
.modal-card { background: var(--soft-white); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); width: 100%; max-height: 92vh; display: flex; flex-direction: column; overflow: hidden; transform: scale(.96); opacity: 0; animation: popIn .2s cubic-bezier(.4,0,.2,1) forwards; }
@keyframes popIn { to { transform: scale(1); opacity: 1; } }
.modal-head { padding: 18px 24px; border-bottom: 1px solid var(--line); background: #fff; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex: 0 0 auto; }
.modal-body { padding: 24px; overflow-y: auto; }
.modal-foot { padding: 14px 24px; border-top: 1px solid var(--line); background: #fff; display: flex; gap: 10px; justify-content: flex-end; flex: 0 0 auto; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .field-label { font-size: 12.5px; font-weight: 600; color: var(--charcoal-600); }
.field-hint { font-size: 11.5px; color: var(--charcoal-400); }
.input, .textarea, .select {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--charcoal);
  font-size: 14px; padding: 10px 12px; transition: border .14s, box-shadow .14s;
}
.input:focus, .textarea:focus, .select:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(14,42,71,.08); }
.input::placeholder, .textarea::placeholder { color: var(--charcoal-400); }
.textarea { resize: vertical; min-height: 90px; line-height: 1.55; }
.input-icon { position: relative; }
.input-icon .input { padding-left: 38px; }
.input-icon svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--charcoal-400); }
.char-counter { font-size: 11.5px; font-weight: 600; }

.toggle { width: 42px; height: 24px; border-radius: 20px; background: #cfd4da; position: relative; border: none; transition: background .18s; flex: 0 0 auto; }
.toggle::after { content: ''; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .18s; }
.toggle.on { background: var(--gold); }
.toggle.on::after { transform: translateX(18px); }

.seg { display: inline-flex; background: var(--light-grey); border-radius: 9px; padding: 3px; }
.seg button { border: none; background: transparent; padding: 6px 13px; border-radius: 7px; font-size: 13px; font-weight: 600; color: var(--charcoal-600); transition: all .14s; }
.seg button.active { background: #fff; color: var(--navy); box-shadow: var(--shadow-sm); }

/* ---------- Image placeholder ---------- */
.img-ph {
  background: repeating-linear-gradient(135deg, #eceef1, #eceef1 10px, #e4e7eb 10px, #e4e7eb 20px);
  display: grid; place-items: center; color: #8a949f; font-family: var(--font-body); font-size: 11px; font-weight: 600;
  letter-spacing: .03em; position: relative; overflow: hidden;
}
.img-ph .img-ph-tag { background: rgba(255,255,255,.82); padding: 3px 8px; border-radius: 5px; font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 10px; color: #6b757f; }

/* ---------- Misc ---------- */
.divider { height: 1px; background: var(--line); border: none; margin: 0; }
.muted { color: var(--charcoal-400); }
.row { display: flex; align-items: center; }
.gap-6 { gap: 6px; } .gap-8 { gap: 8px; } .gap-10 { gap: 10px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .gap-20 { gap: 20px; }
.grid-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

/* funnel */
.funnel { display: flex; gap: 8px; align-items: stretch; }
.funnel-stage { flex: 1; background: var(--soft-white); border: 1px solid var(--line); border-radius: 10px; padding: 13px 12px; position: relative; transition: all .15s; cursor: pointer; }
.funnel-stage:hover { border-color: var(--gold); box-shadow: var(--shadow-sm); }
.funnel-stage .fs-count { font-family: var(--font-head); font-size: 24px; font-weight: 600; line-height: 1; }
.funnel-stage .fs-label { font-size: 11.5px; color: var(--charcoal-600); margin-top: 5px; font-weight: 500; }
.funnel-bar { height: 4px; border-radius: 4px; margin-top: 9px; }

/* kanban */
.kanban { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 14px; align-items: flex-start; }
.kanban-col { flex: 0 0 290px; background: var(--light-grey); border-radius: var(--r-md); padding: 10px; max-height: calc(100vh - 280px); display: flex; flex-direction: column; }
.kanban-col-head { display: flex; align-items: center; gap: 8px; padding: 6px 8px 10px; }
.kanban-col-head .kc-title { font-size: 13px; font-weight: 600; }
.kanban-col-head .kc-count { background: #fff; color: var(--charcoal-600); border-radius: 20px; font-size: 11px; font-weight: 700; padding: 1px 8px; }
.kanban-list { display: flex; flex-direction: column; gap: 9px; overflow-y: auto; padding: 2px; }

.lead-mini { background: #fff; border-radius: 10px; border: 1px solid var(--line); padding: 12px; box-shadow: var(--shadow-sm); cursor: pointer; transition: all .15s; }
.lead-mini:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); border-color: #d6dbe1; }

/* timeline */
.timeline { display: flex; flex-direction: column; gap: 0; }
.tl-item { display: flex; gap: 12px; padding-bottom: 18px; position: relative; }
.tl-item::before { content: ''; position: absolute; left: 15px; top: 32px; bottom: 0; width: 2px; background: var(--line); }
.tl-item:last-child::before { display: none; }
.tl-avatar { flex: 0 0 auto; z-index: 1; }
.tl-body { flex: 1; }
.tl-meta { font-size: 12px; color: var(--charcoal-400); margin-top: 2px; }
.tl-text { font-size: 13.5px; line-height: 1.5; margin-top: 3px; }

/* checklist */
.check-item { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line-soft); font-size: 13.5px; }
.check-box { width: 19px; height: 19px; border-radius: 6px; border: 1.5px solid var(--charcoal-400); flex: 0 0 auto; display: grid; place-items: center; cursor: pointer; transition: all .14s; }
.check-box.done { background: var(--green); border-color: var(--green); }

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

/* responsive */
@media (max-width: 1080px) {
  .grid-stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 920px) {
  .app { grid-template-columns: 1fr !important; }
  .sidenav { display: none; }
  .content { padding-bottom: 80px; }
  .content-pad { padding: 18px 16px 90px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .topbar-company .company-name { display: none; }
  .global-search { max-width: none; }
  .bottom-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; height: 64px; background: var(--navy);
    z-index: 50; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); justify-content: space-around; align-items: center;
    box-shadow: 0 -2px 16px rgba(14,42,71,.18);
  }
  .bottom-nav-item { display: flex; flex-direction: column; align-items: center; gap: 3px; background: transparent; border: none; color: #8ea3bb; font-size: 10px; font-weight: 600; padding: 4px 6px; border-radius: 8px; flex: 1; max-width: 80px; position: relative; }
  .bottom-nav-item.active { color: var(--gold); }
  .grid-stats { grid-template-columns: repeat(2, 1fr); }
  .kanban-col { max-height: none; }
  .page-head { align-items: flex-start; }
}
@media (max-width: 560px) {
  .grid-stats { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stat-value { font-size: 25px; }
}

/* role switcher (prototype tool) */
.role-switcher { position: fixed; bottom: 18px; right: 18px; z-index: 90; display: flex; align-items: center; gap: 0; background: #fff; border: 1px solid var(--line); border-radius: 30px; box-shadow: var(--shadow-lg); padding: 5px; }
.role-switcher .rs-label { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--charcoal-400); padding: 0 10px 0 12px; }
.role-switcher button { border: none; background: transparent; padding: 7px 13px; border-radius: 22px; font-size: 12.5px; font-weight: 600; color: var(--charcoal-600); transition: all .14s; }
.role-switcher button.active { background: var(--navy); color: #fff; }
@media (max-width: 920px) { .role-switcher { bottom: 78px; right: 12px; padding: 4px; } .role-switcher .rs-label { display: none; } .role-switcher button { padding: 6px 10px; font-size: 11.5px; } }

.fade-in { animation: contentFade .3s ease both; }
@keyframes contentFade { from { transform: translateY(6px); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { .fade-in { animation: none; } }

.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 56px 24px; text-align: center; color: var(--charcoal-600); }
.empty-state .es-icon { width: 64px; height: 64px; border-radius: 18px; background: var(--gold-tint); display: grid; place-items: center; color: var(--gold); }

/* AI spinner */
.ai-spinner { width: 15px; height: 15px; border-radius: 50%; border: 2px solid rgba(201,162,39,.3); border-top-color: var(--gold); display: inline-block; animation: aiSpin .7s linear infinite; flex: 0 0 auto; }
@keyframes aiSpin { to { transform: rotate(360deg); } }
