:root,
html[data-theme="dark"] {
  --bg: #0f1419;
  --surface: #1a2332;
  --input-bg: #121820;
  --hover-bg: rgba(255, 255, 255, 0.04);
  --table-head-bg: rgba(0, 0, 0, 0.2);
  --border: #2a3544;
  --text: #e8eef5;
  --muted: #8b9bb0;
  --accent: #3d8bfd;
  --accent-hover: #5a9fff;
  --danger: #e35d6a;
  --ok: #3ecf8e;
  --warn: #e6b84d;
  --alert-error-fg: #ffb4bc;
  --alert-ok-fg: #9aefc4;
  --font: "IBM Plex Sans", "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --sidebar-width: 240px;
  --sidebar-collapsed: 72px;
  --sidebar-bg: rgba(15, 20, 25, 0.96);
  --sidebar-text: #e8eef5;
  --sidebar-muted: #8b9bb0;
  --sidebar-border: #2a3544;
}

html[data-theme="light"] {
  --bg: #eef2f7;
  --surface: #ffffff;
  --input-bg: #f4f7fb;
  --hover-bg: rgba(15, 30, 50, 0.05);
  --table-head-bg: #e8eef6;
  --border: #d0d8e4;
  --text: #1a2332;
  --muted: #5a6b80;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --danger: #dc2626;
  --ok: #059669;
  --warn: #d97706;
  --alert-error-fg: #b91c1c;
  --alert-ok-fg: #047857;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

html[data-theme="light"] {
  color-scheme: light;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, #1a3a5c 0%, transparent 50%),
    radial-gradient(ellipse 60% 40% at 90% 0%, #1a2f28 0%, transparent 45%),
    var(--bg);
  color: var(--text);
  line-height: 1.5;
}

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

a:hover {
  color: var(--accent-hover);
}

/* —— App shell + left sidebar —— */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
  width: var(--sidebar-width);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.85rem 0.75rem;
  border-right: 1px solid var(--sidebar-border);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  backdrop-filter: blur(8px);
  transition: width 0.2s ease;
  z-index: 20;
}

/* Sidebar stays dark in both themes */
html[data-theme="light"] .sidebar {
  --text: var(--sidebar-text);
  --muted: var(--sidebar-muted);
  --border: var(--sidebar-border);
  --surface: #1a2332;
  --accent: #3d8bfd;
  --accent-hover: #5a9fff;
}

.app-shell.sidebar-collapsed .sidebar {
  width: var(--sidebar-collapsed);
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
}

.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  flex: 1;
  color: var(--text);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand-mark {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(145deg, #2a5a9e, #1a3a5c);
  font-size: 0.95rem;
}

.brand-logo {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  object-fit: contain;
  border-radius: 6px;
}

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

.app-shell.sidebar-collapsed .brand-text,
.app-shell.sidebar-collapsed .nav-label {
  display: none;
}

.sidebar-toggle {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: grid;
  place-items: center;
}

.sidebar-toggle:hover {
  color: var(--text);
  border-color: var(--muted);
}

.toggle-icon {
  display: block;
  width: 0.55rem;
  height: 0.55rem;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.2s ease;
}

.app-shell.sidebar-collapsed .toggle-icon {
  transform: rotate(-135deg);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.sidebar-nav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.7rem;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.95rem;
}

.sidebar-nav a:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.sidebar-nav a.active {
  color: var(--text);
  background: rgba(61, 139, 253, 0.16);
}

.nav-icon {
  flex-shrink: 0;
  width: 1.25rem;
  text-align: center;
  opacity: 0.9;
}

.nav-badge {
  margin-left: auto;
  min-width: 1.35rem;
  height: 1.35rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: #c45c26;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.35rem;
  text-align: center;
  flex-shrink: 0;
}

.app-shell.sidebar-collapsed .nav-badge {
  position: absolute;
  top: 0.2rem;
  right: 0.15rem;
  margin-left: 0;
  min-width: 1.1rem;
  height: 1.1rem;
  line-height: 1.1rem;
  font-size: 0.65rem;
  padding: 0 0.25rem;
}

.pref-inline {
  margin: 0;
}

.btn-sm {
  padding: 0.3rem 0.55rem;
  font-size: 0.75rem;
}

.topbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.85rem;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  backdrop-filter: blur(6px);
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 0;
}

.topbar-prefs {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.topbar .btn-sm {
  padding: 0.15rem 0.4rem;
  font-size: 0.7rem;
  line-height: 1.2;
  border-radius: 6px;
}

.topbar-user {
  color: var(--muted);
  font-size: 0.72rem;
  max-width: 11rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.page-header h1 {
  margin: 0;
}

.form-card {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  max-width: 640px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
}

.form-card fieldset {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.35rem 0;
}

.flash {
  padding: 0.65rem 0.9rem;
  border-radius: 8px;
  margin-bottom: 1rem;
}

.flash-error {
  background: rgba(227, 93, 106, 0.15);
  border: 1px solid var(--danger);
  color: var(--danger);
}

.flash-ok {
  background: rgba(62, 207, 142, 0.12);
  border: 1px solid var(--ok);
  color: var(--ok);
}

.danger-zone {
  margin-top: 1.5rem;
}

.auth-lang {
  position: absolute;
  top: 1rem;
  right: 1rem;
}

.auth-wrap {
  position: relative;
}

.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.auth-brand .brand-mark {
  width: 11.25rem;
  height: 11.25rem;
  font-size: 4.25rem;
  border-radius: 20px;
}

.auth-logo {
  width: 13.75rem;
  height: 13.75rem;
  object-fit: contain;
}

.logo-preview {
  margin: 0.5rem 0;
}

html[data-theme="light"] body {
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, #c5d8f0 0%, transparent 50%),
    radial-gradient(ellipse 60% 40% at 90% 0%, #d0e8dc 0%, transparent 45%),
    var(--bg);
}

html[data-theme="light"] .app-main {
  color: var(--text);
}

.app-main {
  flex: 1;
  min-width: 0;
}

.page,
.container {
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 1rem 1.25rem 1.5rem;
}

.page-wide {
  max-width: none;
  width: 100%;
}

h1 {
  font-size: 1.6rem;
  font-weight: 650;
  margin: 0 0 1rem;
}

h2 {
  font-size: 1.15rem;
  margin: 1.5rem 0 0.75rem;
}

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

.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.auth-card {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.75rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

.auth-card h1 {
  margin: 0;
  font-size: 1.45rem;
  text-align: center;
  line-height: 1.25;
}

.auth-card .sub {
  color: var(--muted);
  margin: 0 0 1.25rem;
  font-size: 0.95rem;
  text-align: center;
}

label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

input:not([type]),
input[type="email"],
input[type="password"],
input[type="text"],
input[type="url"],
input[type="search"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  margin-bottom: 1rem;
}

option {
  background: var(--surface);
  color: var(--text);
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(61, 139, 253, 0.45);
  border-color: var(--accent);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  border: 1px solid transparent;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

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

.btn-secondary {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}

.btn-secondary:hover {
  border-color: var(--muted);
  background: var(--hover-bg);
}

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

.btn-block {
  width: 100%;
}

.remember {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0.25rem 0 1rem;
  color: var(--text);
  font-size: 0.95rem;
}

.remember input {
  width: auto;
  margin: 0;
}

.alert {
  padding: 0.75rem 0.9rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.92rem;
}

.alert-error {
  background: rgba(227, 93, 106, 0.15);
  border: 1px solid rgba(227, 93, 106, 0.4);
  color: var(--alert-error-fg);
}

.alert-ok {
  background: rgba(62, 207, 142, 0.12);
  border: 1px solid rgba(62, 207, 142, 0.35);
  color: var(--alert-ok-fg);
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.1rem;
}

.stat .label {
  color: var(--muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat .value {
  font-size: 1.75rem;
  font-weight: 700;
  font-family: var(--mono);
}

.stat .meta {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 0.25rem;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: end;
  margin-bottom: 1rem;
}

.filters .field {
  min-width: 140px;
}

.filters .field.grow {
  flex: 1;
  min-width: 180px;
}

.filters label {
  margin-bottom: 0.25rem;
}

.filters input,
.filters select {
  margin-bottom: 0;
}

.table-wrap {
  overflow-x: auto;
  width: 100%;
  max-width: 100%;
  margin: 0 0 1rem;
  -webkit-overflow-scrolling: touch;
}

.table-wrap-wide {
  width: 100%;
}

table {
  width: 100%;
  min-width: 0;
  table-layout: auto;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.9rem;
}

th,
td {
  padding: 0.65rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  white-space: nowrap;
}

th {
  position: relative;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: var(--table-head-bg);
}

.col-resizer {
  position: absolute;
  top: 0;
  right: 0;
  width: 6px;
  height: 100%;
  cursor: col-resize;
  user-select: none;
  z-index: 2;
}

/* Domains table: readable defaults + horizontal scroll */
#domains-table {
  width: max-content;
  min-width: 100%;
}

#domains-table th,
#domains-table td {
  white-space: normal;
}

#domains-table th:nth-child(1),
#domains-table td:nth-child(1) {
  width: 2.5rem;
  min-width: 2.5rem;
}

#domains-table th:nth-child(2),
#domains-table td:nth-child(2) {
  min-width: 3.5rem;
}

#domains-table th:nth-child(3),
#domains-table td:nth-child(3) {
  min-width: 6rem;
}

#domains-table th:nth-child(4),
#domains-table td:nth-child(4) {
  min-width: 22rem;
  max-width: 32rem;
}

#domains-table th:nth-child(5),
#domains-table td:nth-child(5) {
  min-width: 9rem;
}

#domains-table th:nth-child(6),
#domains-table td:nth-child(6),
#domains-table th:nth-child(7),
#domains-table td:nth-child(7),
#domains-table th:nth-child(8),
#domains-table td:nth-child(8),
#domains-table th:nth-child(9),
#domains-table td:nth-child(9),
#domains-table th:nth-child(10),
#domains-table td:nth-child(10),
#domains-table th:nth-child(11),
#domains-table td:nth-child(11) {
  min-width: 5.5rem;
  text-align: center;
}

