/* ============================================================
   COLORES CSS — Variables de marca
   Actualiza estos valores cuando tengas el branding oficial de CAS
============================================================ */
:root {
  /* Paleta principal */
  --color-bg:          #080B0F;
  --color-surface:     #0D1117;
  --color-surface-2:   #161B22;
  --color-surface-3:   #1C2128;
  --color-border:      #21262D;
  --color-border-2:    #30363D;

  /* Acento — REEMPLAZAR con color oficial CAS cuando tengas branding */
  --color-accent:      #E8A020;
  --color-accent-dim:  rgba(232,160,32,0.15);
  --color-accent-glow: rgba(232,160,32,0.35);

  /* Textos */
  --color-text:        #E6EDF3;
  --color-text-muted:  #7D8590;
  --color-text-dim:    #484F58;

  /* Estados Kanban */
  --col-briefing:      #1F6FEB;
  --col-preprod:       #8957E5;
  --col-prod:          #E3B341;
  --col-post:          #F78166;
  --col-revision:      #56D364;
  --col-entregado:     #238636;

  /* UI */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-card: 0 4px 24px rgba(0,0,0,0.5);
  --transition: 0.18s ease;

  /* Tipografía — cinematográfica */
  --font-display: 'Syne', 'Bebas Neue', sans-serif;
  --font-body:    'DM Sans', 'Instrument Sans', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', 'Fira Code', monospace;
}

/* ── Reset & Base ────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Google Fonts cargadas dinámicamente */
@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=DM+Sans:wght@300;400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── Scrollbar ───────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--color-surface); }
::-webkit-scrollbar-thumb { background: var(--color-border-2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--color-text-muted); }

/* ── Utilidades ─────────────────────────────── */
.hidden { display: none !important; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 6px; } .gap-2 { gap: 10px; } .gap-3 { gap: 14px; }
.w-full { width: 100%; }
.text-muted { color: var(--color-text-muted); }
.text-accent { color: var(--color-accent); }
.text-sm { font-size: 0.82rem; }
.text-xs { font-size: 0.72rem; }
.font-mono { font-family: var(--font-mono); }
.mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 20px; }

/* ── Layout Principal ────────────────────────── */
.app-shell {
  display: grid;
  grid-template-columns: 64px 1fr;
  grid-template-rows: 56px 1fr;
  min-height: 100vh;
}

/* ── Topbar ──────────────────────────────────── */
.topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px 0 16px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.topbar-brand .logo-mark {
  width: 32px; height: 32px;
  background: var(--color-accent);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 800;
  color: #000;
  letter-spacing: 0;
  flex-shrink: 0;
}
.topbar-brand .brand-name { color: var(--color-text); }
.topbar-brand .brand-sub { color: var(--color-text-muted); font-size: 0.7rem; font-weight: 400; letter-spacing: 0.05em; }
.topbar-right {
  display: flex; align-items: center; gap: 12px;
}
.topbar-clock {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--color-text-muted);
  padding: 4px 10px;
  background: var(--color-surface-2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
}

/* ── Sidebar ─────────────────────────────────── */
.sidebar {
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0;
  gap: 4px;
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
}
.nav-btn {
  width: 44px; height: 44px;
  border-radius: var(--radius-md);
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--color-text-muted);
  transition: var(--transition);
  position: relative;
}
.nav-btn:hover { background: var(--color-surface-2); color: var(--color-text); }
.nav-btn.active {
  background: var(--color-accent-dim);
  color: var(--color-accent);
  border: 1px solid var(--color-accent-glow);
}
.nav-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nav-tooltip {
  position: absolute;
  left: 54px;
  background: var(--color-surface-3);
  color: var(--color-text);
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
  z-index: 200;
}
.nav-btn:hover .nav-tooltip { opacity: 1; }
.sidebar-spacer { flex: 1; }

/* ── Main Content ────────────────────────────── */
.main-content {
  padding: 24px 28px;
  overflow-y: auto;
  height: calc(100vh - 56px);
}

/* ── Vistas ──────────────────────────────────── */
.view { display: none; }
.view.active { display: block; }

