/* ============================================================
   DASHBOARD.CSS — DJM Agents LeadFlow
   Design system identique à l'app agence (theme-new.css)
   ============================================================ */

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

/* ── DESIGN TOKENS ─────────────────────────────────────────── */
:root {
  --bg:                  #0c0e0f;
  --surface:             #121415;
  --surface-low:         #1a1c1d;
  --surface-mid:         #1e2021;
  --surface-high:        #282a2b;
  --surface-highest:     #333536;
  --on-surface:          #e2e2e3;
  --on-surface-muted:    #bbc9cf;
  --outline:             #859398;
  --outline-dim:         #3c494e;
  --primary:             #00d4ff;
  --primary-dim:         #3cd7ff;
  --primary-soft:        rgba(0, 212, 255, 0.08);
  --primary-glow:        rgba(0, 212, 255, 0.15);
  --secondary:           #ffb695;
  --secondary-dark:      #923900;
  --error-new:           #ffb4ab;
  --success:             #4ade80;

  --radius-sm:   0.25rem;
  --radius:      0.5rem;
  --radius-md:   0.75rem;
  --radius-lg:   1rem;
  --radius-xl:   1.5rem;
  --radius-full: 9999px;

  --font-head: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;

  --sidebar-w: 220px;
  --topbar-h:  56px;
}

/* ── BASE ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--bg);
  color: var(--on-surface);
  font-family: var(--font-body);
  font-size: 15px;
  height: 100%;
  overflow: hidden;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: var(--font-body); }

/* ── SCROLLBAR ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--outline-dim); border-radius: 2px; }

/* ── APP SHELL ─────────────────────────────────────────────── */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  height: 100vh;
  width: 100%;
  position: fixed;
  inset: 0;
}

/* ── TOPBAR ────────────────────────────────────────────────── */
.tn-topbar {
  grid-column: 1 / -1;
  grid-row: 1;
  background: var(--surface);
  border-bottom: 1px solid var(--outline-dim);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  position: relative;
  z-index: 200;
  flex-shrink: 0;
}

.tn-topbar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  width: var(--sidebar-w);
  padding-right: 16px;
  border-right: 1px solid var(--outline-dim);
  flex-shrink: 0;
  min-width: 0;
}

.tn-logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--primary), #0066ff);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 11px;
  color: #001f27;
  flex-shrink: 0;
  box-shadow: 0 0 12px rgba(0, 212, 255, 0.3);
}

.tn-logo-text {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 12px;
  line-height: 1.2;
  color: var(--primary);
  white-space: nowrap;
}

.tn-logo-sub {
  font-size: 9px;
  color: var(--on-surface-muted);
  font-weight: 400;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.tn-topbar-search {
  flex: 1;
  max-width: 320px;
  background: var(--surface-mid);
  border: 1px solid var(--outline-dim);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  height: 32px;
  transition: border-color 0.15s;
}

.tn-topbar-search:focus-within {
  border-color: var(--primary);
}

.tn-topbar-search input {
  background: none;
  border: none;
  outline: none;
  color: var(--on-surface);
  font-family: var(--font-body);
  font-size: 13px;
  flex: 1;
}

.tn-topbar-search input::placeholder { color: var(--outline); }
.tn-topbar-search svg { color: var(--outline); flex-shrink: 0; }

.tn-topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tn-topbar-sep {
  width: 1px;
  height: 20px;
  background: var(--outline-dim);
  flex-shrink: 0;
}

/* ── BOUTONS ────────────────────────────────────────────────── */
.tn-btn {
  height: 32px;
  min-width: 32px;
  border-radius: var(--radius);
  background: var(--surface-mid);
  border: 1px solid var(--outline-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--on-surface-muted);
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  gap: 6px;
  padding: 0 10px;
  white-space: nowrap;
}

.tn-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}

.tn-btn-icon {
  padding: 0;
  width: 32px;
  min-width: 32px;
}

.tn-btn-sm {
  padding: 5px 12px;
  height: 28px;
  background: var(--surface-mid);
  border: 1px solid var(--outline-dim);
  border-radius: var(--radius);
  color: var(--on-surface-muted);
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: border-color 0.15s, color 0.15s;
  white-space: nowrap;
}

