/* vbrowser embedded admin UI — no external assets, no framework. */

:root {
  color-scheme: light;
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Consolas,
    "Liberation Mono", monospace;

  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --surface-3: #edf1f7;
  --surface-glass: rgba(255, 255, 255, 0.82);
  --text: #172033;
  --muted: #68758a;
  --border: #dfe5ee;
  --border-strong: #c7d1e0;
  --accent: #3b6cf6;
  --accent-hover: #2e5ce4;
  --accent-contrast: #ffffff;
  --accent-soft: #eaf0ff;
  --success: #117a58;
  --success-soft: #e6f7f0;
  --warning: #9a5a00;
  --warning-soft: #fff4de;
  --danger: #c33b4b;
  --danger-hover: #ad2f3e;
  --danger-soft: #fdecef;
  --info: #0a6a99;
  --info-soft: #e5f5fd;

  --shadow-sm: 0 1px 2px rgba(17, 28, 45, 0.05);
  --shadow-md: 0 12px 32px rgba(17, 28, 45, 0.11);
  --shadow-lg: 0 28px 70px rgba(13, 22, 38, 0.22);
  --focus-ring: 0 0 0 3px rgba(59, 108, 246, 0.26);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --sidebar-width: 264px;
  --topbar-height: 64px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0d1118;
    --surface: #151b24;
    --surface-2: #1a2230;
    --surface-3: #222c3b;
    --surface-glass: rgba(21, 27, 36, 0.82);
    --text: #e9eef7;
    --muted: #98a6ba;
    --border: #2a3444;
    --border-strong: #3a4960;
    --accent: #7496ff;
    --accent-hover: #8ca8ff;
    --accent-contrast: #0b1220;
    --accent-soft: #1c2946;
    --success: #52d3a4;
    --success-soft: #123127;
    --warning: #f2b95b;
    --warning-soft: #352811;
    --danger: #ff8494;
    --danger-hover: #ff9faa;
    --danger-soft: #3a1b22;
    --info: #6fc8ef;
    --info-soft: #102e3e;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.28);
    --shadow-md: 0 16px 40px rgba(0, 0, 0, 0.38);
    --shadow-lg: 0 30px 80px rgba(0, 0, 0, 0.55);
    --focus-ring: 0 0 0 3px rgba(116, 150, 255, 0.35);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1118;
  --surface: #151b24;
  --surface-2: #1a2230;
  --surface-3: #222c3b;
  --surface-glass: rgba(21, 27, 36, 0.82);
  --text: #e9eef7;
  --muted: #98a6ba;
  --border: #2a3444;
  --border-strong: #3a4960;
  --accent: #7496ff;
  --accent-hover: #8ca8ff;
  --accent-contrast: #0b1220;
  --accent-soft: #1c2946;
  --success: #52d3a4;
  --success-soft: #123127;
  --warning: #f2b95b;
  --warning-soft: #352811;
  --danger: #ff8494;
  --danger-hover: #ff9faa;
  --danger-soft: #3a1b22;
  --info: #6fc8ef;
  --info-soft: #102e3e;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.28);
  --shadow-md: 0 16px 40px rgba(0, 0, 0, 0.38);
  --shadow-lg: 0 30px 80px rgba(0, 0, 0, 0.55);
  --focus-ring: 0 0 0 3px rgba(116, 150, 255, 0.35);
}

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

[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1,
h2,
h3,
h4,
p,
dl,
dd,
dt,
figure {
  margin: 0;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

::selection {
  background: var(--accent);
  color: var(--accent-contrast);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

:focus:not(:focus-visible) {
  outline: none;
}

.icon {
  width: 1.25em;
  height: 1.25em;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  overflow: visible;
}

.mono,
code,
kbd {
  font-family: var(--font-mono);
}

code {
  font-size: 0.92em;
}

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

/* --------------------------------------------------------------------------
 * Buttons
 * ----------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.15s ease;
}

.btn:hover {
  text-decoration: none;
}

.btn .icon {
  width: 17px;
  height: 17px;
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
  box-shadow: 0 5px 14px rgba(59, 108, 246, 0.22);
}

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

.btn.secondary {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.btn.secondary:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
}

.btn.danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

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

.btn.danger-ghost {
  color: var(--danger);
  background: transparent;
  border-color: transparent;
}

.btn.danger-ghost:hover {
  background: var(--danger-soft);
}

.btn.icon-btn {
  width: 38px;
  min-width: 38px;
  padding: 0;
}

.btn.btn-sm {
  min-height: 32px;
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 12.5px;
}

.btn.btn-sm .icon {
  width: 15px;
  height: 15px;
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
  transform: none;
  box-shadow: none;
}

.theme-toggle {
  color: var(--muted);
}

/* --------------------------------------------------------------------------
 * App shell, sidebar and topbar
 * ----------------------------------------------------------------------- */

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
}

.app-sidebar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  padding: 18px 13px 14px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 4px 10px 20px;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border-radius: 12px;
  color: #fff;
  background:
    radial-gradient(circle at 28% 20%, rgba(255, 255, 255, 0.28), transparent 46%),
    linear-gradient(145deg, #4c7bff, #3157d8);
  box-shadow: 0 7px 18px rgba(59, 108, 246, 0.3);
}

.brand-mark .icon {
  width: 23px;
  height: 23px;
  stroke-width: 1.9;
}

.brand-mark-lg {
  width: 58px;
  height: 58px;
  border-radius: 17px;
}

.brand-mark-lg .icon {
  width: 33px;
  height: 33px;
}

.brand-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  line-height: 1.25;
}

.brand-copy strong {
  font-size: 16px;
  letter-spacing: -0.015em;
}

.brand-copy span {
  color: var(--muted);
  font-size: 11.5px;
}

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 42px;
  padding: 9px 11px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 550;
  text-decoration: none;
  transition:
    background-color 0.15s ease,
    color 0.15s ease;
}

.nav-item .icon {
  width: 19px;
  height: 19px;
  opacity: 0.9;
}

.nav-item:hover {
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
}

.nav-item[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 650;
}

.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.sidebar-section-title {
  padding: 0 11px 8px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: auto;
  padding-top: 18px;
}

