/* Evidence Exchange — design system
 * Self-hosted only. No external origins (fonts, images, remote stylesheets) — CSP default-src 'self'.
 * System font stack; no Google Fonts.
 */

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

:root {
  --bg:          #07091A;
  --surface:     #0C1027;
  --surface-2:   #101530;
  --border:      #1C2342;
  --border-h:    #2A3560;
  --text:        #E4EAFF;
  --muted:       #6B7FAB;
  --blue:        #3D5CFF;
  --blue-h:      #5572FF;
  --blue-glow:   rgba(61, 92, 255, 0.28);
  --blue-dim:    rgba(61, 92, 255, 0.10);
  --green:       #00CF76;
  --green-dim:   rgba(0, 207, 118, 0.12);
  --red:         #FF4D6A;
  --red-dim:     rgba(255, 77, 106, 0.12);
  --amber:       #FFB020;
  --amber-dim:   rgba(255, 176, 32, 0.12);
}

.login-panel {
  --surface: #010203;
  --border: #4C4D4F;
  --text: #FFFFFF;
  --blue: #0077FF;
  --blue-h: #002C6F;
  --blue-glow: rgba(0, 119, 255, 0.28);
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  padding: 28px;
  font-family: "Die Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
}

.login-panel form {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.login-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}

.login-hint {
  color: #8D8E92;
  margin: 2px 0 20px;
}

.login-field {
  display: grid;
  gap: 6px;
}

.login-panel label {
  color: #DADBE1;
  font-weight: 500;
}

/* Boxed field: the wrapper draws the border so the Show toggle sits inside
   it, and the look is identical whether the input is type=password or text. */
.password-field {
  display: flex;
  align-items: center;
  min-height: 50px;
  padding: 0 8px 0 14px;
  background: #07091A;
  border: 1px solid #2A3560;
  border-radius: 8px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.password-field:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0, 119, 255, 0.25);
}

.password-field.has-error {
  border: 1.5px solid #FF8469;
}

.password-field.has-error:focus-within {
  box-shadow: 0 0 0 3px rgba(255, 132, 105, 0.2);
}

.password-field input {
  flex: 1;
  min-width: 0;
  padding: 12px 0;
  background: transparent;
  border: 0;
  outline: none;
  color: var(--text);
  caret-color: var(--text);
  font: inherit;
  font-size: 16px;
  letter-spacing: 0;
  color-scheme: dark;
}

.password-field input:-webkit-autofill {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px #07091A inset;
}

.password-toggle {
  flex-shrink: 0;
  background: none;
  border: 0;
  border-radius: 6px;
  padding: 6px 8px;
  color: #85D3FF;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.password-toggle[hidden] { display: none; }

.password-toggle:hover { background: rgba(133, 211, 255, 0.08); }

.password-toggle:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
}

.field-error {
  font-size: 13px;
  color: #FF8469;
}

.caps-warning {
  font-size: 13px;
  color: #FFC800;
}

.caps-warning[hidden] { display: none; }

.login-panel .btn {
  min-height: 48px;
  justify-content: center;
  letter-spacing: 0;
}

.login-panel .cf-turnstile {
  overflow: auto;
  max-width: 100%;
}

.upload-limit {
  margin-bottom: 20px;
  padding: 12px 16px;
  border-left: 3px solid var(--blue-h);
  background: var(--blue-dim);
  color: var(--text);
  overflow-wrap: anywhere;
}

