/* Flowlify CRM — design system. Single file, no build step. */
:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #fbfcfd;
  --border: #e6e8ec;
  --border-strong: #d7dbe0;
  --text: #1f2430;
  --text-muted: #6b7280;
  --text-faint: #9aa1ac;
  --primary: #f4845f;        /* Flowlify coral */
  --primary-ink: #b8502e;
  --primary-soft: #fdece4;
  --green: #16a34a;
  --green-soft: #e7f6ec;
  --amber: #d97706;
  --amber-soft: #fdf0dc;
  --red: #dc2626;
  --red-soft: #fbe9e9;
  --blue: #2563eb;
  --blue-soft: #e8effc;
  --violet: #7c3aed;
  --violet-soft: #f0e9fd;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(16,24,40,.04), 0 1px 3px rgba(16,24,40,.06);
  --shadow-lg: 0 8px 28px rgba(16,24,40,.12);
  --sidebar-w: 236px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  /* Dark sidebar palette */
  --sb-bg: #1b1e28;
  --sb-border: rgba(255,255,255,.07);
  --sb-text: #c3c9d5;
  --sb-muted: #767e90;
  --sb-hover: rgba(255,255,255,.05);
  --sb-active-bg: rgba(244,132,95,.15);
  --sb-active-text: #f7a181;
}

/* ============================================================
   Theme: Dark
   Dark surfaces/borders, light text, same coral primary accent.
   ============================================================ */
:root[data-theme="dark"] {
  --bg: #10131a;
  --surface: #181c25;
  --surface-2: #1f2430;
  --border: #2b3140;
  --border-strong: #3b4353;
  --text: #e7e9ee;
  --text-muted: #9aa3b2;
  --text-faint: #6b7280;
  --primary: #f4845f;
  --primary-ink: #ffb99b;
  --primary-soft: rgba(244,132,95,.18);
  --green: #34d399;
  --green-soft: rgba(52,211,153,.15);
  --amber: #fbbf24;
  --amber-soft: rgba(251,191,36,.15);
  --red: #f87171;
  --red-soft: rgba(248,113,113,.16);
  --blue: #60a5fa;
  --blue-soft: rgba(96,165,250,.15);
  --violet: #a78bfa;
  --violet-soft: rgba(167,139,250,.16);
  --shadow: 0 1px 2px rgba(0,0,0,.5), 0 1px 3px rgba(0,0,0,.55);
  --shadow-lg: 0 8px 28px rgba(0,0,0,.55);
  --sb-bg: #0d0f15;
  --sb-border: rgba(255,255,255,.06);
  --sb-text: #c3c9d5;
  --sb-muted: #767e90;
  --sb-hover: rgba(255,255,255,.06);
  --sb-active-bg: rgba(244,132,95,.18);
  --sb-active-text: #f7a181;
}
:root[data-theme="dark"] .auth-wrap { background: var(--bg); }

/* ============================================================
   Theme: Ronaldo — Portugal colours, floodlights and a celebratory pitch.
   ============================================================ */
