:root {
  --bg: #0f1419;
  --card: #1a2332;
  --text: #e8eef7;
  --muted: #8b9cb3;
  --accent: #3d8bfd;
  --danger: #e05252;
  --ok: #3ddc84;
  --border: #2a3a54;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: 1.5rem;
}
/* Same horizontal width as .container.container-wide (960px) */
.shell-wide {
  max-width: 960px;
  margin: 0 auto;
  width: 100%;
  padding: 0 1.25rem;
  box-sizing: border-box;
}
.shell-sticky {
  position: sticky;
  top: 0;
  z-index: 200;
}
.topbar-strip {
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.topbar {
  display: flex;
  align-items: center;
  height: 52px;
  gap: 1rem;
}
.brand { font-weight: 700; letter-spacing: 0.02em; font-size: 1rem; flex-shrink: 0; }
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-left: auto;
}
.btn-save-main {
  padding: 0.45rem 1rem;
  font-size: 0.88rem;
  font-weight: 600;
  margin: 0;
  border-radius: 6px;
}
.topbar-logout {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.88rem;
  padding-left: 0.75rem;
  border-left: 1px solid var(--border);
  line-height: 1;
  flex-shrink: 0;
}
.topbar-logout:hover { color: var(--text); }
@media (max-width: 720px) {
  .hide-narrow { display: none !important; }
}
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.container { flex: 1; padding: 1.25rem; max-width: 1100px; margin: 0 auto; width: 100%; }
.container-wide { max-width: 1200px; }
.footer { padding: 0.5rem; text-align: center; font-size: 0.8rem; }

h1 { font-size: 1.5rem; margin-top: 0; }
h2 { font-size: 1.1rem; margin-top: 0; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}
.card.narrow { max-width: 420px; margin-left: auto; margin-right: auto; }

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.btn {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
  margin-right: 0.5rem;
  margin-bottom: 0.5rem;
}
.btn.primary { background: var(--accent); color: #fff; }
.btn.danger { background: var(--danger); color: #fff; }

.form-stack label, .form-sections label { display: block; margin: 0.5rem 0; }
.form-stack input, .form-sections input[type="number"], .form-sections input.wide {
  width: 100%;
  max-width: 360px;
  padding: 0.4rem 0.5rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: #0d1117;
  color: var(--text);
}
.inline { display: inline-block; }

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

.flash-list { list-style: none; padding: 0; }
.flash { padding: 0.5rem 0.75rem; border-radius: 6px; margin-bottom: 0.5rem; }
.flash-ok { background: rgba(61, 220, 132, 0.15); border: 1px solid var(--ok); }
.flash-err { background: rgba(224, 82, 82, 0.15); border: 1px solid var(--danger); }
.flash-message { background: rgba(61, 139, 253, 0.12); border: 1px solid var(--accent); }

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  background: #243044;
  font-size: 0.9rem;
}
.badge-pill {
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 500;
}

.log-preview, .log-box {
  background: #0d1117;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem;
  font-size: 0.8rem;
  overflow: auto;
  max-height: 320px;
  white-space: pre-wrap;
  word-break: break-word;
}
.log-box { max-height: 70vh; }

.zones-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.35rem 1rem;
  margin-bottom: 1rem;
}
.zones-grid .chk { display: flex; align-items: center; gap: 0.35rem; }
.zones-grid .offset input { width: 4rem; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
}
.data-table th, .data-table td {
  border: 1px solid var(--border);
  padding: 0.5rem 0.75rem;
  text-align: left;
}
.data-table input[type="number"] { width: 4rem; }

.inline-check { display: inline-block; margin-bottom: 0.5rem; }

code { background: #243044; padding: 0.1rem 0.35rem; border-radius: 4px; font-size: 0.9em; }

.intro-notice {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 1rem;
  overflow: hidden;
}
.intro-notice__summary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.1rem;
  cursor: pointer;
  list-style: none;
  font-size: 0.9rem;
  color: var(--muted);
  user-select: none;
  transition: color 0.15s;
}
.intro-notice__summary::-webkit-details-marker { display: none; }
.intro-notice__summary::before {
  content: "▸";
  font-size: 0.7rem;
  opacity: 0.6;
  transition: transform 0.15s;
  flex-shrink: 0;
}
.intro-notice[open] .intro-notice__summary::before { transform: rotate(90deg); }
.intro-notice__summary:hover { color: var(--text); }
.intro-notice__body {
  margin: 0;
  padding: 0 1.1rem 0.85rem;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--text);
  border-top: 1px solid var(--border);
  padding-top: 0.7rem;
}