/* ── Page Header ─────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--color-border);
}
.page-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1;
}
.page-title span { color: var(--color-accent); }
.page-subtitle { color: var(--color-text-muted); font-size: 0.82rem; margin-top: 4px; }

/* ── Botones ─────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.83rem;
  font-weight: 500;
  transition: var(--transition);
  white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn-primary {
  background: var(--color-accent);
  color: #000;
  border-color: var(--color-accent);
  font-weight: 600;
}
.btn-primary:hover { background: #f0ad2a; box-shadow: 0 0 16px var(--color-accent-glow); }
.btn-ghost {
  background: transparent;
  color: var(--color-text);
  border-color: var(--color-border);
}
.btn-ghost:hover { background: var(--color-surface-2); border-color: var(--color-border-2); }
.btn-danger {
  background: rgba(248,81,73,0.1);
  color: #f85149;
  border-color: rgba(248,81,73,0.25);
}
.btn-danger:hover { background: rgba(248,81,73,0.2); }
.btn-wa {
  background: #128C7E;
  color: #fff;
  border-color: #128C7E;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 10px 22px;
}
.btn-wa:hover { background: #0e7366; box-shadow: 0 0 20px rgba(18,140,126,0.4); }
.btn-sm { padding: 5px 10px; font-size: 0.76rem; }
.btn-icon { padding: 7px; }

/* ── Input / Select / Textarea ────────────────── */
.input, .select, textarea {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 0.85rem;
  padding: 9px 12px;
  transition: var(--transition);
  width: 100%;
  outline: none;
}
.input:focus, .select:focus, textarea:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-dim);
}
.input::placeholder, textarea::placeholder { color: var(--color-text-dim); }
.input[readonly] {
  background: var(--color-surface);
  color: var(--color-text-muted);
}
.select { cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%237D8590' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; padding-right: 34px; }
.select option { background: var(--color-surface-3); }
textarea { resize: vertical; min-height: 80px; }
.phone-field {
  display: grid;
  grid-template-columns: minmax(132px, 0.38fr) minmax(150px, 1fr);
  gap: 8px;
}
.phone-code,
.phone-number {
  min-width: 0;
}
label.form-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--color-text-muted);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.form-group { margin-bottom: 14px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

/* ── Toggle ──────────────────────────────────── */
.toggle-wrap { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.toggle {
  width: 36px; height: 20px;
  background: var(--color-border-2);
  border-radius: 10px;
  position: relative;
  transition: var(--transition);
  flex-shrink: 0;
}
.toggle::after {
  content: '';
  width: 14px; height: 14px;
  background: #fff;
  border-radius: 50%;
  position: absolute;
  top: 3px; left: 3px;
  transition: var(--transition);
}
.toggle.on { background: var(--color-accent); }
.toggle.on::after { transform: translateX(16px); }
.toggle-label { font-size: 0.83rem; }

/* ── Modal ───────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--color-surface);
  border: 1px solid var(--color-border-2);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 100%; max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.96);
  transition: transform 0.2s;
  box-shadow: var(--shadow-card);
}
.modal-overlay.open .modal { transform: scale(1); }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 22px;
}
.modal-title { font-family: var(--font-display); font-size: 1.15rem; font-weight: 700; }
.modal-close {
  background: none; border: none; cursor: pointer;
  color: var(--color-text-muted); font-size: 1.3rem; line-height: 1;
  padding: 2px 6px; border-radius: var(--radius-sm);
  transition: var(--transition);
}
.modal-close:hover { color: var(--color-text); background: var(--color-surface-2); }

/* ── Toasts ──────────────────────────────────── */
#toast-container {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 9999; display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: var(--color-surface-3);
  border: 1px solid var(--color-border-2);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  font-size: 0.84rem;
  max-width: 300px;
  box-shadow: var(--shadow-card);
  animation: toastIn 0.3s ease;
  display: flex; align-items: center; gap: 10px;
}
.toast.success { border-left: 3px solid #56D364; }
.toast.error   { border-left: 3px solid #f85149; }
.toast.info    { border-left: 3px solid var(--color-accent); }
@keyframes toastIn { from { opacity:0; transform:translateY(12px); } to { opacity:1; transform:translateY(0); } }
@keyframes toastOut { from { opacity:1; } to { opacity:0; transform:translateY(8px); } }

/* ──────────────────────────────────────────────
   MÓDULO 1: KANBAN
──────────────────────────────────────────────── */

.kanban-controls {
  display: flex; gap: 10px; align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.kanban-search {
  flex: 1; min-width: 180px; max-width: 300px;
}
.kanban-board {
  display: grid;
  grid-template-columns: repeat(6, minmax(220px, 1fr));
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 12px;
}
@media (max-width: 1300px) {
  .kanban-board { grid-template-columns: repeat(3, minmax(220px, 1fr)); }
}

.kanban-col {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 0;
  min-height: 480px;
  display: flex; flex-direction: column;
}
.kanban-col-header {
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--color-border);
  display: flex; align-items: center; justify-content: space-between;
  position: relative;
}
.kanban-col-title {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  display: flex; align-items: center; gap: 7px;
}
.col-dot {
  width: 8px; height: 8px; border-radius: 50%;
}
.kanban-count {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  background: var(--color-surface-2);
  color: var(--color-text-muted);
  padding: 1px 7px;
  border-radius: 20px;
}
.kanban-col-body {
  padding: 10px;
  flex: 1;
  display: flex; flex-direction: column; gap: 8px;
  overflow-y: auto;
}
.kanban-col-body.drag-over {
  background: rgba(232,160,32,0.04);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

/* ── Tarjeta de cliente ─────────────────────── */
.client-card {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 12px;
  cursor: grab;
  transition: var(--transition);
  position: relative;
  animation: cardIn 0.25s ease;
}
@keyframes cardIn { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:translateY(0); } }
.client-card:hover {
  border-color: var(--color-border-2);
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  transform: translateY(-1px);
}
.client-card.dragging { opacity: 0.4; cursor: grabbing; }
.card-project {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 3px;
}
.card-client {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 8px;
}
.card-meta {
  display: flex; flex-wrap: wrap; gap: 5px;
  margin-bottom: 8px;
}
.card-tag {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 0.72rem;
  color: var(--color-text-muted);
  background: var(--color-surface-3);
  padding: 2px 7px;
  border-radius: 4px;
}
.card-tag.amount { color: var(--color-accent); }
.card-tag.deadline.overdue { color: #f85149; }
.card-tag.deadline.soon { color: #E3B341; }
.card-actions {
  display: flex; gap: 5px; justify-content: flex-end;
  border-top: 1px solid var(--color-border);
  padding-top: 8px;
  margin-top: 8px;
}
.card-action-btn {
  background: none; border: none; cursor: pointer;
  color: var(--color-text-muted); padding: 3px;
  border-radius: 4px; transition: var(--transition);
  display: flex;
}
.card-action-btn:hover { color: var(--color-text); background: var(--color-surface-3); }
.card-action-btn svg { width: 14px; height: 14px; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
.card-action-btn.delete:hover { color: #f85149; }
.card-action-btn.wa:hover { color: #25D366; }
.card-action-btn.quote:hover { color: var(--color-accent); }

/* Barra de color de estado en el borde izquierdo */
.client-card::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

/* ──────────────────────────────────────────────
   MÓDULO 2: COTIZADOR
──────────────────────────────────────────────── */

.quoter-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 20px;
}
@media (max-width: 1100px) {
  .quoter-layout { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .phone-field { grid-template-columns: 1fr; }
}

.card-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 22px;
}
.panel-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 18px;
  display: flex; align-items: center; gap: 8px;
  color: var(--color-text-muted);
}
.panel-title span { color: var(--color-accent); font-size: 1.1rem; }

/* Selector de servicios */
.service-add-row {
  display: flex; gap: 8px; margin-bottom: 16px;
}
.service-add-row .select { flex: 1; }

/* Lista de servicios seleccionados */
.service-list { display: flex; flex-direction: column; gap: 8px; }
.service-item {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  animation: cardIn 0.2s ease;
}
.service-item-name { font-size: 0.84rem; font-weight: 500; }
.service-item-price { font-family: var(--font-mono); font-size: 0.82rem; color: var(--color-text-muted); white-space: nowrap; }
.qty-control {
  display: flex; align-items: center; gap: 0;
  background: var(--color-surface-3);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  overflow: hidden;
}
.qty-btn {
  background: none; border: none; cursor: pointer;
  color: var(--color-text-muted);
  width: 26px; height: 26px;
  font-size: 1rem; line-height: 1;
  transition: var(--transition);
  display: flex; align-items: center; justify-content: center;
}
.qty-btn:hover { color: var(--color-accent); background: var(--color-accent-dim); }
.qty-value {
  width: 30px; text-align: center;
  font-family: var(--font-mono); font-size: 0.82rem;
}
.service-item-total { font-family: var(--font-mono); font-size: 0.84rem; font-weight: 600; color: var(--color-accent); min-width: 80px; text-align: right; }
.service-remove-btn {
  background: none; border: none; cursor: pointer;
  color: var(--color-text-dim); padding: 3px;
  border-radius: 4px; transition: var(--transition);
}
.service-remove-btn:hover { color: #f85149; }
.service-remove-btn svg { width: 14px; height: 14px; fill:none; stroke:currentColor; stroke-width:2.5; stroke-linecap:round; }

/* Descuento individual en item */
.service-discount-row {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: 8px;
  padding-top: 6px;
  border-top: 1px dashed var(--color-border);
  margin-top: 4px;
}
.service-discount-row .input { max-width: 140px; font-size: 0.78rem; padding: 5px 8px; }
.service-discount-row label { font-size: 0.75rem; color: var(--color-text-muted); white-space: nowrap; }
.service-config-row {
  display: grid;
  grid-template-columns: minmax(190px, 1.4fr) minmax(130px, 0.9fr) minmax(96px, 0.45fr) minmax(180px, 1.3fr) auto auto;
  gap: 8px;
  align-items: center;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 8px 12px;
}
.service-config-row .input {
  font-size: 0.78rem;
  padding: 6px 8px;
}
@media (max-width: 900px) {
  .service-config-row {
    grid-template-columns: 1fr;
  }
}

/* Panel resumen / totales */
.totals-section { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.total-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.85rem;
}
.total-row.subtotal { color: var(--color-text-muted); }
.total-row.discount { color: #56D364; }
.total-row.iva { color: var(--color-text-muted); }
.total-row.grand {
  font-size: 1.3rem;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--color-accent);
  padding-top: 10px;
  border-top: 1px solid var(--color-border-2);
  margin-top: 4px;
}
.total-row.grand .amount-total { font-family: var(--font-mono); }

/* Código descuento global */
.discount-code-section {
  background: var(--color-surface-2);
  border: 1px dashed var(--color-border-2);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-top: 12px;
}
.discount-code-row { display: flex; gap: 8px; }
.discount-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(86,211,100,0.1);
  color: #56D364;
  border: 1px solid rgba(86,211,100,0.25);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 0.77rem;
  font-family: var(--font-mono);
  margin-top: 8px;
}
.discount-badge .remove-code { cursor: pointer; opacity: 0.6; }
.discount-badge .remove-code:hover { opacity: 1; }

/* ──────────────────────────────────────────────
   MÓDULO 3: HISTORIAL DE COTIZACIONES
──────────────────────────────────────────────── */

.history-filters {
  display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap;
}
.history-table-wrap {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
table { width: 100%; border-collapse: collapse; }
thead { background: var(--color-surface-2); }
th {
  padding: 10px 14px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border);
}
td {
  padding: 12px 14px;
  font-size: 0.84rem;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tbody tr { transition: var(--transition); }
tbody tr:hover { background: var(--color-surface-2); }
.badge {
  display: inline-block;
  padding: 2px 9px; border-radius: 20px;
  font-size: 0.72rem; font-weight: 600;
}
.badge-sent    { background: rgba(30,130,76,0.15); color: #56D364; }
.badge-draft   { background: rgba(232,160,32,0.12); color: var(--color-accent); }
.badge-accepted{ background: rgba(31,111,235,0.15); color: #58a6ff; }

/* ── Dashboard Stats ─────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
}
.stat-card::after {
  content: '';
  position: absolute; right: -16px; top: -16px;
  width: 72px; height: 72px;
  border-radius: 50%;
  background: var(--color-accent-dim);
}
.stat-label { font-size: 0.75rem; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.stat-value {
  font-family: var(--font-mono); font-size: 1.7rem; font-weight: 600;
  color: var(--color-accent); margin: 6px 0 0;
  line-height: 1;
}
.stat-sub { font-size: 0.73rem; color: var(--color-text-dim); margin-top: 4px; }

/* ── Empty state ─────────────────────────────── */
.empty-state {
  text-align: center; padding: 48px 20px;
  color: var(--color-text-muted);
}
.empty-state svg { width: 40px; height: 40px; stroke: var(--color-border-2); margin: 0 auto 12px; display: block; fill:none; stroke-linecap:round; stroke-linejoin:round; }
.empty-state p { font-size: 0.85rem; }

#login-overlay {
  position: fixed; inset: 0; z-index: 9000;
  background: var(--color-bg);
  display: flex; align-items: center; justify-content: center;
}
.login-box {
  background: var(--color-surface);
  border: 1px solid var(--color-border-2);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  width: 100%; max-width: 380px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.7);
}
.login-logo {
  width: 48px; height: 48px;
  background: var(--color-accent);
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 1.1rem; font-weight: 800; color: #000;
  margin: 0 auto 20px;
}
.login-title {
  font-family: var(--font-display);
  font-size: 1.4rem; font-weight: 700;
  text-align: center; margin-bottom: 6px;
}
.login-sub { text-align: center; color: var(--color-text-muted); font-size: 0.82rem; margin-bottom: 28px; }
.login-error { color: #f85149; font-size: 0.8rem; text-align: center; margin-top: 10px; min-height: 18px; }
.login-hint { color: var(--color-text-dim); font-size: 0.75rem; text-align: center; margin-top: 14px; }
