:root {
  --bg: #f4f6f9;
  --sidebar: #1e293b;
  --sidebar-hover: #334155;
  --sidebar-active: #3b82f6;
  --card: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --ok: #16a34a;
  --warn: #d97706;
  --err: #dc2626;
  --border: #e2e8f0;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  background: var(--sidebar);
  color: #e2e8f0;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  padding: 1.25rem 1.5rem;
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  text-decoration: none;
}

.sidebar-brand span {
  display: block;
  font-size: 0.75rem;
  font-weight: 400;
  color: #94a3b8;
  margin-top: 0.2rem;
}

.sidebar nav {
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}

.sidebar nav a {
  display: block;
  padding: 0.65rem 1rem;
  border-radius: 8px;
  color: #cbd5e1;
  text-decoration: none;
  font-size: 0.95rem;
  transition: background 0.15s;
}

.sidebar nav a:hover {
  background: var(--sidebar-hover);
  color: #fff;
}

.sidebar nav a.active {
  background: var(--sidebar-active);
  color: #fff;
  font-weight: 600;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin-bottom: 0.15rem;
}

.nav-group-label {
  padding: 0.45rem 1rem 0.15rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
}

.sidebar nav a.nav-sub {
  padding: 0.5rem 1rem 0.5rem 1.65rem;
  font-size: 0.88rem;
}

.sidebar nav a.nav-sub.active {
  background: var(--sidebar-active);
  color: #fff;
  font-weight: 600;
}

.link-mix-fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem 1rem;
  margin: 0 0 1rem;
}

.link-mix-fieldset legend {
  padding: 0 0.35rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.sidebar-footer {
  margin-top: auto;
  padding: 1rem 1.25rem 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.sidebar-user {
  font-size: 0.8rem;
  color: #94a3b8;
}

.sidebar-user::before {
  content: "● ";
  color: #22c55e;
  font-size: 0.65rem;
  vertical-align: middle;
}

.sidebar-logout {
  font-size: 0.85rem;
  color: #cbd5e1;
  text-decoration: none;
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  text-align: center;
  transition: background 0.15s, color 0.15s;
}

.sidebar-logout:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

/* ——— Login page ——— */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem;
  background: #0b1220;
  color: #e2e8f0;
  position: relative;
  overflow: hidden;
}

.login-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.login-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.06) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, #000 20%, transparent 75%);
}

.login-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.55;
}

.login-orb-a {
  width: 420px;
  height: 420px;
  background: #2563eb;
  top: -120px;
  right: -80px;
  animation: login-float 12s ease-in-out infinite;
}

.login-orb-b {
  width: 360px;
  height: 360px;
  background: #7c3aed;
  bottom: -100px;
  left: -60px;
  animation: login-float 14s ease-in-out infinite reverse;
}

@keyframes login-float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(24px, -18px) scale(1.05); }
}

.login-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
}

