/* SancharAI — cyan on near-black, matching the VoiceAI design language.
   Plain CSS, no build step.

   Variable NAMES stay stable across re-skins (--primary, --green, --red…)
   because page templates reference them in inline styles. Re-theming means
   changing values here, never hunting through markup. */

@import url("https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;700&display=swap");

:root {
  /* grounds */
  --bg: #05050a;
  --surface: #12121a;
  --surface-2: #1a1a24;
  --surface-3: #22222e;

  /* brand */
  --primary: #00e5ff;
  --primary-hover: #33eeff;
  --primary-dim: rgba(0, 229, 255, 0.12);
  --violet: #7c5cfc;
  --violet-dim: rgba(124, 92, 252, 0.13);

  /* semantic — separate from the brand accent */
  --green: #00ff9d;
  --teal: var(--green);
  --red: #ff3366;
  --amber: #ffb020;
  --gold: var(--amber);

  /* ink */
  --text: #ffffff;
  --muted: #8b8b9e;
  --hint: #5a5a6e;

  --border: rgba(255, 255, 255, 0.08);
  --border-2: rgba(255, 255, 255, 0.14);
  --border-3: rgba(255, 255, 255, 0.24);

  --radius: 12px;
  --display: "Plus Jakarta Sans", ui-sans-serif, system-ui, sans-serif;
  --body: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
}

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

html, body { background: var(--bg); color: var(--text); min-height: 100%; }
body {
  font-family: var(--body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }

/* ---------------------------------------------------------------- utility */
.font-display { font-family: var(--display); font-weight: 800; letter-spacing: -0.03em; }
.mono { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.cyan { color: var(--primary); }
.glass {
  background: rgba(10, 10, 15, 0.62);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border);
}
.glow { box-shadow: 0 0 40px rgba(0, 229, 255, 0.22), 0 0 4px rgba(0, 229, 255, 0.35); }
.eyebrow {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--primary); margin-bottom: 14px;
}

/* ------------------------------------------------------------------ shell */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; z-index: 2;
}
.brand {
  display: flex; align-items: center; gap: 11px;
  padding: 18px 20px; border-bottom: 1px solid var(--border);
  font-family: var(--display); font-size: 19px; font-weight: 800; letter-spacing: -0.03em;
}
.brand-mark {
  width: 31px; height: 31px; border-radius: 9px; flex-shrink: 0;
  background: var(--primary); color: #000;
  display: flex; align-items: center; justify-content: center; font-size: 15px;
}
.brand .accent { color: var(--primary); }

.nav { flex: 1; padding: 12px 10px; }
.nav-label {
  font-size: 10px; font-family: var(--mono); letter-spacing: 0.13em;
  text-transform: uppercase; color: var(--hint); padding: 16px 12px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 9px; margin-bottom: 2px;
  font-size: 13.5px; font-weight: 500; color: var(--muted);
  transition: background-color .15s ease, color .15s ease;
}
.nav-item:hover { background: rgba(255, 255, 255, .05); color: var(--text); }
.nav-item.active {
  background: rgba(255, 255, 255, .05); color: var(--text);
  border-left: 2px solid var(--primary); padding-left: 10px;
}
.nav-item .count {
  margin-left: auto; font-family: var(--mono); font-size: 10px;
  background: var(--surface-3); border-radius: 100px; padding: 2px 8px; color: var(--hint);
}

.side-foot { padding: 14px 16px; border-top: 1px solid var(--border); font-size: 12px; }
.side-foot .who { color: var(--text); font-size: 13px; font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; }
.side-foot .plan { color: var(--primary); font-family: var(--mono); font-size: 11px; margin-top: 2px; }
.side-foot a { color: var(--muted); font-size: 12px; display: inline-block; margin-top: 8px; }
.side-foot a:hover { color: var(--text); }

.meter { height: 5px; background: var(--surface-3); border-radius: 100px; overflow: hidden; margin: 8px 0 4px; }
.meter > div { height: 100%; background: var(--primary); }
.meter.warn > div { background: var(--amber); }
.meter.full > div { background: var(--red); }

