@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@700;900&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;700&display=swap');

/* ── TOKENS ── */
:root {
  --bg:          #080D14;
  --surface:     #0D1420;
  --surface-2:   #131E2E;
  --surface-3:   #2A323F;
  --surface-glass: rgba(18, 27, 42, 0.76);
  --surface-elev:  #111B2A;
  --gold:        #E09F4F;
  --gold-dark:   #C47E2E;
  --gold-light:  #F4C98E;
  --gold-grad:   linear-gradient(90deg, #E09F4F 0%, #FFE0A3 50%, #C47E2E 100%);
  --gold-glow:   rgba(224,159,79,0.18);
  --gold-glow-sm:rgba(224,159,79,0.10);
  --blue:        #68A7FF;
  --blue-glow:   rgba(104,167,255,0.15);
  --green:       #4ADE80;
  --green-glow:  rgba(74,222,128,0.13);
  --red:         #F87171;
  --red-glow:    rgba(248,113,113,0.13);
  --grey:        #434C5E;
  --border:      rgba(255,255,255,0.08);
  --border-md:   rgba(255,255,255,0.13);
  --text:        #FFFFFF;
  --text-muted:  rgba(255,255,255,0.55);
  --text-dim:    rgba(255,255,255,0.25);
  --font-h:      'Montserrat', sans-serif;
  --font-b:      'Inter', sans-serif;
  --font-mono:   'JetBrains Mono', monospace;
  --sidebar-w:   240px;
  --radius:      8px;
  --radius-lg:   14px;
  --shadow-sm:   0 2px 12px rgba(0,0,0,0.4);
  --shadow-md:   0 8px 32px rgba(0,0,0,0.55);
  --shadow-deep: 0 20px 60px -20px rgba(0,0,0,0.8);
  --shadow-glow: 0 0 24px rgba(224,159,79,0.28);

  /* Emily status */
  --c-pendiente: #6366F1;
  --c-contactando:#F59E0B;
  --c-cita:      #E09F4F;
  --c-no-contest:#6B7280;
  --c-sin-interes:#EF4444;
  --c-cerrado:   #22C55E;
  --c-cliente:   #10B981;

  /* Temperatura */
  --c-hot:  #EF4444;
  --c-warm: #F59E0B;
  --c-cold: #6366F1;
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font-b);
  background:
    radial-gradient(circle at 20% 0%, rgba(104,167,255,0.10), transparent 32%),
    radial-gradient(circle at 86% 12%, rgba(224,159,79,0.12), transparent 28%),
    linear-gradient(160deg, #070B12 0%, #0A111B 42%, #0D1420 100%);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(224,159,79,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(224,159,79,0.025) 1px, transparent 1px);
  background-size: 44px 44px;
  pointer-events: none;
  z-index: 0;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }
img { display: block; max-width: 100%; }

/* ── UTILS ── */
.hidden { display: none !important; }
.spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── LAYOUT ── */
.app-shell {
  display: flex;
  height: 100vh;
  position: relative;
  z-index: 1;
  overflow: hidden;
}
.main-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
}
.app-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
}
.app-header { display: none; }

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-w);
  background: rgba(10,16,32,0.92);
  backdrop-filter: blur(12px);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 10;
}
.sidebar-logo {
  padding: 22px 20px 18px;
  font-family: var(--font-h);
  font-weight: 900;
  font-size: 17px;
  letter-spacing: -0.02em;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  line-height: 1;
}
.sidebar-logo span { color: var(--gold); }
.sidebar-logo small {
  display: block;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 4px;
}
.sidebar-nav {
  flex: 1;
  padding: 16px 10px;
  overflow-y: auto;
}
.nav-section-label {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 10px 10px 4px;
}
.nav-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 10px;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 500;
  transition: background .15s, color .15s;
  text-align: left;
  border-left: 3px solid transparent;
}
.nav-btn:hover {
  background: rgba(255,255,255,0.05);
  color: var(--text);
}
.nav-btn.active {
  background: var(--gold-glow);
  color: var(--gold);
  border-left-color: var(--gold);
  font-weight: 600;
}
.nav-btn svg { flex-shrink: 0; opacity: .8; }
.sidebar-footer {
  padding: 16px 18px;
  border-top: 1px solid var(--border);
}
.sidebar-user { font-size: 11px; color: var(--text-dim); margin-bottom: 2px; }
.sidebar-user-name {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--gold-light);
  margin-bottom: 8px;
  font-weight: 700;
}
.header-logout {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  padding: 0;
  transition: color .15s;
}
.header-logout:hover { color: var(--gold); }

