@import url('https://fonts.googleapis.com/css2?family=Inter:opsz,wght@14..32,300..900&display=swap');

/* ══════════════════════════════════════
   TOKENS
══════════════════════════════════════ */
:root {
  --bg:        #07090f;
  --surface:   #0c1120;
  --card:      #101726;
  --border:    rgba(255,255,255,.07);
  --sep:       rgba(255,255,255,.05);

  --text:      #dde5ff;
  --muted:     rgba(221,229,255,.50);
  --subtle:    rgba(221,229,255,.28);

  --accent:    #7153f8;
  --accent2:   #4286f5;
  --ok:        #2bc98a;
  --warn:      #f5a324;
  --bad:       #ef4f6e;

  --left-bg:   #0f1d35;
  --right-bg:  #111830;
  --sys-bg:    #0b1e2e;

  --r-xl: 20px;
  --r-lg: 16px;
  --r-md: 12px;
  --r-sm: 9px;
  --r-xs: 7px;

  --shadow:    0 24px 80px rgba(0,0,0,.60);
  --shadow-sm: 0 10px 36px rgba(0,0,0,.45);
  --shadow-xs: 0 4px 14px rgba(0,0,0,.30);
  --ring:      0 0 0 3px rgba(113,83,248,.22);
}

/* ══════════════════════════════════════
   RESET
══════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background:
    radial-gradient(1200px 800px at 10% -5%,  rgba(113,83,248,.13), transparent 55%),
    radial-gradient(1000px 700px at 90%  5%,  rgba(66,134,245,.09), transparent 55%),
    radial-gradient(900px  700px at 50% 110%, rgba(239,79,110,.05), transparent 55%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }

/* ══════════════════════════════════════
   SCROLLBAR
══════════════════════════════════════ */
::-webkit-scrollbar              { width: 5px; height: 5px; }
::-webkit-scrollbar-track        { background: transparent; }
::-webkit-scrollbar-thumb        { background: rgba(255,255,255,.12); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover  { background: rgba(255,255,255,.22); }

/* ══════════════════════════════════════
   UTILITIES
══════════════════════════════════════ */
.mono   { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.small  { font-size: 12px; }
.strong { font-weight: 700; }
.muted  { color: var(--muted); }
.subtle { color: var(--subtle); }

/* ══════════════════════════════════════
   SIDEBAR
══════════════════════════════════════ */
.sidebar {
  position: fixed;
  inset: 12px auto 12px 12px;
  width: 236px;
  background: linear-gradient(160deg, rgba(255,255,255,.045), rgba(255,255,255,.018));
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

/* Brand */
.brand { padding: 8px 8px 14px; }

.brand .logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -.03em;
}

.logo-mark {
  width: 34px; height: 34px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(113,83,248,.40);
  flex-shrink: 0;
}
.logo-mark svg { width: 18px; height: 18px; fill: #fff; }

.brand-sub {
  color: var(--muted);
  font-size: 11.5px;
  margin-top: 4px;
  padding-left: 44px;
}

/* Nav */
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }

.nav-sep {
  height: 1px;
  background: var(--sep);
  margin: 6px 4px;
}

.nav-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--subtle);
  padding: 4px 12px 2px;
}

.nav-item {
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13.5px;
  font-weight: 500;
  transition: all .14s ease;
  position: relative;
}

.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; opacity: .65; transition: opacity .14s; }

.nav-item:hover {
  background: rgba(255,255,255,.05);
  border-color: rgba(255,255,255,.07);
  color: var(--text);
}
.nav-item:hover svg { opacity: 1; }

.nav-item.active {
  background: linear-gradient(135deg, rgba(113,83,248,.18), rgba(66,134,245,.10));
  border-color: rgba(113,83,248,.24);
  color: var(--text);
  font-weight: 600;
}
.nav-item.active svg { opacity: 1; }
.nav-badge {
  margin-left: auto;
  background: var(--bad);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  box-shadow: 0 0 8px rgba(239,79,110,.45);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 18px;
  background: linear-gradient(180deg, var(--accent), var(--accent2));
  border-radius: 0 3px 3px 0;
}