#domains-table th:nth-child(12),
#domains-table td:nth-child(12) {
  min-width: 6rem;
}

#domains-table th:nth-child(13),
#domains-table td:nth-child(13) {
  min-width: 10rem;
  max-width: 16rem;
}

#domains-table th:nth-child(14),
#domains-table td:nth-child(14) {
  min-width: 4.5rem;
}

tr:last-child td {
  border-bottom: none;
}

.sortable-th {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

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

.sortable-th::after {
  content: " ↕";
  opacity: 0.35;
  font-size: 0.75em;
}

.sortable-th[aria-sort="ascending"]::after {
  content: " ↑";
  opacity: 0.9;
  color: var(--accent);
}

.sortable-th[aria-sort="descending"]::after {
  content: " ↓";
  opacity: 0.9;
  color: var(--accent);
}

.row-error {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 0.25rem;
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-enabled {
  background: rgba(62, 207, 142, 0.18);
  color: var(--ok);
}

.badge-disabled {
  background: rgba(139, 155, 176, 0.2);
  color: var(--muted);
}

.badge-running {
  background: rgba(230, 184, 77, 0.2);
  color: var(--warn);
}

.badge-completed {
  background: rgba(62, 207, 142, 0.18);
  color: var(--ok);
}

.badge-failed {
  background: rgba(227, 93, 106, 0.2);
  color: var(--danger);
}

.mono {
  font-family: var(--mono);
  font-size: 0.85rem;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1rem;
}

.backup-codes {
  background: var(--input-bg);
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 1rem;
  font-family: var(--mono);
  list-style: none;
  margin: 0 0 1rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
}

.turnstile-wrap {
  margin-bottom: 1rem;
  min-height: 65px;
}

.pagination {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-top: 1rem;
  margin-left: auto;
  margin-right: auto;
  width: 90%;
  flex-wrap: wrap;
  color: var(--muted);
}

.qr {
  max-width: 200px;
  display: block;
  margin: 0.75rem 0;
  border-radius: 8px;
}

/* —— Live generate progress —— */
.progress-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.15rem 1.15rem;
  margin-bottom: 1.5rem;
}

.progress-panel.is-empty:not(.is-active) .progress-bar-track,
.progress-panel.is-empty:not(.is-active) .progress-stats,
.progress-panel.is-empty:not(.is-active) .progress-meta {
  display: none;
}

.progress-panel-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}