.login-card {
  background: rgba(15, 23, 42, 0.82);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 20px;
  padding: 2rem 2rem 1.75rem;
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(16px);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.login-logo {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: 0.04em;
  color: #fff;
  box-shadow: 0 8px 24px rgba(59, 130, 246, 0.35);
}

.login-brand h1 {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 700;
  color: #f8fafc;
  line-height: 1.2;
}

.login-brand p {
  margin: 0.2rem 0 0;
  font-size: 0.88rem;
  color: #94a3b8;
}

.login-alert {
  background: rgba(220, 38, 38, 0.15);
  border: 1px solid rgba(248, 113, 113, 0.35);
  color: #fecaca;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
}

.login-form {
  display: grid;
  gap: 1rem;
}

.login-field {
  display: grid;
  gap: 0.4rem;
}

.login-field span {
  font-size: 0.82rem;
  font-weight: 600;
  color: #cbd5e1;
  letter-spacing: 0.02em;
}

.login-field input {
  width: 100%;
  padding: 0.75rem 0.9rem;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(2, 6, 23, 0.65);
  color: #f1f5f9;
  font-size: 0.95rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.login-field input::placeholder {
  color: #64748b;
}

.login-field input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

.login-submit {
  margin-top: 0.35rem;
  width: 100%;
  padding: 0.85rem 1rem;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s, filter 0.12s;
  box-shadow: 0 10px 28px rgba(37, 99, 235, 0.35);
}

.login-submit:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.login-submit:active {
  transform: translateY(0);
}

.login-features {
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 1rem 0 0;
  border-top: 1px solid rgba(148, 163, 184, 0.15);
  display: grid;
  gap: 0.45rem;
}

.login-features li {
  font-size: 0.82rem;
  color: #94a3b8;
  padding-left: 1.1rem;
  position: relative;
}

.login-features li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #3b82f6;
}

.login-footer {
  text-align: center;
  margin: 1.25rem 0 0;
  font-size: 0.78rem;
  color: #64748b;
}

.main {
  flex: 1;
  padding: 2rem 2.5rem;
  max-width: 1200px;
}

.page-header {
  margin-bottom: 1.75rem;
}

.page-header h1 {
  margin: 0 0 0.35rem;
  font-size: 1.75rem;
  font-weight: 700;
}

.page-header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow);
}

.stat-card .num {
  font-size: 2.25rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.1;
}

.stat-card .label {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 0.35rem;
}

.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}

.panel h2 {
  margin: 0 0 1rem;
  font-size: 1.1rem;
  font-weight: 600;
}

.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.75rem;
}

.panel-head h2 {
  margin: 0;
  flex: 1 1 12rem;
  min-width: 0;
  line-height: 1.35;
}

.panel-head .badge-count {
  flex-shrink: 0;
  white-space: nowrap;
}

.keygen-panel h2 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin: 0 0 0.85rem;
  line-height: 1.35;
}

.keygen-panel h2 .badge-count {
  font-size: 0.78rem;
}

.hint-list {
  list-style: none;
  margin: 0 0 1.15rem;
  padding: 0;
}

.hint-list > li {
  margin: 0 0 0.7rem;
  padding: 0;
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.55;
}

.hint-list > li:last-child {
  margin-bottom: 0;
}

.hint-list > li.warn {
  color: #92400e;
  background: #fffbeb;
  border: 1px solid #fde68a;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  line-height: 1.45;
}

.hint-list-compact {
  margin-bottom: 0.75rem;
}

.hint-list code {
  font-size: 0.82rem;
  word-break: break-word;
}

.form {
  display: grid;
  gap: 1rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  align-items: start;
}

.form-grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-field-wide {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.form-field-wide label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  min-width: 0;
}

.field-hint {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.4;
}

.form label {
  display: grid;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  min-width: 0;
}

.label-text {
  display: block;
  line-height: 1.4;
}

