/* Saleslights CX Suite — dark operator console */
:root {
  --bg: #0a0b0f;
  --bg2: #0f1118;
  --panel: #141722;
  --panel2: #1a1e2c;
  --line: #262b3d;
  --text: #e8eaf2;
  --muted: #8b91a7;
  --dim: #5d6378;
  --orange: #ff6a1a;
  --orange-soft: rgba(255, 106, 26, 0.14);
  --navy: #1b2a52;
  --navy2: #24396e;
  --green: #22c55e;
  --amber: #f5b301;
  --org: #ff8a3d;
  --red: #ef4444;
  --radius: 10px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; }
a { color: var(--orange); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 8px; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 22px; } h2 { font-size: 17px; } h3 { font-size: 15px; } h4 { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); } .dim { color: var(--dim); } .small { font-size: 12px; }
.hidden { display: none !important; }

/* Layout */
.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sidebar { background: var(--bg2); border-right: 1px solid var(--line); padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(135deg, var(--orange), #ff9a5a); display: grid; place-items: center; font-weight: 800; color: #111; }
.brand-name { font-weight: 700; font-size: 14px; line-height: 1.2; }
.brand-name small { display: block; color: var(--muted); font-weight: 500; font-size: 11px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-section { color: var(--dim); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; padding: 14px 10px 6px; }
.nav a { color: var(--muted); padding: 7px 10px; border-radius: 7px; display: flex; justify-content: space-between; align-items: center; }
.nav a:hover { background: var(--panel); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--orange-soft); color: var(--orange); font-weight: 600; }
.nav .count { font-size: 11px; background: var(--panel2); color: var(--muted); padding: 0 7px; border-radius: 10px; }
.sidebar-foot { margin-top: auto; padding: 14px 8px 0; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.sidebar-foot .who { color: var(--text); font-weight: 600; }
.main { padding: 26px 32px 60px; min-width: 0; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head p { color: var(--muted); max-width: 760px; margin: 0; }

/* Panels / cards */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card + .card { margin-top: 0; }
.section { margin-top: 22px; }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 10px; }
.client-card { border-top: 3px solid var(--orange); }
.scores { display: flex; gap: 14px; margin: 12px 0 16px; }
.score { flex: 1; background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.score .label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.score .value { font-size: 30px; font-weight: 700; line-height: 1.1; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat .value { font-size: 24px; font-weight: 700; }
.stat .label { color: var(--muted); font-size: 12px; }

/* Score bands */
.band-green { color: var(--green); } .band-amber { color: var(--amber); } .band-orange { color: var(--org); } .band-red { color: var(--red); }
.bg-green { background: var(--green); } .bg-amber { background: var(--amber); } .bg-orange { background: var(--org); } .bg-red { background: var(--red); }
.bar-row { display: grid; grid-template-columns: 92px 1fr 34px; gap: 10px; align-items: center; margin: 6px 0; font-size: 12px; }
.bar-row .name { color: var(--muted); text-transform: capitalize; }
.bar { height: 8px; background: var(--bg2); border-radius: 6px; overflow: hidden; border: 1px solid var(--line); }
.bar > span { display: block; height: 100%; border-radius: 6px; }
.bar-row .num { text-align: right; font-weight: 600; }

/* Chips */
.chip { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; text-transform: capitalize; border: 1px solid transparent; white-space: nowrap; }
.sev-critical { background: rgba(239, 68, 68, .16); color: #ff7b7b; border-color: rgba(239, 68, 68, .4); }
.sev-high { background: rgba(255, 138, 61, .15); color: var(--org); border-color: rgba(255, 138, 61, .4); }
.sev-medium { background: rgba(245, 179, 1, .13); color: var(--amber); border-color: rgba(245, 179, 1, .35); }
.sev-low { background: rgba(34, 197, 94, .12); color: var(--green); border-color: rgba(34, 197, 94, .35); }
.chip-type { background: var(--navy); color: #b9c8f3; border-color: var(--navy2); }
.chip-status { background: var(--panel2); color: var(--muted); border-color: var(--line); }
.chip-client { background: var(--orange-soft); color: var(--orange); }
.st-fixed, .st-verified { color: var(--green); }
.st-in_progress { color: var(--amber); }

/* Tables */
.table-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; background: var(--bg2); position: sticky; top: 0; }
tr:last-child td { border-bottom: none; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: var(--panel2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.rank { font-weight: 700; color: var(--orange); }
.title-cell { font-weight: 500; max-width: 420px; }
.title-cell .sub { color: var(--dim); font-size: 12px; font-weight: 400; }
.empty { padding: 28px; text-align: center; color: var(--muted); }

/* Forms */
input, select, textarea, button { font: inherit; color: inherit; }
input, select, textarea { background: var(--bg2); border: 1px solid var(--line); border-radius: 7px; padding: 8px 10px; color: var(--text); outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--orange); }
select.inline { padding: 3px 6px; font-size: 12px; }
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.field { margin-bottom: 12px; }
.field input, .field select { width: 100%; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.filters input[type=search] { min-width: 240px; }
.btn { background: var(--orange); color: #111; border: none; padding: 8px 14px; border-radius: 7px; font-weight: 600; cursor: pointer; }
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn-ghost:hover { border-color: var(--orange); color: var(--orange); }
.btn-sm { padding: 4px 9px; font-size: 12px; }
.btn-row { display: flex; gap: 6px; flex-wrap: wrap; }

/* Auth screens */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(1200px 600px at 20% 10%, rgba(27, 42, 82, .55), transparent), radial-gradient(800px 500px at 90% 90%, rgba(255, 106, 26, .10), transparent), var(--bg); }
.auth-card { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 28px; box-shadow: var(--shadow); }
.auth-card .brand { padding: 0 0 18px; }
.auth-card .btn { width: 100%; padding: 10px; margin-top: 4px; }
.form-error { color: #ff7b7b; font-size: 13px; min-height: 18px; margin-top: 8px; }

/* Drawer */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); z-index: 40; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); background: var(--bg2); border-left: 1px solid var(--line); z-index: 50; overflow-y: auto; padding: 22px 24px 40px; box-shadow: var(--shadow); }
.drawer .close { float: right; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 6px 12px; margin: 12px 0; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.block { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin: 10px 0; }
.block h4 { margin-bottom: 6px; }
.evidence { list-style: none; padding: 0; margin: 0; }
.evidence li { padding: 8px 0; border-bottom: 1px dashed var(--line); }
.evidence li:last-child { border-bottom: none; }
.evidence blockquote { margin: 4px 0 0; padding-left: 10px; border-left: 2px solid var(--orange); color: var(--muted); font-style: italic; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }

/* Lists */
.list { list-style: none; padding: 0; margin: 0; }
.list li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: none; }
.pill-list { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 3px 8px; font-size: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.callout { background: linear-gradient(90deg, var(--orange-soft), transparent); border-left: 3px solid var(--orange); padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; color: var(--text); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.secret { background: var(--bg); border: 1px dashed var(--orange); padding: 8px 10px; border-radius: 6px; word-break: break-all; }

/* Toasts */
.toasts { position: fixed; bottom: 18px; right: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: var(--panel2); border: 1px solid var(--line); border-left: 3px solid var(--green); padding: 10px 14px; border-radius: 8px; box-shadow: var(--shadow); max-width: 380px; font-size: 13px; }
.toast.error { border-left-color: var(--red); }
.loading { color: var(--muted); padding: 30px 0; }

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .main { padding: 18px; }
  .grid-2 { grid-template-columns: 1fr; }
}