.progress-title {
  margin: 0;
  font-size: 1.05rem;
}

.progress-phase-badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(139, 155, 176, 0.2);
  color: var(--muted);
}

.progress-panel.is-active .progress-phase-badge {
  background: rgba(61, 139, 253, 0.2);
  color: var(--accent);
  animation: phase-pulse 1.4s ease-in-out infinite;
}

.progress-panel.is-done .progress-phase-badge {
  background: rgba(62, 207, 142, 0.18);
  color: var(--ok);
  animation: none;
}

.progress-panel.is-failed .progress-phase-badge {
  background: rgba(227, 93, 106, 0.2);
  color: var(--danger);
  animation: none;
}

.progress-message {
  margin: 0 0 0.65rem;
}

.progress-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.progress-domain {
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.progress-bar-track {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: var(--input-bg);
  overflow: hidden;
  border: 1px solid var(--border);
  margin-bottom: 0.85rem;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2a5a9e, var(--accent), #5a9fff);
  transition: width 0.25s ease;
}

.progress-bar-track[data-mode="indeterminate"] .progress-bar-fill {
  width: 35% !important;
  animation: progress-shimmer 1.2s ease-in-out infinite;
}

.progress-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 0.5rem 1rem;
  font-size: 0.9rem;
}

@keyframes progress-shimmer {
  0% {
    transform: translateX(-120%);
  }
  100% {
    transform: translateX(320%);
  }
}