.tn-btn-sm:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.tn-btn-sm:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.tn-btn-primary {
  padding: 7px 16px;
  height: auto;
  background: var(--primary);
  border: none;
  border-radius: var(--radius);
  color: #001f27;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s, box-shadow 0.15s;
  box-shadow: 0 0 14px rgba(0, 212, 255, 0.18);
  white-space: nowrap;
}

.tn-btn-primary:hover {
  background: #33ddff;
  box-shadow: 0 0 22px rgba(0, 212, 255, 0.32);
}

.tn-btn-danger {
  padding: 5px 12px;
  height: 28px;
  background: rgba(255, 180, 171, 0.1);
  border: 1px solid var(--error-new);
  border-radius: var(--radius);
  color: var(--error-new);
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: background 0.15s;
}

.tn-btn-danger:hover {
  background: rgba(255, 180, 171, 0.18);
}

/* ── USER CHIP ───────────────────────────────────────────────── */
.tn-user-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 3px 10px 3px 3px;
  background: var(--surface-mid);
  border: 1px solid var(--outline-dim);
  border-radius: var(--radius-full);
}

.tn-user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #0066ff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #001f27;
  flex-shrink: 0;
}

.tn-user-email {
  font-size: 12px;
  color: var(--on-surface-muted);
  white-space: nowrap;
}

/* ── SIDEBAR ────────────────────────────────────────────────── */
.tn-sidebar {
  grid-column: 1;
  grid-row: 2;
  background: var(--surface);
  border-right: 1px solid var(--outline-dim);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 0;
}

.tn-nav-section {
  padding: 0 10px;
  margin-bottom: 4px;
}

.tn-nav-label {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--outline);
  padding: 8px 8px 4px;
}

.tn-nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--on-surface-muted);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-body);
  transition: background 0.12s, color 0.12s;
  position: relative;
  text-decoration: none;
  border: 1px solid transparent;
  line-height: 1.3;
  margin-bottom: 2px;
}

.tn-nav-item:hover {
  background: var(--surface-mid);
  color: var(--on-surface);
}

.tn-nav-item.active {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: rgba(0, 212, 255, 0.15);
}

.tn-nav-item.active::before {
  content: '';
  position: absolute;
  left: -1px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--primary);
  border-radius: 0 2px 2px 0;
  box-shadow: 0 0 8px var(--primary);
}

.nav-emoji {
  font-size: 16px;
  flex-shrink: 0;
  width: 20px;
  text-align: center;
}

.tn-nav-divider {
  height: 1px;
  background: var(--outline-dim);
  margin: 6px 0;
}

.tn-nav-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  background: var(--error-new);
  color: #001f27;
  flex-shrink: 0;
  min-width: 18px;
  text-align: center;
}

.tn-sidebar-footer {
  margin-top: auto;
  padding: 12px 10px 6px;
  border-top: 1px solid var(--outline-dim);
}

.tn-sidebar-footer-text {
  font-size: 10px;
  color: var(--outline);
  text-align: center;
  line-height: 1.6;
}

/* ── MAIN CONTENT ───────────────────────────────────────────── */
.tn-main {
  grid-column: 2;
  grid-row: 2;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg);
  padding: 28px 32px;
}

/* ── PAGE HEADER ─────────────────────────────────────────────── */
.tn-page-header {
  margin-bottom: 24px;
}

.tn-page-title {
  font-family: var(--font-head);
  font-size: 26px;
  font-weight: 700;
  color: var(--on-surface);
  letter-spacing: -0.01em;
  line-height: 1.1;
}

.tn-page-subtitle {
  font-size: 13px;
  color: var(--on-surface-muted);
  margin-top: 4px;
}

/* ── KPI CARDS ──────────────────────────────────────────────── */
.tn-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.tn-kpi-card {
  background: var(--surface);
  border: 1px solid var(--outline-dim);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s, transform 0.2s;
  animation: tn-fadeUp 0.4s ease both;
}

.tn-kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--primary), transparent);
}

.tn-kpi-card:hover {
  border-color: rgba(0, 212, 255, 0.25);
  transform: translateY(-1px);
}

.tn-kpi-card.secondary::before { background: linear-gradient(90deg, var(--secondary), transparent); }
.tn-kpi-card.error::before     { background: linear-gradient(90deg, var(--error-new), transparent); }
.tn-kpi-card.success::before   { background: linear-gradient(90deg, var(--success), transparent); }