.sidebar-user {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
  transition:
    border-color 0.15s ease,
    background-color 0.15s ease;
}

.sidebar-user-card:hover {
  border-color: var(--border-strong);
  background: var(--surface-3);
  text-decoration: none;
}

.sidebar-user-card > .icon {
  width: 15px;
  height: 15px;
  color: var(--muted);
}

.sidebar-user-copy {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: 2px;
}

.sidebar-user-name {
  overflow: hidden;
  font-size: 13px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user-login {
  overflow: hidden;
  color: var(--muted);
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user-copy .badge {
  align-self: flex-start;
  margin-top: 2px;
}

.sidebar-logout {
  width: 100%;
  justify-content: flex-start;
  min-height: 34px;
  padding: 6px 11px;
  background: transparent;
  box-shadow: none;
  color: var(--muted);
}

.sidebar-logout:hover {
  color: var(--danger);
  border-color: var(--border);
  background: var(--danger-soft);
}

.sidebar-version {
  padding: 0 11px;
  color: var(--muted);
  font-size: 10.5px;
  opacity: 0.75;
}

.app-main {
  display: flex;
  min-width: 0;
  min-height: 100vh;
  min-height: 100dvh;
  flex-direction: column;
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--topbar-height);
  padding: 10px 26px;
  background: var(--surface-glass);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.menu-toggle {
  display: none;
}

.topbar-title {
  min-width: 0;
  overflow: hidden;
  font-size: 14px;
  font-weight: 650;
  letter-spacing: -0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.theme-host {
  display: flex;
  align-items: center;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 7px 4px 4px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--text);
  text-decoration: none;
}

.topbar-user:hover {
  background: var(--surface-2);
  border-color: var(--border);
  text-decoration: none;
}

.topbar-user-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.topbar-user-name {
  max-width: 160px;
  overflow: hidden;
  font-size: 12.5px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-user-role {
  color: var(--muted);
  font-size: 10.5px;
}

.app-outlet {
  flex: 1;
  min-height: 0;
  padding: 30px 32px 48px;
}

.app-outlet:focus {
  outline: none;
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 28;
  background: rgba(7, 12, 22, 0.55);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

/* Bare routes: login, viewer, 404 */
.route-bare .app-shell {
  grid-template-columns: minmax(0, 1fr);
}

.route-bare .app-sidebar,
.route-bare .app-topbar,
.route-bare .sidebar-backdrop {
  display: none;
}

.route-bare .app-main {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
}

.route-bare .app-outlet {
  height: 100%;
  padding: 0;
  overflow: auto;
}

body.sidebar-open {
  overflow: hidden;
}

/* --------------------------------------------------------------------------
 * Boot / no-script / route fallback
 * ----------------------------------------------------------------------- */

.boot-screen {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 15%, rgba(59, 108, 246, 0.13), transparent 38%),
    radial-gradient(circle at 80% 85%, rgba(20, 160, 120, 0.1), transparent 42%),
    var(--bg);
}

.boot-card {
  display: flex;
  width: min(360px, 100%);
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 34px 30px;
  text-align: center;
}

.boot-title {
  font-size: 25px;
  letter-spacing: -0.03em;
}

.boot-message {
  color: var(--muted);
  font-size: 13px;
}

.boot-card .spinner {
  margin-top: 6px;
}

.boot-card-error {
  width: min(520px, 100%);
  padding: 0;
}

.boot-card-error .error-state {
  width: 100%;
}

.noscript-card {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-content: center;
  gap: 10px;
  padding: 30px;
  background: var(--bg);
  text-align: center;
}

.noscript-card h1 {
  font-size: 24px;
}

.noscript-card p {
  color: var(--muted);
}

.route-fallback {
  display: flex;
  min-height: 70vh;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px 20px;
  text-align: center;
}

.route-bare .route-fallback {
  min-height: 100vh;
}

/* --------------------------------------------------------------------------
 * Page, cards, badges and common blocks
 * ----------------------------------------------------------------------- */

.page {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  animation: page-in 0.18s ease both;
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

.page-header-copy {
  min-width: 0;
}

.eyebrow {
  margin-bottom: 5px;
  color: var(--accent);
  font-size: 10.5px;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.page-title {
  font-size: clamp(23px, 2.2vw, 30px);
  font-weight: 720;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.page-subtitle {
  max-width: 760px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 13.5px;
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.card-padded {
  padding: 21px;
}

.card-heading {
  margin-bottom: 16px;
}

.card-heading-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.card-title {
  font-size: 15.5px;
  font-weight: 680;
  letter-spacing: -0.015em;
}

.card-subtitle {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12.5px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 22px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  line-height: 1.2;
  white-space: nowrap;
}

.badge .icon {
  width: 13px;
  height: 13px;
}

.badge-dot {
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: currentColor;
}

.badge-success {
  background: var(--success-soft);
  color: var(--success);
}

.badge-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.badge-warning {
  background: var(--warning-soft);
  color: var(--warning);
}

.badge-info {
  background: var(--info-soft);
  color: var(--info);
}

.badge-accent {
  background: var(--accent-soft);
  color: var(--accent);
}

.badge-neutral {
  background: var(--surface-3);
  color: var(--muted);
}

.status-badge {
  font-variant-numeric: tabular-nums;
}

.status-badge.status-running .badge-dot {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 18%, transparent);
}

.avatar {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--accent-soft), var(--surface-3));
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 750;
  letter-spacing: 0.02em;
  user-select: none;
}

.avatar-xs {
  width: 28px;
  height: 28px;
  font-size: 9.5px;
}

.avatar-sm {
  width: 31px;
  height: 31px;
  font-size: 10.5px;
}

.avatar-md {
  width: 42px;
  height: 42px;
  font-size: 13px;
}

.avatar-lg {
  width: 62px;
  height: 62px;
  font-size: 19px;
}

.notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  font-size: 12.5px;
}

.notice > .icon {
  width: 17px;
  height: 17px;
  margin-top: 1px;
}

.notice p {
  margin: 0;
}

.notice strong {
  display: block;
  margin-bottom: 2px;
}

.notice-warning {
  border-color: color-mix(in srgb, var(--warning) 30%, var(--border));
  background: var(--warning-soft);
  color: var(--warning);
}

.notice-danger {
  border-color: color-mix(in srgb, var(--danger) 30%, var(--border));
  background: var(--danger-soft);
  color: var(--danger);
}

.notice-success {
  border-color: color-mix(in srgb, var(--success) 30%, var(--border));
  background: var(--success-soft);
  color: var(--success);
}

.notice-info {
  border-color: color-mix(in srgb, var(--info) 30%, var(--border));
  background: var(--info-soft);
  color: var(--info);
}

.notice-lg {
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 18px;
  padding: 18px;
  font-size: 13.5px;
}

.notice-lg > .icon {
  width: 22px;
  height: 22px;
}

.progress {
  position: relative;
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-3);
}

.progress-bar {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 60%, #8b5cf6));
  transition: width 0.35s ease;
}

/* --------------------------------------------------------------------------
 * Forms
 * ----------------------------------------------------------------------- */

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

.field-label {
  display: flex;
  align-items: baseline;
  gap: 4px;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 650;
}

.required-mark {
  color: var(--danger);
}

.field-hint {
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.4;
}

.field-error {
  color: var(--danger);
  font-size: 11.5px;
}

.field-invalid .input {
  border-color: var(--danger);
}

.input {
  width: 100%;
  min-width: 0;
  height: 42px;
  padding: 8px 11px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    background-color 0.15s ease;
}

.input::placeholder {
  color: var(--muted);
  opacity: 0.72;
}

.input:hover {
  border-color: color-mix(in srgb, var(--border-strong) 70%, var(--text));
}

.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

.input:disabled {
  background: var(--surface-3);
  color: var(--muted);
  cursor: not-allowed;
}

textarea.input {
  height: auto;
  min-height: 92px;
  padding: 10px 11px;
  resize: vertical;
  line-height: 1.45;
}

.select {
  padding-right: 32px;
}

.input-with-action {
  position: relative;
}

.input-with-action .input {
  padding-right: 44px;
}

.input-reveal {
  position: absolute;
  top: 50%;
  right: 5px;
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transform: translateY(-50%);
}

.input-reveal:hover {
  background: var(--surface-2);
  color: var(--text);
}

.input-reveal .icon {
  width: 18px;
  height: 18px;
}

.form-grid {
  display: grid;
  gap: 14px;
}

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

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 4px;
}

.dialog-form,
.profile-form,
.login-form {
  display: grid;
  gap: 15px;
}

.dialog-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 6px;
}