/* ── KPI BAR ── */
.kpi-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--border);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.kpi-card {
  background: var(--surface);
  padding: 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
  overflow: hidden;
}
.kpi-card:first-child::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0;
  width: 100%; height: 2px;
  background: var(--gold-grad);
}
.kpi-value {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.03em;
  line-height: 1;
}
.kpi-value.gold { color: var(--gold); }
.kpi-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.kpi-chart-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 22px;
}
.kpi-card--chart {
  flex-direction: row;
  align-items: center;
  gap: 14px;
}

/* ── VIEW PANELS ── */
[data-view-panel] { min-height: 100%; }
.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}
.view-title {
  font-family: var(--font-h);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.search-input {
  flex: 1;
  min-width: 180px;
  max-width: 280px;
  padding: 8px 12px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: border-color .15s;
}
.search-input:focus { border-color: var(--gold); }
.search-input::placeholder { color: var(--text-dim); }

/* ── FILTER TABS ── */
.filter-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.filter-tab {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  transition: all .15s;
}
.filter-tab:hover { border-color: var(--gold); color: var(--gold); }
.filter-tab.active {
  background: var(--gold-glow);
  border-color: var(--gold);
  color: var(--gold);
  font-weight: 600;
}

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius);
  border: none;
  font-size: 13.5px;
  font-weight: 600;
  font-family: var(--font-b);
  transition: background .15s, box-shadow .15s, opacity .15s;
  cursor: pointer;
  white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary {
  background: var(--gold);
  color: #0D1420;
}
.btn-primary:hover:not(:disabled) {
  background: var(--gold-dark);
  box-shadow: var(--shadow-glow);
}
.btn-secondary {
  background: var(--surface-3);
  color: var(--text);
  border: 1px solid var(--border-md);
}
.btn-secondary:hover:not(:disabled) { border-color: var(--gold); color: var(--gold); }
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover:not(:disabled) { color: var(--text); border-color: var(--border-md); }
.btn-danger {
  background: rgba(239,68,68,0.15);
  color: #EF4444;
  border: 1px solid rgba(239,68,68,0.3);
}
.btn-danger:hover:not(:disabled) { background: rgba(239,68,68,0.25); }
.btn-sm { padding: 6px 14px; font-size: 12.5px; }
.btn-full { width: 100%; justify-content: center; }

/* ── FORM FIELDS ── */
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }
.field input,
.field select,
.field textarea {
  padding: 9px 12px;
  background: var(--surface-3);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13.5px;
  outline: none;
  transition: border-color .15s;
  width: 100%;
}
.field input:focus,
.field select:focus,
.field textarea:focus { border-color: var(--gold); }
.field select { cursor: pointer; }
.field textarea { resize: vertical; min-height: 72px; }
.field input::placeholder,
.field textarea::placeholder { color: var(--text-dim); }

/* Services checkboxes */
.services-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.service-check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 12.5px;
  color: var(--text-muted);
  transition: border-color .15s, color .15s;
}
.service-check:has(input:checked) {
  border-color: var(--gold);
  color: var(--gold);
  background: var(--gold-glow-sm);
}
.service-check input { width: 14px; height: 14px; accent-color: var(--gold); }

