/* ──────────────────────────────────────────────────────────────
   CPP CRM — design system v2
   App-first · mobile-first · keyboard-friendly
   Touch targets generosos (min 44px). 1 protagonista por seção.
   ────────────────────────────────────────────────────────────── */

@import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600;9..144,700&family=Geist:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;600&display=swap");

:root {
  /* Base */
  --bg:           #0a0b0e;
  --bg-2:         #11131a;
  --bg-3:         #181b25;
  --surface:      #1e2230;
  --surface-2:    #262b3b;
  --surface-3:    #313749;
  --hover:        rgba(255,255,255,0.05);

  /* Gold */
  --gold:         #c4854a;
  --gold-2:       #d99e6c;
  --gold-3:       #f2b674;
  --gold-glow:    rgba(196,133,74,0.20);
  --gold-faint:   rgba(196,133,74,0.08);

  /* Status */
  --green:        #4ade80;
  --green-deep:   #16a34a;
  --green-wa:     #25D366;
  --amber:        #fbbf24;
  --red:          #f87171;
  --red-deep:     #dc2626;
  --blue:         #60a5fa;
  --violet:       #a78bfa;

  /* Text — todos WCAG AAA */
  --fg:           #ffffff;
  --fg-2:         #d4d2cd;
  --fg-3:         #9c9892;
  --fg-faint:     #6b685f;
  --fg-on-gold:   #0a0b0e;

  /* Lines */
  --line:         rgba(255,255,255,0.08);
  --line-2:       rgba(255,255,255,0.14);
  --line-gold:    rgba(196,133,74,0.28);

  /* Spacing tokens */
  --space-1:      4px;
  --space-2:      8px;
  --space-3:      12px;
  --space-4:      16px;
  --space-5:      20px;
  --space-6:      24px;
  --space-8:      32px;
  --space-10:     40px;
  --space-12:     48px;
  --space-16:     64px;

  /* Radius */
  --r-sm:         6px;
  --r-md:         10px;
  --r-lg:         14px;
  --r-xl:         20px;
  --r-pill:       999px;

  /* Touch targets */
  --tap:          44px;
  --tap-lg:       52px;

  /* Shadows */
  --shadow-sm:    0 1px 2px rgba(0,0,0,0.4);
  --shadow:       0 4px 12px rgba(0,0,0,0.45), 0 1px 0 rgba(255,255,255,0.04) inset;
  --shadow-lg:    0 16px 48px rgba(0,0,0,0.55), 0 1px 0 rgba(255,255,255,0.05) inset;
  --shadow-modal: 0 28px 80px rgba(0,0,0,0.7);

  /* Type */
  --font-display: "Fraunces", Georgia, serif;
  --font-body:    "Geist", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono:    "JetBrains Mono", "SF Mono", Menlo, monospace;

  /* Layout */
  --sidebar-w:    260px;
  --topbar-h:     64px;
  --bottomnav-h:  68px;
}

/* ─── Reset ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; overscroll-behavior: none; }
html { color-scheme: dark; }
body {
  font-family: var(--font-body);
  font-feature-settings: "cv11","ss03","ss04";
  background: var(--bg);
  color: var(--fg);
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button { font: inherit; color: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font: inherit; color: inherit; }

::selection { background: var(--gold-glow); color: var(--fg); }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold); }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 500;
  color: var(--fg);
  letter-spacing: -0.02em;
  margin: 0;
}
h1 { font-size: clamp(28px, 4vw, 40px); line-height: 1.05; }
h2 { font-size: clamp(20px, 2.4vw, 26px); line-height: 1.2; }
h3 { font-size: 17px; font-weight: 600; }

a { color: var(--gold-3); text-decoration: none; }
a:hover { color: var(--gold-2); }

/* ═══════════════════════ APP SHELL ═══════════════════════ */

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  grid-template-areas: "sidebar topbar" "sidebar main";
  height: 100vh; height: 100dvh;
}

