/* Sasify Solutions admin — Linear density + Stripe rhythm, v2 */
:root {
  --bg:#0a0c10; --surface:#121620; --surface-2:#171c28; --surface-3:#1c222f;
  --border:#232a38; --border-strong:#323a4a;
  --ink:#eef0f4; --ink-soft:#c7ccd8; --muted:#8b93a7; --hush:#5c6478;
  --brand:#4f7cff; --brand-soft:rgba(79,124,255,0.12); --brand-ring:rgba(79,124,255,0.35);
  --success:#2fbf71; --success-soft:rgba(47,191,113,0.1);
  --warning:#e3a83b; --warning-soft:rgba(227,168,59,0.1);
  --danger:#e5484d; --danger-soft:rgba(229,72,77,0.1);
  --radius-1:4px; --radius-2:6px; --radius-3:10px; --radius-4:14px;
  --shadow-1: 0 1px 2px rgba(0,0,0,0.24);
  --shadow-lift: 0 8px 28px rgba(0,0,0,0.32);
  --mono: ui-monospace, "SF Mono", "Cascadia Code", monospace;
  --sans: ui-sans-serif, -apple-system, "Inter", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin:0; background:var(--bg); color:var(--ink); font-family:var(--sans);
  font-size:13.5px; -webkit-font-smoothing:antialiased; }
a { color: var(--brand); text-decoration:none; }
a:hover { text-decoration:underline; }
svg.icon { width:16px; height:16px; stroke:currentColor; fill:none; stroke-width:1.75;
  stroke-linecap:round; stroke-linejoin:round; flex-shrink:0; vertical-align:-3px; }

::-webkit-scrollbar { width:10px; height:10px; }
::-webkit-scrollbar-track { background:transparent; }
::-webkit-scrollbar-thumb { background:var(--border-strong); border-radius:6px; }

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

/* ---------- Sidebar ---------- */
.sidebar {
  width:232px; flex-shrink:0; background:var(--surface); border-right:1px solid var(--border);
  padding:18px 12px; position:sticky; top:0; height:100vh; display:flex; flex-direction:column;
}
.sidebar .brand { display:flex; align-items:center; gap:9px; font-weight:700; font-size:14px;
  padding:4px 8px 20px; letter-spacing:-0.01em; color:var(--ink); }
.sidebar .brand .mark {
  width:26px; height:26px; border-radius:7px; background:linear-gradient(145deg,#4f7cff,#7c5cff);
  display:flex; align-items:center; justify-content:center; color:#fff; flex-shrink:0;
  box-shadow: 0 2px 8px rgba(79,124,255,0.35);
}
.sidebar .group-label { font-size:10px; text-transform:uppercase; letter-spacing:0.09em;
  color:var(--hush); font-weight:700; padding:14px 10px 6px; }
.sidebar nav { display:flex; flex-direction:column; gap:1px; flex:1; }
.sidebar nav a {
  color:var(--muted); font-size:13px; padding:8px 10px; border-radius:7px; font-weight:500;
  display:flex; align-items:center; gap:9px;
}
.sidebar nav a:hover { background:var(--surface-2); color:var(--ink); text-decoration:none; }
.sidebar nav a.active { background:var(--brand-soft); color:var(--brand); }
.sidebar nav a.active svg { stroke:var(--brand); }
.sidebar .divider { height:1px; background:var(--border); margin:12px 4px; }
.sidebar .foot { padding-top:10px; }
.sidebar .foot .user-row { display:flex; align-items:center; gap:9px; padding:8px 10px 10px;
  font-size:12px; color:var(--muted); }
.sidebar .foot .user-row .dot { width:7px; height:7px; border-radius:50%; background:var(--success);
  box-shadow:0 0 0 3px rgba(47,191,113,0.15); flex-shrink:0; }
.sidebar form.logout button {
  width:100%; background:none; border:1px solid var(--border); color:var(--muted);
  padding:8px; border-radius:7px; font-size:12.5px; cursor:pointer; display:flex;
  align-items:center; justify-content:center; gap:6px; font-weight:500;
}
.sidebar form.logout button:hover { border-color:var(--border-strong); color:var(--ink); background:var(--surface-2); }

/* ---------- Main ---------- */
.main { flex:1; min-width:0; padding:26px 34px 48px; max-width:1280px; }
.breadcrumb { font-size:12px; color:var(--muted); margin-bottom:12px; }
.breadcrumb a { color:var(--muted); }
.breadcrumb a:hover { color:var(--ink); }
.page-header { display:flex; align-items:flex-start; justify-content:space-between; margin-bottom:26px; gap:16px; }
.page-header h1 { font-size:19px; font-weight:650; margin:0 0 4px; letter-spacing:-0.015em;
  display:flex; align-items:center; gap:10px; }
.page-header p { font-size:12.5px; color:var(--muted); margin:0; }
.page-header .actions { display:flex; gap:8px; flex-shrink:0; }

/* ---------- Stat cards ---------- */
.stat-grid { display:grid; grid-template-columns:repeat(4,1fr); gap:12px; margin-bottom:22px; }
.stat-card {
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-3);
  padding:16px 17px; position:relative; overflow:hidden;
}
.stat-card .top-row { display:flex; align-items:center; justify-content:space-between; margin-bottom:10px; }
.stat-card .label { font-size:11px; text-transform:uppercase; letter-spacing:0.06em; color:var(--muted); font-weight:600; }
.stat-card .icon-box { width:26px; height:26px; border-radius:7px; display:flex; align-items:center;
  justify-content:center; flex-shrink:0; }
