:root {
  --ink: #080b1e;
  --midnight: #0e1433;
  --panel: #141b42;
  --panel-2: #1e2858;
  --line: #24305f;
  --fg: #eef0fa;
  --muted: #9aa3c7;
  --on-air: #ff3d6e;
  --ember: #ff6a3d;
  --amber: #ffb547;
  --ok: #3ddc97;
  --signal: linear-gradient(90deg, var(--on-air), var(--ember), var(--amber));
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { background: var(--ink); }
body {
  margin: 0;
  min-height: 100vh;
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--fg);
  background: radial-gradient(1200px 700px at 20% -10%, #1e2a5a, var(--midnight) 55%, var(--ink));
  background-attachment: fixed;
}
header.top {
  display: flex; align-items: center; gap: 16px;
  padding: 18px 32px; max-width: 1560px; margin: 0 auto;
}
header.top img { height: 30px; }
header.top .spacer { flex: 1; }
main { max-width: 1560px; margin: 0 auto; padding: 8px 32px 64px; }
h1 { font-size: 26px; margin: 8px 0 4px; }
h2 { font-size: 18px; margin: 0 0 12px; }
p.lead { color: var(--muted); margin: 0 0 24px; }
.card {
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  border: 1px solid var(--line); border-radius: 16px; padding: 22px;
}
.stack { display: grid; gap: 16px; align-content: start; }
.grid2 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); align-items: start; }
/* Grid children default to their content's width; let long text shrink and ellipsize instead. */
.stack > *, .grid2 > *, .list > * { min-width: 0; }
.narrow { max-width: 440px; margin: 40px auto; }
label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
input, select, textarea {
  font: inherit; color: var(--fg); background: var(--midnight);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%;
  box-sizing: border-box;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--ember); outline-offset: 1px; }
textarea { resize: vertical; min-height: 80px; }
button {
  font: inherit; font-weight: 600; cursor: pointer; border: 0; border-radius: 999px;
  padding: 10px 20px; color: #fff; background: var(--signal);
}
button.ghost { background: var(--panel-2); color: var(--fg); }
button.danger { background: transparent; color: var(--on-air); border: 1px solid var(--on-air); }
button.danger.solid { background: var(--on-air); color: white; }
button.small { padding: 6px 14px; font-size: 13px; }
button:disabled { opacity: .5; cursor: default; }
.end { justify-content: flex-end; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row > .grow { flex: 1; min-width: min(160px, 100%); }
.muted { color: var(--muted); }
.error { color: var(--on-air); margin: 0; }
.notice { color: var(--ok); margin: 0; }
.error:empty, .notice:empty { display: none; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; letter-spacing: .02em; }
.badge.active { background: color-mix(in srgb, var(--ok) 20%, transparent); color: var(--ok); }
.badge.trial { background: color-mix(in srgb, var(--amber) 20%, transparent); color: var(--amber); }
.badge.expired, .badge.banned { background: color-mix(in srgb, var(--on-air) 20%, transparent); color: var(--on-air); }
.badge.neutral { background: var(--panel-2); color: var(--muted); }
.badge.info { background: color-mix(in srgb, var(--ember) 20%, transparent); color: var(--ember); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .03em; }
.list { display: grid; gap: 10px; }
.item { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-radius: 12px; background: var(--midnight); border: 1px solid var(--line); }
.item .grow { flex: 1; min-width: 0; }
.item .title { font-weight: 600; }
.item .sub { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.segmented { display: inline-flex; background: var(--midnight); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.segmented button { background: transparent; color: var(--muted); padding: 6px 16px; }
.segmented button.on { background: var(--panel-2); color: var(--fg); }
nav.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 20px; }
nav.tabs button { background: transparent; color: var(--muted); }
nav.tabs button.on { background: var(--panel-2); color: var(--fg); }
nav.tabs button:focus-visible, button:focus-visible, tr.click:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.table-wrap {
  overflow-x: auto;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--midnight) 75%, transparent);
}
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13.5px;
}
thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  text-align: left;
  color: var(--muted);
  background: var(--panel);
  font-weight: 600;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
