/* Call — demo application */

:root {
  /* chart roles — validated reference categorical palette (light surface) */
  --s1: #2a78d6;
  --s2: #eb6834;
  --s3: #1baf7a;
  --s4: #eda100;
  --s5: #e87ba4;
  --s6: #008300;
  --seq-100: #cde2fb;
  --seq-250: #86b6ef;
  --seq-350: #5598e7;
  --seq-450: #2a78d6;
  --seq-550: #1c5cab;
  --seq-650: #104281;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --ink-muted: #898781;
  --chart-surface: #ffffff;

  --sidebar: #0a0f2c;
  --sidebar-2: #121a45;
}

body {
  background: var(--surface);
}

/* ---------------- shell ---------------- */

.shell {
  display: grid;
  grid-template-columns: 238px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: linear-gradient(180deg, var(--sidebar) 0%, #0d1436 100%);
  color: rgba(255, 255, 255, 0.72);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 18px;
  color: #fff;
  font-weight: 700;
  font-size: 18px;
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar .brand .mark {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: linear-gradient(140deg, var(--brand), var(--accent));
  display: grid;
  place-items: center;
  flex: none;
}

.sidebar .brand .mark svg {
  width: 17px;
  height: 17px;
  fill: #fff;
}

.sidebar .brand small {
  display: block;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.42);
  margin-top: -3px;
}

.side-nav {
  padding: 14px 12px;
  display: grid;
  gap: 2px;
  align-content: start;
  flex: 1;
}

.side-nav .group {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.32);
  padding: 16px 10px 6px;
}

.side-nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  border-radius: 9px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.72);
  transition: background 0.15s ease, color 0.15s ease;
}

.side-nav a:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
}

.side-nav a.active {
  background: linear-gradient(100deg, rgba(79, 70, 229, 0.9), rgba(6, 182, 212, 0.5));
  color: #fff;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.32);
}

.side-nav svg {
  width: 17px;
  height: 17px;
  flex: none;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.side-nav .count {
  margin-inline-start: auto;
  font-size: 11px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.14);
  padding: 1px 7px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}

.side-nav a.active .count {
  background: rgba(255, 255, 255, 0.26);
}

.side-foot {
  padding: 14px 16px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 11.5px;
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.42);
}

.side-foot a {
  color: rgba(255, 255, 255, 0.72);
}

.demo-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(250, 178, 25, 0.14);
  border: 1px solid rgba(250, 178, 25, 0.34);
  color: #fbbf24;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  margin-bottom: 9px;
}

/* ---------------- topbar ---------------- */

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(12px) saturate(160%);
  -webkit-backdrop-filter: blur(12px) saturate(160%);
  border-bottom: 1px solid var(--line);
  padding: 14px 26px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.topbar h1 {
  font-size: 19px;
  margin: 0;
  letter-spacing: -0.01em;
}

.topbar .sub {
  font-size: 12.5px;
  color: var(--faint);
  margin-top: 1px;
}

.topbar .spacer {
  flex: 1;
}

.sidebar-toggle {
  display: none;
  background: none;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 7px;
  cursor: pointer;
}

.ctrl {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 7px 11px;
  font-size: 13.5px;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ctrl:hover {
  border-color: var(--line-strong);
}

select.ctrl,
input.ctrl {
  cursor: auto;
}

.seg {
  display: inline-flex;
  background: var(--surface-2);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}

.seg button {
  border: 0;
  background: none;
  padding: 6px 13px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.seg button.on {
  background: #fff;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.btn-sim {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 0;
  border-radius: 10px;
  padding: 9px 16px;
  font-size: 13.5px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), #6366f1 60%, var(--accent));
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.32);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.btn-sim:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(79, 70, 229, 0.4);
}

.btn-sim:disabled {
  opacity: 0.6;
  cursor: default;
  transform: none;
}

.btn-sim svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------------- content ---------------- */

.content {
  padding: 24px 26px 56px;
  flex: 1;
}

.view {
  display: none;
}

.view.on {
  display: block;
  animation: fade 0.25s ease;
}

@keyframes fade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
}