/* Theme toggle */
.theme-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  border-radius: var(--r-sm);
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.08);
  color: var(--muted);
  cursor: pointer;
  transition: all .14s ease;
  font-size: 15px;
  flex-shrink: 0;
}
.theme-btn:hover {
  background: rgba(255,255,255,.09);
  border-color: rgba(255,255,255,.14);
  color: var(--text);
}

/* Sidebar footer */
.sidebar-foot {
  margin-top: auto;
  padding: 12px 8px 2px;
  border-top: 1px solid var(--sep);
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 32px; height: 32px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(113,83,248,.35), rgba(66,134,245,.25));
  border: 1px solid rgba(113,83,248,.28);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.user-info { min-width: 0; }
.user-name {
  font-size: 13px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-role { font-size: 11px; color: var(--muted); }

/* ══════════════════════════════════════
   LAYOUT
══════════════════════════════════════ */
.main { margin-left: 260px; min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  padding: 22px 28px 16px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.topbar-left { min-width: 0; }
.topbar-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }

.page-title {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -.03em;
}

.page-sub {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.content { padding: 0 28px 32px; max-width: 1400px; width: 100%; }

/* Back link */
.back {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 6px;
  transition: color .14s;
}
.back:hover { color: var(--text); }

/* ══════════════════════════════════════
   CARDS
══════════════════════════════════════ */
.card {
  background: linear-gradient(160deg, rgba(255,255,255,.048), rgba(255,255,255,.02));
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card.card-accent {
  background: linear-gradient(135deg, rgba(113,83,248,.80), rgba(66,134,245,.65));
  border-color: rgba(255,255,255,.14);
}

/* ══════════════════════════════════════
   STAT CARDS (dashboard)
══════════════════════════════════════ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat-card {
  background: linear-gradient(160deg, rgba(255,255,255,.048), rgba(255,255,255,.02));
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 20px 22px;
  transition: border-color .2s, box-shadow .2s;
}
.stat-card:hover { border-color: rgba(255,255,255,.13); box-shadow: var(--shadow-xs); }

.stat-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}

.stat-value {
  font-size: 40px;
  font-weight: 900;
  letter-spacing: -.01em;
  line-height: 1;
  margin: 10px 0 6px;
}

.stat-sub { font-size: 12px; color: var(--muted); }

.stat-card.ok   { border-color: rgba(43,201,138,.20); }
.stat-card.ok .stat-value { color: var(--ok); }
.stat-card.blue { border-color: rgba(66,134,245,.20); }
.stat-card.blue .stat-value { color: var(--accent2); }

/* Dashboard 2-col grid */
.dash-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 14px;
  align-items: start;
}

.panel-head {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 16px 20px;
  border-bottom: 1px solid var(--sep);
}

.panel-body { padding: 20px; }

/* Quick actions */
.qa-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: rgba(255,255,255,.02);
  font-size: 13px;
  font-weight: 500;
  transition: all .14s ease;
  margin-bottom: 8px;
}
.qa-link:last-child { margin-bottom: 0; }
.qa-link:hover {
  background: rgba(255,255,255,.05);
  border-color: rgba(255,255,255,.12);
  transform: translateX(3px);
}
.qa-link svg { width: 15px; height: 15px; color: var(--muted); flex-shrink: 0; }

/* ══════════════════════════════════════
   FILTERS / INPUTS
══════════════════════════════════════ */
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.input, .select {
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.09);
  color: var(--text);
  padding: 9px 13px;
  border-radius: var(--r-md);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color .14s, box-shadow .14s, background .14s;
  -webkit-appearance: none;
}

.input::placeholder { color: var(--subtle); }

.input:focus, .select:focus {
  border-color: rgba(113,83,248,.40);
  box-shadow: var(--ring);
  background: rgba(255,255,255,.07);
}

.select {
  padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='rgba(221,229,255,0.35)' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  cursor: pointer;
}

