:root {
  --black: #0a0a0a;
  --surface: #121212;
  --elevated: #1a1a1a;
  --border: #2a2a2a;
  --text: #e5e5e5;
  --text-muted: #9a9a9a;
  --text-dim: #5c5c5c;
  --accent: #34d399;
  --accent-hover: #6ee7b7;
  --accent-muted: #1c3934;
  --success: #34d399;
  --warning: #fbbf24;
  --error: #f87171;
  /* Legacy aliases */
  --red: var(--accent);
  --red-hover: var(--accent-hover);

  --topbar-h: 64px;

  --dock-h: 64px;

  --z-topbar: 50;
  --z-dock: 40; /* under the top bar so its dropdowns cover a top-docked dock */
  --z-dock-zone: 39;
  --z-drawer: 60;
}

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

html, body { margin: 0; }

body {
  min-height: 100vh;
  background: var(--black);
  color: var(--text);
  font-family: system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.6;
}

main {
  padding-top: var(--topbar-h);
  padding-bottom: calc(var(--dock-h) + 32px); /* keep content clear of the dock */
}

:focus-visible {
  outline: 2px solid var(--red-hover);
  outline-offset: 3px;
  border-radius: 8px;
}

/* ---------- Scrollbars ---------- */
/* Slim dark scrollbars everywhere; the thumb turns accent color while hovered/dragged */

::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track { background: transparent; }

::-webkit-scrollbar-thumb {
  background: #2e2e2e;
  background-clip: padding-box;
  border: 3px solid transparent; /* inset the thumb so it floats in the track */
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: #4a4a4a;
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:active {
  background: var(--red);
  background-clip: padding-box;
}

::-webkit-scrollbar-corner { background: transparent; }

/* Firefox */
@supports not selector(::-webkit-scrollbar) {
  * { scrollbar-width: thin; scrollbar-color: #2e2e2e transparent; }
}

/* ---------- Top bar ---------- */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-topbar);
  background: rgba(20, 20, 20, 0.82);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
}

/* Hairline accent along the bottom edge */
.topbar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--red), transparent);
  opacity: 0.8;
}

.topbar__inner {
  height: var(--topbar-h);
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
}

.brand__name {
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-weight: 600;
  font-size: 1.35rem;
  letter-spacing: -0.01em;
  color: var(--text);
}

.brand__tld { color: var(--red-hover); }

