/* LeadsFire palette (leadsfire.com) */
:root {
  --bg: #0a0a0f;
  --bg-card: #12121a;
  --bg-elevated: #1a1a26;
  --border: rgba(255, 255, 255, 0.08);
  --text: #e8e8ed;
  --text-secondary: #8888a0;
  --text-muted: #55556a;
  --fire: #ff6b35;
  --fire-light: #ff8c5a;
  --fire-glow: rgba(255, 107, 53, 0.15);
  --ember: #ff4500;
  --gold: #ffa726;
  --blue: #4fc3f7;
  --green: #66bb6a;
  --purple: #ab47bc;
  --red: #ef5350;
  --radius: 16px;
  --radius-sm: 10px;

  /* Legacy aliases used throughout the app; --primary can be overridden by the brand_primary_color setting. */
  --primary: var(--fire);
  --card: var(--bg-card);
  --line: var(--border);
  --muted: var(--text-secondary);
}

* { box-sizing: border-box; }
body, body.app-body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; color: var(--text); background: radial-gradient(circle at top right, rgba(255, 107, 53, 0.10) 0%, var(--bg) 45%), var(--bg); }

/* Brand */
.logo { display: inline-flex; align-items: center; gap: .5rem; color: var(--text); text-decoration: none; }
.logo:hover { color: var(--text); }
.flame-icon { width: 26px; height: 26px; color: var(--fire); flex-shrink: 0; filter: drop-shadow(0 0 6px var(--fire-glow)); }
.logo-text { font-family: 'Outfit', sans-serif; font-size: 1.3rem; letter-spacing: 1.5px; text-transform: lowercase; font-weight: 700; line-height: 1; }
.logo-text span { color: var(--fire); }
.brand-company { font-size: .8rem; color: var(--text-secondary); margin-top: .35rem; }

.app-shell { min-height: 100vh; display: flex; }
.sidebar { width: 240px; background: var(--bg-card); border-right: 1px solid var(--border); position: sticky; top: 0; height: 100vh; flex-shrink: 0; overflow-y: auto; }
.main { flex: 1; min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 0.75rem 1.5rem; border-bottom: 1px solid var(--border); background: rgba(10, 10, 15, 0.8); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 20; }

.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); }
.field { width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .55rem .75rem; color: var(--text); font-size: .875rem; }
.field::placeholder { color: var(--text-muted); }
.field:focus { outline: 2px solid var(--fire-glow); border-color: var(--primary); }
select.field { appearance: auto; }

.btn, .btn-primary, .btn-danger { border-radius: var(--radius-sm); padding: .45rem .85rem; border: 1px solid var(--border); font-size: .85rem; cursor: pointer; transition: all 0.15s; }
.btn { background: var(--bg-elevated); color: var(--text); }
.btn:hover { background: #22222f; border-color: rgba(255, 255, 255, 0.14); }
.btn-primary { background: linear-gradient(90deg, var(--ember), var(--primary)); color: #fff; border-color: transparent; font-weight: 600; box-shadow: 0 4px 14px var(--fire-glow); }
.btn-primary:hover { background: linear-gradient(90deg, var(--primary), var(--fire-light)); }
.btn-danger { background: rgba(239, 83, 80, 0.12); color: #ffb3b1; border-color: rgba(239, 83, 80, 0.4); }
.btn-danger:hover { background: rgba(239, 83, 80, 0.28); }
.btn-sm { padding: .25rem .55rem; font-size: .75rem; }

.nav-link { display: block; padding: .4rem .75rem; border-radius: 9px; color: var(--text-secondary); font-size: .85rem; text-decoration: none; transition: background 0.15s, color 0.15s; }
.nav-link:hover { background: var(--bg-elevated); color: var(--text); }
.nav-link.active { background: var(--fire-glow); color: var(--fire-light); }

.table-wrap { overflow: auto; }
.table { width: 100%; border-collapse: collapse; min-width: 640px; }
.table th, .table td { border-bottom: 1px solid var(--border); padding: .55rem .5rem; text-align: left; font-size: .85rem; }
.table th { color: var(--text-secondary); font-weight: 600; font-size: .8rem; }
.table tr:hover { background: var(--bg-elevated); }

.badge { font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; border: 1px solid rgba(255, 107, 53, 0.4); border-radius: 9999px; padding: .15rem .45rem; color: var(--fire-light); background: rgba(255, 107, 53, 0.08); display: inline-block; }
.badge-green { color: #9ad69d; border-color: rgba(102, 187, 106, 0.5); background: rgba(102, 187, 106, 0.15); }
.badge-red { color: #ffb3b1; border-color: rgba(239, 83, 80, 0.5); background: rgba(239, 83, 80, 0.15); }
.badge-yellow { color: #ffcf7a; border-color: rgba(255, 167, 38, 0.5); background: rgba(255, 167, 38, 0.15); }
.badge-purple { color: #d2a0dd; border-color: rgba(171, 71, 188, 0.5); background: rgba(171, 71, 188, 0.15); }
.badge-cyan { color: #9adcfb; border-color: rgba(79, 195, 247, 0.5); background: rgba(79, 195, 247, 0.15); }

.tab { border: 1px solid var(--border); background: var(--bg-elevated); color: var(--text); border-radius: 8px; padding: .4rem .75rem; cursor: pointer; font-size: .85rem; }
.tab.active { background: var(--fire-glow); color: var(--fire-light); border-color: rgba(255, 107, 53, 0.4); }

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace; }

.modal { border: 1px solid var(--border); background: var(--bg-card); color: var(--text); border-radius: var(--radius); width: min(560px, 92vw); max-height: 85vh; overflow-y: auto; }
.modal::backdrop { background: rgba(0, 0, 0, 0.7); }

.toast { position: fixed; right: 1rem; bottom: 1rem; background: #10231a; border: 1px solid rgba(102, 187, 106, 0.5); color: #b9e6bb; padding: .55rem .85rem; border-radius: var(--radius-sm); z-index: 999; font-size: .875rem; animation: slideIn 0.2s ease; }
.toast-error { background: #2a1212; border-color: rgba(239, 83, 80, 0.5); color: #ffb3b1; }

@keyframes slideIn {
  from { transform: translateY(10px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* KPI cards */
.kpi-card { padding: 1rem; }
.kpi-card .kpi-value { font-size: 1.5rem; font-weight: 700; }
.kpi-card .kpi-label { font-size: .75rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .04em; }

/* Pagination */
.pagination { display: flex; align-items: center; gap: 0.5rem; font-size: .85rem; }
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }

/* Tab panels */
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Integration card */
.integration-card { transition: border-color 0.15s; }
.integration-card:hover { border-color: var(--primary); }

/* Notification unread */
.notif-unread { border-left: 3px solid var(--primary); }

/* Responsive */
@media (max-width: 1024px) {
  .sidebar { width: 200px; }
}

@media (max-width: 760px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; max-height: none; }
  .sidebar nav { display: flex; flex-wrap: wrap; gap: 0.25rem; max-height: none !important; }
  .sidebar nav > div { display: none; }
  .nav-link { padding: .35rem .5rem; font-size: .75rem; white-space: nowrap; }
  .topbar { position: static; flex-wrap: wrap; gap: 0.5rem; }
  .table { min-width: 500px; }
  .modal { width: 95vw; }
}

@media (max-width: 480px) {
  section { padding: 0.75rem !important; }
  .kpi-card .kpi-value { font-size: 1.15rem; }
}