.stat-card .icon-box svg { width:14px; height:14px; }
.stat-card .icon-box.blue { background:var(--brand-soft); color:var(--brand); }
.stat-card .icon-box.green { background:var(--success-soft); color:var(--success); }
.stat-card .icon-box.amber { background:var(--warning-soft); color:var(--warning); }
.stat-card .icon-box.gray { background:var(--surface-2); color:var(--muted); }
.stat-card .value { font-size:23px; font-weight:650; font-family:var(--mono); font-feature-settings:"tnum"; letter-spacing:-0.02em; }
.stat-card .sub { font-size:11.5px; color:var(--hush); margin-top:4px; }

/* ---------- Cards / tables ---------- */
.card { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-3); }
.card + .card { margin-top:18px; }
.card-header { display:flex; align-items:center; justify-content:space-between;
  padding:14px 18px; border-bottom:1px solid var(--border); gap:12px; }
.card-header h2 { font-size:13.5px; font-weight:650; margin:0; display:flex; align-items:center; gap:8px; }
.card-header .hint { font-size:11.5px; color:var(--muted); font-weight:400; }
.card-body { padding:18px; }
.card-body.flush { padding:0; overflow-x:auto; -webkit-overflow-scrolling:touch; }
.card-body.chart-body { padding:18px 18px 8px; }

table { width:100%; border-collapse:collapse; font-size:13px; }
th { text-align:left; font-size:10.5px; text-transform:uppercase; letter-spacing:0.06em;
  color:var(--muted); font-weight:650; padding:10px 18px; border-bottom:1px solid var(--border);
  background:var(--surface); position:sticky; top:0; }
td { padding:11px 18px; border-bottom:1px solid var(--border); vertical-align:middle; }
tbody tr:last-child td { border-bottom:none; }
tbody tr { transition: background 0.1s; }
tbody tr:hover td { background:var(--surface-2); }
.mono { font-family:var(--mono); font-feature-settings:"tnum"; font-size:12.5px; }
.cell-primary { font-weight:600; color:var(--ink); }
.cell-muted { color:var(--muted); }
.row-link { display:block; }

