:root {
  --navy: #0d1b2a;
  --text: #0d1b2a;
  --text-muted: #4b5563;
  --orange: #ff7a00;
  --amber: #ffc107;
  --slate: #4b5563;
  --mist: #e5e7eb;
  --canvas: #f4f6f8;
  --panel: #fff;
  --header-bg: #fff;
  --sidebar-bg: #0d1b2a;
  --sidebar-text: #cbd5e1;
  --sidebar-muted: #9ca3af;
  --input-bg: #fff;
  --surface-subtle: #fafbfc;
  --surface-hover: #f3f4f6;
  --danger: #b91c1c;
  --ok: #047857;
  --warn: #b45309;
  --line: #e5e7eb;
  --radius: 16px;
  --shadow: 0 8px 24px rgba(13, 27, 42, 0.05);
  --font: Poppins, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { font-family: var(--font); background: var(--canvas); color: var(--text); }
a { color: var(--orange); }
img { max-width: 100%; }

.brand { display: flex; align-items: center; gap: 0.65rem; text-decoration: none; color: inherit; }
.brand img { width: 40px; height: 40px; flex-shrink: 0; }
.brand > span { display: flex; flex-direction: column; min-width: 0; }
.word { display: block; font-weight: 700; font-size: 1.15rem; letter-spacing: -0.03em; line-height: 1.1; }
.word em { color: var(--orange); font-style: normal; }
.tag { display: block; margin: 0.15rem 0 0; font-size: 0.65rem; letter-spacing: 0.2em; color: #9ca3af; font-weight: 500; }

.page-head { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; justify-content: space-between; margin: 0 0 1.2rem; }
.page-head h1 { margin: 0; font-size: 1.55rem; }
.page-head p { margin: 0.25rem 0 0; color: var(--text-muted); }
h2 { font-size: 1.05rem; margin: 1.4rem 0 0.7rem; }

.muted { color: var(--text-muted); }
.empty { color: var(--text-muted); padding: 0.8rem 1.1rem; }

.kpis, .cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.8rem; }
.kpi, .card { background: var(--panel); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); }
.kpi i { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--orange); color: #fff; font-style: normal; font-weight: 700; font-size: 0.8rem; margin-bottom: 0.7rem; }
.kpi strong, .card strong { display: block; font-size: 1.55rem; }
.kpi span, .card span { color: var(--text-muted); font-size: 0.8rem; }
.kpi.warn strong, .card.warn strong { color: var(--warn); }

.panel { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 1rem; overflow: hidden; padding: 1.1rem; border: 1px solid var(--line); }
.panel-pad { padding: 1.1rem; }
.panel:has(table), .panel:has(.list-row), .panel-tabs { padding: 0; }
.panel:has(table) h2, .panel:has(.list-row) h2 { margin: 0; padding: 1rem 1.1rem 0; }

.row { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; justify-content: space-between; }
.list-row { padding: 0.9rem 1.1rem; border-top: 1px solid var(--surface-hover); }
.list-row:first-child { border-top: 0; }