.form input,
.form select {
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font-size: 0.95rem;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.form input:focus,
.form select:focus,
.form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form textarea {
  padding: 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.85rem;
  line-height: 1.45;
  resize: vertical;
  min-height: 120px;
  width: 100%;
}

.mode-row {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.radio {
  display: flex !important;
  align-items: center;
  gap: 0.5rem;
  font-weight: 400 !important;
  font-size: 0.9rem;
}

.radio input { width: auto; }

.alert {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1.25rem;
  font-size: 0.95rem;
}

.alert-ok {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.alert-warn {
  background: #fffbeb;
  color: #92400e;
  border: 1px solid #fde68a;
}

.alert-err {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
}

.alert-err-inline {
  color: var(--err);
  font-weight: 600;
}

.badge-count {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  background: #f1f5f9;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  vertical-align: middle;
}

.file-preview,
.file-edit-advanced {
  margin: 0.75rem 0;
}

.file-preview summary,
.file-edit-advanced summary {
  cursor: pointer;
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.file-preview .log {
  max-height: 200px;
  font-size: 0.78rem;
}

.hint.warn {
  color: #b45309;
  background: #fffbeb;
  border: 1px solid #fde68a;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
}

.progress-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
}

.progress-panel-muted {
  color: var(--muted);
  font-size: 0.9rem;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.progress-title { font-weight: 600; }
.progress-pct { font-size: 1.5rem; font-weight: 700; color: var(--accent); }

.progress-bar-wrap {
  height: 10px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #2563eb, #3b82f6);
  border-radius: 999px;
  transition: width 0.4s ease;
  min-width: 0;
}

.progress-stats,
.progress-timing {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.progress-stats .ok { color: var(--ok); font-weight: 600; }
.progress-stats .err { color: var(--err); font-weight: 600; }

.progress-current {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.5rem;
  word-break: break-all;
}

.mini-progress {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
}

.muted-cell {
  font-size: 0.85rem;
  color: var(--muted);
  white-space: nowrap;
}

.checkbox {
  display: flex !important;
  align-items: center;
  gap: 0.5rem;
  font-weight: 400 !important;
}

.checkbox input { width: auto; }

.batch-csv-block {
  margin: 0.75rem 0;
  padding: 0.75rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.batch-csv-block summary {
  cursor: pointer;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.data-table.compact td,
.data-table.compact th {
  font-size: 0.88rem;
  padding: 0.35rem 0.5rem;
}

.btn-row.compact {
  gap: 0.35rem;
  flex-wrap: wrap;
}

.site-target-block {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin: 1rem 0;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-2, rgba(255, 255, 255, 0.02));
}

.site-picker {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 0.35rem;
}

.site-picker textarea {
  font-family: var(--mono, ui-monospace, monospace);
  font-size: 0.85rem;
}

.site-picker-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.site-picker-toolbar input[type="search"] {
  flex: 1 1 12rem;
  min-width: 10rem;
}

.site-picker-list {
  max-height: 16rem;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.site-picker-item {
  margin: 0;
  font-size: 0.9rem;
}

.site-picker-item small.muted {
  color: var(--muted);
}

.hint {
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.45;
  margin: 0;
}

.hint-stack {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-bottom: 1rem;
}

.hint-stack .hint {
  margin: 0;
}

.panel > .hint,
.form > .hint {
  margin: 0.35rem 0;
}

.hint code {
  word-break: break-word;
}

.keygen-form {
  margin-top: 0.75rem;
}

.keygen-presets {
  align-items: center;
  margin-bottom: 0.5rem;
}

.keygen-presets .preset-label {
  color: var(--muted);
  font-size: 0.875rem;
}

.keygen-config-grid {
  margin-top: 0.5rem;
}

.keygen-dashboard .keygen-stats-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
}

.keygen-stat {
  display: flex;
  flex-direction: column;
  min-width: 7rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
}

.keygen-stat-value {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.2;
}

.keygen-stat-label {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

.keygen-stat-sub {
  font-size: 0.75rem;
  color: var(--muted);
}

.keygen-dashboard-charts {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  align-items: flex-start;
}

.keygen-pie-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
}

.keygen-pie {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  flex-shrink: 0;
}

.keygen-pie-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.keygen-pie-legend li {
  margin: 0.25rem 0;
}

.keygen-dot {
  display: inline-block;
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  margin-right: 0.35rem;
  vertical-align: middle;
}

.keygen-bucket-table {
  flex: 1 1 16rem;
  min-width: 14rem;
}

.btn-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.btn {
  padding: 0.65rem 1.25rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
  transition: all 0.15s;
}

.btn:hover { background: #f8fafc; }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-danger {
  background: var(--err);
  border-color: var(--err);
  color: #fff;
}

.table-wrap {
  overflow-x: auto;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.panel .table-wrap {
  box-shadow: none;
  margin-top: 0.5rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th {
  text-align: left;
  padding: 0.75rem 1rem;
  background: #f8fafc;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

tr:last-child td { border-bottom: none; }

tr:hover td { background: #f8fafc; }

.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge.pending { background: #fef3c7; color: #92400e; }
.badge.running { background: #dbeafe; color: #1e40af; }
.badge.done { background: #dcfce7; color: #166534; }
.badge.warn { background: #fef3c7; color: #92400e; }
.badge.failed { background: #fee2e2; color: #991b1b; }
.badge.cancelled { background: #f1f5f9; color: #475569; }
.badge.queued { background: #fef3c7; color: #92400e; }
.badge.assigned { background: #e0e7ff; color: #3730a3; }
.badge.in_progress,
.badge.processing { background: #dbeafe; color: #1e40af; }
.badge.stuck { background: #ffedd5; color: #9a3412; }
.badge.error { background: #fee2e2; color: #991b1b; }
.badge.indexed { background: #dcfce7; color: #166534; }

.indexing-section {
  margin-bottom: 2.5rem;
  padding-top: 0.5rem;
}

.indexing-section > h2 {
  margin: 0 0 0.35rem;
  font-size: 1.35rem;
  font-weight: 700;
}

.indexing-section > .section-desc {
  margin: 0 0 1.25rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.link:hover { text-decoration: underline; }

.log {
  background: #0f172a;
  color: #e2e8f0;
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  overflow: auto;
  max-height: 65vh;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.82rem;
  line-height: 1.45;
  margin: 0;
}

code {
  background: #f1f5f9;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.85em;
  color: #334155;
}

.job-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  align-items: center;
  margin-bottom: 1rem;
}

.job-meta-item {
  font-size: 0.9rem;
  color: var(--muted);
}

.job-meta-item strong {
  color: var(--text);
}

.panel-wide {
  margin-bottom: 1.25rem;
}

.publish-results-panel .publish-urls {
  width: 100%;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 0.85rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
  resize: vertical;
  margin-top: 0.5rem;
}

.auto-index-options {
  margin: 0.75rem 0 0 1.5rem;
  padding-left: 0.5rem;
  border-left: 3px solid var(--border);
}

.auto-index-status {
  margin: 0.75rem 0 1rem;
  padding: 0.65rem 0.85rem;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 8px;
}

.auto-index-job-list {
  list-style: none;
  margin: 0.35rem 0 0;
  padding: 0;
}

.auto-index-job-list li {
  padding: 0.25rem 0;
}

.verified-urls-section {
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 2px solid var(--border);
}

.verified-urls-section h3 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
}

.publish-urls.verified-urls {
  background: #f0fdf4;
  border-color: #86efac;
}

.publish-url-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
}

.publish-url-list li {
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border);
  word-break: break-all;
}

.publish-url-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
}

.badge.verify-ok {
  background: #dcfce7;
  color: #166534;
  font-size: 0.75rem;
  padding: 0.15rem 0.45rem;
}

.badge.verify-fail {
  background: #fee2e2;
  color: #991b1b;
  font-size: 0.75rem;
  padding: 0.15rem 0.45rem;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge.verify-warn {
  background: #fef3c7;
  color: #92400e;
  font-size: 0.75rem;
  padding: 0.15rem 0.45rem;
}

.publish-subheading {
  margin: 1.25rem 0 0.5rem;
  font-size: 1rem;
  font-weight: 600;
}

.verified-urls-section {
  margin-top: 0.75rem;
  margin-bottom: 1rem;
  padding: 1rem 1.1rem;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius);
}

.verified-urls-section h3 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
}

.verify-ok-hint {
  color: var(--ok);
  margin-top: 0.75rem;
}

.verify-failures-panel summary {
  color: var(--err);
  font-weight: 600;
}

.publish-url-list .muted {
  color: var(--muted);
  font-size: 0.85rem;
}

.publish-failures {
  margin-top: 1rem;
  font-size: 0.9rem;
}

.publish-failures summary {
  cursor: pointer;
  color: var(--muted);
}

.btn-secondary {
  background: #f1f5f9;
}

.field-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}

@media (max-width: 768px) {
  .layout { flex-direction: column; }
  .sidebar {
    width: 100%;
    height: auto;
    position: static;
  }
  .sidebar nav {
    flex-direction: row;
    flex-wrap: wrap;
    padding: 0.5rem;
  }
  .main { padding: 1.25rem; }
  .form-grid-2,
  .form-grid-3 {
    grid-template-columns: 1fr;
  }
}

/* Semantic core panel */
.semantic-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 1.25rem;
}

.semantic-tab {
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
}

.semantic-tab:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.semantic-section {
  scroll-margin-top: 1rem;
  margin-bottom: 1.5rem;
}

.semantic-stats {
  margin-bottom: 1.25rem;
}

.semantic-results-box {
  margin-top: 1rem;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--border);
  padding: 0.55rem 0.65rem;
  text-align: left;
  vertical-align: top;
}

.data-table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.semantic-title-cell {
  max-width: 320px;
}

.semantic-sample {
  font-size: 0.85rem;
  color: var(--muted);
  max-width: 280px;
}

.semantic-lsi-list {
  margin: 0.35rem 0 0;
  padding-left: 1.1rem;
  font-size: 0.85rem;
}

.semantic-lsi-list .lsi-used {
  color: var(--muted);
}

.semantic-lsi-list .lsi-miss {
  color: var(--err);
}

.code-area {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.85rem;
  width: 100%;
  min-height: 12rem;
}

.semantic-create-row {
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.semantic-import-block {
  margin-top: 1rem;
  padding: 0.75rem;
  border: 1px dashed var(--border);
  border-radius: 8px;
}

.archive-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.75rem;
}

.archive-filters .input {
  min-width: 10rem;
}

.archive-filters #archive-q {
  flex: 1 1 16rem;
  max-width: 28rem;
}

.archive-details {
  margin-bottom: 1rem;
}

.archive-details summary {
  cursor: pointer;
  margin-bottom: 0.5rem;
  color: var(--muted);
}

.inline-form {
  display: inline;
}

.btn-sm {
  padding: 0.25rem 0.55rem;
  font-size: 0.8rem;
}

.badge-high, .badge-ok, .badge.ok {
  background: #dcfce7;
  color: #166534;
}

.badge-medium, .badge-warn, .badge.warn {
  background: #fef3c7;
  color: #92400e;
}

.badge-low, .badge-none, .badge.fail, .badge-fail {
  background: #fee2e2;
  color: #991b1b;
}

.badge-muted {
  background: #f1f5f9;
  color: #64748b;
}

.audit-ok td:first-child { border-left: 3px solid var(--ok); }
.audit-warn td:first-child { border-left: 3px solid var(--warn); }
.audit-fail td:first-child { border-left: 3px solid var(--err); }

.row-warn {
  background: #fffbeb;
}

.form-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
}

.btn-link {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--accent);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  padding: 0.55rem 1rem;
  border-radius: 8px;
}

.page-header-compact {
  margin-bottom: 0.75rem;
}

.page-header-compact p {
  margin-bottom: 0;
}

.pipeline-wizard {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

/* ── SEO Pipeline (dashboard) ── */
.pipeline-panel {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.35rem 1.5rem 1.5rem;
  margin-bottom: 1.75rem;
}

.pipeline-panel-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.1rem;
}

.pipeline-title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
}

.pipeline-subtitle {
  margin: 0.25rem 0 0;
  font-size: 0.88rem;
  color: var(--muted);
}

.pipeline-summary {
  text-align: right;
  line-height: 1.1;
}

.pipeline-summary-count {
  display: block;
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--accent);
}

.pipeline-summary-label {
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pipeline-progress {
  height: 8px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.pipeline-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #2563eb, #16a34a);
  border-radius: 999px;
  transition: width 0.35s ease;
}

.pipeline-progress-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 1.25rem;
}

.pipeline-progress-legend .dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 0.35rem;
  vertical-align: middle;
}

.dot-done { background: var(--ok); }
.dot-warn { background: var(--warn); }
.dot-pending { background: #cbd5e1; }

.pipeline-track {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
  position: relative;
}

.pipeline-item {
  position: relative;
  min-width: 0;
}

.pipeline-connector {
  position: absolute;
  top: 2.1rem;
  left: calc(50% + 1.4rem);
  right: calc(-50% + 1.4rem);
  height: 3px;
  background: #e2e8f0;
  z-index: 0;
  pointer-events: none;
}

.pipeline-item-done .pipeline-connector {
  background: linear-gradient(90deg, #86efac, #bbf7d0);
}

.pipeline-item-warn .pipeline-connector {
  background: linear-gradient(90deg, #fde68a, #e2e8f0);
}

.pipeline-card {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  text-decoration: none;
  color: inherit;
  padding: 0.5rem 0.65rem 0.85rem;
  border-radius: 10px;
  transition: background 0.15s, transform 0.15s, box-shadow 0.15s;
}

.pipeline-card:hover {
  background: rgba(37, 99, 235, 0.06);
  transform: translateY(-2px);
}

.pipeline-card:hover .pipeline-card-cta {
  opacity: 1;
  transform: translateY(0);
}

.pipeline-badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  margin-bottom: 0.5rem;
}

.pipeline-badge-done {
  background: #dcfce7;
  color: #166534;
}

.pipeline-badge-warn {
  background: #fef3c7;
  color: #92400e;
}

.pipeline-badge-pending {
  background: #f1f5f9;
  color: #64748b;
}

.pipeline-node {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1rem;
  margin-bottom: 0.65rem;
  border: 3px solid #e2e8f0;
  background: #fff;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.pipeline-item-done .pipeline-node {
  border-color: #86efac;
  background: #f0fdf4;
  color: #16a34a;
}

.pipeline-item-warn .pipeline-node {
  border-color: #fcd34d;
  background: #fffbeb;
  color: #d97706;
}

.pipeline-item-pending .pipeline-node {
  border-color: #e2e8f0;
  background: #fff;
  color: #94a3b8;
}

.pipeline-card:hover .pipeline-node {
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.15);
}

.pipeline-node-icon {
  width: 1.25rem;
  height: 1.25rem;
}

.pipeline-node-num {
  line-height: 1;
}

.pipeline-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  width: 100%;
}

.pipeline-card-label {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--text);
}

.pipeline-card-desc {
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.3;
}

.pipeline-card-hint {
  font-size: 0.72rem;
  color: #64748b;
  margin-top: 0.15rem;
  line-height: 1.35;
  min-height: 2.5em;
}

.pipeline-card-cta {
  margin-top: 0.45rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.15s, transform 0.15s;
}

@media (max-width: 1100px) {
  .pipeline-track {
    grid-template-columns: repeat(3, 1fr);
    row-gap: 1.25rem;
  }
  .pipeline-connector { display: none; }
}

@media (max-width: 768px) {
  .pipeline-track {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
  .pipeline-card {
    flex-direction: row;
    text-align: left;
    align-items: flex-start;
    gap: 0.85rem;
    padding: 0.85rem 1rem;
    border: 1px solid var(--border);
    background: #fff;
  }
  .pipeline-badge {
    position: absolute;
    top: 0.65rem;
    right: 0.75rem;
    margin: 0;
  }
  .pipeline-node {
    flex-shrink: 0;
    margin-bottom: 0;
    width: 2.4rem;
    height: 2.4rem;
    font-size: 0.9rem;
  }
  .pipeline-card-body { align-items: flex-start; }
  .pipeline-card-hint { min-height: auto; }
  .pipeline-card-cta {
    opacity: 1;
    transform: none;
    margin-top: 0.25rem;
  }
  .pipeline-summary { text-align: left; }
}

.seo-gate-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin: 0.5rem 0;
}

.titles-preview-box {
  margin-top: 0.75rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #f8fafc;
}

.titles-preview-meta {
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: 0.65rem;
}

.titles-preview-list {
  margin: 0;
  padding: 0;
  list-style: none;
  max-height: 320px;
  overflow-y: auto;
  font-size: 0.92rem;
  line-height: 1.45;
}

.titles-preview-list li {
  display: flex;
  gap: 0.65rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border);
}

.titles-preview-list li:last-child {
  border-bottom: none;
}

.titles-preview-num {
  flex-shrink: 0;
  min-width: 2rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 0.8rem;
}

.titles-preview-check {
  flex-shrink: 0;
  display: flex;
  align-items: flex-start;
  padding-top: 0.15rem;
}

.titles-preview-text {
  flex: 1;
  min-width: 0;
}

.titles-preview-actions {
  margin: 0.5rem 0 0.75rem;
}

.title-status-badge {
  flex-shrink: 0;
  width: 1.25rem;
  text-align: center;
  font-weight: 600;
}

.title-status-ok,
.title-status-badge.title-status-ok {
  color: #15803d;
}

.title-status-failed,
.title-status-badge.title-status-failed {
  color: #b45309;
}

.title-status-pending,
.title-status-badge.title-status-pending {
  color: var(--muted);
}

.titles-preview-list li.title-row-ok {
  opacity: 0.72;
}

/* Archive Domain Hub */
.archive-hub-stats {
  margin-bottom: 1rem;
}

.stat-card-link {
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.stat-card-link:hover {
  border-color: var(--accent);
}

.stat-card-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.text-warn {
  color: var(--warn);
}

.archive-hub-meta {
  margin: 0 0 1rem;
}

.archive-hub-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  gap: 1rem;
  align-items: start;
}

.archive-hub-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.archive-hub-search {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  flex: 1 1 20rem;
}

.archive-hub-search .input {
  flex: 1 1 16rem;
  min-width: 12rem;
}

.archive-scenario-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1rem;
}

.archive-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 0.82rem;
  cursor: pointer;
}

.archive-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.archive-chip-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.archive-chip-active .archive-chip-count {
  color: rgba(255, 255, 255, 0.85);
}

.archive-chip-count {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: 0.78rem;
}

.archive-table-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  font-size: 0.88rem;
  color: var(--muted);
}

.archive-pagination {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.archive-hub-table tbody tr.archive-domain-row {
  cursor: pointer;
}

.archive-hub-table tbody tr.archive-domain-row:hover {
  background: rgba(37, 99, 235, 0.04);
}

.archive-hub-table tbody tr.archive-row-active {
  background: rgba(37, 99, 235, 0.08);
}

.archive-domain-code {
  font-size: 0.82rem;
  word-break: break-all;
}

.archive-substatus {
  display: block;
  margin-top: 0.15rem;
}

.archive-error-hint {
  margin-top: 0.2rem;
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-pill {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.3;
}

.pill-ok {
  background: rgba(22, 163, 74, 0.12);
  color: var(--ok);
}

.pill-warn {
  background: rgba(217, 119, 6, 0.12);
  color: var(--warn);
}

.pill-err {
  background: rgba(220, 38, 38, 0.12);
  color: var(--err);
}

.pill-muted {
  background: rgba(100, 116, 139, 0.12);
  color: var(--muted);
}

.archive-empty-state {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--muted);
}

.archive-drawer {
  position: sticky;
  top: 1rem;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
}

.archive-drawer-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.archive-drawer-header h2 {
  margin: 0;
  font-size: 1rem;
  word-break: break-all;
}

.archive-drawer-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.archive-drawer-dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.35rem 0.75rem;
  margin: 0 0 1rem;
  font-size: 0.88rem;
}

.archive-drawer-dl dt {
  color: var(--muted);
  margin: 0;
}

.archive-drawer-dl dd {
  margin: 0;
  word-break: break-word;
}

.archive-error-text {
  color: var(--err);
}

.archive-drawer-subtitle {
  margin: 1rem 0 0.5rem;
  font-size: 0.92rem;
}

.archive-drawer-actions {
  margin-top: 0.5rem;
}

.archive-timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}

.archive-timeline-item {
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.archive-timeline-item:last-child {
  border-bottom: none;
}

.archive-timeline-at {
  font-size: 0.78rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

@media (max-width: 960px) {
  .archive-hub-layout {
    grid-template-columns: 1fr;
  }

  .archive-drawer {
    position: static;
    max-height: none;
  }
}