.form-error {
  padding: 9px 11px;
  border: 1px solid color-mix(in srgb, var(--danger) 32%, var(--border));
  border-radius: 9px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 12px;
}

.switch-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 11px 0;
  cursor: pointer;
}

.switch-row input[role="switch"] {
  position: relative;
  width: 42px;
  height: 24px;
  flex: 0 0 auto;
  margin: 1px 0 0;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface-3);
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease;
}

.switch-row input[role="switch"]::before {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  content: "";
  transition: transform 0.16s ease;
}

.switch-row input[role="switch"]:checked {
  border-color: var(--accent);
  background: var(--accent);
}

.switch-row input[role="switch"]:checked::before {
  transform: translateX(18px);
}

.switch-row input[role="switch"]:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.switch-row span {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* --------------------------------------------------------------------------
 * Dialogs, toasts, states, skeletons
 * ----------------------------------------------------------------------- */

dialog.modal {
  width: min(600px, calc(100vw - 32px));
  max-height: min(90vh, 880px);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}

dialog.modal[open] {
  display: flex;
  flex-direction: column;
  animation: dialog-in 0.16s ease both;
}

dialog.modal::backdrop {
  background: rgba(7, 12, 22, 0.58);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

dialog.modal-sm {
  width: min(440px, calc(100vw - 32px));
}

dialog.modal-md {
  width: min(620px, calc(100vw - 32px));
}

dialog.modal-lg {
  width: min(780px, calc(100vw - 32px));
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 17px 20px;
  border-bottom: 1px solid var(--border);
}

.dialog-title {
  font-size: 16px;
  font-weight: 680;
  letter-spacing: -0.015em;
}

.dialog-close {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.dialog-close:hover {
  background: var(--surface-2);
  color: var(--text);
}

.dialog-close .icon {
  width: 18px;
  height: 18px;
}

.dialog-body {
  min-height: 0;
  padding: 20px;
  overflow-y: auto;
}

.dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

.confirm-message {
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.55;
  white-space: pre-line;
}

.toast-stack {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));
  z-index: 500;
  display: flex;
  width: min(390px, calc(100vw - 32px));
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 11px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
  color: var(--text);
  font-size: 12.5px;
  pointer-events: auto;
  animation: toast-in 0.2s ease both;
}

.toast > .icon {
  width: 17px;
  height: 17px;
  margin-top: 1px;
  color: var(--accent);
}

.toast-success {
  border-left-color: var(--success);
}

.toast-success > .icon {
  color: var(--success);
}

.toast-error {
  border-left-color: var(--danger);
}

.toast-error > .icon {
  color: var(--danger);
}

.toast-warning {
  border-left-color: var(--warning);
}

.toast-warning > .icon {
  color: var(--warning);
}

.toast-info {
  border-left-color: var(--info);
}

.toast-info > .icon {
  color: var(--info);
}

.toast-message {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.toast-close {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.toast-close:hover {
  background: var(--surface-2);
  color: var(--text);
}

.toast-close .icon {
  width: 14px;
  height: 14px;
}

.toast-leaving {
  opacity: 0;
  transform: translateX(10px);
  transition:
    opacity 0.18s ease,
    transform 0.18s ease;
}

.empty-state,
.error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 46px 24px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
  text-align: center;
}

.error-state {
  border-color: color-mix(in srgb, var(--danger) 30%, var(--border));
  background: var(--danger-soft);
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-bottom: 4px;
  border-radius: 15px;
  background: var(--surface-3);
  color: var(--muted);
}

.empty-icon .icon {
  width: 24px;
  height: 24px;
}

.error-state .empty-icon {
  background: color-mix(in srgb, var(--danger) 14%, var(--surface));
  color: var(--danger);
}

.empty-title {
  font-size: 15px;
  font-weight: 680;
}

.empty-message {
  max-width: 520px;
  color: var(--muted);
  font-size: 12.5px;
}

.empty-state .btn,
.error-state .btn {
  margin-top: 8px;
}

.skeleton {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: 7px;
  background: var(--surface-3);
}

.skeleton::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent,
    color-mix(in srgb, var(--surface) 68%, transparent),
    transparent
  );
  content: "";
  transform: translateX(-100%);
  animation: shimmer 1.35s infinite;
}

