:root {
  --bg: #0b1220;
  --panel: #111a2e;
  --panel-2: #182447;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --accent: #f59e0b;
  --accent-2: #fbbf24;
  --green: #22c55e;
  --red: #ef4444;
  --border: #1f2937;
}
*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
  /* 900px on small laptops was leaving half the screen empty on wider
     monitors. 1200px is the sweet spot — wide enough for a comfortable
     1fr+360px viewer grid, narrow enough for body text not to feel like
     a billboard. We also let the container breathe to the full width
     on truly wide screens via `min(1200px, 96vw)`. */
  max-width: min(1200px, 96vw);
  margin: 16px auto;
  padding: 0 14px;
}
/* When the live viewer is the focus (AWAITING_3DS), let it span wider
   so the cardholder can clearly see the bank's challenge. */
.container.viewer-wide { max-width: min(1320px, 98vw); }
.brand {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.brand span { color: var(--accent); }
.brand .sub {
  display: inline-block;
  margin-left: 8px;
  color: var(--muted);
  font-weight: 400;
  font-size: 13px;
}
.subtitle {
  color: var(--muted);
  margin-bottom: 20px;
  font-size: 14px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 16px;
}
.panel h2 {
  margin: 0 0 12px 0;
  font-size: 15px;
  color: var(--accent-2);
  letter-spacing: 0.3px;
}
.panel .h2-sub {
  color: var(--muted);
  font-weight: 400;
  font-size: 12px;
}

.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > .field { flex: 1 1 calc(50% - 5px); }
.row > .field.full { flex-basis: 100%; }
.row > .field.third { flex-basis: calc(33.333% - 7px); min-width: 90px; }
.row > .field.two-thirds { flex-basis: calc(66.666% - 7px); min-width: 240px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-weight: 600;
}
input, select, textarea {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  /* 16px on mobile to defeat iOS zoom-on-focus */
  font: inherit;
  font-size: 16px;
  min-height: 44px;
  appearance: none;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.22);
}
input.invalid {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.18);
}
/* Checkboxes / radios must NOT inherit the text-field skin above
   (`appearance:none` + 44px min-height hides native toggles entirely). */