body {
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(61,92,255,0.08) 0%, transparent 70%),
    radial-gradient(circle, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: auto, 28px 28px;
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Topbar ───────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(7, 9, 26, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 32px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}

.brand-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.brand-logo {
  display: block;
  width: 176px;
  height: 21px;
  object-fit: contain;
  flex-shrink: 0;
}

.brand-name {
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.06em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 20px;
  flex: 1;
  /* Lockup lettering sits in the lower part of the image; match its baseline. */
  position: relative;
  top: 5px;
}

.nav-links a {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  letter-spacing: 0.02em;
}

.nav-links a:hover {
  color: #ffffff;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.status-text {
  font-size: 12px;
  color: var(--green);
  white-space: nowrap;
}

.case-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.logout-form {
  margin: 0;
}

.btn-logout {
  padding: 6px 14px;
  font-size: 12px;
}

.config-badge {
  font-size: 11.5px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 12px;
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

@keyframes badgePulse {
  0%, 100% { opacity: 1;    box-shadow: 0 0 0   0   rgba(255,176,32,0); }
  50%       { opacity: 0.6; box-shadow: 0 0 10px 2px rgba(255,176,32,0.45); }
}
.config-badge.is-checking {
  color: var(--amber);
  border-color: rgba(255,176,32,0.4);
  animation: badgePulse 1.1s ease-in-out infinite;
}
.config-badge.is-valid {
  color: var(--green);
  border-color: rgba(0,207,118,0.3);
}
.badge-bulb {
  display: inline-block;
  width: 11px;
  height: 11px;
  vertical-align: -1px;
  margin-right: 4px;
  flex-shrink: 0;
}

/* ── Main layout ──────────────────────────────── */
.main {
  max-width: 900px;
  margin: 0 auto;
  padding: 48px 32px 80px;
}

/* ── Page header ──────────────────────────────── */
.page-header {
  margin-bottom: 32px;
}

.page-header h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text);
  margin-bottom: 6px;
}

.page-header p {
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.page-header p span {
  display: inline-block;
  margin: 0 6px;
  opacity: 0.4;
}

/* ── Cards ────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

/* ── Drop zone ────────────────────────────────── */
.drop-zone {
  padding: 56px 40px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
  margin-bottom: 16px;
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--blue);
  background: var(--surface-2);
  box-shadow: 0 0 0 1px var(--blue), inset 0 0 40px rgba(61,92,255,0.04);
}

.drop-zone input[type="file"] { display: none; }

.drop-icon-wrap {
  width: 56px;
  height: 56px;
  background: var(--blue-dim);
  border: 1px solid rgba(61,92,255,0.3);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  transition: background 0.2s, box-shadow 0.2s;
}

.drop-zone:hover .drop-icon-wrap,
.drop-zone.drag-over .drop-icon-wrap {
  background: rgba(61,92,255,0.18);
  box-shadow: 0 0 16px var(--blue-glow);
}

.drop-icon-wrap svg { width: 26px; height: 26px; }

.drop-primary {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.drop-secondary {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 24px;
}

/* ── Buttons ──────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 20px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: background 0.15s, box-shadow 0.15s, opacity 0.15s;
  white-space: nowrap;
}

.btn-outline {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text);
}

.btn-outline:hover {
  border-color: var(--border-h);
  background: #151d3e;
}

.btn-primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
  box-shadow: 0 0 18px var(--blue-glow);
}

.btn-primary:hover:not(:disabled) {
  background: var(--blue-h);
  border-color: var(--blue-h);
  box-shadow: 0 0 28px rgba(61,92,255,0.45);
}

.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; }

/* ── Actions bar ──────────────────────────────── */
.actions {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  margin-bottom: 4px;
}

.file-summary {
  flex: 1;
  font-size: 13px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.clear-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}

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

/* ── Overall progress ─────────────────────────── */
.overall-card {
  display: none;
  padding: 16px 20px;
  border-radius: 10px;
  margin-bottom: 8px;
}

.overall-card.visible { display: block; }

.card-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
}

.card-label strong { color: var(--text); font-size: 13px; font-weight: 600; }

/* ── Progress bars ────────────────────────────── */
.bar-track {
  background: var(--surface-2);
  border-radius: 99px;
  height: 6px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 99px;
  width: 0%;
  background: var(--blue);
  transition: width 0.3s ease, background 0.4s;
  box-shadow: 0 0 8px var(--blue-glow);
}

.bar-fill.done  { background: var(--green); box-shadow: 0 0 8px rgba(0,207,118,0.3); }
.bar-fill.error { background: var(--red);   box-shadow: 0 0 8px rgba(255,77,106,0.3); }

/* ── File list ────────────────────────────────── */
.file-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.file-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  transition: border-color 0.2s;
  animation: cardIn 0.22s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.file-card.is-done  { border-color: rgba(0,207,118,0.25); }