/* Subtle emerald gradient text (falls back to solid emerald) */
.brand__tld,
.welcome__name {
  background: linear-gradient(90deg, #6ee7b7, #34d399);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.topbar__right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 14px 0 4px;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
}

.user__pfp {
  display: block;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.user__info {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.user__name {
  font: 600 0.875rem system-ui, sans-serif;
  color: var(--text);
}

.user__time {
  font: 500 0.75rem system-ui, sans-serif;
  color: #a3a3a3;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  background: transparent;
  color: var(--text);
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 200ms ease, color 200ms ease, background-color 200ms ease;
}

.icon-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Telegram: solid plane */
.icon-btn svg.icon-telegram path {
  fill: currentColor;
  stroke: none;
}

.icon-btn:hover,
.icon-btn[aria-expanded="true"] {
  border-color: var(--red);
  color: var(--red-hover);
  background: rgba(52, 211, 153, 0.08);
}

/* Dropdowns (notifications, what's new) */
.dropdown {
  position: relative;
}

.dropdown__panel {
  position: absolute;
  top: calc(100% + 20px);
  right: 0;
  width: 380px;
  max-width: calc(100vw - 32px);
  background: #141414;
  border: 1px solid #2a2a2a;
  border-radius: 10px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 180ms ease, transform 180ms ease, visibility 0s 180ms;
}

.dropdown__panel.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition: opacity 180ms ease, transform 180ms ease;
}

.dropdown__title {
  margin: 0;
  padding: 14px 16px;
  font: 600 0.95rem system-ui, sans-serif;
  color: var(--text);
  border-bottom: 1px solid #2a2a2a;
}

.dropdown__list {
  margin: 0;
  padding: 6px;
  list-style: none;
  max-height: 360px; /* script.js trims this to fit 4 notifications */
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* Uses the site-wide scrollbar style (see Scrollbars) */

.dropdown__empty {
  padding: 20px 16px;
  font: 400 0.875rem system-ui, sans-serif;
  color: #a3a3a3;
}

.brand__logo {
  display: block;
  width: 40px;
  height: 40px;
  image-rendering: pixelated;
  visibility: hidden;
}

.notif {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px 10px 12px;
  border-radius: 8px;
  transition: background-color 150ms ease;
}

.notif + .notif { margin-top: 2px; }

.notif:hover { background: #1a1a1a; }

/* Unread: lighter background. Read: faded text. */
.notif.is-unread { background: #1a1a1a; }

.notif.is-unread:hover { background: #202020; }

.notif:not(.is-unread) .notif__title { color: #a3a3a3; }

.notif:not(.is-unread) .notif__text { color: #737373; }

.notif__body {
  flex: 1;
  min-width: 0;
}

.notif__actions {
  flex-shrink: 0;
  display: flex;
  gap: 6px;
}

.notif__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  background: transparent;
  color: #a3a3a3;
  border: 1px solid #2a2a2a;
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 150ms ease, color 150ms ease, background-color 150ms ease;
}

.notif__btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.notif__btn:hover {
  border-color: var(--red);
  color: var(--red-hover);
  background: rgba(52, 211, 153, 0.08);
}

/* Already read: nothing left to mark */
.notif:not(.is-unread) .notif__read { display: none; }

.notif__head {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.notif__title {
  font: 600 0.875rem system-ui, sans-serif;
  color: var(--text);
}

.notif__time {
  flex-shrink: 0;
  font: 400 0.75rem system-ui, sans-serif;
  color: #737373;
}

.notif__text {
  display: block;
  margin-top: 2px;
  font: 400 0.8125rem system-ui, sans-serif;
  color: #a3a3a3;
}

/* Unread count on the bell */
.icon-btn { position: relative; }

.badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 20px;
  height: 20px;
  padding: 0 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--red);
  color: #fff;
  font: 700 0.6875rem/1 system-ui, sans-serif;
  border: 2px solid #141414;
  border-radius: 999px;
}

.badge[hidden] { display: none; }

.text-valid { color: #34d399; }

.text-invalid { color: var(--error); }

/* What's new entries */
.update {
  padding: 10px 12px;
}

.update + .update {
  margin-top: 2px;
  border-top: 1px solid #2a2a2a;
}

.update__title {
  display: block;
  font: 600 0.875rem system-ui, sans-serif;
  color: var(--text);
}

.update__text {
  margin: 2px 0 0;
  font: 400 0.8125rem/1.5 system-ui, sans-serif;
  color: #a3a3a3;
}

/* ---------- Dock ---------- */
.dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 16px;
  z-index: var(--z-dock);
  width: fit-content;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 240px;
  max-width: calc(100vw - 32px);
  height: var(--dock-h);
  padding: 0 12px;
  background: rgba(20, 20, 20, 0.82);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border: 1px solid #2a2a2a;
  border-radius: 16px;
}

.dock__item {
  position: relative;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  color: #a3a3a3;
  text-decoration: none;
  border-radius: 10px;
  transition: background-color 150ms ease, color 150ms ease;
}

.dock__item svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dock__item:hover {
  color: var(--text);
  background: #1f1f1f;
}

.dock__item.is-active {
  color: var(--red-hover);
  background: rgba(52, 211, 153, 0.1);
}

/* Label above the icon on hover / keyboard focus */
.dock__item::after {
  content: attr(data-label);
  position: absolute;
  bottom: calc(100% + 12px);
  left: 50%;
  transform: translate(-50%, 4px);
  padding: 4px 8px;
  background: #1f1f1f;
  color: var(--text);
  font: 500 0.75rem system-ui, sans-serif;
  white-space: nowrap;
  border: 1px solid #2a2a2a;
  border-radius: 6px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 150ms ease, transform 150ms ease;
}

.dock__item:hover::after,
.dock__item:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

.dock__sep {
  flex-shrink: 0;
  width: 1px;
  height: 28px;
  margin: 0 6px;
  background: #2a2a2a;
}

/* ---------- Page content ---------- */
.page {
  max-width: 1200px;
  margin: 0 auto;
  padding-left: 28px;
  padding-right: 28px;
}

.welcome {
  margin: 40px 0 24px;
  font: 600 1.75rem/1.2 system-ui, sans-serif;
  letter-spacing: -0.01em;
  color: var(--text);
}

.welcome__name {
  background: linear-gradient(90deg, #bbf7d0, #34d399 50%, #bbf7d0);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.card {
  padding: 18px 20px;
  background: #141414;
  border: 1px solid #2a2a2a;
  border-radius: 12px;
}

.card__title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  font: 600 0.95rem system-ui, sans-serif;
  color: var(--text);
}

.card__title > svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.card__title > svg[viewBox^="4.5"] {
  fill: var(--accent);
  stroke: none;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
}

.stat {
  padding: 14px 16px;
  background: #1a1a1a;
  border-radius: 8px;
}

.stat__label {
  font: 500 0.75rem system-ui, sans-serif;
  color: #a3a3a3;
}

.stat__value {
  margin: 4px 0 0;
  font: 600 1rem system-ui, sans-serif;
  color: var(--text);
}

.stat__value--active { color: #34d399; }

.stat__value--num {
  font-size: 1.5rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.card + .card { margin-top: 20px; }

.stats--two { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.stat__unit {
  font-size: 0.875rem;
  font-weight: 500;
  color: #a3a3a3;
}

.card__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.card__head .card__title { margin: 0; }

.card__meta {
  font: 500 0.8125rem system-ui, sans-serif;
  color: #a3a3a3;
}

@media (max-width: 768px) {
  .page {
    padding-left: 16px;
    padding-right: 16px;
  }

  .welcome {
    margin-top: 28px;
    font-size: 1.4rem;
  }

  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- Dock edges (PC only): drag the dock and it snaps to an edge ---------- */
@media (min-width: 641px) {
  .dock {
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
  }


  /* Top */
  .dock[data-edge="top"] {
    top: calc(var(--topbar-h) + 16px);
    bottom: auto;
  }

  .dock[data-edge="top"] .dock__item::after {
    top: calc(100% + 12px);
    bottom: auto;
    transform: translate(-50%, -4px);
  }

  .dock[data-edge="top"] .dock__item:hover::after,
  .dock[data-edge="top"] .dock__item:focus-visible::after { transform: translate(-50%, 0); }

  /* Left / right: vertical */
  .dock[data-edge="left"],
  .dock[data-edge="right"] {
    top: var(--topbar-h);
    bottom: 0;
    width: var(--dock-h);
    height: fit-content;
    min-width: 0;
    max-height: calc(100vh - var(--topbar-h) - 32px);
    margin: auto 0;
    flex-direction: column;
    padding: 12px 0;
  }

  .dock[data-edge="left"] { left: 16px; right: auto; }

  .dock[data-edge="right"] { right: 16px; left: auto; }

  .dock[data-edge="left"] .dock__sep,
  .dock[data-edge="right"] .dock__sep {
    width: 28px;
    height: 1px;
    margin: 6px 0;
  }

  .dock[data-edge="left"] .dock__item::after,
  .dock[data-edge="right"] .dock__item::after {
    top: 50%;
    bottom: auto;
  }

  .dock[data-edge="left"] .dock__item::after {
    left: calc(100% + 12px);
    transform: translate(-4px, -50%);
  }

  .dock[data-edge="right"] .dock__item::after {
    left: auto;
    right: calc(100% + 12px);
    transform: translate(4px, -50%);
  }

  .dock[data-edge="left"] .dock__item:hover::after,
  .dock[data-edge="left"] .dock__item:focus-visible::after,
  .dock[data-edge="right"] .dock__item:hover::after,
  .dock[data-edge="right"] .dock__item:focus-visible::after { transform: translate(0, -50%); }
}

/* Dock while being dragged (PC): closed down to the current tab, centred on the cursor */
@media (min-width: 641px) {
  .dock.is-dragging[data-edge] {
    top: 0;
    left: 0;
    right: auto;
    bottom: auto;
    width: auto;
    height: auto;
    min-width: 0;
    max-height: none;
    margin: 0;
    translate: -50% -50%; /* script.js moves it to the cursor with transform */
    cursor: grabbing;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
    will-change: transform;
  }

  .dock.is-collapsed[data-edge] {
    gap: 0;
    padding: 10px;
  }

  .dock.is-collapsed > :not(.is-active) { display: none; }

  /* While closing/opening: clip to the animating size, keep the icons centred */
  .dock.is-animating {
    overflow: hidden;
    justify-content: center;
  }

  .dock.is-dragging .dock__item::after,
  .dock.is-animating .dock__item::after { display: none; }
}

/* Drop zone shown while dragging the dock: highlights the whole side it will snap to.
   script.js sets its position/size; it glides between sides as you drag. */
.dock-zone {
  position: fixed;
  z-index: var(--z-dock-zone);
  background: rgba(52, 211, 153, 0.08);
  border: 2px dashed rgba(110, 231, 183, 0.6);
  border-radius: 16px;
  pointer-events: none;
  opacity: 0;
  transform: scale(0.98);
  transition:
    opacity 180ms ease,
    transform 180ms ease,
    left 260ms cubic-bezier(0.2, 0.8, 0.2, 1),
    top 260ms cubic-bezier(0.2, 0.8, 0.2, 1),
    width 260ms cubic-bezier(0.2, 0.8, 0.2, 1),
    height 260ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.dock-zone.is-visible {
  opacity: 1;
  transform: scale(1);
}

/* First appearance: fade in place instead of gliding from the last spot */
.dock-zone.no-glide { transition: opacity 180ms ease, transform 180ms ease; }

@media (prefers-reduced-motion: reduce) {
  .dock-zone,
  .dock-zone.no-glide { transition: none; }
}

/* ---------- Page switch animation ---------- */
/* Opt in to cross-document transitions so navigating dashboard.html <-> panel.html animates
   (Chrome/Edge). Browsers without it just do a normal, instant page load. */
@view-transition { navigation: auto; }

main { view-transition-name: page; }

@keyframes page-out {
  to { opacity: 0; transform: translateY(-8px); }
}

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

::view-transition-old(page) { animation: page-out 160ms ease-in both; }

::view-transition-new(page) { animation: page-in 320ms cubic-bezier(0.2, 0.8, 0.2, 1) 120ms both; }

/* Fallback for browsers without View Transitions.
 *
 * Transform only. Animating opacity with `both` meant a throttled or paused
 * animation (background tab, reduced-motion edge cases) held the view at
 * opacity 0 and the tab looked blank even though it was rendered.
 */
@keyframes view-in {
  from { transform: translateY(14px); }
  to   { transform: translateY(0); }
}
.view-enter { animation: view-in 320ms cubic-bezier(0.2, 0.8, 0.2, 1) both; }

@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(page),
  ::view-transition-new(page),
  .view-enter { animation: none; }
}

/* ---------- Panel page ---------- */
/* Panel uses the full width instead of the centred page column */
main.page:has(> .panel:not([hidden])) {
  max-width: none;
  padding-left: 0;
  padding-right: 0;
  padding-bottom: 0;
}

/* Post overview fits the screen: a column where the chart row fills the leftover height */
[data-view-panel="overview"] {
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: calc(100vh - var(--topbar-h) - var(--dock-h) - 32px);
  min-height: 520px;
}

[data-view-panel="overview"] .welcome { margin: 12px 0 0; }

/* Drop the default card/row stacking margins inside the flex column */
[data-view-panel="overview"] .card,
[data-view-panel="overview"] .ov-split { margin: 0; }

/* Chart + Top Services row grows to fill the remaining space */
[data-view-panel="overview"] .ov-split--grow {
  flex: 1;
  min-height: 0;
}

[data-view-panel="overview"] .ov-split--grow > .card {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

[data-view-panel="overview"] .ov-split--grow .chart {
  flex: 1;
  height: auto;
  min-height: 0;
}

[data-view-panel="overview"] .ov-split--grow .toplist {
  min-height: 0;
  overflow: auto;
}

/* SMTP / NFA / FA: config box (left) + HTML preview box (right), filling the screen */
[data-view-panel="smtp"],
[data-view-panel="nfa"],
[data-view-panel="fa"] {
  display: flex;
  flex-direction: column;
  margin-top: 16px;
  height: calc(100vh - var(--topbar-h) - var(--dock-h) - 72px);
  min-height: 420px;
}

[data-view-panel="smtp"] > .welcome,
[data-view-panel="nfa"] > .welcome,
[data-view-panel="fa"] > .welcome { margin: 0 0 16px; }

/* Config box (left) + preview box (right), filling the remaining height */
.post-boxes {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 16px;
}

.post-box {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: #141414;
  border: 1px solid #2a2a2a;
  border-radius: 12px;
  overflow: hidden;
}

.post-box__head {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 56px;
  padding: 8px 10px 8px 18px;
  font: 600 0.95rem system-ui, sans-serif;
  color: var(--text);
  border-bottom: 1px solid #2a2a2a;
}

.post-box__content {
  flex: 1;
  min-height: 0;
  padding: 18px;
  overflow: auto;
}

/* Stack the config fields */
.post-box__content > * + * { margin-top: 14px; }

/* Pinned footer at the bottom of a box (Send Post button) */
.post-box__foot {
  flex-shrink: 0;
  padding: 14px 18px;
  border-top: 1px solid #2a2a2a;
}

.post-box__foot .btn-accept {
  width: 100%;
  height: 42px;
  justify-content: center;
}

/* Two fields sharing one line */
.post-row {
  display: flex;
  gap: 10px;
}

.post-row > .nav-field {
  flex: 1;
  min-width: 0;
}

/* Text input (Subject), matching the select style */
.post-input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  font: 500 0.9rem system-ui, sans-serif;
  color: var(--text);
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 10px;
  transition: border-color 150ms ease;
}

.post-input::placeholder { color: #737373; }

.post-input:hover { border-color: #4a4a4a; }

.post-input:focus-visible { outline: none; border-color: var(--red); }

/* Embedded HTML fills the preview box edge to edge */
.post-box__frame {
  flex: 1;
  min-height: 0;
  width: 100%;
  background: #fff;
  border: 0;
}

/* Hidden content panels stay hidden (overrides the display rules above) */
[data-view-panel][hidden] { display: none; }

.panel {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: calc(100vh - var(--topbar-h));
}

.panel[hidden] { display: none; }

.panel__sidebar {
  position: sticky;
  top: var(--topbar-h);
  align-self: start;
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  padding: 20px 12px;
  background: #0f0f0f;
  border-right: 1px solid #2a2a2a;
}

.panel__heading {
  display: block;
  padding: 0 12px 10px;
  font: 600 0.7rem system-ui, sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #737373;
}

.panel__nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.panel__item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  height: 40px;
  padding: 0 12px;
  background: transparent;
  color: #a3a3a3;
  font: 500 0.9rem system-ui, sans-serif;
  text-align: left;
  white-space: nowrap;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease;
}

.panel__item svg {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.panel__item:hover {
  color: var(--text);
  background: #1a1a1a;
}

.panel__item.is-active {
  color: var(--red-hover);
  background: rgba(52, 211, 153, 0.1);
}

.panel__sep {
  height: 1px;
  margin: 8px 4px;
  background: #2a2a2a;
}

.panel__content {
  min-width: 0;
  padding: 24px 28px calc(var(--dock-h) + 32px);
}

/* Panel overview metrics */
.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
}

.metrics + .metrics { margin-top: 12px; }

/* Overview layout: Sessions across the top, Engagement + Accounts side by side below */
.ov-split {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 16px;
  margin-top: 16px;
}

.ov-split > .card { margin-top: 0; }

.ov-split + .ov-split { margin-top: 16px; }

.metrics.metrics--two { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.metrics.metrics--one { grid-template-columns: minmax(0, 1fr); }

/* Tiles inside a card sit on a slightly lighter fill instead of their own outline */
.card .metric {
  background: #1a1a1a;
  border-color: transparent;
}

/* Medium screens: the sidebar leaves less room */
@media (max-width: 1024px) {
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .ov-split { grid-template-columns: minmax(0, 1fr); }

  .session-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .metrics.metrics--one { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.metric {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: #141414;
  border: 1px solid #2a2a2a;
  border-radius: 12px;
}

.metric__icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  color: var(--red-hover);
  background: rgba(52, 211, 153, 0.1);
  border-radius: 10px;
}

.metric__icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.metric__label {
  font: 500 0.8rem system-ui, sans-serif;
  color: #a3a3a3;
}

.metric__value {
  margin: 2px 0 0;
  font: 600 1.5rem/1.2 system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

/* Empty state inside a card */
.empty {
  margin: 0;
  padding: 36px 16px;
  text-align: center;
  font: 500 0.875rem system-ui, sans-serif;
  color: #737373;
  border: 1px dashed #2a2a2a;
  border-radius: 10px;
}

/* Count pill next to a card title */
.card__title .count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  margin-left: 6px;
  padding: 0 6px;
  vertical-align: 1px;
  background: var(--red);
  color: #fff;
  font: 700 0.72rem/1 system-ui, sans-serif;
  border-radius: 999px;
}

.card__title .count[hidden] { display: none; }

/* Connection rows (Sessions > Pending) */
.conn-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.conn {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  background: #1a1a1a;
  border-radius: 10px;
}

.conn__avatar {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  color: var(--red-hover);
  background: rgba(52, 211, 153, 0.1);
  border-radius: 10px;
}

.conn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.conn__main {
  flex: 1;
  min-width: 0;
}

.conn__line {
  display: flex;
  align-items: baseline; /* text and tags share one baseline */
  flex-wrap: wrap;
  gap: 4px 10px;
}

.conn__line > svg,
.conn__client { align-self: center; }

/* Browser line in session boxes: keep the tag on the same line, shorten the text if needed */
.session .conn__line--meta:last-child { flex-wrap: nowrap; }

.conn__text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conn__tag { flex-shrink: 0; }

.conn__line--meta {
  margin-top: 4px;
  font: 400 0.8rem system-ui, sans-serif;
  color: #a3a3a3;
}

.conn__client {
  display: inline-flex;
  gap: 6px;
  color: #a3a3a3;
}

.conn__client svg { width: 15px; height: 15px; }

.conn__client svg.is-fill { fill: currentColor; stroke: none; transform: scale(0.85); }

.conn__ip {
  font: 600 0.95rem ui-monospace, "Cascadia Mono", Consolas, monospace;
  color: var(--text);
}

.conn__time {
  font: 400 0.78rem system-ui, sans-serif;
  color: #737373;
}

.conn__country {
  padding: 1px 5px;
  font: 600 0.68rem ui-monospace, Consolas, monospace;
  color: #d4d4d4;
  border: 1px solid #3a3a3a;
  border-radius: 4px;
}

.conn__tag {
  font: 600 0.68rem system-ui, sans-serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #34d399;
}

.conn__tag--vpn { color: var(--red-hover); }

.conn__actions {
  flex-shrink: 0;
  display: flex;
  gap: 8px;
}

.btn-accept,
.btn-deny {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  font: 600 0.85rem system-ui, sans-serif;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}

.btn-accept svg,
.btn-deny svg {
  display: block;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Trim the label to its capital letters so it centres exactly against the icon */
.btn-accept span,
.btn-deny span,
.btn-toggle span {
  display: block;
  white-space: nowrap;
  line-height: 1;
  text-box: trim-both cap alphabetic;
}

/* Page header with title + subtitle on the left and action buttons on the right */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 40px 0 20px; /* top margin matches the .welcome title on other tabs */
}

.page-header .welcome { margin: 0; }

.page-header__text {
  flex: 1;
  min-width: 0;
}

.page-header__sub {
  margin: 4px 0 0;
  font: 400 0.9rem system-ui, sans-serif;
  color: #a3a3a3;
}

.page-header__actions {
  flex-shrink: 0;
  display: flex;
  gap: 10px;
  transform: translateY(6px); /* nudge the buttons down to sit under the title */
}

.btn-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  font: 600 0.85rem system-ui, sans-serif;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease;
}

.btn-toggle svg {
  display: block;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.btn-toggle--on {
  color: #000;
  background: var(--accent);
  border-color: var(--accent);
}

.btn-toggle--on:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-toggle--off {
  color: #fff;
  background: #dc2626;
  border-color: #dc2626;
}

.btn-toggle--off:hover { background: #b91c1c; border-color: #b91c1c; }

/* ---------- Service rows (compact list) ---------- */
.service-list {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  list-style: none;
}

.svc-row { border-bottom: 1px solid #1f1f1f; }
.svc-row:last-child { border-bottom: 0; }

.svc-row__bar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.svc-row__toggle {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 4px;
  background: none;
  border: 0;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.svc-row__dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #34d399;
}

.svc-row--off .svc-row__dot { background: #6b6b6b; }

.svc-row__name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 600 0.95rem system-ui, sans-serif;
  color: var(--text);
}

.svc-row__status {
  flex-shrink: 0;
  font: 600 0.62rem system-ui, sans-serif;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #34d399;
}

.svc-row--off .svc-row__status { color: #737373; }

.svc-row__tag {
  flex-shrink: 0;
  padding: 2px 8px;
  font: 600 0.6rem system-ui, sans-serif;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #a3a3a3;
  border: 1px solid #2f2f2f;
  border-radius: 999px;
}

.svc-row__tag--proxy {
  color: var(--red-hover);
  background: rgba(52, 211, 153, 0.12);
  border-color: rgba(52, 211, 153, 0.3);
}

.svc-row__route {
  margin-left: auto;
  flex-shrink: 0;
  font: 500 0.85rem ui-monospace, "Cascadia Mono", Consolas, monospace;
  color: var(--red-hover);
  white-space: nowrap;
}

.svc-row--off .svc-row__route { color: #a3a3a3; }

.svc-row__chev {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: #737373;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 200ms ease;
}

.svc-row.is-open .svc-row__chev { transform: rotate(180deg); }

.svc-row__actions {
  flex-shrink: 0;
  display: flex;
  gap: 8px;
}

/* Settings icon stays white */
.svc-row__actions [data-action="settings"] svg { stroke: #fff; }

.svc-row__detail {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0 4px 16px 30px; /* indent under the name */
}

.svc-row__meta {
  font: 500 0.82rem ui-monospace, "Cascadia Mono", Consolas, monospace;
  color: #737373;
}

.service__route { margin-top: 0; }

.service__route-label {
  display: block;
  margin-bottom: 8px;
  font: 600 0.72rem system-ui, sans-serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #737373;
}

.service__route-row {
  display: flex;
  gap: 10px;
}

.service__route-path {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  height: 40px;
  padding: 0 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 500 0.9rem ui-monospace, "Cascadia Mono", Consolas, monospace;
  color: var(--red-hover);
  background: #121212;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
}

.svc-row--off .service__route-path { color: #a3a3a3; }

.service__route-input {
  flex: 1;
  min-width: 0;
  height: 40px;
  padding: 0 14px;
  font: 500 0.9rem ui-monospace, "Cascadia Mono", Consolas, monospace;
  color: var(--text);
  background: #121212;
  border: 1px solid var(--red);
  border-radius: 8px;
  outline: none;
}

.service__route-input:focus { border-color: var(--red-hover); }

.service__route-row .btn-deny,
.service__route-row .btn-toggle {
  flex-shrink: 0;
  height: 40px;
}

/* Edit pen icon stays white, like the Settings icon */
.service__route-row [data-action="edit"] svg { stroke: #fff; }

/* ---------- Audit log table ---------- */
/* Card with no inner padding so the table reaches the edges */
.card--flush { padding: 0; overflow: hidden; }

.audit-wrap { overflow-x: auto; }

/* White icons on the Export / Filter buttons */
#audit-export svg,
#audit-filter svg { stroke: #fff; }

/* Audit Log Entry popup */
.modal--entry {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
}

.modal--entry[open] {
  display: flex;
  flex-direction: column;
}

.entry-field + .entry-field,
.entry-field + div { margin-top: 14px; }

.entry-field__label {
  display: block;
  margin-bottom: 6px;
  font: 600 0.72rem ui-monospace, "Cascadia Mono", Consolas, monospace;
  letter-spacing: 0.04em;
  color: #737373;
}

.entry-field__value {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 14px;
  font: 500 0.9rem system-ui, sans-serif;
  color: var(--text);
  background: #121212;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  overflow-wrap: anywhere;
}

.entry-field__value .is-mono {
  font: 500 0.85rem ui-monospace, "Cascadia Mono", Consolas, monospace;
}

/* Leading icons (user / ip / clock) - the action's pulse keeps its own colour */
.entry-field__value > svg {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: #737373;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.entry-field__json {
  margin: 0;
  padding: 12px 14px;
  font: 500 0.82rem ui-monospace, "Cascadia Mono", Consolas, monospace;
  color: #a3a3a3;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: #0f0f0f;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
}

.audit-table {
  width: 100%;
  border-collapse: collapse;
}

.audit-table th {
  padding: 12px 16px;
  text-align: left;
  white-space: nowrap;
  font: 600 0.72rem ui-monospace, "Cascadia Mono", Consolas, monospace;
  letter-spacing: 0.04em;
  color: #737373;
  border-bottom: 1px solid #2a2a2a;
}

.audit-table td {
  padding: 12px 16px;
  white-space: nowrap;
  font: 400 0.85rem system-ui, sans-serif;
  color: #a3a3a3;
  border-bottom: 1px solid #1c1c1c;
}

.audit-table tbody tr:last-child td { border-bottom: 0; }

/* Subtle zebra striping for easier scanning */
.audit-table tbody tr:nth-child(even) { background: #131313; }

.audit-table tbody tr:hover { background: #1c1c1c; }

.audit__time { color: #737373; }

.audit__mono {
  font: 400 0.82rem ui-monospace, "Cascadia Mono", Consolas, monospace;
}

.audit__target { color: #a3a3a3; }

.audit__action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: 600 0.85rem ui-monospace, "Cascadia Mono", Consolas, monospace;
  color: var(--text);
}

.audit__action svg {
  flex-shrink: 0;
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: #737373; /* neutral pulse by default */
}

/* Notable events (good/bad) get a tinted chip so they stand out in the log */
.audit__action--good,
.audit__action--bad {
  padding: 3px 9px;
  border-radius: 999px;
}

.audit__action--good {
  color: #6ee7b7;
  background: rgba(52, 211, 153, 0.12);
}

.audit__action--bad {
  color: var(--error);
  background: rgba(248, 113, 113, 0.12);
}

.audit__action--good svg,
.audit__action--bad svg { color: inherit; }

.audit__details { color: #555; }

.audit__details-btn {
  display: inline-flex;
  padding: 2px;
  color: var(--red-hover);
  background: none;
  border: 0;
  cursor: pointer;
}

.audit__details-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- Domains tab ---------- */
.card__title--icon {
  display: flex;
  align-items: center;
  gap: 10px;
}

.card__title--icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: var(--red-hover);
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* DNS Setup Instructions (collapsible) */
.dns { margin-top: 16px; }

.dns__toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  background: none;
  border: 0;
  cursor: pointer;
  font: 500 0.88rem system-ui, sans-serif;
  color: #a3a3a3;
}

.dns__toggle:hover { color: var(--text); }

.dns__toggle svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 200ms ease;
}

.dns__toggle[aria-expanded="true"] svg { transform: rotate(180deg); }

.dns__body {
  margin-top: 12px;
  padding: 14px 16px;
  background: #141414;
  border: 1px solid #2a2a2a;
  border-radius: 10px;
}

.dns__body[hidden] { display: none; }

.dns__intro {
  margin: 0 0 10px;
  font: 400 0.85rem system-ui, sans-serif;
  color: #a3a3a3;
}

.dns-records { width: 100%; border-collapse: collapse; }

.dns-records th,
.dns-records td {
  padding: 6px 10px;
  text-align: left;
  font: 500 0.82rem ui-monospace, "Cascadia Mono", Consolas, monospace;
}

.dns-records th {
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #737373;
}

.dns-records td {
  color: #d4d4d4;
  border-top: 1px solid #1f1f1f;
}

/* Domain tabs */
.dm-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
}

.dm-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 0.9rem;
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.dm-tab svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.dm-tab:hover { color: var(--text); background: rgba(255,255,255,0.03); }

.dm-tab.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.dm-panel { margin-top: 8px; }

/* Server IP with blur reveal */
.server-ip {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  font-size: 0.9rem;
}

.server-ip svg {
  width: 16px;
  height: 16px;
  stroke: var(--accent);
  stroke-width: 2;
  fill: none;
}

.server-ip__label { color: var(--text-muted); }

.server-ip__value {
  color: var(--accent);
  font-family: ui-monospace, monospace;
  filter: blur(5px);
  transition: filter 0.2s;
  cursor: default;
}

.server-ip__value:hover { filter: none; }

/* DNS instruction steps */
.dns__steps {
  margin: 0;
  padding-left: 20px;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.8;
}

.dns__steps code {
  padding: 2px 6px;
  background: rgba(52, 211, 153, 0.1);
  border-radius: 4px;
  color: var(--accent);
  font-family: ui-monospace, monospace;
  font-size: 0.85em;
}

.dns__note {
  margin: 12px 0 0;
  font-size: 0.85rem;
  color: var(--text-dim);
  font-style: italic;
}

/* Cloudflare toggle row */
.cf-toggle-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.cf-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.cf-toggle__slider {
  position: relative;
  width: 40px;
  height: 22px;
  background: #333;
  border-radius: 999px;
  transition: background 0.2s;
}

.cf-toggle__slider::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: #888;
  border-radius: 50%;
  transition: transform 0.2s, background 0.2s;
}

.cf-toggle input { display: none; }

.cf-toggle input:checked + .cf-toggle__slider { background: #f6821f; }

.cf-toggle input:checked + .cf-toggle__slider::after {
  transform: translateX(18px);
  background: #fff;
}

.cf-toggle__logo {
  width: 24px;
  height: auto;
}

.cf-toggle__label {
  font-weight: 500;
  color: var(--text);
}

.cf-mode-btns {
  display: flex;
  gap: 8px;
}

.cf-mode-btns[hidden] { display: none; }

.cf-mode-btn {
  padding: 5px 12px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 0.8rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.cf-mode-btn:hover {
  border-color: #f6821f;
  color: var(--text);
}

.cf-mode-btn.is-active {
  background: rgba(246, 130, 31, 0.15);
  border-color: #f6821f;
  color: #f6821f;
}

/* Cloudflare fields */
.cf-fields { margin-top: 16px; }

.cf-field {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.cf-field > svg {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 12px;
  stroke: var(--text-dim);
  stroke-width: 2;
  fill: none;
}

.cf-field--textarea > svg { margin-top: 4px; }

.cf-field__wrap { flex: 1; }

.cf-field__label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.cf-input {
  flex: 1;
  width: 100%;
  height: 42px;
  padding: 0 14px;
  background: var(--black);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.9rem;
  font-family: ui-monospace, monospace;
}

.cf-input::placeholder { color: var(--text-dim); }
.cf-input:focus { outline: none; border-color: var(--accent); }

.cf-textarea {
  width: 100%;
  min-height: 90px;
  padding: 12px;
  background: var(--black);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.8rem;
  font-family: ui-monospace, monospace;
  resize: vertical;
}

.cf-textarea::placeholder { color: var(--text-dim); }
.cf-textarea:focus { outline: none; border-color: var(--accent); }

.cf-generate {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.cf-generate > svg {
  width: 18px;
  height: 18px;
  stroke: var(--text-dim);
  stroke-width: 2;
  fill: none;
}

.btn-cf-generate {
  padding: 8px 16px;
  background: transparent;
  border: 1px solid #f6821f;
  border-radius: 6px;
  color: #f6821f;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-cf-generate:hover { background: rgba(246, 130, 31, 0.1); }

.cf-generate__note {
  font-size: 0.8rem;
  color: var(--text-dim);
}

/* Registrar cards */
.registrar-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.registrar-card {
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.registrar-card__name {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.03em;
  margin-bottom: 6px;
}

.registrar-card__link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #f6821f;
  font-size: 0.85rem;
  text-decoration: none;
}

.registrar-card__link svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.registrar-card__link:hover { text-decoration: underline; }

/* Register domain search */
.register-search {
  display: flex;
  gap: 10px;
}

.register-search__select {
  position: relative;
  flex-shrink: 0;
}

.register-search__select select {
  appearance: none;
  height: 44px;
  padding: 0 32px 0 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
}

.register-search__select svg {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  stroke: var(--text-muted);
  stroke-width: 2;
  fill: none;
  pointer-events: none;
}

.register-search__input {
  flex: 1;
  min-width: 0;
  height: 44px;
  padding: 0 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.9rem;
}

.register-search__input::placeholder { color: var(--text-dim); }
.register-search__input:focus { outline: none; border-color: var(--accent); }

@media (max-width: 640px) {
  .registrar-grid { grid-template-columns: 1fr; }
  .register-search { flex-direction: column; }
}

/* Add domain row */
.dm-add {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.dm-add input {
  flex: 1;
  min-width: 0;
  height: 44px;
  padding: 0 14px;
  font: 500 0.9rem system-ui, sans-serif;
  color: var(--text);
  background: #121212;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  transition: border-color 150ms ease;
}

.dm-add input::placeholder { color: #737373; }
.dm-add input:focus-visible { outline: none; border-color: var(--accent); }
.dm-add input[hidden] { display: none; }

.dm-add .btn-accept {
  flex-shrink: 0;
  height: 44px;
  padding: 0 18px;
}

/* Domain list */
.dm-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.dm-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: #141414;
  border: 1px solid #222;
  border-radius: 10px;
}

.dm-row__main {
  display: flex;
  align-items: center;
  gap: 24px;
  flex: 1;
  min-width: 0;
}

.dm-row__info { min-width: 0; }

.dm-row__head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dm-row__service {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dm-row__service-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.dm-row__service-select {
  position: relative;
}

.dm-row__service-select select {
  appearance: none;
  height: 32px;
  padding: 0 28px 0 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.85rem;
  cursor: pointer;
}

.dm-row__service-select select:focus { outline: none; border-color: var(--accent); }

.dm-row__service-select svg {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  stroke: var(--text-muted);
  stroke-width: 2;
  fill: none;
  pointer-events: none;
}

.dm-row__name {
  font: 600 0.95rem ui-monospace, "Cascadia Mono", Consolas, monospace;
  color: var(--text);
}

.dm-row__status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px 2px 6px;
  font: 600 0.72rem system-ui, sans-serif;
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.4);
  border-radius: 6px;
}

.dm-row__status svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dm-row__ssl {
  display: block;
  margin-top: 4px;
  font: 400 0.8rem system-ui, sans-serif;
  color: #737373;
}

.dm-row__actions {
  flex-shrink: 0;
  display: flex;
  gap: 6px;
}

.icon-btn-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  color: #a3a3a3;
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  cursor: pointer;
  transition: color 150ms ease, border-color 150ms ease, background-color 150ms ease;
}

.icon-btn-sm:hover { color: var(--text); border-color: #4a4a4a; background: #1f1f1f; }

.icon-btn-sm svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-btn-sm[data-action="delete"]:hover {
  color: var(--red-hover);
  border-color: var(--red);
}

.icon-btn-sm:disabled { opacity: 0.6; cursor: default; }

/* SSL renewal spinner */
@keyframes dm-spin { to { transform: rotate(360deg); } }

.icon-btn-sm.is-spinning {
  color: var(--red-hover);
  border-color: var(--red);
}

.icon-btn-sm.is-spinning svg { animation: dm-spin 0.8s linear infinite; }

/* ---------- Page editor ---------- */
/* Fill the screen so the editor never needs the page to scroll */
[data-panel-view="editor"],
[data-panel-view="files"] {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--topbar-h) - var(--dock-h) - 32px);
  min-height: 440px;
}

[data-panel-view="editor"][hidden],
[data-panel-view="files"][hidden] { display: none; }

[data-panel-view="editor"] .page-header { margin-top: 24px; }

.editor {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  margin-top: 8px;
}

.btn-sm { height: 32px; padding: 0 12px; font-size: 0.82rem; }

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

.editor__ptabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ed-ptab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 14px;
  font: 600 0.85rem system-ui, sans-serif;
  color: #a3a3a3;
  background: #141414;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  cursor: pointer;
  transition: color 150ms ease, border-color 150ms ease, background-color 150ms ease;
}

.ed-ptab:hover { color: var(--text); }

.ed-ptab svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ed-ptab.is-active {
  color: var(--red-hover);
  background: rgba(52, 211, 153, 0.1);
  border-color: rgba(52, 211, 153, 0.35);
}

.editor__main {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr); /* row fills the editor height instead of growing to content */
  gap: 16px;
}

.editor__left,
.editor__right {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

/* Meta fields row */
.editor__meta {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  margin-bottom: 12px;
}

.ed-field {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ed-field > span {
  font: 500 0.72rem system-ui, sans-serif;
  color: #737373;
}

.ed-field input {
  height: 40px;
  padding: 0 12px;
  font: 500 0.85rem ui-monospace, "Cascadia Mono", Consolas, monospace;
  color: var(--text);
  background: #121212;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
}

.ed-field input:focus-visible { outline: none; border-color: var(--red); }

.ed-field__btn { flex-shrink: 0; height: 40px; }

/* Code head: lang tabs + theme + preview */
.editor__codehead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 4px 10px;
  border-bottom: 1px solid #2a2a2a;
}

.editor__langtabs { display: flex; gap: 6px; }

.ed-lang {
  height: 30px;
  padding: 0 12px;
  font: 600 0.82rem ui-monospace, "Cascadia Mono", Consolas, monospace;
  color: #737373;
  background: none;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}

.ed-lang:hover { color: var(--text); }

.ed-lang.is-active { color: var(--accent-hover); background: rgba(52, 211, 153, 0.1); }

.editor__codehead-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-select--sm select {
  height: 32px;
  padding: 0 32px 0 10px;
  font-size: 0.82rem;
}

.nav-select--sm > svg { right: 10px; width: 14px; height: 14px; }

.ed-preview-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  font: 600 0.82rem system-ui, sans-serif;
  color: #a3a3a3;
  background: none;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  cursor: pointer;
}

.ed-preview-btn:hover { color: var(--text); border-color: #4a4a4a; }

.ed-preview-btn svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Code editor (gutter + highlighted layer + textarea) */
.ed {
  flex: 1;
  min-height: 0;
  display: flex;
  overflow: hidden;
  background: #0e0e0e;
  border: 1px solid #2a2a2a;
  border-top: 0;
  border-radius: 0 0 10px 10px;
}

.ed__gutter,
.ed__pre,
.ed__ta {
  font: 13px/1.6 ui-monospace, "Cascadia Mono", Consolas, monospace;
  tab-size: 2;
}

.ed__gutter {
  flex-shrink: 0;
  padding: 12px 8px 12px 14px;
  overflow: hidden;
  text-align: right;
  white-space: pre;
  color: #5a5a5a;
  background: #0b0b0b;
  user-select: none;
}

.ed__area {
  position: relative;
  flex: 1;
  min-width: 0;
}

.ed__pre,
.ed__ta {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 12px 14px;
  white-space: pre;
  overflow: auto;
  border: 0;
}

.ed__pre {
  pointer-events: none;
  background: transparent;
  overflow: hidden;
}

.ed__code { background: transparent !important; padding: 0 !important; }

.ed__ta {
  color: transparent;
  caret-color: #fff;
  background: transparent;
  resize: none;
  outline: none;
}

.ed__ta::selection { background: rgba(120, 140, 200, 0.35); }

/* Live preview */
.editor__preview-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 4px 10px;
  font: 600 0.82rem system-ui, sans-serif;
  color: #a3a3a3;
  border-bottom: 1px solid #2a2a2a;
}

.editor__preview-head svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.editor__frame {
  flex: 1;
  min-height: 0;
  width: 100%;
  background: #fff;
  border: 1px solid #2a2a2a;
  border-top: 0;
  border-radius: 0 0 10px 10px;
}

/* ---------- Files tab (file-tree editor) ---------- */
.files {
  flex: 1;
  min-height: 0;
  margin-top: 8px;
  display: flex;
  overflow: hidden;
  background: #0e0e0e;
  border: 1px solid #2a2a2a;
  border-radius: 12px;
}

.files__tree {
  flex-shrink: 0;
  width: 240px;
  display: flex;
  flex-direction: column;
  background: #0f0f0f;
  border-right: 1px solid #2a2a2a;
}

.files__tree-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  font: 600 0.72rem ui-monospace, "Cascadia Mono", Consolas, monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #737373;
  border-bottom: 1px solid #1f1f1f;
}

.files__tree-actions { display: flex; gap: 4px; }

.files__tree-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  color: #a3a3a3;
  background: none;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}

.files__tree-actions button:hover { color: var(--text); background: #1a1a1a; }

.files__tree-actions svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.files__list {
  flex: 1;
  overflow-y: auto;
  margin: 0;
  padding: 6px;
  list-style: none;
}

.files__list ul { list-style: none; margin: 0; padding: 0; }

.fe-folder {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 8px;
  font: 600 0.85rem system-ui, sans-serif;
  color: var(--text);
  background: none;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}

.fe-folder:hover { background: #161616; }

.fe-folder__chev,
.fe-folder__icon { display: inline-flex; flex-shrink: 0; }

.fe-folder__chev svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: #737373;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 150ms ease;
}

.fe-folder.is-open .fe-folder__chev svg { transform: rotate(90deg); }

.fe-folder__icon svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: #d8a33a;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.fe-folder__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.fe-folder__count {
  margin-left: auto;
  font: 600 0.72rem ui-monospace, Consolas, monospace;
  color: #737373;
}

.fe-files { padding-left: 10px !important; }

.fe-file {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 8px;
  font: 500 0.82rem system-ui, sans-serif;
  color: #a3a3a3;
  text-align: left;
  background: none;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}

.fe-file:hover { color: var(--text); background: #161616; }

.fe-file.is-active { color: var(--text); background: rgba(52, 211, 153, 0.12); }

.fe-file__tag {
  flex-shrink: 0;
  width: 34px;
  font: 500 0.66rem ui-monospace, Consolas, monospace;
  color: #5a5a5a;
}

.fe-file__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.files__main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.files__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 49px;
  padding: 8px 14px;
  border-bottom: 1px solid #2a2a2a;
}

.files__crumb {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font: 500 0.85rem ui-monospace, "Cascadia Mono", Consolas, monospace;
  color: #737373;
}

.files__crumb svg {
  flex-shrink: 0;
  width: 15px;
  height: 15px;
  fill: none;
  stroke: #737373;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.files__crumb strong { color: var(--text); font-weight: 600; }

.files__bar-right { display: flex; align-items: center; gap: 10px; }
.files__bar-right[hidden] { display: none; }

.files__body {
  flex: 1;
  min-height: 0;
  display: flex;
}

.files__empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: #5a5a5a;
}

.files__empty[hidden] { display: none; }

.files__empty svg {
  width: 46px;
  height: 46px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.files__empty span { font: 500 0.9rem system-ui, sans-serif; }

#fe-ed { flex: 1; border: 0; border-radius: 0; }
#fe-ed[hidden] { display: none; }

/* ---------- Link Builder popup ---------- */
.modal.modal--link { width: min(680px, calc(100vw - 32px)); }

/* ---------- Manage Account popup (large) ---------- */
.modal.modal--manage {
  width: min(1280px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
}

.modal--manage[open] {
  display: flex;
  flex-direction: column;
}

/* Body stacks: [details + 2FA row] then the full-width inbox box */
.modal--manage .modal__body {
  flex-direction: column;
  align-items: stretch;
  gap: 20px;
}

.manage-top {
  display: flex;
  align-items: flex-start;
  gap: 20px;
}

.manage-card { flex: 1; }

.twofa {
  flex-shrink: 0;
  width: 420px;
}

.twofa__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  background: #121212;
  border: 1px solid #2a2a2a;
  border-radius: 12px;
}

.twofa__head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.twofa__logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
}

/* higher specificity so `.modal svg { width:18px }` doesn't shrink these */
.twofa .twofa__logo svg { width: 52px; height: 52px; }

.twofa__name { font: 600 1rem system-ui, sans-serif; color: var(--text); }

.twofa__type {
  font: 500 0.72rem ui-monospace, Consolas, monospace;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #737373;
}

/* Connections list */
.twofa__list {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow-y: auto;
}

.twofa-conn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  text-align: left;
  background: #1a1a1a;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
}

.twofa-conn:hover { background: #1f1f1f; }

.twofa-conn.is-active {
  background: rgba(52, 211, 153, 0.1);
  border-color: var(--red);
}

.twofa-conn__logo {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
}

.twofa .twofa-conn__logo svg { width: 22px; height: 22px; }

.twofa-conn__text { display: flex; flex-direction: column; min-width: 0; }

.twofa-conn__label { font: 600 0.82rem system-ui, sans-serif; color: var(--text); }

.twofa-conn__sub {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 500 0.72rem system-ui, sans-serif;
  color: #737373;
}

/* Output area reserves space so the layout never shifts */
.twofa__out {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  height: 4rem; /* fixed, so hint and code occupy the exact same space */
}

.twofa__hint {
  max-width: 220px;
  font: 500 0.82rem system-ui, sans-serif;
  color: #737373;
  text-align: center;
  line-height: 1.4;
}

.twofa__hint[hidden] { display: none; }

.twofa__code {
  display: flex;
  align-items: center;
  justify-content: center;
  font: 700 1.9rem ui-monospace, "Cascadia Mono", Consolas, monospace;
  letter-spacing: 0.18em;
  color: var(--red-hover);
}

.twofa__code:empty { display: none; }

.twofa__seed {
  display: flex;
  align-items: center;
  justify-content: center;
  font: 500 0.78rem ui-monospace, Consolas, monospace;
  color: #a3a3a3;
  text-align: center;
  word-break: break-all;
}

.twofa__seed:empty { display: none; }


@media (max-width: 640px) {
  .modal--manage .modal__body { flex-direction: column; }
  .twofa { width: 100%; }
}

.manage-card {
  padding: 2px 16px;
  background: #121212;
  border: 1px solid #2a2a2a;
  border-radius: 12px;
}

.manage-row {
  display: flex;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid #1f1f1f;
}

.manage-row:last-child { border-bottom: 0; }

.manage-row__label {
  flex-shrink: 0;
  width: 128px;
  font: 500 0.82rem system-ui, sans-serif;
  color: #737373;
}

.manage-row__value {
  flex: 1;
  min-width: 0;
  font: 500 0.85rem ui-monospace, "Cascadia Mono", Consolas, monospace;
  color: var(--text);
  white-space: pre-line;
  word-break: break-all;
}

/* Secret values: blurred until hovered, click to copy */
.manage-row__value--secret {
  align-self: flex-start;
  padding: 2px 6px;
  margin: -2px -6px;
  background: none;
  border: 0;
  border-radius: 6px;
  text-align: left;
  cursor: pointer;
  filter: blur(5px);
  user-select: none;
  transition: filter 150ms ease, background-color 150ms ease;
}

.manage-row__value--secret:hover,
.manage-row__value--secret:focus-visible {
  filter: blur(0);
  background: #1a1a1a;
  outline: none;
  user-select: text;
}

.acct-enrolled {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: 600 0.9rem system-ui, sans-serif;
  color: #34d399;
}

.acct-enrolled svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- Inbox viewer (Manage Account) ---------- */
.inbox {
  width: 100%;
  padding: 16px 18px;
  background: #121212;
  border: 1px solid #2a2a2a;
  border-radius: 12px;
}

.inbox__head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  font: 600 0.95rem system-ui, sans-serif;
  color: var(--text);
}

.inbox__logo { display: inline-flex; }

.inbox .inbox__logo svg { width: 22px; height: 18px; }

.inbox__tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 4px;
}

.inbox__tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 14px;
  font: 500 0.82rem system-ui, sans-serif;
  color: #a3a3a3;
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 999px;
  cursor: pointer;
  transition: color 150ms ease, background-color 150ms ease, border-color 150ms ease;
}

.inbox__tab:hover { color: var(--text); border-color: #4a4a4a; }

.inbox__tab.is-active {
  color: var(--text);
  background: #2e2e2e;
  border-color: #3a3a3a;
}

.inbox__tab svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.inbox__body { padding-top: 14px; }

/* Account tool tiles (2x2 grid under the inbox) */
.tools {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.tool {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 22px;
  text-align: left;
  background: #121212;
  border: 1px solid #2a2a2a;
  border-radius: 14px;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease;
}

.tool:hover { background: #171717; border-color: #4a4a4a; }

.tool__logo {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.tool__text { display: flex; flex-direction: column; gap: 2px; }

.tool__label { font: 600 1rem system-ui, sans-serif; color: var(--text); }

.tool__sub { font: 500 0.8rem system-ui, sans-serif; color: #737373; }

/* ---------- Tool popups ---------- */
.tool-head { display: flex; align-items: center; gap: 10px; }

.tool-head__logo { width: 26px; height: 26px; object-fit: contain; }

.modal.modal--tool {
  width: min(960px, calc(100vw - 32px));
  height: min(82vh, 640px);
}

.modal--tool[open] { display: flex; flex-direction: column; }

/* Drive */
.drive { display: flex; gap: 20px; height: 100%; }

.drive__side {
  flex-shrink: 0;
  width: 220px;
}

.drive__side-title {
  padding: 10px 12px;
  font: 600 0.95rem system-ui, sans-serif;
  color: var(--text);
  background: rgba(52, 211, 153, 0.1);
  border-radius: 8px;
}

.drive__storage { margin-top: 18px; }

.drive__bar {
  height: 8px;
  background: #1f1f1f;
  border-radius: 4px;
  overflow: hidden;
}

.drive__bar span {
  display: block;
  height: 100%;
  background: var(--red-hover);
  border-radius: 4px;
}

.drive__storage-text {
  margin-top: 8px;
  font: 500 0.8rem system-ui, sans-serif;
  color: #a3a3a3;
}

.drive__main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.drive__search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 0 12px;
  height: 38px;
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
}

.drive__search svg {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: #737373;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.drive__search input {
  flex: 1;
  min-width: 0;
  background: none;
  border: 0;
  outline: none;
  color: var(--text);
  font: 500 0.88rem system-ui, sans-serif;
}

.drive__search input::placeholder { color: #737373; }

.drive-empty {
  padding: 16px 10px;
  font: 500 0.85rem system-ui, sans-serif;
  color: #737373;
}

.drive__thead,
.drive-file {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 130px 90px 44px;
  align-items: center;
  gap: 12px;
}

.drive__thead {
  padding: 0 10px 10px;
  font: 600 0.72rem system-ui, sans-serif;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #737373;
  border-bottom: 1px solid #2a2a2a;
}

.drive__files {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  margin: 0;
  padding: 4px 0 0;
  list-style: none;
}

.drive-file {
  padding: 10px;
  border-radius: 8px;
  font: 500 0.85rem system-ui, sans-serif;
  color: #d4d4d4;
}

.drive-file:hover { background: #1a1a1a; }

.drive-file__name {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drive-file__name svg {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--red-hover);
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.drive-file__mod,
.drive-file__size { color: #737373; font-size: 0.8rem; }

.drive-file__dl {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  color: #a3a3a3;
  background: none;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

.drive-file__dl:hover { color: var(--text); background: #222; }

.drive-file__dl svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Photos */
.photos-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}

.photo {
  aspect-ratio: 1;
  border-radius: 10px;
}

/* Passwords */
.pw-list { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0; list-style: none; }

.pw-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  background: #1a1a1a;
  border-radius: 10px;
}

.pw-row__info { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.pw-row__site { font: 600 0.9rem system-ui, sans-serif; color: var(--text); }

.pw-row__user { font: 500 0.8rem system-ui, sans-serif; color: #737373; }

.pw-row__pass {
  min-width: 150px;
  text-align: right;
  font: 600 0.88rem ui-monospace, "Cascadia Mono", Consolas, monospace;
  color: #a3a3a3;
  letter-spacing: 1px;
  word-break: break-all;
}

.pw-row__pass.is-shown { color: var(--text); letter-spacing: 0; }

.pw-eye {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  color: #a3a3a3;
  background: none;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

.pw-eye:hover { color: var(--text); background: #222; }

.pw-list .pw-eye svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Scan findings */
.scan__bar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid #2a2a2a;
}

.scan__n { font: 600 0.95rem system-ui, sans-serif; color: var(--text); }

.scan__breakdown { font: 500 0.82rem system-ui, sans-serif; color: #737373; }

.scan-find { display: flex; flex-direction: column; gap: 4px; min-width: 0; }

.scan-find__item {
  font: 500 0.88rem system-ui, sans-serif;
  color: var(--text);
}

.scan-find__src {
  margin-right: 6px;
  padding: 1px 7px;
  font: 600 0.68rem system-ui, sans-serif;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #a3a3a3;
  background: #222;
  border-radius: 999px;
}

.scan-find__hits { display: flex; flex-wrap: wrap; gap: 5px; }

.scan-tag {
  padding: 1px 7px;
  font: 600 0.68rem system-ui, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--red-hover);
  background: rgba(52, 211, 153, 0.12);
  border-radius: 4px;
}

/* Scan */
.scan-list { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0; list-style: none; }

.scan-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  background: #1a1a1a;
  border: 1px solid #232323;
  border-left: 3px solid var(--red);
  border-radius: 8px;
}

.scan-find {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.scan-find__top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.scan-find__item { font: 600 0.88rem system-ui, sans-serif; color: var(--text); }

.scan-find__value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 500 0.82rem ui-monospace, "Cascadia Mono", Consolas, monospace;
  color: #8a8a8a;
}

.scan-act { flex-shrink: 0; }

/* ---------- Settings page ---------- */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 20px;
}

/* cancel the generic `.card + .card` margin so both grid cards start level */
.settings-grid > .card { margin-top: 0; }

.settings-grid + .card { margin-top: 20px; }

/* Label + description row with a control on the right */
.set-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0 0;
}

.set-row:first-of-type { padding-top: 8px; }

.set-row__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.set-row__label { font: 600 0.9rem system-ui, sans-serif; color: var(--text); }

.set-row__desc { font: 500 0.8rem system-ui, sans-serif; color: #737373; }

/* Field: label above an input */
.set-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 14px;
}

.set-field:first-child { margin-top: 0; }

.set-field__label { font: 600 0.82rem system-ui, sans-serif; color: var(--text); }

.set-field__hint { font: 400 0.78rem/1.4 system-ui, sans-serif; color: #737373; }

.set-field__row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

.set-field__row .empty { margin: 0; }

.set-input {
  height: 42px;
  padding: 0 14px;
  color: var(--text);
  background: #121212;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  font: 500 0.88rem ui-monospace, "Cascadia Mono", Consolas, monospace;
  transition: border-color 150ms ease;
}

.set-input::placeholder { color: #5a5a5a; }

.set-input:focus-visible { outline: none; border-color: var(--red); }

.set-textarea {
  height: auto;
  min-height: 84px;
  padding: 12px 14px;
  line-height: 1.5;
  resize: vertical;
}

.set-range { width: 100%; accent-color: var(--accent); cursor: pointer; }

.set-volume {
  display: flex;
  align-items: center;
  gap: 12px;
}

.set-volume .set-range { flex: 1; min-width: 0; }

.set-volume .btn-sm { flex-shrink: 0; height: 36px; }

#sound-test svg { fill: currentColor; stroke: none; }

/* select in settings matches the input height */
.settings-grid .nav-select select { height: 42px; }

/* Toggle switch */
.switch {
  position: relative;
  flex-shrink: 0;
  width: 44px;
  height: 24px;
}

.switch input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.switch__slider {
  position: absolute;
  inset: 0;
  background: #2e2e2e;
  border-radius: 999px;
  transition: background-color 150ms ease;
}

.switch__slider::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: transform 150ms ease;
}

.switch input:checked + .switch__slider { background: var(--accent); }

.switch input:checked + .switch__slider::before { transform: translateX(20px); }

.switch input:focus-visible + .switch__slider { outline: 2px solid var(--accent-hover); outline-offset: 2px; }

@media (max-width: 900px) {
  .settings-grid { grid-template-columns: minmax(0, 1fr); }
}

/* Profile section */
.profile-section {
  padding: 8px 0 14px;
}

.profile-upload {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 10px;
}

.profile-upload__preview {
  flex-shrink: 0;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent);
}

.profile-upload__actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.profile-upload__hint {
  flex: 1;
  font: 400 0.75rem system-ui, sans-serif;
  color: var(--text-dim);
}

.profile-name-row {
  display: flex;
  gap: 10px;
}

.profile-name-row .set-input {
  flex: 1;
}

.profile-name-row .btn-accept {
  flex-shrink: 0;
}

/* Settings subtitle */
.set-subtitle {
  margin: 18px 0 10px;
  padding-top: 14px;
  border-top: 1px solid #2a2a2a;
  font: 600 0.85rem system-ui, sans-serif;
  color: var(--text-muted);
}

/* Warning description */
.set-row__desc--warn { color: #f87171; }

/* Input with add button */
.set-input-add {
  display: flex;
  gap: 8px;
}

.set-input-add .set-input { flex: 1; min-width: 0; }

.set-input--short { max-width: 120px; }

.btn-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  background: transparent;
  border: 1px solid #3a3a3a;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease;
}

.btn-icon svg {
  width: 18px;
  height: 18px;
  stroke: var(--text-muted);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.btn-icon:hover { background: #2a2a2a; border-color: #4a4a4a; }

/* Tag list for IPs */
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: #252525;
  border-radius: 6px;
  font: 500 0.8rem ui-monospace, monospace;
  color: var(--text);
}

.tag__remove {
  display: flex;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
}

.tag__remove svg {
  width: 14px;
  height: 14px;
  stroke: #666;
  stroke-width: 2;
  stroke-linecap: round;
  fill: none;
}

.tag__remove:hover svg { stroke: #f87171; }

/* Settings actions row */
.set-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid #2a2a2a;
}

.set-actions--split { justify-content: space-between; }

/* Settings hint text */
.set-hint {
  margin: 0 0 16px;
  font: 400 0.85rem system-ui, sans-serif;
  color: var(--text-dim);
}

/* Registrar cards grid */
.registrar-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

@media (max-width: 900px) {
  .registrar-grid { grid-template-columns: minmax(0, 1fr); }
}

.registrar-card {
  padding: 16px;
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 10px;
}

.registrar-card__head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.registrar-card__name {
  font: 600 0.95rem system-ui, sans-serif;
  color: var(--text);
}

.registrar-card__badge {
  padding: 2px 8px;
  background: rgba(52, 211, 153, 0.15);
  border-radius: 4px;
  font: 600 0.7rem system-ui, sans-serif;
  color: #34d399;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.registrar-card__head .btn-sm { margin-left: auto; }

.registrar-card .set-field { padding-top: 8px; }

.registrar-card .set-field:first-of-type { padding-top: 0; }

/* Transfer cards grid */
.transfer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

@media (max-width: 900px) {
  .transfer-grid { grid-template-columns: minmax(0, 1fr); }
}

.transfer-card {
  padding: 20px;
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 10px;
}

.transfer-card__title {
  margin: 0 0 8px;
  font: 600 0.95rem system-ui, sans-serif;
  color: var(--text);
}

.transfer-card__desc {
  margin: 0 0 14px;
  font: 400 0.85rem system-ui, sans-serif;
  color: var(--text-dim);
}

.transfer-card .set-field { margin-top: 12px; }

.transfer-card .set-field:first-of-type { margin-top: 0; }

.transfer-card > .btn-accept,
.transfer-card > .btn-deny {
  width: 100%;
  justify-content: center;
  margin-top: 14px;
}

.set-input-file {
  width: 100%;
  padding: 10px 12px;
  background: #1a1a1a;
  border: 1px solid #3a3a3a;
  border-radius: 8px;
  font: 500 0.85rem system-ui, sans-serif;
  color: var(--text);
  cursor: pointer;
}

.set-input-file::file-selector-button {
  padding: 6px 12px;
  margin-right: 12px;
  background: #2a2a2a;
  border: none;
  border-radius: 6px;
  font: 500 0.8rem system-ui, sans-serif;
  color: var(--text);
  cursor: pointer;
}

.set-input-file::file-selector-button:hover { background: #3a3a3a; }

/* System control buttons */
.system-btns {
  display: flex;
  gap: 12px;
  margin-top: 12px;
}

/* User Management */
.card--wide { grid-column: 1 / -1; }

.user-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.user-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  background: #141414;
  border: 1px solid #222;
  border-radius: 10px;
}

.user-row__pfp {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
}

.user-row__pfp--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #222;
}

.user-row__pfp--placeholder svg {
  width: 28px;
  height: 28px;
  stroke: #666;
  stroke-width: 2;
  fill: none;
}

.user-row__main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.user-row__header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-row__name {
  font: 600 1rem system-ui, sans-serif;
  color: var(--text);
}

.user-row__handle {
  font: 400 0.9rem system-ui, sans-serif;
  color: var(--text-muted);
}

.user-row__info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-row__role {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font: 600 0.8rem system-ui, sans-serif;
}

.user-row__role svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.user-row__role--superadmin { color: #34d399; }
.user-row__role--admin { color: #3b82f6; }
.user-row__role--manager { color: #e5e5e5; }
.user-row__role--viewer { color: #a3a3a3; }

.user-row__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.user-row__dot { color: var(--text-dim); }

.user-row__created {
  font: 400 0.8rem system-ui, sans-serif;
  color: var(--text-dim);
}

.user-row__uid {
  font: 400 0.75rem ui-monospace, monospace;
  color: var(--text-dim);
}

.user-row__actions {
  flex-shrink: 0;
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

@media (max-width: 700px) {
  .user-row { flex-wrap: wrap; }
  .user-row__actions { width: 100%; margin-top: 8px; }
}

/* User modal */
.modal--medium {
  width: min(920px, calc(100vw - 32px)) !important;
  max-width: 920px !important;
  max-height: calc(100vh - 64px);
}

.user-form__perms-scroll {
  max-height: 280px;
  overflow-y: auto;
  padding-right: 8px;
}

.user-form {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.user-form__fields {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.set-field__req { color: #f87171; }

.role-select {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.role-option {
  display: flex;
  align-items: center;
  cursor: pointer;
}

.role-option input { display: none; }

.role-option__label {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 14px;
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  font: 500 0.85rem system-ui, sans-serif;
  transition: border-color 0.15s, background 0.15s;
}

.role-option__label svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.role-option input:checked + .role-option__label--superadmin { background: rgba(52, 211, 153, 0.15); border-color: #34d399; color: #34d399; }
.role-option input:checked + .role-option__label--admin { background: rgba(59, 130, 246, 0.15); border-color: #3b82f6; color: #3b82f6; }
.role-option input:checked + .role-option__label--manager { background: rgba(255, 255, 255, 0.08); border-color: #e5e5e5; color: #e5e5e5; }
.role-option input:checked + .role-option__label--viewer { background: rgba(255, 255, 255, 0.08); border-color: #a3a3a3; color: #a3a3a3; }

.role-option__label:hover { border-color: #444; }

.rank-select {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.rank-option {
  display: flex;
  align-items: center;
  cursor: pointer;
}

.rank-option input { display: none; }

.rank-option__label {
  font: 500 0.9rem system-ui, sans-serif;
  color: var(--text-dim);
  transition: color 0.15s;
}

.rank-option input:checked + .rank-option__label {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.rank-option input[value="none"]:checked + .rank-option__label {
  color: #fff;
}

.rank-option input[value="boss"]:checked + .rank-option__label {
  background: linear-gradient(90deg, #14b8a6, #06b6d4);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.rank-option input[value="worker"]:checked + .rank-option__label {
  background: linear-gradient(90deg, #38bdf8, #7dd3fc);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.rank-option input[value="caller"]:checked + .rank-option__label {
  background: linear-gradient(90deg, #22c55e, #4ade80);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.rank-option__label:hover { color: var(--text-muted); }

.perm-note {
  margin: 8px 0 0;
  padding: 10px 12px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-left: 3px solid #ef4444;
  border-radius: 4px;
  font: 400 0.85rem system-ui, sans-serif;
  color: #fca5a5;
}

/* Delete user modal */
.modal--small { width: min(420px, calc(100vw - 32px)); }

.delete-user-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 0;
}

.delete-user-pfp {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 6px;
}

.delete-user-name {
  font: 600 1.1rem system-ui, sans-serif;
  color: var(--text);
}

.delete-user-handle {
  font: 400 0.9rem system-ui, sans-serif;
  color: var(--text-muted);
}

.delete-user-warning {
  margin: 0;
  padding: 14px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 8px;
  font: 400 0.9rem system-ui, sans-serif;
  color: #fca5a5;
  line-height: 1.5;
  text-align: center;
}

/* TOTP Modal */
.modal--totp {
  width: min(420px, calc(100vw - 32px));
}

.modal--totp .modal__title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal--totp .modal__title svg {
  width: 20px;
  height: 20px;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.totp-body {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.totp-steps {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.totp-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.totp-step__num {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: var(--accent);
  border-radius: 50%;
  font: 700 0.75rem system-ui, sans-serif;
  color: #000;
}

.totp-step__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.totp-step__title {
  font: 600 0.9rem system-ui, sans-serif;
  color: var(--text);
}

.totp-step__desc {
  font: 400 0.8rem system-ui, sans-serif;
  color: var(--text-muted);
}

.totp-qr {
  display: flex;
  justify-content: center;
  padding: 16px;
  background: #fff;
  border-radius: 10px;
}

.totp-qr__img {
  width: 160px;
  height: 160px;
  background: #eee;
}

.totp-manual {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.totp-manual__label {
  font: 500 0.8rem system-ui, sans-serif;
  color: var(--text-dim);
}

.totp-manual__code {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
}

.totp-manual__code code {
  font: 600 0.9rem ui-monospace, monospace;
  color: var(--accent);
  letter-spacing: 1px;
}

.totp-manual__copy {
  display: flex;
  padding: 4px;
  background: none;
  border: none;
  cursor: pointer;
}

.totp-manual__copy svg {
  width: 16px;
  height: 16px;
  stroke: var(--text-muted);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  transition: stroke 150ms ease;
}

.totp-manual__copy:hover svg {
  stroke: var(--text);
}

.totp-verify {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-top: 16px;
  border-top: 1px solid #2a2a2a;
}

.totp-code {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.totp-code__input {
  width: 44px;
  height: 52px;
  padding: 0;
  background: #1a1a1a;
  border: 2px solid #2a2a2a;
  border-radius: 10px;
  font: 700 1.5rem ui-monospace, monospace;
  color: var(--text);
  text-align: center;
  caret-color: var(--accent);
  transition: border-color 150ms ease;
}

.totp-code__input:focus {
  outline: none;
  border-color: var(--accent);
}

.totp-code__input::placeholder {
  color: #3a3a3a;
}

.totp-code__sep {
  width: 12px;
  height: 3px;
  background: #3a3a3a;
  border-radius: 2px;
}

.totp-error {
  margin: 0;
  padding: 10px 12px;
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.3);
  border-radius: 8px;
  font: 500 0.85rem system-ui, sans-serif;
  color: #f87171;
  text-align: center;
}

.totp-error[hidden] { display: none; }

/* Health Modal */
.modal--large {
  width: min(1000px, calc(100vw - 32px)) !important;
  max-width: 1000px !important;
  max-height: calc(100vh - 64px);
}

.modal__head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.health-body {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.health-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

@media (max-width: 900px) {
  .health-grid { grid-template-columns: repeat(2, 1fr); }
}

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

.health-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: transparent;
  border: 1px solid #252525;
  border-radius: 8px;
}

.health-card__icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
}

.health-card__icon svg {
  width: 20px;
  height: 20px;
  stroke: var(--text-muted);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.health-card__icon--good svg {
  stroke: #34d399;
}

.health-card__icon--warn svg {
  stroke: #fbbf24;
}

.health-card__icon--bad svg {
  stroke: #f87171;
}

.health-card__icon--accent svg {
  stroke: var(--accent);
}

.health-card__content {
  flex: 1;
  min-width: 0;
}

.health-card__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.health-card__title {
  font: 600 0.8rem system-ui, sans-serif;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.health-card__value {
  font: 700 1.1rem system-ui, sans-serif;
  color: var(--text);
}

.health-card__value--good { color: #34d399; }
.health-card__value--warn { color: #fbbf24; }
.health-card__value--bad { color: #f87171; }
.health-card__value--accent { color: var(--accent); }

.health-bar {
  height: 4px;
  background: #1f1f1f;
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 6px;
}

.health-bar__fill {
  height: 100%;
  background: #34d399;
  border-radius: 2px;
  transition: width 0.3s;
}

.health-card__sub {
  font: 400 0.75rem system-ui, sans-serif;
  color: var(--text-dim);
}

.health-card__path {
  font: 400 0.75rem ui-monospace, monospace;
  color: var(--text-dim);
  word-break: break-all;
}

.health-card__stats {
  display: flex;
  gap: 12px;
  font: 400 0.8rem system-ui, sans-serif;
  color: var(--text-dim);
}

.health-card__stats strong {
  color: var(--text-muted);
  font-weight: 500;
  margin-right: 3px;
}

.health-section {
  margin-bottom: 16px;
}

.health-section:last-child {
  margin-bottom: 0;
}

.health-section__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.health-section__title {
  margin: 0 0 12px;
  font: 600 0.95rem system-ui, sans-serif;
  color: var(--text);
}

.health-section__head .health-section__title { margin: 0; }

.health-table-wrap {
  overflow-x: auto;
}

.health-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.health-table th,
.health-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid #222;
}

.health-table th {
  font-weight: 500;
  color: var(--text-muted);
  background: #141414;
}

.health-table td {
  color: var(--text);
}

.health-mono {
  font-family: ui-monospace, monospace;
  color: var(--text-muted);
}

.health-status {
  display: inline-block;
  padding: 2px 8px;
  font: 600 0.7rem system-ui, sans-serif;
  text-transform: uppercase;
  border-radius: 4px;
}

.health-status--active {
  background: rgba(52, 211, 153, 0.15);
  color: #34d399;
}

.health-note {
  font: 400 0.75rem system-ui, sans-serif;
  color: var(--text-dim);
  margin-left: 4px;
}

.health-type {
  font: 500 0.8rem system-ui, sans-serif;
}

.health-type--fail { color: #f87171; }
.health-type--success { color: #34d399; }
.health-type--warn { color: #fbbf24; }

.btn-xs {
  height: 28px;
  padding: 0 10px;
  font-size: 0.75rem;
}

@media (max-width: 800px) {
  .health-grid { grid-template-columns: repeat(2, 1fr); }
}

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

.perm-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.perm-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: #141414;
  border: 1px solid #222;
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 0.15s;
}

.perm-item:hover { border-color: #333; }

.perm-item input {
  flex-shrink: 0;
  margin-top: 2px;
  accent-color: var(--accent);
}

.perm-item__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.perm-item__name {
  font: 500 0.85rem system-ui, sans-serif;
  color: var(--text);
}

.perm-item__code {
  font: 400 0.75rem ui-monospace, monospace;
  color: var(--text-dim);
}

@media (max-width: 640px) {
  .perm-grid { grid-template-columns: 1fr; }
  .role-select { flex-direction: column; }
  .role-option__label { width: 100%; text-align: center; }
}

.inbox__empty {
  margin: 0;
  padding: 2px;
  font: 500 0.85rem system-ui, sans-serif;
  color: #737373;
}

/* Mail list: shows ~4 at a time, scrolls for more */
.mail-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 296px;
  margin: 0;
  padding: 0 4px 0 0;
  list-style: none;
  overflow-y: auto;
}

.mail {
  padding: 10px 12px;
  background: #1a1a1a;
  border: 1px solid #232323;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 150ms ease;
}

.mail:hover { background: #1f1f1f; }

.mail__top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.mail__from { font: 600 0.85rem system-ui, sans-serif; color: var(--text); }

.mail__time {
  flex-shrink: 0;
  font: 500 0.75rem system-ui, sans-serif;
  color: #737373;
}

.mail__line {
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 0.82rem system-ui, sans-serif;
}

.mail__subject { color: #d4d4d4; font-weight: 600; }

.mail__preview { color: #737373; }

/* Mail reader */
.mail-view {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mail-view__back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  padding: 0;
  font: 500 0.82rem system-ui, sans-serif;
  color: #a3a3a3;
  background: none;
  border: 0;
  cursor: pointer;
}

.mail-view__back:hover { color: var(--text); }

.mail-view__back svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mail-view__subject { font: 600 1.05rem system-ui, sans-serif; color: var(--text); }

.mail-view__meta {
  margin-top: 3px;
  font: 500 0.8rem system-ui, sans-serif;
  color: #737373;
}

.mail-view__from { color: #d4d4d4; font-weight: 600; }

.mail-view__addr { font-family: ui-monospace, Consolas, monospace; }

.mail-frame {
  width: 100%;
  height: 320px;
  background: #fff;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
}

.mail-text {
  max-height: 320px;
  overflow-y: auto;
  padding: 14px 16px;
  white-space: pre-wrap;
  word-break: break-word;
  font: 0.85rem/1.65 system-ui, sans-serif;
  color: #d4d4d4;
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
}

.lb {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px;
  padding: 20px;
}

.lb__left {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.lb__right {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lb__qr {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 10px;
  /* White, not the panel's dark tile: a QR needs a light quiet zone to scan.
     On a black background it reads as inverted and many scanners fail. */
  background: #fff;
  border: 1px solid #2a2a2a;
  border-radius: 10px;
  overflow: hidden;
  flex: 0 0 auto;
  width: 140px;
  max-width: 100%;
  margin: 0 auto;
}
.lb__qr img, .lb__qr canvas {
  display: block;
  width: 120px;
  height: 120px;
  border-radius: 4px;
}
.lb__qr .lb__qr-placeholder { padding: 10px 4px; text-align: center; color: #666; }
.lb__qr .lb__qr-placeholder svg { width: 30px; height: 30px; }

.lb__qr-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: #555;
}

.lb__qr-placeholder svg {
  width: 46px;
  height: 46px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.lb__qr-placeholder span { font: 500 0.85rem system-ui, sans-serif; }

.lb__qr canvas,
.lb__qr img {
  display: block;
  border-radius: 6px;
}

.lb__gen {
  width: 100%;
  height: 40px;
  justify-content: center;
}

.lb__url {
  padding: 12px 14px;
  background: #121212;
  border: 1px solid #2a2a2a;
  border-radius: 10px;
}

.lb__url-label {
  display: block;
  margin-bottom: 4px;
  font: 600 0.7rem system-ui, sans-serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #737373;
}

.lb__url-value {
  font: 500 0.85rem ui-monospace, "Cascadia Mono", Consolas, monospace;
  color: var(--red-hover);
  word-break: break-all;
}

.lb__actions {
  display: flex;
  gap: 10px;
}

.lb__actions .btn-accept {
  flex: 1;
  height: 40px;
  justify-content: center;
}

.lb__actions .btn-deny { height: 40px; }

@media (max-width: 640px) {
  .lb { grid-template-columns: minmax(0, 1fr); gap: 16px; }
}

/* Note box (e.g. Service Management tips below the service list) */
.note-box {
  margin-top: 16px;
  padding: 16px 18px;
  background: #141414;
  border: 1px solid #2a2a2a;
  border-radius: 12px;
}

.note-box__title {
  margin: 0 0 10px;
  font: 600 0.9rem system-ui, sans-serif;
  color: var(--text);
}

.note-box__list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.note-box__list li {
  position: relative;
  padding-left: 18px;
  font: 400 0.85rem system-ui, sans-serif;
  line-height: 1.5;
  color: #a3a3a3;
}

.note-box__list li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.62em;
  width: 5px;
  height: 5px;
  background: var(--red-hover);
  border-radius: 50%;
}

.note-box code {
  padding: 1px 5px;
  font: 500 0.82em ui-monospace, "Cascadia Mono", Consolas, monospace;
  color: var(--red-hover);
  background: #1f1f1f;
  border-radius: 4px;
}

/* ---------- Toast ---------- */
.toast-container {
  position: fixed;
  left: 50%;
  bottom: calc(var(--dock-h) + 32px);
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(440px, calc(100vw - 32px));
  padding: 12px 16px;
  font: 500 0.875rem system-ui, sans-serif;
  color: var(--text);
  background: #1f1f1f;
  border: 1px solid #2a2a2a;
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 200ms ease, transform 200ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast svg {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.toast--error { border-color: rgba(248, 113, 113, 0.4); }
.toast--error svg { stroke: var(--error); }
.toast--success svg { stroke: #34d399; }

@media (prefers-reduced-motion: reduce) {
  .toast { transition: opacity 200ms ease; transform: none; }
}

.btn-accept {
  background: var(--accent);
  color: #000;
  border: 1px solid var(--accent);
}

.btn-accept:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-deny {
  background: transparent;
  color: #d4d4d4;
  border: 1px solid #2a2a2a;
}

.btn-deny:hover { color: var(--text); border-color: #4a4a4a; background: #1f1f1f; }

/* Active session boxes: 3 per row */
.session-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Below ~1280px the sidebar leaves too little room for 3 boxes to fit their details */
@media (max-width: 1280px) {
  .session-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.session {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
  background: #1a1a1a;
  border-radius: 12px;
}

.session svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.session__head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.session__id {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.session__id .conn__ip { overflow: hidden; text-overflow: ellipsis; }

.session__status {
  font: 600 0.68rem system-ui, sans-serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #34d399;
}

/* Type badge: tells a reverse-proxy session apart from a normal browser one */
.session__type {
  margin-left: auto;
  align-self: flex-start;
  padding: 3px 8px;
  font: 600 0.6rem system-ui, sans-serif;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
  color: #a3a3a3;
  background: #232323;
  border: 1px solid #2f2f2f;
  border-radius: 999px;
}

.session__type--proxy {
  color: var(--red-hover);
  background: rgba(52, 211, 153, 0.12);
  border-color: rgba(52, 211, 153, 0.3);
}

.session__meta .conn__line--meta + .conn__line--meta { margin-top: 6px; }

.session__stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0;
  padding-top: 14px;
  border-top: 1px solid #2a2a2a;
}

.session__stats dt {
  font: 500 0.72rem system-ui, sans-serif;
  color: #737373;
}

.session__stats dd {
  margin: 2px 0 0;
  font: 600 0.95rem system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.session__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: auto;
}

.session__actions button {
  justify-content: center;
  height: 34px;
  padding: 0 10px;
  font-size: 0.82rem;
}

/* An odd last button (e.g. proxy sessions with Navigate removed) spans the row */
.session__actions:has(> :last-child:nth-child(3)) > :last-child { grid-column: 1 / -1; }

/* Offline sessions: greyed avatar and status */
.session--inactive .conn__avatar {
  color: #737373;
  background: #232323;
}

.session--inactive .session__status { color: #737373; }

/* Info stays compact so "Forget Entry" fits on one line */
.session--inactive .session__actions { grid-template-columns: auto 1fr; }

/* Account cards reuse the session card shell */
.account__email {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 600 0.95rem system-ui, sans-serif;
  color: var(--text);
}

.account__pw {
  letter-spacing: 1px;
  color: #a3a3a3;
}

/* Live = accent (default status colour), Dead = error */
.account--dead .session__status { color: var(--error); }

.card__title .count--muted {
  background: #2a2a2a;
  color: #d4d4d4;
}

.btn-danger:hover {
  color: var(--error);
  border-color: var(--error);
  background: rgba(248, 113, 113, 0.08);
}

/* ---------- Popup (modal) ---------- */
.modal {
  width: min(440px, calc(100vw - 32px));
  padding: 0;
  color: var(--text);
  background: #141414;
  border: 1px solid #2a2a2a;
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(2px);
}

/* The open state must be visible on its own. Relying on the animation to end
   at opacity:1 left the dialog invisible whenever animations were paused,
   disabled, or overridden (reduced-motion, some headless browsers). */
.modal[open] { opacity: 1; animation: modal-in 200ms cubic-bezier(0.2, 0.8, 0.2, 1); }

.modal[open]::backdrop { animation: backdrop-in 200ms ease; }

/* Animate transform only. Animating opacity means the dialog is invisible
   whenever the animation does not run to completion (paused tab, reduced
   motion, a stalled compositor), which made popups silently unopenable. */
@keyframes modal-in {
  from { transform: translateY(8px) scale(0.98); }
  to   { transform: translateY(0) scale(1); }
}

@keyframes backdrop-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .modal[open],
  .modal[open]::backdrop { animation: none; }
}

/* page behind doesn't scroll while a popup is open */
html:has(.modal[open]) { overflow: hidden; }

.modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 14px 14px 20px;
  border-bottom: 1px solid #2a2a2a;
}

.modal__title {
  margin: 0;
  font: 600 1rem system-ui, sans-serif;
}

/* Large popup: details on the top half, bottom half reserved */
.modal--large {
  width: min(880px, calc(100vw - 32px));
  height: min(640px, calc(100vh - 48px));
}

.modal--large[open] {
  display: flex;
  flex-direction: column;
}

.modal__body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
  overflow-y: auto;
}

.modal__top {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal__bottom {
  flex: 1;
  min-height: 160px;
  padding: 14px 16px;
  border: 1px dashed #2a2a2a;
  border-radius: 12px;
}

.modal__label {
  margin: 0;
  font: 600 0.9rem system-ui, sans-serif;
  color: var(--text);
}

.saved-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.btn-sm {
  height: 30px;
  padding: 0 10px;
  font-size: 0.8rem;
}

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

/* Saved Info: one row per saved field (label left, value right) */
.saved-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0 0;
}

.saved-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 12px;
  background: #1a1a1a;
  border-radius: 8px;
}

.saved-row dt {
  flex-shrink: 0;
  font: 500 0.82rem system-ui, sans-serif;
  color: #a3a3a3;
}

.saved-row dd {
  margin: 0;
  min-width: 0;
  font: 500 0.85rem ui-monospace, "Cascadia Mono", Consolas, monospace;
  color: var(--text);
  overflow-wrap: anywhere;
  text-align: right;
}

.sd-summary {
  display: flex;
  align-items: center;
  gap: 14px;
}

.sd-summary .conn__avatar {
  width: 48px;
  height: 48px;
  border-radius: 12px;
}

.sd-summary .conn__avatar svg { width: 22px; height: 22px; }

.sd-summary .conn__ip { font-size: 1.25rem; }

.modal svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sd-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.sd-tile {
  padding: 12px 14px;
  background: #1a1a1a;
  border-radius: 10px;
}

.sd-tile dt {
  font: 500 0.75rem system-ui, sans-serif;
  color: #737373;
}

.sd-tile dd {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0 0;
  font: 600 0.92rem system-ui, sans-serif;
  color: var(--text);
}

.sd-tile .conn__tag { font-size: 0.85rem; }

.sd-tile .conn__client { display: inline-flex; gap: 6px; }

/* User agent takes the rest of its row */
.sd-tile--wide { grid-column: span 3; }

.sd-ua {
  font: 500 0.8rem/1.5 ui-monospace, "Cascadia Mono", Consolas, monospace;
  color: #d4d4d4;
  overflow-wrap: anywhere; /* wrap at spaces, only split a word if it has to */
}

.sd-tile .conn__client svg { width: 16px; height: 16px; }

.sd-tile .conn__client svg.is-fill { fill: currentColor; stroke: none; }

.modal.is-inactive .conn__avatar {
  color: #737373;
  background: #232323;
}

.modal.is-inactive .session__status { color: #737373; }

/* ---------- Live View popup ---------- */
.modal--live {
  width: min(960px, calc(100vw - 32px));
  height: min(680px, calc(100vh - 48px));
}

.modal--live[open] {
  display: flex;
  flex-direction: column;
  overflow: hidden; /* let the inner wrapper own the rounded corners */
}

/* The wrapper holds all live-view content; it's what goes fullscreen */
.live-inner {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

/* Fullscreen: the wrapper fills the whole screen with the same dark surface */
.live-inner:fullscreen {
  background: #141414;
}

.live-tools {
  display: flex;
  gap: 8px;
}

.live-tools .icon-btn {
  width: 36px;
  height: 36px;
}

.live-sub {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  border-bottom: 1px solid #2a2a2a;
}

.live-sub .conn__ip { font-size: 0.9rem; }

.live-sep { color: #3a3a3a; }

.live-page {
  font: 500 0.9rem ui-monospace, "Cascadia Mono", Consolas, monospace;
  color: #a3a3a3;
}

/* The frame area that will hold the live screen */
.live-frame {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding: 20px;
  background:
    linear-gradient(#0d0d0d 0 0) padding-box,
    repeating-linear-gradient(45deg, #121212 0 12px, #0d0d0d 12px 24px);
}

.live-frame__inner {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 240px;
  background: #0a0a0a;
  border: 1px solid #1f1f1f;
  border-radius: 10px;
  transform: scale(var(--live-zoom, 1));
  transition: transform 150ms ease;
}

.live-placeholder {
  font: 500 1rem system-ui, sans-serif;
  color: #555;
  letter-spacing: 0.02em;
}

/* ---------- Navigate popup ---------- */
/* same footprint as the Live popup, but no preview frame inside */
.modal--nav {
  width: min(960px, calc(100vw - 32px));
  height: min(680px, calc(100vh - 48px));
}

.modal--nav[open] {
  display: flex;
  flex-direction: column;
}

.nav-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 20px;
  overflow-y: auto;
}

/* Top area: pickers on the left, preview on the right */
.nav-main {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 16px;
}

.nav-controls {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.nav-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-field[hidden] { display: none; }

.nav-field__label {
  font: 600 0.75rem system-ui, sans-serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #a3a3a3;
}

/* Custom-styled select (native chevron hidden, our own chevron on the right) */
.nav-select { position: relative; }

.nav-select select {
  width: 100%;
  height: 44px;
  padding: 0 40px 0 14px;
  appearance: none;
  -webkit-appearance: none;
  background: #1a1a1a;
  color: var(--text);
  font: 500 0.9rem system-ui, sans-serif;
  border: 1px solid #2a2a2a;
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 150ms ease;
}

.nav-select select:hover { border-color: #4a4a4a; }

.nav-select select:focus-visible {
  outline: none;
  border-color: var(--red);
}

.nav-select select option { background: #1a1a1a; color: var(--text); }

.nav-select > svg {
  position: absolute;
  top: 50%;
  right: 14px;
  width: 16px;
  height: 16px;
  transform: translateY(-50%);
  pointer-events: none;
  fill: none;
  stroke: #a3a3a3;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Right-side page preview (empty for now) */
.nav-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 240px;
  background:
    linear-gradient(#0d0d0d 0 0) padding-box,
    repeating-linear-gradient(45deg, #121212 0 12px, #0d0d0d 12px 24px);
  border: 1px solid #1f1f1f;
  border-radius: 12px;
}

.nav-preview__placeholder {
  font: 500 1rem system-ui, sans-serif;
  color: #555;
  letter-spacing: 0.02em;
}

/* External redirect row, pinned at the bottom */
.nav-redirect {
  padding-top: 20px;
  border-top: 1px solid #2a2a2a;
}

.nav-redirect > .modal__label { display: block; margin-bottom: 12px; }

.nav-redirect__row {
  display: flex;
  gap: 10px;
}

.nav-input {
  flex: 1;
  min-width: 0;
  height: 44px;
  padding: 0 14px;
  background: #1a1a1a;
  color: var(--text);
  font: 500 0.9rem system-ui, sans-serif;
  border: 1px solid #2a2a2a;
  border-radius: 10px;
  transition: border-color 150ms ease;
}

.nav-input::placeholder { color: #737373; }

.nav-input:focus-visible {
  outline: none;
  border-color: var(--red);
}

.nav-redirect__row .btn-accept {
  flex-shrink: 0;
  height: 44px;
  padding: 0 20px;
}

/* Narrow screens: stack the pickers above the preview */
@media (max-width: 640px) {
  .nav-main { grid-template-columns: minmax(0, 1fr); }

  .nav-redirect__row { flex-direction: column; }

  .nav-redirect__row .btn-accept { justify-content: center; }
}

/* ---------- Service Settings popup ---------- */
.modal--settings {
  width: min(520px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
}

.modal--settings[open] {
  display: flex;
  flex-direction: column;
}

.settings-group {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* display:flex above would otherwise beat the [hidden] attribute */
.settings-group[hidden],
.settings-note[hidden] { display: none; }

.settings-group + .settings-group {
  padding-top: 16px;
  border-top: 1px solid #2a2a2a;
}

.settings-group__title {
  margin: 0;
  font: 600 0.95rem system-ui, sans-serif;
  color: var(--text);
}

.settings-group__desc {
  margin: -8px 0 0;
  font: 400 0.82rem system-ui, sans-serif;
  color: #a3a3a3;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field__label {
  font: 600 0.82rem system-ui, sans-serif;
  color: var(--text);
}

.field__hint {
  margin-top: -2px;
  font: 400 0.78rem system-ui, sans-serif;
  color: #737373;
}

.field__input {
  height: 40px;
  padding: 0 14px;
  background: #1a1a1a;
  color: var(--text);
  font: 500 0.9rem system-ui, sans-serif;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  transition: border-color 150ms ease;
}

.field__input::placeholder { color: #737373; }

.field__input:focus-visible { outline: none; border-color: var(--red); }

.field__file {
  display: flex;
  align-items: center;
  gap: 12px;
}

.file-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 14px;
  font: 600 0.85rem system-ui, sans-serif;
  color: #d4d4d4;
  background: transparent;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 150ms ease, color 150ms ease, background-color 150ms ease;
}

.file-btn:hover { color: var(--text); border-color: #4a4a4a; background: #1f1f1f; }

.file-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.file-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 400 0.82rem system-ui, sans-serif;
  color: #737373;
}

/* Info note echoing the selected flow mode */
.settings-note {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  background: rgba(52, 211, 153, 0.08);
  border: 1px solid rgba(52, 211, 153, 0.25);
  border-radius: 10px;
}

.settings-note strong {
  font: 600 0.82rem system-ui, sans-serif;
  color: var(--red-hover);
}

.settings-note span {
  font: 400 0.8rem system-ui, sans-serif;
  color: #a3a3a3;
}

.modal__footer,
.modal__foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid #2a2a2a;
}

.modal__footer .btn-deny,
.modal__footer .btn-accept,
.modal__foot .btn-deny,
.modal__foot .btn-accept {
  height: 40px;
  padding: 0 18px;
  justify-content: center;
}

/* Sessions chart */
.chart {
  position: relative;
  height: 220px;
}

.chart svg { display: block; overflow: visible; }

.chart__grid { stroke: #232323; stroke-width: 1; }

.chart__tick {
  fill: #737373;
  font: 500 11px system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
}

.chart__line {
  fill: none;
  stroke: var(--red-hover);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.chart__dot {
  fill: var(--red-hover);
  stroke: #141414; /* ring separates the dot from the line */
  stroke-width: 2;
  transition: r 120ms ease;
}

.chart__dot.is-active { r: 6; }

.chart__cross {
  stroke: #3a3a3a;
  stroke-width: 1;
  opacity: 0;
}

.chart__cross.is-visible { opacity: 1; }

.chart__hit { fill: transparent; cursor: crosshair; }

.chart__tip {
  position: absolute;
  pointer-events: none;
  padding: 6px 10px;
  background: #1f1f1f;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  font: 400 0.8rem system-ui, sans-serif;
  color: #a3a3a3;
  white-space: nowrap;
}

.chart__tip strong { color: var(--text); font-weight: 600; }

.chart__tip-date {
  display: block;
  font-size: 0.72rem;
  color: #737373;
}

/* Top services */
.toplist {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.toplist__row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
  font: 500 0.85rem system-ui, sans-serif;
}

.toplist__name { color: #d4d4d4; }

.toplist__value {
  color: var(--text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.toplist__track {
  height: 8px;
  background: #1f1f1f;
  border-radius: 4px;
  overflow: hidden;
}

.toplist__bar {
  height: 100%;
  background: var(--red-hover);
  border-radius: 4px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Phone-only pieces stay hidden on desktop */
.dock__label,
.dock__more,
.drawer { display: none; }

/* ---------- Phones only (desktop is unaffected) ---------- */
@media (max-width: 640px) {
  :root {
    --topbar-h: 56px;
    --dock-h: 52px;
  }

  /* Top bar: smaller logo/buttons, user card shows just the picture */
  .topbar__inner { padding: 0 12px; }

  .brand { gap: 8px; }

  .brand__logo { width: 30px; height: 30px; }

  .brand__name { font-size: 1.1rem; }

  .topbar__right { gap: 6px; }

  .icon-btn { width: 36px; height: 36px; }

  .user {
    height: 36px;
    padding: 0 3px;
  }

  .user__pfp { width: 28px; height: 28px; }

  .user__info { display: none; }

  /* Dropdowns: full width under the bar instead of hanging off the bell */
  .dropdown { position: static; }

  .dropdown__panel {
    top: calc(100% + 8px);
    left: 12px;
    right: 12px;
    width: auto;
    max-width: none;
  }

  /* Dock: just the current tab + a "more" button that opens the drawer */
  .dock {
    bottom: calc(12px + env(safe-area-inset-bottom));
    min-width: 0;
    gap: 4px;
    padding: 0 4px;
    height: var(--dock-h);
    border-radius: 14px;
  }

  .dock__item:not(.is-active),
  .dock__sep { display: none; }

  .dock__item.is-active {
    width: auto;
    gap: 8px;
    padding: 0 14px 0 12px;
  }

  .dock__item svg { width: 20px; height: 20px; }

  .dock__item::after { display: none; }

  .dock__label {
    display: inline;
    font: 600 0.9rem system-ui, sans-serif;
  }

  .dock__more {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    background: transparent;
    color: #a3a3a3;
    border: 0;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 150ms ease, color 150ms ease;
  }

  .dock__more svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
    stroke: currentColor;
    stroke-width: 2;
  }

  .dock__more:hover,
  .dock__more[aria-expanded="true"] {
    color: var(--text);
    background: #1f1f1f;
  }

  /* Drawer */
  .drawer {
    display: block;
    position: fixed;
    inset: 0;
    z-index: var(--z-drawer);
    visibility: hidden;
    transition: visibility 0s 250ms;
  }

  .drawer.is-open {
    visibility: visible;
    transition: none;
  }

  .drawer__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    opacity: 0;
    transition: opacity 250ms ease;
  }

  .drawer.is-open .drawer__backdrop { opacity: 1; }

  .drawer__panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(300px, 82vw);
    display: flex;
    flex-direction: column;
    padding-bottom: env(safe-area-inset-bottom);
    background: #141414;
    border-left: 1px solid #2a2a2a;
    transform: translateX(100%);
    transition: transform 250ms cubic-bezier(0.2, 0.8, 0.2, 1);
  }

  .drawer.is-open .drawer__panel { transform: translateX(0); }

  .drawer__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--topbar-h);
    padding: 0 12px 0 16px;
    border-bottom: 1px solid #2a2a2a;
  }

  .drawer__title {
    font: 600 1rem system-ui, sans-serif;
    color: var(--text);
  }

  .drawer__nav {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
  }

  .drawer__item {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 48px;
    padding: 0 12px;
    color: #d4d4d4;
    font: 500 0.95rem system-ui, sans-serif;
    text-decoration: none;
    border-radius: 10px;
    transition: background-color 150ms ease, color 150ms ease;
  }

  .drawer__item svg {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .drawer__item:hover { background: #1f1f1f; color: var(--text); }

  .drawer__item.is-active {
    color: var(--red-hover);
    background: rgba(52, 211, 153, 0.1);
  }

  .drawer__divider {
    height: 1px;
    margin: 8px 4px;
    border: 0;
    background: #2a2a2a;
  }

  /* Panel: sidebar becomes a sideways-scrolling row under the top bar */
  .panel {
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
  }

  .panel__sidebar {
    z-index: 10;
    height: auto;
    padding: 8px 12px;
    border-right: 0;
    border-bottom: 1px solid #2a2a2a;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .panel__sidebar::-webkit-scrollbar { display: none; }

  .panel__heading { display: none; }

  .panel__nav {
    flex-direction: row;
    align-items: center;
    gap: 4px;
  }

  .panel__item {
    width: auto;
    height: 36px;
    gap: 8px;
    padding: 0 12px;
    font-size: 0.85rem;
  }

  .panel__item svg { width: 16px; height: 16px; }

  .panel__sep {
    flex-shrink: 0;
    width: 1px;
    height: 20px;
    margin: 0 4px;
  }

  .panel__content { padding: 20px 12px calc(var(--dock-h) + 32px); }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .metrics + .metrics { margin-top: 8px; }

  .metric {
    gap: 8px;
    padding: 10px;
  }

  .metric__icon { width: 30px; height: 30px; border-radius: 8px; }

  .metric__label { font-size: 0.75rem; }

  .chart { height: 180px; }

  .modal--large { height: calc(100vh - 32px); }

  .modal__body { padding: 14px; }

  .sd-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }

  .sd-tile--wide { grid-column: 1 / -1; }

  .conn { flex-wrap: wrap; align-items: flex-start; }

  .conn__actions { width: 100%; }

  .btn-accept,
  .btn-deny { flex: 1; justify-content: center; }

  .session-grid { grid-template-columns: minmax(0, 1fr); }

  /* Services header: stack the buttons under the title, each full width */
  .page-header { flex-direction: column; align-items: stretch; }

  .page-header__actions { transform: none; }

  .page-header__actions > .btn-toggle,
  .page-header__actions > .btn-deny { flex: 1; justify-content: center; }

  /* Compact service rows: name line on top, action buttons full-width below */
  .svc-row__bar { flex-wrap: wrap; }

  .svc-row__toggle { flex: 1 1 100%; padding-bottom: 6px; }

  .svc-row__route { display: none; } /* route shows in the expanded detail */

  .svc-row__chev { margin-left: auto; }

  .svc-row__actions { flex: 1 1 100%; padding-bottom: 14px; }

  .svc-row__actions > * { flex: 1; justify-content: center; }

  .svc-row__detail { padding-left: 4px; }

  /* Domains: stack the add-domain inputs and button */
  .dm-add { flex-direction: column; }

  .dm-add .btn-accept { justify-content: center; }

  .dm-row { flex-wrap: wrap; }
  .dm-row__main { flex-direction: column; align-items: flex-start; gap: 12px; }
  .dm-row__service { margin-top: 4px; }

  /* Page editor: stack editor over preview, and the meta fields */
  [data-panel-view="editor"] { height: auto; }

  .editor__main { grid-template-columns: minmax(0, 1fr); }

  .editor__left, .editor__right { height: 440px; }

  .editor__meta { flex-wrap: wrap; }

  .ed-field { flex: 1 1 100%; }

  .ed-field__btn { width: 100%; justify-content: center; }

  /* Files: stack tree above editor */
  [data-panel-view="files"] { height: auto; }

  .files { flex-direction: column; height: 560px; }

  .files__tree { width: auto; height: 180px; border-right: 0; border-bottom: 1px solid #2a2a2a; }

  .metric__icon svg { width: 18px; height: 18px; }

  .metric__value { font-size: 1.25rem; }

  /* Page */
  .page {
    padding-left: 12px;
    padding-right: 12px;
  }

  .welcome {
    margin: 24px 0 16px;
    font-size: 1.35rem;
    overflow-wrap: anywhere;
  }

  .card { padding: 14px; }

  .stats { gap: 8px; }

  .stat { padding: 12px; }
}

/* Very narrow phones: logo only, no wordmark */
@media (max-width: 359px) {
  .brand__name { display: none; }
}

/* ---------- Admin Activity List ---------- */
.activity-list {
  display: flex;
  flex-direction: column;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid #1f1f1f;
}

.activity-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.activity-item:first-child {
  padding-top: 0;
}

.activity-item__icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #1f1f1f;
}

.activity-item__icon svg {
  width: 18px;
  height: 18px;
  stroke: var(--text-muted);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.activity-item__icon--user { background: rgba(59, 130, 246, 0.15); }
.activity-item__icon--user svg { stroke: #3b82f6; }

.activity-item__icon--payment { background: rgba(52, 211, 153, 0.15); }
.activity-item__icon--payment svg { stroke: #34d399; }

.activity-item__icon--instance { background: rgba(251, 191, 36, 0.15); }
.activity-item__icon--instance svg { stroke: #fbbf24; }

.activity-item__text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.activity-item__title {
  font: 600 0.9rem system-ui, sans-serif;
  color: var(--text);
}

.activity-item__desc {
  font: 400 0.8rem system-ui, sans-serif;
  color: var(--text-muted);
}

.activity-item__time {
  flex-shrink: 0;
  font: 400 0.75rem system-ui, sans-serif;
  color: var(--text-dim);
}

/* ---------- Admin Tables ---------- */
.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.table-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
}

.table-search svg {
  width: 16px;
  height: 16px;
  stroke: var(--text-muted);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  flex-shrink: 0;
}

.table-search__input {
  background: none;
  border: none;
  color: var(--text);
  font: 400 0.875rem system-ui, sans-serif;
  width: 180px;
  outline: none;
}

.table-search__input::placeholder { color: var(--text-dim); }

.table-wrap {
  overflow-x: auto;
  margin: 0 -20px;
  padding: 0 20px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.table th,
.table td {
  text-align: left;
  padding: 12px 16px;
  white-space: nowrap;
}

.table th {
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.table td {
  border-bottom: 1px solid #1f1f1f;
  color: var(--text);
}

.table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.instance-domain {
  font-family: ui-monospace, monospace;
  font-weight: 500;
  color: var(--accent);
}

.instance-owner {
  display: flex;
  align-items: center;
  gap: 8px;
}

.instance-owner__pfp {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.table-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: var(--surface);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}

.table-btn svg {
  width: 16px;
  height: 16px;
  stroke: var(--text-muted);
  stroke-width: 2;
  stroke-linecap: round;
  pointer-events: none;
  stroke-linejoin: round;
  fill: none;
}

.table-btn:hover {
  background: var(--elevated);
}

.table-btn:hover svg {
  stroke: var(--text);
}

.table-btn--warn:hover { background: rgba(251, 191, 36, 0.15); }
.table-btn--warn:hover svg { stroke: #fbbf24; }

.table-btn--danger:hover { background: rgba(248, 113, 113, 0.15); }
.table-btn--danger:hover svg { stroke: #f87171; }

.table-btn--good:hover { background: rgba(52, 211, 153, 0.15); }
.table-btn--good:hover svg { stroke: #34d399; }

/* ---------- Tags ---------- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 100px;
  font: 500 0.75rem system-ui, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.tag--good {
  background: rgba(52, 211, 153, 0.15);
  color: #34d399;
}

.tag--warn {
  background: rgba(251, 191, 36, 0.15);
  color: #fbbf24;
}

.tag--bad {
  background: rgba(248, 113, 113, 0.15);
  color: #f87171;
}

.tag--muted {
  background: rgba(156, 163, 175, 0.15);
  color: #9ca3af;
}

/* ---------- Form Components ---------- */
.input-group {
  display: flex;
  align-items: stretch;
}

.input-group .input {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  border-right: none;
}

.input-suffix {
  display: flex;
  align-items: center;
  padding: 0 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: none;
  border-radius: 0 8px 8px 0;
  color: var(--text-muted);
  font: 400 0.9rem system-ui, sans-serif;
}

.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.checkbox input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.checkbox__box {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  transition: all 0.15s;
  position: relative;
}

.checkbox__box::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 6px;
  width: 5px;
  height: 9px;
  border: solid var(--black);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  opacity: 0;
  transition: opacity 0.15s;
}

.checkbox input:checked + .checkbox__box {
  background: var(--accent);
  border-color: var(--accent);
}

.checkbox input:checked + .checkbox__box::after {
  opacity: 1;
}

.checkbox__label {
  font: 400 0.9rem system-ui, sans-serif;
  color: var(--text);
}

/* ---------- VPS Health Cards ---------- */
.vps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.vps-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}

.vps-card--offline {
  opacity: 0.6;
}

.vps-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.vps-card__name {
  font: 600 1rem system-ui, sans-serif;
  color: var(--text);
  font-family: ui-monospace, monospace;
}

.vps-card__stats {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.vps-stat {
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  align-items: center;
  gap: 10px;
}

.vps-stat__label {
  font: 500 0.75rem system-ui, sans-serif;
  color: var(--text-muted);
  text-transform: uppercase;
}

.vps-stat__bar {
  height: 6px;
  background: #1f1f1f;
  border-radius: 3px;
  overflow: hidden;
}

.vps-stat__fill {
  height: 100%;
  border-radius: 3px;
  background: var(--text-dim);
  transition: width 0.3s;
}

.vps-stat__fill--good { background: var(--accent); }
.vps-stat__fill--warn { background: var(--warning); }
.vps-stat__fill--bad { background: var(--error); }

.vps-stat__value {
  font: 500 0.8rem ui-monospace, monospace;
  color: var(--text);
  text-align: right;
}

.vps-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid #1f1f1f;
}

.vps-card__instances {
  font: 500 0.8rem system-ui, sans-serif;
  color: var(--text-muted);
}

.vps-card__uptime {
  font: 400 0.75rem system-ui, sans-serif;
  color: var(--text-dim);
}

/* Single VPS layout */
.vps-single {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}

.vps-single__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.vps-single__info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.vps-single__name {
  font: 600 1.1rem ui-monospace, monospace;
  color: var(--text);
}

.vps-single__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font: 400 0.85rem system-ui, sans-serif;
  color: var(--text-muted);
}

.vps-single__stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.vps-single__stat {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.vps-single__stat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.vps-single__stat-label {
  font: 500 0.8rem system-ui, sans-serif;
  color: var(--text-muted);
}

.vps-single__stat-value {
  font: 500 0.85rem ui-monospace, monospace;
  color: var(--text);
}

/* ---------- Admin Logs ---------- */
.logs-toolbar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 20px;
}

.logs-filters {
  display: flex;
  align-items: flex-start;
  gap: 24px;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filter-group__label {
  font: 500 0.7rem system-ui, sans-serif;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.filter-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-pill {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 100px;
  background: transparent;
  color: var(--text-muted);
  font: 500 0.75rem system-ui, sans-serif;
  cursor: pointer;
  transition: all 0.15s;
}

.filter-pill:hover {
  border-color: var(--text-dim);
  color: var(--text);
}

.filter-pill.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
}

.filter-pill--error:not(.is-active):hover {
  border-color: var(--error);
  color: var(--error);
}

.filter-pill--offline {
  opacity: 0.5;
}

.logs-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.logs-search {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  max-width: 320px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: border-color 0.15s;
}

.logs-search:focus-within {
  border-color: var(--accent);
}

.logs-search svg {
  width: 16px;
  height: 16px;
  stroke: var(--text-dim);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  flex-shrink: 0;
}

.logs-search__input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text);
  font: 400 0.85rem system-ui, sans-serif;
  outline: none;
}

.logs-search__input::placeholder {
  color: var(--text-dim);
}

.logs-count {
  font: 500 0.8rem system-ui, sans-serif;
  color: var(--text-muted);
  white-space: nowrap;
}

.logs-list {
  display: flex;
  flex-direction: column;
  font-family: ui-monospace, monospace;
  font-size: 0.8rem;
  background: var(--surface);
  border-radius: 8px;
  overflow: hidden;
}

.log-entry {
  display: grid;
  grid-template-columns: 70px 80px 1fr;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid #1a1a1a;
  align-items: center;
}

.log-entry:last-child { border-bottom: none; }

.log-entry:hover { background: rgba(255, 255, 255, 0.02); }

.log-entry__time { color: var(--text-dim); }

.log-entry__type {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.log-entry--info .log-entry__type { color: var(--text-muted); }
.log-entry--warn .log-entry__type { color: var(--warning); }
.log-entry--error .log-entry__type { color: var(--error); }

.log-entry__node { color: var(--accent); }

.log-entry__msg { color: var(--text); }

.logs-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.logs-pagination__info {
  font: 400 0.85rem system-ui, sans-serif;
  color: var(--text-muted);
}

.btn--sm {
  padding: 8px 14px;
  font-size: 0.8rem;
}

/* ---------- Announcements ---------- */
.announcements-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.announcement {
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}

.announcement--archived { opacity: 0.6; }

.announcement__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.announcement__date {
  font: 400 0.8rem system-ui, sans-serif;
  color: var(--text-dim);
}

.announcement__title {
  font: 600 1.1rem system-ui, sans-serif;
  color: var(--text);
  margin: 0 0 8px;
}

.announcement__body {
  font: 400 0.9rem system-ui, sans-serif;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0;
}

.announcement__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.announcement__target {
  font: 400 0.8rem system-ui, sans-serif;
  color: var(--text-dim);
}

.announcement__actions {
  display: flex;
  gap: 6px;
}

/* ---------- Activity Item Colors ---------- */
.activity-item__icon--warn { background: rgba(251, 191, 36, 0.15); }
.activity-item__icon--warn svg { stroke: #fbbf24; }

.activity-item__icon--good { background: rgba(52, 211, 153, 0.15); }
.activity-item__icon--good svg { stroke: #34d399; }

/* ---------- Div-based Modals (admin) ---------- */
div.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: auto;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

div.modal[hidden] {
  display: none;
}

div.modal .modal__backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

div.modal .modal__box {
  position: relative;
  width: min(500px, calc(100vw - 32px));
  max-height: calc(100vh - 64px);
  overflow-y: auto;
  background: #141414;
  border: 1px solid #2a2a2a;
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
  animation: modal-in 200ms ease-out;
}

div.modal .modal__box--sm {
  width: min(400px, calc(100vw - 32px));
}

div.modal .modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}

div.modal .modal__title {
  font: 600 1rem system-ui, sans-serif;
  color: var(--text);
  margin: 0;
}

div.modal .modal__body {
  padding: 20px;
}

div.modal .modal__body p {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.5;
}

div.modal .modal__foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
}

/* Transform only: see the note on the earlier modal-in definition. Animating
   opacity leaves the dialog invisible if the animation does not complete. */
@keyframes modal-in {
  from { transform: scale(0.95); }
  to   { transform: scale(1); }
}

/* Modal form elements */
div.modal .set-row {
  margin-bottom: 18px;
}

div.modal .set-row:last-child {
  margin-bottom: 0;
}

div.modal .set-label {
  display: block;
  margin-bottom: 8px;
  font: 500 0.75rem system-ui, sans-serif;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

div.modal .set-hint {
  margin: 6px 0 0;
  font: 400 0.8rem system-ui, sans-serif;
  color: var(--text-dim);
}

div.modal .input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font: 400 0.9rem system-ui, sans-serif;
  transition: border-color 0.15s;
}

div.modal .input:focus {
  outline: none;
  border-color: var(--accent);
}

div.modal .input::placeholder {
  color: var(--text-dim);
}

div.modal .input-group {
  display: flex;
}

div.modal .input-group .input {
  flex: 1;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  border-right: none;
}

div.modal .input-suffix {
  display: flex;
  align-items: center;
  padding: 0 14px;
  background: var(--elevated);
  border: 1px solid var(--border);
  border-left: none;
  border-radius: 0 8px 8px 0;
  color: var(--text-muted);
  font: 400 0.9rem system-ui, sans-serif;
}

div.modal .checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

div.modal .checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

div.modal .checkbox input {
  display: none;
}

div.modal .checkbox__box {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s;
}

div.modal .checkbox input:checked + .checkbox__box {
  background: var(--accent);
  border-color: var(--accent);
}

div.modal .checkbox__box::after {
  content: '';
  width: 10px;
  height: 10px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
  background-size: contain;
  opacity: 0;
  transition: opacity 0.15s;
}

div.modal .checkbox input:checked + .checkbox__box::after {
  opacity: 1;
}

div.modal .checkbox__label {
  font: 400 0.875rem system-ui, sans-serif;
  color: var(--text);
}

div.modal .toggle-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

div.modal .toggle {
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
}

div.modal .toggle input {
  display: none;
}

div.modal .toggle__switch {
  position: relative;
  width: 42px;
  height: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: background 0.2s, border-color 0.2s;
  flex-shrink: 0;
}

div.modal .toggle__switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: var(--text-dim);
  border-radius: 50%;
  transition: transform 0.2s, background 0.2s;
}

div.modal .toggle input:checked + .toggle__switch {
  background: var(--accent);
  border-color: var(--accent);
}

div.modal .toggle input:checked + .toggle__switch::after {
  transform: translateX(18px);
  background: #000;
}

div.modal .toggle__label {
  font: 500 0.9rem system-ui, sans-serif;
  color: var(--text);
}

/* ---------- Toast Notifications ---------- */
.toast {
  position: fixed;
  bottom: calc(var(--dock-h) + 24px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  font: 500 0.9rem system-ui, sans-serif;
  color: var(--text);
  z-index: 100;
  animation: toast-in 0.2s ease-out;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.toast--success { border-color: var(--accent); }
.toast--success .toast__icon::before { content: '✓'; color: var(--accent); }

.toast--error { border-color: var(--error); }
.toast--error .toast__icon::before { content: '✕'; color: var(--error); }

.toast--warn { border-color: var(--warning); }
.toast--warn .toast__icon::before { content: '!'; color: var(--warning); }

.toast--info { border-color: var(--text-muted); }
.toast--info .toast__icon::before { content: 'ℹ'; color: var(--text-muted); }

.toast__icon {
  font-weight: 700;
  font-size: 1rem;
}

/* Small modal variant */
.modal__box--sm {
  max-width: 400px;
}

.modal__box--sm .modal__body p {
  margin: 0;
  font: 400 0.95rem system-ui, sans-serif;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Danger button style */
.btn-danger {
  background: var(--error) !important;
  border-color: var(--error) !important;
}

.btn-danger:hover {
  background: #ef5350 !important;
}

/* ---------- Admin Panel Spacing ---------- */
[data-panel-view] .welcome {
  margin: 0 0 20px;
}

[data-panel-view] .page-header {
  margin: 0 0 20px;
}

[data-panel-view] .stats {
  margin-bottom: 24px;
}

[data-panel-view] .card + .card {
  margin-top: 20px;
}

[data-panel-view] .card {
  margin-bottom: 0;
}

/* ---------- Admin Responsive ---------- */
@media (max-width: 700px) {
  .log-entry {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .log-entry__time,
  .log-entry__type,
  .log-entry__node {
    display: inline;
  }

  .log-entry__time::after,
  .log-entry__type::after {
    content: ' · ';
  }

  .log-entry__msg {
    grid-column: 1;
    margin-top: 4px;
  }

  .logs-filters {
    gap: 16px;
  }

  .filter-group {
    width: 100%;
  }

  .logs-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .logs-search {
    max-width: none;
  }

  .logs-count {
    text-align: center;
  }

  .announcement__footer {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }

  .vps-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- Login Page ---------- */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0a0a0a;
}

.login {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  padding: 24px;
}

.login__card {
  width: 100%;
  max-width: 380px;
  padding: 32px;
  background: #111;
  border: 1px solid #1f1f1f;
  border-radius: 16px;
}

.login__header {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 32px;
}

.login__title {
  margin: 0;
  font: 600 2rem "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  letter-spacing: -0.02em;
  background: linear-gradient(90deg, #6ee7b7, #34d399);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.login__form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.login__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.login__label {
  font: 600 0.8rem system-ui, sans-serif;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.login__input {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  background: #0a0a0a;
  border: 1px solid #2a2a2a;
  border-radius: 10px;
  font: 500 0.95rem system-ui, sans-serif;
  color: var(--text);
  transition: border-color 150ms ease;
}

.login__input::placeholder {
  color: #4a4a4a;
}

.login__input:focus {
  outline: none;
  border-color: var(--accent);
}

.login__input-wrap {
  position: relative;
}

.login__input-wrap .login__input {
  padding-right: 48px;
}

.login__toggle {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
}

.login__eye {
  width: 18px;
  height: 18px;
  stroke: var(--text-dim);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.login__eye--off {
  display: none;
}

.login__toggle.is-visible .login__eye:not(.login__eye--off) {
  display: none;
}

.login__toggle.is-visible .login__eye--off {
  display: block;
}

.login__toggle:hover .login__eye {
  stroke: var(--text-muted);
}

.login__error {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.3);
  border-radius: 8px;
  font: 500 0.85rem system-ui, sans-serif;
  color: #f87171;
}

.login__error[hidden] { display: none; }

.login__error svg {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.login__submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  margin-top: 6px;
  background: var(--accent);
  border: none;
  border-radius: 10px;
  font: 600 0.95rem system-ui, sans-serif;
  color: #000;
  cursor: pointer;
  transition: background-color 150ms ease;
}

.login__submit:hover {
  background: var(--accent-hover);
}

.login__submit svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.login__footer {
  margin: 20px 0 0;
  text-align: center;
}

.login__link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: 500 0.85rem system-ui, sans-serif;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 150ms ease;
}

.login__link:hover {
  color: var(--text);
}

.login__link svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.login__copy {
  margin: 24px 0 0;
  font: 400 0.75rem system-ui, sans-serif;
  color: var(--text-dim);
}

.login__card--2fa {
  text-align: center;
}

.login__card[hidden] { display: none; }

.login__2fa-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  background: rgba(52, 211, 153, 0.1);
  border-radius: 50%;
}

.login__2fa-icon svg {
  width: 28px;
  height: 28px;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.login__title--sm {
  font-size: 1.25rem;
  background: none;
  -webkit-text-fill-color: var(--text);
  color: var(--text);
}

.login__subtitle {
  margin: 8px 0 0;
  font: 400 0.9rem system-ui, sans-serif;
  color: var(--text-muted);
}

.login__code {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.login__code-input {
  width: 48px;
  height: 56px;
  padding: 0;
  background: #0a0a0a;
  border: 2px solid #2a2a2a;
  border-radius: 10px;
  font: 700 1.5rem ui-monospace, monospace;
  color: var(--text);
  text-align: center;
  caret-color: var(--accent);
  transition: border-color 150ms ease;
}

.login__code-input:focus {
  outline: none;
  border-color: var(--accent);
}

.login__code-sep {
  width: 12px;
  height: 3px;
  background: #3a3a3a;
  border-radius: 2px;
}

.login__back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 8px;
  padding: 8px 12px;
  background: none;
  border: none;
  font: 500 0.85rem system-ui, sans-serif;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 150ms ease;
}

.login__back:hover {
  color: var(--text);
}

.login__back svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

@media (max-width: 440px) {
  .login__card {
    padding: 24px 20px;
    border-radius: 12px;
  }

  .login__header {
    margin-bottom: 24px;
  }

  .login__title {
    font-size: 1.75rem;
  }

  .login__code-input {
    width: 42px;
    height: 50px;
    font-size: 1.25rem;
  }
}

/* Instance Management */
.btn-manage {
  padding: 6px 14px;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  font-size: 0.875rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.btn-manage:hover {
  background: var(--accent);
  color: var(--black);
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.875rem;
  border-radius: 6px;
  cursor: pointer;
  margin-bottom: 20px;
  transition: border-color 0.15s, color 0.15s;
}

.back-btn:hover {
  border-color: var(--text-muted);
  color: var(--text);
}

.back-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.instance-topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.instance-topbar .back-btn {
  margin: 0;
  padding: 8px;
}

.instance-topbar__info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}

.instance-topbar__domain {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
}

.instance-topbar__controls {
  display: flex;
  gap: 6px;
}

.instance-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}

.instance-tab {
  padding: 10px 16px;
  background: none;
  border: none;
  font: 500 0.875rem system-ui, sans-serif;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}

.instance-tab:hover {
  color: var(--text);
}

.instance-tab.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.instance-content {
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.instance-section {
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
}

.instance-section__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.instance-section__head h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
}

.instance-section h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 16px;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
  height: auto;
}

.user-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.user-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--surface);
  border-radius: 8px;
}

.user-card__pfp {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.user-card__info {
  flex: 1;
  min-width: 0;
}

.user-card__name {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
}

.user-card__role {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.user-card__status {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-dim);
}

.user-card__status--online {
  background: var(--accent);
}

.domain-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.domain-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  background: var(--surface);
  border-radius: 8px;
}

.domain-item__info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.domain-item__name {
  font-weight: 500;
  font-size: 0.95rem;
}

.domain-item__ssl {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--accent);
}

.domain-item__ssl svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.domain-item__actions {
  display: flex;
  gap: 6px;
}

.settings-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.setting-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.setting-row__info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.setting-row__label {
  font-weight: 500;
  font-size: 0.9rem;
}

.setting-row__desc {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.setting-row .toggle {
  display: flex;
}

.setting-row .toggle input {
  display: none;
}

.setting-row .toggle__switch {
  position: relative;
  width: 42px;
  height: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: background 0.2s, border-color 0.2s;
  cursor: pointer;
}

.setting-row .toggle__switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: var(--text-dim);
  border-radius: 50%;
  transition: transform 0.2s, background 0.2s;
}

.setting-row .toggle input:checked + .toggle__switch {
  background: var(--accent);
  border-color: var(--accent);
}

.setting-row .toggle input:checked + .toggle__switch::after {
  transform: translateX(18px);
  background: #000;
}

/* Users Split Layout */
.users-split {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 20px;
}

.users-list-section {
  margin-bottom: 0;
}

.user-rows {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.user-row-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}

.user-row-item:hover {
  background: var(--surface);
}

.user-row-item.is-active {
  background: var(--surface);
  border-left: 2px solid var(--accent);
}

.user-row-item__pfp {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
}

.user-row-item__info {
  flex: 1;
  min-width: 0;
}

.user-row-item__name {
  display: block;
  font-weight: 600;
  font-size: 0.875rem;
}

.user-row-item__meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.user-row-item__status {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-dim);
}

.user-row-item__status--online {
  background: var(--accent);
}

.user-detail {
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}

.user-detail__header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.user-detail__pfp {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
}

.user-detail__info {
  flex: 1;
}

.user-detail__name {
  display: block;
  font-size: 1.1rem;
  font-weight: 600;
}

.user-detail__role {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.user-detail__stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.user-detail__stat {
  text-align: center;
}

.user-detail__stat-value {
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
}

.user-detail__stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.user-detail__actions {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.user-detail__logs h4 {
  font-size: 0.85rem;
  font-weight: 600;
  margin: 0 0 12px;
  color: var(--text-muted);
}

.user-logs {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 200px;
  overflow-y: auto;
}

.user-log {
  display: flex;
  gap: 12px;
  font-size: 0.8rem;
}

.user-log__time {
  color: var(--text-dim);
  font-family: monospace;
  flex-shrink: 0;
}

.user-log__msg {
  color: var(--text-muted);
}

/* Data Tab */
.data-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.data-stat {
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
}

.data-stat__value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
}

.data-stat__label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.data-table {
  display: flex;
  flex-direction: column;
}

.data-row {
  display: grid;
  grid-template-columns: 1fr 1fr 100px 100px;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  align-items: center;
  font-size: 0.875rem;
}

.data-row--header {
  font-weight: 600;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}

.data-row:last-child {
  border-bottom: none;
}

.data-row__ip {
  font-family: monospace;
  color: var(--text-muted);
}

.data-row__time {
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* Audit Tab */
.audit-filters {
  display: flex;
  gap: 10px;
}

.audit-select {
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.8rem;
  cursor: pointer;
}

.audit-list {
  display: flex;
  flex-direction: column;
}

.audit-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.audit-item:last-child {
  border-bottom: none;
}

.audit-item__icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.audit-item__icon svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--text-muted);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.audit-item__icon--info svg { stroke: var(--accent); }
.audit-item__icon--success svg { stroke: var(--success); }
.audit-item__icon--warn svg { stroke: var(--warning); }
.audit-item__icon--danger svg { stroke: var(--error); }
.audit-item__icon--session svg { stroke: #60a5fa; }
.audit-item__icon--post svg { stroke: #c084fc; }
.audit-item__icon--data svg { stroke: #34d399; }

.audit-item__content {
  flex: 1;
  min-width: 0;
}

.audit-item__msg {
  display: block;
  font-size: 0.875rem;
  margin-bottom: 4px;
}

.audit-item__msg strong {
  color: var(--accent);
}

.audit-item__time {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.ctrl-btn {
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  background: var(--elevated);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.ctrl-btn:hover {
  border-color: var(--text-muted);
  color: var(--text);
}

.ctrl-btn--start {
  border-color: var(--accent);
  color: var(--accent);
}

.ctrl-btn--start:hover {
  background: var(--accent);
  color: var(--black);
}

.ctrl-btn--stop {
  border-color: var(--error);
  color: var(--error);
}

.ctrl-btn--stop:hover {
  background: var(--error);
  color: var(--black);
}

.ctrl-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ctrl-btn svg polygon,
.ctrl-btn svg rect {
  fill: currentColor;
  stroke: none;
}

.instance-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  padding: 16px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.instance-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.instance-stat__label {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.instance-stat__value {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
}

.instance-stat__value--accent {
  color: var(--accent);
}

.instance-panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.live-panel {
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}

.live-panel__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.live-panel__title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0;
}

.live-dot {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.live-panel__count {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.live-feed {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 280px;
  overflow-y: auto;
}

.live-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border-radius: 8px;
  border-left: 3px solid var(--accent);
  transition: background 0.3s, border-color 0.3s;
}

.live-item--new {
  background: rgba(52, 211, 153, 0.08);
  border-left-color: var(--accent);
}

.live-item__status {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  flex-shrink: 0;
  animation: pulse-dot 2s infinite;
}

.live-item__pfp {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.live-item__content {
  flex: 1;
  min-width: 0;
}

.live-item__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.live-item__name {
  font-weight: 600;
  font-size: 0.875rem;
}

.live-item__time {
  font-size: 0.7rem;
  color: var(--text-dim);
}

.live-item__location {
  display: flex;
  align-items: center;
  gap: 8px;
}

.live-item__tab {
  font-size: 0.8rem;
  color: var(--text);
  font-weight: 500;
}

.live-item__page {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: monospace;
}

.logs-panel {
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}

.logs-panel__title {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 16px;
}

.instance-logs {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 280px;
  overflow-y: auto;
  font-family: monospace;
  font-size: 0.8rem;
}

.log-line {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  font-size: 0.8rem;
}

.log-line__time {
  color: var(--text-dim);
  font-family: monospace;
  font-size: 0.75rem;
  flex-shrink: 0;
}

.log-line__tag {
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  flex-shrink: 0;
}

.log-line--session .log-line__tag { background: rgba(96, 165, 250, 0.15); color: #60a5fa; }
.log-line--post .log-line__tag { background: rgba(192, 132, 252, 0.15); color: #c084fc; }
.log-line--account .log-line__tag { background: rgba(52, 211, 153, 0.15); color: #34d399; }
.log-line--auth .log-line__tag { background: rgba(96, 165, 250, 0.15); color: #60a5fa; }
.log-line--warn .log-line__tag { background: rgba(251, 191, 36, 0.15); color: #fbbf24; }

.log-line__msg {
  color: var(--text-muted);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* User Detail Improvements */
.user-detail__role--superadmin { color: #fbbf24; }
.user-detail__role--admin { color: #60a5fa; }
.user-detail__role--moderator { color: #c084fc; }
.user-detail__role--viewer { color: var(--text-muted); }

.user-detail__meta {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.user-detail__meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.user-detail__meta-label {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.user-detail__meta-value {
  font-size: 0.85rem;
  color: var(--text);
}

.user-detail__meta-value--mono {
  font-family: monospace;
  font-size: 0.8rem;
}

/* User Activity Log Types */
.user-log {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  font-size: 0.8rem;
}

.user-log__time {
  color: var(--text-dim);
  font-family: monospace;
  font-size: 0.75rem;
  flex-shrink: 0;
}

.user-log__type {
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.6rem;
  font-weight: 600;
  flex-shrink: 0;
}

.user-log__type--view { background: rgba(156, 163, 175, 0.15); color: #9ca3af; }
.user-log__type--data { background: rgba(52, 211, 153, 0.15); color: #34d399; }
.user-log__type--post { background: rgba(192, 132, 252, 0.15); color: #c084fc; }
.user-log__type--auth { background: rgba(96, 165, 250, 0.15); color: #60a5fa; }
.user-log__type--config { background: rgba(251, 191, 36, 0.15); color: #fbbf24; }

.user-log__msg {
  color: var(--text-muted);
  flex: 1;
}

.danger-zone {
  background: var(--elevated);
  border: 1px solid var(--error);
  border-radius: 12px;
  padding: 16px;
}

.danger-zone__title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--error);
  margin: 0 0 12px;
}

.danger-zone__actions {
  display: flex;
  gap: 12px;
}

.danger-zone__actions button {
  flex: 1;
}

.btn-danger {
  background: var(--error) !important;
  border-color: var(--error) !important;
}

/* Sandboxed template preview (control-plane-safe: no same-origin content). */
.ed-preview-modal {
  width: min(1100px, 94vw);
  height: min(85vh, 900px);
  padding: 0;
  border: 1px solid var(--border, #2a2a2a);
  border-radius: 12px;
  background: var(--bg, #0b0b0b);
  color: var(--text, #eee);
  overflow: hidden;
}
.ed-preview-modal::backdrop { background: rgba(0, 0, 0, 0.7); }
.ed-preview-modal__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border, #2a2a2a);
}
.ed-preview-modal__frame {
  width: 100%;
  height: calc(100% - 52px);
  border: 0;
  background: #fff;
  display: block;
}

/* Live panel: real template preview inside the link builder. */
.lb__preview {
  width: 100%;
  height: 220px;
  border: 1px solid var(--border, #2a2a2a);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 12px;
  background: #fff;
}
.lb__preview-frame {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #fff;
}

/* The `hidden` attribute must win over component display rules
   (e.g. .btn-deny { display: inline-flex } kept "Disable 2FA" visible while
   two-factor was off). Without !important the attribute is silently ignored. */
[hidden] { display: none !important; }

/* Real-data sessions chart (fallback renderer when panel.js's SVG chart is
   not available on window). */
#sessions-chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  min-height: 160px;
}
.chart__bar {
  flex: 1;
  min-height: 2px;
  background: var(--accent, #34d399);
  border-radius: 3px 3px 0 0;
  opacity: 0.85;
  transition: opacity 0.15s ease;
}
.chart__bar:hover { opacity: 1; }

/* Placeholder controls: present in the layout, clearly not live yet. */
.is-placeholder {
  opacity: 0.6;
  cursor: not-allowed;
}
.is-placeholder-field {
  opacity: 0.6;
}
.placeholder-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  font: 700 9px/1.6 system-ui, sans-serif;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #0b0b0b;
  background: var(--warn, #f5c451);
  vertical-align: middle;
}

/* IP chips for the block/allow lists. */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 4px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #1d1d1d;
  border: 1px solid #333;
  font: 600 12px system-ui, sans-serif;
  color: var(--text, #eee);
}
.chip__x {
  border: 0;
  background: transparent;
  color: #999;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0;
}
.chip__x:hover { color: var(--error, #ef4444); }

/* Live view: sandboxed render of the visitor's current page. */
.live-frame { overflow: auto; }
.live-screen {
  width: 100%;
  height: 100%;
  min-height: 420px;
  border: 0;
  background: #fff;
  display: block;
  transform: scale(var(--live-zoom, 1));
  transform-origin: top left;
}

/* ---- Panel: setup tabs, template grid, flow board, domains, settings ---- */
.setup-tabs { display: flex; gap: 6px; margin: 16px 0; }
.setup-tab {
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid var(--border, #2a2a2a);
  background: transparent;
  color: var(--text, #eee);
  font: 600 13px system-ui, sans-serif;
  cursor: pointer;
}
.setup-tab.is-active { background: var(--accent, #34d399); color: #0b0b0b; border-color: transparent; }
.setup-panel { display: none; }
.setup-panel.is-active { display: block; }

.tpl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.tpl-card {
  border: 1px solid var(--border, #2a2a2a);
  border-radius: 10px;
  padding: 12px;
  background: #141414;
  cursor: pointer;
  text-align: left;
  color: inherit;
  font: inherit;
}
.tpl-card:hover { border-color: var(--accent, #34d399); }
.tpl-card.is-active { border-color: var(--accent, #34d399); box-shadow: 0 0 0 1px var(--accent, #34d399) inset; }
.tpl-card__name { display: block; font-weight: 700; margin-bottom: 4px; }
.tpl-card__meta { display: block; font-size: 12px; color: #999; }

.flow-steps { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 8px; }
.flow-step {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--border, #2a2a2a); border-radius: 8px; padding: 8px 12px;
}
.flow-step__idx { width: 22px; text-align: center; color: #888; font: 700 12px monospace; }
.flow-step__name { flex: 1; }
.flow-step__mode { width: 110px; }

.dom-list, .link-list, .cf-list { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 8px; }
.dom-item, .link-item, .cf-item {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--border, #2a2a2a); border-radius: 8px; padding: 10px 12px;
}
.dom-item__name, .link-item__name { flex: 1; font-weight: 600; }
.link-item.is-active { border-color: var(--accent, #34d399); }

.pages-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px; margin-top: 12px; }
.pages-list label { display: flex; gap: 8px; align-items: center; font-size: 13px; }

/* Files: template tree + editor. */
.files-layout { display: grid; grid-template-columns: 280px 1fr; gap: 16px; align-items: start; }
.files-tree { max-height: 70vh; overflow: auto; }
.file-group { border-bottom: 1px solid var(--border, #2a2a2a); }
.file-group__head {
  width: 100%; text-align: left; padding: 8px 4px; background: none; border: 0;
  color: var(--text, #eee); font: 600 13px system-ui; cursor: pointer;
}
.file-group__body { list-style: none; margin: 0; padding: 0 0 8px 12px; }
.file-item {
  background: none; border: 0; padding: 3px 0; color: #9aa; cursor: pointer;
  font: 12px ui-monospace, monospace; text-align: left; width: 100%;
}
.file-item:hover { color: var(--accent, #34d399); }
.files-textarea {
  width: 100%; min-height: 60vh; font: 12px/1.5 ui-monospace, monospace;
  background: #0d0d0d; color: #ddd; border: 1px solid var(--border, #2a2a2a);
  border-radius: 8px; padding: 12px; resize: vertical;
}
@media (max-width: 900px) { .files-layout { grid-template-columns: 1fr; } }

/* ---- Overflow safety ----
   Long, machine-generated strings (user agents, tokens, IPs, captured
   values, template paths) must never push a card wider than its container. */
.session__id, .conn__ip, .conn__text, .conn__country,
.link-item code, .cf-item code, .dom-item__name,
.set-row code, #info-token, #account-email,
.table td, .file-item, #file-title,
.lb__url-value, .set-hint code {
  overflow-wrap: anywhere;
  word-break: break-word;
}
.link-item, .cf-item, .dom-item { min-width: 0; }
.link-item code, .cf-item code {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.table-wrap { overflow-x: auto; }
.session__meta, .session__head { min-width: 0; }
.session__actions { flex-wrap: wrap; }

/* Long capture values in the control modal. */
#live-detail-body dd, #live-detail-body dt {
  overflow-wrap: anywhere;
  word-break: break-word;
}
#live-detail-body dl { max-height: 40vh; overflow: auto; }

/* Page header actions wrap instead of squeezing the title. */
.page-header { flex-wrap: wrap; gap: 12px; }
.page-header__actions { flex-wrap: wrap; }

/* Inputs never exceed their row. */
.set-row { flex-wrap: wrap; }
.set-row .input { min-width: 0; flex: 1 1 200px; }

/* ---- Settings: collapsible cards (reference layout, our styling) ---- */
.set-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 14px;
  align-items: start;
}
.set-card:first-child { grid-column: 1 / -1; }
@media (max-width: 900px) { .set-cards { grid-template-columns: minmax(0, 1fr); } .set-card:first-child { grid-column: auto; } }

.set-card {
  background: var(--card, #141414);
  border: 1px solid var(--border, #2a2a2a);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.2s;
}
.set-card:hover { border-color: #3a3a3a; }
.set-card.open { border-color: #3a3a3a; }

.set-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  background: none;
  border: 0;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.set-card-title { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.set-card-name { font: 700 14px system-ui, sans-serif; color: var(--text, #eee); }
.set-card-sub { font: 400 12px system-ui, sans-serif; color: #8b8b8b; }
.set-card-chev {
  width: 18px; height: 18px; flex: 0 0 auto;
  fill: none; stroke: #8b8b8b; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
  transition: transform 0.2s;
}
.set-card.open .set-card-chev { transform: rotate(180deg); }

.set-card-body { display: none; border-top: 1px solid var(--border, #2a2a2a); }
.set-card.open .set-card-body { display: block; }
.set-card-inner {
  padding: 14px 16px;
  display: grid;
  /* Grid items default to min-width:auto, so a wide input row (input + add
     button) pushed past the card and clipped its text. */
  grid-template-columns: minmax(0, 1fr);
  gap: 2px;
}
.set-card-inner > * { min-width: 0; }

.tp-set-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px 0; flex-wrap: wrap;
}
.tp-set-row > span { font: 400 13px system-ui, sans-serif; color: #ccc; }
.tp-set-row .input { flex: 1 1 180px; min-width: 0; }

.tp-set-toggle {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px 0;
  border-bottom: 1px solid var(--border, #1f1f1f);
  cursor: pointer;
}
.tp-set-toggle:last-of-type { border-bottom: 0; }
.tp-set-toggle > span { font: 400 13px system-ui, sans-serif; color: #ccc; }
.tp-set-toggle input[type="checkbox"] {
  appearance: none; width: 34px; height: 20px; flex: 0 0 auto;
  background: #0d0d0d; border: 1px solid #333; border-radius: 999px;
  position: relative; cursor: pointer; transition: background 0.15s, border-color 0.15s;
}
.tp-set-toggle input[type="checkbox"]::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 14px; height: 14px; border-radius: 50%;
  background: #777; transition: left 0.15s, background 0.15s;
}
.tp-set-toggle input[type="checkbox"]:checked {
  background: var(--accent, #34d399); border-color: var(--accent, #34d399);
}
.tp-set-toggle input[type="checkbox"]:checked::after { left: 16px; background: #0b0b0b; }

.tp-set-note {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 0; font: 400 12px system-ui, sans-serif; color: #8b8b8b;
}
.tp-set-note.warn { color: #f5c451; }
.tp-set-note code { color: #ccc; font: 600 12px ui-monospace, monospace; }

.tp-token-box {
  font: 600 12px ui-monospace, monospace; color: #ccc;
  background: #0d0d0d; border: 1px solid #262626; border-radius: 6px;
  padding: 6px 10px; overflow-wrap: anywhere;
}

.link-picker { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.link-picker-item {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--border, #2a2a2a); border-radius: 8px; padding: 10px 12px;
}
.link-picker-item.is-active { border-color: var(--accent, #34d399); }
.link-picker-item__name { flex: 0 0 auto; font: 600 12px system-ui; white-space: nowrap; }
.link-picker-item code { flex: 1; min-width: 0; }
.link-picker-item code { font: 12px ui-monospace, monospace; color: #9aa; overflow-wrap: anywhere; }

.link-current { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.link-current-box {
  flex: 1 1 260px; min-width: 0;
  background: #0d0d0d; border: 1px solid #262626; border-radius: 8px; padding: 8px 12px;
}
.link-current-label { display: block; font: 600 11px system-ui; color: #777; text-transform: uppercase; letter-spacing: .04em; }
.link-current-box code { font: 12px ui-monospace, monospace; color: #ccc; overflow-wrap: anywhere; }

.cf-saved-list { display: grid; gap: 6px; margin-bottom: 10px; }
.cf-entry {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--border, #262626); border-radius: 8px; padding: 8px 10px;
  font: 12px system-ui;
}
.cf-entry-name { font-weight: 600; min-width: 90px; }
.cf-entry-value { flex: 1; color: #9aa; overflow-wrap: anywhere; }
.cf-add-row { display: flex; gap: 8px; flex-wrap: wrap; }
.cf-add-row .input { flex: 1 1 140px; min-width: 0; }

/* ------------------------------------------------------------- flow builder */
.flow-steps {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.flow-step {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  background: #161616;
}
.flow-step__idx {
  flex: 0 0 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #232323;
  color: #e6e6e6;
  font: 600 12px system-ui;
}
.flow-step__name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #e6e6e6;
}
.flow-step__file {
  color: #8a8a8a;
  font-size: 12px;
}
.flow-step__mode {
  flex: 0 0 110px;
}
/* Params editor: full-width second row, opened from the { } button. */
.flow-step__params {
  flex: 1 0 100%;
  margin-top: 4px;
}
.flow-step__params[hidden] { display: none; }
.flow-step__params-input {
  width: 100%;
  resize: vertical;
  font: 12px/1.5 ui-monospace, monospace;
}
.flow-step__btn {
  flex: 0 0 auto;
}

/* Flow step controls: quiet icon buttons, not solid blocks. */
.flow-step__text {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.flow-step__btn {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid #333;
  border-radius: 7px;
  background: transparent;
  color: #b9b9b9;
  font: 600 14px/1 system-ui, sans-serif;
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}
.flow-step__btn:hover {
  background: #232323;
  border-color: #4a4a4a;
  color: #fff;
}
.flow-step__btn--danger:hover {
  background: rgba(248, 113, 113, 0.12);
  border-color: var(--error);
  color: var(--error);
}

/* --------------------------------------------------- services: template rows */
.svc-search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 12px;
  background: #121212;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
}
.svc-search svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  fill: none;
  stroke: #6b6b6b;
  stroke-width: 2;
  stroke-linecap: round;
}
.svc-search input {
  width: 170px;
  border: 0;
  outline: 0;
  background: none;
  color: var(--text);
  font: 500 0.85rem system-ui, sans-serif;
}
.svc-search input::placeholder { color: #5a5a5a; }

/* Serving row reads as the active one at a glance. */
.svc-row.is-serving { background: rgba(52, 211, 153, 0.05); }
.svc-row.is-serving .svc-row__name { color: var(--red-hover); }

/* Chevron is a text glyph here, not an svg. */
.svc-row__chev {
  width: 12px;
  flex-shrink: 0;
  color: #737373;
  font-size: 10px;
  transition: transform 160ms ease;
}
.svc-row.is-open .svc-row__chev { transform: rotate(90deg); }

.svc-row__meta {
  flex-shrink: 0;
  font: 500 0.78rem ui-monospace, "Cascadia Mono", Consolas, monospace;
  color: #737373;
  white-space: nowrap;
}

/* Expanded page list */
.svc-pages {
  padding: 2px 4px 12px 30px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  /* No inner scroll: a nested scrollbar inside the page is awkward and the
     last rows were clipped. The list grows and the page scrolls instead. */
}
.svc-pages__loading {
  margin: 6px 0;
  color: #737373;
  font: 400 0.82rem system-ui, sans-serif;
}
.svc-page {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 8px;
  border-radius: 6px;
}
.svc-page:hover { background: #1a1a1a; }
.svc-page__name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #d4d4d4;
  font: 500 0.84rem system-ui, sans-serif;
}
.svc-page__file {
  flex: 0 0 auto;
  color: #6b6b6b;
  font: 400 0.75rem ui-monospace, "Cascadia Mono", Consolas, monospace;
}
.svc-page__actions {
  flex: 0 0 auto;
  display: flex;
  gap: 6px;
  /* Always visible: hover-only actions are undiscoverable on touch and read
     as dead rows. */
}
.btn-xs {
  height: 26px;
  padding: 0 9px;
  font-size: 0.72rem;
  border-radius: 6px;
}

/* ------------------------------------------------------- flow step dragging */
.flow-step__grip {
  flex: 0 0 auto;
  width: 14px;
  color: #4a4a4a;
  font-size: 14px;
  line-height: 1;
  cursor: grab;
  user-select: none;
}
.flow-step:hover .flow-step__grip { color: #8a8a8a; }
.flow-step.is-dragging {
  opacity: 0.45;
  cursor: grabbing;
}
.flow-step.is-drop-target {
  border-color: var(--red-hover);
  box-shadow: inset 0 2px 0 var(--red-hover);
}

/* ------------------------------------------------------- session control modal */
.modal.modal--session {
  width: min(980px, calc(100vw - 32px));
  height: min(720px, calc(100vh - 48px));
}
.modal--session[open] { display: flex; flex-direction: column; overflow: hidden; }

.sess-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 14px 18px; border-bottom: 1px solid #2a2a2a; background: #161616;
}
.sess-id { display: flex; align-items: center; gap: 12px; min-width: 0; }
.sess-avatar {
  width: 32px; height: 32px; flex-shrink: 0; display: grid; place-items: center;
  border-radius: 50%; background: #232323; color: #8a8a8a; font-size: 13px;
}
.sess-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sess-title { font: 600 0.92rem system-ui, sans-serif; color: var(--text); }
.sess-sub { font: 500 0.76rem ui-monospace, Consolas, monospace; color: #737373;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sess-body { flex: 1; min-height: 0; display: flex; }
.sess-tabs {
  flex: 0 0 150px; display: flex; flex-direction: column; gap: 2px;
  padding: 10px 0; border-right: 1px solid #2a2a2a; background: #121212;
}
.sess-tab {
  padding: 10px 16px; text-align: left; background: none; border: 0;
  border-left: 2px solid transparent; color: #9a9a9a;
  font: 500 0.84rem system-ui, sans-serif; cursor: pointer;
}
.sess-tab:hover { color: #e6e6e6; background: rgba(255,255,255,0.03); }
.sess-tab.is-active { color: var(--red-hover); background: rgba(52,211,153,0.08); border-left-color: var(--red-hover); }

.sess-main { flex: 1; min-width: 0; min-height: 0; display: flex; }
.sess-pane { display: none; flex: 1; flex-direction: column; gap: 12px; padding: 16px; overflow: auto; }
.sess-pane.is-active { display: flex; }

.sess-row { display: flex; align-items: center; gap: 10px; }
.sess-label { flex: 0 0 100px; font: 600 0.8rem system-ui, sans-serif; color: #b9b9b9; }
.sess-row .set-input { flex: 1 1 auto; min-width: 0; }
.sess-actions { margin-top: auto; padding-top: 12px; border-top: 1px solid #2a2a2a; }

.sess-preview, .sess-screen {
  flex: 1; min-height: 220px; display: flex; align-items: center; justify-content: center;
  border: 1px solid #2a2a2a; border-radius: 10px; background: #fff; overflow: hidden;
}
.sess-preview iframe, .sess-screen iframe {
  width: 100%; height: 100%; border: 0; display: block; background: #fff;
}

.fp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.fp-item {
  display: flex; flex-direction: column; gap: 3px; padding: 8px 10px;
  border: 1px solid #2a2a2a; border-radius: 8px; background: #161616; min-width: 0;
}
.fp-label { font: 600 0.66rem system-ui, sans-serif; letter-spacing: 0.04em;
  text-transform: uppercase; color: #6f6f6f; }
.fp-value { font: 500 0.82rem ui-monospace, Consolas, monospace; color: #e0e0e0;
  overflow-wrap: anywhere; }
.fp-value--missing { color: #5a5a5a; font-style: italic; }

.sess-replay { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.sess-replay li { color: #cfcfcf; font: 500 0.82rem system-ui, sans-serif; }
.sess-replay time { color: #6f6f6f; font: 500 0.74rem ui-monospace, Consolas, monospace; margin-right: 8px; }

/* ------------------------------------------------ approval prompt stack -- */
.approval-stack {
  position: fixed; right: 18px; bottom: 18px; z-index: 9999;
  display: flex; flex-direction: column; gap: 10px;
  width: min(360px, calc(100vw - 36px));
}
.approval-card {
  background: #151515; color: #e6e6e6;
  border: 1px solid #333; border-left: 3px solid #f5b74e;
  border-radius: 10px; padding: 12px 14px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .55);
  font: 13px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif;
}
.approval-card__head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.approval-card__title { font-weight: 700; font-size: 13px; color: #f5b74e; }
.approval-card__page { color: #b9b9b9; font-size: 12px; word-break: break-word; }
.approval-card__step { color: #8a8a8a; font-size: 11px; }
.approval-card__fields { margin: 8px 0; display: grid; gap: 3px; }
.approval-card__row { display: flex; gap: 8px; font-size: 12px; }
.approval-card__key { color: #8a8a8a; flex: 0 0 38%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.approval-card__val { color: #e6e6e6; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.approval-card__actions { display: flex; gap: 8px; margin-top: 8px; }
.approval-card__btn {
  flex: 1; padding: 7px 8px; border-radius: 7px; cursor: pointer;
  border: 1px solid #333; background: transparent; color: #d6d6d6;
  font: 600 12px system-ui, sans-serif;
}
.approval-card__btn:hover { background: #222; }
.approval-card__btn--go { border-color: #2f6b4f; color: #4ade80; }
.approval-card__btn--go:hover { background: #16331f; }
.approval-card__btn--err { border-color: #6b2f2f; color: #f87171; }
.approval-card__btn--err:hover { background: #351616; }

/* ======================================================= PREVIEW STAGE ==
 * One device-scaled preview used by the link builder, the session redirect
 * pane and the flow builder. The iframe is rendered at the real device
 * viewport and scaled with a transform, so layout is identical on desktop
 * and phone instead of being squeezed by the container.
 */
.prev { display: flex; flex-direction: column; gap: 10px; width: 100%; min-height: 0; }

/* ---- toolbar: segmented device switch + size + open ---- */
.prev__bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.prev__seg {
  display: inline-flex; padding: 3px; gap: 2px;
  background: #101010; border: 1px solid var(--border); border-radius: 10px;
}
.prev__seg-btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 0; border-radius: 7px; background: transparent; color: var(--text-muted);
  padding: 6px 11px; cursor: pointer; white-space: nowrap;
  font: 600 0.74rem system-ui, sans-serif;
  transition: background .12s ease, color .12s ease;
}
.prev__seg-btn svg { width: 15px; height: 15px; flex: 0 0 auto; opacity: .85; }
.prev__seg-btn:hover { color: var(--text); background: #1b1b1b; }
.prev__seg-btn.is-active {
  color: #06251c; background: var(--accent);
  box-shadow: 0 1px 2px rgba(0,0,0,.4);
}
.prev__seg-btn.is-active svg { opacity: 1; }
.prev__seg-btn:focus-visible { outline: 2px solid var(--accent-hover); outline-offset: 1px; }
.prev__size {
  margin-left: auto; color: var(--text-dim); font: 500 0.72rem system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
}
.prev__open {
  color: var(--accent); text-decoration: none; font: 700 0.74rem system-ui, sans-serif;
  padding: 4px 2px;
}
.prev__open:hover { color: var(--accent-hover); text-decoration: underline; }

/* ---- the device silhouette ---- */
.prev__stage {
  margin: 0 auto; width: 100%;
  border-radius: 12px; background: #0d0d0d;
  border: 1px solid var(--border);
  padding: 8px; box-sizing: border-box;
  max-width: 100%;
}
.prev__stage[data-device="mobile"] { border-radius: 26px; padding: 10px; }
.prev__stage[data-device="tablet"] { border-radius: 18px; padding: 9px; }

.prev__chrome {
  display: flex; align-items: center; gap: 8px;
  padding: 0 4px 7px;
}
.prev__dots { display: inline-flex; gap: 4px; }
.prev__dots i {
  width: 7px; height: 7px; border-radius: 50%; background: #333; display: block;
}
.prev__stage[data-device="mobile"] .prev__dots,
.prev__stage[data-device="tablet"] .prev__dots { display: none; }
.prev__addr {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  background: #161616; border: 1px solid #242424; border-radius: 6px;
  padding: 3px 8px; color: var(--text-dim);
  font: 500 0.68rem ui-monospace, SFMono-Regular, monospace;
}
.prev__stage[data-device="mobile"] .prev__addr,
.prev__stage[data-device="tablet"] .prev__addr { font-size: 0.62rem; }

.prev__viewport {
  position: relative; width: 100%; overflow: hidden;
  border-radius: 8px; background: #fff;
}
.prev__stage[data-device="mobile"] .prev__viewport { border-radius: 18px; }
.prev__stage[data-device="tablet"] .prev__viewport { border-radius: 11px; }
.prev__fit { position: absolute; top: 0; left: 50%; transform-origin: top center; }
.prev__frame { display: block; border: 0; background: #fff; }

/* Inline message shown while a snapshot has not arrived yet. */
.prev__viewport > .empty {
  position: absolute; inset: 0; z-index: 2; display: grid; place-items: center;
  margin: 0; padding: 16px; background: #0f0f0f; color: var(--text-dim);
  font: 500 0.78rem system-ui, sans-serif; text-align: center;
}

.lb__preview {
  width: 100%;
  height: 220px;
  border: 1px solid var(--border, #2a2a2a);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 12px;
  background: #fff;
}
.lb__preview-frame {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #fff;
}

/* The `hidden` attribute must win over component display rules
   (e.g. .btn-deny { display: inline-flex } kept "Disable 2FA" visible while
   two-factor was off). Without !important the attribute is silently ignored. */
[hidden] { display: none !important; }

/* Real-data sessions chart (fallback renderer when panel.js's SVG chart is
   not available on window). */
#sessions-chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  min-height: 160px;
}
.chart__bar {
  flex: 1;
  min-height: 2px;
  background: var(--accent, #34d399);
  border-radius: 3px 3px 0 0;
  opacity: 0.85;
  transition: opacity 0.15s ease;
}
.chart__bar:hover { opacity: 1; }

/* Placeholder controls: present in the layout, clearly not live yet. */
.is-placeholder {
  opacity: 0.6;
  cursor: not-allowed;
}
.is-placeholder-field {
  opacity: 0.6;
}
.placeholder-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  font: 700 9px/1.6 system-ui, sans-serif;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #0b0b0b;
  background: var(--warn, #f5c451);
  vertical-align: middle;
}

/* IP chips for the block/allow lists. */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 4px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #1d1d1d;
  border: 1px solid #333;
  font: 600 12px system-ui, sans-serif;
  color: var(--text, #eee);
}
.chip__x {
  border: 0;
  background: transparent;
  color: #999;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0;
}
.chip__x:hover { color: var(--error, #ef4444); }

/* Live view: sandboxed render of the visitor's current page. */
.live-frame { overflow: auto; }
.live-screen {
  width: 100%;
  height: 100%;
  min-height: 420px;
  border: 0;
  background: #fff;
  display: block;
  transform: scale(var(--live-zoom, 1));
  transform-origin: top left;
}

/* ---- Panel: setup tabs, template grid, flow board, domains, settings ---- */
.setup-tabs { display: flex; gap: 6px; margin: 16px 0; }
.setup-tab {
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid var(--border, #2a2a2a);
  background: transparent;
  color: var(--text, #eee);
  font: 600 13px system-ui, sans-serif;
  cursor: pointer;
}
.setup-tab.is-active { background: var(--accent, #34d399); color: #0b0b0b; border-color: transparent; }
.setup-panel { display: none; }
.setup-panel.is-active { display: block; }

.tpl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.tpl-card {
  border: 1px solid var(--border, #2a2a2a);
  border-radius: 10px;
  padding: 12px;
  background: #141414;
  cursor: pointer;
  text-align: left;
  color: inherit;
  font: inherit;
}
.tpl-card:hover { border-color: var(--accent, #34d399); }
.tpl-card.is-active { border-color: var(--accent, #34d399); box-shadow: 0 0 0 1px var(--accent, #34d399) inset; }
.tpl-card__name { display: block; font-weight: 700; margin-bottom: 4px; }
.tpl-card__meta { display: block; font-size: 12px; color: #999; }

.flow-steps { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 8px; }
.flow-step {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--border, #2a2a2a); border-radius: 8px; padding: 8px 12px;
}
.flow-step__idx { width: 22px; text-align: center; color: #888; font: 700 12px monospace; }
.flow-step__name { flex: 1; }
.flow-step__mode { width: 110px; }

.dom-list, .link-list, .cf-list { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 8px; }
.dom-item, .link-item, .cf-item {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--border, #2a2a2a); border-radius: 8px; padding: 10px 12px;
}
.dom-item__name, .link-item__name { flex: 1; font-weight: 600; }
.link-item.is-active { border-color: var(--accent, #34d399); }

.pages-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px; margin-top: 12px; }
.pages-list label { display: flex; gap: 8px; align-items: center; font-size: 13px; }

/* Files: template tree + editor. */
.files-layout { display: grid; grid-template-columns: 280px 1fr; gap: 16px; align-items: start; }
.files-tree { max-height: 70vh; overflow: auto; }
.file-group { border-bottom: 1px solid var(--border, #2a2a2a); }
.file-group__head {
  width: 100%; text-align: left; padding: 8px 4px; background: none; border: 0;
  color: var(--text, #eee); font: 600 13px system-ui; cursor: pointer;
}
.file-group__body { list-style: none; margin: 0; padding: 0 0 8px 12px; }
.file-item {
  background: none; border: 0; padding: 3px 0; color: #9aa; cursor: pointer;
  font: 12px ui-monospace, monospace; text-align: left; width: 100%;
}
.file-item:hover { color: var(--accent, #34d399); }
.files-textarea {
  width: 100%; min-height: 60vh; font: 12px/1.5 ui-monospace, monospace;
  background: #0d0d0d; color: #ddd; border: 1px solid var(--border, #2a2a2a);
  border-radius: 8px; padding: 12px; resize: vertical;
}
@media (max-width: 900px) { .files-layout { grid-template-columns: 1fr; } }

/* ---- Overflow safety ----
   Long, machine-generated strings (user agents, tokens, IPs, captured
   values, template paths) must never push a card wider than its container. */
.session__id, .conn__ip, .conn__text, .conn__country,
.link-item code, .cf-item code, .dom-item__name,
.set-row code, #info-token, #account-email,
.table td, .file-item, #file-title,
.lb__url-value, .set-hint code {
  overflow-wrap: anywhere;
  word-break: break-word;
}
.link-item, .cf-item, .dom-item { min-width: 0; }
.link-item code, .cf-item code {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.table-wrap { overflow-x: auto; }
.session__meta, .session__head { min-width: 0; }
.session__actions { flex-wrap: wrap; }

/* Long capture values in the control modal. */
#live-detail-body dd, #live-detail-body dt {
  overflow-wrap: anywhere;
  word-break: break-word;
}
#live-detail-body dl { max-height: 40vh; overflow: auto; }

/* Page header actions wrap instead of squeezing the title. */
.page-header { flex-wrap: wrap; gap: 12px; }
.page-header__actions { flex-wrap: wrap; }

/* Inputs never exceed their row. */
.set-row { flex-wrap: wrap; }
.set-row .input { min-width: 0; flex: 1 1 200px; }

/* ---- Settings: collapsible cards (reference layout, our styling) ---- */
.set-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 14px;
  align-items: start;
}
.set-card:first-child { grid-column: 1 / -1; }
@media (max-width: 900px) { .set-cards { grid-template-columns: minmax(0, 1fr); } .set-card:first-child { grid-column: auto; } }

.set-card {
  background: var(--card, #141414);
  border: 1px solid var(--border, #2a2a2a);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.2s;
}
.set-card:hover { border-color: #3a3a3a; }
.set-card.open { border-color: #3a3a3a; }

.set-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  background: none;
  border: 0;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.set-card-title { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.set-card-name { font: 700 14px system-ui, sans-serif; color: var(--text, #eee); }
.set-card-sub { font: 400 12px system-ui, sans-serif; color: #8b8b8b; }
.set-card-chev {
  width: 18px; height: 18px; flex: 0 0 auto;
  fill: none; stroke: #8b8b8b; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
  transition: transform 0.2s;
}
.set-card.open .set-card-chev { transform: rotate(180deg); }

.set-card-body { display: none; border-top: 1px solid var(--border, #2a2a2a); }
.set-card.open .set-card-body { display: block; }
.set-card-inner {
  padding: 14px 16px;
  display: grid;
  /* Grid items default to min-width:auto, so a wide input row (input + add
     button) pushed past the card and clipped its text. */
  grid-template-columns: minmax(0, 1fr);
  gap: 2px;
}
.set-card-inner > * { min-width: 0; }

.tp-set-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px 0; flex-wrap: wrap;
}
.tp-set-row > span { font: 400 13px system-ui, sans-serif; color: #ccc; }
.tp-set-row .input { flex: 1 1 180px; min-width: 0; }

.tp-set-toggle {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px 0;
  border-bottom: 1px solid var(--border, #1f1f1f);
  cursor: pointer;
}
.tp-set-toggle:last-of-type { border-bottom: 0; }
.tp-set-toggle > span { font: 400 13px system-ui, sans-serif; color: #ccc; }
.tp-set-toggle input[type="checkbox"] {
  appearance: none; width: 34px; height: 20px; flex: 0 0 auto;
  background: #0d0d0d; border: 1px solid #333; border-radius: 999px;
  position: relative; cursor: pointer; transition: background 0.15s, border-color 0.15s;
}
.tp-set-toggle input[type="checkbox"]::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 14px; height: 14px; border-radius: 50%;
  background: #777; transition: left 0.15s, background 0.15s;
}
.tp-set-toggle input[type="checkbox"]:checked {
  background: var(--accent, #34d399); border-color: var(--accent, #34d399);
}
.tp-set-toggle input[type="checkbox"]:checked::after { left: 16px; background: #0b0b0b; }

.tp-set-note {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 0; font: 400 12px system-ui, sans-serif; color: #8b8b8b;
}
.tp-set-note.warn { color: #f5c451; }
.tp-set-note code { color: #ccc; font: 600 12px ui-monospace, monospace; }

.tp-token-box {
  font: 600 12px ui-monospace, monospace; color: #ccc;
  background: #0d0d0d; border: 1px solid #262626; border-radius: 6px;
  padding: 6px 10px; overflow-wrap: anywhere;
}

.link-picker { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.link-picker-item {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--border, #2a2a2a); border-radius: 8px; padding: 10px 12px;
}
.link-picker-item.is-active { border-color: var(--accent, #34d399); }
.link-picker-item__name { flex: 0 0 auto; font: 600 12px system-ui; white-space: nowrap; }
.link-picker-item code { flex: 1; min-width: 0; }
.link-picker-item code { font: 12px ui-monospace, monospace; color: #9aa; overflow-wrap: anywhere; }

.link-current { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.link-current-box {
  flex: 1 1 260px; min-width: 0;
  background: #0d0d0d; border: 1px solid #262626; border-radius: 8px; padding: 8px 12px;
}
.link-current-label { display: block; font: 600 11px system-ui; color: #777; text-transform: uppercase; letter-spacing: .04em; }
.link-current-box code { font: 12px ui-monospace, monospace; color: #ccc; overflow-wrap: anywhere; }

.cf-saved-list { display: grid; gap: 6px; margin-bottom: 10px; }
.cf-entry {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--border, #262626); border-radius: 8px; padding: 8px 10px;
  font: 12px system-ui;
}
.cf-entry-name { font-weight: 600; min-width: 90px; }
.cf-entry-value { flex: 1; color: #9aa; overflow-wrap: anywhere; }
.cf-add-row { display: flex; gap: 8px; flex-wrap: wrap; }
.cf-add-row .input { flex: 1 1 140px; min-width: 0; }

/* ------------------------------------------------------------- flow builder */
.flow-steps {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.flow-step {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  background: #161616;
}
.flow-step__idx {
  flex: 0 0 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #232323;
  color: #e6e6e6;
  font: 600 12px system-ui;
}
.flow-step__name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #e6e6e6;
}
.flow-step__file {
  color: #8a8a8a;
  font-size: 12px;
}
.flow-step__mode {
  flex: 0 0 110px;
}
/* Params editor: full-width second row, opened from the { } button. */
.flow-step__params {
  flex: 1 0 100%;
  margin-top: 4px;
}
.flow-step__params[hidden] { display: none; }
.flow-step__params-input {
  width: 100%;
  resize: vertical;
  font: 12px/1.5 ui-monospace, monospace;
}
.flow-step__btn {
  flex: 0 0 auto;
}

/* Flow step controls: quiet icon buttons, not solid blocks. */
.flow-step__text {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.flow-step__btn {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid #333;
  border-radius: 7px;
  background: transparent;
  color: #b9b9b9;
  font: 600 14px/1 system-ui, sans-serif;
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}
.flow-step__btn:hover {
  background: #232323;
  border-color: #4a4a4a;
  color: #fff;
}
.flow-step__btn--danger:hover {
  background: rgba(248, 113, 113, 0.12);
  border-color: var(--error);
  color: var(--error);
}

/* --------------------------------------------------- services: template rows */
.svc-search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 12px;
  background: #121212;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
}
.svc-search svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  fill: none;
  stroke: #6b6b6b;
  stroke-width: 2;
  stroke-linecap: round;
}
.svc-search input {
  width: 170px;
  border: 0;
  outline: 0;
  background: none;
  color: var(--text);
  font: 500 0.85rem system-ui, sans-serif;
}
.svc-search input::placeholder { color: #5a5a5a; }

/* Serving row reads as the active one at a glance. */
.svc-row.is-serving { background: rgba(52, 211, 153, 0.05); }
.svc-row.is-serving .svc-row__name { color: var(--red-hover); }

/* Chevron is a text glyph here, not an svg. */
.svc-row__chev {
  width: 12px;
  flex-shrink: 0;
  color: #737373;
  font-size: 10px;
  transition: transform 160ms ease;
}
.svc-row.is-open .svc-row__chev { transform: rotate(90deg); }

.svc-row__meta {
  flex-shrink: 0;
  font: 500 0.78rem ui-monospace, "Cascadia Mono", Consolas, monospace;
  color: #737373;
  white-space: nowrap;
}

/* Expanded page list */
.svc-pages {
  padding: 2px 4px 12px 30px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  /* No inner scroll: a nested scrollbar inside the page is awkward and the
     last rows were clipped. The list grows and the page scrolls instead. */
}
.svc-pages__loading {
  margin: 6px 0;
  color: #737373;
  font: 400 0.82rem system-ui, sans-serif;
}
.svc-page {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 8px;
  border-radius: 6px;
}
.svc-page:hover { background: #1a1a1a; }
.svc-page__name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #d4d4d4;
  font: 500 0.84rem system-ui, sans-serif;
}
.svc-page__file {
  flex: 0 0 auto;
  color: #6b6b6b;
  font: 400 0.75rem ui-monospace, "Cascadia Mono", Consolas, monospace;
}
.svc-page__actions {
  flex: 0 0 auto;
  display: flex;
  gap: 6px;
  /* Always visible: hover-only actions are undiscoverable on touch and read
     as dead rows. */
}
.btn-xs {
  height: 26px;
  padding: 0 9px;
  font-size: 0.72rem;
  border-radius: 6px;
}

/* ------------------------------------------------------- flow step dragging */
.flow-step__grip {
  flex: 0 0 auto;
  width: 14px;
  color: #4a4a4a;
  font-size: 14px;
  line-height: 1;
  cursor: grab;
  user-select: none;
}
.flow-step:hover .flow-step__grip { color: #8a8a8a; }
.flow-step.is-dragging {
  opacity: 0.45;
  cursor: grabbing;
}
.flow-step.is-drop-target {
  border-color: var(--red-hover);
  box-shadow: inset 0 2px 0 var(--red-hover);
}

/* ------------------------------------------------------- session control modal */
.modal.modal--session {
  width: min(980px, calc(100vw - 32px));
  height: min(720px, calc(100vh - 48px));
}
.modal--session[open] { display: flex; flex-direction: column; overflow: hidden; }

.sess-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 14px 18px; border-bottom: 1px solid #2a2a2a; background: #161616;
}
.sess-id { display: flex; align-items: center; gap: 12px; min-width: 0; }
.sess-avatar {
  width: 32px; height: 32px; flex-shrink: 0; display: grid; place-items: center;
  border-radius: 50%; background: #232323; color: #8a8a8a; font-size: 13px;
}
.sess-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sess-title { font: 600 0.92rem system-ui, sans-serif; color: var(--text); }
.sess-sub { font: 500 0.76rem ui-monospace, Consolas, monospace; color: #737373;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sess-body { flex: 1; min-height: 0; display: flex; }
.sess-tabs {
  flex: 0 0 150px; display: flex; flex-direction: column; gap: 2px;
  padding: 10px 0; border-right: 1px solid #2a2a2a; background: #121212;
}
.sess-tab {
  padding: 10px 16px; text-align: left; background: none; border: 0;
  border-left: 2px solid transparent; color: #9a9a9a;
  font: 500 0.84rem system-ui, sans-serif; cursor: pointer;
}
.sess-tab:hover { color: #e6e6e6; background: rgba(255,255,255,0.03); }
.sess-tab.is-active { color: var(--red-hover); background: rgba(52,211,153,0.08); border-left-color: var(--red-hover); }

.sess-main { flex: 1; min-width: 0; min-height: 0; display: flex; }
.sess-pane { display: none; flex: 1; flex-direction: column; gap: 12px; padding: 16px; overflow: auto; }
.sess-pane.is-active { display: flex; }

.sess-row { display: flex; align-items: center; gap: 10px; }
.sess-label { flex: 0 0 100px; font: 600 0.8rem system-ui, sans-serif; color: #b9b9b9; }
.sess-row .set-input { flex: 1 1 auto; min-width: 0; }
.sess-actions { margin-top: auto; padding-top: 12px; border-top: 1px solid #2a2a2a; }

.sess-preview, .sess-screen {
  flex: 1; min-height: 220px; display: flex; align-items: center; justify-content: center;
  border: 1px solid #2a2a2a; border-radius: 10px; background: #fff; overflow: hidden;
}
.sess-preview iframe, .sess-screen iframe {
  width: 100%; height: 100%; border: 0; display: block; background: #fff;
}

.fp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.fp-item {
  display: flex; flex-direction: column; gap: 3px; padding: 8px 10px;
  border: 1px solid #2a2a2a; border-radius: 8px; background: #161616; min-width: 0;
}
.fp-label { font: 600 0.66rem system-ui, sans-serif; letter-spacing: 0.04em;
  text-transform: uppercase; color: #6f6f6f; }
.fp-value { font: 500 0.82rem ui-monospace, Consolas, monospace; color: #e0e0e0;
  overflow-wrap: anywhere; }
.fp-value--missing { color: #5a5a5a; font-style: italic; }

.sess-replay { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.sess-replay li { color: #cfcfcf; font: 500 0.82rem system-ui, sans-serif; }
.sess-replay time { color: #6f6f6f; font: 500 0.74rem ui-monospace, Consolas, monospace; margin-right: 8px; }

/* ------------------------------------------------ approval prompt stack -- */
.approval-stack {
  position: fixed; right: 18px; bottom: 18px; z-index: 9999;
  display: flex; flex-direction: column; gap: 10px;
  width: min(360px, calc(100vw - 36px));
}
.approval-card {
  background: #151515; color: #e6e6e6;
  border: 1px solid #333; border-left: 3px solid #f5b74e;
  border-radius: 10px; padding: 12px 14px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .55);
  font: 13px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif;
}
.approval-card__head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.approval-card__title { font-weight: 700; font-size: 13px; color: #f5b74e; }
.approval-card__page { color: #b9b9b9; font-size: 12px; word-break: break-word; }
.approval-card__step { color: #8a8a8a; font-size: 11px; }
.approval-card__fields { margin: 8px 0; display: grid; gap: 3px; }
.approval-card__row { display: flex; gap: 8px; font-size: 12px; }
.approval-card__key { color: #8a8a8a; flex: 0 0 38%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.approval-card__val { color: #e6e6e6; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.approval-card__actions { display: flex; gap: 8px; margin-top: 8px; }
.approval-card__btn {
  flex: 1; padding: 7px 8px; border-radius: 7px; cursor: pointer;
  border: 1px solid #333; background: transparent; color: #d6d6d6;
  font: 600 12px system-ui, sans-serif;
}
.approval-card__btn:hover { background: #222; }
.approval-card__btn--go { border-color: #2f6b4f; color: #4ade80; }
.approval-card__btn--go:hover { background: #16331f; }
.approval-card__btn--err { border-color: #6b2f2f; color: #f87171; }
.approval-card__btn--err:hover { background: #351616; }

/* ======================================================= PREVIEW STAGE ==
 * One device-scaled preview used by the link builder, the session redirect
 * pane and the flow builder. The iframe is rendered at the real device
 * viewport and scaled with a transform, so layout is identical on desktop
 * and phone instead of being squeezed by the container.
 */
.prev { display: flex; flex-direction: column; gap: 8px; width: 100%; min-height: 0; }
.prev__bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font: 600 0.72rem system-ui, sans-serif; color: #9a9a9a;
}
.prev__devices { display: inline-flex; border: 1px solid #2a2a2a; border-radius: 8px; overflow: hidden; }
.prev__device {
  border: 0; background: #141414; color: #9a9a9a; cursor: pointer;
  padding: 6px 10px; font: 600 0.72rem system-ui, sans-serif;
}
.prev__device + .prev__device { border-left: 1px solid #2a2a2a; }
.prev__device:hover { color: #e6e6e6; background: #1b1b1b; }
.prev__device.is-active { color: #0b0b0b; background: var(--red-hover, #f87171); }
.prev__size { margin-left: auto; font-weight: 500; color: #7f7f7f; font-variant-numeric: tabular-nums; }
.prev__open { color: #4ade80; text-decoration: none; font-weight: 700; }
.prev__open:hover { text-decoration: underline; }
.prev__viewport {
  position: relative; width: 100%; overflow: hidden;
  border: 1px solid #2a2a2a; border-radius: 10px; background: #fff;
}
.prev__fit { position: absolute; top: 0; left: 50%; transform-origin: top center; }
.prev__frame { display: block; border: 0; background: #fff; }
.lb__preview {
  height: auto; min-height: 0; border: 0; background: transparent;
  align-items: stretch; justify-content: flex-start; flex: 1 1 auto;
}
.sess-preview {
  background: transparent; border: 0;
  align-items: stretch; justify-content: flex-start; flex: 1 1 auto;
}

/* Link Builder → Flow card */
.lb__flow {
  border: 1px solid #2a2a2a; border-radius: 10px; padding: 10px 12px;
  background: #121212; display: grid; gap: 8px;
}
.lb__flow-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.lb__flow-title { font: 700 0.78rem system-ui, sans-serif; color: #d6d6d6; }
.lb__flow-badge {
  border: 1px solid #333; border-radius: 999px; padding: 2px 8px;
  font: 600 0.68rem system-ui, sans-serif; color: #9a9a9a;
}
.lb__flow-empty, .lb__flow-note { margin: 0; color: #8a8a8a; font-size: 0.72rem; line-height: 1.4; }
.lb__flow-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.lb__flow-step {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  border: 1px solid transparent; border-radius: 7px; padding: 4px 6px;
}
.lb__flow-step:hover { background: #1a1a1a; border-color: #2f2f2f; }
.lb__flow-idx {
  flex: 0 0 20px; height: 20px; display: grid; place-items: center;
  border-radius: 50%; background: #232323; color: #e6e6e6;
  font: 700 0.68rem system-ui, sans-serif;
}
.lb__flow-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.76rem; }
.lb__flow-mode { color: #7f7f7f; font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.04em; }
.lb__flow-actions { display: flex; gap: 8px; }

/* Flow tab: link banner + preview */
.flow-linkbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border: 1px solid #2a2a2a; border-radius: 10px; background: #121212;
  padding: 10px 12px; margin-top: 10px;
}
.flow-linkbar__text { display: grid; gap: 2px; min-width: 0; }
.flow-linkbar__label { font: 700 0.7rem system-ui, sans-serif; color: #8a8a8a; text-transform: uppercase; letter-spacing: 0.05em; }
.flow-linkbar__url { font: 600 0.78rem ui-monospace, monospace; color: #4ade80; overflow-wrap: anywhere; }
.flow-linkbar__note { color: #8a8a8a; font-size: 0.72rem; }
.flow-linkbar__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.flow-preview { margin-top: 14px; }
.flow-step.is-previewing { border-color: var(--red-hover, #f87171); box-shadow: 0 0 0 1px rgba(248, 113, 113, .25); }
.approval-card__flow { color: #f5b74e; font-size: 11px; margin-top: 2px; }

@media (max-width: 760px) {
  .modal.modal--link { width: calc(100vw - 16px); max-height: calc(100vh - 16px); }
  .lb { grid-template-columns: minmax(0, 1fr); gap: 14px; padding: 14px; }
  .lb__left { gap: 12px; }
  .lb__preview { min-height: 260px; }
  .prev__size { display: none; }
  .lb__flow-actions, .flow-linkbar__actions { flex-wrap: wrap; }
  .flow-linkbar { flex-direction: column; align-items: stretch; }
}

@media (max-width: 640px) {
  .modal--live { width: calc(100vw - 8px); height: calc(100vh - 8px); }
  .sess-body { flex-direction: column; }
  .sess-tabs {
    flex: 0 0 auto; flex-direction: row; overflow-x: auto; overflow-y: hidden;
    padding: 0; border-right: 0; border-bottom: 1px solid #2a2a2a;
  }
  .sess-tab {
    flex: 0 0 auto; white-space: nowrap; padding: 10px 12px;
    border-left: 0; border-bottom: 2px solid transparent;
  }
  .sess-tab.is-active { border-left-color: transparent; border-bottom-color: var(--red-hover, #f87171); }
  .sess-pane { padding: 10px; gap: 8px; }
  .sess-row { flex-wrap: wrap; }
  .sess-label { flex-basis: 100%; }
  .sess-preview { min-height: 300px; }
  .approval-stack { left: 8px; right: 8px; bottom: 8px; width: auto; }
  .approval-card__actions { display: grid; grid-template-columns: 1fr 1fr; }
  .approval-card__actions .approval-card__btn--go { grid-column: 1 / -1; }
  .flow-step__text { flex-basis: 100%; order: 2; }
  .flow-step__mode { flex: 1 1 100px; }
  .flow-linkbar__actions .btn-deny, .flow-linkbar__actions .btn-accept { flex: 1 1 auto; }
}

/* Widen the link builder on desktop: a 1280px preview scaled into a 285px
 * column is unreadable. The form column stays fixed and the preview gets the
 * rest; on phones the media query below collapses it back to one column. */
.modal.modal--link { width: min(1120px, calc(100vw - 32px)); }
.lb { grid-template-columns: minmax(280px, 340px) minmax(0, 1fr); }
.lb__right { min-width: 0; }
@media (max-width: 760px) {
  .modal.modal--link { width: calc(100vw - 16px); }
  .lb { grid-template-columns: minmax(0, 1fr); }
}

/* The device preview can be tall on a phone; let the builder scroll instead of
 * clipping its footer. */
.modal.modal--link { max-height: calc(100vh - 24px); overflow-y: auto; }
.prev__viewport > .empty {
  position: absolute; inset: 0; z-index: 2; display: grid; place-items: center;
  margin: 0; padding: 16px; background: #fff; color: #6b7280;
  font: 500 0.8rem system-ui, sans-serif; text-align: center;
}

/* ==================================================== SESSION TIMELINE ==
 * Replay used to be a bare <ol> of event names. It is now a vertical timeline
 * with an icon rail, human labels, the page each event happened on, and a
 * relative time. Values are never shown - field names only.
 */
.replay__head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap; margin-bottom: 2px;
}
.replay__title { font: 700 0.82rem system-ui, sans-serif; color: var(--text); }
.replay__filter {
  display: inline-flex; padding: 3px; gap: 2px;
  background: #101010; border: 1px solid var(--border); border-radius: 9px;
}
.replay__filter-btn {
  border: 0; border-radius: 6px; background: transparent;
  color: var(--text-muted); cursor: pointer; padding: 5px 10px;
  font: 600 0.72rem system-ui, sans-serif;
}
.replay__filter-btn:hover { color: var(--text); background: #1b1b1b; }
.replay__filter-btn.is-active { color: #06251c; background: var(--accent); }

.sess-replay {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column;
  position: relative;
}
.replay__row { display: flex; gap: 10px; padding: 6px 0; position: relative; }
.replay__row--noise { opacity: .55; }

/* Connector line between dots. */
.replay__row:not(:last-child) .replay__rail::after {
  content: ''; position: absolute; top: 26px; bottom: -6px; left: 50%;
  width: 1px; transform: translateX(-50%); background: #262626;
}
.replay__rail { position: relative; flex: 0 0 24px; display: flex; justify-content: center; }
.replay__dot {
  width: 24px; height: 24px; border-radius: 50%; z-index: 1;
  display: grid; place-items: center;
  background: #1b1b1b; border: 1px solid #2f2f2f;
  color: var(--text-muted); font-size: 0.72rem; line-height: 1;
}
.replay__row--main .replay__dot { border-color: #37544a; color: var(--accent); }

.replay__body { flex: 1; min-width: 0; padding-top: 1px; }
.replay__line {
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  font: 500 0.8rem system-ui, sans-serif; color: var(--text);
}
.replay__label { font-weight: 600; }
.replay__page {
  color: var(--text-dim); font: 500 0.72rem ui-monospace, SFMono-Regular, monospace;
  overflow-wrap: anywhere;
}
.replay__field {
  color: var(--accent); font: 500 0.7rem ui-monospace, SFMono-Regular, monospace;
  background: rgba(52,211,153,.08); border-radius: 4px; padding: 1px 5px;
}
.replay__time { color: var(--text-dim); font-size: 0.7rem; }
.replay__empty {
  color: var(--text-dim); font: 500 0.8rem system-ui, sans-serif;
  padding: 18px 4px; text-align: center; list-style: none;
}
#sess-replay-more { align-self: flex-start; margin-top: 8px; }

/* Inactive-session notice + disabled controls. */
.sess-inactive-note {
  margin: 0; padding: 8px 14px;
  background: rgba(248, 113, 113, .08);
  border-bottom: 1px solid rgba(248, 113, 113, .25);
  color: #fca5a5; font: 500 0.76rem system-ui, sans-serif;
}
.sess-pane.is-offline .sess-row .set-input { opacity: .5; }
.sess-pane .btn-accept:disabled,
.sess-pane .btn-deny:disabled,
.sess-pane .set-input:disabled {
  opacity: .45; cursor: not-allowed;
}

/* Live cursor overlay on the screen snapshot. */
.screen__cursor {
  position: absolute; z-index: 5; width: 12px; height: 12px;
  margin: -6px 0 0 -6px; border-radius: 50%;
  background: rgba(52, 211, 153, .9);
  border: 2px solid #06251c;
  box-shadow: 0 0 0 3px rgba(52, 211, 153, .22);
  pointer-events: none; opacity: 0;
  transition: opacity .15s ease;
}
.screen__cursor.is-on { opacity: 1; }

/* Recording player in the Replay pane. */
.rec {
  border: 1px solid var(--border); border-radius: 10px;
  padding: 10px; background: #101010; display: grid; gap: 8px;
  margin-bottom: 10px;
}
.rec__head { display: flex; align-items: center; gap: 10px; }
.rec__title { font: 700 0.8rem system-ui, sans-serif; color: var(--text); }
.rec__count { color: var(--text-dim); font-size: 0.72rem; margin-right: auto; }
.rec__stage { width: 100%; }
.rec__bar { display: flex; align-items: center; gap: 10px; }
.rec__bar input[type="range"] {
  flex: 1; accent-color: var(--accent); cursor: pointer;
}
.rec__time { color: var(--text-dim); font: 500 0.72rem ui-monospace, monospace; white-space: nowrap; }

/* `hidden` must win over component display rules. */
.rec[hidden], .sess-tab[hidden] { display: none !important; }
.rec__empty {
  margin: 0; padding: 18px 8px; text-align: center;
  color: var(--text-dim); font: 500 0.78rem system-ui, sans-serif;
  border: 1px dashed var(--border); border-radius: 8px;
}

/* Flow step controls: arrows stay square icons; preview/params/remove carry a
 * visible word so the action is not guesswork. */
.flow-step__btn--text {
  width: auto;
  min-width: 0;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: 600 0.72rem system-ui, sans-serif;
  white-space: nowrap;
}
.flow-step__btn--text.flow-step__btn--danger { color: #d99; }

/* Explains the mode dropdown in the Flow tab without a tooltip. */
.flow-legend {
  margin: 6px 0 0; color: var(--text-dim);
  font: 500 0.72rem/1.5 system-ui, sans-serif;
}
.flow-legend strong { color: var(--text-muted); font-weight: 600; }
@media (max-width: 640px) {
  .flow-step__btn--text { padding: 0 8px; font-size: 0.68rem; }
}

/* ===================================================== FLOW BUILDER ====
 * Save/Activate used to sit under the step list, off-screen once a flow had a
 * few rows. The toolbar is sticky, the picker previews pages on hover, and the
 * layout splits editor and preview on desktop.
 */
.card--flow { padding: 14px; }
.flow-toolbar {
  position: sticky; top: 0; z-index: 8;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  margin: -14px -14px 10px; padding: 12px 14px;
  background: var(--surface, #121212);
  border-bottom: 1px solid var(--border, #2a2a2a);
  border-radius: 12px 12px 0 0;
}
.flow-toolbar__left, .flow-toolbar__right {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.flow-toolbar__label {
  font: 700 0.68rem system-ui, sans-serif; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: .05em;
}
#flow-select { min-width: 190px; max-width: 280px; }
.flow-status { font: 600 0.7rem system-ui, sans-serif; color: var(--text-dim); }
.flow-status--active { color: var(--accent); }
.flow-status--dirty { color: var(--warning); }

.flow-layout {
  display: grid; grid-template-columns: minmax(0, 1fr) 380px;
  gap: 16px; align-items: start;
}
.flow-main { min-width: 0; }

.flow-add { position: relative; margin: 10px 0 4px; }
/* Inline, not floating: the old absolute popover overlapped the step list and
 * could fall off-screen, hiding rows. This pushes content down and scrolls
 * inside itself like a normal list. */
.flow-picker {
  position: static; margin-top: 8px;
  background: #101010; border: 1px solid var(--border, #2a2a2a);
  border-radius: 10px; padding: 8px;
  max-height: 340px; overflow: auto;
}
.flow-picker[hidden] { display: none; }
.flow-picker__search {
  width: 100%; margin-bottom: 6px;
  /* keep the search box visible while the list scrolls */
  position: sticky; top: 0; z-index: 2; background: #101010;
}
.flow-picker__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.flow-picker__item {
  width: 100%; display: flex; align-items: baseline; justify-content: space-between;
  gap: 10px; padding: 7px 9px; border: 0; border-radius: 7px;
  background: transparent; color: var(--text); cursor: pointer; text-align: left;
}
.flow-picker__item:hover, .flow-picker__item:focus-visible {
  background: rgba(52, 211, 153, .10); outline: none;
}
.flow-picker__name { font: 600 0.8rem system-ui, sans-serif; }
.flow-picker__file { color: var(--text-dim); font: 500 0.68rem ui-monospace, monospace; }
.flow-picker__hint { margin: 6px 2px 0; color: var(--text-dim); font-size: 0.68rem; }
.flow-picker__empty { padding: 10px; color: var(--text-dim); font-size: 0.76rem; }

.flow-side {
  position: sticky; top: 8px;
  border: 1px solid var(--border, #2a2a2a); border-radius: 10px;
  background: #101010; padding: 10px;
}
.flow-side__head {
  font: 700 0.72rem system-ui, sans-serif; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .05em; margin-bottom: 8px;
}
.flow-side__stage { min-height: 220px; }
.flow-side__stage > .empty {
  display: grid; place-items: center; min-height: 220px;
  color: var(--text-dim); font: 500 0.78rem system-ui, sans-serif;
}

@media (max-width: 980px) {
  .flow-layout { grid-template-columns: minmax(0, 1fr); }
  .flow-side { position: static; order: -1; }
  .flow-side__stage { min-height: 180px; }
}

/* Code-needed section inside the approval card (OTP / 2FA / verification). */
.approval-card__code {
  margin-top: 8px; padding: 8px;
  border: 1px solid #2f3a36; border-radius: 8px;
  background: rgba(52, 211, 153, .05);
}
.approval-card__code-title {
  font: 700 0.72rem system-ui, sans-serif; color: #7dd3b0;
  margin-bottom: 6px;
}
.approval-card__code-row {
  display: grid; grid-template-columns: minmax(0, 1fr) 96px; gap: 6px;
}
.approval-card__code-row .set-input {
  height: 32px; padding: 0 8px; font-size: 0.78rem;
  background: #0f0f0f; border: 1px solid #333; border-radius: 7px; color: var(--text);
}
.approval-card__code-row .set-input.is-invalid { border-color: var(--error); }
.approval-card__code-row .approval-card__btn { grid-column: 1 / -1; }
.approval-card__code-hint {
  margin: 6px 0 0; color: #8a8a8a; font-size: 0.68rem; line-height: 1.4;
}

/* Suggested value fields in the deliver panel. */
.approval-card__field { display: grid; gap: 3px; margin-bottom: 6px; }
.approval-card__field-label {
  font: 600 0.66rem system-ui, sans-serif; color: #9a9a9a;
  text-transform: uppercase; letter-spacing: .04em;
}
.approval-card__field .set-input {
  height: 30px; padding: 0 8px; font-size: 0.76rem;
  background: #0f0f0f; border: 1px solid #333; border-radius: 7px; color: var(--text);
}
.approval-card__code-step {
  color: #8a8a8a; font-size: 0.68rem; margin: -2px 0 6px;
}
.approval-card--code { border-left-color: #4ade80; }

/* Persistent pending marker on a code/value prompt. */
.approval-card__tag {
  margin-left: auto; font: 700 0.6rem system-ui, sans-serif;
  text-transform: uppercase; letter-spacing: .06em;
  color: #f5b74e; border: 1px solid #5a4318; border-radius: 999px;
  padding: 1px 6px;
}

/* ---------------------------------------------------------------- mailer --
 * Post -> SMTP / NFA / FA. The preview box reuses .post-box__frame; the
 * wrapper below just lets the iframe fill the box like the mock did.
 */
.post-box__preview {
  flex: 1;
  min-height: 0;
  display: flex;
  background: #fff;
}
.post-box__preview > .post-box__frame { flex: 1; }
.post-box__preview > .empty {
  margin: auto;
  padding: 24px;
  color: #555;
  text-align: center;
  font: 500 0.85rem system-ui, sans-serif;
}

.post-box__badge {
  font: 700 0.62rem system-ui, sans-serif;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #f5b74e;
  border: 1px solid #5a4318;
  border-radius: 999px;
  padding: 2px 8px;
}

.post-box__hint {
  margin: 0;
  color: #8a8a8a;
  font: 500 0.76rem/1.5 system-ui, sans-serif;
}

/* NFA run log */
.post-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
  font: 500 0.78rem/1.45 ui-monospace, monospace;
  color: #cfcfcf;
}
.post-steps__row {
  padding: 6px 8px;
  background: #101010;
  border: 1px solid #242424;
  border-radius: 6px;
  overflow-wrap: anywhere;
}
.post-steps__row--empty { color: #666; }

/* FA add-account row: two inputs plus a button on one line */
.post-row--add { align-items: center; }
.post-row--add .btn-deny { height: 44px; white-space: nowrap; }

@media (max-width: 900px) {
  .post-boxes { grid-template-columns: minmax(0, 1fr); }
  .post-row { flex-direction: column; }
  .post-row--add .btn-deny { width: 100%; }
}

/* ------------------------------------------------------------- GOAuth page --
 * Deliberately restrained: the page is a working surface, not a pitch. All
 * colours come from the existing palette so light/dark keep working.
 */
.page { padding: 28px 20px 88px; }
.goauth { max-width: 1180px; margin: 0 auto; }
.goauth__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.goauth__sub { margin: 6px 0 0; color: var(--text-dim, #8a8a8a); font: 500 .82rem/1.5 system-ui, sans-serif; max-width: 62ch; }
.goauth__badges { display: flex; gap: 8px; }
.goauth__badge {
  font: 700 .62rem system-ui, sans-serif; text-transform: uppercase; letter-spacing: .06em;
  color: #6ee7b7; border: 1px solid #1f6f54; border-radius: 999px; padding: 4px 10px;
}
.goauth__badge.is-warn { color: #f5b74e; border-color: #5a4318; }

.goauth__tabs { display: flex; gap: 6px; margin: 18px 0 14px; border-bottom: 1px solid #262626; }
.goauth__tab {
  appearance: none; background: none; border: 0; border-bottom: 2px solid transparent;
  color: #9a9a9a; font: 600 .82rem system-ui, sans-serif; padding: 10px 14px; cursor: pointer;
}
.goauth__tab:hover { color: var(--text, #eee); }
.goauth__tab.is-active { color: var(--text, #eee); border-bottom-color: #34d399; }
.goauth__count {
  display: inline-block; min-width: 18px; margin-left: 6px; padding: 0 5px;
  border-radius: 999px; background: #232323; color: #cfcfcf; font: 700 .62rem system-ui;
}
.goauth__pane { display: none; }
.goauth__pane.is-active { display: block; }

.goauth__grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.goauth__row { display: flex; gap: 8px; }
.goauth__status {
  margin-top: 12px; padding: 8px 10px; border: 1px solid #24442f; background: #0f1a14;
  border-radius: 8px; color: #8ee0b3; font: 600 .76rem system-ui, sans-serif;
}
.goauth__status.is-warn { color: #f5b74e; border-color: #5a4318; background: #1a1509; }

.goauth__browser { display: flex; }
.goauth__frame { flex: 1; display: flex; flex-direction: column; border: 1px solid #242424; border-radius: 10px; overflow: hidden; min-height: 300px; }
.goauth__frame-bar { display: flex; align-items: center; gap: 5px; padding: 8px 10px; background: #101010; border-bottom: 1px solid #242424; }
.goauth__frame-bar i { width: 8px; height: 8px; border-radius: 50%; background: #333; }
.goauth__frame-bar span { margin-left: 8px; color: #7a7a7a; font: 500 .7rem ui-monospace, monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.goauth__frame-body { flex: 1; display: grid; place-items: center; padding: 20px; background: #0c0c0c; }
.goauth__placeholder { text-align: center; color: #6f6f6f; max-width: 34ch; display: grid; gap: 6px; justify-items: center; }
.goauth__placeholder svg { width: 34px; height: 34px; stroke: currentColor; fill: none; stroke-width: 1.5; }
.goauth__placeholder strong { color: #bdbdbd; font: 600 .85rem system-ui, sans-serif; }
.goauth__placeholder span { font: 500 .74rem/1.5 system-ui, sans-serif; }

.goauth__accounts-head { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.goauth__search { flex: 1; min-width: 220px; }
.goauth__accounts { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.goauth__card { border: 1px solid #262626; border-radius: 10px; background: #121212; padding: 12px; display: grid; gap: 10px; }
.goauth__card-head { display: flex; align-items: center; gap: 10px; }
.goauth__avatar {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: #1b2a22; color: #6ee7b7; font: 700 .8rem system-ui;
}
.goauth__card-info { display: grid; min-width: 0; }
.goauth__email { font: 600 .84rem system-ui, sans-serif; overflow-wrap: anywhere; }
.goauth__kind { color: #7f7f7f; font: 500 .68rem system-ui, sans-serif; }
.goauth__card-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.goauth__empty { grid-column: 1 / -1; padding: 34px 16px; text-align: center; border: 1px dashed #2a2a2a; border-radius: 10px; color: #7f7f7f; display: grid; gap: 6px; }
.goauth__empty strong { color: #c9c9c9; font: 600 .85rem system-ui; }
.goauth__empty span { font: 500 .75rem system-ui; }

.goauth__mail-from { margin: 0 0 10px; color: #8a8a8a; font: 500 .78rem system-ui; }
.goauth__textarea { height: auto; min-height: 120px; padding: 10px 14px; resize: vertical; font-family: inherit; }
.goauth__scopes { display: grid; gap: 8px; max-height: 60vh; overflow: auto; }
.goauth__scope { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; padding: 8px 10px; border: 1px solid #262626; border-radius: 8px; }
.goauth__scope-info { display: grid; min-width: 0; }
.goauth__scope-info strong { font: 600 .78rem system-ui; }
.goauth__scope-info span { color: #777; font: 500 .66rem ui-monospace, monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.goauth__scope-out { grid-column: 1 / -1; height: 34px; font: 500 .7rem ui-monospace, monospace; }

@media (max-width: 900px) {
  .goauth__grid { grid-template-columns: minmax(0, 1fr); }
}

/* ------------------------------------------------------- Admin: NFA pool -- */
.nfa-assign { display: grid; gap: 10px; padding: 4px 2px; }
.nfa-assign__row { display: flex; align-items: center; gap: 12px; }
.nfa-assign__label { min-width: 170px; font: 600 .8rem system-ui, sans-serif; }
.nfa-assign__row select { flex: 1; max-width: 380px; height: 38px; }

.nfa-add { display: grid; gap: 10px; }
.nfa-add textarea {
  width: 100%; min-height: 84px; padding: 10px 12px; resize: vertical;
  background: #161616; color: var(--text); border: 1px solid #2a2a2a; border-radius: 8px;
  font: 500 .78rem/1.5 ui-monospace, monospace;
}
.nfa-add--row { grid-auto-flow: column; grid-template-columns: minmax(0,1fr) minmax(0,1.4fr) auto; align-items: center; }
.nfa-add--row input {
  height: 40px; padding: 0 12px; background: #161616; color: var(--text);
  border: 1px solid #2a2a2a; border-radius: 8px; font: 500 .8rem system-ui, sans-serif;
}
.nfa-status { height: 32px; padding: 0 8px; background: #161616; color: var(--text); border: 1px solid #2a2a2a; border-radius: 6px; font: 500 .76rem system-ui; }
.nfa-muted { color: #8a8a8a; font: 500 .74rem system-ui; overflow-wrap: anywhere; }
.nfa-empty { text-align: center; color: #7f7f7f; padding: 22px 12px; font: 500 .8rem system-ui; }

@media (max-width: 820px) {
  .nfa-add--row { grid-auto-flow: row; grid-template-columns: minmax(0,1fr); }
  .nfa-assign__row { flex-direction: column; align-items: stretch; }
}

/* Collapsible "add sender" block on the Post page. */
.post-add { border: 1px solid #262626; border-radius: 8px; padding: 8px 10px; background: #101010; }
.post-add > summary { cursor: pointer; color: #bdbdbd; font: 600 .78rem system-ui, sans-serif; }
.post-add > summary::marker { color: #6ee7b7; }
.post-add__body { display: grid; gap: 8px; margin-top: 10px; }
.post-add__body .post-input { height: 38px; }