/* Status + log terminal (top dashboard) */
.status-dashboard {
  padding: 1.1rem 1.25rem 1rem;
  overflow: hidden;
}
.status-dashboard__title {
  font-size: 1.15rem;
  margin: 0 0 1rem;
  letter-spacing: 0.02em;
}
.status-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem 1.25rem;
  margin-bottom: 1rem;
}
.status-metric {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
  padding: 0.65rem 0.85rem;
  background: #141c2e;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.status-metric__label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
}
.status-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  align-items: center;
  margin-bottom: 0.65rem;
}
.status-actions .btn { margin: 0; }
.status-dashboard__hint {
  margin: 0 0 0.85rem;
  line-height: 1.45;
}

.status-log-block {
  margin: 0;
  padding: 0.85rem 1rem;
  background: #0d1117;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.status-log-block__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem 1rem;
  margin-bottom: 0.55rem;
}
.status-log-block__title {
  font-size: 0.95rem;
  font-weight: 600;
}
.status-log-block__meta {
  font-size: 0.78rem;
}

.status-label { margin-right: 0.35rem; }
.actions-row { margin: 1rem 0; display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }
.btn-lg { padding: 0.65rem 1.25rem; font-size: 1rem; }

.badge-ok { border: 1px solid var(--ok); color: var(--ok); }
.badge-warn { border: 1px solid #c9a227; color: #e6c84a; }
.badge-run { border: 1px solid var(--accent); color: var(--accent); }
.badge-idle { border: 1px solid var(--muted); color: var(--muted); }
.badge-pill.badge-ok { background: rgba(61, 220, 132, 0.12); }
.badge-pill.badge-warn { background: rgba(201, 162, 39, 0.12); }
.badge-pill.badge-run { background: rgba(61, 139, 253, 0.14); }
.badge-pill.badge-idle { background: rgba(139, 156, 179, 0.1); }

.stack-gap { display: flex; flex-direction: column; gap: 0.25rem; }

.details-block {
  padding: 0.75rem 1rem;
}
.details-block > summary {
  cursor: pointer;
  list-style: none;
  padding: 0.35rem 0;
  font-size: 1.05rem;
}
.details-block > summary::-webkit-details-marker { display: none; }
.details-block[open] > summary { margin-bottom: 0.75rem; border-bottom: 1px solid var(--border); padding-bottom: 0.5rem; }

.help-block { margin: 0.5rem 0 1rem; line-height: 1.5; }
.help-cell { font-size: 0.88rem; color: var(--muted); line-height: 1.45; max-width: 28rem; }
.module-table .order-input { width: 3.5rem; }

.nested-details {
  margin-top: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: #141c2e;
  border-radius: 6px;
  border: 1px solid var(--border);
}
.nested-details > summary { cursor: pointer; font-size: 0.95rem; color: var(--muted); }

.field-row { display: block; margin: 1rem 0; }
.field-row input[type="number"] {
  display: block;
  margin-top: 0.35rem;
  max-width: 12rem;
  padding: 0.4rem 0.5rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: #0d1117;
  color: var(--text);
}
.field-row .hint { display: block; font-size: 0.85rem; color: var(--muted); margin-top: 0.35rem; max-width: 40rem; line-height: 1.45; }

.email-settings-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.email-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.5rem;
  align-items: flex-start;
}
.email-port {
  flex: 0 0 120px;
}
.email-port input[type="number"] {
  width: 100%;
  max-width: 120px;
}
.recipients-textarea {
  display: block;
  margin-top: 0.4rem;
  width: 100%;
  max-width: 32rem;
  min-height: 6rem;
  padding: 0.5rem 0.65rem;
  background: #0d1117;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: ui-monospace, monospace;
  font-size: 0.85rem;
  resize: vertical;
}

.cron-row { display: flex; flex-wrap: wrap; gap: 1rem; margin: 0.75rem 0; }
.cron-row input { margin-left: 0.35rem; }

.upload-inline { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; margin-top: 0.75rem; }
.upload-inline input[type="file"] { max-width: 100%; }
.upload-standalone h2 { font-size: 1.15rem; margin-bottom: 0.5rem; }

.short-log { max-height: 180px; }