.file-card.is-error { border-color: rgba(255,77,106,0.25); }
.file-card-blocked  { border-color: rgba(255,77,106,0.3); opacity: 0.8; }
.file-blocked-reason {
  font-size: 11px;
  color: var(--red);
  padding: 0 4px 6px;
  margin-top: -2px;
}

.file-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.file-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  background: var(--blue-dim);
  border: 1px solid rgba(61,92,255,0.2);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.file-icon svg { width: 16px; height: 16px; }

.file-name {
  flex: 1;
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}

.file-size { font-size: 12px; color: var(--muted); flex-shrink: 0; }

/* ── Badges ───────────────────────────────────── */
.badge {
  flex-shrink: 0;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
}

.badge-queued    { background: var(--surface-2);  color: var(--muted);  border-color: var(--border); }
.badge-resume    { background: var(--amber-dim);   color: var(--amber);  border-color: rgba(255,176,32,0.25); }
.badge-uploading { background: var(--blue-dim);    color: #A0B4FF;       border-color: rgba(61,92,255,0.3); }
.badge-done      { background: var(--green-dim);   color: var(--green);  border-color: rgba(0,207,118,0.3); }
.badge-error     { background: var(--red-dim);     color: var(--red);    border-color: rgba(255,77,106,0.3); }

/* ── File footer ──────────────────────────────── */
.file-footer {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
  margin-top: 8px;
}

.error-msg {
  font-size: 12px;
  color: var(--red);
  margin-top: 6px;
}

/* ── Info / contact widget ────────────────────── */
.info-widget {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 272px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px 20px;
  z-index: 200;
  box-shadow: 0 8px 40px rgba(0,0,0,0.55), 0 0 0 1px rgba(61,92,255,0.08);
  animation: cardIn 0.35s cubic-bezier(0.22, 1, 0.36, 1) 0.6s both;
}

.info-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}

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

.info-header {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 10px;
}

.info-header-icon {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  background: var(--blue-dim);
  border: 1px solid rgba(61,92,255,0.25);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.info-header-icon svg { width: 16px; height: 16px; }

.info-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.01em;
}

.info-divider {
  height: 1px;
  background: var(--border);
  margin: 12px 0;
}

.info-body {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 12px;
}

.info-email {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--blue);
  text-decoration: none;
  transition: color 0.15s, text-shadow 0.15s;
}

.info-email:hover {
  color: var(--blue-h);
  text-shadow: 0 0 12px var(--blue-glow);
}

.info-email svg { width: 13px; height: 13px; flex-shrink: 0; }

/* ── Active nav link ──────────────────────────── */
.nav-links a[aria-current="page"] {
  color: #ffffff;
}

/* ── Download page ────────────────────────────── */
/* Brand blue scoped to this page, mirroring .login-panel. */
.download-page {
  --blue: #0077FF;
  --blue-h: #2E8FFF;
  --blue-glow: rgba(0, 119, 255, 0.28);
  --accent: #8BE000;
}

/* Sidebar tabs on the left, panel on the right. */
.download-page {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

.download-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.3px;
  margin-bottom: 16px;
}

.download-tabs {
  display: grid;
  gap: 8px;
}

.download-tabs[hidden] { display: none; }

/* Radio-card tabs: a filled radio and blue border mark the selected tab. */
.download-tab {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  color: var(--muted);
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.download-tab:hover {
  border-color: var(--border-h);
  color: var(--text);
}

.tab-radio {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1.5px solid var(--border-h);
  transition: border-width 0.15s, border-color 0.15s;
}

.download-tab[aria-selected="true"] {
  border-color: var(--blue);
  background: #0A1838;
  color: #ffffff;
}

.download-tab[aria-selected="true"] .tab-radio {
  border: 5px solid var(--blue);
}

.download-tab:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.download-panel + .download-panel { margin-top: 36px; }

.download-panel[hidden] { display: none; }

.panel-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
}

/* Two side-by-side "plans", one per upload method. */
.plan-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.plan {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
}

.plan-recommended {
  border: 1.5px solid var(--blue);
  box-shadow: 0 0 0 4px var(--blue-dim);
}

.plan-tag {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}

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