.tn-kpi-card:nth-child(1) { animation-delay: 0.05s; }
.tn-kpi-card:nth-child(2) { animation-delay: 0.10s; }
.tn-kpi-card:nth-child(3) { animation-delay: 0.15s; }
.tn-kpi-card:nth-child(4) { animation-delay: 0.20s; }

.tn-kpi-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 10px;
}

.tn-kpi-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--on-surface-muted);
}

.tn-kpi-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 16px;
}

.tn-kpi-icon.cyan   { background: rgba(0, 212, 255, 0.12); }
.tn-kpi-icon.orange { background: rgba(255, 182, 149, 0.12); }
.tn-kpi-icon.red    { background: rgba(255, 180, 171, 0.12); }
.tn-kpi-icon.green  { background: rgba(74, 222, 128, 0.12); }

.tn-kpi-value {
  font-family: var(--font-head);
  font-size: 30px;
  font-weight: 700;
  color: var(--on-surface);
  line-height: 1;
  letter-spacing: -0.02em;
}

.tn-kpi-trend {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 7px;
}

.tn-kpi-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: var(--radius-full);
}

.tn-kpi-badge.up      { background: rgba(74, 222, 128, 0.1); color: var(--success); }
.tn-kpi-badge.neutral { background: var(--surface-high); color: var(--outline); }
.tn-kpi-badge.down    { background: rgba(255, 180, 171, 0.1); color: var(--error-new); }

.tn-kpi-trend-text { font-size: 10px; color: var(--outline); }

/* ── PANELS ─────────────────────────────────────────────────── */
.tn-panel {
  background: var(--surface);
  border: 1px solid var(--outline-dim);
  border-radius: var(--radius-lg);
  overflow: hidden;
  animation: tn-fadeUp 0.4s ease both;
  animation-delay: 0.2s;
  margin-bottom: 20px;
}

.tn-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--outline-dim);
}

.tn-panel-title {
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 600;
  color: var(--on-surface);
}

.tn-panel-body {
  padding: 18px;
}

/* ── CHART ──────────────────────────────────────────────────── */
.tn-chart-wrap {
  position: relative;
  height: 220px;
}

/* ── TABLES ─────────────────────────────────────────────────── */
.lf-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.lf-table th {
  background: var(--surface-high);
  color: var(--on-surface-muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--outline-dim);
}

.lf-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--outline-dim);
  color: var(--on-surface);
  vertical-align: middle;
}

.lf-table tbody tr:last-child td {
  border-bottom: none;
}

.lf-table tbody tr:hover td {
  background: var(--surface-mid);
}

/* ── AGENT CARDS GRID ────────────────────────────────────────── */
.lf-agents-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  animation: tn-fadeUp 0.4s ease both;
}

.lf-agent-card {
  background: var(--surface);
  border: 1px solid var(--outline-dim);
  border-radius: var(--radius-lg);
  padding: 28px 20px 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s, transform 0.2s;
  cursor: default;
}

.lf-agent-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--primary), transparent);
}

.lf-agent-card:hover {
  border-color: rgba(0, 212, 255, 0.3);
  transform: translateY(-2px);
}

.lf-agent-avatar {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-lg);
  background: var(--surface-mid);
  border: 1px solid var(--outline-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  flex-shrink: 0;
}

.lf-agent-name {
  font-family: var(--font-head);
  font-size: 18px;
  font-weight: 700;
  color: var(--on-surface);
  line-height: 1.1;
}

.lf-agent-role {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--secondary);
}

.lf-agent-status {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  display: inline-block;
}

.lf-agent-status.active {
  background: rgba(0, 212, 255, 0.1);
  color: var(--primary);
  border: 1px solid rgba(0, 212, 255, 0.2);
}

.lf-agent-status.inactive {
  background: rgba(255, 182, 149, 0.1);
  color: var(--secondary);
  border: 1px solid rgba(255, 182, 149, 0.2);
}

.lf-agent-status.loading {
  background: var(--surface-high);
  color: var(--outline);
  border: 1px solid var(--outline-dim);
}

/* Skeleton agent card */
.lf-agent-card.lf-skeleton {
  min-height: 180px;
}

.lf-agent-card.lf-skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.03) 50%, transparent 100%);
  background-size: 200% 100%;
  animation: lf-shimmer 1.4s infinite;
}