/* ─── Sidebar (desktop) ──────────────────────────── */
.sidebar {
  grid-area: sidebar;
  background: linear-gradient(180deg, var(--bg-2), var(--bg));
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  padding: 22px 14px 14px;
  position: relative;
}
.sidebar::after {
  content: ""; position: absolute;
  right: 0; top: 0; bottom: 0; width: 1px;
  background: linear-gradient(180deg, transparent, var(--line-gold), transparent);
}

.brand {
  display: flex; align-items: baseline; gap: 6px;
  padding: 0 12px 4px;
  font-family: var(--font-display);
  font-weight: 500;
  font-variation-settings: "opsz" 144, "SOFT" 100;
  font-size: 28px;
  color: var(--fg);
  letter-spacing: -0.03em;
}
.brand .dot {
  width: 8px; height: 8px;
  background: var(--gold-3);
  border-radius: 50%;
  margin-left: 4px;
  box-shadow: 0 0 12px var(--gold-glow);
}
.brand small {
  display: block;
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--fg-3);
  margin-top: 2px;
  padding: 0 12px;
  text-transform: uppercase;
}

.nav-section {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--fg-faint);
  padding: 22px 14px 8px;
  text-transform: uppercase;
}

.nav { display: flex; flex-direction: column; gap: 2px; }

.nav-item {
  display: flex; align-items: center; gap: 12px;
  height: 44px;
  padding: 0 14px;
  border-radius: var(--r-md);
  font-size: 14.5px;
  color: var(--fg-2);
  cursor: pointer;
  transition: all 0.15s;
  font-weight: 500;
}
.nav-item:hover { color: var(--fg); background: var(--hover); }
.nav-item.is-active {
  background: var(--surface);
  color: var(--fg);
  box-shadow: inset 3px 0 0 var(--gold-3);
}
.nav-item .ic {
  width: 18px; height: 18px;
  flex-shrink: 0;
  opacity: 0.75;
}
.nav-item.is-active .ic { opacity: 1; color: var(--gold-3); }

.sidebar-footer {
  margin-top: auto;
  padding: 14px 12px 4px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 10px;
}
.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-3), var(--gold));
  color: var(--fg-on-gold);
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
}

.kbd-hint {
  margin: 10px 12px 0;
  padding: 8px 10px;
  background: var(--bg-3);
  border-radius: var(--r-sm);
  font-size: 11px;
  color: var(--fg-3);
  display: flex; align-items: center; gap: 6px;
}
.kbd {
  display: inline-flex; align-items: center;
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 2px 6px;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: 4px;
  color: var(--fg-2);
  box-shadow: 0 1px 0 var(--line);
}

/* ─── Topbar ──────────────────────────────────────── */
.topbar {
  grid-area: topbar;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: 0 24px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.topbar-title { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.topbar-title h2 {
  font-family: var(--font-display);
  font-variation-settings: "opsz" 144;
  font-weight: 500;
  font-size: clamp(20px, 2.6vw, 26px);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.topbar-search {
  display: flex; align-items: center; gap: 8px;
  height: 40px;
  padding: 0 14px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  color: var(--fg-3);
  cursor: pointer;
  transition: all 0.15s;
  font-size: 13.5px;
}
.topbar-search:hover { border-color: var(--line-gold); background: var(--bg-3); color: var(--fg-2); }
.topbar-search .kbd { margin-left: auto; font-size: 10px; }

/* ─── Main ─────────────────────────────────────── */
.main {
  grid-area: main;
  overflow: auto;
  padding: 24px 28px 40px;
  background: var(--bg);
  scroll-behavior: smooth;
}

/* ─── Bottom Nav (mobile) ─────────────────────── */
.bottom-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  height: var(--bottomnav-h);
  background: var(--bg-2);
  border-top: 1px solid var(--line-gold);
  z-index: 50;
  padding: 6px;
  padding-bottom: calc(6px + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 24px rgba(0,0,0,0.4);
}
.bn-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  height: 100%;
  gap: 2px;
}
.bn-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px;
  color: var(--fg-3);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-radius: var(--r-md);
  transition: color 0.15s, background 0.15s;
  min-height: var(--tap);
}
.bn-item .ic { width: 22px; height: 22px; opacity: 0.8; }
.bn-item.is-active { color: var(--gold-3); background: var(--gold-faint); }
.bn-item.is-active .ic { opacity: 1; }

.bn-more-menu {
  position: fixed;
  bottom: calc(var(--bottomnav-h) + 8px + env(safe-area-inset-bottom));
  left: 12px; right: 12px;
  background: var(--bg-2);
  border: 1px solid var(--line-gold);
  border-radius: var(--r-lg);
  padding: 8px;
  z-index: 51;
  box-shadow: var(--shadow-lg);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}
.bn-more-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 12px 6px;
  border-radius: var(--r-md);
  color: var(--fg-2);
  font-size: 11px;
  font-weight: 500;
  min-height: var(--tap);
}
.bn-more-item.is-active { color: var(--gold-3); background: var(--gold-faint); }