.skeleton-line {
  height: 10px;
}

.skeleton-list {
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.skeleton-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.skeleton-card .skeleton-line:first-child {
  height: 14px;
}

.spinner {
  display: inline-block;
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  border: 2px solid color-mix(in srgb, currentColor 26%, transparent);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.spinner-lg {
  width: 26px;
  height: 26px;
  border-width: 2.5px;
}

.clipboard-fallback {
  position: fixed;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
}

/* --------------------------------------------------------------------------
 * Definition lists, tables and inline code
 * ----------------------------------------------------------------------- */

.definition-list {
  display: flex;
  flex-direction: column;
}

.definition-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
}

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

.definition-row:first-child {
  padding-top: 0;
}

.definition-row dt {
  flex: 0 0 auto;
  color: var(--muted);
}

.definition-row dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  text-align: right;
}

.definition-row-wrap {
  align-items: flex-start;
}

.definition-list.compact .definition-row {
  padding: 6px 0;
  font-size: 12px;
}

.inline-code,
.audit-action,
.audit-target {
  padding: 2px 5px;
  border-radius: 5px;
  background: var(--surface-3);
  color: var(--text);
  overflow-wrap: anywhere;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
  border-radius: inherit;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

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

.data-table tbody tr:hover {
  background: color-mix(in srgb, var(--surface-2) 70%, transparent);
}

.users-table-host > .empty-state,
.users-table-host > .error-state {
  margin: 16px;
}

/* --------------------------------------------------------------------------
 * Login
 * ----------------------------------------------------------------------- */

.login-page {
  position: relative;
  display: grid;
  min-height: 100vh;
  min-height: 100dvh;
  place-items: center;
  overflow: hidden;
  padding: max(24px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
  background:
    radial-gradient(circle at 15% 10%, rgba(59, 108, 246, 0.12), transparent 42%),
    radial-gradient(circle at 88% 90%, rgba(16, 160, 120, 0.1), transparent 44%),
    var(--bg);
}

.login-glow {
  position: absolute;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.25;
  pointer-events: none;
}

.login-glow-one {
  top: -180px;
  left: -120px;
  background: var(--accent);
}

.login-glow-two {
  right: -160px;
  bottom: -220px;
  background: #19a57e;
}

.login-theme {
  position: absolute;
  top: max(18px, env(safe-area-inset-top));
  right: max(18px, env(safe-area-inset-right));
  z-index: 2;
}

.login-card {
  position: relative;
  z-index: 1;
  width: min(440px, 100%);
  padding: clamp(24px, 5vw, 36px);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  animation: page-in 0.24s ease both;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}

.login-title {
  font-size: 23px;
  font-weight: 740;
  letter-spacing: -0.035em;
  line-height: 1.1;
}

.login-subtitle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12.5px;
}

.login-form {
  gap: 17px;
}

.login-submit {
  width: 100%;
  min-height: 44px;
  margin-top: 2px;
}

.login-footnote {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 24px;
  padding-top: 17px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.login-footnote .icon {
  width: 15px;
  height: 15px;
  margin-top: 1px;
}

/* --------------------------------------------------------------------------
 * Dashboard
 * ----------------------------------------------------------------------- */

.dashboard-page {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.dashboard-page .page-header {
  margin-bottom: 2px;
}

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

.metric-card {
  display: flex;
  min-height: 118px;
  flex-direction: column;
  gap: 6px;
  padding: 17px;
}

.metric-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.metric-label {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
}

.metric-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--muted);
}

.metric-icon .icon {
  width: 16px;
  height: 16px;
}

.metric-accent .metric-icon {
  background: var(--accent-soft);
  color: var(--accent);
}

.metric-value {
  margin-top: auto;
  font-size: clamp(21px, 2vw, 27px);
  font-weight: 720;
  letter-spacing: -0.03em;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.metric-hint {
  color: var(--muted);
  font-size: 10.5px;
}

.metric-card.skeleton-card {
  min-height: 118px;
  background:
    linear-gradient(
      100deg,
      transparent 20%,
      color-mix(in srgb, var(--surface) 65%, transparent) 45%,
      transparent 70%
    ),
    var(--surface-3);
  background-size: 220% 100%;
  animation: shimmer-bg 1.4s linear infinite;
}

.sessions-host {
  min-height: 120px;
}

.sessions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr));
  gap: 16px;
}

.session-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    transform 0.16s ease;
}

.session-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

.session-crashed {
  border-color: color-mix(in srgb, var(--danger) 35%, var(--border));
}

.session-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.session-title-block {
  min-width: 0;
}

.session-name {
  overflow: hidden;
  font-size: 15.5px;
  font-weight: 680;
  letter-spacing: -0.015em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
}

.egress-badge {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
}

.egress-badge > .icon {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}

.egress-badge-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  line-height: 1.3;
}