:root[data-theme="ronaldo"] {
  --bg: #082b1a;
  --surface: rgba(255, 254, 246, .93);   /* frosted-but-solid: photo stays visible around panels, text stays crisp on them */
  --surface-2: rgba(255, 250, 231, .88);
  --border: rgba(255, 226, 136, .62);
  --border-strong: #c99b25;
  --text: #1a2e1f;
  --text-muted: #5b6b5e;
  --text-faint: #8a9689;
  --primary: #c8102e;
  --primary-ink: #8c0a1f;
  --primary-soft: rgba(200,16,46,.14);
  --green: #0b6e2f;
  --green-soft: #dff3e3;
  --amber: #b8860b;
  --amber-soft: #fbf1d3;
  --red: #c8102e;
  --red-soft: #fbe1e5;
  --blue: #1d6fa6;
  --blue-soft: #e2f0f8;
  --violet: #7c3aed;
  --violet-soft: #f0e9fd;
  --shadow: 0 6px 20px rgba(0, 19, 8, .28);
  --shadow-lg: 0 14px 38px rgba(0, 19, 8, .42);
  --sb-bg: rgba(4, 43, 23, .58);
  --sb-border: rgba(212,175,55,.30);
  --sb-text: #d9f2df;
  --sb-muted: #8fbf9c;
  --sb-hover: rgba(212,175,55,.12);
  --sb-active-bg: rgba(212,175,55,.22);
  --sb-active-text: #ffd76b;
}
:root[data-theme="ronaldo"] .auth-wrap { background: transparent; }
:root[data-theme="ronaldo"] h1, :root[data-theme="ronaldo"] h2,
:root[data-theme="ronaldo"] h3, :root[data-theme="ronaldo"] h4 {
  font-weight: 800; letter-spacing: -.01em;
}

/* ---- Ronaldo · background photo + cinematic depth overlay ----
   The photo (background-image) is set inline in base.html so manifest static
   storage can fingerprint it. Here we frame it and lay a gradient scrim on top
   that darkens the edges (behind the sidebar/topbar and toward the corners) for
   readability while leaving the centre — Ronaldo — bright and unobstructed. */
.theme-photo { display: none; }
:root[data-theme="ronaldo"] .theme-photo {
  display: block; position: fixed; inset: 0;
  background-size: cover; background-position: center; background-attachment: fixed;
  z-index: 1; pointer-events: none;
}
:root[data-theme="ronaldo"] .theme-photo::after {
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(90deg, rgba(2,18,10,.60) 0%, rgba(2,18,10,.18) 30%, rgba(2,18,10,.04) 58%, rgba(2,18,10,.30) 100%),
    linear-gradient(180deg, rgba(2,18,10,.46) 0%, rgba(2,18,10,0) 22%, rgba(2,18,10,0) 68%, rgba(2,18,10,.52) 100%);
}
/* SVG stadium is a local fallback that shows only if the photo fails to load. */
.theme-canvas { display: none; }
:root[data-theme="ronaldo"] .theme-canvas--ronaldo {
  display: block; position: fixed; inset: 0; width: 100%; height: 100%;
  z-index: 0; pointer-events: none;
}
:root[data-theme="ronaldo"] .app,
:root[data-theme="ronaldo"] .auth-wrap {
  position: relative; z-index: 2;
}
:root[data-theme="ronaldo"] .sidebar { z-index: 3; }