/* ── BADGES ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 20px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}
.badge-pendiente { background: rgba(99,102,241,.18); color: #A5B4FC; }
.badge-contactando { background: rgba(245,158,11,.18); color: #FCD34D; }
.badge-cita-agendada { background: rgba(224,159,79,.18); color: var(--gold-light); }
.badge-no-contestado { background: rgba(107,114,128,.18); color: #9CA3AF; }
.badge-sin-interes { background: rgba(239,68,68,.18); color: #FCA5A5; }
.badge-cerrado { background: rgba(34,197,94,.18); color: #86EFAC; }
.badge-cliente { background: rgba(16,185,129,.22); color: #6EE7B7; }
.badge-hot { background: rgba(239,68,68,.18); color: #FCA5A5; }
.badge-warm { background: rgba(245,158,11,.18); color: #FCD34D; }
.badge-cold { background: rgba(99,102,241,.18); color: #A5B4FC; }
.badge-activo { background: rgba(16,185,129,.18); color: #6EE7B7; }
.badge-pausado { background: rgba(245,158,11,.18); color: #FCD34D; }
.badge-cancelado { background: rgba(239,68,68,.18); color: #FCA5A5; }
.badge-outbound { background: rgba(224,159,79,.15); color: var(--gold-light); }
.badge-inbound { background: rgba(99,102,241,.15); color: #A5B4FC; }

/* ── DATA TABLE ── */
.data-table-wrap {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.data-table-wrap table {
  width: 100%;
  border-collapse: collapse;
}
.data-table-wrap thead {
  background: var(--surface-3);
}
.data-table-wrap th {
  padding: 11px 16px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table-wrap td {
  padding: 12px 16px;
  font-size: 13.5px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text-muted);
}
.data-table-wrap td:first-child { color: var(--text); font-weight: 500; }
.data-table-wrap tbody tr:hover { background: rgba(255,255,255,0.03); cursor: pointer; }
.data-table-wrap tbody tr:last-child td { border-bottom: none; }
.table-empty { text-align: center; padding: 40px; color: var(--text-dim); font-size: 13px; }

/* ── DETAIL PANEL ── */
.panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 100;
  display: flex;
  justify-content: flex-end;
}
.panel-overlay.hidden { display: none !important; }
.panel {
  width: min(760px, 100vw);
  max-width: 100vw;
  background: var(--surface-2);
  border-left: 1px solid var(--border);
  height: 100%;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-shadow: var(--shadow-deep);
}
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.panel-name {
  font-family: var(--font-h);
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 4px;
}
.panel-company { font-size: 13px; color: var(--text-muted); }
.panel-close {
  font-size: 22px;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color .15s, background .15s;
}
.panel-close:hover { color: var(--text); background: rgba(255,255,255,0.08); }
.panel-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.panel-section-title {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.panel-help-text {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.5;
  margin: 0 0 8px;
}
.client-panel-tabs {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 3px;
  padding: 4px;
  position: sticky;
  top: -24px;
  z-index: 2;
}
.client-tab {
  appearance: none;
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  min-width: 0;
  padding: 8px 4px;
}
.client-tab:hover,
.client-tab.active {
  background: rgba(224,159,79,.16);
  color: var(--gold-light);
}
.client-tab-panel {
  display: none;
  flex-direction: column;
  gap: 18px;
}
.client-tab-panel.active {
  display: flex;
}
.info-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 13.5px;
}
.info-label {
  min-width: 80px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  font-family: var(--font-mono);
  flex-shrink: 0;
}
.mrr-preview {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: -0.03em;
  text-align: center;
  padding: 10px 0 4px;
}
.call-item {
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.call-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.call-item-date { font-size: 11px; color: var(--text-dim); font-family: var(--font-mono); }
.call-item-resumen {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  cursor: pointer;
}
.call-item-resumen.expanded {
  -webkit-line-clamp: unset;
}

/* ── PIPELINE KANBAN ── */
.pipeline-wrap {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 12px;
  min-height: 70vh;
  align-items: flex-start;
}
.pipeline-col {
  min-width: 200px;
  width: 200px;
  flex-shrink: 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: hidden;
}
.pipeline-col-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.pipeline-col-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
}
.pipeline-col-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-dim);
}
.pipeline-col-count {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
}
.pipeline-col-mrr { font-family: var(--font-mono); }
.pipeline-cards {
  padding: 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 80px;
  transition: background .15s;
}
.pipeline-cards.drag-over { background: var(--gold-glow-sm); }
.pipeline-card {
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  cursor: grab;
  transition: border-color .15s, box-shadow .15s;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.pipeline-card:hover { border-color: var(--border-md); box-shadow: var(--shadow-sm); }
.pipeline-card:active { cursor: grabbing; }
.pipeline-card.dragging { opacity: .4; }
.pipeline-card-name { font-size: 13px; font-weight: 600; color: var(--text); }
.pipeline-card-empresa { font-size: 11px; color: var(--text-muted); }
.pipeline-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 2px;
}
.temp-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.pipeline-card-mrr {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--gold-light);
  font-weight: 700;
}