.egress-badge-name {
  overflow: hidden;
  color: var(--text);
  font-size: 11.5px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.egress-badge-detail {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.egress-direct {
  color: var(--muted);
}

.egress-up {
  border-color: color-mix(in srgb, var(--success) 25%, var(--border));
  background: color-mix(in srgb, var(--success-soft) 62%, var(--surface));
}

.egress-up > .icon {
  color: var(--success);
}

.egress-down {
  border-color: color-mix(in srgb, var(--danger) 32%, var(--border));
  background: var(--danger-soft);
  color: var(--danger);
}

.egress-down .egress-badge-name {
  color: var(--danger);
}

.egress-down .egress-badge-detail {
  color: color-mix(in srgb, var(--danger) 78%, var(--muted));
}

.session-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.session-stat {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
  padding: 8px 9px;
  border-radius: 9px;
  background: var(--surface-2);
}

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

.session-stat-value {
  overflow: hidden;
  font-size: 12px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.session-tabs {
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
}

.session-tabs-empty {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 11.5px;
}

.session-tabs-empty .icon {
  width: 15px;
  height: 15px;
}

.session-tabs-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.tab-count {
  display: inline-grid;
  min-width: 18px;
  height: 18px;
  place-items: center;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--surface-3);
  font-size: 9.5px;
  letter-spacing: 0;
}

.tab-list {
  display: flex;
  max-height: 112px;
  flex-direction: column;
  gap: 1px;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
  scrollbar-width: thin;
}

.tab-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1px;
  padding: 5px 6px;
  border-radius: 6px;
}

.tab-item.is-active {
  background: var(--surface);
}

.tab-title {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 5px;
  overflow: hidden;
  color: var(--text);
  font-size: 11.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tab-title .icon {
  width: 11px;
  height: 11px;
  color: var(--accent);
}

.tab-url {
  overflow: hidden;
  color: var(--muted);
  font-size: 9.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 13px;
  border-top: 1px solid var(--border);
}

.session-time {
  min-width: 0;
  overflow: hidden;
  font-size: 10.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
}

/* --------------------------------------------------------------------------
 * Viewer
 * ----------------------------------------------------------------------- */

.viewer-page {
  /* The viewing surface is intentionally dark in both themes. */
  --surface: #141a23;
  --surface-2: #1a222e;
  --surface-3: #233041;
  --surface-glass: rgba(20, 26, 35, 0.86);
  --text: #e9eef7;
  --muted: #96a5ba;
  --border: #293445;
  --border-strong: #3b4b62;
  --accent: #7d9dff;
  --accent-hover: #97b0ff;
  --accent-contrast: #0b1220;
  --accent-soft: #1d2a46;
  --success: #58d7aa;
  --success-soft: #153329;
  --warning: #f5bd63;
  --warning-soft: #362a16;
  --danger: #ff8a99;
  --danger-hover: #ffa4b0;
  --danger-soft: #3a1c23;
  --info: #74ccef;
  --info-soft: #112f3d;
  color-scheme: dark;

  display: flex;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 0, rgba(90, 120, 200, 0.12), transparent 46%),
    #090c11;
  color: var(--text);
}

.viewer-page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.viewer-page-head-main {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 11px;
}

.viewer-back {
  color: var(--muted);
  flex: 0 0 auto;
}

.viewer-page-titles {
  min-width: 0;
}

.viewer-page-title {
  overflow: hidden;
  font-size: 14.5px;
  font-weight: 680;
  letter-spacing: -0.015em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viewer-page-subtitle {
  overflow: hidden;
  font-size: 9.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: 0.75;
}

.viewer-page-status {
  flex: 0 0 auto;
}

.viewer-page-head-side {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.viewer-page-egress {
  display: flex;
  min-width: 0;
}

.viewer-page-egress .egress-badge {
  max-width: 270px;
}

.viewer-page-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.viewer-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.viewer-meta-item .icon {
  width: 13px;
  height: 13px;
}

.viewer-page-body {
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  gap: 10px;
  padding: 12px 16px 16px;
  overflow: hidden;
}

.viewer-page-body > .notice {
  flex: 0 0 auto;
}

.viewer-page-body > .empty-state,
.viewer-page-body > .error-state {
  flex: 1;
  overflow-y: auto;
}

.viewer-mount {
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
}

.viewer-loading {
  display: flex;
  min-height: 240px;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.viewer-shell {
  display: flex;
  width: 100%;
  height: 100%;
  min-height: 0;
  flex-direction: column;
  gap: 9px;
  overflow: hidden;
}

.viewer-statusbar {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface);
}

.viewer-chips {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.viewer-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 25px;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.viewer-chip .icon {
  width: 12px;
  height: 12px;
  opacity: 0.8;
}

.viewer-chip-value {
  color: var(--text);
  font-weight: 600;
}

.viewer-connection {
  gap: 5px;
}

.viewer-chip-dot {
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--warning);
}

.viewer-connection[data-state="connected"] {
  border-color: color-mix(in srgb, var(--success) 28%, var(--border));
  background: var(--success-soft);
}

.viewer-connection[data-state="connected"] .viewer-chip-dot {
  background: var(--success);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 18%, transparent);
}

.viewer-connection[data-state="error"] {
  border-color: color-mix(in srgb, var(--danger) 30%, var(--border));
  background: var(--danger-soft);
}

.viewer-connection[data-state="error"] .viewer-chip-dot {
  background: var(--danger);
}

.viewer-connection[data-state="idle"] .viewer-chip-dot {
  background: var(--muted);
}

.viewer-toolbar-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 4px;
}

.viewer-tool-btn {
  color: var(--muted);
  background: transparent;
  border-color: transparent;
}

.viewer-tool-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.viewer-explorer-btn {
  min-height: 30px;
  padding: 4px 9px;
  border-color: var(--border);
  font-size: 10.5px;
  white-space: nowrap;
}

.viewer-explorer-btn:hover {
  background: var(--surface-2);
}

.viewer-stop-btn {
  min-height: 30px;
  padding: 4px 9px;
  border-color: var(--border);
  color: var(--danger, #c2410c);
  font-size: 10.5px;
  white-space: nowrap;
}

.viewer-stop-btn:hover:not(:disabled) {
  background: var(--surface-2);
}

.viewer-stop-btn[hidden] {
  display: none;
}

.viewer-explorer-btn[aria-pressed="false"] {
  color: var(--muted);
  background: transparent;
}

.viewer-quick-title {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 4px;
  padding: 0 7px 0 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.viewer-quick-title .icon {
  width: 12px;
  height: 12px;
}

.viewer-screen {
  position: relative;
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #000;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

.viewer-stage {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
}

.viewer-video,
.viewer-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.viewer-input-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  touch-action: none;
  /* The cursor is local: the pointer must never wait for video round-trip. */
  cursor: default;
  outline: none;
  user-select: none;
  -webkit-user-select: none;
  overscroll-behavior: contain;
}

.viewer-input-overlay:focus-visible,
.viewer-input-overlay:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: -4px;
}

/* Focus target that turns browser paste events into remote text input. */
.viewer-clipboard-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  padding: 0;
  border: 0;
  opacity: 0;
  overflow: hidden;
  resize: none;
  pointer-events: none;
  font-size: 16px;
  caret-color: transparent;
}

.viewer-input-overlay.is-readonly {
  cursor: default;
  pointer-events: none;
}

.viewer-readonly-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  border: 1px solid color-mix(in srgb, var(--warning) 32%, var(--border));
  border-radius: 999px;
  background: color-mix(in srgb, var(--warning-soft) 86%, transparent);
  color: var(--warning);
  font-size: 10px;
  font-weight: 650;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.viewer-readonly-badge .icon {
  width: 13px;
  height: 13px;
}

.viewer-cover {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 20%, rgba(90, 120, 200, 0.12), transparent 55%),
    rgba(7, 10, 15, 0.76);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.viewer-cover-card {
  display: flex;
  width: min(480px, 100%);
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 26px 22px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.viewer-cover-icon {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  margin-bottom: 3px;
  border-radius: 15px;
  background: var(--surface-3);
  color: var(--muted);
}

.viewer-cover-icon .icon {
  width: 25px;
  height: 25px;
}

.viewer-cover-danger .viewer-cover-icon {
  background: var(--danger-soft);
  color: var(--danger);
}

.viewer-cover-spinner {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  color: var(--accent);
}

.viewer-cover-title {
  font-size: 16.5px;
  font-weight: 690;
  letter-spacing: -0.02em;
}

.viewer-cover-message {
  max-width: 390px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.viewer-cover-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
  margin-top: 8px;
}

.viewer-input-hint {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 10.5px;
  text-align: center;
  opacity: 0.8;
}

.viewer-quick-panel {
  display: flex;
  flex: 0 0 auto;
  gap: 5px;
  padding: 3px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.quick-action {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 10.5px;
  cursor: pointer;
  transition:
    background-color 0.14s ease,
    border-color 0.14s ease;
}

.quick-action:hover:not(:disabled) {
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.quick-action:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.quick-action .icon {
  width: 14px;
  height: 14px;
  color: var(--muted);
}

.quick-action-label {
  white-space: nowrap;
}

.quick-action-hint {
  padding: 1px 4px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 8.5px;
  letter-spacing: 0.02em;
}

.viewer-shell:fullscreen {
  width: 100vw;
  height: 100vh;
  padding: 8px;
  background: #000;
}

.viewer-shell:fullscreen .viewer-screen {
  border-color: #151d28;
  border-radius: 4px;
}

.viewer-shell:fullscreen .viewer-input-hint {
  opacity: 0.55;
}

.viewer-page .badge-neutral {
  background: var(--surface-3);
  color: var(--muted);
}

/* --------------------------------------------------------------------------
 * Users
 * ----------------------------------------------------------------------- */

.users-page .card {
  overflow: hidden;
}

.users-summary {
  margin: -12px 0 14px;
  font-size: 12px;
}

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

.user-cell-copy {
  min-width: 0;
}

.user-cell-name {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 650;
}

.user-cell-login {
  font-size: 11px;
}

.self-tag {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
}

.cell-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
}

.cell-time {
  color: var(--muted);
  font-size: 11.5px;
  white-space: nowrap;
}

.cell-actions {
  width: 1%;
  text-align: right !important;
}

.row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
}

.row-actions .btn {
  color: var(--muted);
}

.row-actions .btn:hover {
  color: var(--text);
  background: var(--surface-2);
}

.row-actions .danger-ghost {
  color: var(--danger);
}

.users-table tr.is-self {
  background: color-mix(in srgb, var(--accent-soft) 34%, transparent);
}

.users-table tr.is-busy {
  opacity: 0.66;
}

.dialog-user-head {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 17px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--border);
}

.dialog-user-head strong {
  font-size: 13.5px;
}

.dialog-user-head .text-muted {
  font-size: 11.5px;
}

/* --------------------------------------------------------------------------
 * Egress
 * ----------------------------------------------------------------------- */

.egress-page .notice {
  margin-bottom: 18px;
}

.egress-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(360px, 100%), 1fr));
  gap: 16px;
}