label { display: block; font-size: 0.8rem; font-weight: 500; margin: 0 0 0.35rem; }
.field { margin-bottom: 0.95rem; }
input, textarea, select {
  width: 100%; padding: 0.8rem 0.9rem; border: 1px solid var(--line); border-radius: 10px;
  background: var(--input-bg); color: var(--text); font: 400 1rem var(--font);
}
textarea { min-height: 6rem; }
input:focus, textarea:focus, select:focus { outline: 2px solid #fdba74; border-color: var(--orange); }
.check { display: flex; align-items: center; gap: 0.5rem; color: var(--text-muted); font-size: 0.9rem; margin: 0.2rem 0 1.1rem; }
.check input { width: auto; }

.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }
.btn, button.btn {
  display: inline-flex; align-items: center; justify-content: center; padding: 0.65rem 1rem;
  border-radius: 10px; border: 1px solid transparent; background: var(--orange); color: #fff;
  text-decoration: none; font: 600 0.92rem var(--font); cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .15s ease;
}
.btn:hover { background: #e56e00; }
.btn.secondary:hover { background: #f8fafc; border-color: #cbd5e1; }
.btn:active { transform: translateY(1px); }
.btn.secondary { background: var(--panel); color: var(--text); border-color: var(--line); }
.btn.danger { background: var(--panel); color: var(--danger); border-color: #fecaca; }
.btn.small { padding: 0.4rem 0.65rem; font-size: 0.82rem; }
.btn.block { width: 100%; }

table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 0.75rem 1.1rem; border-top: 1px solid var(--surface-hover); vertical-align: top; }
th { color: var(--text-muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; }

.flash, .secret, .errors { padding: 0.85rem 1rem; border-radius: 12px; margin-bottom: 1rem; }
.flash { background: #ecfdf5; color: var(--ok); }
.errors { background: #fee2e2; color: var(--danger); }
.secret { background: #fff7ed; border: 1px dashed #fdba74; }
.secret code, .mono { font-family: ui-monospace, monospace; word-break: break-all; }
.error { color: var(--danger); font-size: 0.85rem; margin: 0.3rem 0 0; }
.badge { display: inline-block; padding: 0.15rem 0.5rem; border-radius: 999px; background: #ecfdf5; color: var(--ok); font-size: 0.72rem; font-weight: 600; }

/* App shell */
.nav-check { position: absolute; opacity: 0; pointer-events: none; }
.app { min-height: 100vh; }
.side {
  background: var(--sidebar-bg); color: #fff; padding: 1.1rem 0.85rem 1rem;
  display: none; flex-direction: column; gap: 0.4rem;
}
.side .brand { padding: 0.25rem 0.5rem 1rem; color: #fff; }
.nav-links { display: flex; flex-direction: column; gap: 0.2rem; }
.nav-links a, .nav-links button.link {
  display: flex; width: 100%; align-items: center; gap: 0.65rem;
  color: var(--sidebar-text); text-decoration: none; background: none; border: 0; text-align: left;
  padding: 0.65rem 0.75rem; border-radius: 10px; font: 500 0.92rem var(--font); cursor: pointer;
}
.nav-links a.active { background: var(--orange); color: #fff; }
.nav-links a:not(.active):hover, .nav-links button.link:hover { background: rgba(255,255,255,.06); }
.who {
  margin-top: auto; background: rgba(255,255,255,.06); border-radius: 12px;
  padding: 0.8rem; display: flex; gap: 0.65rem; align-items: center;
}
.who > div:last-child { min-width: 0; }
.who > div:last-child > div:first-child {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ava { width: 36px; height: 36px; border-radius: 50%; background: var(--orange); display: grid; place-items: center; font-weight: 700; font-size: 0.8rem; letter-spacing: -0.03em; flex-shrink: 0; }
.who small { color: var(--sidebar-muted); display: block; font-size: 0.75rem; }

/* Main column + white header */
.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
  width: 100%;
}
.app-header {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-shrink: 0;
  padding: 0.7rem 1rem;
  background: var(--header-bg);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(13, 27, 42, 0.04);
  position: sticky;
  top: 0;
  z-index: 15;
}
.app-header a { text-decoration: none; }
.app-header-start {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  flex: 1 1 auto;
}
.app-header-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.app-header-actions {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}
.app-header-menu {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  flex-shrink: 0;
}
.app-header-menu:hover { background: var(--surface-hover); }
.app-header-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
}
.app-header-icon:hover { background: var(--surface-hover); }
.app-header-icon.is-active {
  border-color: #fdba74;
  background: rgba(255, 122, 0, 0.1);
  color: var(--orange);
}
.app-header-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--orange);
  color: #fff;
  border: 2px solid var(--header-bg);
  font: 700 0.68rem var(--font);
  display: grid;
  place-items: center;
}
.app-header-user {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 0.55rem;
  max-width: 220px;
  padding: 0.2rem 0.5rem 0.2rem 0.2rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text);
}
.app-header-user:hover { background: var(--surface-hover); }
.app-header-user .ava { width: 32px; height: 32px; font-size: 0.68rem; }
.app-header-user-meta {
  display: none;
  min-width: 0;
  line-height: 1.2;
}
.app-header-user-meta strong {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.app-header-user-meta small {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--orange);
  color: #fff;
  font: 700 0.7rem var(--font);
  display: inline-grid;
  place-items: center;
  margin-left: 0.35rem;
  vertical-align: middle;
}
.notification-list { display: grid; gap: 0; }
.notification-item {
  display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start;
  padding: 1rem 1.1rem; border-bottom: 1px solid var(--line);
}
.notification-item:last-child { border-bottom: 0; }
.notification-item.unread { background: rgba(255, 122, 0, 0.06); }
.notification-head { display: flex; justify-content: space-between; gap: 1rem; align-items: baseline; }
.notification-head time { font-size: 0.8rem; white-space: nowrap; }
.notification-main p { margin: 0.35rem 0 0; font-size: 0.9rem; }
.badge.warn { background: rgba(245, 158, 11, 0.15); color: #b45309; }
.main { padding: 1.15rem 1rem 2.2rem; width: 100%; max-width: none; box-sizing: border-box; }
.backdrop { display: none; }

@media (max-width: 859px) {
  .nav-check:checked ~ .app .side {
    display: flex; position: fixed; inset: 0 auto 0 0; width: min(260px, 86vw); z-index: 30;
  }
  .nav-check:checked ~ .backdrop {
    display: block; position: fixed; inset: 0; background: rgba(13,27,42,.45); z-index: 20;
  }
}

@media (min-width: 860px) {
  .app { display: grid; grid-template-columns: 240px minmax(0, 1fr); }
  .side { display: flex; grid-column: 1; }
  .app-shell { grid-column: 2; }
  .app-header { padding: 0.75rem 1.6rem; }
  .app-header-menu { display: none; }
  .app-header-user-meta { display: block; }
  .side .who { display: none; }
  .main { padding: 1.25rem 1.6rem 2.4rem; }
  .kpis, .cards { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* Guest / login */
body.guest { background: var(--canvas); }
.login { min-height: 100vh; display: grid; }
.hero {
  background: var(--navy); color: #fff; padding: 2.2rem 1.6rem;
  display: flex; flex-direction: column; justify-content: space-between;
  position: relative; overflow: hidden; min-height: 220px;
}
.hero:after {
  content: ""; position: absolute; inset: auto -20% -40% 15%; height: 80%;
  border: 2px solid rgba(255,122,0,.25); border-radius: 50%; pointer-events: none;
}
.hero .brand { color: #fff; }
.hero h2 { font-size: clamp(1.5rem, 3vw, 2.15rem); margin: 2.2rem 0 0.55rem; line-height: 1.2; }
.hero p { color: #cbd5e1; max-width: 22rem; line-height: 1.55; margin: 0; }
.form-wrap { display: grid; place-items: center; padding: 2rem 1.25rem; }
.form-wrap .inner { width: min(24rem, 100%); }

@media (min-width: 860px) {
  .login { grid-template-columns: 1.1fr 0.9fr; }
  .hero { min-height: 100vh; padding: 2.6rem 2.2rem; }
}

[x-cloak] { display: none !important; }
body.modal-open { overflow: hidden; }

/* Navigation groups */
.nav-label {
  margin: 1rem 0.75rem 0.35rem; font-size: 0.62rem; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--sidebar-muted); font-weight: 600;
}
.nav-label:first-of-type { margin-top: 0.35rem; }

/* Tabs — inside panel */
.panel-tabs { padding: 0; overflow: hidden; }
.tab-bar {
  display: flex; gap: 0; border-bottom: 1px solid var(--line);
  background: var(--surface-subtle); padding: 0 0.35rem; overflow-x: auto;
}
.tab-item {
  position: relative; display: inline-flex; align-items: center;
  padding: 0.9rem 1rem; text-decoration: none; color: var(--text-muted);
  font: 600 0.88rem var(--font); white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color .15s ease, border-color .15s ease;
}
.tab-item:hover { color: var(--text); }
.tab-item.is-active {
  color: var(--text); border-bottom-color: var(--orange); background: var(--panel);
}
.tab-body { padding: 1.25rem 1.35rem 1.4rem; }
.panel-narrow { max-width: 32rem; }

.panel-header {
  padding: 1rem 1.35rem 0.25rem; border-bottom: 1px solid var(--surface-hover);
}
.panel-header h2 { margin: 0 0 0.75rem; font-size: 0.95rem; }

/* Tables */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.data-table thead th {
  padding: 0.8rem 1.35rem; text-align: left; font-size: 0.68rem;
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted);
  background: var(--surface-subtle); border-bottom: 1px solid var(--line);
}
.data-table tbody td {
  padding: 0.9rem 1.35rem; border-bottom: 1px solid var(--surface-hover); vertical-align: middle;
}
.data-table tbody tr:hover { background: var(--surface-subtle); }
.data-table tbody tr:last-child td { border-bottom: 0; }

/* Meta list (health) */
.meta-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem; margin: 0;
}
.meta-item {
  margin: 0; padding: 0.9rem 1rem; border: 1px solid var(--surface-hover);
  border-radius: 12px; background: var(--surface-subtle);
}
.meta-item dt {
  margin: 0 0 0.35rem; font-size: 0.72rem; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--text-muted); font-weight: 600;
}
.meta-item dd { margin: 0; font-size: 1rem; font-weight: 600; color: var(--text); }

/* Settings row */
.setting-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: 0.75rem 0 1.1rem; border-bottom: 1px solid var(--surface-hover);
}
.setting-row:last-of-type { border-bottom: 0; padding-bottom: 0.35rem; }
.setting-row strong { display: block; margin-bottom: 0.2rem; }
.setting-row p { margin: 0; font-size: 0.88rem; }

.switch { position: relative; display: inline-flex; flex-shrink: 0; }
.switch input {
  position: absolute; opacity: 0; width: 0; height: 0;
}
.switch-ui {
  position: relative;
  width: 44px; height: 26px; border-radius: 999px; background: #d1d5db;
  transition: background .2s ease; cursor: pointer;
}
.switch-ui::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.15);
  transition: transform .2s ease;
}
.switch input:checked + .switch-ui { background: var(--orange); }
.switch input:checked + .switch-ui::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-ui { outline: 2px solid #fdba74; outline-offset: 2px; }
.switch-table { margin: 0 auto; }

.profile-fields-table select {
  min-width: 9rem; padding: 0.55rem 0.65rem; font-size: 0.88rem;
}

.form-actions { display: flex; gap: 0.5rem; padding-top: 0.5rem; }
.empty-state { padding: 2rem 0.5rem; text-align: center; color: var(--text-muted); }

.permission-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.85rem; margin-top: 0.75rem;
}
.permission-group {
  border: 1px solid var(--surface-hover); border-radius: 12px; background: var(--surface-subtle); overflow: hidden;
}
.permission-group h3 {
  margin: 0; padding: 0.7rem 0.85rem; font-size: 0.72rem; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-muted); background: var(--panel); border-bottom: 1px solid var(--surface-hover);
}
.permission-list { display: grid; gap: 0; }
.permission-item {
  display: flex; align-items: flex-start; gap: 0.6rem; padding: 0.65rem 0.85rem;
  border-top: 1px solid var(--surface-hover); cursor: pointer;
}
.permission-item:first-child { border-top: 0; }
.permission-item input { width: auto; margin-top: 0.2rem; flex-shrink: 0; }
.permission-item strong { display: block; font-size: 0.88rem; font-weight: 600; color: var(--text); }
.permission-item small { display: block; margin-top: 0.15rem; color: var(--text-muted); font-size: 0.75rem; }
.permission-item:hover { background: var(--panel); }

.actions-cell { white-space: nowrap; text-align: right; }
.device-list {
  list-style: none; margin: 0; padding: 0; display: grid; gap: 0.35rem;
}
.device-list li {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  font-size: 0.85rem;
}
.device-list form { display: inline; }
.btn-link {
  border: 0; background: none; color: var(--orange); font: 600 0.85rem var(--font);
  cursor: pointer; padding: 0.2rem 0.4rem; border-radius: 6px;
  transition: background .15s ease, color .15s ease;
}
.btn-link:hover { background: #fff7ed; }
.btn-link.danger { color: var(--danger); }
.btn-link.danger:hover { background: #fef2f2; }
form.inline { display: inline; }
.badge.bad { background: #fee2e2; color: var(--danger); }

/* Toasts */
.toast-root {
  position: fixed; top: 1rem; right: 1rem; z-index: 300; display: grid; gap: 0.5rem;
  width: min(22rem, calc(100vw - 2rem)); pointer-events: none;
}
.toast {
  padding: 0.85rem 1rem; border-radius: 12px; background: var(--panel); color: var(--text);
  box-shadow: 0 12px 32px rgba(13,27,42,.14); border-left: 4px solid var(--orange);
  opacity: 0; transform: translateY(-8px); transition: .22s ease;
  pointer-events: auto; font-size: 0.92rem; font-weight: 500;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-success { border-left-color: var(--ok); }
.toast-error { border-left-color: var(--danger); }
.toast-warn { border-left-color: var(--warn); }
.toast-rich { display: grid; gap: 0.55rem; }
.toast-rich .toast-text { margin: 0; font-weight: 500; }
.toast-copy-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--slate); }
.toast-copy-row { display: flex; justify-content: flex-end; }

/* Modals */
.modal {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.modal[hidden] { display: none !important; }
.modal-backdrop {
  position: absolute; inset: 0; background: rgba(13,27,42,.5);
  backdrop-filter: blur(2px);
}
.modal-card {
  position: relative; width: min(28rem, 100%); background: var(--panel);
  border-radius: 18px; padding: 1.25rem 1.35rem 1.35rem;
  box-shadow: 0 24px 60px rgba(13,27,42,.22);
  animation: modal-in .2s ease;
}
.modal-card.modal-sm { width: min(24rem, 100%); }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1rem; padding-bottom: 0.85rem; border-bottom: 1px solid var(--surface-hover);
}
.modal-head h2 { margin: 0; font-size: 1.15rem; }
.modal-close {
  border: 0; background: var(--surface-hover); width: 2rem; height: 2rem; border-radius: 8px;
  font-size: 1.2rem; line-height: 1; cursor: pointer; color: var(--text-muted);
  transition: background .15s ease;
}
.modal-close:hover { background: var(--line); }
.modal-actions { display: flex; justify-content: flex-end; gap: 0.55rem; margin-top: 1.1rem; }

@keyframes modal-in {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.panel-subsection {
  margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--surface-hover);
}
.panel-subsection h3 { margin: 0 0 0.35rem; font-size: 0.95rem; }
.branding-preview {
  margin: 0 0 1.25rem; padding: 1rem 1.1rem; border-radius: 12px; background: var(--navy);
  max-width: 260px;
}
.branding-preview .brand { color: #fff; padding: 0.25rem 0.5rem; }
.branding-preview .tag { color: #9ca3af; }
.logo-current { display: flex; align-items: center; gap: 1rem; margin-bottom: 0.75rem; }
.logo-current img { width: 48px; height: 48px; object-fit: contain; border-radius: 10px; background: #fff; padding: 0.35rem; }
.smtp-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 1rem; }

.impersonation-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.75rem 1rem; background: rgba(255, 122, 0, 0.1); border-bottom: 1px solid rgba(255, 122, 0, 0.35);
  color: var(--text);
}
.impersonation-banner strong { display: block; margin-bottom: 0.15rem; }
.impersonation-banner .muted { font-size: 0.85rem; }

.app-header-theme { display: inline; margin: 0; padding: 0; border: 0; background: none; }
.app-header-theme button.app-header-icon {
  margin: 0;
  padding: 0;
  font: inherit;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  text-decoration: none;
}

[data-theme="dark"] {
  --text: #e8eef5;
  --text-muted: #94a3b8;
  --slate: #94a3b8;
  --canvas: #0b1220;
  --panel: #131c2e;
  --header-bg: #131c2e;
  --sidebar-bg: #070d14;
  --sidebar-text: #cbd5e1;
  --sidebar-muted: #64748b;
  --input-bg: #0b1220;
  --surface-subtle: #0f172a;
  --surface-hover: #1a2538;
  --line: #243044;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
[data-theme="dark"] .panel { border-color: var(--line); }
[data-theme="dark"] .btn.secondary:hover { background: var(--surface-hover); border-color: var(--line); }
[data-theme="dark"] .btn-link:hover { background: rgba(255, 122, 0, 0.1); }
[data-theme="dark"] .btn-link.danger:hover { background: rgba(185, 28, 28, 0.12); }
[data-theme="dark"] .badge { background: rgba(4, 120, 87, 0.2); color: #6ee7b7; }
[data-theme="dark"] .badge.bad { background: rgba(185, 28, 28, 0.2); color: #fca5a5; }
[data-theme="dark"] .badge.warn { background: rgba(180, 83, 9, 0.2); color: #fcd34d; }
[data-theme="dark"] .flash { background: rgba(4, 120, 87, 0.15); color: #6ee7b7; }
[data-theme="dark"] .errors { background: rgba(185, 28, 28, 0.15); color: #fca5a5; }
[data-theme="dark"] .secret { background: rgba(255, 122, 0, 0.1); border-color: rgba(255, 122, 0, 0.35); }
[data-theme="dark"] .notification-item.unread { background: rgba(255, 122, 0, 0.08); }
[data-theme="dark"] .logo-current img { background: var(--panel); }
[data-theme="dark"] body.guest { background: var(--canvas); }
[data-theme="dark"] body.guest .form-wrap { background: var(--canvas); }

.actions-cell select {
  width: auto;
  min-width: 9rem;
  display: inline-block;
  margin-right: 0.35rem;
  vertical-align: middle;
  padding: 0.55rem 0.65rem;
  font-size: 0.88rem;
}
.actions-cell .btn.small { display: inline-flex; width: auto; }