/* ── INVOICES ── */
.invoice-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}
.invoice-empty {
  color: var(--text-dim);
  font-size: 12px;
  margin: 0;
}
.invoice-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.invoice-summary-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  min-width: 0;
}
.invoice-summary-card span {
  display: block;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.invoice-summary-card strong {
  display: block;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 15px;
  margin-top: 4px;
}
.invoice-hidden-note {
  color: var(--text-dim);
  font-size: 11px;
  margin: -2px 0 0;
}
.invoice-filter-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
}
.invoice-filter {
  appearance: none;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  padding: 6px 10px;
}
.invoice-filter span {
  color: var(--text-dim);
  font-family: var(--font-mono);
}
.invoice-filter.active {
  background: rgba(224,159,79,.16);
  border-color: rgba(224,159,79,.38);
  color: var(--gold-light);
}
.invoice-item {
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.invoice-item-head,
.invoice-payment-row,
.invoice-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}
.invoice-actions {
  display: flex;
  flex-wrap: wrap;
}
.invoice-actions a {
  text-decoration: none;
}
.invoice-number,
.invoice-total {
  color: var(--gold-light);
  font-family: var(--font-mono);
  font-weight: 700;
}
.invoice-meta,
.invoice-balance {
  color: var(--text-muted);
  font-size: 12px;
}
.invoice-carry-forward {
  color: var(--gold-light);
  font-size: 11px;
  font-weight: 700;
  margin-top: 4px;
}
.invoice-receipt-meta {
  color: var(--text-muted);
  font-size: 11px;
  margin-top: 4px;
}
.invoice-status-pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border-md);
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  margin-left: 6px;
  padding: 3px 7px;
}
.invoice-status-paid {
  background: rgba(16,185,129,.12);
  border-color: rgba(16,185,129,.35);
  color: #6EE7B7;
}
.invoice-status-partially-paid,
.invoice-status-sent {
  background: rgba(224,159,79,.12);
  border-color: rgba(224,159,79,.35);
  color: var(--gold-light);
}
.invoice-status-draft,
.invoice-status-pending-approval {
  background: rgba(99,102,241,.12);
  border-color: rgba(99,102,241,.35);
  color: #A5B4FC;
}
.invoice-payment-row input,
.invoice-payment-row select,
.invoice-notes-input {
  background: rgba(255,255,255,0.055);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 7px;
  color: var(--text);
  font-size: 13px;
  min-height: 34px;
  padding: 8px 10px;
  min-width: 0;
  width: 100%;
}
.invoice-payment-row input::placeholder,
.invoice-notes-input::placeholder { color: var(--text-dim); }
.invoice-outstanding-check {
  justify-content: flex-start;
  margin-top: 0;
}
.invoice-outstanding-detail {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.5;
  margin-top: 6px;
  word-break: break-word;
}

.activity-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.activity-item {
  display: grid;
  grid-template-columns: 12px 1fr;
  gap: 10px;
  padding: 10px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
  margin-top: 4px;
}
.activity-title {
  color: var(--text);
  font-size: 12.5px;
  font-weight: 700;
}
.activity-detail {
  color: var(--text-muted);
  font-size: 11.5px;
  line-height: 1.45;
  margin-top: 3px;
}
.telegram-review-card {
  align-items: center;
  background: rgba(224,159,79,.08);
  border: 1px solid rgba(224,159,79,.24);
  border-radius: var(--radius);
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr auto;
  padding: 12px;
}
.telegram-review-card strong {
  color: var(--gold-light);
  display: block;
  font-size: 12px;
  margin-bottom: 3px;
}
.telegram-review-card span {
  color: var(--text-muted);
  display: block;
  font-size: 11.5px;
  line-height: 1.45;
}