th, td {
  padding: 13px 16px;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
  vertical-align: middle;
}
tbody tr:last-child td {
  border-bottom: 0;
}
tbody tr.click {
  cursor: pointer;
  transition: background 0.12s ease;
}
tbody tr.click:hover td {
  background: color-mix(in srgb, var(--panel-2) 60%, var(--midnight));
}
.tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.tile { background: var(--midnight); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.tile .value { font-size: 26px; font-weight: 700; }
.tile .label { color: var(--muted); font-size: 13px; }
.credits { font-weight: 700; padding: 6px 14px; border-radius: 999px; background: var(--panel-2); }
.toolbar { display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.toolbar .search { flex:1; min-width:min(240px, 100%); }
.panel-heading { display:flex; align-items:flex-end; justify-content:space-between; gap:18px; flex-wrap:wrap; }
.panel-heading h2 { margin-bottom:3px; }
.panel-subtitle { margin:0; font-size:13px; }
.reseller-toolbar { margin-left:auto; }
.reseller-toolbar .search { width:min(280px, 100%); }
.actions { justify-content:flex-end; flex-wrap:nowrap; }
.table-note { max-width:220px; margin-top:2px; color:var(--muted); font-size:12px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.reseller-state { margin:5px 0 0; }
tr.is-disabled td { opacity:.7; }
tr.is-disabled td:last-child { opacity:1; }
.empty { padding: 36px 18px; text-align:center; color:var(--muted); }
.toast-host { position:fixed; z-index:1000; right:18px; bottom:18px; display:grid; gap:10px; width:min(360px, calc(100vw - 36px)); }
.toast { padding:13px 16px; border-radius:12px; background:var(--panel-2); border:1px solid var(--line); box-shadow:0 14px 40px rgb(0 0 0 / .35); }
.toast.ok { border-color:color-mix(in srgb, var(--ok) 55%, var(--line)); }
.toast.error { border-color:var(--on-air); }
.loading { position:relative; pointer-events:none; opacity:.65; }
.loading::after { content:""; position:absolute; width:22px; height:22px; border:3px solid var(--line); border-top-color:var(--amber); border-radius:50%; animation:spin .7s linear infinite; top:18px; right:18px; }
@keyframes spin { to { transform:rotate(360deg); } }
.metric-group { display:grid; gap:10px; }
.metric-group > h3 { margin:0; color:var(--amber); font-size:12px; text-transform:uppercase; letter-spacing:.08em; }
.device-title { display:flex; align-items:center; gap:10px; }
.device-title .label { font-family:inherit; color:var(--fg); }
textarea { font:inherit; color:var(--fg); background:var(--midnight); border:1px solid var(--line); border-radius:10px; padding:10px 12px; width:100%; resize:vertical; min-height:90px; }
textarea:focus { outline:2px solid var(--ember); outline-offset:1px; }
[hidden] { display: none !important; }
@media (max-width: 600px) {
  header.top, main { padding-left: 16px; padding-right: 16px; }
  header.top .muted { display: none; }
  .card { padding: 16px; }
  nav.tabs { overflow-x:auto; flex-wrap:nowrap; padding-bottom:4px; }
  nav.tabs button { white-space:nowrap; }
  .desktop-table th:nth-child(n+4), .desktop-table td:nth-child(n+4) { display:none; }
  dialog .head { align-items:flex-start; flex-wrap:wrap; }
  .reseller-toolbar { width:100%; margin-left:0; }
  .reseller-toolbar > * { flex:1; min-width:130px; }
}

/* ---- Master dashboard ---- */
dialog:not([open]) { display: none !important; }
dialog {
  width: min(760px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
  padding: 0; border: 1px solid var(--line); border-radius: 18px;
  background: var(--panel); color: var(--fg);
}
dialog::backdrop { background: rgb(4 6 18 / .7); }
dialog .head .grow { flex: 1; }
dialog .head { display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); }
dialog .body { padding: 18px 22px 24px; display: grid; gap: 20px; }
.confirm-dialog { width:min(460px, calc(100vw - 32px)); }
.facts {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
}
.facts .fact-card {
  background: var(--midnight);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.facts .fact-card .label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
}
.facts .fact-card .value {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.facts .fact-card .value.highlight {
  color: var(--amber);
}
.facts .fact-card .value .badge {
  display: inline-block;
  vertical-align: middle;
}
.section-title { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--amber); margin: 0 0 8px; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--panel-2); }
input.days { width: 90px; }
select.inline { width: auto; }

label.check { display: flex; align-items: center; gap: 10px; color: var(--fg); font-size: 14px; }
label.check input { width: auto; }

/* ---- Reseller Panel 2-Column Layout ---- */
.activate-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}
@media (max-width: 880px) {
  .activate-layout {
    grid-template-columns: 1fr;
  }
}
.welcome-bar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin: 12px 0 16px;
  flex-wrap: wrap;
}
.welcome-bar h1 {
  margin: 0;
  font-size: 24px;
}
.welcome-bar .subtitle {
  color: var(--muted);
  font-size: 13px;
  margin-top: 3px;
}
.price-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  background: var(--midnight);
  border: 1px solid var(--line);
  font-size: 12px;
  color: var(--fg);
}
.price-chip strong {
  color: var(--amber);
}
.plan-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  border-radius: 10px;
  background: var(--midnight);
  border: 1px solid var(--line);
}
.plan-row .cost {
  font-weight: 700;
  color: var(--amber);
}
.tile.positive .value { color: var(--ok); }
.tile.warning .value { color: var(--amber); }
.tile.danger .value { color: var(--on-air); }