/* ---------- Buttons ---------- */
.btn {
  display:inline-flex; align-items:center; gap:6px; padding:7px 14px; border-radius:7px;
  font-size:12.5px; font-weight:600; border:1px solid var(--border-strong); cursor:pointer;
  background:var(--surface-2); color:var(--ink); transition:background 0.12s, border-color 0.12s;
}
.btn svg { width:14px; height:14px; }
.btn:hover { background:var(--border); text-decoration:none; }
.btn-primary { background:var(--brand); border-color:var(--brand); color:#fff; box-shadow:0 1px 0 rgba(0,0,0,0.08); }
.btn-primary:hover { background:#3d68f0; }
.btn-danger { background:transparent; border-color:var(--danger); color:var(--danger); }
.btn-danger:hover { background:var(--danger-soft); }
.btn-sm { padding:5px 10px; font-size:11.5px; }
.btn-ghost { background:transparent; border-color:transparent; color:var(--muted); }
.btn-ghost:hover { background:var(--surface-2); color:var(--ink); }
.btn-block { width:100%; justify-content:center; }
.btn:disabled { opacity:0.5; cursor:not-allowed; }

/* ---------- Tags / pills ---------- */
.tag { display:inline-flex; align-items:center; gap:4px; padding:2.5px 8px; border-radius:999px;
  font-size:10.5px; font-weight:650; text-transform:uppercase; letter-spacing:0.03em;
  border:1px solid; white-space:nowrap; }
.tag svg { width:10px; height:10px; }
.tag-ok { color:var(--success); border-color:rgba(47,191,113,0.35); background:var(--success-soft); }
.tag-warn { color:var(--warning); border-color:rgba(227,168,59,0.35); background:var(--warning-soft); }
.tag-danger { color:var(--danger); border-color:rgba(229,72,77,0.35); background:var(--danger-soft); }
.tag-neutral { color:var(--muted); border-color:var(--border); background:var(--surface-2); }
.tag-brand { color:var(--brand); border-color:rgba(79,124,255,0.35); background:var(--brand-soft); }

/* ---------- Progress ---------- */
.progress { height:6px; border-radius:3px; background:var(--surface-2); overflow:hidden; border:1px solid var(--border); }
.progress-bar { height:100%; background:var(--brand); border-radius:3px; transition:width 0.4s ease; }
.progress-bar.warn { background:var(--warning); }
.progress-bar.danger { background:var(--danger); }

/* ---------- Forms ---------- */
label { display:block; font-size:12px; color:var(--ink-soft); margin-bottom:7px; font-weight:600; }
input[type=text], input[type=number], input[type=password], input[type=search], textarea {
  width:100%; padding:9px 11px; background:#0d1017; border:1px solid var(--border);
  border-radius:7px; color:var(--ink); font-size:13px; font-family:var(--sans); transition:border-color 0.12s;
}
input[type=number] { font-family:var(--mono); }
input:focus, textarea:focus { outline:none; border-color:var(--brand); box-shadow:0 0 0 3px var(--brand-soft); }
.field { margin-bottom:18px; }
.field-hint { font-size:11.5px; color:var(--hush); margin-top:6px; line-height:1.4; }
.grid-2 { display:grid; grid-template-columns:1fr 1fr; gap:16px; }
.input-affix { position:relative; }
.input-affix .affix { position:absolute; left:11px; top:50%; transform:translateY(-50%); color:var(--muted); font-size:12.5px; font-family:var(--mono); pointer-events:none; }
.input-affix input { padding-left:26px; }
.input-affix.suffix input { padding-left:11px; padding-right:72px; }
.input-affix.suffix .affix { left:auto; right:11px; font-family:var(--sans); font-weight:600; }

/* ---------- Model picker ---------- */
.model-picker-wrap { border:1px solid var(--border); border-radius:9px; background:#0d1017; overflow:hidden; }
.model-picker-search { position:relative; border-bottom:1px solid var(--border); padding:8px; }
.model-picker-search svg { position:absolute; left:16px; top:50%; transform:translateY(-50%); color:var(--muted); width:14px; height:14px; }
.model-picker-search input { padding-left:32px; background:transparent; border:none; }
.model-picker-search input:focus { box-shadow:none; }
.model-picker-toolbar { display:flex; align-items:center; justify-content:space-between; padding:6px 12px;
  border-bottom:1px solid var(--border); font-size:11px; color:var(--muted); }
.model-picker-toolbar .links { display:flex; gap:10px; }
.model-picker-toolbar .links a { font-size:11px; font-weight:600; }
.model-picker { max-height:280px; overflow-y:auto; padding:6px; }
.model-row {
  display:flex; align-items:center; gap:9px; padding:7px 8px; font-size:12.5px;
  color:var(--ink-soft); cursor:pointer; margin:0; border-radius:6px;
}
.model-row:hover { background:var(--surface-2); }
.model-row input[type=checkbox] { width:15px; height:15px; margin:0; accent-color:var(--brand); flex-shrink:0; }
.model-row .model-id { font-family:var(--mono); font-size:12px; flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.model-row.hidden-row { display:none; }
.model-count-badge { font-size:11px; color:var(--muted); font-weight:600; }

/* ---------- Callouts ---------- */
.callout { border:1px solid var(--border); border-radius:9px; padding:13px 15px; font-size:12.5px;
  color:var(--ink-soft); background:var(--surface-2); margin-bottom:16px; display:flex; gap:10px; align-items:flex-start; }
.callout svg { flex-shrink:0; margin-top:1px; }
.callout.reveal { border-color:rgba(47,191,113,0.4); background:var(--success-soft); }
.callout.reveal svg { color:var(--success); }
.callout.info { border-color:rgba(79,124,255,0.35); background:var(--brand-soft); }
.callout.info svg { color:var(--brand); }
.callout code { font-family:var(--mono); font-size:12px; word-break:break-all; }
.key-reveal-box { display:flex; align-items:center; gap:8px; background:#0d1017; border:1px solid var(--border);
  border-radius:8px; padding:12px 14px; margin:12px 0; }
.key-reveal-box code { flex:1; font-family:var(--mono); font-size:13px; color:var(--success); word-break:break-all; }
.copy-btn { flex-shrink:0; background:var(--surface-2); border:1px solid var(--border-strong); border-radius:6px;
  padding:6px 10px; font-size:11.5px; font-weight:600; color:var(--ink); cursor:pointer; display:flex; align-items:center; gap:5px; }
.copy-btn:hover { background:var(--border); }
.copy-btn svg { width:13px; height:13px; }

/* ---------- Empty state ---------- */
.empty { text-align:center; padding:52px 20px; color:var(--muted); font-size:12.5px; }
.empty svg { width:32px; height:32px; color:var(--hush); margin-bottom:12px; }
.empty .empty-title { font-size:13.5px; color:var(--ink-soft); font-weight:600; margin-bottom:4px; }

/* ---------- Charts ---------- */
.chart-wrap { position:relative; height:220px; }
.legend-row { display:flex; gap:18px; padding:0 18px 14px; font-size:12px; color:var(--muted); }
.legend-row .dot { width:8px; height:8px; border-radius:50%; display:inline-block; margin-right:6px; }

/* ---------- Table horizontal scroll wrapper ---------- */
.table-scroll { overflow-x:auto; -webkit-overflow-scrolling:touch; }
.table-scroll table { min-width:640px; }

/* ---------- Mobile topbar (hidden on desktop) ---------- */
.mobile-topbar {
  display:none; align-items:center; justify-content:space-between;
  padding:12px 14px; background:var(--surface); border-bottom:1px solid var(--border);
  position:sticky; top:0; z-index:40;
}
.mobile-topbar .brand-mini { display:flex; align-items:center; gap:8px; font-weight:700; font-size:13px; white-space:nowrap; }
.mobile-topbar .brand-mini .mark {
  width:24px; height:24px; border-radius:6px; background:linear-gradient(145deg,#4f7cff,#7c5cff);
  display:flex; align-items:center; justify-content:center; color:#fff; flex-shrink:0;
}
.mobile-topbar .brand-mini .mark svg { width:13px; height:13px; }
.hamburger-btn {
  width:38px; height:38px; border-radius:8px; border:1px solid var(--border); background:var(--surface-2);
  display:flex; align-items:center; justify-content:center; color:var(--ink); cursor:pointer; flex-shrink:0;
}
.hamburger-btn svg { width:19px; height:19px; }
.sidebar-overlay {
  display:none; position:fixed; inset:0; background:rgba(0,0,0,0.5); z-index:45;
}
.sidebar-overlay.open { display:block; }

/* ---------- Responsive breakpoints ---------- */
@media (max-width: 980px) {
  .stat-grid { grid-template-columns:repeat(2,1fr); }
  .grid-2 { grid-template-columns:1fr; }
}

@media (max-width: 760px) {
  html, body { font-size:13.5px; }
  .mobile-topbar { display:flex; }

  .shell { display:block; }
  .sidebar {
    position:fixed; top:0; left:0; z-index:50; height:100vh; width:78vw; max-width:280px;
    transform:translateX(-100%); transition:transform 0.22s ease; box-shadow:var(--shadow-lift);
  }
  .sidebar.open { transform:translateX(0); }
  .sidebar .brand { padding-top:2px; }

  .main { padding:16px 14px 40px; max-width:100%; }

  .page-header { flex-direction:column; align-items:stretch; gap:10px; margin-bottom:18px; }
  .page-header h1 { font-size:17px; }
  .page-header .actions { width:100%; }
  .page-header .actions .btn { flex:1; justify-content:center; }

  .stat-grid { grid-template-columns:repeat(2,1fr); gap:9px; margin-bottom:16px; }
  .stat-card { padding:12px 13px; }
  .stat-card .value { font-size:18px; }
  .stat-card .label { font-size:10px; }

  .card-header { padding:12px 14px; flex-wrap:wrap; }
  .card-header h2 { font-size:13px; }
  .card-body { padding:14px; }
  .card-body.chart-body { padding:12px 10px 6px; }

  table { font-size:12px; min-width:560px; }
  th, td { padding:9px 12px; white-space:nowrap; }

  .btn { padding:9px 14px; font-size:12.5px; }
  .btn-sm { padding:7px 11px; }

  .grid-2 { gap:14px; }

  .key-reveal-box { flex-direction:column; align-items:stretch; }
  .key-reveal-box code { word-break:break-all; font-size:11.5px; }
  .copy-btn { justify-content:center; }

  .model-picker { max-height:220px; }
  .model-picker-toolbar { flex-wrap:wrap; gap:6px; }

  .chart-wrap { height:180px; }

  .breadcrumb { margin-bottom:10px; }
}

@media (max-width: 420px) {
  .stat-grid { grid-template-columns:1fr; }
}