.egress-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 13px;
  padding: 18px;
}

.egress-card.is-unreadable {
  border-color: color-mix(in srgb, var(--danger) 38%, var(--border));
}

.egress-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.egress-card-title {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.egress-icon {
  display: grid;
  place-items: center;
  width: 37px;
  height: 37px;
  flex: 0 0 auto;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
}

.egress-icon .icon {
  width: 19px;
  height: 19px;
}

.egress-name {
  overflow: hidden;
  font-size: 14.5px;
  font-weight: 680;
  letter-spacing: -0.015em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.egress-usage {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  padding: 8px 9px;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 10.5px;
}

.egress-usage .icon {
  width: 14px;
  height: 14px;
  margin-top: 1px;
}

.egress-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.egress-ssh-block {
  display: grid;
  gap: 14px;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface-2);
}

.code-input {
  font-family: var(--font-mono);
  font-size: 12px;
}

.test-result {
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.test-result > .notice {
  margin: 0;
}

.token-reveal {
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.token-value-row {
  display: flex;
  align-items: center;
  gap: 7px;
}

.token-value-row .input {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 12px;
}

/* --------------------------------------------------------------------------
 * Profile and API tokens
 * ----------------------------------------------------------------------- */

.profile-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.8fr);
  align-items: start;
  gap: 18px;
  margin-bottom: 18px;
}

.profile-grid-forced {
  grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.7fr);
}

.profile-side {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.profile-identity {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px;
}

.profile-identity-copy {
  min-width: 0;
}

.profile-name {
  overflow: hidden;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin-top: 5px;
  font-size: 12px;
}

.token-list {
  margin-top: 2px;
}

.token-table {
  display: flex;
  flex-direction: column;
}

.token-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 0;
  border-top: 1px solid var(--border);
}