/* ── FILTER PILLS ─────────────────────────────────────────── */
.lf-filter-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.lf-pill {
  padding: 5px 14px;
  border-radius: var(--radius-full);
  background: var(--surface-mid);
  border: 1px solid var(--outline-dim);
  color: var(--on-surface-muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.lf-pill:hover {
  border-color: var(--outline);
  color: var(--on-surface);
}

.lf-pill.active {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
}

/* ── SCORE BADGES ─────────────────────────────────────────── */
.lf-score {
  display: inline-block;
  min-width: 36px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  font-family: var(--font-head);
}

.lf-score.good { background: rgba(74, 222, 128, 0.12); color: var(--success); }
.lf-score.warn { background: rgba(255, 182, 149, 0.12); color: var(--secondary); }
.lf-score.bad  { background: rgba(255, 180, 171, 0.12); color: var(--error-new); }

/* ── STATUS BADGES ────────────────────────────────────────── */
.lf-status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.lf-status-badge.new         { background: rgba(0,212,255,0.1);  color: var(--primary); }
.lf-status-badge.qualified   { background: rgba(74,222,128,0.1); color: var(--success); }
.lf-status-badge.contacted   { background: rgba(255,182,149,0.1);color: var(--secondary); }
.lf-status-badge.replied     { background: rgba(167,139,250,0.1);color: #a78bfa; }
.lf-status-badge.closed,
.lf-status-badge.won         { background: rgba(74,222,128,0.15);color: var(--success); }
.lf-status-badge.rejected,
.lf-status-badge.lost        { background: rgba(255,180,171,0.1);color: var(--error-new); }
.lf-status-badge.enriched    { background: rgba(99,179,237,0.1); color: #63b3ed; }

/* ── PAGINATION ──────────────────────────────────────────── */
.lf-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid var(--outline-dim);
}

.lf-page-info {
  font-size: 12px;
  color: var(--on-surface-muted);
}

/* ── WORKFLOW ACTIONS LIST ────────────────────────────────── */
.lf-actions-toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.lf-workflow-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--outline-dim);
  gap: 12px;
}

.lf-workflow-item:last-child {
  border-bottom: none;
}

.lf-workflow-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.lf-workflow-emoji {
  font-size: 20px;
  flex-shrink: 0;
  width: 28px;
  text-align: center;
}

.lf-workflow-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--on-surface);
}

.lf-workflow-role {
  font-size: 11px;
  color: var(--on-surface-muted);
  margin-top: 2px;
}

.lf-workflow-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.lf-workflow-status-text {
  font-size: 12px;
  color: var(--on-surface-muted);
  min-width: 56px;
}

.lf-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  animation: tn-pulse 2s infinite;
}

.lf-status-dot.active  { background: var(--primary); box-shadow: 0 0 6px var(--primary); }
.lf-status-dot.inactive { background: var(--outline); animation: none; }

.lf-toggle-btn {
  padding: 5px 14px;
  border-radius: var(--radius);
  font-size: 11px;
  font-weight: 600;
  border: 1px solid;
  cursor: pointer;
  transition: all 0.15s;
  min-width: 80px;
}

.lf-toggle-btn.on {
  background: rgba(255, 182, 149, 0.08);
  border-color: var(--secondary);
  color: var(--secondary);
}

.lf-toggle-btn.on:hover {
  background: rgba(255, 182, 149, 0.16);
}

.lf-toggle-btn.off {
  background: rgba(0, 212, 255, 0.08);
  border-color: var(--primary);
  color: var(--primary);
}

.lf-toggle-btn.off:hover {
  background: rgba(0, 212, 255, 0.16);
}

/* ── AGE BADGES (errors) ─────────────────────────────────── */
.lf-age-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 600;
}

.lf-age-badge.red    { background: rgba(255,180,171,0.15); color: var(--error-new); }
.lf-age-badge.orange { background: rgba(255,182,149,0.12); color: var(--secondary); }
.lf-age-badge.gray   { background: var(--surface-high); color: var(--outline); }

.lf-badge-ok {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 600;
  background: rgba(74,222,128,0.12);
  color: var(--success);
}