/* ═══════════════════════ COMPONENTS ═══════════════════════ */

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap);
  padding: 0 18px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--fg);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--surface); border-color: var(--line-gold); }
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--gold-3);
  color: var(--fg-on-gold);
  border-color: var(--gold-3);
  font-weight: 600;
}
.btn-primary:hover:not(:disabled) {
  background: var(--gold-2);
  border-color: var(--gold-2);
}

.btn-ghost { background: transparent; border-color: transparent; color: var(--fg-2); }
.btn-ghost:hover:not(:disabled) { background: var(--hover); color: var(--fg); border-color: transparent; }

.btn-danger { border-color: rgba(248,113,113,0.4); color: var(--red); }
.btn-danger:hover { background: rgba(248,113,113,0.1); border-color: var(--red); }

.btn-wa { border-color: rgba(37,211,102,0.4); color: var(--green-wa); }
.btn-wa:hover { background: rgba(37,211,102,0.12); border-color: var(--green-wa); }

.btn-icon { width: var(--tap); padding: 0; }
.btn-lg { min-height: var(--tap-lg); padding: 0 24px; font-size: 15px; }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: 13px; }

/* Inputs */
.input {
  width: 100%;
  min-height: var(--tap);
  padding: 10px 14px;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  color: var(--fg);
  font-size: 14.5px;
  transition: all 0.15s;
}
.input::placeholder { color: var(--fg-faint); }
.input:focus { outline: none; border-color: var(--gold-3); background: var(--surface); }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--fg-3);
  text-transform: uppercase;
}

/* Chips/Pills */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px;
  border-radius: var(--r-pill);
  font-size: 11.5px;
  font-weight: 600;
  background: var(--bg-3);
  color: var(--fg-2);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.pill::before {
  content: "";
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--fg-3);
}
.pill.is-green  { color: var(--green); border-color: rgba(74,222,128,0.30); background: rgba(74,222,128,0.08); }
.pill.is-green::before { background: var(--green); }
.pill.is-amber  { color: var(--amber); border-color: rgba(251,191,36,0.30); background: rgba(251,191,36,0.08); }
.pill.is-amber::before { background: var(--amber); }
.pill.is-red    { color: var(--red);   border-color: rgba(248,113,113,0.30); background: rgba(248,113,113,0.08); }
.pill.is-red::before { background: var(--red); }
.pill.is-blue   { color: var(--blue);  border-color: rgba(96,165,250,0.30); background: rgba(96,165,250,0.08); }
.pill.is-blue::before { background: var(--blue); }
.pill.is-violet { color: var(--violet); border-color: rgba(167,139,250,0.30); background: rgba(167,139,250,0.08); }
.pill.is-violet::before { background: var(--violet); }
.pill.is-gold   { color: var(--gold-3); border-color: var(--line-gold); background: var(--gold-faint); }
.pill.is-gold::before { background: var(--gold-3); }

