/* Dashboard theme: dark, lime accent, Plus Jakarta Sans (matches the cue-starter-kit look). */
:root {
  color-scheme: dark;
  --bg: #0a0a0a;
  --bg-elev: #0f0f0f;
  --panel: #141414;
  --fill-control: #161616;
  --fill-hover: #1c1c1c;
  --fill-raised: #202020;
  --fill-active: #262626;
  --line: #2a2a2a;
  --line-soft: #1e1e1e;
  --line-hover: #444444;
  --text: #ffffff;
  --text-mid: #a3a3a3;
  --muted: #8a8a8a;
  --dim: #7d7d7d;
  --accent: #9aff00;
  --accent-dim: rgba(154, 255, 0, 0.1);
  --accent-line: rgba(154, 255, 0, 0.3);
  --on-accent: #0a0a0a;
  --danger: #ff5c5c;
  --danger-dim: rgba(255, 92, 92, 0.12);
  --warn: #fbbf24;
  --warn-dim: rgba(251, 191, 36, 0.1);
  --warn-line: rgba(251, 191, 36, 0.32);
  --bubble-in: #1a1a1a;
  --bubble-out: #1c2a0c;
  --bubble-staff: #14233a;
  --radius: 12px;
  --shadow-pop: 0 24px 64px rgba(0, 0, 0, 0.7);
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 18px; }
h2 { font-size: 16px; font-weight: 700; margin: 26px 0 10px; }
h3 { font-size: 14px; font-weight: 700; margin: 16px 0 8px; }
p { margin: 6px 0; }
b { font-weight: 650; }
.boot { padding: 40px; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.danger { color: var(--danger); }
::selection { background: var(--accent); color: var(--on-accent); }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2a2a2a; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #3a3a3a; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; background: var(--bg-elev); border-right: 1px solid var(--line-soft); padding: 14px 10px; display: flex; flex-direction: column; gap: 1px; overflow-y: auto; }
.side .brand { display: flex; align-items: center; gap: 10px; padding: 2px 6px 14px; font-weight: 800; font-size: 15px; letter-spacing: -0.01em; color: var(--text); }
.logo { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: var(--on-accent); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; box-shadow: 0 0 18px var(--accent-line); }
.logo svg { width: 16px; height: 16px; }
.biz { display: flex; align-items: center; gap: 10px; padding: 8px 10px; margin: 0 0 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--fill-control); }
.biz .avatar { width: 26px; height: 26px; border-radius: 7px; background: var(--fill-active); color: var(--accent); font-weight: 800; font-size: 12px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.biz .who { min-width: 0; flex: 1; }
.biz .name { font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.biz .role { font-size: 11px; color: var(--muted); text-transform: capitalize; }
.biz select { width: 100%; border: 0; background: transparent; padding: 0; font-weight: 700; font-size: 13px; }
.side .group { padding: 14px 10px 6px; font-size: 11px; font-weight: 600; color: var(--text-mid); }
.side a.nav { position: relative; display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px; color: var(--text-mid); font-size: 13.5px; font-weight: 500; text-decoration: none; transition: background 0.12s, color 0.12s; }
.side a.nav svg { width: 16px; height: 16px; flex-shrink: 0; color: var(--muted); }
.side a.nav:hover { background: var(--fill-hover); color: var(--text); }
.side a.nav.active { background: var(--fill-hover); color: var(--text); font-weight: 650; }
.side a.nav.active svg { color: var(--accent); }
.side a.nav.active::before { content: ""; position: absolute; left: 0; top: 50%; width: 2.5px; height: 14px; transform: translateY(-50%); border-radius: 2px; background: var(--accent); }
.side .spacer { flex: 1; min-height: 16px; }
.side .me { display: flex; align-items: center; gap: 10px; padding: 10px; border-top: 1px solid var(--line-soft); margin-top: 8px; }
.side .me .who { min-width: 0; flex: 1; font-size: 12px; }
.side .me .who div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side .me .who .email { color: var(--muted); }
.side .me a { color: var(--muted); display: inline-flex; padding: 6px; border-radius: 6px; }
.side .me a:hover { background: var(--fill-hover); color: var(--text); }
.side .me svg { width: 16px; height: 16px; }
.main { padding: 28px 32px 40px; min-width: 0; }
.page { max-width: 1180px; margin: 0 auto; }
.topbar { display: none; }
.scrim { display: none; }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .topbar { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 20; padding: 10px 16px; background: rgba(10, 10, 10, 0.9); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line-soft); font-weight: 800; }
  .topbar button { padding: 6px; border: 0; background: transparent; color: var(--text); display: inline-flex; }
  .topbar svg { width: 20px; height: 20px; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 272px; z-index: 40; transform: translateX(-100%); transition: transform 0.2s ease; box-shadow: var(--shadow-pop); }
  .shell.open .side { transform: none; }
  .shell.open .scrim { display: block; position: fixed; inset: 0; z-index: 30; background: rgba(10, 10, 10, 0.72); }
  .main { padding: 18px 16px 32px; }
}

