* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text-main);
  background: var(--bg-gradient) fixed;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 4px; font-weight: 650; }
h2 { font-size: 16px; margin: 0 0 12px; font-weight: 600; }
h3 { font-size: 14px; margin: 0 0 8px; font-weight: 600; color: var(--text-dim); }
p { margin: 0 0 10px; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }

/* ── Shell ─────────────────────────────────────────── */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-width);
  background: var(--glass-bg); border-right: 1px solid var(--glass-border);
  backdrop-filter: blur(var(--glass-blur));
  display: flex; flex-direction: column; padding: 18px 12px; z-index: 10;
}
.brand { display: flex; gap: 10px; align-items: center; padding: 4px 8px 18px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: var(--accent-gradient); color: var(--accent-text-on-fill); font-weight: 800;
}
.brand-name { font-weight: 700; }
.brand-sub { font-size: 12px; color: var(--text-faint); }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-faint); padding: 12px 10px 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--text-dim); text-decoration: none !important;
}
.nav-item:hover { background: var(--glass-bg-soft); color: var(--text-main); }
.nav-item.active { background: var(--accent-glow-soft); color: var(--text-main); box-shadow: inset 2px 0 0 var(--accent); }
.nav-icon { width: 18px; text-align: center; }

.sidebar-foot { border-top: 1px solid var(--glass-border); padding: 12px 8px 0; font-size: 12px; color: var(--text-faint); }
.sidebar-foot .who { color: var(--text-main); font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; }

.main { margin-left: var(--sidebar-width); flex: 1; padding: 26px 30px 60px; max-width: 1400px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-sub { color: var(--text-faint); }

/* ── Surfaces ──────────────────────────────────────── */
.card {
  background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: var(--radius);
  padding: 18px; backdrop-filter: blur(var(--glass-blur)); margin-bottom: 16px;
}
.card.soft { background: var(--glass-bg-soft); }
.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1000px) { .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) {
  .sidebar { position: static; width: 100%; }
  .shell { flex-direction: column; }
  .main { margin-left: 0; padding: 16px; }
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
}

.stat { display: block; color: inherit; text-decoration: none !important; }
.stat:hover { border-color: var(--accent); }
.stat .label { color: var(--text-faint); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.stat .value { font-size: 28px; font-weight: 700; margin-top: 6px; }
.stat .hint { color: var(--text-dim); font-size: 12.5px; margin-top: 2px; }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.spacer { flex: 1; }
.muted { color: var(--text-faint); }
.dim { color: var(--text-dim); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-wrap; }

/* ── Forms ─────────────────────────────────────────── */
label.field { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--text-dim); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time],
input[type=search], select, textarea {
  background: rgba(4, 10, 26, 0.6); border: 1px solid var(--glass-border); color: var(--text-main);
  border-radius: var(--radius-sm); padding: 8px 10px; font: inherit; min-width: 0;
}
textarea { resize: vertical; min-height: 70px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow-soft); }
input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; }
label.check { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 700px) { .form-grid { grid-template-columns: 1fr; } }

/* ── Buttons ───────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--glass-border);
  background: var(--glass-bg-soft); color: var(--text-main); padding: 7px 13px; border-radius: var(--radius-sm);
  font: inherit; cursor: pointer; white-space: nowrap; text-decoration: none !important;
}
.btn:hover { border-color: var(--accent); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent-gradient); color: var(--accent-text-on-fill); border-color: transparent; font-weight: 600; }
.btn.danger { color: var(--danger); border-color: rgba(255, 138, 138, .45); }
.btn.danger.solid { background: var(--danger); color: #2a0000; font-weight: 700; }
.btn.ok { color: var(--ok); border-color: rgba(107, 255, 176, .45); }
.btn.small { padding: 4px 9px; font-size: 12.5px; }
.btn.link { background: none; border: none; color: var(--accent); padding: 0; }

/* ── Tables ────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); padding: 8px 10px; border-bottom: 1px solid var(--glass-border); }
.table td { padding: 10px; border-bottom: 1px solid rgba(120, 180, 255, 0.1); vertical-align: top; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--glass-bg-soft); }

/* ── Badges & alerts ───────────────────────────────── */
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--info-bg); color: var(--text-dim); margin: 1px 2px 1px 0; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.danger { background: var(--danger-bg); color: var(--danger); }
.badge.neutral { background: rgba(255, 255, 255, .06); color: var(--text-faint); }

.alert { padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 14px; border: 1px solid; }
.alert.error { background: var(--danger-bg); border-color: rgba(255, 138, 138, .4); color: var(--danger); }
.alert.success { background: var(--ok-bg); border-color: rgba(107, 255, 176, .35); color: var(--ok); }
.alert.warn { background: var(--warn-bg); border-color: rgba(255, 215, 107, .35); color: var(--warn); }
.alert.info { background: var(--info-bg); border-color: var(--glass-border); color: var(--text-dim); }

/* ── Bits ──────────────────────────────────────────── */
.checklist { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.checklist li { display: flex; gap: 10px; align-items: flex-start; }
.checklist .tick { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; flex-shrink: 0; }
.checklist .tick.done { background: var(--ok-bg); color: var(--ok); }
.checklist .tick.todo { background: var(--danger-bg); color: var(--danger); }

.bar { height: 8px; border-radius: 99px; background: rgba(255, 255, 255, .07); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent-gradient); }
.hbars { display: flex; align-items: flex-end; gap: 3px; height: 120px; }
.hbars > div { flex: 1; background: var(--accent-gradient); border-radius: 3px 3px 0 0; min-height: 2px; opacity: .85; }
.hbars-labels { display: flex; gap: 3px; font-size: 10px; color: var(--text-faint); }
.hbars-labels > span { flex: 1; text-align: center; }

.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.compare > div { background: rgba(4, 10, 26, .5); border-radius: var(--radius-sm); padding: 10px; border: 1px solid var(--glass-border); }
.transcript { display: flex; flex-direction: column; gap: 8px; max-height: 460px; overflow-y: auto; }
.turn { padding: 8px 12px; border-radius: 10px; max-width: 80%; }
.turn.caller { background: rgba(255, 255, 255, .06); align-self: flex-start; }
.turn.agent { background: var(--accent-glow-soft); align-self: flex-end; }
.turn .who { font-size: 11px; color: var(--text-faint); text-transform: uppercase; margin-bottom: 2px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--glass-border); margin-bottom: 16px; }
.tab { background: none; border: none; color: var(--text-dim); padding: 9px 14px; cursor: pointer; font: inherit; border-bottom: 2px solid transparent; }
.tab.active { color: var(--text-main); border-bottom-color: var(--accent); }

.modal-backdrop { position: fixed; inset: 0; background: rgba(0, 4, 14, .7); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: var(--glass-bg-strong); border: 1px solid var(--glass-border); border-radius: var(--radius); padding: 22px; width: min(720px, 100%); max-height: 90vh; overflow-y: auto; }

.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.auth-card { width: min(420px, 100%); }
.qr { background: #fff; padding: 10px; border-radius: 10px; width: 200px; height: 200px; }
.empty { text-align: center; padding: 30px; color: var(--text-faint); }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--glass-border); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

#blazor-error-ui { display: none; }
