:root {
  --stealth-sidebar: #1e293b;
  --stealth-accent: #0d9488;
  --stealth-accent-dark: #0f766e;
  --stealth-content: #f1f5f9;
  --stealth-card: #ffffff;
  --stealth-text: #0f172a;
  --stealth-muted: #64748b;
}

* { box-sizing: border-box; }

.stealth-body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--stealth-content);
  color: var(--stealth-text);
}

.stealth-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.stealth-sidebar {
  width: 240px;
  background: var(--stealth-sidebar);
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.stealth-brand {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  padding: 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.stealth-brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--stealth-accent);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
}

.stealth-brand-title { font-weight: 700; font-size: 1rem; }
.stealth-brand-sub { font-size: 0.7rem; color: #94a3b8; }

.stealth-nav {
  display: flex;
  flex-direction: column;
  padding: 0.75rem 0.5rem;
  gap: 0.15rem;
  flex: 1;
}

.stealth-nav-item {
  color: #cbd5e1;
  text-decoration: none;
  padding: 0.55rem 0.85rem;
  border-radius: 6px;
  font-size: 0.92rem;
  font-weight: 500;
}

.stealth-nav-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.stealth-nav-item.active {
  background: var(--stealth-accent);
  color: #fff;
}

.stealth-sidebar-foot {
  padding: 1rem;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.stealth-main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.stealth-topbar {
  background: var(--stealth-card);
  border-bottom: 1px solid #e2e8f0;
  padding: 0.9rem 1.5rem;
  flex-shrink: 0;
}

.stealth-page-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 650;
}

.stealth-content {
  padding: 1.25rem 1.5rem 2rem;
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
}

.stealth-flash { border-left: 4px solid var(--stealth-accent); }

.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.kpi-card {
  background: var(--stealth-card);
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 1rem 1.1rem;
}

.kpi-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--stealth-muted); }
.kpi-value { font-size: 1.6rem; font-weight: 700; color: var(--stealth-accent-dark); margin-top: 0.2rem; }

.panel {
  background: var(--stealth-card);
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 1rem 1.15rem;
  margin-bottom: 1rem;
}

.panel-title {
  font-size: 0.95rem;
  font-weight: 650;
  margin: 0 0 0.85rem;
}

.btn-stealth {
  background: var(--stealth-accent);
  border-color: var(--stealth-accent);
  color: #fff;
}

.btn-stealth:hover {
  background: var(--stealth-accent-dark);
  border-color: var(--stealth-accent-dark);
  color: #fff;
}

.table.stealth-table {
  font-size: 0.875rem;
  margin-bottom: 0;
}

.table.stealth-table thead th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--stealth-muted);
  border-bottom-width: 1px;
}