input[type="checkbox"],
input[type="radio"] {
  width: auto;
  min-height: unset;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
input[type="checkbox"]:focus,
input[type="radio"]:focus {
  box-shadow: none;
}
.field .err-msg {
  font-size: 12px;
  color: #fecaca;
  display: none;
}
.field.has-error .err-msg { display: block; }

button {
  background: var(--accent);
  color: #1a1300;
  border: 0;
  border-radius: 8px;
  padding: 14px 22px;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  font-family: inherit;
  min-height: 48px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(0,0,0,0);
}
button:hover { background: var(--accent-2); }
button:disabled { opacity: 0.55; cursor: not-allowed; }
button.secondary {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
}

.note { color: var(--muted); font-size: 12px; }
.warn {
  color: #fde68a;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
}
.banner-test {
  background: rgba(245, 158, 11, 0.12);
  border-bottom: 1px solid rgba(245, 158, 11, 0.4);
  color: #fde68a;
  padding: 8px 14px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

/* ---------- Card form (employer) ---------- */
.card-form .brand-icon {
  display: inline-block;
  margin-left: 8px;
  font-weight: 700;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--panel-2);
  color: var(--muted);
  vertical-align: 1px;
}
.card-form .brand-icon.visa       { color: #1a1f71; background: #fff; }
.card-form .brand-icon.mastercard { color: #fff;    background: #eb001b; }

/* ---------- Job viewer ---------- */
/* Two-column layout: BIG live view (1fr) + compact side panel (360px).
   We bias to the live view because that's the part the cardholder is
   focused on at AWAITING_3DS — the result panel is a short status. */
.viewer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
  align-items: start;
}
@media (max-width: 900px) {
  /* Below this width the 360px side panel doesn't fit comfortably
     next to the live view; stack instead. The live view goes ON TOP
     so the cardholder doesn't have to scroll past chrome to see the
     bank's challenge. */
  .viewer-grid { grid-template-columns: 1fr; }
  .container   { margin-top: 8px; padding: 0 8px; }
}
/* When the live view is hidden (WAITING_FOR_CARD), centre the form column. */
.viewer-grid.grid-single {
  grid-template-columns: 1fr;
  max-width: 480px;
  margin: 0 auto;
}
.viewer-img-wrap {
  background: #000;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  touch-action: none;     /* defeat browser zoom/scroll on the image */
}
/* Min-height ONLY applies before the JS has measured the image and set
   an explicit wrap height. Once `applyZoom()` runs it sets `height:Npx`
   directly on the element which overrides this. Keep min-height small
   to avoid the "huge black void below the image" bug on mobile where
   the bot's 1280x1000 viewport rendered at ~414w only fills ~320h. */
.viewer-img-wrap:not([style*="height"]) {
  min-height: 320px;
}
@media (max-width: 900px) {
  /* Tiny floor so the box isn't invisible while JS is loading; the
     actual height will be set by applyZoom() to the image's natural
     aspect or the modal-fit rect. */
  .viewer-img-wrap:not([style*="height"]) {
    min-height: 240px;
  }
}
.viewer-img-wrap img {
  display: block;
  width: 100%;
  height: auto;
  user-select: none;
  -webkit-user-drag: none;
  touch-action: none;
}
.viewer-overlay-processing {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  background: linear-gradient(135deg, #182447ee, #0b1220ee);
  color: #cbd5e1;
  text-align: center;
  padding: 20px;
}
.viewer-overlay-processing .spinner {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.15);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.viewer-overlay-processing .label {
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.3px;
}
.viewer-overlay-processing .sub { color: var(--muted); font-size: 12px; }

.state-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.state-PENDING, .state-PROCESSING        { background: #1e3a8a; color: #bfdbfe; }
.state-RETRYING                          { background: #334155; color: #cbd5e1; }
.state-AWAITING_3DS                      { background: #b45309; color: #fef3c7; }
.state-WAITING_FOR_CARD                  { background: #6b21a8; color: #f3e8ff; }
.state-SUCCESS                           { background: #166534; color: #bbf7d0; }
.state-DECLINED                          { background: #7f1d1d; color: #fecaca; }
.state-ERROR                             { background: #4c1d95; color: #ddd6fe; }

.events {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  max-height: 240px;
  overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  white-space: pre-wrap;
  word-break: break-word;
}
.events div { padding: 1px 0; opacity: 0.85; }
.events div:last-child { color: var(--accent-2); opacity: 1; }
details.admin-details summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
  padding: 6px 0;
}

/* ---------- Mobile keyboard helper for 3DS ---------- */
/* Off-screen but focusable so the mobile OS keyboard opens on tap. */
#kbd-capture {
  position: fixed;
  opacity: 0;
  pointer-events: none;
  left: 50%; top: 50%;
  width: 1px; height: 1px;
  min-height: 0;
  border: 0; padding: 0; margin: 0;
  background: transparent;
}
.viewer-status {
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
  display: flex; align-items: center; gap: 8px;
  justify-content: center;
  user-select: none;
  padding: 6px 10px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-height: 28px;
  text-align: center;
}
.viewer-status #vs-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.viewer-status .vs-btn {
  flex: 0 0 auto;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
  letter-spacing: 0.2px;
}
.viewer-status .vs-btn:hover {
  background: #1e2a4a;
  border-color: var(--accent);
}
.viewer-status .vs-btn:active { transform: scale(0.97); }
.viewer-status .dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: #9ca3af;
  transition: background 0.2s, box-shadow 0.2s;
  flex-shrink: 0;
}
.viewer-img-wrap.interactive {
  cursor: pointer;
  outline: 1px solid rgba(34, 197, 94, 0.35);
  outline-offset: -1px;
}

/* ---------- Smart loader (during PROCESSING) ---------- */
/* The merchant flow is hidden. The employer sees a friendly step ladder
   with the current step pulsing, completed steps ticked, future steps
   greyed out. No merchant names, no provider names. */
.smart-loader {
  max-width: 480px;
  margin: 0 auto 14px auto;
  text-align: center;
}
.smart-loader h2 {
  margin: 0 0 6px 0;
  font-size: 18px;
}
.smart-loader .note {
  margin: 0 0 18px 0;
}
.step-ladder {
  list-style: none;
  padding: 0;
  margin: 18px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.step-ladder .step {
  display: grid;
  grid-template-columns: 36px 1fr 22px;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  text-align: left;
  transition: background 0.25s, border-color 0.25s, opacity 0.25s;
}
.step-ladder .step .ico {
  font-size: 22px;
  line-height: 1;
  text-align: center;
}
.step-ladder .step .lbl {
  font-size: 13px;
  font-weight: 500;
  color: #cbd5e1;
}
.step-ladder .step .check {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: transparent;
  position: relative;
}
.step-ladder .step.done .check {
  background: #22c55e;
}
.step-ladder .step.done .check::after {
  content: '';
  position: absolute;
  left: 5px; top: 2px;
  width: 5px; height: 9px;
  border: solid #0b1220;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.step-ladder .step.done {
  border-color: rgba(34, 197, 94, 0.35);
  background: rgba(34, 197, 94, 0.08);
}
.step-ladder .step.done .lbl {
  color: #bbf7d0;
}
.step-ladder .step.active {
  border-color: rgba(96, 165, 250, 0.55);
  background: rgba(96, 165, 250, 0.10);
  box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.10);
  animation: step-pulse 1.8s ease-in-out infinite;
}
.step-ladder .step.active .ico {
  animation: step-bob 1.4s ease-in-out infinite;
}
.step-ladder .step.active .lbl {
  color: #dbeafe;
  font-weight: 600;
}
.step-ladder .step.active .check {
  width: 14px; height: 14px;
  border: 2px solid rgba(96, 165, 250, 0.5);
  border-top-color: #60a5fa;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  background: transparent;
}
.step-ladder .step.pending {
  opacity: 0.42;
}
.step-ladder .step.pending .check {
  background: var(--border);
}
@keyframes step-pulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.10); }
  50%      { box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.18); }
}
@keyframes step-bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-2px); }
}
.sl-progress {
  height: 4px;
  background: var(--panel-2);
  border-radius: 999px;
  overflow: hidden;
  margin: 18px 0 10px 0;
}
.sl-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #60a5fa, #22c55e);
  border-radius: 999px;
  transition: width 0.6s cubic-bezier(.4, 0, .2, 1);
}
/* Indeterminate pulsing bar — shown only while the job is QUEUED behind
   another card on the same merchant account. Visually distinguishes
   "we're in line" from "we're stuck". Not used for any other state. */