/* ---------- controls ---------- */
button, .btn { font: inherit; font-size: 13.5px; font-weight: 600; border: 1px solid var(--line); background: var(--fill-control); color: var(--text); padding: 7px 13px; border-radius: 9px; cursor: pointer; transition: background 0.12s, border-color 0.12s, transform 0.05s; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
button:hover, .btn:hover { background: var(--fill-raised); border-color: var(--line-hover); text-decoration: none; }
button:active { transform: translateY(1px); }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
button.primary:hover, .btn.primary:hover { background: var(--accent); border-color: var(--accent); filter: brightness(1.12); }
button.danger { color: var(--danger); }
button.danger:hover { background: var(--danger-dim); border-color: rgba(255, 92, 92, 0.4); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent-line); outline-offset: 2px; }
input, select, textarea { font: inherit; font-size: 14px; color: var(--text); background: var(--fill-control); border: 1px solid var(--line); border-radius: 9px; padding: 8px 11px; transition: border-color 0.12s, background 0.12s; }
input:hover, select:hover, textarea:hover { border-color: var(--line-hover); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); background: #121212; }
input::placeholder, textarea::placeholder { color: var(--dim); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: 16px; height: 16px; padding: 0; }
select option { background: var(--panel); }
textarea { width: 100%; min-height: 76px; resize: vertical; }
label { display: block; margin: 12px 0 5px; font-size: 12.5px; font-weight: 600; color: var(--text-mid); }
label.check { display: flex; align-items: center; gap: 9px; color: var(--text); font-size: 14px; font-weight: 500; margin: 8px 0; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.field input, .field select, .field textarea { width: 100%; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 18px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 14px; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.notice { background: var(--warn-dim); border: 1px solid var(--warn-line); color: var(--warn); padding: 10px 12px; border-radius: 9px; margin: 10px 0; }
.error { color: var(--danger); margin: 8px 0; }
.ok { color: var(--accent); margin: 8px 0; }

table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
th { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); background: var(--bg-elev); }
tbody tr:hover td { background: #171717; }
tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; }

.pill { display: inline-flex; align-items: center; font-size: 11px; font-weight: 650; padding: 2px 8px; border-radius: 99px; background: var(--accent-dim); color: var(--accent); border: 1px solid var(--accent-line); white-space: nowrap; }
.pill.warn { background: var(--warn-dim); color: var(--warn); border-color: var(--warn-line); }
.pill.grey { background: var(--fill-raised); color: var(--text-mid); border-color: var(--line); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 14px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; color: var(--text-mid); font-size: 12.5px; }
.stat b { display: block; font-size: 26px; font-weight: 800; letter-spacing: -0.02em; color: var(--text); margin-bottom: 2px; }

/* ---------- auth ---------- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-art { position: relative; overflow: hidden; padding: 40px 48px; display: flex; flex-direction: column; justify-content: space-between; border-right: 1px solid var(--line-soft); background: radial-gradient(ellipse 80% 60% at 20% 0%, var(--accent-dim), transparent 60%), var(--bg-elev); }
.auth-art .brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 16px; color: var(--text); }
.auth-art h2 { font-size: 34px; line-height: 1.12; letter-spacing: -0.03em; font-weight: 800; margin: 0 0 14px; max-width: 460px; }
.auth-art h2 em { font-style: normal; color: var(--accent); }
.auth-art p { color: var(--text-mid); max-width: 420px; font-size: 15px; }
.auth-art ul { list-style: none; padding: 0; margin: 22px 0 0; display: grid; gap: 10px; }
.auth-art li { display: flex; gap: 10px; align-items: center; color: var(--text-mid); }
.auth-art li svg { width: 16px; height: 16px; color: var(--accent); flex-shrink: 0; }
.auth-art .foot { color: var(--dim); font-size: 12px; }
.auth { width: 100%; max-width: 420px; margin: auto; padding: 32px 20px; }
.auth .card { padding: 28px; background: transparent; border: 0; }
.auth h1 { font-size: 26px; margin-bottom: 4px; }
.auth .sub { color: var(--muted); margin: 0 0 18px; }
.auth button.primary { width: 100%; justify-content: center; padding: 10px; margin-top: 8px; }
.auth .alt { margin-top: 16px; color: var(--muted); font-size: 13px; text-align: center; }
.auth-solo { min-height: 100vh; display: flex; }
@media (max-width: 860px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .auth .card { padding: 8px 4px; }
}

/* ---------- inbox ---------- */
.inbox { display: grid; grid-template-columns: 330px 1fr; gap: 14px; height: calc(100vh - 120px); }
.inbox .list { overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.inbox .item { position: relative; padding: 12px 14px; border-bottom: 1px solid var(--line-soft); cursor: pointer; transition: background 0.12s; }
.inbox .item:hover { background: var(--fill-hover); }
.inbox .item.active { background: var(--fill-active); }
.inbox .item.active::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 2.5px; border-radius: 2px; background: var(--accent); }
.inbox .item .top { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.inbox .item .preview { color: var(--text-mid); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.chat { display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); min-height: 0; overflow: hidden; }
.chat header { padding: 12px 16px; border-bottom: 1px solid var(--line-soft); display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: center; }
.chat .messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; background: var(--bg-elev); }
.bubble { max-width: 75%; padding: 8px 12px; border-radius: 12px; border-top-left-radius: 4px; white-space: pre-wrap; word-wrap: break-word; background: var(--bubble-in); border: 1px solid var(--line); }
.bubble.out { align-self: flex-end; background: var(--bubble-out); border-color: rgba(154, 255, 0, 0.18); border-top-left-radius: 12px; border-top-right-radius: 4px; }
.bubble.staff { background: var(--bubble-staff); border-color: rgba(96, 165, 250, 0.25); }
.bubble .meta { font-size: 11px; color: var(--muted); margin-top: 4px; }
.chat footer { padding: 12px; border-top: 1px solid var(--line-soft); }
.chat footer textarea { min-height: 54px; margin-bottom: 8px; }
.facts { font-size: 13px; padding: 10px 16px; border-bottom: 1px solid var(--line-soft); background: var(--panel); color: var(--text-mid); }
@media (max-width: 860px) { .inbox { grid-template-columns: 1fr; height: auto; } .inbox .list { max-height: 280px; } .chat { min-height: 70vh; } }

/* spacing utilities (no inline styles: the CSP forbids them) */
.pad { padding: 14px; }
.spread { justify-content: space-between; margin-bottom: 14px; }
.flush { margin: 0; }
.mt { margin-top: 20px; }
.mb { margin-bottom: 12px; }
code { background: var(--fill-raised); border: 1px solid var(--line); padding: 1px 6px; border-radius: 5px; font-size: 12.5px; word-break: break-all; font-family: ui-monospace, "Geist Mono", Consolas, monospace; }
.side a.brand:hover, .auth-art a.brand:hover { text-decoration: none; }
.side .me a.who { display: block; padding: 4px 6px; color: var(--text); text-decoration: none; }
.side .me a.who:hover { background: var(--fill-hover); }
.page.narrow { max-width: 720px; }
.auth-art .foot a { color: var(--dim); }
.auth-art .foot a:hover { color: var(--text-mid); }
.tags-input { min-width: 160px; width: 100%; }

/* team inbox */
.teambar { padding: 8px 16px; border-bottom: 1px solid var(--line-soft); background: var(--panel); }
.teambar select { padding: 5px 8px; font-size: 13px; }
.labels-input { flex: 1; min-width: 140px; padding: 5px 9px; font-size: 13px; }
.ghost-btn { padding: 5px 10px; font-size: 12.5px; }
.notes-box { margin-top: 8px; display: grid; gap: 8px; }
.notes { display: grid; gap: 6px; max-height: 180px; overflow-y: auto; }
.note { background: var(--warn-dim); border: 1px solid var(--warn-line); border-radius: 9px; padding: 7px 10px; white-space: pre-wrap; font-size: 13px; }
.note .meta { font-size: 11px; color: var(--muted); margin-top: 3px; }
.note-input { min-height: 46px; }
.tags-row { gap: 6px; margin-top: 4px; }
.tags-row .pill { font-size: 10.5px; padding: 1px 6px; }

/* analytics */
.chart { width: 100%; height: auto; display: block; }
.chart .bar-ai { fill: var(--accent); }
.chart .bar-staff { fill: #60a5fa; }
.chart .dot-chats { fill: #ffffff; }
.chart .grid { stroke: var(--line); }
.chart .axis { fill: var(--muted); font-size: 10px; font-family: var(--font); }
.legend { display: flex; align-items: center; gap: 6px; }
.legend .key { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-left: 8px; }
.legend .key.ai { background: var(--accent); }
.legend .key.staff { background: #60a5fa; }
.legend .key.chats { background: #fff; border-radius: 50%; }
.hbar { display: grid; grid-template-columns: 100px 1fr 40px; align-items: center; gap: 10px; margin: 8px 0; font-size: 13px; text-transform: capitalize; }
.hbar b { text-align: right; }
.hbar-track { height: 8px; border-radius: 99px; background: var(--fill-raised); overflow: hidden; }
.hbar-fill { height: 100%; background: var(--accent); border-radius: 99px; }
[hidden] { display: none !important; }
.logo-img { width: 28px; height: 28px; border-radius: 8px; object-fit: cover; flex-shrink: 0; }
.steps-list { padding-left: 18px; margin: 4px 0 12px; }
.steps-list li { margin: 4px 0; }
input[type="color"] { width: 44px; height: 34px; padding: 2px; }
.grow > input, .grow > select { width: 100%; }