/* ---- Ronaldo · topbar (translucent glass, gold-red-green hairline) ---- */
:root[data-theme="ronaldo"] .topbar {
  background: linear-gradient(180deg, rgba(6,38,20,.74), rgba(4,28,15,.52));
  color: #fff;
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  border-bottom: 2px solid transparent;
  border-image: linear-gradient(90deg, #c8102e, #ffd76b, #0b6e2f) 1;
}
:root[data-theme="ronaldo"] .topbar h1,
:root[data-theme="ronaldo"] .topbar .head-ico { color: #fff; }
:root[data-theme="ronaldo"] .sidebar,
:root[data-theme="ronaldo"] .topbar { text-shadow: 0 1px 2px rgba(0, 0, 0, .6); }

/* The fix: topbar controls (notification bell, theme picker, page actions and
   the mobile menu) become distinct gold-rimmed glass chips with white icons, so
   they can never wash out against the photo. */
:root[data-theme="ronaldo"] .topbar .btn--ghost,
:root[data-theme="ronaldo"] .menu-btn {
  color: #fff;
  background: rgba(4,32,18,.58);
  border: 1px solid rgba(212,175,55,.55);
  box-shadow: 0 2px 10px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.10);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
:root[data-theme="ronaldo"] .topbar .btn--ghost svg.ico,
:root[data-theme="ronaldo"] .menu-btn svg.ico { opacity: 1; }
:root[data-theme="ronaldo"] .topbar .btn--ghost:hover,
:root[data-theme="ronaldo"] .menu-btn:hover {
  background: linear-gradient(135deg, rgba(200,16,46,.66), rgba(140,10,31,.66));
  border-color: #ffd76b; color: #fff;
}

/* ---- Ronaldo · sidebar (glass so the photo shows on the left) ---- */
:root[data-theme="ronaldo"] .sidebar {
  background: linear-gradient(180deg, rgba(5,40,21,.60), rgba(3,22,12,.52));
  backdrop-filter: blur(14px) saturate(1.12);
  -webkit-backdrop-filter: blur(14px) saturate(1.12);
}
:root[data-theme="ronaldo"] .sidebar__brand { color: #ffe9a8; }
:root[data-theme="ronaldo"] .nav__section { color: #bcdcc4; }
:root[data-theme="ronaldo"] .nav a { color: #eafaee; }
:root[data-theme="ronaldo"] .nav a svg.ico { opacity: 1; }
:root[data-theme="ronaldo"] .nav a:hover { background: rgba(212,175,55,.16); color: #fff; }
:root[data-theme="ronaldo"] .nav a.active {
  background: linear-gradient(90deg, rgba(212,175,55,.32), rgba(212,175,55,.08));
  color: #ffe9a8; box-shadow: inset 3px 0 0 #ffd76b;
}
:root[data-theme="ronaldo"] .nav a.active svg.ico { color: #ffd76b; }
:root[data-theme="ronaldo"] .sidebar__user .name { color: #fff; }
:root[data-theme="ronaldo"] .sidebar__user .role { color: #a9cdb0; }
:root[data-theme="ronaldo"] .sidebar__user .btn--ghost {
  color: #eafaee; background: rgba(4,32,18,.5); border: 1px solid rgba(212,175,55,.45);
}
:root[data-theme="ronaldo"] .sidebar__user .btn--ghost:hover {
  color: #fff; background: rgba(200,16,46,.6); border-color: #ffd76b;
}

/* ---- Ronaldo · brand mark + easter egg ---- */
:root[data-theme="ronaldo"] .sidebar__brand .dot {
  background: linear-gradient(135deg, #0b6e2f 50%, #c8102e 50%);
  position: relative;
}
/* Small, non-intrusive football watermark low in the sidebar. */
:root[data-theme="ronaldo"] .sidebar::before {
  content: "⚽";
  position: absolute; right: 6px; bottom: 64px; font-size: 56px;
  opacity: .09; transform: rotate(-12deg); pointer-events: none;
}
/* Easter egg: hover the little logo square for a celebration. */
:root[data-theme="ronaldo"] .sidebar__brand .dot::after {
  content: "SIUUU! 🐐";
  position: absolute; left: 50%; top: 130%; white-space: nowrap;
  transform: translateX(-50%) translateY(-4px) scale(.9);
  background: #ffd76b; color: #1a2e1f; font-size: 11px; font-weight: 800;
  padding: 4px 9px; border-radius: 999px; box-shadow: 0 4px 12px rgba(0,0,0,.3);
  opacity: 0; pointer-events: none; transition: opacity .18s ease, transform .18s ease;
  z-index: 50;
}
:root[data-theme="ronaldo"] .sidebar__brand:hover .dot::after {
  opacity: 1; transform: translateX(-50%) translateY(0) scale(1);
}

/* ---- Ronaldo · frosted cards + Portugal-red primary buttons ---- */
:root[data-theme="ronaldo"] .card, :root[data-theme="ronaldo"] .tile, :root[data-theme="ronaldo"] .kpi,
:root[data-theme="ronaldo"] .table-wrap, :root[data-theme="ronaldo"] .tl-item, :root[data-theme="ronaldo"] .contact,
:root[data-theme="ronaldo"] .auth-card, :root[data-theme="ronaldo"] .dropdown__menu {
  backdrop-filter: blur(15px) saturate(1.1);
  -webkit-backdrop-filter: blur(15px) saturate(1.1);
}
:root[data-theme="ronaldo"] .btn--primary {
  background: linear-gradient(135deg, #d4123a, #8c0a1f);
  border-color: #8c0a1f;
}
:root[data-theme="ronaldo"] .btn--primary:hover {
  background: linear-gradient(135deg, #e0193f, #a10c24);
}
/* Inputs, selects, secondary buttons and pills get the same frosted glass so
   they stay readable while the (now translucent) surfaces let the photo show. */
:root[data-theme="ronaldo"] input, :root[data-theme="ronaldo"] select,
:root[data-theme="ronaldo"] textarea, :root[data-theme="ronaldo"] .btn,
:root[data-theme="ronaldo"] .pill, :root[data-theme="ronaldo"] .quick-links a,
:root[data-theme="ronaldo"] .funnel-chip {
  backdrop-filter: blur(9px) saturate(1.06);
  -webkit-backdrop-filter: blur(9px) saturate(1.06);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1,h2,h3,h4 { margin: 0; font-weight: 650; }

/* ---- Icons (inline SVG sprite, see base.html) ---- */
svg.ico { width: 16px; height: 16px; flex: 0 0 auto; vertical-align: -3px; }
.head-ico { color: var(--text-muted); }

/* ---- App shell ---- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--sb-bg);
  border-right: 1px solid var(--sb-border);
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
}
.sidebar__brand {
  display: flex; align-items: center; gap: 9px;
  padding: 16px 18px; font-weight: 750; font-size: 16px;
  border-bottom: 1px solid var(--sb-border); color: #fff;
}
.sidebar__brand .dot { width: 20px; height: 20px; border-radius: 6px; background: var(--primary); display:inline-block; }
.nav { padding: 10px; overflow-y: auto; flex: 1; }
.nav__section { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--sb-muted); padding: 14px 10px 6px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--sb-text); font-weight: 500; margin-bottom: 1px;
  transition: background .12s, color .12s;
}
.nav a:hover { background: var(--sb-hover); color: #fff; text-decoration: none; }
.nav a.active { background: var(--sb-active-bg); color: var(--sb-active-text); font-weight: 600; }
.nav a svg.ico { width: 17px; height: 17px; opacity: .85; }
.nav a .badge-count {
  margin-left: auto; background: rgba(255,255,255,.1); color: var(--sb-text);
  border-radius: 999px; font-size: 11px; padding: 1px 7px; font-weight: 600;
}
.nav a.active .badge-count { background: var(--primary); color: #fff; }
.nav a.nav-sub { padding-left: 30px; font-size: 12.5px; opacity: .92; }
.nav a.nav-sub svg.ico { width: 14px; height: 14px; }
/* Collapsible nav group (Lists → Follow-up / Reassigned / Demo) */
.nav-group { margin-bottom: 1px; }
.nav-group > summary {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--sb-text); font-weight: 500; cursor: pointer;
  list-style: none; user-select: none;
  transition: background .12s, color .12s;
}
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-group > summary:hover { background: var(--sb-hover); color: #fff; }
.nav-group > summary:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.nav-group > summary svg.ico { width: 17px; height: 17px; opacity: .85; }
.nav-group > summary .nav-caret {
  margin-left: auto; width: 14px; height: 14px; opacity: .7;
  transition: transform .18s ease;
}
.nav-group[open] > summary .nav-caret { transform: rotate(90deg); }
.nav-group[open] > summary { color: #fff; }
.nav-group__items { margin-top: 1px; }
.sidebar__user { border-top: 1px solid var(--sb-border); padding: 12px; display: flex; align-items: center; gap: 10px; }
.sidebar__user .name { font-weight: 600; font-size: 13px; color: #fff; }
.sidebar__user .role { font-size: 11px; color: var(--sb-muted); }
.sidebar__user form { margin-left: auto; }
.sidebar__user .btn--ghost { color: var(--sb-muted); }
.sidebar__user .btn--ghost:hover { color: #fff; background: var(--sb-hover); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 24px; background: var(--surface);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 18px; }
.topbar .spacer { flex: 1; }
.content { padding: 22px 24px; }

/* ---- Avatars ---- */
.avatar {
  width: 28px; height: 28px; border-radius: 999px; flex: 0 0 28px;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 11px; font-weight: 700; background: var(--violet);
}
.avatar.sm { width: 22px; height: 22px; flex-basis: 22px; font-size: 10px; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 13px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text); font-weight: 600; font-size: 13px; cursor: pointer;
  font-family: inherit; line-height: 1;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn--primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn--primary:hover { background: #ef7146; }
.btn--green { background: var(--green); border-color: var(--green); color: #fff; }
.btn--danger { color: var(--red); border-color: var(--red-soft); }
.btn--ghost { border-color: transparent; background: transparent; }
.btn.sm { padding: 4px 9px; font-size: 12px; }

/* ---- Badges / pills ---- */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--surface-2); border: 1px solid var(--border);
}
.pill .dot { width: 7px; height: 7px; border-radius: 999px; background: currentColor; }
.pill--green  { color: var(--green);  background: var(--green-soft);  border-color: transparent; }
.pill--amber  { color: var(--amber);  background: var(--amber-soft);  border-color: transparent; }
.pill--red    { color: var(--red);    background: var(--red-soft);    border-color: transparent; }
.pill--blue   { color: var(--blue);   background: var(--blue-soft);   border-color: transparent; }
.pill--violet { color: var(--violet); background: var(--violet-soft); border-color: transparent; }
.pill--grey   { color: var(--text-muted); }

/* ---- Cards ---- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card__head { padding: 13px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.card__head h3 { font-size: 14px; }
.card__body { padding: 16px; }

/* ---- Tables ---- */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: auto; box-shadow: var(--shadow); }
table.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
table.grid th, table.grid td { padding: 10px 14px; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--border); }
table.grid thead th { background: var(--surface-2); color: var(--text-muted); font-weight: 600; font-size: 12px; position: sticky; top: 0; }
table.grid tbody tr:hover { background: var(--surface-2); }
table.grid td .lead-name { font-weight: 600; color: var(--text); }
table.grid td .sub { color: var(--text-faint); font-size: 12px; }
.row-flex { display: flex; align-items: center; gap: 8px; }

/* ---- Metric tiles ---- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.tile .label { font-size: 12px; color: var(--text-muted); }
.tile .value { font-size: 26px; font-weight: 700; margin-top: 4px; }
.tile .value.green { color: var(--green); }
.tile .sub { font-size: 11px; color: var(--text-faint); margin-top: 2px; }

/* ---- Forms ---- */
label { font-size: 12px; font-weight: 600; color: var(--text-muted); display: block; margin-bottom: 4px; }
input, select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); font-family: inherit; font-size: 13px; background: var(--surface); color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.field { margin-bottom: 14px; }
.form-row { display: flex; gap: 12px; } .form-row > * { flex: 1; }
select.inline-select { width: auto; padding: 4px 26px 4px 10px; font-weight: 600; }

/* ---- Toolbar / filters ---- */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar input[type=search] { width: 260px; }
.toolbar .spacer { flex: 1; }

/* ---- Lead detail 3-col ---- */
.detail { display: grid; grid-template-columns: 300px 1fr 320px; gap: 16px; align-items: start; }
@media (max-width: 1200px) { .detail { grid-template-columns: 1fr; } }
.kv { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--border); font-size: 13px; }
.kv:last-child { border-bottom: 0; }
.kv .k { color: var(--text-muted); }
.quick-links { display: flex; flex-wrap: wrap; gap: 6px; }
.quick-links a { font-size: 12px; padding: 4px 9px; border: 1px solid var(--border); border-radius: 999px; color: var(--text); }

/* ---- Timeline ---- */
.timeline { display: flex; flex-direction: column; gap: 10px; }
.tl-item { border: 1px solid var(--border); border-radius: var(--radius); padding: 11px 14px; background: var(--surface); }
.tl-item .tl-head { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-muted); margin-bottom: 5px; }
.tl-item .tl-type { font-weight: 700; color: var(--text); }
.tl-item .tl-body { font-size: 13px; white-space: pre-wrap; }

/* ---- Contacts / suggestions ---- */
.contact { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 8px; }
.contact .cname { font-weight: 650; }
.contact .crole { font-size: 11px; color: var(--text-faint); }
.contact .cline { display: flex; align-items: center; gap: 6px; font-size: 13px; margin-top: 4px; }
.suggestion { border: 1px solid var(--amber-soft); background: var(--amber-soft); border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 8px; }
.suggestion .s-actions { display: flex; gap: 6px; margin-top: 8px; }

/* ---- Login ---- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg,#fbf6f0,#f7f8fa); }
.auth-card { width: 360px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 28px; }
.auth-card .brand { display: flex; align-items: center; gap: 9px; font-weight: 750; font-size: 18px; margin-bottom: 4px; }
.auth-card .brand .dot { width: 22px; height: 22px; border-radius: 7px; background: var(--primary); }
.auth-card .sub { color: var(--text-muted); margin-bottom: 20px; font-size: 13px; }

/* ---- Misc ---- */
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.messages { margin-bottom: 14px; }
.msg { padding: 9px 13px; border-radius: var(--radius-sm); margin-bottom: 8px; font-size: 13px; }
.msg.success { background: var(--green-soft); color: var(--green); }
.msg.error { background: var(--red-soft); color: var(--red); }
.msg.info { background: var(--blue-soft); color: var(--blue); }
.empty { text-align: center; color: var(--text-faint); padding: 40px; }
.section-title { font-size: 13px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; margin: 4px 0 10px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.hstack { display: flex; align-items: center; gap: 8px; }
.dropdown { position: relative; display: inline-block; }
.dropdown__menu { position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; min-width: 200px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px; display: none; }
.dropdown.open .dropdown__menu { display: block; }
.dropdown__menu button, .dropdown__menu a { display: block; width: 100%; text-align: left; padding: 7px 10px; border: 0; background: transparent; border-radius: var(--radius-sm); cursor: pointer; font-size: 13px; color: var(--text); }
.dropdown__menu button:hover, .dropdown__menu a:hover { background: var(--surface-2); text-decoration: none; }
.dropdown__menu--right { left: auto; right: 0; }

/* ---- Theme picker ---- */
.theme-picker .dropdown__menu { min-width: 150px; }
.theme-option { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 500; }
.theme-option.is-active { font-weight: 700; color: var(--primary-ink); background: var(--primary-soft); }
.theme-option.is-active::after { content: "✓"; color: var(--primary); font-weight: 700; }
.htmx-indicator { opacity: 0; transition: opacity .2s; }
.htmx-request .htmx-indicator, .htmx-indicator.htmx-request { opacity: 1; }

/* ---- Interaction polish ---- */
.btn { transition: background .12s, border-color .12s, box-shadow .12s, transform .06s; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, a:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
table.grid tbody tr { transition: background .1s; }

/* ---- Dashboard ---- */
.greeting { margin-bottom: 18px; }
.greeting h2 { font-size: 20px; margin-bottom: 2px; }
.kpis {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px; margin-bottom: 18px;
}
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow);
  transition: transform .12s, box-shadow .12s;
}
.kpi:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.kpi__label { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; color: var(--text-muted); }
.kpi__label svg.ico { width: 14px; height: 14px; }
.kpi__value { font-size: 26px; font-weight: 750; margin-top: 6px; letter-spacing: -.01em; }
.kpi__sub { font-size: 11px; color: var(--text-faint); margin-top: 2px; }
.kpi--money .kpi__value { color: var(--green); }

.funnel-bar {
  display: flex; gap: 2px; height: 10px; border-radius: 999px; overflow: hidden;
  margin-bottom: 12px; background: var(--surface-2);
}
.funnel-seg { min-width: 6px; transition: flex .3s; }
.funnel-legend { display: flex; flex-wrap: wrap; gap: 8px; }
.funnel-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px;
  font-size: 12px; color: var(--text); transition: border-color .12s, background .12s;
}
.funnel-chip:hover { border-color: var(--primary); background: var(--primary-soft); text-decoration: none; }
.funnel-chip .dot { width: 8px; height: 8px; border-radius: 999px; }
.funnel-chip b { font-weight: 700; }

.dash-cols { display: grid; grid-template-columns: 1.25fr .85fr; gap: 16px; align-items: start; }
@media (max-width: 1100px) { .dash-cols { grid-template-columns: 1fr; } }

.workrow {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: var(--radius-sm);
  transition: background .1s;
}
.workrow:hover { background: var(--surface-2); }
.workrow--overdue { background: var(--red-soft); }
.workrow--overdue:hover { background: var(--red-soft); }
.workrow__ico { color: var(--text-muted); display: inline-flex; }
.workrow--overdue .workrow__ico { color: var(--red); }
.workrow__main { flex: 1; min-width: 0; }
.workrow__title { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.workrow__sub { font-size: 12px; color: var(--text-muted); }

.suggest-cta { display: block; border-color: var(--amber); background: var(--amber-soft); color: var(--text); }
.suggest-cta:hover { text-decoration: none; box-shadow: var(--shadow-lg); }
.suggest-cta svg.ico { color: var(--amber); }

/* ---- Click-to-dial ---- */
.tel { display: inline-flex; align-items: center; gap: 5px; color: var(--text); font-weight: 500; white-space: nowrap; }
.tel:hover { color: var(--primary-ink); text-decoration: none; }
.tel svg.ico { color: var(--text-faint); }
.tel:hover svg.ico { color: var(--primary); }

/* ---- Spinner ---- */
.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--border-strong); border-top-color: var(--primary);
  animation: spin .7s linear infinite; flex: 0 0 auto; display: inline-block;
}
.spinner--xs { width: 10px; height: 10px; border-width: 2px; border-color: currentColor; border-top-color: transparent; opacity: .7; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Rate bars (reports) ---- */
.rate { display: flex; align-items: center; gap: 8px; min-width: 110px; }
.rate__track { flex: 1; height: 5px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; }
.rate__fill { height: 100%; border-radius: 999px; background: var(--primary); transition: width .3s; }
.rate__fill--green { background: var(--green); }
.rate__fill--blue { background: var(--blue); }

/* ---- Responsive / mobile ---- */
.menu-btn { display: none; }
.backdrop { display: none; }
@media (max-width: 900px) {
  .menu-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm); background: var(--surface); cursor: pointer;
  }
  .sidebar {
    position: fixed; left: calc(-1 * var(--sidebar-w) - 12px); top: 0; bottom: 0;
    height: 100dvh; z-index: 60; transition: left .2s ease;
    box-shadow: none;
  }
  .app.nav-open .sidebar { left: 0; box-shadow: var(--shadow-lg); }
  .app.nav-open .backdrop {
    display: block; position: fixed; inset: 0; z-index: 55;
    background: rgba(16,24,40,.45);
  }
  .content { padding: 14px; }
  .topbar { padding: 10px 14px; }
  .detail { grid-template-columns: 1fr; }
  .form-row { flex-direction: column; }
  .toolbar input[type=search] { width: 100%; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
}