.token-row:first-child {
  border-top: 0;
  padding-top: 2px;
}

.token-main {
  min-width: 0;
}

.token-name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 650;
}

.token-name .icon {
  width: 15px;
  height: 15px;
  color: var(--accent);
}

.token-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 13px;
  margin-top: 4px;
  font-size: 10.5px;
}

.token-list > .empty-state {
  border: 0;
  padding: 28px 16px;
  background: transparent;
}

/* --------------------------------------------------------------------------
 * System
 * ----------------------------------------------------------------------- */

.system-grid-host {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 16px;
  margin-bottom: 18px;
}

.system-card {
  min-width: 0;
}

.version-chip {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 650;
}

.dependency-list {
  display: flex;
  flex-direction: column;
}

.dependency-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}

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

.dependency-name {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
}

.dependency-path {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 10.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.resource-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.resource-tile {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
  padding: 11px;
  border-radius: 10px;
  background: var(--surface-2);
  font-size: 10.5px;
}

.resource-label {
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.resource-value {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.resource-tile .progress {
  margin-top: 5px;
}

.config-list .definition-row {
  gap: 12px;
}

.config-list dd {
  font-size: 11.5px;
}

.audit-card {
  margin-top: 0;
}

.audit-head-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
}

.audit-summary {
  font-size: 10.5px;
  white-space: nowrap;
}

.audit-host {
  margin: 0 -21px;
}

.audit-host > .empty-state {
  margin: 0 21px;
}

.audit-table {
  min-width: 760px;
}

.audit-table td {
  padding-top: 10px;
  padding-bottom: 10px;
  font-size: 11.5px;
}

.audit-table .cell-details {
  max-width: 280px;
}

.audit-details summary {
  color: var(--muted);
  font-size: 10.5px;
  cursor: pointer;
}

.audit-detail-full {
  display: block;
  max-height: 200px;
  margin-top: 5px;
  padding: 7px;
  overflow: auto;
  border-radius: 6px;
  background: var(--surface-2);
  font-size: 10px;
  white-space: pre-wrap;
  word-break: break-word;
}

.audit-detail {
  font-size: 10.5px;
  word-break: break-word;
}

.audit-footer {
  display: flex;
  justify-content: center;
  padding-top: 14px;
}

.system-page .error-state {
  grid-column: 1 / -1;
}

/* --------------------------------------------------------------------------
 * Responsive
 * ----------------------------------------------------------------------- */

@media (max-width: 1180px) {
  .metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .profile-side {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }
}

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

  .viewer-page-meta {
    display: none;
  }
}

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

  .app-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 40;
    width: min(286px, 86vw);
    height: 100vh;
    height: 100dvh;
    border-right: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    transform: translateX(-104%);
    transition: transform 0.2s ease;
  }

  .sidebar-open .app-sidebar {
    transform: translateX(0);
  }

  .menu-toggle {
    display: inline-flex;
  }

  .app-topbar {
    padding: 9px 16px;
  }

  .app-outlet {
    padding: 22px 20px 40px;
  }

  .page-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 13px;
  }

  .page-actions {
    justify-content: flex-start;
    width: 100%;
  }

  .viewer-page-head {
    flex-wrap: wrap;
    gap: 8px;
    padding: 9px 12px;
  }

  .viewer-page-head-side {
    width: 100%;
    justify-content: space-between;
  }

  .viewer-page-egress {
    flex: 1;
  }

  .viewer-page-egress .egress-badge {
    max-width: none;
  }

  .viewer-page-body {
    padding: 9px 10px 10px;
  }
}

@media (max-width: 760px) {
  .app-outlet {
    padding: 18px 14px 36px;
  }

  .topbar-user-copy {
    display: none;
  }

  .topbar-user {
    padding: 2px;
    border: 0;
  }

  .page-title {
    font-size: 23px;
  }

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

  .metric-card {
    min-height: 106px;
    padding: 14px;
  }

  .metric-value {
    font-size: 21px;
  }

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

  .session-card-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .session-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .form-grid-two,
  .resource-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .profile-side {
    display: flex;
    flex-direction: column;
  }

  .data-table thead {
    display: none;
  }

  .data-table,
  .data-table tbody,
  .data-table tr,
  .data-table td {
    display: block;
    width: 100%;
  }

  .data-table tr {
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
  }

  .data-table tr:last-child {
    border-bottom: 0;
  }

  .data-table td {
    display: grid;
    grid-template-columns: 104px minmax(0, 1fr);
    gap: 10px;
    padding: 6px 14px;
    border: 0;
    text-align: left !important;
  }

  .data-table td::before {
    align-self: center;
    color: var(--muted);
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    content: attr(data-label);
  }

  .data-table td.cell-user {
    grid-template-columns: minmax(0, 1fr);
  }

  .data-table td.cell-user::before,
  .data-table td.cell-actions::before {
    display: none;
  }

  .data-table td.cell-actions {
    padding-top: 8px;
  }

  .row-actions {
    justify-content: flex-start;
  }

  .audit-host {
    margin: 0 -21px;
  }

  .audit-table {
    min-width: 0;
  }

  .audit-table .cell-details {
    max-width: none;
  }

  .audit-head-actions {
    width: 100%;
    justify-content: space-between;
  }

  .token-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 9px;
  }

  .dialog-footer {
    flex-wrap: wrap;
  }

  .viewer-quick-panel {
    padding-bottom: 5px;
  }

  .viewer-quick-title {
    display: none;
  }

  .viewer-explorer-btn {
    padding: 4px 6px;
  }

  .viewer-explorer-btn span {
    display: none;
  }

  .quick-action-hint {
    display: none;
  }

  .viewer-input-hint {
    padding: 0 4px;
    font-size: 9.5px;
  }

  .viewer-page-head-side > .badge {
    display: none;
  }

  .toast-stack {
    top: auto;
    right: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
    left: 12px;
    width: auto;
  }
}

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

  .metric-card {
    min-height: 96px;
  }

  .metric-icon {
    width: 27px;
    height: 27px;
  }

  .login-card {
    padding: 24px 20px;
    border-radius: var(--radius-lg);
  }

  .login-brand {
    margin-bottom: 22px;
  }

  .brand-mark-lg {
    width: 48px;
    height: 48px;
    border-radius: 14px;
  }

  .brand-mark-lg .icon {
    width: 27px;
    height: 27px;
  }

  .login-title {
    font-size: 20px;
  }

  .viewer-page-title {
    max-width: 150px;
  }

  .viewer-chip.viewer-size-chip {
    display: none;
  }

  .viewer-page-head-main {
    flex-wrap: wrap;
  }

  .viewer-cover {
    padding: 12px;
  }

  .viewer-cover-card {
    padding: 20px 15px;
  }

  .viewer-cover-actions {
    width: 100%;
  }

  .viewer-cover-actions .btn {
    flex: 1;
  }

  .card-padded {
    padding: 17px 15px;
  }

  .audit-host {
    margin: 0 -15px;
  }

  .audit-host > .empty-state {
    margin: 0 15px;
  }

  .audit-head-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .definition-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .definition-row dd {
    text-align: left;
  }

  .page-actions .btn {
    flex: 1;
  }

  .page-actions .btn.icon-btn {
    flex: 0 0 38px;
  }

  .dialog-form-actions .btn {
    flex: 1;
  }

  .dialog-body {
    padding: 16px;
  }

  .dialog-header,
  .dialog-footer {
    padding-left: 16px;
    padding-right: 16px;
  }
}

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

  .viewer-page-status {
    display: none;
  }
}

