/* ============================================================
   PULSE — interactive demo · style.css
   ============================================================ */

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

:root {
  --bg: #FAFBFC;
  --surface: #FFFFFF;
  --border: #E6E8EB;
  --border-h: #D1D5DA;
  --text: #0F172A;
  --text-2: #475569;
  --text-3: #94A3B8;
  --indigo: #4F46E5;
  --indigo-soft: #EEF2FF;
  --indigo-hover: #4338CA;
  --green: #10B981;
  --green-soft: #ECFDF5;
  --red: #EF4444;
  --red-soft: #FEF2F2;
  --amber: #F59E0B;
  --amber-soft: #FFFBEB;
  --purple: #8B5CF6;
  --shadow-sm: 0 1px 2px rgba(15,23,42,.04);
  --shadow:    0 1px 3px rgba(15,23,42,.06), 0 1px 2px rgba(15,23,42,.04);
  --shadow-md: 0 4px 12px rgba(15,23,42,.08), 0 2px 4px rgba(15,23,42,.04);
  --shadow-lg: 0 16px 40px rgba(15,23,42,.16), 0 4px 8px rgba(15,23,42,.04);
  --r: 8px;
  --r-sm: 6px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
}

body {
  background: var(--bg); color: var(--text); font-family: var(--font);
  font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

.layout { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }

/* ======================== SIDEBAR ======================== */
.side {
  background: var(--surface); border-right: 1px solid var(--border);
  padding: 22px 16px; display: flex; flex-direction: column; gap: 24px;
  position: sticky; top: 0; height: 100vh;
}
.side-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 0 8px; margin-bottom: 4px;
}
.brand-mark {
  width: 28px; height: 28px;
  background: var(--indigo); border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 14px;
  box-shadow: 0 4px 12px rgba(79,70,229,.3);
}
.brand-name { font-weight: 700; font-size: 15px; letter-spacing: -.01em; }
.brand-name em { color: var(--indigo); font-style: normal; }

.side-search {
  position: relative; width: 100%;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px 8px 32px;
  font-size: 13px; color: var(--text-3);
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--r-sm); font-family: inherit; text-align: left;
  transition: border-color .15s, color .15s;
}
.side-search:hover { color: var(--text-2); border-color: var(--border-h); }
.side-search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); }
.side-search .kbd {
  margin-left: auto;
  font-size: 11px; padding: 2px 6px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 4px; color: var(--text-3);
}

.nav-group { display: flex; flex-direction: column; gap: 1px; }
.nav-label {
  font-size: 11px; font-weight: 600; color: var(--text-3);
  text-transform: uppercase; letter-spacing: .06em;
  padding: 0 8px 6px; margin-top: 8px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: var(--r-sm);
  font-size: 13.5px; color: var(--text-2); font-weight: 500;
  cursor: pointer; transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--bg); color: var(--text); }
.nav-item.active { background: var(--indigo-soft); color: var(--indigo); }
.nav-item.active svg { color: var(--indigo); }
.nav-item svg { color: var(--text-3); flex-shrink: 0; }
.nav-item .badge {
  margin-left: auto; font-size: 10.5px; font-weight: 600;
  padding: 1px 6px; border-radius: 10px;
  background: var(--bg); color: var(--text-2);
  min-width: 20px; text-align: center;
}
.nav-item.active .badge { background: rgba(79,70,229,.15); color: var(--indigo); }
.nav-item .badge.live { background: rgba(16,185,129,.15); color: var(--green); }
.nav-item .badge.live .dot { display: inline-block; width: 6px; height: 6px; background: var(--green); border-radius: 50%; animation: pulse 1.4s infinite; }
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: .35; transform: scale(.7); }
}

.side-foot {
  margin-top: auto; padding: 12px 8px;
  display: flex; align-items: center; gap: 10px;
  border-top: 1px solid var(--border);
  cursor: pointer; transition: background .15s;
  border-radius: var(--r-sm);
}
.side-foot:hover { background: var(--bg); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, #fb7185, #f43f5e);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 600; font-size: 12px;
  flex-shrink: 0;
}
.side-user { flex: 1; min-width: 0; }
.side-user b { display: block; font-size: 13px; font-weight: 600; }
.side-user span { display: block; font-size: 11.5px; color: var(--text-3); }
.side-foot svg { color: var(--text-3); }