.chip {
  display: inline-flex; align-items: center; gap: 4px;
  min-height: 36px;
  padding: 0 14px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--fg-2);
  font-size: 13px;
  font-weight: 500;
}
.chip:hover { color: var(--fg); border-color: var(--line-gold); }
.chip.is-active {
  background: var(--gold-3);
  color: var(--fg-on-gold);
  border-color: var(--gold-3);
  font-weight: 600;
}

/* Segmented (iOS style) */
.seg {
  display: inline-flex;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 3px;
  gap: 2px;
}
.seg-item {
  min-height: 34px;
  padding: 0 14px;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-3);
  background: transparent;
  transition: all 0.15s;
  white-space: nowrap;
}
.seg-item.is-active { background: var(--gold-3); color: var(--fg-on-gold); font-weight: 600; }
.seg-item:not(.is-active):hover { color: var(--fg); }

/* Section title */
.section-title {
  display: flex; align-items: baseline; justify-content: space-between;
  flex-wrap: wrap; gap: 12px;
  margin: 6px 0 16px;
}
.section-title h2 {
  font-family: var(--font-display);
  font-variation-settings: "opsz" 144;
  font-weight: 500;
  font-size: clamp(20px, 2.4vw, 26px);
  letter-spacing: -0.015em;
}
.section-title .meta { font-size: 13px; color: var(--fg-3); font-family: var(--font-mono); }

/* KPI cards */
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.kpi {
  background: linear-gradient(180deg, var(--bg-2), var(--bg));
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
}
.kpi::after {
  content: ""; position: absolute;
  top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--line-gold), transparent);
}
.kpi-label {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--fg-3);
  margin: 0 0 8px;
  text-transform: uppercase;
}
.kpi-value {
  font-family: var(--font-display);
  font-variation-settings: "opsz" 144;
  font-weight: 500;
  font-size: 32px;
  line-height: 1;
  color: var(--fg);
  letter-spacing: -0.02em;
}
.kpi-value .accent {
  background: linear-gradient(135deg, var(--gold-3), var(--gold));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.kpi-trend { margin-top: 6px; font-size: 12px; color: var(--fg-3); }

/* Cards */
.card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  transition: all 0.15s;
}
.card[data-clickable], .card.clickable {
  cursor: pointer;
}
.card[data-clickable]:hover, .card.clickable:hover {
  background: var(--surface);
  border-color: var(--line-gold);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.card-name {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 16px;
  color: var(--fg);
  margin: 0 0 4px;
  line-height: 1.25;
  letter-spacing: -0.01em;
}
.card-meta { font-size: 12.5px; color: var(--fg-3); margin: 0 0 8px; font-family: var(--font-mono); }
.card-acao {
  font-size: 13px;
  color: var(--fg-2);
  line-height: 1.45;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-acao::before { content: "→ "; color: var(--gold-3); }

/* Kanban */
.kanban {
  display: grid;
  grid-template-columns: repeat(5, minmax(260px, 1fr));
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 12px;
}
.col {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 14px;
  min-height: 320px;
}
.col-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.col-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.04em;
  color: var(--gold-3);
  text-transform: uppercase;
}
.col-count {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--fg-3);
  background: var(--bg-3);
  padding: 3px 9px;
  border-radius: var(--r-pill);
}

/* Table */
.table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--bg-2);
}
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  background: var(--bg-3);
  color: var(--fg-3);
  text-align: left;
  padding: 12px 16px;
  font-weight: 600;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--fg-2);
}
.table tr:last-child td { border-bottom: none; }
.table tbody tr { cursor: pointer; transition: background 0.12s; }
.table tbody tr:hover { background: var(--hover); }
.table tbody tr:hover td:first-child { color: var(--fg); }
.table .name { font-family: var(--font-display); font-weight: 500; font-size: 14.5px; color: var(--fg); }