.badge-status-sent { background: #ccfbf1; color: #0f766e; }
.badge-status-failed { background: #fee2e2; color: #b91c1c; }
.badge-status-queued, .badge-status-sending { background: #e2e8f0; color: #475569; }

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.media-card {
  background: var(--stealth-card);
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.media-card video, .media-card .media-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #0f172a;
  object-fit: cover;
}

.media-card-body { padding: 0.85rem 1rem 1rem; flex: 1; display: flex; flex-direction: column; gap: 0.35rem; }
.media-card-title { font-weight: 650; font-size: 0.95rem; margin: 0; }
.media-card-desc { color: var(--stealth-muted); font-size: 0.82rem; margin: 0; flex: 1; }

.form-hint { font-size: 0.8rem; color: var(--stealth-muted); }

.stealth-login-body {
  min-height: 100vh;
  background:
    radial-gradient(ellipse at top left, rgba(13, 148, 136, 0.18), transparent 50%),
    linear-gradient(160deg, #0f172a 0%, #1e293b 55%, #0f172a 100%);
}

.stealth-login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.stealth-login-card {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border-radius: 12px;
  padding: 1.75rem 1.5rem 1.5rem;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
}

.stealth-login-brand {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1.5rem;
}

.stealth-login-brand .stealth-brand-title { color: var(--stealth-text); }
.stealth-login-brand .stealth-brand-sub { color: var(--stealth-muted); }

.btn-stealth {
  background: var(--stealth-accent);
  border-color: var(--stealth-accent);
  color: #fff;
  font-weight: 600;
}

.btn-stealth:hover {
  background: var(--stealth-accent-dark);
  border-color: var(--stealth-accent-dark);
  color: #fff;
}

/* AJAX toasts - stay visible over the shell without a full navigation */
.stealth-toast-host {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: min(420px, calc(100vw - 2rem));
  pointer-events: none;
}

.stealth-toast {
  pointer-events: auto;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18);
  color: #fff;
  font-size: 0.9rem;
  line-height: 1.35;
  animation: stealth-toast-in 0.2s ease-out;
}

.stealth-toast--ok { background: #0f766e; }
.stealth-toast--err { background: #b91c1c; }
.stealth-toast.is-leaving {
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

@keyframes stealth-toast-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

form.is-stealth-busy { opacity: 0.75; pointer-events: none; }

/* Page layouts: keep chrome/KPIs/side panels visible; only the grid scrolls */
.stealth-page-fit {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  gap: 0;
}

.stealth-page-fit > .stealth-page-chrome {
  flex-shrink: 0;
}

.stealth-page-fit > .stealth-page-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.stealth-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  gap: 1rem;
  flex: 1;
  min-height: 0;
  align-items: stretch;
}

.stealth-split-main {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.stealth-split-side {
  min-height: 0;
  overflow: auto;
  align-self: stretch;
  max-height: 100%;
}

.panel.panel-fill {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  margin-bottom: 0;
}

.panel.panel-fill > .panel-head {
  flex-shrink: 0;
}

.panel.panel-fill > .stealth-grid {
  flex: 1;
  min-height: 0;
}

/* Data grid: search / sort / column filter / paging */
.stealth-grid {
  display: flex;
  flex-direction: column;
  min-height: 0;
  gap: 0.5rem;
}

.stealth-grid-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.stealth-grid-search {
  flex: 1 1 220px;
  max-width: 360px;
}

.stealth-grid-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  color: var(--stealth-muted);
  font-size: 0.8rem;
}

.stealth-grid-pagesize {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
}

.stealth-grid-pagesize select {
  width: auto;
  min-width: 4.5rem;
}

.stealth-grid-scroll {
  flex: 1;
  min-height: 160px;
  overflow: auto;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #fff;
}

.stealth-grid-scroll .table {
  margin-bottom: 0;
}

.stealth-grid-scroll thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fff;
  box-shadow: inset 0 -1px 0 #e2e8f0;
}

.stealth-grid-scroll thead tr.stealth-grid-filters th {
  top: 2.15rem;
  z-index: 1;
  background: #f8fafc;
  padding-top: 0.35rem;
  padding-bottom: 0.35rem;
  box-shadow: inset 0 -1px 0 #e2e8f0;
}

.stealth-grid-sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.stealth-grid-sortable::after {
  content: " \2195";
  opacity: 0.35;
  font-size: 0.75em;
}

.stealth-grid-sortable.is-sorted-asc::after { content: " \2191"; opacity: 0.9; }
.stealth-grid-sortable.is-sorted-desc::after { content: " \2193"; opacity: 0.9; }

.stealth-grid-filters input {
  min-width: 4.5rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
}

.stealth-grid-pager {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.stealth-grid-pages {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  align-items: center;
}

.stealth-grid-page-num {
  min-width: 2rem;
  padding-left: 0.45rem;
  padding-right: 0.45rem;
}

.stealth-grid-page-ellipsis {
  min-width: 1.25rem;
  text-align: center;
  color: var(--stealth-muted);
  font-size: 0.85rem;
  user-select: none;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

.stealth-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  min-height: 220px;
  padding: 2rem 1rem;
  text-align: center;
}

.stealth-loading-spinner {
  width: 2rem;
  height: 2rem;
  border: 3px solid #e2e8f0;
  border-top-color: var(--stealth-accent);
  border-radius: 50%;
  animation: stealth-spin 0.75s linear infinite;
}

.stealth-loading-text {
  font-weight: 600;
  color: var(--stealth-text);
}

@keyframes stealth-spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 992px) {
  .stealth-shell { height: auto; min-height: 100vh; overflow: visible; flex-direction: column; }
  .stealth-sidebar { width: 100%; }
  .stealth-nav { flex-direction: row; flex-wrap: wrap; }
  .stealth-main { height: auto; min-height: 0; }
  .stealth-content { overflow: visible; display: block; }
  .stealth-page-fit,
  .stealth-page-fit > .stealth-page-body,
  .panel.panel-fill,
  .stealth-split-main {
    display: block;
    min-height: 0;
  }
  .stealth-split {
    display: block;
  }
  .stealth-split-side {
    position: static;
    max-height: none;
    margin-top: 1rem;
  }
  .stealth-grid-scroll {
    max-height: min(60vh, 520px);
  }
}