/* ── MODAL ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.hidden { display: none !important; }
.modal {
  background: var(--surface-2);
  border: 1px solid var(--border-md);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-deep);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border);
}
.modal-title {
  font-family: var(--font-h);
  font-size: 16px;
  font-weight: 700;
}
.modal-close {
  font-size: 20px;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
  padding: 2px 5px;
  border-radius: 4px;
}
.modal-close:hover { color: var(--text); }
.modal-form {
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 6px;
}

/* ── CHART LEGEND ── */
.chart-legend {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}
.chart-legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}
.chart-legend-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── TOAST ── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 18px;
  background: var(--surface-3);
  border: 1px solid var(--border-md);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
  z-index: 9999;
  box-shadow: var(--shadow-md);
  animation: slideUp .25s ease;
  max-width: 320px;
}
.toast.success { border-color: rgba(16,185,129,.4); background: rgba(16,185,129,.12); color: #6EE7B7; }
.toast.error   { border-color: rgba(239,68,68,.4); background: rgba(239,68,68,.12); color: #FCA5A5; }
@keyframes slideUp { from { transform: translateY(12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ── SETTINGS ── */
.settings-section {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 18px;
}
.settings-section-title {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.settings-webhook-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.settings-webhook-label { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.settings-webhook-url {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  word-break: break-all;
  padding: 6px 10px;
  background: var(--surface-3);
  border-radius: var(--radius);
}
.outbound-trigger-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}
.outbound-last-run {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
}

/* ── SERVICES PILLS ── */
.services-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.service-pill {
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--gold-glow-sm);
  border: 1px solid rgba(224,159,79,.2);
  color: var(--gold-light);
  font-size: 11px;
  font-weight: 500;
}

/* ── LOGIN PAGE ── */
body.login-page {
  display: flex;
  align-items: stretch;
  height: 100vh;
}
body.login-page::before { z-index: 0; }
.login-split {
  display: flex;
  width: 100%;
  position: relative;
  z-index: 1;
}
.login-brand {
  flex: 0 0 42%;
  background: linear-gradient(145deg, #080D14 0%, #0F1C2E 60%, #1A2333 100%);
  padding: 60px 52px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-right: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}
.login-brand::before {
  content: '';
  position: absolute;
  top: -80px; left: -80px;
  width: 380px; height: 380px;
  background: radial-gradient(circle, rgba(224,159,79,0.22) 0%, transparent 65%);
  pointer-events: none;
}
.login-brand-logo {
  font-family: var(--font-h);
  font-weight: 900;
  font-size: 32px;
  letter-spacing: -0.03em;
  color: var(--text);
  line-height: 1;
  margin-bottom: 18px;
  position: relative;
}
.login-brand-logo span { color: var(--gold); }
.login-brand-divider {
  width: 48px; height: 2px;
  background: var(--gold-grad);
  border-radius: 2px;
  margin-bottom: 18px;
}
.login-brand-tagline {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.20em;
  text-transform: uppercase;
  color: var(--gold-light);
  margin-bottom: 14px;
}
.login-brand-desc {
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.65;
  max-width: 320px;
}
.login-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 60px 40px;
}
.login-card-title {
  font-family: var(--font-h);
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 28px;
  letter-spacing: -0.02em;
  text-align: center;
}
.login-form {
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.login-error {
  color: #FCA5A5;
  font-size: 13px;
  text-align: center;
  padding: 9px 14px;
  background: rgba(239,68,68,.12);
  border: 1px solid rgba(239,68,68,.25);
  border-radius: var(--radius);
}

/* ── PREMIUM CRM POLISH ── */
.main-wrap {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.025), rgba(255,255,255,0)),
    rgba(13,20,32,0.86);
}
.app-content { padding: 28px 32px 36px; }
.sidebar {
  background: linear-gradient(180deg, rgba(9,14,24,0.96), rgba(8,13,20,0.92));
  backdrop-filter: blur(18px);
}
.sidebar-logo { padding: 24px 20px 20px; }
.nav-btn {
  padding: 10px 11px;
  transition: background .15s, color .15s, transform .15s, border-color .15s;
}
.nav-btn:hover { transform: translateX(1px); }
.nav-btn.active {
  background: linear-gradient(90deg, rgba(224,159,79,0.20), rgba(224,159,79,0.06));
}
.kpi-bar {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  background: rgba(255,255,255,0.07);
}
.kpi-card {
  background: linear-gradient(180deg, rgba(21,31,48,.96), rgba(13,20,32,.94));
  padding: 20px 24px;
}
.view-title { font-size: 22px; }
.search-input,
.field input,
.field select,
.field textarea {
  background: rgba(255,255,255,0.055);
  border-color: rgba(255,255,255,0.10);
}
.filter-tab,
.btn,
.field input,
.field select,
.field textarea { border-radius: 7px; }
.btn { transition: background .15s, box-shadow .15s, opacity .15s, transform .15s, border-color .15s, color .15s; }
.btn-primary {
  background: linear-gradient(135deg, #F4C98E, #E09F4F 48%, #B97831);
  box-shadow: 0 10px 28px -18px rgba(224,159,79,0.9);
}
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #FFE0A3, #E09F4F 52%, #C47E2E);
  transform: translateY(-1px);
}
.btn-ghost { background: rgba(255,255,255,0.03); }
.data-table-wrap {
  background: rgba(17,27,42,0.78);
  box-shadow: 0 18px 44px -32px rgba(0,0,0,.9);
}
.data-table-wrap thead {
  background: linear-gradient(180deg, rgba(52,63,80,0.78), rgba(39,50,66,0.78));
}
.data-table-wrap tbody tr:hover { background: rgba(224,159,79,0.055); }

.eyebrow {
  color: var(--gold-light);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .16em;
  margin: 0 0 8px;
  text-transform: uppercase;
}
.overview-hero {
  align-items: center;
  background:
    linear-gradient(135deg, rgba(224,159,79,.16), rgba(104,167,255,.09) 52%, rgba(74,222,128,.06)),
    rgba(255,255,255,.035);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-deep);
  display: grid;
  gap: 20px;
  grid-template-columns: 1fr auto;
  margin-bottom: 18px;
  padding: 24px;
}
.overview-hero h1 {
  color: var(--text);
  font-family: var(--font-h);
  font-size: 34px;
  letter-spacing: -0.04em;
  line-height: 1.05;
}
.overview-copy {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 8px;
  max-width: 560px;
}
.overview-hero-metric {
  background: rgba(5,9,16,.48);
  border: 1px solid rgba(224,159,79,.24);
  border-radius: 12px;
  min-width: 220px;
  padding: 18px;
  text-align: right;
}
.overview-hero-metric span,
.finance-card span,
.client-finance-strip span,
.contact-card span {
  color: var(--text-muted);
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.overview-hero-metric strong {
  color: var(--gold-light);
  display: block;
  font-family: var(--font-mono);
  font-size: 27px;
  margin-top: 6px;
}
.finance-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 18px;
}
.finance-card,
.premium-section {
  background: linear-gradient(180deg, rgba(255,255,255,.045), rgba(255,255,255,.018));
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 20px 50px -38px rgba(0,0,0,.95);
}
.finance-card {
  min-height: 130px;
  overflow: hidden;
  padding: 18px;
  position: relative;
}
.finance-card::after {
  background: var(--blue-glow);
  border-radius: 999px;
  content: '';
  height: 80px;
  position: absolute;
  right: -35px;
  top: -35px;
  width: 80px;
}
.finance-card--gold::after { background: var(--gold-glow); }
.finance-card--alert::after { background: var(--red-glow); }
.finance-card strong {
  color: var(--text);
  display: block;
  font-family: var(--font-mono);
  font-size: 28px;
  letter-spacing: -0.04em;
  margin-top: 12px;
}
.finance-card--gold strong { color: var(--gold-light); }
.finance-card small {
  color: var(--text-muted);
  display: block;
  font-size: 12px;
  margin-top: 8px;
}
.overview-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr);
}
.premium-section { padding: 18px; }
.section-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.section-head.compact { margin-bottom: 0; }
.section-head h2 {
  font-family: var(--font-h);
  font-size: 18px;
  letter-spacing: -0.03em;
}
.soft-count {
  align-items: center;
  background: rgba(255,255,255,.05);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--gold-light);
  display: inline-flex;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  height: 30px;
  justify-content: center;
  min-width: 30px;
  padding: 0 10px;
}
.mini-invoice-list,
.ops-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mini-invoice-row,
.ops-list div {
  align-items: center;
  background: rgba(255,255,255,.03);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px;
}
.mini-invoice-row strong,
.ops-list strong {
  color: var(--text);
  font-family: var(--font-mono);
}
.mini-invoice-row span,
.ops-list span {
  color: var(--text-muted);
  display: block;
  font-size: 12px;
  margin-top: 2px;
}