.sl-progress-bar.sl-bar-pulse {
  width: 30% !important;
  transition: none;
  background: linear-gradient(90deg, #fbbf24, #60a5fa, #fbbf24);
  background-size: 200% 100%;
  animation: sl-pulse 1.6s ease-in-out infinite;
}
@keyframes sl-pulse {
  0%   { transform: translateX(-100%); background-position: 0% 50%; }
  50%  { transform: translateX(120%);  background-position: 100% 50%; }
  100% { transform: translateX(-100%); background-position: 0% 50%; }
}
/* Slightly muted caption while queued so the cardholder reads the
   reassurance copy ("usually under 2 minutes") as a status line not
   a warning. */
.smart-loader.is-queued .sl-caption {
  color: #fcd99a;
}
.sl-caption {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
  min-height: 18px;
}

/* ---------- Smart loader: "keep window open" banner ---------- */
/* Sits ABOVE the title so it's the first thing the cardholder reads.
 * Uses a soft pulsing dot instead of a scary red banner — gentle but
 * impossible to miss, matching the calm-checkout aesthetic. */
.sl-keep-open {
  display:        inline-flex;
  align-items:    center;
  gap:            10px;
  padding:        9px 16px 9px 14px;
  margin:         0 auto 18px auto;
  border-radius:  999px;
  background:     rgba(96, 165, 250, 0.08);
  border:         1px solid rgba(96, 165, 250, 0.25);
  color:          #cbd5e1;
  font-size:      13px;
  line-height:    1.4;
  text-align:     left;
}
.sl-keep-open strong {
  color:          #f3f4f6;
  font-weight:    600;
}
.sl-keep-dot {
  width:          10px;
  height:         10px;
  border-radius:  50%;
  background:     #60a5fa;
  box-shadow:     0 0 0 0 rgba(96, 165, 250, 0.55);
  animation:      sl-keep-pulse 1.6s ease-in-out infinite;
  flex-shrink:    0;
}
@keyframes sl-keep-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(96, 165, 250, 0.55); }
  50%      { box-shadow: 0 0 0 8px rgba(96, 165, 250, 0); }
}