/* Drawer / Sheet */
.drawer-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.62);
  backdrop-filter: blur(6px);
  z-index: 100;
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s;
}
.drawer-overlay.is-open { opacity: 1; pointer-events: all; }

.drawer {
  position: fixed; right: 0; top: 0; bottom: 0;
  width: min(680px, 95vw);
  background: var(--bg-2);
  border-left: 1px solid var(--line-gold);
  box-shadow: var(--shadow-modal);
  z-index: 101;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
  display: flex; flex-direction: column;
}
.drawer.is-open { transform: translateX(0); }

.drawer-head {
  padding: 22px 28px 18px;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
}
.drawer-head h2 {
  font-family: var(--font-display);
  font-variation-settings: "opsz" 144;
  font-weight: 500;
  font-size: clamp(22px, 3vw, 28px);
  letter-spacing: -0.02em;
}
.drawer-head .sub { margin-top: 4px; font-size: 13px; color: var(--fg-3); }
.drawer-close {
  width: var(--tap); height: var(--tap);
  display: grid; place-items: center;
  border-radius: var(--r-md);
  background: var(--bg-3);
  border: 1px solid var(--line);
  color: var(--fg-2);
}
.drawer-close:hover { background: var(--surface); color: var(--fg); }

.drawer-tabs {
  display: flex; gap: 0;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.drawer-tab {
  padding: 14px 16px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--fg-3);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  min-height: var(--tap);
  display: inline-flex; align-items: center;
}
.drawer-tab:hover { color: var(--fg-2); }
.drawer-tab.is-active { color: var(--gold-3); border-bottom-color: var(--gold-3); }

.drawer-body { padding: 22px 28px; overflow: auto; flex: 1; -webkit-overflow-scrolling: touch; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 22px;
}
.stat {
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 12px 14px;
}
.stat-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--fg-3);
  margin-bottom: 4px;
  text-transform: uppercase;
}
.stat-value { font-family: var(--font-display); font-weight: 500; font-size: 20px; }

.field-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  align-items: baseline;
}
.field-row:last-child { border-bottom: none; }
.field-row dt { font-size: 12px; color: var(--fg-3); font-weight: 500; text-transform: uppercase; letter-spacing: 0.06em; }
.field-row dd { margin: 0; font-size: 14px; color: var(--fg); }