/* ---- Device Details Modal Redesign ---- */
.dialog-card {
  background: var(--midnight);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
}
.playlist-form-card {
  background: var(--midnight);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin-top: 10px;
}
.playlist-type-selector {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 2px;
  flex-wrap: wrap;
}
.playlist-item {
  background: var(--midnight);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
}
.activity-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
  padding-right: 2px;
}
.activity-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  background: var(--midnight);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
}
.activity-item .left {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
  min-width: 0;
}
.activity-item .action-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
  text-transform: capitalize;
  white-space: nowrap;
  flex-shrink: 0;
}
.activity-item .action-badge.activated { background: rgb(34 197 94 / .15); color: var(--ok); border: 1px solid rgb(34 197 94 / .3); }
.activity-item .action-badge.registered { background: rgb(56 189 248 / .15); color: #38bdf8; border: 1px solid rgb(56 189 248 / .3); }
.activity-item .action-badge.reassigned { background: rgb(168 85 247 / .15); color: #c084fc; border: 1px solid rgb(168 85 247 / .3); }
.activity-item .action-badge.alert { background: rgb(244 63 94 / .15); color: var(--on-air); border: 1px solid rgb(244 63 94 / .3); }
.activity-item .action-badge.default { background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); }
.activity-item .detail {
  color: var(--fg);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.activity-item .time {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ---- Brand platform tabs ---- */
.brand-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 2px 10px;
  margin-bottom: 6px;
  flex-wrap: nowrap;
  -webkit-overflow-scrolling: touch;
}
.brand-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--midnight);
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 15px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s ease;
}
.brand-tab:hover {
  border-color: var(--amber);
  color: var(--fg);
}
.brand-tab.on {
  background: var(--panel-2);
  color: #fff;
  border-color: var(--amber);
  box-shadow: 0 0 14px rgba(255, 181, 71, 0.22);
}
.brand-tab .count {
  font-size: 11px;
  background: var(--line);
  color: var(--fg);
  padding: 1px 7px;
  border-radius: 999px;
  font-weight: 700;
}
.brand-tab.on .count {
  background: var(--amber);
  color: var(--ink);
}

/* Platform badge in table */
.platform-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  background: var(--midnight);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.platform-badge.platform-firetv { border-color: rgba(255, 106, 61, 0.4); color: #ff9d7a; }
.platform-badge.platform-shield { border-color: rgba(118, 185, 0, 0.4); color: #9fe625; }
.platform-badge.platform-androidtv { border-color: rgba(61, 220, 151, 0.4); color: #3ddc97; }
.platform-badge.platform-samsung { border-color: rgba(66, 133, 244, 0.4); color: #7cb5ec; }
.platform-badge.platform-lg { border-color: rgba(200, 107, 255, 0.4); color: #e195ff; }
.platform-badge.platform-roku { border-color: rgba(135, 76, 255, 0.4); color: #b78eff; }
.platform-badge.platform-apple { border-color: rgba(255, 255, 255, 0.4); color: #ffffff; }

/* Expiry pill */
.expiry-pill {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--midnight);
  color: var(--muted);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.expiry-pill.lifetime {
  background: rgba(61, 220, 151, 0.12);
  color: var(--ok);
  border-color: rgba(61, 220, 151, 0.35);
}
.expiry-pill.ok {
  color: var(--muted);
}
.expiry-pill.warning {
  background: rgba(255, 181, 71, 0.12);
  color: var(--amber);
  border-color: rgba(255, 181, 71, 0.35);
}
.expiry-pill.urgent {
  background: rgba(255, 61, 110, 0.15);
  color: var(--on-air);
  border-color: rgba(255, 61, 110, 0.4);
  font-weight: 700;
}
.expiry-pill.expired {
  background: rgba(255, 61, 110, 0.2);
  color: #ff6b8b;
  border-color: rgba(255, 61, 110, 0.4);
}

/* Activity indicator */
.activity-cell {
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}
.activity-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.activity-indicator.online {
  background: var(--ok);
  box-shadow: 0 0 8px var(--ok);
}
.activity-indicator.recent {
  background: var(--amber);
}
.activity-indicator.offline {
  background: var(--line);
}

/* Playlist pill */
.playlist-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--midnight);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.playlist-pill.empty {
  background: rgba(255, 181, 71, 0.14);
  color: var(--amber);
  border-color: rgba(255, 181, 71, 0.45);
}
.playlist-pill.ok {
  color: var(--fg);
}

/* Modern toolbar */
.device-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 4px 0 6px;
}
.device-toolbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  flex: 1;
}
.device-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Platform distribution pills in overview */
.platform-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}
.platform-stat-card {
  background: var(--midnight);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.platform-stat-card .icon {
  font-size: 22px;
}
.platform-stat-card .count {
  font-size: 18px;
  font-weight: 700;
}
.platform-stat-card .label {
  font-size: 11px;
  color: var(--muted);
}
.copy-btn {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  padding: 2px 6px;
  font-size: 11px;
  cursor: pointer;
}
.copy-btn:hover {
  color: var(--fg);
  border-color: var(--amber);
}

/* ---- Redesigned Device Command Center Dialog ---- */
#device-dialog {
  width: min(1140px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--ink);
  color: var(--fg);
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(255, 255, 255, 0.05);
  overflow: hidden;
  padding: 0;
}
#device-dialog:not([open]) {
  display: none !important;
}
#device-dialog[open] {
  display: flex;
  flex-direction: column;
}
#device-dialog .device-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
  background: radial-gradient(800px 300px at 10% -30%, rgba(255, 106, 61, 0.15), var(--panel));
  flex-shrink: 0;
}
#device-dialog .device-modal-hero {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 0;
}
#device-dialog .device-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
#device-dialog .device-hero-title {
  font-size: 20px;
  font-weight: 700;
  margin: 0;
  color: var(--fg);
}
#device-dialog .device-hero-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
#device-dialog .device-modal-body {
  padding: 20px 24px 28px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* KPI Ribbon */