.select option { background: #101726; color: var(--text); }

/* ══════════════════════════════════════
   BUTTONS
══════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  border: 0;
  padding: 9px 16px;
  border-radius: var(--r-md);
  font-size: 13px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform .14s ease, filter .14s ease, box-shadow .14s ease;
  box-shadow: 0 4px 16px rgba(113,83,248,.28);
  white-space: nowrap;
}
.btn:hover  { transform: translateY(-1px); filter: brightness(1.08); box-shadow: 0 6px 22px rgba(113,83,248,.38); }
.btn:active { transform: none; filter: brightness(.96); box-shadow: none; }

.btn.ghost {
  background: rgba(255,255,255,.05);
  color: var(--text);
  border: 1px solid rgba(255,255,255,.10);
  box-shadow: none;
}
.btn.ghost:hover { background: rgba(255,255,255,.09); border-color: rgba(255,255,255,.16); box-shadow: none; }

.btn svg { width: 14px; height: 14px; }

/* ══════════════════════════════════════
   PILLS / BADGES
══════════════════════════════════════ */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.10);
  font-size: 11.5px;
  font-weight: 600;
  background: rgba(255,255,255,.04);
  white-space: nowrap;
}
.pill::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 999px;
  background: rgba(255,255,255,.45);
  flex-shrink: 0;
}

.s-open              { border-color: rgba(245,163,36,.28);  background: rgba(245,163,36,.06); }
.s-open::before      { background: var(--warn); box-shadow: 0 0 6px rgba(245,163,36,.55); }

.s-in_progress       { border-color: rgba(113,83,248,.28);  background: rgba(113,83,248,.07); }
.s-in_progress::before { background: var(--accent); box-shadow: 0 0 6px rgba(113,83,248,.55); }

.s-closed            { border-color: rgba(43,201,138,.28);  background: rgba(43,201,138,.07); }
.s-closed::before    { background: var(--ok); box-shadow: 0 0 6px rgba(43,201,138,.55); }

.p-high              { border-color: rgba(239,79,110,.28);  background: rgba(239,79,110,.07); }
.p-high::before      { background: var(--bad); box-shadow: 0 0 6px rgba(239,79,110,.55); }

.p-medium            { border-color: rgba(245,163,36,.22);  background: rgba(245,163,36,.05); }
.p-medium::before    { background: var(--warn); }

.p-low               { border-color: rgba(255,255,255,.12); }
.p-low::before       { background: var(--subtle); }

/* ══════════════════════════════════════
   TABLE
══════════════════════════════════════ */
.table .trow {
  display: grid;
  grid-template-columns: 76px 1.6fr 1fr 150px 140px 180px;
  gap: 12px;
  padding: 13px 18px;
  border-top: 1px solid var(--sep);
  align-items: center;
  text-decoration: none;
  color: inherit;
  transition: background .13s;
}

.table .thead {
  border-top: 0;
  background: rgba(255,255,255,.025);
  color: var(--subtle);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.table a.trow:hover { background: rgba(255,255,255,.028); }

.sort-link {
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  transition: color .13s;
}
.sort-link:hover { color: var(--text); }

.table a.trow.trow-closed {
  background: rgba(43,201,138,.04);
  border-top-color: rgba(43,201,138,.10);
}
.table a.trow.trow-closed:hover { background: rgba(43,201,138,.07); }

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

/* ══════════════════════════════════════
   PAGER
══════════════════════════════════════ */
.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 16px;
}

/* ══════════════════════════════════════
   DETAIL GRID
══════════════════════════════════════ */
.grid {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 14px;
}

/* ══════════════════════════════════════
   CHAT
══════════════════════════════════════ */
.chat-wrap { display: flex; flex-direction: column; min-height: 72vh; }

.chat-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--sep);
  background: rgba(255,255,255,.018);
}
.chat-ref { font-size: 11px; color: var(--subtle); font-family: ui-monospace, monospace; }
.chat-summary { font-size: 13px; color: var(--muted); line-height: 1.55; margin-top: 6px; white-space: pre-wrap; }

.chat { padding: 16px; display: flex; flex-direction: column; gap: 10px; flex: 1; overflow-y: auto; max-height: 65vh; }