/* ======================== MAIN ======================== */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.crumb { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.crumb b { color: var(--text); font-weight: 600; }
.crumb svg { color: var(--text-3); }

.top-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid transparent;
  border-radius: var(--r-sm); color: var(--text-2); position: relative;
  transition: background .15s, color .15s, border-color .15s;
}
.icon-btn:hover { background: var(--bg); color: var(--text); border-color: var(--border); }
.notif-badge {
  position: absolute; top: 4px; right: 4px;
  min-width: 16px; height: 16px; padding: 0 4px;
  background: var(--red); color: #fff;
  border-radius: 8px; font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--surface);
}
.notif-badge:empty, .notif-badge[data-n="0"] { display: none; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; font-size: 13px; font-weight: 600;
  border-radius: var(--r-sm); border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
  font-family: inherit;
  transition: background .15s, border-color .15s, color .15s, transform .1s;
}
.btn:hover { background: var(--bg); border-color: var(--border-h); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--indigo); color: #fff; border-color: var(--indigo); box-shadow: 0 1px 2px rgba(79,70,229,.25); }
.btn-primary:hover { background: var(--indigo-hover); border-color: var(--indigo-hover); color: #fff; }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover { background: #DC2626; border-color: #DC2626; color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; }
.btn-ghost { background: transparent; border: 1px solid transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--bg); color: var(--text); }

/* ======================== CONTENT ======================== */
.content { padding: 28px 24px 80px; max-width: 100%; }
.page-head {
  display: flex; justify-content: space-between; align-items: flex-end;
  margin-bottom: 24px; gap: 16px; flex-wrap: wrap;
}
.page-head h1 {
  font-size: 22px; font-weight: 700; letter-spacing: -.02em;
  margin-bottom: 4px;
}
.page-head p { font-size: 13.5px; color: var(--text-2); }

.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.filter {
  padding: 6px 12px; font-size: 12.5px; font-weight: 500;
  border-radius: 16px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-2);
  transition: all .15s;
}
.filter.active { background: var(--text); color: var(--surface); border-color: var(--text); }
.filter:hover:not(.active) { border-color: var(--border-h); color: var(--text); }

/* STAT CARDS */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 18px;
  display: flex; flex-direction: column; gap: 8px;
  transition: border-color .15s, transform .15s;
}
.stat-card:hover { border-color: var(--border-h); }
.stat-row1 { display: flex; justify-content: space-between; align-items: center; }
.stat-label { font-size: 12.5px; color: var(--text-2); font-weight: 500; }
.stat-card svg.ic { color: var(--text-3); }
.stat-val { font-size: 26px; font-weight: 700; letter-spacing: -.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-delta {
  font-size: 12px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 7px; border-radius: 4px; width: fit-content;
}
.delta-up { background: var(--green-soft); color: var(--green); }
.delta-down { background: var(--red-soft); color: var(--red); }
.delta-neut { background: var(--bg); color: var(--text-2); }

/* CHART CARD */
.chart-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 22px; margin-bottom: 20px;
}
.chart-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 24px; gap: 16px; flex-wrap: wrap; }
.chart-head h3 { font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.chart-head p { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }
.chart-tabs { display: flex; gap: 4px; padding: 3px; background: var(--bg); border-radius: var(--r-sm); }
.chart-tab {
  padding: 5px 12px; font-size: 12px; font-weight: 500;
  color: var(--text-2); border-radius: 4px; transition: all .15s;
  background: transparent; border: none;
}
.chart-tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

.chart-bars {
  display: flex; align-items: flex-end; justify-content: space-between;
  height: 200px; gap: 8px; padding: 0 4px; position: relative;
}
.chart-bars::before {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: var(--border);
}
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; position: relative; cursor: pointer; }
.bar-stack { display: flex; flex-direction: column-reverse; width: 100%; gap: 2px; }
.bar-a, .bar-b { width: 100%; border-radius: 3px 3px 0 0; transition: opacity .2s; }
.bar-a { background: var(--indigo); }
.bar-b { background: rgba(79,70,229,.25); }
.bar-col:hover .bar-a, .bar-col:hover .bar-b { opacity: .7; }
.bar-col:hover .bar-tip { opacity: 1; transform: translateY(0); }
.bar-tip {
  position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%) translateY(4px);
  background: var(--text); color: #fff; padding: 6px 10px; border-radius: 6px;
  font-size: 11px; white-space: nowrap; opacity: 0; pointer-events: none;
  transition: opacity .15s, transform .15s;
  margin-bottom: 8px; box-shadow: var(--shadow-md);
}
.bar-tip b { color: #fff; }
.bar-tip::after {
  content: ''; position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  border: 4px solid transparent; border-top-color: var(--text);
}
.bar-lab { font-size: 10.5px; color: var(--text-3); font-weight: 500; }

.chart-legend { display: flex; gap: 18px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); }
.legend-dot { width: 8px; height: 8px; border-radius: 2px; }