/* ═══════════════════════ COMMAND PALETTE ═══════════════════════ */
.cmdk-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: grid; place-items: start center;
  padding-top: 14vh;
  opacity: 0; pointer-events: none;
  transition: opacity 0.18s;
}
.cmdk-overlay.is-open { opacity: 1; pointer-events: all; }
.cmdk {
  width: min(640px, 92vw);
  background: var(--bg-2);
  border: 1px solid var(--line-gold);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-modal);
  overflow: hidden;
  transform: scale(0.96);
  opacity: 0;
  transition: all 0.2s cubic-bezier(0.32, 0.72, 0, 1);
}
.cmdk-overlay.is-open .cmdk { transform: scale(1); opacity: 1; }
.cmdk-input {
  width: 100%;
  background: transparent;
  border: none;
  padding: 18px 22px;
  font-size: 17px;
  color: var(--fg);
  outline: none;
}
.cmdk-input::placeholder { color: var(--fg-faint); }
.cmdk-results {
  max-height: 60vh;
  overflow: auto;
  border-top: 1px solid var(--line);
}
.cmdk-group {
  padding: 8px 12px 4px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--fg-faint);
  text-transform: uppercase;
}
.cmdk-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 18px;
  cursor: pointer;
  transition: background 0.1s;
}
.cmdk-item.is-active { background: var(--gold-faint); }
.cmdk-item:hover { background: var(--hover); }
.cmdk-item-text { flex: 1; min-width: 0; }
.cmdk-item-name { font-size: 14.5px; color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmdk-item-meta { font-size: 11.5px; color: var(--fg-3); font-family: var(--font-mono); }
.cmdk-item-kind { font-size: 10px; padding: 2px 7px; border-radius: var(--r-pill); background: var(--bg-3); color: var(--fg-3); font-weight: 600; letter-spacing: 0.04em; }
.cmdk-footer {
  padding: 8px 18px;
  border-top: 1px solid var(--line);
  background: var(--bg-3);
  display: flex; gap: 14px;
  font-size: 11px;
  color: var(--fg-3);
}

/* ═══════════════════════ TOAST ═══════════════════════ */
.toast-host {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 250;
  display: flex; flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold-3);
  padding: 14px 18px;
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  min-width: 260px; max-width: 360px;
  font-size: 14px;
  pointer-events: all;
  animation: toast-in 0.22s cubic-bezier(0.32, 0.72, 0, 1);
}
.toast.is-error { border-left-color: var(--red); }
.toast.is-success { border-left-color: var(--green); }
@keyframes toast-in {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ═══════════════════════ MARKDOWN ═══════════════════════ */
.md-content { font-size: 14px; line-height: 1.7; color: var(--fg); max-width: 720px; }
.md-content h1 { font-family: var(--font-display); font-weight: 500; font-size: 26px; letter-spacing: -0.02em; margin: 0 0 16px; }
.md-content h2 { font-family: var(--font-display); font-weight: 500; font-size: 19px; letter-spacing: -0.01em; margin: 22px 0 10px; color: var(--gold-3); }
.md-content h3 { font-family: var(--font-body); font-weight: 700; font-size: 14px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--fg-2); margin: 18px 0 8px; }
.md-content p { margin: 0 0 12px; }
.md-content strong { color: var(--gold-3); font-weight: 600; }
.md-content em { color: var(--fg-2); font-style: italic; }
.md-content code { font-family: var(--font-mono); font-size: 12px; padding: 2px 7px; background: var(--bg-3); border-radius: 4px; color: var(--gold-3); }
.md-content ul { padding-left: 22px; margin: 8px 0 14px; }
.md-content li { margin: 3px 0; }
.md-content a { color: var(--gold-3); text-decoration: underline; text-decoration-color: rgba(196,133,74,0.3); }
.md-content blockquote { border-left: 3px solid var(--gold-3); padding-left: 14px; margin: 12px 0; color: var(--fg-2); }
.md-content hr { border: none; border-top: 1px solid var(--line); margin: 18px 0; }

/* ═══════════════════════ SKELETON ═══════════════════════ */
.skel {
  background: linear-gradient(90deg, var(--bg-2), var(--bg-3), var(--bg-2));
  background-size: 200% 100%;
  border-radius: var(--r-md);
  animation: skel-shimmer 1.4s ease-in-out infinite;
}
@keyframes skel-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ═══════════════════════ EMPTY ═══════════════════════ */
.empty {
  text-align: center;
  padding: 60px 24px;
  color: var(--fg-3);
}
.empty .icon {
  width: 56px; height: 56px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: var(--bg-2);
  border: 1px solid var(--line-gold);
  display: grid; place-items: center;
  color: var(--gold-3);
}
.empty h3 { font-family: var(--font-display); font-weight: 500; font-size: 19px; color: var(--fg); margin: 0 0 6px; }
.empty p { font-size: 13.5px; max-width: 360px; margin: 0 auto; line-height: 1.5; }