.plan-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.plan-desc {
  color: var(--muted);
  margin: 6px 0 20px;
  min-height: 44px;
}

.plan-desc a {
  color: var(--text);
  text-underline-offset: 2px;
}

.plan-builds {
  display: grid;
  gap: 8px;
  margin-top: auto;
}

.plan-btn {
  width: 100%;
  justify-content: space-between;
  padding: 12px 16px;
  font-size: 14px;
}

.plan-arch {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
  font-weight: 500;
  opacity: 0.75;
}

.plan-btn:disabled { opacity: 0.6; cursor: progress; }

.download-page .btn:focus-visible,
.plan-desc a:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.plan-none {
  color: var(--muted);
  font-size: 13px;
}

/* Certificate: name and button side by side, never pushed apart. */
.cert-card {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
}

.cert-name { font-weight: 600; }

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

.other-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin: 28px 0 10px;
}

.other-list {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.other-row { padding: 10px 14px; }

.other-row + .other-row { border-top: 1px solid var(--border); }

.other-row .file-name { flex: 1; font-weight: 500; }

.other-row .btn { padding: 7px 16px; }

.empty-state {
  margin-top: 20px;
  color: var(--muted);
}

@media (max-width: 820px) {
  .download-page { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .download-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .plan-grid { grid-template-columns: minmax(0, 1fr); }
  .plan-desc { min-height: 0; }
}

/* ── Help menu (topbar) ───────────────────────── */
.help-menu { position: relative; }

.help-btn {
  padding: 6px 10px;
  font-size: 12px;
  gap: 6px;
}

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

.help-btn svg { width: 15px; height: 15px; }

.help-btn .help-chev { width: 13px; height: 13px; transition: transform 0.2s; }

.help-btn[aria-expanded="true"] { border-color: #0077FF; }

.help-btn[aria-expanded="true"] .help-chev { transform: rotate(180deg); }

.help-pop {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 290px;
  padding: 8px;
  background: #0E1330;
  border: 1px solid var(--border-h);
  border-radius: 12px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
  z-index: 60;
  animation: tour-pop-in 0.18s ease;
}

.help-pop[hidden] { display: none; }

.help-pop-head {
  padding: 6px 10px 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.help-item,
.help-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  background: none;
  border: 0;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.help-item:hover,
.help-toggle:hover { background: rgba(0, 119, 255, 0.10); }

.help-item:focus-visible { outline: 2px solid #0077FF; outline-offset: -2px; }

.help-item small,
.help-toggle small { display: block; font-size: 12px; color: var(--muted); }

.help-item-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border-radius: 50%;
  background: rgba(0, 119, 255, 0.18);
  color: #85D3FF;
  font-size: 11px;
}

.help-toggle > span:first-child { flex: 1; }

.help-toggle input { position: absolute; opacity: 0; pointer-events: none; }

.switch {
  position: relative;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
  border-radius: 999px;
  background: #2A3560;
  transition: background 0.2s;
}

.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
}

.help-toggle input:checked + .switch { background: #0077FF; }

.help-toggle input:checked + .switch::after { transform: translateX(16px); }

.help-toggle input:focus-visible + .switch { outline: 2px solid #85D3FF; outline-offset: 2px; }

.help-pop-foot {
  margin-top: 4px;
  padding: 8px 10px 4px;
  border-top: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--muted);
}

.help-menu.attention .help-btn {
  border-color: #0077FF;
  animation: tour-ring 1.2s ease-out 3;
}

/* ── Orientation walkthrough ──────────────────── */
/* Fixed overlay; tour.js only sets computed positions. The spotlight's huge
   box-shadow dims everything except the highlighted rectangle. */
.tour-layer {
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
}

.tour-layer[hidden] { display: none; }

.tour-spot {
  position: absolute;
  border-radius: 12px;
  box-shadow: 0 0 0 9999px rgba(3, 5, 16, 0.72);
  outline: 2px solid #0077FF;
  transition: top 0.45s cubic-bezier(.2, .8, .2, 1), left 0.45s cubic-bezier(.2, .8, .2, 1),
              width 0.45s cubic-bezier(.2, .8, .2, 1), height 0.45s cubic-bezier(.2, .8, .2, 1);
}

.tour-spot::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  animation: tour-spot-pulse 1.8s ease-out infinite;
}

.tour-spot-num {
  position: absolute;
  top: -14px;
  left: -14px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #0077FF;
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  box-shadow: 0 0 0 3px var(--bg);
}

/* No room above (target touches the top edge): put the badge below. */
.tour-spot.num-below .tour-spot-num { top: auto; bottom: -14px; }

.tour-spot-num.is-entering { animation: tour-num-pop 0.4s cubic-bezier(.3, 1.6, .5, 1); }

.tour-balloon {
  --ax: 50%;
  --ay: 50%;
  position: absolute;
  width: 340px;
  max-width: calc(100vw - 24px);
  padding: 16px 18px 14px;
  background: #121A44;
  color: var(--text);
  border: 1px solid #2E4AA8;
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
  pointer-events: auto;
  transition: top 0.45s cubic-bezier(.2, .8, .2, 1), left 0.45s cubic-bezier(.2, .8, .2, 1);
}

.tour-layer.is-scrolling .tour-spot,
.tour-layer.is-scrolling .tour-balloon { transition: none; }

.tour-balloon.is-entering { animation: tour-balloon-in 0.4s cubic-bezier(.2, 1.2, .4, 1); }

/* Arrow: a rotated square that borrows the balloon's fill and border. */
.tour-balloon::before {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  background: inherit;
  border: 1px solid #2E4AA8;
  border-radius: 3px;
  transform: rotate(45deg);
}

.tour-balloon[data-side="bottom"]::before { top: -9px; left: calc(var(--ax) - 8px); border-right: 0; border-bottom: 0; }
.tour-balloon[data-side="top"]::before    { bottom: -9px; left: calc(var(--ax) - 8px); border-left: 0; border-top: 0; }
.tour-balloon[data-side="right"]::before  { left: -9px; top: calc(var(--ay) - 8px); border-top: 0; border-right: 0; }
.tour-balloon[data-side="left"]::before   { right: -9px; top: calc(var(--ay) - 8px); border-bottom: 0; border-left: 0; }
.tour-balloon[data-side="none"]::before   { display: none; }

.tour-balloon-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }

.tour-num {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #0077FF;
  color: #fff;
  font-weight: 800;
  font-size: 13px;
}

.tour-count { font-size: 12px; font-weight: 600; color: var(--muted); }

.tour-x {
  margin-left: auto;
  background: none;
  border: 0;
  font-size: 20px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
}

.tour-title { font-size: 16px; font-weight: 700; margin-bottom: 4px; }

.tour-body { font-size: 13.5px; line-height: 1.55; color: #B9C4E6; }

.tour-body b { color: #fff; }

.tour-dots { display: flex; gap: 5px; margin: 14px 0 12px; }

.tour-dots span { height: 4px; flex: 1; border-radius: 2px; background: #2A3560; transition: background 0.3s; }

.tour-dots span.on { background: #0077FF; }

.tour-actions { display: flex; align-items: center; gap: 8px; }

.tour-spacer { flex: 1; }

.tour-skip {
  background: none;
  border: 0;
  padding: 4px 0;
  font: inherit;
  font-size: 12.5px;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.tour-x:hover,
.tour-skip:hover { color: var(--text); }

.tour-btn { padding: 7px 14px; font-size: 13px; }

.tour-balloon .btn-primary { background: #0077FF; }

.tour-balloon .btn-outline { background: transparent; border-color: var(--border-h); }

.tour-balloon .btn:disabled { opacity: 0.4; cursor: default; }

.tour-balloon button:focus-visible { outline: 2px solid #85D3FF; outline-offset: 2px; }

/* Welcome card shown right after sign-in */
.tour-welcome {
  position: fixed;
  inset: 0;
  z-index: 210;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(3, 5, 16, 0.72);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: tour-fade 0.3s ease;
}

.tour-welcome[hidden] { display: none; }

.tour-welcome-card {
  width: 480px;
  max-width: 100%;
  padding: 28px 30px 22px;
  text-align: center;
  background: #0E1330;
  border: 1px solid var(--border-h);
  border-radius: 16px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  animation: tour-balloon-in 0.45s cubic-bezier(.2, 1.2, .4, 1);
}

.tour-welcome-card h2 { font-size: 21px; margin: 18px 0 8px; }

.tour-welcome-card p { color: #B9C4E6; }

.tour-welcome-card p strong { color: var(--text); overflow-wrap: anywhere; }

.welcome-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin: 22px 0 14px; }

.welcome-actions .btn-primary { background: #0077FF; }

.welcome-optout {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  font-size: 12.5px;
  color: var(--muted);
  cursor: pointer;
}

.welcome-optout input { accent-color: #0077FF; }

.welcome-flow { display: flex; align-items: center; justify-content: center; gap: 6px; }

.wf-step {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 6px;
  width: 92px;
  font-size: 12px;
  color: var(--muted);
  animation: tour-rise 0.5s ease backwards;
}

.wf-step:nth-child(3) { animation-delay: 0.35s; }

.wf-step:nth-child(5) { animation-delay: 0.7s; }

.wf-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: rgba(0, 119, 255, 0.14);
  border: 1px solid rgba(0, 119, 255, 0.4);
  color: #85D3FF;
  font-size: 20px;
}

.wf-num {
  position: absolute;
  top: -8px;
  right: 14px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #0077FF;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}

.wf-arrow {
  width: 34px;
  height: 2px;
  margin-bottom: 22px;
  background: linear-gradient(90deg, #85D3FF 50%, transparent 50%) 0 0 / 8px 2px;
  animation: tour-march 0.8s linear infinite;
}

/* Toast that points at the Help button */
.tour-toast {
  position: fixed;
  z-index: 205;
  width: 300px;
  max-width: calc(100vw - 24px);
  padding: 12px 14px;
  background: #121A44;
  color: #B9C4E6;
  border: 1px solid #2E4AA8;
  border-radius: 10px;
  font-size: 13px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.5);
  animation: tour-balloon-in 0.35s ease;
}

.tour-toast[hidden] { display: none; }

.tour-toast b { color: #fff; }

.tour-toast::before {
  content: "";
  position: absolute;
  top: -7px;
  right: var(--tx, 40px);
  width: 12px;
  height: 12px;
  background: inherit;
  border: 1px solid #2E4AA8;
  border-right: 0;
  border-bottom: 0;
  transform: rotate(45deg);
}

@keyframes tour-pop-in     { from { opacity: 0; transform: translateY(-6px) scale(0.98); } }
@keyframes tour-balloon-in { from { opacity: 0; transform: translateY(8px) scale(0.96); } }
@keyframes tour-num-pop    { from { transform: scale(0); } }
@keyframes tour-fade       { from { opacity: 0; } }
@keyframes tour-rise       { from { opacity: 0; transform: translateY(10px); } }
@keyframes tour-march      { to { background-position: 8px 0; } }
@keyframes tour-ring {
  0%   { box-shadow: 0 0 0 0 rgba(0, 119, 255, 0.7); }
  100% { box-shadow: 0 0 0 14px rgba(0, 119, 255, 0); }
}
@keyframes tour-spot-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(0, 119, 255, 0.55); }
  100% { box-shadow: 0 0 0 16px rgba(0, 119, 255, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .tour-spot, .tour-balloon { transition: none; }
  .tour-spot::after, .wf-arrow, .help-menu.attention .help-btn { animation: none; }
  .tour-balloon.is-entering, .tour-spot-num.is-entering, .tour-welcome,
  .tour-welcome-card, .wf-step, .tour-toast, .help-pop { animation: none; }
}

/* ── Responsive ───────────────────────────────── */
@media (max-width: 600px) {
  .topbar-inner { padding: 12px 20px; height: auto; min-height: 58px; flex-wrap: wrap; }
  .nav-links { order: 3; flex-basis: 100%; top: 0; }
  .topbar-right { flex-wrap: wrap; justify-content: flex-end; margin-left: auto; }
  .main         { padding: 32px 20px 60px; }
  .drop-zone    { padding: 40px 24px; }
  .config-badge { display: none; }
}