/* --------------------------------------------------------------------------
 * Animations and motion preferences
 * ----------------------------------------------------------------------- */

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

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

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

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes shimmer {
  to {
    transform: translateX(100%);
  }
}

@keyframes shimmer-bg {
  to {
    background-position: -120% 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* --------------------------------------------------------------------------
 * Session fingerprint report
 * ----------------------------------------------------------------------- */

.fingerprint-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 18px;
  align-items: start;
}

.fingerprint-page .page-header {
  margin-bottom: 20px;
}

.fingerprint-summary {
  grid-column: 1 / -1;
}

.fingerprint-settings {
  grid-column: 1 / -1;
}

.fingerprint-form .field-wide {
  grid-column: 1 / -1;
}

.create-fingerprint {
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.create-fingerprint summary {
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  user-select: none;
}

.create-fingerprint[open] summary {
  margin-bottom: 12px;
}

.fingerprint-card .card-heading {
  margin-bottom: 14px;
}

.fingerprint-row {
  gap: 24px;
}

.fingerprint-value {
  max-width: 65%;
}

.fingerprint-value.mono {
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.5;
  word-break: break-word;
}

.fingerprint-note {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 12px;
  line-height: 1.6;
}

.empty-inline {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

.empty-inline p {
  margin: 0;
}

@media (max-width: 720px) {
  .fingerprint-content {
    grid-template-columns: 1fr;
  }

  .fingerprint-value {
    max-width: 60%;
  }
}

/* ---- Viewer: explicit paste dialog ---- */

.viewer-paste-btn {
  min-height: 30px;
  padding: 4px 9px;
  border-color: var(--border);
  font-size: 10.5px;
  white-space: nowrap;
}

.viewer-paste-btn:hover {
  background: var(--surface-2);
}

.viewer-paste-hint {
  margin: 0 0 12px;
  font-size: 12px;
  line-height: 1.5;
}

.viewer-paste-area {
  min-height: 150px;
  resize: vertical;
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  line-height: 1.45;
}

/* ---- Viewer: session file manager ---- */

.file-manager {
  display: flex;
  min-height: 0;
  flex-direction: column;
  gap: 8px;
}

.file-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.file-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.file-status {
  font-size: 10.5px;
  white-space: nowrap;
}

.file-breadcrumbs {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
}

.file-crumb {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 18ch;
  overflow: hidden;
  padding: 3px 5px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.file-crumb:hover {
  background: var(--surface-2);
}

.file-crumb .icon {
  width: 12px;
  height: 12px;
}

.file-crumb-sep {
  color: var(--muted);
  font-size: 11px;
}

.file-mkdir-row {
  padding: 6px 0;
}

.file-mkdir-form {
  display: flex;
  align-items: center;
  gap: 6px;
}

.file-mkdir-form .input {
  flex: 1 1 auto;
  min-width: 0;
}

.file-list {
  display: flex;
  min-height: 180px;
  max-height: min(52vh, 520px);
  flex-direction: column;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.file-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 82px 118px auto;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 4px 8px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}

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

.file-row:hover {
  background: var(--surface-2);
}

.file-name {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 12px;
  text-align: left;
}

.file-name > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-name .icon {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  color: var(--muted);
}

.file-name-dir {
  cursor: pointer;
}

.file-name-dir:hover > span {
  text-decoration: underline;
}

.file-size,
.file-modified {
  color: var(--muted);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.file-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
}

.file-actions .btn {
  min-height: 27px;
  padding: 3px 6px;
}

.file-empty,
.file-loading {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 160px;
  padding: 18px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.file-empty {
  flex-direction: column;
}

.file-empty .icon {
  width: 24px;
  height: 24px;
  opacity: 0.7;
}

.file-hint {
  margin: 0;
  font-size: 10.5px;
  line-height: 1.5;
}

@media (max-width: 720px) {
  .file-row {
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-areas: 'name size actions';
    padding: 6px 8px;
  }

  .file-name {
    grid-area: name;
  }

  .file-size {
    grid-area: size;
  }

  .file-modified {
    display: none;
  }

  .file-actions {
    grid-area: actions;
  }

  .viewer-paste-btn span {
    display: none;
  }
}

/* Fingerprint library and per-session fingerprint card */
.fp-page,
.fp-content {
  display: grid;
  gap: 24px;
}
.fp-section {
  display: grid;
  gap: 14px;
}
.fp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.fp-card {
  display: grid;
  gap: 12px;
  align-content: start;
}
.fp-summary {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
  font-size: 0.875rem;
  color: var(--text-muted, inherit);
}
.fp-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.fp-session {
  display: grid;
  gap: 14px;
}
.fp-session-body {
  display: grid;
  gap: 14px;
}