/* TWO COL */
.twocol { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; }

/* PANELS */
.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); overflow: hidden;
}
.panel-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px; border-bottom: 1px solid var(--border); gap: 12px;
}
.panel-head h3 { font-size: 14.5px; font-weight: 600; }
.panel-head .panel-actions { display: flex; gap: 8px; align-items: center; }
.panel-head a, .panel-head button { font-size: 12.5px; color: var(--indigo); font-weight: 600; background: transparent; border: none; }
.panel-head a:hover, .panel-head button:hover { text-decoration: underline; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  text-align: left; padding: 10px 20px;
  font-size: 11px; font-weight: 600; color: var(--text-3);
  text-transform: uppercase; letter-spacing: .06em;
  background: var(--bg); border-bottom: 1px solid var(--border);
  cursor: pointer; user-select: none;
}
thead th:hover { color: var(--text); }
thead th .sort-i { display: inline-block; margin-left: 4px; opacity: .6; vertical-align: middle; }
thead th.sorted .sort-i { opacity: 1; color: var(--indigo); }
tbody td { padding: 12px 20px; border-bottom: 1px solid var(--border); }
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background .12s; cursor: pointer; }
tbody tr:hover { background: var(--bg); }
tbody tr.row-actions-open { background: var(--bg); }
.cust { display: flex; align-items: center; gap: 10px; }
.cust-av {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 600; font-size: 11px;
  flex-shrink: 0;
}
.av-1 { background: linear-gradient(135deg, #f59e0b, #ea580c); }
.av-2 { background: linear-gradient(135deg, #06b6d4, #0284c7); }
.av-3 { background: linear-gradient(135deg, #8b5cf6, #6366f1); }
.av-4 { background: linear-gradient(135deg, #10b981, #059669); }
.av-5 { background: linear-gradient(135deg, #f43f5e, #e11d48); }
.av-6 { background: linear-gradient(135deg, #6366f1, #4338CA); }
.av-7 { background: linear-gradient(135deg, #14b8a6, #0d9488); }
.av-8 { background: linear-gradient(135deg, #d946ef, #a21caf); }
.cust-info b { display: block; font-weight: 600; font-size: 13px; }
.cust-info span { font-size: 11.5px; color: var(--text-3); }
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; font-size: 11.5px; font-weight: 600;
  border-radius: 4px;
}
.pill-active { background: var(--green-soft); color: var(--green); }
.pill-trial { background: var(--amber-soft); color: var(--amber); }
.pill-paused { background: var(--bg); color: var(--text-2); }
.pill-cancel { background: var(--red-soft); color: var(--red); }
.pill::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.amount { font-variant-numeric: tabular-nums; font-weight: 600; }
.row-actions {
  display: inline-flex; gap: 4px; opacity: 0; transition: opacity .15s;
}
tbody tr:hover .row-actions { opacity: 1; }
.row-action {
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid transparent;
  border-radius: 4px; color: var(--text-3);
  transition: all .15s;
}
.row-action:hover { background: var(--surface); color: var(--text); border-color: var(--border); }
.row-action.danger:hover { color: var(--red); border-color: var(--red-soft); background: var(--red-soft); }

/* search input */
.search-inp {
  position: relative; flex: 1; max-width: 320px;
}
.search-inp input {
  width: 100%; padding: 7px 12px 7px 32px; font-size: 13px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-sm); font-family: inherit; color: var(--text);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.search-inp input:focus { border-color: var(--indigo); box-shadow: 0 0 0 3px rgba(79,70,229,.1); }
.search-inp svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.search-inp .clear-btn { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: transparent; border: none; color: var(--text-3); padding: 4px; }

/* Activity */
.activity-list { padding: 6px 0; max-height: 460px; overflow-y: auto; }
.act-item {
  display: grid; grid-template-columns: 28px 1fr auto;
  gap: 10px; padding: 12px 20px; align-items: flex-start;
  border-bottom: 1px solid var(--border);
  animation: actIn .35s ease;
}
.act-item:last-child { border-bottom: none; }
@keyframes actIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
.act-item.act-new {
  animation: actNew .6s ease;
}
@keyframes actNew {
  0% { background: var(--green-soft); transform: translateY(-6px); opacity: 0; }
  35% { background: var(--green-soft); opacity: 1; transform: translateY(0); }
  100% { background: transparent; }
}
.act-icon {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.ai-pay { background: var(--green-soft); color: var(--green); }
.ai-up  { background: var(--indigo-soft); color: var(--indigo); }
.ai-out { background: var(--red-soft); color: var(--red); }
.ai-add { background: var(--amber-soft); color: var(--amber); }
.ai-edit { background: rgba(139,92,246,.1); color: var(--purple); }
.act-body { font-size: 13px; line-height: 1.45; min-width: 0; }
.act-body b { font-weight: 600; }
.act-body span { color: var(--text-2); }
.act-time { font-size: 11.5px; color: var(--text-3); white-space: nowrap; }

/* Empty state */
.empty {
  text-align: center; padding: 60px 24px;
  color: var(--text-2);
}
.empty-ic {
  width: 56px; height: 56px;
  margin: 0 auto 16px;
  background: var(--bg); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-3);
}
.empty h4 { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.empty p { font-size: 13px; margin-bottom: 16px; }

/* ======================== CUSTOMER DETAIL ======================== */
.detail-head {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 24px;
  margin-bottom: 16px;
  display: flex; gap: 18px; align-items: center;
}
.detail-head .cust-av { width: 56px; height: 56px; font-size: 18px; }
.detail-head h2 { font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.detail-head p { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.detail-head .actions { margin-left: auto; display: flex; gap: 8px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1.6fr; gap: 16px; }
.detail-info-list { padding: 6px 0; }
.detail-info-row {
  display: grid; grid-template-columns: 130px 1fr;
  padding: 12px 20px; border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.detail-info-row:last-child { border-bottom: none; }
.detail-info-row span { color: var(--text-2); font-weight: 500; }
.detail-info-row b { color: var(--text); font-weight: 500; }

/* ======================== SETTINGS ======================== */
.settings-grid {
  display: grid; grid-template-columns: 220px 1fr; gap: 28px;
}
.settings-nav { display: flex; flex-direction: column; gap: 1px; }
.settings-nav button {
  background: transparent; border: none; text-align: left;
  padding: 8px 12px; font-size: 13.5px; color: var(--text-2);
  border-radius: var(--r-sm); font-weight: 500;
  font-family: inherit;
}
.settings-nav button:hover { background: var(--bg); color: var(--text); }
.settings-nav button.active { background: var(--indigo-soft); color: var(--indigo); }
.settings-section { display: flex; flex-direction: column; gap: 16px; }
.set-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 24px;
}
.set-card h3 { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.set-card p.set-desc { font-size: 12.5px; color: var(--text-2); margin-bottom: 18px; }
.set-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 0; border-top: 1px solid var(--border);
}
.set-row:first-of-type { border-top: none; padding-top: 0; }
.set-row-l b { display: block; font-size: 13.5px; font-weight: 600; }
.set-row-l span { font-size: 12.5px; color: var(--text-2); }
.toggle {
  position: relative; width: 36px; height: 20px;
  background: var(--border); border-radius: 999px;
  transition: background .2s; cursor: pointer; border: none; padding: 0;
}
.toggle::after {
  content: ''; position: absolute;
  top: 2px; left: 2px; width: 16px; height: 16px;
  background: #fff; border-radius: 50%;
  transition: transform .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2);
}
.toggle.on { background: var(--indigo); }
.toggle.on::after { transform: translateX(16px); }

.danger-zone { border-color: var(--red-soft); background: var(--red-soft); }
.danger-zone h3 { color: var(--red); }

/* form */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.form-grp { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.form-grp label { font-size: 12px; font-weight: 600; color: var(--text-2); }
.form-grp input, .form-grp select, .form-grp textarea {
  padding: 9px 12px; font-size: 13.5px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-sm); font-family: inherit; color: var(--text);
  outline: none; transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none;
}
.form-grp input:focus, .form-grp select:focus, .form-grp textarea:focus {
  border-color: var(--indigo); box-shadow: 0 0 0 3px rgba(79,70,229,.1);
}
.form-grp .err { font-size: 11.5px; color: var(--red); }
.form-grp.has-err input, .form-grp.has-err select { border-color: var(--red); }

/* ======================== MODAL ======================== */
.modal-wrap {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: rgba(15,23,42,.4); backdrop-filter: blur(4px);
  opacity: 0; pointer-events: none;
  transition: opacity .2s;
}
.modal-wrap.open { opacity: 1; pointer-events: auto; }
.modal {
  background: var(--surface); border-radius: 12px;
  width: 100%; max-width: 520px;
  box-shadow: var(--shadow-lg);
  transform: translateY(8px) scale(.98); transition: transform .2s;
  max-height: 90vh; overflow: auto;
}
.modal-wrap.open .modal { transform: translateY(0) scale(1); }
.modal-head { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-head h3 { font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.modal-body { padding: 22px 24px; }
.modal-foot {
  padding: 14px 24px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 8px;
  background: var(--bg);
}

/* ======================== NOTIFICATIONS PANEL ======================== */
.overlay {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(15,23,42,.3); backdrop-filter: blur(2px);
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.overlay.open { opacity: 1; pointer-events: auto; }
.notif-panel {
  position: fixed; top: 0; right: 0; bottom: 0;
  z-index: 90; width: 380px; max-width: 100vw;
  background: var(--surface); border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .25s ease;
  box-shadow: var(--shadow-lg);
}
.notif-panel.open { transform: translateX(0); }
.notif-head { padding: 18px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.notif-head h3 { font-size: 15px; font-weight: 700; }
.notif-body { flex: 1; overflow-y: auto; padding: 4px 0; }
.notif-foot { padding: 12px 16px; border-top: 1px solid var(--border); }
.notif-empty { padding: 60px 20px; text-align: center; color: var(--text-2); font-size: 13px; }

/* ======================== COMMAND PALETTE ======================== */
.cmd-wrap {
  position: fixed; inset: 0; z-index: 110;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 100px 24px 24px;
  background: rgba(15,23,42,.4); backdrop-filter: blur(6px);
  opacity: 0; pointer-events: none;
  transition: opacity .2s;
}
.cmd-wrap.open { opacity: 1; pointer-events: auto; }
.cmd-box {
  background: var(--surface); border-radius: 12px;
  width: 100%; max-width: 540px;
  box-shadow: var(--shadow-lg);
  transform: translateY(8px); transition: transform .2s;
  overflow: hidden;
}
.cmd-wrap.open .cmd-box { transform: translateY(0); }
.cmd-input { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.cmd-input svg { color: var(--text-3); }
.cmd-input input {
  flex: 1; border: none; outline: none;
  background: transparent; font-family: inherit;
  font-size: 14.5px; color: var(--text);
}
.cmd-input .kbd { font-size: 11px; padding: 2px 6px; border: 1px solid var(--border); border-radius: 4px; color: var(--text-3); }
.cmd-list { max-height: 420px; overflow-y: auto; padding: 6px 0; }
.cmd-section { padding: 8px 18px 4px; font-size: 11px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .08em; }
.cmd-item {
  padding: 9px 18px; display: flex; align-items: center; gap: 10px;
  font-size: 13.5px; cursor: pointer; transition: background .1s;
}
.cmd-item.sel { background: var(--indigo-soft); color: var(--indigo); }
.cmd-item .ic-wrap { width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; color: var(--text-3); }
.cmd-item.sel .ic-wrap { color: var(--indigo); }
.cmd-item-meta { margin-left: auto; font-size: 11px; color: var(--text-3); }

/* ======================== TOASTS ======================== */
.toast-wrap {
  position: fixed; bottom: 20px; left: 24px; z-index: 120;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--text); color: var(--surface);
  padding: 10px 16px; border-radius: var(--r-sm);
  font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-md);
  display: flex; align-items: center; gap: 10px;
  min-width: 240px; max-width: 360px;
  animation: toastIn .25s ease;
  pointer-events: auto;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.toast.out { animation: toastOut .25s ease forwards; }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px); } }
.toast-ok .ic { color: var(--green); }
.toast-err { background: var(--red); }
.toast-info .ic { color: var(--indigo); }
.toast .ic { width: 16px; height: 16px; flex-shrink: 0; }

/* ======================== LIVE FEED ======================== */
.live-head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 16px;
  padding: 14px 18px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r);
}
.live-pulse {
  width: 10px; height: 10px;
  background: var(--green); border-radius: 50%;
  position: relative;
}
.live-pulse::before {
  content: ''; position: absolute; inset: -4px;
  border-radius: 50%; background: var(--green); opacity: .4;
  animation: livePulse 1.6s ease-out infinite;
}
@keyframes livePulse { 0% { transform: scale(.8); opacity: .5; } 100% { transform: scale(2.2); opacity: 0; } }
.live-head h2 { font-size: 16px; font-weight: 700; }
.live-head .live-stats { margin-left: auto; display: flex; gap: 16px; font-size: 12.5px; color: var(--text-2); }
.live-head .live-stats b { color: var(--text); margin-left: 4px; }

/* ======================== BACK PILL ======================== */
.back-pill {
  position: fixed; bottom: 20px; right: 20px;
  padding: 10px 18px; font-size: 12.5px; font-weight: 600;
  background: var(--text); color: var(--surface);
  border-radius: 999px; box-shadow: 0 8px 24px rgba(15,23,42,.25);
  transition: transform .15s;
  z-index: 30;
}
.back-pill:hover { transform: translateY(-2px); }

/* ======================== SKELETON ======================== */
@keyframes shine {
  0% { background-position: -200px 0; }
  100% { background-position: 200px 0; }
}
.skel {
  background: linear-gradient(90deg, var(--bg) 0%, var(--border) 50%, var(--bg) 100%);
  background-size: 400px 100%;
  animation: shine 1.4s ease infinite;
  border-radius: 4px;
}

/* ======================== RESPONSIVE ======================== */
@media (max-width: 1024px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .twocol { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .layout { grid-template-columns: 1fr; }
  .side {
    position: fixed; bottom: 0; left: 0; right: 0; top: auto;
    height: auto; flex-direction: row; padding: 8px;
    border-right: none; border-top: 1px solid var(--border);
    z-index: 50; gap: 0; justify-content: space-around;
  }
  .side-brand, .side-search, .nav-label, .side-foot, .nav-group:last-child { display: none; }
  .nav-group { flex-direction: row; gap: 4px; }
  .nav-item { flex-direction: column; gap: 2px; padding: 6px 8px; font-size: 10.5px; }
  .nav-item .badge { display: none; }
  .content { padding: 16px 16px 90px; }
  .topbar { padding: 12px 16px; }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  table { font-size: 12px; }
  thead th, tbody td { padding: 10px 14px; }
  .form-row { grid-template-columns: 1fr; }
  .back-pill { display: none; }
}