.lf-error-msg {
  max-width: 280px;
  font-size: 12px;
  color: var(--on-surface-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── MODAL ──────────────────────────────────────────────────── */
.lf-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.lf-modal {
  background: var(--surface-low);
  border: 1px solid var(--outline-dim);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 40px rgba(0,0,0,0.6);
  width: 100%;
  max-width: 440px;
  overflow: hidden;
  animation: tn-fadeUp 0.2s ease;
}

.lf-modal-header {
  background: var(--surface);
  border-bottom: 1px solid var(--outline-dim);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.lf-modal-title {
  font-family: var(--font-head);
  font-size: 15px;
  font-weight: 600;
  color: var(--on-surface);
}

.lf-modal-close {
  background: none;
  border: none;
  color: var(--on-surface-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  border-radius: var(--radius-sm);
  transition: color 0.15s;
}

.lf-modal-close:hover { color: var(--on-surface); }

.lf-modal-body {
  padding: 20px 18px;
  font-size: 13px;
  color: var(--on-surface-muted);
  line-height: 1.6;
}

.lf-modal-footer {
  background: var(--surface);
  border-top: 1px solid var(--outline-dim);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

/* ── TOAST ──────────────────────────────────────────────────── */
#toastContainer {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.lf-toast {
  background: var(--surface-mid);
  border: 1px solid var(--outline-dim);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  font-size: 13px;
  color: var(--on-surface);
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  min-width: 200px;
  max-width: 340px;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: lf-toast-in 0.25s ease;
  pointer-events: auto;
}

.lf-toast.success { border-left: 3px solid var(--primary); }
.lf-toast.error   { border-left: 3px solid var(--error-new); }
.lf-toast.warning { border-left: 3px solid var(--secondary); }

.lf-toast-icon { font-size: 14px; flex-shrink: 0; }

/* ── LOADING / EMPTY STATES ─────────────────────────────────── */
.lf-boot-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 16px;
  color: var(--on-surface-muted);
  font-size: 13px;
}

.lf-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--outline-dim);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: lf-spin 0.8s linear infinite;
}

.lf-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px 20px;
  color: var(--on-surface-muted);
  font-size: 13px;
}

.lf-loading::before {
  content: '';
  width: 20px;
  height: 20px;
  border: 2px solid var(--outline-dim);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: lf-spin 0.8s linear infinite;
  flex-shrink: 0;
}

.lf-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--on-surface-muted);
  font-size: 13px;
}

.lf-empty-cell {
  text-align: center;
  color: var(--on-surface-muted);
  font-size: 13px;
  padding: 30px 14px !important;
}

.lf-config-notice {
  background: rgba(255, 182, 149, 0.06);
  border: 1px solid rgba(255, 182, 149, 0.2);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  font-size: 13px;
  color: var(--secondary);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── REFRESH ANIMATION ──────────────────────────────────────── */
.tn-btn-icon.spinning svg {
  animation: lf-spin 0.7s linear infinite;
}

/* ── ANIMATIONS ─────────────────────────────────────────────── */
@keyframes tn-fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes tn-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.45; }
}

@keyframes lf-spin {
  to { transform: rotate(360deg); }
}

@keyframes lf-shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

@keyframes lf-toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── RESPONSIVE ─────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .tn-kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .lf-agents-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  :root { --sidebar-w: 52px; }

  .tn-nav-item span:not(.nav-emoji),
  .tn-nav-label,
  .tn-sidebar-footer-text,
  .tn-nav-badge { display: none; }

  .tn-nav-item { justify-content: center; padding: 9px; gap: 0; }
  .nav-emoji { width: auto; }
  .tn-topbar-logo { width: var(--sidebar-w); padding-right: 8px; }
  .tn-logo-text, .tn-logo-sub { display: none; }
  .tn-user-email { display: none; }
}

@media (max-width: 640px) {
  .tn-main { padding: 16px; }
  .tn-kpi-grid { grid-template-columns: 1fr; }
  .lf-agents-grid { grid-template-columns: 1fr; }
  .tn-topbar-search { display: none; }
}

/* ── INPUT ───────── */
.lf-input {
  width: 100%;
  padding: 9px 12px;
  background: var(--surface-mid);
  border: 1.5px solid var(--outline-dim);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--on-surface);
  font-family: var(--font-body);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.lf-input::placeholder { color: var(--outline); }
.lf-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,212,255,0.08); }
/* ── SIDEBAR SIGNOUT ─ */
.tn-nav-signout {
  background: none;
  border: 1px solid transparent;
  width: 100%;
  text-align: left;
  color: var(--on-surface-muted);
  transition: background 0.12s, color 0.12s;
}
.tn-nav-signout:hover {
  background: rgba(255,180,171,0.06);
  color: var(--error-new);
  border-color: rgba(255,180,171,0.1);
}