@keyframes phase-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.65;
  }
}

.readonly-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem 1.25rem;
  margin: 0 0 1.25rem;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.readonly-meta dt {
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.readonly-meta dd {
  margin: 0.2rem 0 0;
  word-break: break-all;
}

.edit-form textarea {
  resize: vertical;
  min-height: 6rem;
}

.domain-edit-shot {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1rem;
  margin: 0 0 1.25rem;
}

.domain-edit-thumb {
  width: 280px;
  max-width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  object-position: top;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  cursor: zoom-in;
}

.domain-edit-thumb-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
}

.domain-edit-shot-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: flex-start;
}

.upload-shot-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}

.upload-shot-form input[type='file'] {
  width: auto;
  max-width: 16rem;
  margin: 0;
  padding: 0.35rem 0;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 0.85rem;
}

.is-hidden {
  display: none !important;
}

.source-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  flex-basis: 100%;
  margin: 0.35rem 0 0.5rem;
}

.source-check {
  margin: 0;
}

.run-form {
  flex-wrap: wrap;
  align-items: flex-start;
}

.flag-fieldset {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  margin: 0 0 1.25rem;
}

.flag-fieldset legend {
  padding: 0 0.35rem;
  color: var(--muted);
  font-size: 0.85rem;
}

#domains-table .row-select,
#select-all-domains {
  width: auto;
  margin: 0;
  accent-color: var(--accent);
}

.domain-row {
  cursor: pointer;
}

.domain-row:hover {
  background: var(--hover-bg);
}

.domain-cell {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  min-width: 18rem;
}

.domain-thumb {
  width: 64px;
  height: 44px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  flex-shrink: 0;
  cursor: zoom-in;
}

.domain-thumb-empty {
  display: inline-block;
  width: 64px;
  height: 44px;
  border-radius: 4px;
  border: 1px dashed var(--border);
  background: var(--hover-bg);
  cursor: default;
  flex-shrink: 0;
}

.domain-text {
  min-width: 0;
  flex: 1;
  font-size: 1.05rem;
}

.domain-name {
  font-size: 1em;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  word-break: break-word;
  white-space: normal;
}

.domain-link {
  display: block;
  font-size: 0.5em;
  line-height: 1.35;
  color: var(--muted);
  word-break: break-all;
  white-space: normal;
  margin-top: 0.2rem;
}

.domain-link:hover {
  color: var(--accent);
}

.ip-list {
  font-family: var(--mono);
  font-size: 0.72rem;
  line-height: 1.4;
  color: var(--muted);
  white-space: normal;
}

.page-size-label {
  margin: 0 0 0 0.75rem;
  display: inline;
  color: var(--muted);
  font-size: 0.85rem;
}

#pageSizeSelect {
  width: auto;
  margin: 0;
  display: inline-block;
  padding: 0.35rem 0.5rem;
}

.lightbox[hidden] {
  display: none !important;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
}

.lightbox-panel {
  position: relative;
  z-index: 1;
  width: min(96vw, 1100px);
  max-height: 92vh;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.lightbox-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.lightbox-stage {
  overflow: auto;
  max-height: calc(92vh - 4rem);
  background: #0a0e14;
  border-radius: 8px;
  text-align: center;
}

.lightbox-stage img {
  max-width: none;
  transform-origin: center top;
  transition: transform 0.15s ease;
}

@media (max-width: 800px) {
  .app-shell {
    flex-direction: column;
  }

  .sidebar {
    position: sticky;
    top: 0;
    width: 100% !important;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .app-shell.sidebar-collapsed .sidebar {
    width: 100% !important;
  }

  .app-shell.sidebar-collapsed .brand-text,
  .app-shell.sidebar-collapsed .nav-label {
    display: initial;
  }

  .app-shell.sidebar-collapsed .sidebar-nav {
    display: none;
  }

  .sidebar {
    max-height: 40vh;
  }

  .sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
    overflow-y: auto;
  }

  .topbar {
    position: static;
  }
}