.panel-overlay {
  background: rgba(2,6,12,0.68);
  backdrop-filter: blur(8px);
}
.panel {
  background: linear-gradient(180deg, rgba(255,255,255,0.045), rgba(255,255,255,0)), #101927;
  padding: 26px;
  width: min(860px, 100vw);
}
.client-hero {
  background:
    linear-gradient(135deg, rgba(224,159,79,0.18), rgba(104,167,255,0.08) 54%, rgba(74,222,128,0.05)),
    rgba(255,255,255,0.035);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin: -4px -4px 0;
  padding: 22px;
}
.panel-name {
  font-size: 24px;
  letter-spacing: -0.03em;
}
.panel-section {
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}
.panel-section-title {
  border-bottom: 0;
  padding-bottom: 0;
}
.client-panel-tabs {
  background: rgba(4,8,14,0.58);
  border-radius: 10px;
}
.client-tab:hover,
.client-tab.active {
  background: linear-gradient(135deg, rgba(224,159,79,.20), rgba(224,159,79,.08));
}
.client-finance-strip {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.client-finance-strip div,
.contact-card {
  background: rgba(255,255,255,.035);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 12px;
}
.client-finance-strip strong {
  color: var(--gold-light);
  display: block;
  font-family: var(--font-mono);
  font-size: 18px;
  margin-top: 6px;
}
.contact-card-grid,
.edit-grid,
.client-admin-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.contact-card strong {
  color: var(--text);
  display: block;
  font-size: 13px;
  margin-top: 6px;
  overflow-wrap: anywhere;
}
.invoice-summary-card,
.invoice-item,
.activity-item,
.telegram-review-card,
.call-item,
.pipeline-card {
  background: rgba(255,255,255,.035);
  border-color: rgba(255,255,255,.10);
}
.invoice-item {
  border-radius: 12px;
  padding: 14px;
}
.invoice-status-cancelled {
  background: rgba(248,113,113,.12);
  border-color: rgba(248,113,113,.35);
  color: #FCA5A5;
}
.invoice-status-sent { color: var(--gold-light); }
.invoice-status-partially-paid { color: #FCD34D; }
.activity-item {
  border-radius: 11px;
  grid-template-columns: 14px 1fr;
  padding: 12px;
}
.activity-dot {
  box-shadow: 0 0 0 4px rgba(224,159,79,.10);
}
.activity-payment .activity-dot,
.activity-receipt .activity-dot { background: var(--green); box-shadow: 0 0 0 4px var(--green-glow); }
.activity-invoice .activity-dot { background: var(--blue); box-shadow: 0 0 0 4px var(--blue-glow); }
.service-pill {
  background: rgba(224,159,79,.10);
  border-color: rgba(224,159,79,.28);
}

/* ── RESPONSIVE ── */
@media (min-width: 781px) and (max-width: 1180px) {
  :root { --sidebar-w: 86px; }
  .sidebar-logo {
    font-size: 0;
    padding: 18px 12px;
    text-align: center;
  }
  .sidebar-logo::before {
    content: 'NM';
    color: var(--text);
    font-family: var(--font-h);
    font-size: 18px;
    font-weight: 900;
  }
  .sidebar-logo::after {
    content: 'AI';
    color: var(--gold);
    display: block;
    font-family: var(--font-h);
    font-size: 12px;
    font-weight: 900;
    margin-top: 2px;
  }
  .sidebar-logo small,
  .nav-section-label,
  .nav-btn span:not(.nav-badge),
  .sidebar-user,
  .sidebar-user-name,
  .header-logout {
    display: none;
  }
  .sidebar-nav { padding: 12px 8px; }
  .nav-btn {
    justify-content: center;
    min-height: 44px;
    padding: 10px;
  }
  .nav-btn svg {
    height: 18px;
    width: 18px;
  }
  .nav-badge {
    margin-left: 0;
    position: absolute;
    right: 8px;
    top: 6px;
  }
  .sidebar-footer { padding: 10px; }
  .app-content { padding: 20px; }
  .kpi-bar { grid-template-columns: repeat(3, 1fr); }
  .finance-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .overview-grid { grid-template-columns: 1fr; }
  .client-finance-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .data-table-wrap { overflow-x: auto; }
  .panel {
    width: min(520px, calc(100vw - var(--sidebar-w)));
  }
}

@media (max-width: 780px) {
  .app-shell { flex-direction: column; }
  .sidebar {
    width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
    flex-direction: row;
    overflow-x: auto;
  }
  .sidebar-logo { display: none; }
  .sidebar-nav {
    display: flex;
    flex-direction: row;
    padding: 8px;
    gap: 4px;
    overflow-x: auto;
  }
  .nav-section-label { display: none; }
  .nav-btn { white-space: nowrap; border-left: none; border-bottom: 3px solid transparent; border-radius: 6px 6px 0 0; }
  .nav-btn.active { border-left-color: transparent; border-bottom-color: var(--gold); }
  .sidebar-footer { display: none; }
  .kpi-bar { grid-template-columns: 1fr 1fr; }
  .kpi-card--chart {
    grid-column: 1 / -1;
    order: 5;
  }
  .kpi-card:nth-child(5) { order: 4; }
  .chart-legend {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .chart-legend-item {
    white-space: normal;
    word-break: break-word;
  }
  .app-content { padding: 16px; }
  .overview-hero,
  .overview-grid,
  .finance-grid,
  .client-finance-strip,
  .contact-card-grid,
  .edit-grid,
  .client-admin-grid {
    grid-template-columns: 1fr;
  }
  .overview-hero h1 { font-size: 27px; }
  .overview-hero-metric { min-width: 0; text-align: left; }
  .login-brand { display: none; }
  .login-card { padding: 40px 24px; }
  .pipeline-wrap { min-height: 50vh; }
  .panel {
    width: 100vw;
    padding: 18px;
  }
  .client-panel-tabs {
    top: -18px;
    grid-template-columns: repeat(5, minmax(74px, 1fr));
    overflow-x: auto;
  }
  .client-tab {
    padding-inline: 8px;
  }
  .invoice-summary-grid {
    grid-template-columns: 1fr;
  }
  .telegram-review-card {
    grid-template-columns: 1fr;
  }
}

/* Nav badge */
.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--gold);
  color: #000;
  font-size: 10px;
  font-weight: 700;
  margin-left: auto;
  font-family: var(--font-mono);
}

/* Bulk toolbar */
.bulk-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--text-muted);
}
.bulk-toolbar select {
  background: var(--surface-3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
}

/* Renewal banner */
.renewal-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  margin-bottom: 12px;
  background: rgba(224, 159, 79, 0.12);
  border: 1px solid rgba(224, 159, 79, 0.35);
  border-radius: 8px;
  color: var(--gold-light);
  font-size: 13px;
}