/* -------------------------------------------------------------- main area */
.main { position: relative; z-index: 2; overflow-x: hidden; }
.topbar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 0 28px; height: 64px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: rgba(5, 5, 10, .84);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); z-index: 3;
}
.topbar h1 { font-family: var(--display); font-size: 18px; font-weight: 800; letter-spacing: -0.03em; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.pill {
  display: flex; align-items: center; gap: 7px; font-size: 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 12px; color: var(--muted);
}
.dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.dot.on { background: var(--green); box-shadow: 0 0 8px var(--green); }
.dot.off { background: var(--red); }
.dot.idle { background: var(--primary); }

.content { padding: 24px 28px 60px; display: flex; flex-direction: column; gap: 18px; }

/* ------------------------------------------------------------------ cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.card-head {
  padding: 15px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.card-title { font-size: 14px; font-weight: 600; }
.card-body { padding: 20px; }
.card.danger { border-color: rgba(255, 51, 102, .35); }

.grid { display: grid; gap: 14px; }
.grid.c2 { grid-template-columns: repeat(2, 1fr); }
.grid.c3 { grid-template-columns: repeat(3, 1fr); }
.grid.c4 { grid-template-columns: repeat(4, 1fr); }

.metric { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; }
.metric-label { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.metric-val {
  font-family: var(--display); font-size: 31px; font-weight: 800;
  letter-spacing: -0.045em; line-height: 1;
}
.metric-sub { font-size: 11px; font-family: var(--mono); color: var(--hint); margin-top: 6px; }

/* ----------------------------------------------------------------- forms */
label { display: block; font-weight: 600; font-size: 12px; color: var(--muted); margin: 14px 0 6px; }
input, select, textarea {
  width: 100%; padding: 10px 13px; border-radius: 9px;
  border: 1px solid var(--border-2); background: #0a0a10; color: var(--text);
  font-size: 14px; font-family: var(--body); outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus, textarea:focus {
  border-color: rgba(0, 229, 255, .6); box-shadow: 0 0 0 3px rgba(0, 229, 255, .12); outline: none;
}
textarea { min-height: 92px; resize: vertical; line-height: 1.6; }
input[type="file"] { padding: 9px 12px; font-size: 13px; color: var(--muted); }
select option { background: #0a0a10; }

.btn {
  padding: 10px 20px; border: none; border-radius: 9px; font-weight: 600;
  font-size: 14px; cursor: pointer; font-family: var(--body);
  transition: background-color .18s ease, transform .1s ease;
}
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #000; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-ghost { background: transparent; border: 1px solid var(--border-3); color: var(--muted); }
.btn-ghost:hover:not(:disabled) { color: var(--text); border-color: rgba(255, 255, 255, .4); }
.btn-danger { background: transparent; border: 1px solid rgba(255, 51, 102, .4); color: #ff6688; }
.btn-danger:hover:not(:disabled) { background: rgba(255, 51, 102, .1); }
.btn-sm { padding: 6px 13px; font-size: 12.5px; }
.btn-round { border-radius: 100px; }

.note { font-size: 12px; color: var(--hint); margin-top: 6px; line-height: 1.55; }
.ok { color: var(--green); } .bad { color: #ff6688; } .warn { color: var(--amber); }

/* ---------------------------------------------------------------- tables */
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; padding: 10px 16px; font-size: 10.5px; font-family: var(--mono);
  letter-spacing: .08em; text-transform: uppercase; color: var(--hint);
  border-bottom: 1px solid var(--border); background: var(--surface-2);
}
td { padding: 12px 16px; font-size: 13.5px; border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: rgba(255, 255, 255, .022); }
.mono, td.mono, .metric-sub { font-variant-numeric: tabular-nums; }

.tag {
  font-size: 10px; font-family: var(--mono); font-weight: 600;
  padding: 4px 10px; border-radius: 100px; white-space: nowrap; display: inline-block;
}
.t-good { background: rgba(0, 255, 157, .1); color: var(--green); border: 1px solid rgba(0, 255, 157, .28); }
.t-mid  { background: var(--primary-dim); color: var(--primary); border: 1px solid rgba(0, 229, 255, .28); }
.t-bad  { background: rgba(255, 51, 102, .1); color: #ff6688; border: 1px solid rgba(255, 51, 102, .28); }
.t-idle { background: rgba(255, 255, 255, .05); color: var(--muted); border: 1px solid var(--border-2); }

.empty { color: var(--hint); font-size: 13px; padding: 26px 20px; text-align: center; }

.codebox {
  background: #0a0a10; border: 1px solid var(--border-2); border-radius: 9px;
  padding: 11px 13px; font-family: var(--mono); font-size: 11px; color: var(--muted);
  word-break: break-all; margin-top: 6px;
}

/* --------------------------------------------------------------- billing */
.plan-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 24px; display: flex; flex-direction: column; position: relative;
}
.plan-card.current { border-color: rgba(0, 229, 255, .5); box-shadow: 0 0 34px rgba(0, 229, 255, .1); }
.plan-name { font-family: var(--display); font-size: 22px; font-weight: 800; letter-spacing: -0.03em; }
.plan-price {
  font-family: var(--display); font-size: 34px; font-weight: 800;
  letter-spacing: -0.045em; margin: 10px 0 2px;
}
.plan-price span { font-size: 13px; font-weight: 400; color: var(--muted); letter-spacing: 0; }
.plan-feats { list-style: none; margin: 18px 0; flex: 1; display: flex; flex-direction: column; gap: 9px; }
.plan-feats li {
  font-size: 13.5px; color: rgba(255, 255, 255, .8);
  display: flex; align-items: flex-start; gap: 9px;
}
.plan-feats svg { width: 15px; height: 15px; color: var(--primary); flex-shrink: 0; margin-top: 3px; }
.badge-pop {
  position: absolute; top: -11px; left: 22px;
  font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: #000; background: var(--primary); padding: 4px 9px; border-radius: 5px;
}

/* ----------------------------------------------------------------- toast */
#toast {
  position: fixed; top: 18px; right: 18px; z-index: 99;
  display: flex; flex-direction: column; gap: 8px; max-width: 380px;
}
.toast {
  background: var(--surface-2); border: 1px solid var(--border-2);
  border-left: 3px solid var(--primary); border-radius: 10px;
  padding: 12px 16px; font-size: 13px; box-shadow: 0 8px 30px rgba(0, 0, 0, .55);
  animation: slidein .2s ease;
}
.toast.bad { border-left-color: var(--red); }
.toast.good { border-left-color: var(--green); }
@keyframes slidein { from { opacity: 0; transform: translateX(16px); } }

/* ---------------------------------------------------------------- modal */
.modal-bg {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .74); z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  backdrop-filter: blur(4px);
}
.modal {
  background: var(--surface); border: 1px solid var(--border-2); border-radius: 14px;
  max-width: 640px; width: 100%; max-height: 82vh; overflow-y: auto;
}

/* ----------------------------------------------------------------- auth */
.auth-wrap { display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 24px; position: relative; z-index: 2; }
.auth-card { width: 100%; max-width: 420px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 16px; padding: 34px; }
.auth-card h1 { font-family: var(--display); font-size: 24px; font-weight: 800;
  letter-spacing: -0.035em; margin-bottom: 6px; }
.auth-card .sub { font-size: 13.5px; color: var(--muted); margin-bottom: 20px; }
.auth-card .btn { width: 100%; margin-top: 22px; }
.auth-foot { text-align: center; margin-top: 18px; font-size: 13px; color: var(--muted); }
.auth-foot a { color: var(--primary); font-weight: 500; }
.alert { background: rgba(255, 51, 102, .09); border: 1px solid rgba(255, 51, 102, .3);
  color: #ff8fa5; border-radius: 9px; padding: 11px 14px; font-size: 13px; margin-bottom: 16px; }
.banner { border-radius: var(--radius); padding: 16px 20px; display: flex;
  align-items: center; gap: 16px; flex-wrap: wrap; }
.banner.amber { background: rgba(255, 176, 32, .06); border: 1px solid rgba(255, 176, 32, .3); }

.seg { display: flex; gap: 8px; margin-top: 6px; }
.seg label {
  flex: 1; margin: 0; padding: 11px; text-align: center; border-radius: 9px;
  border: 1px solid var(--border-2); font-size: 13px; cursor: pointer; color: var(--muted);
}
.seg input { display: none; }
.seg input:checked + span { color: var(--primary); }
.seg label:has(input:checked) { border-color: rgba(0, 229, 255, .6); background: var(--primary-dim); }

/* ------------------------------------------------------------ responsive */
@media (max-width: 1000px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; overflow-x: auto; align-items: center; }
  .sidebar .nav { display: flex; gap: 4px; padding: 8px; }
  .nav-label, .side-foot, .nav-item .count { display: none; }
  .nav-item { white-space: nowrap; }
  .grid.c4 { grid-template-columns: repeat(2, 1fr); }
  .grid.c3, .grid.c2 { grid-template-columns: 1fr; }
  .content, .topbar { padding-left: 16px; padding-right: 16px; }
}
@media (max-width: 560px) {
  .grid.c4 { grid-template-columns: 1fr; }
  .table-scroll { overflow-x: auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