.device-kpi-ribbon {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
@media (max-width: 820px) {
  .device-kpi-ribbon {
    grid-template-columns: repeat(2, 1fr);
  }
}
.kpi-card {
  background: var(--midnight);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.kpi-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
}
.kpi-value {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--fg);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 2-Column Grid inside Device Dialog */
.device-modal-columns {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, 1.18fr);
  gap: 18px;
  align-items: start;
}
@media (max-width: 900px) {
  .device-modal-columns {
    grid-template-columns: 1fr;
  }
}
.device-col-left, .device-col-right {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}
.device-box {
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.device-box-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.device-box-head h3 {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--amber);
}

/* Monospace Pill */
.mono-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--midnight);
  border: 1px solid var(--line);
  font-size: 12px;
}

/* WhatsApp button */
.wa-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 12px;
  border-radius: 999px;
  background: #25D366;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.15s, filter 0.15s;
}
.wa-btn:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

/* Timeline */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  padding-left: 20px;
  margin: 4px 0;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--line);
}
.timeline-item {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.timeline-dot {
  position: absolute;
  left: -20px;
  top: 4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--amber);
  border: 2px solid var(--midnight);
  box-shadow: 0 0 6px rgba(255, 181, 71, 0.6);
}
.timeline-dot.activated {
  background: var(--ok);
  box-shadow: 0 0 6px rgba(61, 220, 151, 0.6);
}
.timeline-dot.registered {
  background: var(--amber);
  box-shadow: 0 0 6px rgba(255, 181, 71, 0.6);
}
.timeline-dot.reassigned {
  background: #4dabf7;
  box-shadow: 0 0 6px rgba(77, 171, 247, 0.6);
}
.timeline-dot.alert {
  background: var(--on-air);
  box-shadow: 0 0 6px rgba(255, 61, 110, 0.6);
}
.timeline-content {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.timeline-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
}
.timeline-time {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}
.timeline-detail {
  font-size: 12px;
  color: var(--muted);
}

/* ---- Reseller & Sub-Reseller Table Enhancements ---- */
.credits-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--midnight);
  border: 1px solid var(--line);
  font-weight: 700;
  color: var(--amber);
  font-size: 12.5px;
}
.device-count-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--midnight);
  border: 1px solid var(--line);
  color: var(--fg);
  font-size: 12px;
  font-weight: 600;
}
#new-reseller-dialog,
#edit-reseller-dialog,
#reset-password-dialog,
#adjust-credits-dialog {
  width: min(540px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--fg);
  overflow: hidden;
  padding: 0;
}
#new-reseller-dialog:not([open]),
#edit-reseller-dialog:not([open]),
#reset-password-dialog:not([open]),
#adjust-credits-dialog:not([open]) {
  display: none !important;
}
#new-reseller-dialog[open],
#edit-reseller-dialog[open],
#reset-password-dialog[open],
#adjust-credits-dialog[open] {
  display: flex;
  flex-direction: column;
}

/* ---- User / Customer Portal Enhancements ---- */
.portal-hero {
  background: radial-gradient(800px 300px at 10% -30%, rgba(255, 106, 61, 0.15), var(--panel));
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.portal-hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.portal-hero-title {
  font-size: 22px;
  font-weight: 700;
  margin: 0;
  color: var(--fg);
}
.portal-hero-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