.msg { display: flex; }
.msg.left   { justify-content: flex-start; }
.msg.right  { justify-content: flex-end; }
.msg.center { justify-content: center; }

.bubble, .system {
  max-width: min(760px, 90%);
  padding: 10px 14px;
  border-radius: var(--r-lg);
  border: 1px solid rgba(255,255,255,.08);
  box-shadow: var(--shadow-xs);
}

.msg.left  .bubble { background: var(--left-bg); }
.msg.right .bubble { background: var(--right-bg); border-color: rgba(113,83,248,.15); }

.system {
  background: var(--sys-bg);
  border-style: dashed;
  border-color: rgba(43,201,138,.25);
}

.bubble-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 5px;
}

.author { font-weight: 700; color: var(--muted); font-size: 11.5px; }
.time   { color: var(--subtle); font-size: 11px; white-space: nowrap; }
.text   { font-size: 13.5px; line-height: 1.6; }

.flags { margin-top: 8px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.flag  {
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.03);
}
.flag.warn { border-color: rgba(245,163,36,.28); color: var(--warn); background: rgba(245,163,36,.07); }

/* ══════════════════════════════════════
   SIDE PANEL
══════════════════════════════════════ */
.side { padding: 18px 20px; }
.side-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 16px;
}

.kv { display: flex; flex-direction: column; gap: 0; }

.kv-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--sep);
}
.kv-row:last-child { border-bottom: 0; }

.k { color: var(--muted); font-size: 12px; }
.v { font-size: 13px; font-weight: 500; text-align: right; }

.meta { display: flex; flex-direction: column; gap: 3px; }

/* ══════════════════════════════════════
   TOASTS
══════════════════════════════════════ */
.toast-stack {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 9999;
  transition: opacity .4s ease;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--r-md);
  border: 1px solid rgba(43,201,138,.28);
  background: linear-gradient(135deg, rgba(43,201,138,.14), rgba(43,201,138,.07));
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 28px rgba(0,0,0,.35);
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  min-width: 260px;
  max-width: 380px;
  animation: toast-in .25s ease;
}

.toast svg { color: var(--ok); flex-shrink: 0; }

.toast-close {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  padding: 2px 4px;
  border-radius: 4px;
  transition: color .13s;
}
.toast-close:hover { color: var(--text); }

