/*
 * ManageLeads — application shell
 *
 * Bootstrap 5 provides the grid and components; this file provides the
 * design tokens, the panel chrome and the dark theme. Everything is driven
 * by CSS custom properties so the three panels differ only by --accent.
 *
 * No build step: Bootstrap and Bootstrap Icons load from CDN, this file is
 * plain CSS. XAMPP users never need npm.
 */

:root {
  --accent:        #e63946;
  --accent-soft:   rgba(230, 57, 70, .12);
  --accent-text:   #ffffff;

  --bg:            #f4f6f9;
  --surface:       #ffffff;
  --surface-2:     #f8fafc;
  --border:        #e3e8ef;
  --text:          #16202c;
  --text-muted:    #6b7a8d;
  --sidebar-bg:    #10171f;
  --sidebar-text:  #9fb0c3;
  --sidebar-hover: rgba(255, 255, 255, .07);
  --sidebar-active-bg: rgba(255, 255, 255, .1);
  --topbar-bg:     #ffffff;

  --radius:        12px;
  --radius-sm:     8px;
  --shadow-sm:     0 1px 2px rgba(16, 23, 31, .06);
  --shadow:        0 2px 10px rgba(16, 23, 31, .07);
  --sidebar-w:     256px;
  --topbar-h:      60px;
}

[data-theme="dark"] {
  --bg:            #0d1117;
  --surface:       #151b23;
  --surface-2:     #1b232d;
  --border:        #262f3b;
  --text:          #e4ecf4;
  --text-muted:    #8b9bad;
  --sidebar-bg:    #0a0e14;
  --sidebar-text:  #8b9bad;
  --topbar-bg:     #151b23;
  --shadow-sm:     0 1px 2px rgba(0, 0, 0, .3);
  --shadow:        0 2px 12px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ──────────────────────────────────────────────────────────── */

.lh-shell { display: flex; min-height: 100vh; }

.lh-sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 1040;
  transition: transform .22s ease;
  overflow: hidden;
}

.lh-sidebar__brand {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
  flex: 0 0 auto;
}
.lh-sidebar__mark {
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--accent); color: #fff;
  display: grid; place-items: center;
  font-weight: 800; font-size: 14px; letter-spacing: -.5px;
}
.lh-sidebar__name { color: #fff; font-weight: 650; font-size: 15px; letter-spacing: -.2px; }
.lh-sidebar__panel { display: block; font-size: 11px; color: var(--sidebar-text); font-weight: 400; }

.lh-sidebar__nav { flex: 1 1 auto; overflow-y: auto; padding: 12px 10px 24px; }
.lh-sidebar__nav::-webkit-scrollbar { width: 6px; }
.lh-sidebar__nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 3px; }

.lh-nav-group {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em;
  color: rgba(255, 255, 255, .34); font-weight: 600;
  padding: 16px 12px 6px;
}