/* ---------- Smart loader: booking summary card ---------- */
/* Renders only when the partner site posted an order_meta. Echoes
 * the same booking info the cardholder saw on the Review & Pay
 * step so they're certain WHAT is being charged while it processes. */
.sl-booking {
  margin:         18px 0 4px 0;
  padding:        16px 18px 14px 18px;
  background:     rgba(255, 255, 255, 0.03);
  border:         1px solid var(--border);
  border-radius:  14px;
  text-align:     left;
}
.sl-booking-head {
  display:        flex;
  align-items:    center;
  gap:            10px;
  margin-bottom:  10px;
  padding-bottom: 10px;
  border-bottom:  1px dashed var(--border);
}
.sl-booking-icon {
  font-size:      22px;
  line-height:    1;
}
.sl-booking-name {
  font-size:      15px;
  font-weight:    600;
  color:          var(--text);
  letter-spacing: 0.01em;
}
.sl-booking-lines {
  list-style:     none;
  padding:        0;
  margin:         0;
  display:        flex;
  flex-direction: column;
  gap:            6px;
}
.sl-booking-lines li {
  display:        flex;
  justify-content: space-between;
  gap:            12px;
  font-size:      13px;
  color:          var(--muted);
}
.sl-booking-lines li .sl-bk-val {
  color:          var(--text);
  font-weight:    500;
  text-align:     right;
  max-width:      55%;
  overflow:       hidden;
  text-overflow:  ellipsis;
}
.sl-booking-total {
  display:        flex;
  justify-content: space-between;
  align-items:    baseline;
  margin-top:     12px;
  padding-top:    10px;
  border-top:     1px solid var(--border);
  font-size:      14px;
  color:          var(--muted);
}
.sl-booking-total strong {
  font-size:      18px;
  color:          var(--text);
  font-weight:    700;
  letter-spacing: 0.01em;
}
.sl-footnote {
  margin:         16px 0 0 0;
  font-size:      12px;
  color:          var(--muted);
  font-style:     italic;
}

/* ---------- Resubmit card — booking-continuity redesign ---------- */
/* Replaces the bare "Try another card" panel. Reassures the user the
 * booking is held, echoes the order summary, surfaces clear labels
 * with strong contrast against the panel background. */
.resubmit-head {
  display:        flex;
  gap:            14px;
  align-items:    flex-start;
  margin-bottom:  16px;
}
.resubmit-icon {
  width:          44px; height: 44px;
  display:        inline-flex;
  align-items:    center; justify-content: center;
  font-size:      22px;
  background:     rgba(245, 124, 0, 0.10);
  border-radius:  12px;
  flex-shrink:    0;
  border:         1px solid rgba(245, 124, 0, 0.25);
}
.resubmit-title {
  margin:         0 0 4px 0;
  font-size:      18px;
  font-weight:    600;
  color:          var(--text);
}
.resubmit-sub {
  margin:         0;
  font-size:      13.5px;
  line-height:    1.45;
  color:          var(--muted);
}
.resubmit-booking {
  background:     rgba(255, 255, 255, 0.03);
  border:         1px solid var(--border);
  border-radius:  12px;
  padding:        12px 14px;
  margin-bottom:  16px;
}
.resubmit-bk-name {
  font-size:      14px;
  font-weight:    600;
  color:          var(--text);
  margin-bottom:  4px;
}
.resubmit-bk-meta {
  display:        flex;
  flex-wrap:      wrap;
  gap:            6px 14px;
  font-size:      12.5px;
  color:          var(--muted);
}
.resubmit-bk-meta span:not(:last-child)::after {
  content:        ' · ';
  margin-left:    4px;
  opacity:        0.5;
}
.resubmit-bk-total {
  display:        flex;
  justify-content: space-between;
  align-items:    baseline;
  margin-top:     10px;
  padding-top:    9px;
  border-top:     1px solid var(--border);
  font-size:      13px;
  color:          var(--muted);
}
.resubmit-bk-total strong {
  font-size:      16px;
  color:          var(--text);
  font-weight:    700;
}
.resubmit-form .field label {
  font-size:      12.5px;
  font-weight:    500;
  color:          #e5e7eb;
  letter-spacing: 0.02em;
  text-transform: none;
}
.resubmit-form input {
  font-size:      15px;
  padding:        12px 14px;
}
.resubmit-cta {
  width:          100%;
  margin-top:     6px;
  min-height:     48px;
  font-size:      15px;
}
.resubmit-secure {
  margin:         12px 0 0 0;
  font-size:      12px;
  color:          var(--muted);
  text-align:     center;
  letter-spacing: 0.01em;
}
.resubmit-secure span {
  margin-right:   4px;
}