.card-head {
  padding: 16px 20px 12px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

.card-head h2 {
  font-size: 15.5px;
  margin: 0;
  letter-spacing: -0.005em;
}

.card-head p {
  font-size: 12.5px;
  color: var(--faint);
  margin: 2px 0 0;
}

.card-head .spacer {
  flex: 1;
}

.card-body {
  padding: 4px 20px 20px;
}

/* KPI row */

.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(178px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.kpi {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
}

.kpi .l {
  font-size: 12.5px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.kpi .v {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.025em;
  margin-top: 6px;
  line-height: 1.15;
}

.kpi .v .u {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  margin-inline-start: 3px;
  letter-spacing: 0;
}

.kpi .d {
  font-size: 12px;
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
}

.kpi .d.up { color: #006300; }
.kpi .d.down { color: var(--bad); }
.kpi .d.flat { color: var(--faint); }

.kpi.hero {
  background: linear-gradient(140deg, #0d1440, #1f2a68);
  border-color: transparent;
  color: #fff;
}

.kpi.hero .l { color: rgba(255, 255, 255, 0.66); }
.kpi.hero .v { font-size: 38px; }
.kpi.hero .v .u { color: rgba(255, 255, 255, 0.7); }
.kpi.hero .d.up { color: #6ee7b7; }

/* grid helpers */

.grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1.62fr) minmax(0, 1fr);
  gap: 16px;
  margin-bottom: 16px;
  align-items: start;
}

.grid-2.even {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
  align-items: start;
}

/* ---------------- charts ---------------- */

.chart {
  position: relative;
  width: 100%;
}

.chart svg {
  width: 100%;
  height: auto;
  overflow: visible;
  display: block;
}

.chart .gridline {
  stroke: var(--grid);
  stroke-width: 1;
  shape-rendering: crispEdges;
}

.chart .baseline {
  stroke: var(--axis);
  stroke-width: 1;
  shape-rendering: crispEdges;
}

.chart text {
  font-family: var(--font);
  fill: var(--ink-muted);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
}

.chart .hit {
  fill: transparent;
  cursor: pointer;
}

.chart .col rect.seg {
  transition: opacity 0.12s ease;
}

.chart .col.dim rect.seg {
  opacity: 0.35;
}

.tip {
  position: absolute;
  z-index: 30;
  background: #10162c;
  color: #fff;
  border-radius: 9px;
  padding: 9px 12px;
  font-size: 12px;
  line-height: 1.6;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -108%);
  transition: opacity 0.12s ease;
  box-shadow: 0 10px 30px rgba(16, 22, 44, 0.28);
  white-space: nowrap;
}

.tip.show {
  opacity: 1;
}

.tip b {
  display: block;
  font-size: 12.5px;
  margin-bottom: 3px;
}

.tip .row {
  display: flex;
  align-items: center;
  gap: 7px;
  color: rgba(255, 255, 255, 0.82);
}

.tip .sw {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  flex: none;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 14px;
  font-size: 12.5px;
  color: var(--muted);
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.legend i {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex: none;
}

/* horizontal bar list (intent breakdown) */

.hbars {
  display: grid;
  gap: 11px;
}

.hbar {
  display: grid;
  grid-template-columns: 9.8em minmax(0, 1fr) 3.4em;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.hbar .name {
  color: var(--ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hbar .track {
  background: var(--surface-2);
  border-radius: 4px;
  height: 12px;
  overflow: hidden;
}

.hbar .fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.hbar .n {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: 12.5px;
}

/* stacked share bar */

.share-bar {
  display: flex;
  height: 22px;
  border-radius: 6px;
  overflow: hidden;
  gap: 2px;
  background: var(--surface-2);
}

.share-bar span {
  height: 100%;
  min-width: 3px;
}

/* ---------------- tables ---------------- */

.table-wrap {
  overflow-x: auto;
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  min-width: 640px;
}

table.data th {
  text-align: left;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--faint);
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  position: sticky;
  top: 0;
  background: #fff;
}

table.data td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

table.data tbody tr {
  cursor: pointer;
  transition: background 0.12s ease;
}

table.data tbody tr:hover {
  background: var(--brand-softer);
}

table.data tbody tr.unread td:first-child {
  box-shadow: inset 3px 0 0 var(--brand);
  font-weight: 700;
}

table.data .num {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

table.data .who {
  font-weight: 600;
}

table.data .ph {
  color: var(--faint);
  font-size: 12px;
  font-family: var(--font-mono);
}

table.data .sum {
  color: var(--muted);
  font-size: 12.5px;
  max-width: 42ch;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-clamp: 2;
  overflow: hidden;
}

.empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--faint);
  font-size: 14px;
}

/* badges */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
  border: 1px solid transparent;
}

.badge.ok { background: var(--ok-soft); color: #046c4e; border-color: #bfe6d7; }
.badge.warn { background: var(--warn-soft); color: #8a4b06; border-color: #f4dcb4; }
.badge.bad { background: var(--bad-soft); color: #a3123a; border-color: #f6c7d2; }
.badge.info { background: var(--info-soft); color: #075f8f; border-color: #c3e0f2; }
.badge.mute { background: var(--surface-2); color: var(--muted); border-color: var(--line); }
.badge.brand { background: var(--brand-soft); color: var(--brand-700); border-color: #d5d8fb; }

.badge .ico {
  font-size: 10px;
  line-height: 1;
}

.tag-mini {
  display: inline-block;
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--muted);
  margin-inline-end: 4px;
}

.dot-intent {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-inline-end: 7px;
  vertical-align: 0;
  flex: none;
}

/* filters row */

.filters {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 14px;
}

.filters input[type='search'] {
  min-width: 220px;
  flex: 1 1 220px;
  max-width: 340px;
}

.pager {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-end;
  padding: 14px 4px 0;
  font-size: 13px;
  color: var(--muted);
}

.pager button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 13px;
}

.pager button:disabled {
  opacity: 0.45;
  cursor: default;
}

/* ---------------- drawer ---------------- */

.scrim {
  position: fixed;
  inset: 0;
  background: rgba(10, 15, 44, 0.42);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s ease;
  z-index: 60;
  backdrop-filter: blur(2px);
}

.scrim.on {
  opacity: 1;
  pointer-events: auto;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(560px, 100%);
  background: #fff;
  z-index: 61;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  display: flex;
  flex-direction: column;
  box-shadow: -18px 0 50px rgba(16, 22, 44, 0.16);
}

.drawer.on {
  transform: none;
}

.drawer-head {
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.drawer-head h2 {
  font-size: 17px;
  margin: 0 0 3px;
}

.drawer-head .sub {
  font-size: 12.5px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

.drawer-close {
  margin-inline-start: auto;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 9px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex: none;
  font-size: 16px;
  color: var(--muted);
}

.drawer-close:hover {
  background: var(--surface);
}

.drawer-body {
  overflow-y: auto;
  padding: 18px 22px 30px;
  flex: 1;
}

.summary-box {
  background: linear-gradient(140deg, var(--brand-softer), var(--accent-soft));
  border: 1px solid #dfe3fb;
  border-radius: 12px;
  padding: 15px 17px;
  font-size: 14px;
  line-height: 1.8;
  margin-bottom: 18px;
}

.summary-box .lbl {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--brand-700);
  display: block;
  margin-bottom: 5px;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 18px;
  margin-bottom: 20px;
}

.meta-grid .k {
  font-size: 11.5px;
  color: var(--faint);
  margin-bottom: 2px;
}

.meta-grid .v {
  font-size: 13.5px;
  font-weight: 600;
}

.sect-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--faint);
  margin: 22px 0 12px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--line);
}

.turn {
  display: flex;
  gap: 10px;
  margin-bottom: 13px;
}

.turn .tag {
  flex: none;
  width: 36px;
  height: 22px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  font-size: 10.5px;
  font-weight: 700;
  margin-top: 2px;
}

.turn.ai .tag { background: var(--brand-soft); color: var(--brand-700); }
.turn.caller .tag { background: var(--surface-2); color: var(--muted); }

.turn .bubble {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 9px 13px;
  font-size: 13.5px;
  line-height: 1.75;
}

.turn.ai .bubble {
  background: var(--brand-softer);
  border-color: #e2e5fc;
}

.sent-meter {
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(to right, #d03b3b, #f0efec 50%, #0ca30c);
  position: relative;
  margin: 10px 0 6px;
}

.sent-meter i {
  position: absolute;
  top: -4px;
  width: 4px;
  height: 16px;
  border-radius: 2px;
  background: var(--ink);
  box-shadow: 0 0 0 2px #fff;
  transform: translateX(-50%);
}

.sent-scale {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--faint);
}

.drawer-actions {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

/* ---------------- forms (agent settings) ---------------- */

.form-grid {
  display: grid;
  gap: 18px;
}

.field label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: 6px;
}

.field .hint {
  font-size: 12px;
  color: var(--faint);
  margin-top: 5px;
}

.field input[type='text'],
.field textarea,
.field select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field textarea {
  resize: vertical;
  min-height: 78px;
  line-height: 1.75;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.14);
}

.switch-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}

.switch-row:last-child {
  border-bottom: 0;
}

.switch-row .txt {
  flex: 1;
}

.switch-row .txt b {
  font-size: 14px;
  display: block;
}

.switch-row .txt span {
  font-size: 12.5px;
  color: var(--faint);
}

.switch {
  position: relative;
  display: inline-block; /* required inside table cells, where inline boxes ignore width/height */
  width: 42px;
  height: 24px;
  flex: none;
  vertical-align: middle;
}

.switch-row .switch {
  margin-top: 2px;
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
  z-index: 2;
}

.switch i {
  position: absolute;
  inset: 0;
  background: var(--line-strong);
  border-radius: 999px;
  transition: background 0.2s ease;
}

.switch i::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s ease;
}

.switch input:checked + i {
  background: var(--brand);
}

.switch input:checked + i::after {
  transform: translateX(18px);
}

.switch input:focus-visible + i {
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.28);
}

.hours-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.hours-table td {
  padding: 7px 6px;
  border-bottom: 1px solid var(--line);
}

.hours-table td:first-child {
  width: 3.4em;
  font-weight: 600;
}

.hours-table td:nth-child(2) {
  width: 58px;
}

.hours-table input[type='text'] {
  width: 82px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 8px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.kb-item {
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 13px 15px;
  margin-bottom: 10px;
  background: var(--surface);
}

.kb-item .q {
  font-weight: 700;
  font-size: 13.5px;
  margin-bottom: 4px;
}

.kb-item .a {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.75;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.chip {
  background: var(--bad-soft);
  color: #a3123a;
  border: 1px solid #f6c7d2;
  border-radius: 7px;
  padding: 3px 10px;
  font-size: 12.5px;
  font-weight: 600;
}

.save-bar {
  position: sticky;
  bottom: 0;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  padding: 13px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: 0 0 14px 14px;
  margin-top: 10px;
}

.save-bar .msg {
  font-size: 13px;
  color: var(--ok);
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.save-bar .msg.on {
  opacity: 1;
}

.btn-save {
  border: 0;
  background: var(--brand);
  color: #fff;
  border-radius: 10px;
  padding: 10px 22px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-inline-start: auto;
  transition: background 0.15s ease;
}

.btn-save:hover {
  background: var(--brand-600);
}

.btn-mini {
  border: 1px solid var(--line-strong);
  background: #fff;
  border-radius: 9px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.btn-mini:hover {
  border-color: var(--brand);
  color: var(--brand-700);
}

.btn-mini.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.btn-mini.primary:hover {
  background: var(--brand-600);
}

/* number cards */

.num-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.num-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}

.num-card .n {
  font-size: 21px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  margin: 4px 0 2px;
}

.num-card .lbl {
  font-size: 12.5px;
  color: var(--faint);
}

.num-card dl {
  margin: 14px 0 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 7px 14px;
  font-size: 13px;
}

.num-card dt {
  color: var(--faint);
}

.num-card dd {
  margin: 0;
  font-weight: 600;
  text-align: right;
}

/* toast */

.toast-host {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 90;
  display: grid;
  gap: 10px;
  max-width: min(360px, calc(100vw - 40px));
}

.toast {
  background: #10162c;
  color: #fff;
  border-radius: 12px;
  padding: 13px 16px;
  box-shadow: 0 16px 40px rgba(16, 22, 44, 0.32);
  font-size: 13.5px;
  line-height: 1.65;
  animation: toastIn 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  cursor: pointer;
}

.toast b {
  display: block;
  font-size: 13px;
  margin-bottom: 3px;
  color: #a5b4fc;
}

.toast.out {
  animation: toastOut 0.25s ease forwards;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(14px) scale(0.97); }
  to { opacity: 1; transform: none; }
}

@keyframes toastOut {
  to { opacity: 0; transform: translateY(8px); }
}

.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, #f4f6fb 37%, var(--surface-2) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s ease infinite;
  border-radius: 8px;
  height: 14px;
}

@keyframes shimmer {
  from { background-position: 100% 0; }
  to { background-position: 0 0; }
}

/* ---------------- responsive ---------------- */

@media (max-width: 1080px) {
  .grid-2,
  .grid-2.even,
  .grid-3 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 250px;
    z-index: 70;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  }
  .sidebar.on {
    transform: none;
  }
  .sidebar-toggle {
    display: grid;
    place-items: center;
  }
  .content {
    padding: 18px 16px 48px;
  }
  .topbar {
    padding: 12px 16px;
  }
}

@media (max-width: 640px) {
  .topbar h1 {
    font-size: 17px;
  }
  .kpi .v {
    font-size: 26px;
  }
  .meta-grid {
    grid-template-columns: 1fr;
  }
  .hbar {
    grid-template-columns: 7em minmax(0, 1fr) 3em;
    font-size: 12.5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