.lh-nav-link {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; margin-bottom: 2px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text); font-size: 13.5px; font-weight: 500;
  transition: background .14s, color .14s;
}
.lh-nav-link:hover { background: var(--sidebar-hover); color: #fff; text-decoration: none; }
.lh-nav-link.is-active { background: var(--sidebar-active-bg); color: #fff; }
.lh-nav-link.is-active::before {
  content: ""; position: absolute; left: 0; width: 3px; height: 22px;
  background: var(--accent); border-radius: 0 3px 3px 0;
}
.lh-nav-link { position: relative; }
.lh-nav-link i { font-size: 15px; width: 18px; text-align: center; opacity: .9; }
.lh-nav-link .badge { margin-left: auto; }

.lh-main {
  flex: 1 1 auto;
  margin-left: var(--sidebar-w);
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.lh-topbar {
  height: var(--topbar-h);
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px;
  padding: 0 22px;
  position: sticky; top: 0; z-index: 1030;
}
.lh-topbar__title { font-weight: 640; font-size: 15.5px; letter-spacing: -.2px; margin: 0; }
.lh-topbar__spacer { flex: 1 1 auto; }

.lh-content { padding: 22px; flex: 1 1 auto; }
.lh-content > .container-fluid { padding: 0; }

.lh-footer {
  padding: 14px 22px; border-top: 1px solid var(--border);
  color: var(--text-muted); font-size: 12.5px;
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}

/* ── Page header ─────────────────────────────────────────────────────── */

.lh-page-head {
  display: flex; align-items: flex-start; gap: 16px;
  flex-wrap: wrap; margin-bottom: 18px;
}
.lh-page-head h1 { font-size: 20px; font-weight: 660; letter-spacing: -.3px; margin: 0 0 2px; }
.lh-page-head p { margin: 0; color: var(--text-muted); font-size: 13px; }
.lh-page-head__actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Cards ───────────────────────────────────────────────────────────── */

.lh-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.lh-card__head {
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
}
.lh-card__head h2, .lh-card__head h3 {
  font-size: 14.5px; font-weight: 640; margin: 0; letter-spacing: -.1px;
}
.lh-card__body { padding: 18px; }
.lh-card__foot { padding: 12px 18px; border-top: 1px solid var(--border); background: var(--surface-2); }

/* ── KPI tiles ───────────────────────────────────────────────────────── */

.lh-kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  display: flex; align-items: center; gap: 14px;
  height: 100%;
}
.lh-kpi__icon {
  width: 42px; height: 42px; border-radius: 11px;
  display: grid; place-items: center; font-size: 18px;
  background: var(--accent-soft); color: var(--accent);
  flex: 0 0 auto;
}
.lh-kpi__label {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-muted); font-weight: 600; margin: 0 0 2px;
}
.lh-kpi__value { font-size: 23px; font-weight: 700; letter-spacing: -.6px; line-height: 1.1; }
.lh-kpi__meta { font-size: 12px; color: var(--text-muted); }

/* ── Tables ──────────────────────────────────────────────────────────── */

.lh-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.lh-table thead th {
  text-align: left; padding: 10px 14px;
  font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-muted); font-weight: 650;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.lh-table tbody td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.lh-table tbody tr:last-child td { border-bottom: 0; }
.lh-table tbody tr:hover { background: var(--surface-2); }
.lh-table__wrap { overflow-x: auto; border-radius: var(--radius); }

/* ── Badges / chips ──────────────────────────────────────────────────── */

.lh-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; line-height: 1.6;
  border: 1px solid transparent; white-space: nowrap;
}
.lh-badge--success { background: rgba(34, 160, 96, .12); color: #1a8951; border-color: rgba(34,160,96,.24); }
.lh-badge--danger  { background: rgba(214, 48, 60, .12);  color: #c02736; border-color: rgba(214,48,60,.24); }
.lh-badge--warning { background: rgba(214, 143, 8, .14);  color: #a86a00; border-color: rgba(214,143,8,.26); }
.lh-badge--info    { background: rgba(29, 120, 214, .12); color: #1568bd; border-color: rgba(29,120,214,.24); }
.lh-badge--secondary { background: rgba(107, 122, 141, .13); color: #5a6a7d; border-color: rgba(107,122,141,.24); }
.lh-badge--dark    { background: rgba(22, 32, 44, .1); color: #2c3a4b; border-color: rgba(22,32,44,.2); }

[data-theme="dark"] .lh-badge--success { color: #56d99a; }
[data-theme="dark"] .lh-badge--danger  { color: #ff7b87; }
[data-theme="dark"] .lh-badge--warning { color: #ffc14d; }
[data-theme="dark"] .lh-badge--info    { color: #6cb4ff; }
[data-theme="dark"] .lh-badge--secondary { color: #9fb0c3; }
[data-theme="dark"] .lh-badge--dark    { color: #c3cfdc; }

.lh-phase-chip {
  font-size: 10px; font-weight: 700; letter-spacing: .04em;
  padding: 1px 6px; border-radius: 5px;
  background: rgba(107, 122, 141, .16); color: var(--text-muted);
}

/* ── Forms ───────────────────────────────────────────────────────────── */

.form-label { font-size: 12.5px; font-weight: 600; margin-bottom: 5px; color: var(--text); }
.form-text  { font-size: 12px; color: var(--text-muted); }

.form-control, .form-select {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  padding: 8px 12px;
}
.form-control:focus, .form-select:focus {
  background: var(--surface);
  color: var(--text);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.form-control::placeholder { color: var(--text-muted); opacity: .7; }
.form-control:disabled, .form-control[readonly] { background: var(--surface-2); opacity: .85; }
.form-check-input:checked { background-color: var(--accent); border-color: var(--accent); }
.form-check-input:focus { box-shadow: 0 0 0 3px var(--accent-soft); border-color: var(--accent); }
.invalid-feedback { font-size: 12px; }
.is-invalid { border-color: #d6303c !important; }

/* ── Buttons ─────────────────────────────────────────────────────────── */

.btn { border-radius: var(--radius-sm); font-size: 13.5px; font-weight: 550; padding: 8px 15px; }
.btn-sm { font-size: 12.5px; padding: 5px 11px; }
.btn-primary {
  background: var(--accent); border-color: var(--accent); color: var(--accent-text);
}
.btn-primary:hover, .btn-primary:focus { filter: brightness(.92); background: var(--accent); border-color: var(--accent); }
.btn-outline-secondary { border-color: var(--border); color: var(--text-muted); }
.btn-outline-secondary:hover { background: var(--surface-2); color: var(--text); border-color: var(--border); }

/* ── Alerts ──────────────────────────────────────────────────────────── */

.alert { border-radius: var(--radius-sm); border-width: 1px; font-size: 13.5px; padding: 11px 15px; }

/* ── Auth screens ────────────────────────────────────────────────────── */

.lh-auth {
  min-height: 100vh; display: grid; grid-template-columns: 1fr;
  background: var(--bg);
}
@media (min-width: 992px) { .lh-auth { grid-template-columns: 1.05fr .95fr; } }

.lh-auth__aside {
  display: none; padding: 48px;
  background: linear-gradient(150deg, #14202c 0%, #0c1218 55%, #12070a 100%);
  color: #fff; position: relative; overflow: hidden;
  flex-direction: column; justify-content: space-between;
}
@media (min-width: 992px) { .lh-auth__aside { display: flex; } }
.lh-auth__aside::after {
  content: ""; position: absolute; width: 460px; height: 460px; border-radius: 50%;
  background: radial-gradient(circle, var(--accent) 0%, transparent 68%);
  opacity: .3; right: -140px; bottom: -160px;
}
.lh-auth__aside h2 { font-size: 27px; font-weight: 680; letter-spacing: -.6px; max-width: 22ch; line-height: 1.3; }
.lh-auth__aside p  { color: rgba(255,255,255,.68); max-width: 44ch; font-size: 14px; }
.lh-auth__points { list-style: none; padding: 0; margin: 26px 0 0; position: relative; z-index: 1; }
.lh-auth__points li {
  display: flex; gap: 10px; align-items: flex-start;
  color: rgba(255,255,255,.8); margin-bottom: 11px; font-size: 13.5px;
}
.lh-auth__points i { color: var(--accent); margin-top: 2px; }

.lh-auth__main { display: grid; place-items: center; padding: 32px 20px; }
.lh-auth__card { width: 100%; max-width: 400px; }

/* ── Utility ─────────────────────────────────────────────────────────── */

.lh-muted   { color: var(--text-muted); }
.lh-mono    { font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace; font-size: 12.5px; }
.lh-empty   { text-align: center; padding: 44px 20px; color: var(--text-muted); }
.lh-empty i { font-size: 34px; opacity: .35; display: block; margin-bottom: 10px; }

.lh-avatar { border-radius: 50%; object-fit: cover; }
.lh-avatar--sm { width: 30px; height: 30px; }
.lh-avatar--md { width: 40px; height: 40px; }
.lh-avatar--lg { width: 76px; height: 76px; }

.lh-timeline { list-style: none; margin: 0; padding: 0; }
.lh-timeline li {
  position: relative; padding: 0 0 16px 22px;
  border-left: 2px solid var(--border); margin-left: 5px;
}
.lh-timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.lh-timeline li::before {
  content: ""; position: absolute; left: -6px; top: 4px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--surface);
}
.lh-timeline__meta { font-size: 11.5px; color: var(--text-muted); }

.lh-diff { font-size: 12.5px; }
.lh-diff__old { background: rgba(214, 48, 60, .1);  border-radius: 4px; padding: 1px 6px; }
.lh-diff__new { background: rgba(34, 160, 96, .12); border-radius: 4px; padding: 1px 6px; }

.dropdown-menu {
  background: var(--surface); border-color: var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow); font-size: 13.5px;
}
.dropdown-item { color: var(--text); }
.dropdown-item:hover, .dropdown-item:focus { background: var(--surface-2); color: var(--text); }
.dropdown-divider { border-color: var(--border); }

.modal-content { background: var(--surface); color: var(--text); border-color: var(--border); border-radius: var(--radius); }
.modal-header, .modal-footer { border-color: var(--border); }

.pagination { --bs-pagination-font-size: 13px; }
.page-link { color: var(--text); background: var(--surface); border-color: var(--border); }
.page-item.active .page-link { background: var(--accent); border-color: var(--accent); color: #fff; }
.page-item.disabled .page-link { background: var(--surface-2); color: var(--text-muted); border-color: var(--border); }

.nav-tabs { border-bottom-color: var(--border); }
.nav-tabs .nav-link { color: var(--text-muted); border: 0; border-bottom: 2px solid transparent; font-size: 13.5px; font-weight: 550; }
.nav-tabs .nav-link:hover { color: var(--text); border-bottom-color: var(--border); }
.nav-tabs .nav-link.active { color: var(--accent); background: transparent; border-bottom-color: var(--accent); }

/* ── Mobile ──────────────────────────────────────────────────────────── */

.lh-backdrop {
  display: none; position: fixed; inset: 0;
  background: rgba(8, 12, 18, .5); z-index: 1035;
}

@media (max-width: 991.98px) {
  .lh-sidebar { transform: translateX(-100%); }
  body.lh-sidebar-open .lh-sidebar { transform: translateX(0); }
  body.lh-sidebar-open .lh-backdrop { display: block; }
  .lh-main { margin-left: 0; }
  .lh-content { padding: 16px; }
  .lh-topbar { padding: 0 16px; }
}

@media print {
  .lh-sidebar, .lh-topbar, .lh-footer, .lh-page-head__actions { display: none !important; }
  .lh-main { margin-left: 0; }
  .lh-card { border-color: #ccc; box-shadow: none; }
}

/* ── Phase 4: inventory & distribution ─────────────────────────────── */

/* Slot meter — used in tables and on the board. */
.lh-slots { display: flex; align-items: center; gap: 8px; min-width: 92px; }
.lh-slots__count { font-family: var(--lh-mono, ui-monospace, monospace); font-size: 12px; white-space: nowrap; }
.lh-slots__bar {
  flex: 1; height: 6px; border-radius: 999px; overflow: hidden;
  background: var(--bs-secondary-bg-subtle, #e9ecef);
}
.lh-slots__fill {
  display: block; height: 100%; border-radius: 999px;
  background: var(--bs-primary, #0d6efd); transition: width .2s ease;
}

/* The distribution board: lead on the left, clients on the right. */
.lh-board { display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); gap: 16px; align-items: start; }
.lh-board__lead { position: sticky; top: 76px; }

@media (max-width: 1199.98px) {
  .lh-board { grid-template-columns: 1fr; }
  .lh-board__lead { position: static; }
}

.lh-slotmeter__big { font-size: 42px; font-weight: 700; line-height: 1; }
.lh-slotmeter__label { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; opacity: .65; }
.lh-slotmeter__selected { font-size: 13px; }

/* Ineligible clients stay visible, just clearly out of play. */
.lh-row--muted { opacity: .55; }
.lh-row--muted:hover { opacity: .8; }

/* ── Phase 6: the client console ───────────────────────────────────── */

/* A masked field should look deliberately withheld, not broken. */
.lh-locked {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-radius: 8px;
  border: 1px dashed var(--bs-warning-border-subtle, #ffe69c);
  background: var(--bs-warning-bg-subtle, #fff9e6);
  color: var(--bs-warning-text-emphasis, #664d03);
  font-size: 13px;
}
.lh-locked i { font-size: 18px; opacity: .8; }

/* Buy Leads cards sit in a grid; keep their footers aligned. */
.lh-card.h-100 > .lh-card__body { display: flex; flex-direction: column; }

@media print {
  .lh-locked { border-style: solid; }
}