@media (max-width: 800px) {
  .step-ladder .step { padding: 8px 12px; }
  .step-ladder .step .lbl { font-size: 12px; }
  .step-ladder .step .ico { font-size: 20px; }
}

/* ---------- Admin ---------- */
.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 800px) { .admin-grid { grid-template-columns: 1fr; } }
.toggle-row {
  display: flex; align-items: flex-start; gap: 14px;
  background: var(--panel-2); padding: 12px 14px;
  border-radius: 8px; margin-bottom: 12px;
  border: 1px solid var(--border);
}
/* Visible ON/OFF switch — admin config toggles (test mode, safe mode,
   telegram, link pool, 3DS rewriter, etc.). Form still posts standard
   checkbox name="…" value="on" — only the skin changes. */
.toggle-row input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 54px;
  height: 30px;
  min-height: 30px;
  max-width: 54px;
  margin-top: 2px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid #475569;
  background: #1e293b;
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.toggle-row input[type="checkbox"]::before {
  content: 'OFF';
  position: absolute;
  right: 7px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: #64748b;
  pointer-events: none;
}
.toggle-row input[type="checkbox"]::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #94a3b8;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s ease, background 0.15s ease;
}
.toggle-row input[type="checkbox"]:checked {
  background: rgba(34, 197, 94, 0.28);
  border-color: #22c55e;
}
.toggle-row input[type="checkbox"]:checked::before {
  content: 'ON';
  right: auto;
  left: 8px;
  color: #86efac;
}
.toggle-row input[type="checkbox"]:checked::after {
  transform: translateX(24px);
  background: #bbf7d0;
}
.toggle-row input[type="checkbox"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.35);
}
.toggle-row label {
  cursor: pointer;
}
.toggle-row .desc { color: var(--muted); font-size: 12px; margin-top: 4px; }
.jobs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.jobs-table th, .jobs-table td {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
}
.jobs-table th { color: var(--muted); font-weight: 600; text-transform: uppercase; font-size: 10px; }
/* ---------- Admin panel v2 (jobs ledger, detail, replay) ---------- */
.admin-wide { max-width: min(1400px, 98vw); }
.admin-nav {
  background: linear-gradient(180deg, #111a2e, #0b1220);
  border-bottom: 1px solid var(--border);
  padding: 10px 18px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
}
.admin-nav-brand {
  font-size: 16px; font-weight: 700; letter-spacing: 0.4px;
}
.admin-nav-brand span:first-of-type { color: var(--accent); }
.admin-nav-sub {
  margin-left: 10px; color: var(--muted); font-weight: 500;
  font-size: 12px; text-transform: uppercase; letter-spacing: 1px;
}
.admin-nav-links { display: flex; gap: 6px; align-items: center; }
.admin-nav-links a {
  padding: 6px 12px; border-radius: 6px;
  color: var(--text); font-size: 13px; font-weight: 500;
  transition: background 0.15s;
}
.admin-nav-links a:hover { background: var(--panel-2); text-decoration: none; }
.admin-nav-links a.is-active {
  background: rgba(245, 158, 11, 0.15); color: var(--accent-2);
}
.admin-nav-links a.admin-nav-aux { color: var(--muted); font-size: 11px; }
.admin-nav-links a.admin-nav-logout {
  margin-left: 8px;
  border: 1px solid rgba(248, 113, 113, 0.35);
  color: #fca5a5;
}
.admin-nav-links a.admin-nav-logout:hover {
  background: rgba(248, 113, 113, 0.12);
  color: #fecaca;
}

/* KPI strip */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.kpi {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px 16px;
}
.kpi-label {
  font-size: 11px; color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.5px; font-weight: 600;
}
.kpi-value {
  font-size: 28px; font-weight: 700; line-height: 1.1; margin-top: 4px;
}
.kpi-value-tiny {
  font-size: 13px; font-weight: 600; line-height: 1.2; margin-top: 6px;
  display: flex; gap: 8px; flex-wrap: wrap;
}
.kpi-sub { font-size: 11px; color: var(--muted); margin-top: 4px; }
.device-pill {
  display: inline-block; padding: 1px 7px; border-radius: 999px;
  background: var(--panel-2); border: 1px solid var(--border);
  font-size: 10px; font-weight: 700;
}
.device-pill-mobile  { color: #a5b4fc; }
.device-pill-desktop { color: #cbd5e1; }
.device-pill-tablet  { color: #fde68a; }

/* Filter bar */
.filter-bar { margin-bottom: 16px; padding: 12px 14px; }
.filter-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filter-input {
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px;
  padding: 7px 10px; font-size: 13px; min-height: 32px;
}
.filter-bar button {
  padding: 7px 14px; font-size: 13px; min-height: 32px; font-weight: 600;
}
.btn-clear {
  color: var(--muted); font-size: 12px; padding: 6px 10px;
}

/* Jobs table v2 */
.jobs-table-v2 {
  width: 100%; border-collapse: separate; border-spacing: 0;
  font-size: 13px;
}
.jobs-table-v2 th {
  text-align: left; padding: 8px 10px;
  color: var(--muted); font-weight: 600;
  text-transform: uppercase; font-size: 10px; letter-spacing: 0.5px;
  border-bottom: 2px solid var(--border);
}
.jobs-table-v2 td {
  padding: 8px 10px; border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.jobs-table-v2 .job-row:hover { background: rgba(245, 158, 11, 0.04); }
.jobs-table-v2 .is-testmode {
  background: rgba(245, 158, 11, 0.04);
  border-left: 3px solid var(--accent);
}
.jobs-table-v2 .small { font-size: 11px; }
.jobs-table-v2 .mono  { font-family: ui-monospace, monospace; }
.row-actions { display: flex; gap: 10px; font-size: 12px; }
.row-actions a {
  padding: 2px 7px; border-radius: 4px;
  background: var(--panel-2); border: 1px solid var(--border);
}
.row-actions a.replay-link {
  background: rgba(245, 158, 11, 0.12); border-color: var(--accent);
  color: var(--accent-2); font-weight: 600;
}

.pager { display: flex; gap: 14px; align-items: center; padding: 10px; justify-content: center; }
.pager a { font-weight: 600; }
.state-testmode { background: rgba(245, 158, 11, 0.2); color: var(--accent-2); }

/* Per-job detail page */
.job-detail-header {
  display: flex; justify-content: space-between; align-items: center;
  margin: 14px 0 18px 0; flex-wrap: wrap; gap: 12px;
}
.job-title {
  font-size: 18px; font-weight: 700; margin: 0;
  display: flex; align-items: center; gap: 12px;
}
.job-title code {
  background: var(--panel-2); padding: 4px 10px; border-radius: 6px;
  font-size: 14px; color: var(--accent-2);
}
.job-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn {
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px;
  padding: 7px 14px; font-size: 13px; font-weight: 600;
  text-decoration: none; transition: background 0.15s;
}
.btn:hover { background: #1e2a4a; text-decoration: none; }
.btn-primary {
  background: var(--accent); color: #1a1300; border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-2); }
.btn-ghost { background: transparent; }

.job-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.job-detail-grid .panel { margin-bottom: 0; }
dl.kv { margin: 0; font-size: 13px; }
dl.kv dt { color: var(--muted); font-size: 11px;
           text-transform: uppercase; letter-spacing: 0.5px;
           font-weight: 600; margin-top: 6px; }
dl.kv dd { margin: 2px 0 0 0; }
dl.kv dd.err { color: #fca5a5; font-family: ui-monospace, monospace;
               font-size: 12px; word-break: break-word; }
.attempts-table, .event-log {
  width: 100%; border-collapse: collapse; font-size: 12px;
}
.attempts-table th, .attempts-table td,
.event-log th, .event-log td {
  padding: 5px 8px; border-bottom: 1px solid var(--border);
  text-align: left;
}
.attempts-table th, .event-log th {
  color: var(--muted); font-weight: 600;
  text-transform: uppercase; font-size: 10px;
}
.outcome-DECLINED { color: #fca5a5; }
.outcome-SUCCESS  { color: #86efac; }
.outcome-ERROR    { color: #fcd34d; }
.outcome-TIMEOUT  { color: #fde68a; }
.event-log .small  { font-size: 11px; }
.event-log .mono   { font-family: ui-monospace, monospace; }
.event-log .msg    { font-size: 12px; max-width: 700px; word-break: break-word; }
.event-log .kind-state    { color: #93c5fd; }
.event-log .kind-decline  { color: #fca5a5; }
.event-log .kind-threeds  { color: #fdba74; }
.event-log .kind-attempt  { color: #c4b5fd; }
.event-log .kind-ws_in    { color: #86efac; }
.event-log .kind-captcha  { color: #fde68a; }
.event-log .kind-bootstrap{ color: #cbd5e1; }
.event-log .kind-log      { color: var(--muted); }
.event-filter { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }

/* ---------- Replay player ---------- */
.replay-header { display: flex; justify-content: space-between; align-items: center;
                  margin: 14px 0 18px 0; flex-wrap: wrap; gap: 10px; }
.replay-layout {
  display: grid; grid-template-columns: 1fr 360px; gap: 16px;
  align-items: start;
}
@media (max-width: 900px) {
  .replay-layout { grid-template-columns: 1fr; }
}
.replay-stage { display: flex; flex-direction: column; gap: 10px; }
.replay-canvas-wrap {
  background: #000; border: 1px solid var(--border);
  border-radius: 12px; overflow: hidden; position: relative;
  aspect-ratio: var(--bot-aspect, 1280 / 1000);
  max-height: 70vh;
}
.replay-canvas-wrap canvas {
  width: 100%; height: 100%;
  display: block; object-fit: contain;
  image-rendering: -webkit-optimize-contrast;
}
.replay-loading {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); background: rgba(11, 18, 32, 0.7);
  font-size: 14px;
}
.replay-timeline {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 14px;
}
.rp-track {
  position: relative; height: 8px;
  background: var(--panel-2); border-radius: 4px; overflow: hidden;
  margin-bottom: 6px;
}
.rp-progress {
  position: absolute; left: 0; top: 0; bottom: 0; width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 4px;
  transition: width 0.1s linear;
}
.rp-markers { position: absolute; inset: 0; pointer-events: none; }
.rp-marker {
  position: absolute; top: 0; bottom: 0; width: 2px;
  background: var(--muted); opacity: 0.8;
}
.rp-marker-state    { background: #60a5fa; }
.rp-marker-decline  { background: #ef4444; }
.rp-marker-threeds  { background: #fb923c; }
.rp-marker-attempt  { background: #a78bfa; }
#rp-scrubber { width: 100%; margin: 0; cursor: pointer; }
.replay-controls {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px;
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
  font-size: 13px;
}
.replay-controls button {
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px;
  min-height: 36px; min-width: 40px; padding: 6px 10px;
  font-size: 16px; cursor: pointer;
}
.replay-controls button.primary {
  background: var(--accent); color: #1a1300; border-color: var(--accent);
  min-width: 50px;
}
.replay-controls .rp-time, .replay-controls .rp-frame {
  color: var(--muted); font-family: ui-monospace, monospace;
  font-size: 12px;
}
.replay-controls .rp-speed { color: var(--muted); font-size: 12px;
                              display: flex; gap: 6px; align-items: center; }
.replay-controls .rp-speed select {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--border);
  border-radius: 4px; padding: 4px 8px; font-size: 12px; min-height: 28px;
}
.replay-sidebar { display: flex; flex-direction: column; gap: 12px; }
.rp-meta dl.kv dt, .rp-meta dl.kv dd { font-size: 12px; }
.rp-events { padding: 12px; }
.rp-events-list {
  max-height: 60vh; overflow-y: auto;
  font-size: 12px; line-height: 1.5;
}
.rp-event {
  display: grid; grid-template-columns: 50px 24px 1fr;
  gap: 6px; padding: 4px 6px;
  border-radius: 4px; cursor: pointer;
  transition: background 0.1s;
}
.rp-event:hover { background: var(--panel-2); }
.rp-event.is-active {
  background: rgba(245, 158, 11, 0.18);
  outline: 1px solid var(--accent);
}
.rp-event-time { color: var(--muted); font-family: ui-monospace, monospace; }
.rp-event-tag  { text-align: center; }
.rp-event-msg  { word-break: break-word; }

textarea.cfg {
  width: 100%; min-height: 160px;
  font-family: ui-monospace, monospace;
  font-size: 12px;
  resize: vertical;
}