@keyframes toast-in {
  from { transform: translateY(12px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* ══════════════════════════════════════
   MODAL
══════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9998;
  animation: fade-in .18s ease;
}

.modal {
  background: linear-gradient(160deg, rgba(255,255,255,.07), rgba(255,255,255,.03));
  border: 1px solid rgba(255,255,255,.10);
  border-radius: var(--r-xl);
  box-shadow: 0 32px 80px rgba(0,0,0,.60);
  padding: 28px 28px 24px;
  width: 100%;
  max-width: 380px;
  text-align: center;
  animation: modal-in .2s ease;
}

.modal-icon {
  width: 48px; height: 48px;
  border-radius: 14px;
  background: rgba(43,201,138,.12);
  border: 1px solid rgba(43,201,138,.25);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
  color: var(--ok);
}

.modal-title { font-size: 17px; font-weight: 800; letter-spacing: -.02em; margin-bottom: 8px; }
.modal-sub   { font-size: 13px; color: var(--muted); line-height: 1.55; margin-bottom: 22px; }

.modal-actions { display: flex; gap: 10px; justify-content: center; }
.modal-actions .btn { flex: 1; justify-content: center; }

@keyframes fade-in  { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in { from { transform: scale(.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }

html[data-theme="light"] .modal {
  background: rgba(255,255,255,.95);
  border-color: rgba(13,20,53,.10);
}

/* ══════════════════════════════════════
   REFRESH BANNER
══════════════════════════════════════ */
.refresh-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: var(--r-md);
  border: 1px solid rgba(66,134,245,.28);
  background: rgba(66,134,245,.08);
  font-size: 13px;
  margin-bottom: 12px;
  animation: toast-in .25s ease;
}
.refresh-banner svg { color: var(--accent2); flex-shrink: 0; }
.refresh-banner a { color: var(--accent2); font-weight: 600; text-decoration: underline; }
.refresh-banner button {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  padding: 2px 4px;
  border-radius: 4px;
  transition: color .13s;
}
.refresh-banner button:hover { color: var(--text); }

/* ══════════════════════════════════════
   BADGE NOUVEAU
══════════════════════════════════════ */
.badge-new {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  background: rgba(113,83,248,.18);
  border: 1px solid rgba(113,83,248,.30);
  color: var(--accent);
  vertical-align: middle;
  margin-left: 6px;
}

/* Active filter chips */
.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.active-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid rgba(66,134,245,.28);
  background: rgba(66,134,245,.08);
  font-size: 12px;
  color: var(--text);
}

.active-filter a {
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
  transition: color .13s;
}
.active-filter a:hover { color: var(--bad); }

/* Status action buttons (detail panel) */
.status-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--sep);
}
.status-actions form { display: contents; }
.status-actions .btn { width: 100%; justify-content: center; }

/* ══════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════ */
@media (max-width: 1100px) {
  .grid, .dash-grid { grid-template-columns: 1fr; }
  .sidebar { position: static; width: auto; inset: auto; margin: 10px; border-radius: var(--r-lg); }
  .main { margin-left: 0; }
  .content { padding: 0 16px 20px; }
  .topbar { padding: 16px 16px 12px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .table .trow { grid-template-columns: 60px 1.4fr 0.8fr 130px 120px; }
  .table .trow > :last-child { display: none; }
}

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

/* ══════════════════════════════════════
   LIGHT THEME
══════════════════════════════════════ */
html[data-theme="light"] {
  --bg:        #f3f5fe;
  --card:      rgba(255,255,255,.92);
  --border:    rgba(14,21,55,.09);
  --sep:       rgba(14,21,55,.07);
  --text:      #0d1435;
  --muted:     rgba(13,20,53,.52);
  --subtle:    rgba(13,20,53,.32);
  --left-bg:   rgba(113,83,248,.07);
  --right-bg:  rgba(66,134,245,.07);
  --sys-bg:    rgba(43,201,138,.08);
  --shadow:    0 20px 60px rgba(13,20,53,.10);
  --shadow-sm: 0 8px 28px rgba(13,20,53,.08);
  --shadow-xs: 0 3px 12px rgba(13,20,53,.06);
  --ring:      0 0 0 3px rgba(113,83,248,.16);
}

html[data-theme="light"] body {
  background:
    radial-gradient(1200px 800px at 10% -5%,  rgba(113,83,248,.10), transparent 55%),
    radial-gradient(1000px 700px at 90%  5%,  rgba(66,134,245,.07), transparent 55%),
    var(--bg);
}

html[data-theme="light"] .sidebar {
  background: rgba(255,255,255,.82);
  backdrop-filter: blur(20px);
  box-shadow: 0 20px 60px rgba(13,20,53,.10);
}

html[data-theme="light"] .card,
html[data-theme="light"] .stat-card {
  background: rgba(255,255,255,.80);
  box-shadow: 0 8px 28px rgba(13,20,53,.08);
}

html[data-theme="light"] .input,
html[data-theme="light"] .select {
  background: rgba(13,20,53,.04);
  border-color: rgba(13,20,53,.12);
  color: var(--text);
}
html[data-theme="light"] .input:focus,
html[data-theme="light"] .select:focus { background: rgba(13,20,53,.06); }

html[data-theme="light"] .select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='rgba(13,20,53,0.38)' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
html[data-theme="light"] .select option { background: #fff; color: #0d1435; }

html[data-theme="light"] .btn.ghost {
  background: rgba(13,20,53,.05);
  border-color: rgba(13,20,53,.12);
  color: var(--text);
}

html[data-theme="light"] .theme-btn {
  background: rgba(13,20,53,.05);
  border-color: rgba(13,20,53,.10);
  color: var(--muted);
}
html[data-theme="light"] .theme-btn:hover { color: var(--text); }