/* ═══════════════════════ LOGIN ═══════════════════════ */
.login-shell {
  min-height: 100vh; min-height: 100dvh;
  display: grid; place-items: center;
  background: radial-gradient(ellipse 800px 600px at 50% 0%, var(--gold-glow), transparent 70%), var(--bg);
  padding: 24px;
}
.login-card {
  width: 100%; max-width: 380px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 40px 32px 32px;
  box-shadow: var(--shadow-modal);
}
.login-card h1 {
  font-family: var(--font-display);
  font-variation-settings: "opsz" 144;
  font-weight: 500;
  font-size: 40px;
  text-align: center;
  margin: 0 0 4px;
  letter-spacing: -0.03em;
}
.login-card h1 .accent { background: linear-gradient(135deg, var(--gold-3), var(--gold)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; font-style: italic; }
.login-card .sub {
  text-align: center; color: var(--fg-3);
  font-size: 12px; letter-spacing: 0.08em;
  margin: 0 0 28px; text-transform: uppercase;
}
.login-error {
  background: rgba(248,113,113,0.10);
  border: 1px solid rgba(248,113,113,0.30);
  color: var(--red);
  padding: 10px 14px;
  border-radius: var(--r-md);
  font-size: 13px;
  margin-bottom: 14px;
}

/* ═══════════════════════ UTILS ═══════════════════════ */
.muted { color: var(--fg-3); }
.faint { color: var(--fg-faint); }
.mono { font-family: var(--font-mono); }
.serif { font-family: var(--font-display); }
.mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; }
.flex { display: flex; } .col-flex { flex-direction: column; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.center { align-items: center; } .between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }

.dz-zona-perigosa {
  margin-top: 24px;
  padding: 14px;
  background: rgba(248,113,113,0.06);
  border: 1px solid rgba(248,113,113,0.25);
  border-radius: var(--r-md);
}
.dz-zona-perigosa-label {
  font-size: 11px; font-weight: 600; color: var(--red);
  letter-spacing: 0.08em; margin-bottom: 8px;
  text-transform: uppercase;
}

/* ═══════════════════════ MOBILE ═══════════════════════ */
@media (max-width: 900px) {
  .shell {
    grid-template-columns: 1fr;
    grid-template-rows: var(--topbar-h) 1fr;
    grid-template-areas: "topbar" "main";
  }
  .sidebar { display: none; }
  .bottom-nav { display: block; }
  .main {
    padding: 16px 16px calc(var(--bottomnav-h) + env(safe-area-inset-bottom) + 24px);
  }
  .topbar { padding: 0 14px; gap: 8px; }
  .topbar-title h2 { font-size: 19px; }
  .topbar-search { width: var(--tap); padding: 0; justify-content: center; }
  .topbar-search > span:not(.kbd) { display: none; }
  .topbar-search .kbd { display: none; }

  .kanban {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .col { min-height: auto; }

  .drawer {
    /* Bottom sheet em mobile */
    width: 100%;
    height: 90vh; height: 90dvh;
    top: auto; bottom: 0;
    border-left: none;
    border-top: 1px solid var(--line-gold);
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    transform: translateY(100%);
  }
  .drawer.is-open { transform: translateY(0); }
  .drawer-head { padding: 22px 18px 16px; position: relative; }
  .drawer-head::before {
    content: "";
    position: absolute; top: 8px; left: 50%;
    transform: translateX(-50%);
    width: 40px; height: 4px;
    background: var(--line-2);
    border-radius: 99px;
  }
  .drawer-tabs { padding: 0 18px; }
  .drawer-body { padding: 18px; }

  .stats-grid { grid-template-columns: 1fr 1fr; }
  .field-row { grid-template-columns: 1fr; gap: 4px; }
  .field-row dt { font-size: 11px; }

  .toast-host { bottom: calc(var(--bottomnav-h) + 16px + env(safe-area-inset-bottom)); right: 12px; left: 12px; }
  .toast { min-width: 0; max-width: none; }

  .table-wrap { overflow-x: auto; }
  .table th, .table td { padding: 12px 12px; font-size: 13px; }

  .cmdk-overlay { padding-top: 8vh; }
}

@media (max-width: 540px) {
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpi { padding: 14px 16px; }
  .kpi-value { font-size: 26px; }
  .section-title { gap: 8px; }
  .topbar-search { display: none; }
}