/* Terminal-style log tail in dashboard */
.log-terminal {
  font-family: ui-monospace, "Cascadia Code", "SFMono-Regular", Menlo, Monaco, Consolas, monospace;
  font-size: 0.78rem;
  line-height: 1.5;
  background: #0a0e14;
  color: #c8e0c8;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin: 0;
  max-height: 16rem;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35);
}
.log-terminal--compact {
  max-height: 52rem;
  font-size: 0.76rem;
  border-radius: 8px;
}

details label, .details-block label { display: block; margin: 0.5rem 0; }
details input[type="number"], .details-block input.wide {
  padding: 0.4rem 0.5rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: #0d1117;
  color: var(--text);
}
.details-block input.wide { width: 100%; max-width: 100%; }

/* Balance grid */
.balance-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 0.65rem;
  margin-bottom: 0.85rem;
}
.balance-card {
  display: flex; flex-direction: column; gap: 0.3rem;
  padding: 0.65rem 0.85rem;
  background: #141c2e; border: 1px solid var(--border); border-radius: 8px;
}
.balance-card__label {
  font-size: 0.73rem; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--muted); font-weight: 600;
}
.balance-card__value { font-size: 1.25rem; font-weight: 700; }
.balance-card__link {
  font-size: 0.72rem; color: var(--muted); text-decoration: none; margin-top: auto;
}
.balance-card__link:hover { color: var(--text); text-decoration: underline; }
.usage-rows { display: flex; flex-direction: column; gap: 0.15rem; font-size: 0.82rem; }
.usage-row { display: flex; align-items: baseline; gap: 0.25rem; }
.usage-period { white-space: nowrap; min-width: 4.5rem; }
.usage-parts { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.usage-in  { color: #6dbf4f; }
.usage-out { color: #f4845f; }

/* Subscription tracker */
.sub-tracker { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 0.85rem; }
.sub-card {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  gap: 0.5rem; padding: 0.65rem 0.85rem;
  background: #141c2e; border: 1px solid var(--border); border-radius: 8px;
}
.sub-card__info { display: flex; align-items: center; }
.sub-card__label { font-size: 0.85rem; font-weight: 600; }
.sub-card__days { font-size: 0.95rem; font-weight: 700; margin-left: 0.75rem; }
.sub-card__form { display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; }
.sub-card__form input[type=date],
.sub-card__form input[type=number] {
  padding: 0.3rem 0.5rem; border-radius: 5px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text);
}
.sub-card__form input[type=number] { width: 5rem; }
.days-ok   { color: var(--ok); }
.days-warn { color: #e6c84a; }
.days-crit { color: #ff4d4d; animation: blink 1s step-start infinite; }
@keyframes blink { 50% { opacity: 0.3; } }

/* Small button variant */
.btn-sm {
  padding: 0.2rem 0.55rem;
  font-size: 0.78rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: #1e2d42;
  color: var(--muted);
  cursor: pointer;
  margin: 0;
}
.btn-sm:hover { background: #243044; color: var(--text); }

/* Date picker calendar */
.cal-picker-section { margin-top: 1.25rem; }
.cal-picker-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
  flex-wrap: wrap;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(196px, 1fr));
  gap: 0.75rem;
  margin-top: 0.75rem;
}
.cal-grid > div {
  background: #141c2e;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
}
.cal-month-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.4rem;
  gap: 0.35rem;
}
.cal-month-name { font-weight: 600; font-size: 0.9rem; }
.cal-month-btns { display: flex; gap: 4px; }
.cal-dow-row,
.cal-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.cal-dow-row { margin-bottom: 2px; }
.cal-dow {
  text-align: center;
  font-size: 0.68rem;
  color: var(--muted);
  padding: 2px 0;
}
.cal-day {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 27px;
  border-radius: 4px;
  font-size: 0.8rem;
  cursor: pointer;
  user-select: none;
  border: 1px solid transparent;
  transition: background 0.1s, border-color 0.1s;
}
.cal-day:hover:not(.cal-day--off) {
  background: rgba(61, 139, 253, 0.18);
  border-color: rgba(61, 139, 253, 0.45);
}
.cal-day--selected {
  color: #fff !important;
  font-weight: 700;
  /* White inner ring — clearly visible on any background (zone colour or accent) */
  box-shadow: inset 0 0 0 2.5px rgba(255,255,255,0.9), inset 0 0 0 4px rgba(0,0,0,0.15);
}
.cal-day--off {
  color: var(--muted);
  opacity: 0.35;
  cursor: default;
}
.cal-footer { margin-top: 0.6rem; display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }

/* Conflict: date ready for some zones but not all */
.cal-day--conflict { box-shadow: inset 0 0 0 2.5px #e6a23c; }
/* Selected + conflict: white ring takes priority, orange still visible as outer ring */
.cal-day--selected.cal-day--conflict {
  box-shadow: inset 0 0 0 2.5px rgba(255,255,255,0.9), inset 0 0 0 4px rgba(0,0,0,0.15), inset 0 0 0 5px #e6a23c;
}

/* Zone legend */
.cal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.65rem;
  margin: 0.4rem 0 0;
  min-height: 1.4rem;
}
.cal-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.78rem;
  color: var(--muted);
}
.cal-legend-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* Pipeline progress widget */
.pipeline-progress { margin: 14px 0 10px; }
.pp-header-row { margin-bottom: 6px; display: flex; align-items: center; gap: 10px; }
.pp-docker-badge { font-size: 0.72rem; font-weight: 600; padding: 2px 8px; border-radius: 10px; background: var(--card-bg, #1e2130); border: 1px solid var(--border, #2a2f45); }
.pp-docker-badge--run   { color: var(--accent, #4fa3e0); border-color: var(--accent, #4fa3e0); }
.pp-docker-badge--pause { color: var(--warn, #e0c44f); border-color: var(--warn, #e0c44f); }
.pp-docker-badge--idle  { color: var(--muted, #7a8099); }
.pp-stages { display: flex; align-items: center; gap: 4px; flex-wrap: nowrap; margin-bottom: 8px; overflow-x: auto; }
.pp-arrow { color: var(--muted, #6b7280); font-size: 0.9em; flex-shrink: 0; padding: 0 1px; }
.pp-stage { text-align: center; min-width: 72px; padding: 4px 8px; border-radius: 6px; background: var(--card-bg, #1e2130); border: 1px solid transparent; flex-shrink: 0; }
.pp-stage--active { border-color: var(--accent, #4fa3e0); }
.pp-stage--done { background: #1a2e1a; }
.pp-stage__name { display: block; font-size: 0.65em; margin-bottom: 1px; white-space: nowrap; }
.pp-stage__count { display: block; font-size: 1.3em; font-weight: 700; line-height: 1.1; }
.pp-bar-wrap { height: 6px; background: var(--border, #2a2f45); border-radius: 3px; overflow: hidden; margin-bottom: 6px; }
.pp-bar { height: 100%; background: var(--accent, #4fa3e0); border-radius: 3px; width: 0; transition: width 0.5s ease; }
.pp-meta { display: flex; gap: 8px; align-items: center; }
.pp-sep { opacity: 0.35; }

.pp-whois-ratio { display: flex; align-items: baseline; justify-content: center; gap: 0; }
.pp-whois-ratio .pp-free { color: var(--badge-run, #4caf50); }
.pp-whois-ratio .pp-busy { color: var(--muted, #6b7280); }
.pp-ratio-sep { font-size: 0.9em; }
.pp-stage__sub { display: block; font-size: 0.68em; margin-top: 1px; }

.bal-updated { font-size: 0.72em; font-weight: 400; opacity: 0.5; }

.pp-stage--candidates { background: #1a2535; border-color: #4fa3e055; }

.pp-of { display: block; font-size: 0.65em; opacity: 0.55; white-space: nowrap; }

/* --- Topbar nav (archive tab) --- */
.topbar-nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-left: 0.5rem;
}
.topbar-nav__link {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.88rem;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}
.topbar-nav__link:hover {
  color: var(--text);
  background: rgba(61, 139, 253, 0.08);
}
.topbar-nav__link.is-active {
  color: var(--accent);
  background: rgba(61, 139, 253, 0.14);
}

/* --- Archive panel --- */
.archive-panel__title {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
}
.archive-panel__hint {
  margin: 0 0 1rem;
}
.archive-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: flex-end;
  margin-bottom: 1rem;
}
.archive-filter {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 120px;
}
.archive-filter--search {
  flex: 1 1 180px;
  min-width: 160px;
}
.archive-filter--search input {
  width: 100%;
  max-width: 280px;
  padding: 0.4rem 0.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
}
.archive-filter select,
.archive-filter input[type="date"] {
  padding: 0.4rem 0.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  min-width: 120px;
}
.archive-filter input[type="date"] {
  min-width: 140px;
}
.archive-filter__label {
  font-size: 0.78rem;
  color: var(--muted);
}
.archive-filter--actions {
  flex-direction: row;
  align-items: flex-end;
  gap: 0.5rem;
}
.archive-filter--actions .btn {
  margin-top: 0;
}
/* Compact buttons in archive panel only */
.archive-panel .btn-sm {
  padding: 0.28rem 0.6rem;
  font-size: 0.8rem;
  margin-top: 0;
  line-height: 1.25;
}
.archive-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.archive-export {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}
.archive-export .btn-export {
  display: inline-block;
  padding: 0.3rem 0.65rem;
  font-size: 0.78rem;
  line-height: 1.2;
  text-decoration: none;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: #1e2d42;
  color: var(--text);
  margin: 0;
  white-space: nowrap;
}
.archive-export .btn-export:hover {
  background: #243044;
  color: #fff;
}
.archive-export .btn-export--accent {
  border-color: rgba(61, 139, 253, 0.5);
  background: rgba(61, 139, 253, 0.12);
  color: var(--accent);
}
.archive-export .btn-export--accent:hover {
  background: rgba(61, 139, 253, 0.22);
  color: #fff;
}
.archive-table-wrap {
  margin-bottom: 0.75rem;
  overflow: hidden;
}
.archive-table {
  table-layout: fixed;
  width: 100%;
}
.archive-table col.col-select  { width: 3%; }
.archive-table col.col-domain  { width: 17%; }
.archive-table col.col-zone    { width: 5%; }
.archive-table col.col-status  { width: 13%; }
.archive-table col.col-type    { width: 7%; }
.archive-table col.col-dr      { width: 4%; }
.archive-table col.col-thematic{ width: 28%; }
.archive-table col.col-lang    { width: 8%; }
.archive-table col.col-date    { width: 9%; }
.archive-table col.col-shots   { width: 6%; }
/* total: 100% */
.archive-table .archive-select-th,
.archive-table .archive-select {
  text-align: center;
  vertical-align: middle;
  padding: 0.28rem 0.3rem;
}
.archive-select input[type="checkbox"] {
  display: block;
  margin: 0 auto;
  cursor: pointer;
  width: 14px;
  height: 14px;
}
.archive-domain-cell {
  overflow: hidden;
  white-space: nowrap;
}
.archive-domain-cell .archive-domain {
  display: inline-block;
  max-width: calc(100% - 1.6rem);
  vertical-align: middle;
}
.archive-copy-btn {
  display: inline-block;
  vertical-align: middle;
  margin-left: 0.15rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1rem 0.35rem;
  cursor: pointer;
  font-size: 0.75rem;
  line-height: 1.2;
  color: var(--muted);
}
.archive-copy-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(61, 139, 253, 0.1);
}
.archive-copy-btn.is-copied {
  border-color: var(--ok);
  color: var(--ok);
}
.archive-toolbar__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}
#archive-tbody tr.archive-row.is-active td {
  background: rgba(61, 139, 253, 0.14);
}
#archive-tbody tr.archive-row.is-active {
  box-shadow: inset 3px 0 0 var(--accent);
}
#archive-tbody tr.archive-row.is-active .archive-shots-btn:not(:disabled) {
  border-color: var(--accent);
  background: rgba(61, 139, 253, 0.25);
}
.archive-shots-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.15rem 0.45rem;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1.2;
  color: var(--accent);
}
.archive-shots-btn:hover:not(:disabled) {
  border-color: var(--accent);
  background: rgba(61, 139, 253, 0.12);
}
.archive-shots-btn:disabled {
  opacity: 0.35;
  cursor: default;
}
.archive-delete-btn,
#btn-delete-selected.archive-delete-btn {
  color: var(--danger);
  border-color: rgba(224, 82, 82, 0.45);
}
.archive-delete-btn:hover:not(:disabled),
#btn-delete-selected.archive-delete-btn:hover:not(:disabled) {
  background: rgba(224, 82, 82, 0.12);
  border-color: var(--danger);
}
#btn-delete-selected.archive-delete-btn:disabled {
  opacity: 0.4;
  cursor: default;
}
.screenshot-lightbox {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.88);
}
.screenshot-lightbox[hidden] {
  display: none !important;
}
.screenshot-lightbox__inner {
  position: relative;
  max-width: min(96vw, 1280px);
  max-height: 92vh;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}
.screenshot-lightbox__img-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  max-height: calc(92vh - 4rem);
  overflow: auto;
  width: 100%;
}
.screenshot-lightbox__img {
  max-width: 100%;
  max-height: calc(92vh - 4rem);
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
}
.screenshot-lightbox__caption {
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}
.screenshot-lightbox__close {
  position: absolute;
  top: -2.5rem;
  right: 0;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 1.75rem;
  cursor: pointer;
  line-height: 1;
}
/* Denser table rows */
.archive-table th,
.archive-table td {
  padding: 0.28rem 0.4rem;
  font-size: 0.8rem;
  vertical-align: middle;
  line-height: 1.25;
}
.archive-table th {
  font-size: 0.78rem;
}
/* Type column — ellipsis in fixed table */
.archive-type {
  overflow: hidden;
  max-width: 0; /* trick for fixed table ellipsis in td */
}
.archive-status {
  overflow: visible;
  max-width: none;
}
.archive-status-select {
  display: block;
  width: 100%;
  max-width: 100%;
  padding: 0.12rem 0.2rem;
  font-size: 0.72rem;
  line-height: 1.2;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  cursor: pointer;
  box-sizing: border-box;
}
.archive-status-select.archive-label--ok { color: var(--ok); border-color: rgba(80, 200, 120, 0.35); }
.archive-status-select.archive-label--danger { color: #f07178; border-color: rgba(240, 113, 120, 0.35); }
.archive-status-select.archive-label--warn { color: #e6c84a; border-color: rgba(230, 200, 74, 0.35); }
.archive-status-select.archive-label--accent { color: var(--accent); border-color: rgba(61, 139, 253, 0.35); }
.archive-status-select.archive-label--muted { color: var(--muted); }
.archive-label {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.78rem;
  font-weight: 400;
  line-height: 1.25;
}
.archive-label--ok { color: var(--ok); }
.archive-label--danger { color: #f07178; }
.archive-label--warn { color: #e6c84a; }
.archive-label--accent { color: var(--accent); }
.archive-label--muted { color: var(--muted); }
.archive-table th.sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.archive-table th.sortable:hover {
  color: var(--accent);
}
.archive-table th.sortable::after {
  content: "";
  display: inline-block;
  width: 0.65em;
  margin-left: 0.25em;
  opacity: 0.35;
}
.archive-table th.sortable.sort-asc::after {
  content: "▲";
  opacity: 1;
  color: var(--accent);
}
.archive-table th.sortable.sort-desc::after {
  content: "▼";
  opacity: 1;
  color: var(--accent);
}
.archive-domain {
  font-family: ui-monospace, monospace;
  font-size: 0.82em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.archive-zone,
.archive-dr,
.archive-lang,
.archive-date {
  white-space: nowrap;
}
.archive-thematic {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.archive-pagination {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.archive-pagination .btn {
  margin-top: 0;
}
.archive-pagination__info {
  font-size: 0.88rem;
  color: var(--muted);
}

@media (max-width: 720px) {
  .topbar-nav { display: none; }
  .archive-filters { flex-direction: column; align-items: stretch; }
  .archive-filter select,
  .archive-filter--search input { max-width: 100%; }
}

/* Stopwords tab */
.stopwords-panel__title { margin: 0 0 0.35rem; font-size: 1.15rem; }
.stopwords-panel__hint { margin: 0 0 1rem; line-height: 1.45; }
.stopwords-add {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.stopwords-add__field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 180px;
}
.stopwords-add__field--narrow { min-width: 90px; max-width: 110px; }
.stopwords-add__label { font-size: 0.82rem; color: var(--muted); }
.stopwords-add input[type="text"],
.stopwords-add input[type="number"] {
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
}
.stopwords-add .btn { margin-top: 0; }
.stopwords-add__error { font-size: 0.88rem; align-self: center; }
.stopwords-threshold {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.stopwords-threshold__input {
  width: 4.5rem;
  padding: 0.3rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.stopwords-threshold__input--saving { opacity: 0.6; }
.stopwords-threshold__input--saved {
  border-color: #3ddc84;
  box-shadow: 0 0 0 1px rgba(61, 220, 132, 0.35);
}
.stopwords-threshold__input--err {
  border-color: #e05252;
  box-shadow: 0 0 0 1px rgba(224, 82, 82, 0.35);
}
.stopwords-threshold__save { margin-top: 0; }
.stopwords-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.stopwords-actions .btn { margin-top: 0; }
.stopwords-delete { color: #e05252; border-color: rgba(224, 82, 82, 0.45); }
.stopwords-word { font-weight: 500; }
.stopwords-date { white-space: nowrap; font-size: 0.88rem; color: var(--muted); }
.stopwords-table-wrap {
  max-height: 70vh;
  overflow-y: auto;
}