/* ── Calendar ── */
.cal-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}
.cal-month-label {
  font-size: 14px;
  font-weight: 600;
  min-width: 130px;
  text-align: center;
  color: var(--text);
}
.cal-legend {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  margin-left: auto;
}
.cal-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.cal-dot--calcom   { background: #E09F4F; }
.cal-dot--airtable { background: #4F8EE0; }
.cal-loading {
  padding: 24px;
  color: var(--text-muted);
  font-size: 13px;
}
.cal-grid-wrap { overflow-x: auto; }
.cal-dow-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-bottom: 1px solid var(--border);
}
.cal-dow {
  padding: 8px 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  text-align: center;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-left: 1px solid var(--border);
  border-top: 1px solid var(--border);
}
.cal-cell {
  min-height: 80px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 6px 4px 4px;
  cursor: pointer;
  transition: background .12s;
}
.cal-cell:hover { background: rgba(255,255,255,.03); }
.cal-cell.dim .cal-cell-num { opacity: .3; }
.cal-cell.today .cal-cell-num {
  background: var(--gold);
  color: #000;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}
.cal-cell-num {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  line-height: 1;
  margin-bottom: 4px;
}
.cal-events { display: flex; flex-direction: column; gap: 2px; }
.cal-evt {
  font-size: 10px;
  border-radius: 3px;
  padding: 1px 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}
.cal-evt--calcom   { background: #E09F4F; color: #000; }
.cal-evt--airtable { background: #4F8EE0; color: #fff; }
.cal-evt--more { font-size: 10px; color: var(--text-muted); padding: 0 4px; }
.cal-popover {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 300px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,.4);
  z-index: 200;
}
.cal-popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}
.cal-popover-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 0;
}
.cal-popover-body {
  padding: 12px 16px;
  max-height: 280px;
  overflow-y: auto;
}
.cal-popover-evt {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  border-radius: 6px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: opacity .12s;
}
.cal-popover-evt:hover { opacity: .8; }
.cal-popover-evt--calcom   { background: rgba(224,159,79,.12); border-left: 3px solid #E09F4F; }
.cal-popover-evt--airtable { background: rgba(79,142,224,.12); border-left: 3px solid #4F8EE0; }
.cal-popover-evt-title { font-size: 13px; font-weight: 600; color: var(--text); }
.cal-popover-evt-time  { font-size: 11px; color: var(--text-muted); }
.cal-popover-evt-name  { font-size: 11px; color: var(--text-muted); }
.cal-popover-empty { font-size: 13px; color: var(--text-muted); padding: 8px 0; }
@media (max-width: 640px) {
  .cal-cell { min-height: 52px; }
  .cal-evt  { display: none; }
  .cal-cell[data-has-events="true"]::after {
    content: '';
    display: block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--gold);
    margin: 2px auto 0;
  }
  .cal-popover { right: 12px; left: 12px; width: auto; }
  .cal-legend  { display: none; }
}

/* ── Reporting ── */
.reporting-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 4px 0 16px;
}
.report-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}
.report-card--wide { grid-column: 1 / -1; }
.report-card-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 12px;
}
.reporting-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  padding-bottom: 16px;
}
.report-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
}
.report-stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--gold);
}
.report-stat-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}
@media (max-width: 640px) {
  .reporting-grid { grid-template-columns: 1fr; }
  .report-card--wide { grid-column: 1; }
}

/* ── Tasks ── */
.tasks-group { margin-bottom: 20px; }
.tasks-group-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  padding: 6px 0 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}
.tasks-group-label.overdue { color: #EF4444; }
.tasks-group-label.today   { color: var(--gold); }
.task-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background .12s;
}
.task-row:hover { background: rgba(255,255,255,.04); }
.task-done-btn {
  flex-shrink: 0;
  width: 18px; height: 18px;
  border: 2px solid var(--border-md);
  border-radius: 4px;
  background: none;
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.task-done-btn:hover { border-color: var(--gold); background: rgba(224,159,79,.15); }
.task-info { flex: 1; min-width: 0; }
.task-title { font-size: 13px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-lead  { font-size: 11px; color: var(--text-muted); }
.task-date  { font-size: 11px; color: var(--text-muted); flex-shrink: 0; }
.task-date.overdue { color: #EF4444; font-weight: 600; }
.task-date.today   { color: var(--gold); font-weight: 600; }
