:root {
  color-scheme: dark;

  /* Backgrounds — depth ladder */
  --bg: #020204;
  --bg-elevated: #07080b;
  --bg-field: #0a0b0f;
  --bg-soft: #101116;
  --bg-card: #14151c;

  /* Lines */
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);

  /* Text ladder */
  --text: #f4f4f5;
  --text-soft: #c9cbd2;
  --muted: #777b86;
  --muted-2: #555a64;

  /* Accent — single primary across landing + app */
  --cyan: #53d8ff;
  --cyan-hover: #7be2ff;
  --cyan-soft: rgba(83, 216, 255, 0.12);

  /* Decorative companion (hero gradient only) */
  --violet: #9a7cff;

  /* Semantic */
  --green: #58e69a;
  --amber: #ffbe5c;
  --red: #ff5d73;

  /* Radii */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-pill: 9999px;

  --shadow: 0 24px 70px rgba(0, 0, 0, 0.42);

  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  text-rendering: geometricPrecision;
}

body.viewer-open {
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a,
input,
select,
textarea,
summary {
  -webkit-tap-highlight-color: transparent;
}

.topbar {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 30px;
  border-bottom: 1px solid var(--line);
  background: rgba(2, 2, 4, 0.82);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(18px);
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.slot-badge {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  letter-spacing: 0.02em;
}
.slot-badge.at-limit {
  color: var(--amber);
  border-color: rgba(255, 190, 92, 0.3);
}

/* The toggle is a real <button class="ghost-button admin-toggle"> so it
   inherits identical box metrics from .ghost-button — no hack needed to
   match a <label>+<input> against neighbouring buttons.  Active state is
   indicated by aria-pressed=true: cyan border + cyan text. */
.admin-toggle[aria-pressed="true"] {
  border-color: rgba(83, 216, 255, 0.55);
  color: var(--cyan);
  background: rgba(83, 216, 255, 0.08);
}
.admin-toggle[aria-pressed="true"]:hover {
  border-color: var(--cyan);
  background: rgba(83, 216, 255, 0.13);
}

.brand {
  font-weight: 800;
  font-size: 19px;
  letter-spacing: 0;
}

.subtle,
.results-header p,
.login-panel p {
  color: var(--muted);
  margin: 4px 0 0;
}

.subtle {
  font-size: 13px;
}

.workspace {
  --composer-min: 320px;
  --composer-max: 9999px;
  --composer-width: 420px;
  --split-width: 22px;
  --results-min: 320px;
  --media-tile-width: 280px;
  display: grid;
  grid-template-columns:
    clamp(
      var(--composer-min),
      var(--composer-width),
      min(var(--composer-max), calc(100% - var(--split-width) - var(--results-min)))
    )
    var(--split-width)
    minmax(0, 1fr);
  align-items: stretch;
  gap: 0;
  width: min(100%, 1740px);
  max-width: 100%;
  margin: 0 auto;
  padding: 28px 30px 40px;
  overflow-x: clip;
}

.tool-pane,
.results-pane {
  min-width: 0;
}

.tool-pane {
  width: 100%;
  position: sticky;
  top: 96px;
  align-self: start;
  max-height: calc(100vh - 124px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

.results-pane {
  min-width: 0;
  max-width: 100%;
  min-height: calc(100vh - 126px);
  padding-left: 22px;
  overflow-x: clip;
}

.split-resizer {
  align-self: stretch;
  width: var(--split-width);
  min-height: calc(100vh - 126px);
  border: 0;
  border-radius: 999px;
  background: transparent;
  cursor: col-resize;
  position: sticky;
  top: 96px;
}

.split-resizer::before {
  content: "";
  display: block;
  width: 1px;
  height: 100%;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.08);
  transition: background 160ms ease, box-shadow 160ms ease;
}

.split-resizer:hover::before,
.split-resizer:focus-visible::before,
body.resizing-layout .split-resizer::before {
  background: rgba(83, 216, 255, 0.72);
  box-shadow: 0 0 18px rgba(83, 216, 255, 0.24);
}

body.resizing-layout {
  cursor: col-resize;
  user-select: none;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 4px;
  margin-bottom: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #050609;
}

.tab,
.ghost-button,
.primary-button,
.icon-button,
.viewer-download,
.viewer-button,
.viewer-nav,
.details-value .copy-detail {
  appearance: none;
  border: 0;
  color: var(--text);
  cursor: pointer;
  letter-spacing: 0;
}

.tab {
  min-height: 38px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.tab:hover {
  color: var(--text-soft);
}

.tab.active {
  background: var(--text);
  color: #050609;
}

.ghost-button {
  min-height: 40px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--text-soft);
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.ghost-button:hover {
  border-color: var(--line-strong);
  color: var(--text);
  background: rgba(255, 255, 255, 0.035);
}

.primary-button {
  width: 100%;
  min-height: 54px;
  border-radius: 6px;
  background: var(--cyan);
  color: #020204;
  font-weight: 800;
  margin-top: 18px;
  box-shadow: 0 0 0 1px rgba(83, 216, 255, 0.25), 0 18px 44px rgba(83, 216, 255, 0.14);
}

.primary-button:hover {
  background: #7be2ff;
}

.primary-button:disabled,
.ghost-button:disabled,
.icon-button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.primary-button-mini {
  display: inline-block;
  padding: 9px 16px;
  border-radius: 6px;
  background: var(--cyan);
  color: #020204;
  font-weight: 800;
  font-size: 13px;
  text-decoration: none;
  transition: background 0.12s, transform 0.08s;
  box-shadow: 0 4px 14px rgba(83, 216, 255, 0.3);
}
.primary-button-mini:hover { background: #7be2ff; }
.primary-button-mini:active { transform: scale(0.97); }

.tool-form {
  display: block;
}

.tool-form h1 {
  margin: 0 0 20px;
  font-size: 24px;
  line-height: 1.1;
  font-weight: 800;
}

label {
  display: grid;
  gap: 8px;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 15px;
}

.field-hint {
  color: var(--muted);
  font-weight: 400;
  font-size: 12px;
  margin-left: 4px;
}

/* Honeypot trap — invisible to humans (off-screen + tabindex=-1 + aria-hidden),
   but present in the DOM so naive form-spammer bots fill it.  Filled value =
   silent reject in auth.py signup_post().  display:none would skip bot
   form-walkers; off-screen positioning is the conventional anti-bot pattern. */
.hp-trap {
  position: absolute;
  left: -9999px;
  top: -9999px;
  width: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
}

/* Scoped to text-like inputs only — bare `input` would also style checkboxes
   and radios as tall rectangles (operator-reported bug 2026-05-02 in topbar
   admin toggle).  See .admin-toggle input + .check-row input below for the
   tiny-checkbox style. */
/* :where() makes the negation chain specificity-free (0,0,0) so per-class
   overrides like .slider-number can win without !important.  Without it
   this selector was (0,4,1) — far stronger than any single-class rule. */
input:where(:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"])),
select,
textarea {
  width: 100%;
  color: var(--text);
  background: var(--bg-field);
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 12px 13px;
  outline: none;
  box-shadow: inset 0 0 0 1px var(--line);
}

textarea {
  resize: none;
  overflow: hidden;
  line-height: 1.45;
  min-height: 92px;
}

input::placeholder,
textarea::placeholder {
  color: var(--muted-2);
}

input:where(:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"])):hover,
select:hover,
textarea:hover {
  box-shadow: inset 0 0 0 1px var(--line-strong);
}

input:where(:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"])):focus,
select:focus,
textarea:focus {
  border-color: rgba(83, 216, 255, 0.28);
  box-shadow: inset 0 0 0 1px rgba(83, 216, 255, 0.5), 0 0 0 4px rgba(83, 216, 255, 0.07);
}

select {
  cursor: pointer;
}

.grid-2,
.grid-3,
.grid-4 {
  display: grid;
  gap: 12px;
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* auto-fit instead of fixed 3/4 columns: when some labels in the row are
   display:none (preset-conditional fields like web_search / video_version /
   mode), the visible ones expand to fill the row instead of leaving an
   awkward empty gap.  Operator feedback 2026-05-02. */
.grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.grid-4 {
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}

details {
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  padding: 14px 0 0;
  background: transparent;
}

summary {
  cursor: pointer;
  color: var(--text);
  font-weight: 800;
  margin-bottom: 14px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-soft);
}

.check-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--cyan);
  box-shadow: none;
}

.results-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.results-header h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.1;
  font-weight: 800;
}

.jobs {
  display: grid;
}

.job-card {
  min-width: 0;
  max-width: 100%;
  border-top: 1px solid var(--line);
  background: transparent;
  overflow: visible;
  padding: 22px 0;
}

.job-card:first-child {
  border-top: 0;
  padding-top: 0;
}

.job-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 0 0 14px;
  border-bottom: 0;
}

.job-title {
  font-weight: 800;
  font-size: 15px;
}

.job-head-actions {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.icon-button {
  min-height: 30px;
  padding: 0 10px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.icon-button:hover {
  color: var(--cyan);
  background: rgba(83, 216, 255, 0.07);
}

.icon-button.danger-button:hover {
  color: var(--red);
  background: rgba(255, 93, 115, 0.08);
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border-radius: 999px;
  padding: 0 10px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.status.succeeded {
  background: rgba(88, 230, 154, 0.1);
  color: var(--green);
}

.status.failed {
  background: rgba(255, 93, 115, 0.11);
  color: var(--red);
}

.status.partial {
  background: rgba(154, 124, 255, 0.12);
  color: var(--violet);
}

.status.running,
.status.queued {
  background: rgba(255, 190, 92, 0.11);
  color: var(--amber);
}

.job-body {
  min-width: 0;
  max-width: 100%;
  padding: 0;
}

.prompt-preview {
  color: var(--text-soft);
  line-height: 1.45;
  margin: 0 0 12px;
  max-height: 68px;
  overflow: hidden;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 13px;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 14px;
}

.meta-row span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.generation-details {
  margin-top: 16px;
  padding: 0;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
}

.generation-details summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  margin: 0;
  padding: 0;
  color: var(--muted);
  font-size: 13px;
}

.generation-details summary::-webkit-details-marker {
  display: none;
}

.generation-details summary::marker {
  content: "";
}

.generation-details summary::before {
  content: "›";
  color: var(--cyan);
  font-size: 18px;
  font-weight: 300;
  line-height: 1;
  transform: translateY(-1px);
  transition: transform 160ms ease;
}

.generation-details[open] summary::before {
  transform: rotate(90deg) translateX(-1px);
}

.generation-details summary:hover {
  color: var(--text-soft);
}

.details-table {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr));
  gap: 7px 16px;
  border-top: 1px solid var(--line);
  padding-top: 9px;
}

.details-row {
  display: flex;
  align-items: baseline;
  gap: 7px;
  min-width: 0;
}

.details-row.multiline {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
}

.details-label {
  color: var(--muted);
  flex: 0 0 auto;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.3;
  text-transform: uppercase;
}

.details-value {
  color: var(--text-soft);
  white-space: nowrap;
  overflow-wrap: anywhere;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  max-width: none;
  font-size: 11px;
  line-height: 1.3;
}

.details-row:not(.multiline) .details-label::after {
  content: ":";
}

.details-row.multiline .details-value {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  white-space: normal;
}

.details-row.multiline .details-value span {
  display: block;
  max-height: 74px;
  overflow: auto;
  padding: 2px 0 2px 8px;
  border-left: 1px solid var(--line);
  white-space: pre-wrap;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

.details-value .copy-detail {
  margin: 0;
  border-radius: 6px;
  background: rgba(83, 216, 255, 0.08);
  color: var(--cyan);
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 700;
}

.details-value .copy-detail:hover {
  background: rgba(83, 216, 255, 0.14);
}

.empty-state {
  color: var(--muted);
  border-top: 1px solid var(--line);
  padding: 22px 0;
}

.output-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, var(--media-tile-width));
  gap: 8px;
  justify-content: start;
  align-items: start;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: clip;
}

.output-tile {
  width: var(--media-tile-width);
  min-width: 0;
  max-width: 100%;
  border: 0;
  border-radius: 6px;
  background: #050609;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.055);
}

.media-output {
  /* !important here beats Chrome/WebKit's UA cursor for [draggable=true]
     elements (it shows the grab/move hand on hover by default).  Drag
     still works — the browser only swaps to "grabbing" during the actual
     drag operation, which is the right time for that affordance. */
  cursor: zoom-in !important;
  position: relative;
}

.media-output:hover {
  box-shadow: inset 0 0 0 1px rgba(83, 216, 255, 0.28);
}

.media-output:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}

.pending-output {
  aspect-ratio: var(--media-aspect, 1 / 1);
  min-height: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  border: 1px dashed var(--line-strong);
  box-shadow: none;
}

.output-tile img,
.output-tile video {
  width: 100%;
  aspect-ratio: var(--media-aspect, 1 / 1);
  object-fit: contain;
  display: block;
  background: #020204;
}

.media-standin {
  width: 100%;
  aspect-ratio: var(--media-aspect, 1 / 1);
  background: #020204;
}

.viewer-video-cache {
  position: fixed;
  left: -10000px;
  top: 0;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.play-badge {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.82);
  background: rgba(0, 0, 0, 0.18);
}

/* Hover-strip with all per-tile actions (Download / Animate / Upscale).
   Sits at bottom-right, stays hidden until the tile is hovered or focused.
   All buttons share the .tile-action-btn style — same height, dark glass
   background, cyan label.  Replaces the previous setup where Animate was an
   ALWAYS-visible inline button below the image (operator feedback 2026-05-03:
   "looked ugly under the image"). */
.output-tile-actions {
  position: absolute;
  right: 8px;
  bottom: 8px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 160ms ease, transform 160ms ease;
  pointer-events: none;
}

.media-output:hover .output-tile-actions,
.media-output:focus-within .output-tile-actions {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.tile-action-btn {
  display: inline-flex;
  align-items: center;
  padding: 6px 9px;
  border: 0;
  border-radius: 6px;
  color: var(--cyan);
  text-decoration: none;
  font-family: inherit;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  background: rgba(2, 2, 4, 0.74);
  cursor: pointer;
  transition: background 120ms ease;
}

.tile-action-btn:hover,
.tile-action-btn:focus-visible {
  background: rgba(2, 2, 4, 0.92);
  outline: none;
}

.tile-action-btn:focus-visible {
  box-shadow: 0 0 0 1px var(--cyan);
}

.tile-action-btn:disabled {
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.55;
}

.tile-action-btn:disabled:hover {
  background: rgba(2, 2, 4, 0.74);
}

/* Phase 9: favorites corner-button.  Top-right of the tile, separate from
   the bottom action strip.  Always visible (unlike .output-tile-actions
   which only appears on hover) so the saved state is glanceable from the
   feed without hovering. */
.tile-like-corner {
  position: absolute;
  top: 8px;
  right: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(2, 2, 4, 0.55);
  color: rgba(255, 255, 255, 0.85);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease, transform 120ms ease;
  z-index: 2;
}
.tile-like-corner:hover,
.tile-like-corner:focus-visible {
  background: rgba(2, 2, 4, 0.82);
  outline: none;
  transform: scale(1.08);
}
.tile-like-corner.is-liked {
  color: #f06292;
}
.tile-like-corner.is-liked:hover {
  color: #ec407a;
}

.media-output.media-load-error::after {
  content: "Retry";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--cyan);
  font-size: 12px;
  font-weight: 800;
  background: rgba(2, 2, 4, 0.76);
}

.media-debug-panel {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 120;
  width: min(660px, calc(100vw - 28px));
  max-height: min(620px, calc(100vh - 28px));
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: rgba(2, 2, 4, 0.92);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  overflow: hidden;
}

.media-debug-head,
.media-debug-metrics,
.media-debug-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.media-debug-head {
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.media-debug-head strong {
  margin-right: auto;
  font-size: 12px;
}

.media-debug-head button {
  appearance: none;
  border: 0;
  border-radius: 6px;
  padding: 5px 8px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-soft);
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
}

.media-debug-head button:hover {
  color: var(--cyan);
  background: rgba(83, 216, 255, 0.1);
}

.media-debug-metrics {
  flex-wrap: wrap;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
}

.media-debug-metrics span {
  padding: 3px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
}

.media-debug-list {
  overflow: auto;
  padding: 5px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

.media-debug-row {
  min-width: 0;
  padding: 5px 12px;
  color: var(--muted);
  font-size: 11px;
}

.media-debug-row span,
.media-debug-row strong,
.media-debug-row em {
  min-width: 0;
}

.media-debug-row strong {
  color: var(--text-soft);
  white-space: nowrap;
}

.media-debug-row em {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-style: normal;
}

.media-debug-row.network > span:first-child {
  color: var(--amber);
}

.media-debug-row.cache > span:first-child {
  color: var(--green);
}

.media-debug-row.browser-cache > span:first-child {
  color: var(--violet);
}

.media-debug-row.timing-limited > span:first-child {
  color: var(--muted);
}

.media-debug-row.revalidated > span:first-child,
.media-debug-row.element > span:first-child {
  color: var(--cyan);
}

.media-debug-row.hydrate > span:first-child {
  color: var(--violet);
}

.media-debug-row.video-event > span:first-child {
  color: var(--green);
}

.jobs-sentinel {
  width: 100%;
  height: 1px;
}

.error-text {
  color: var(--red);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin-bottom: 14px;
}

.hidden {
  display: none;
}

.media-viewer {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(18px);
}

.viewer-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: zoom-out;
}

.viewer-shell {
  position: relative;
  z-index: 1;
  width: 100vw;
  height: 100vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  padding: 18px;
  pointer-events: none;
}

.viewer-toolbar {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  pointer-events: auto;
}

.viewer-title {
  font-weight: 800;
  color: var(--text);
  max-width: min(760px, 62vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viewer-counter {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.viewer-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.viewer-download,
.viewer-button,
.viewer-nav {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(7, 8, 11, 0.82);
  color: var(--text);
  text-decoration: none;
}

.viewer-download {
  padding: 10px 14px;
  color: var(--cyan);
  font-weight: 700;
}

.viewer-button {
  width: 42px;
  height: 42px;
  font-size: 28px;
  line-height: 1;
}

.viewer-stage {
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  pointer-events: auto;
}

.viewer-stage img,
.viewer-stage video {
  max-width: calc(100vw - 76px);
  max-height: calc(100vh - 112px);
  object-fit: contain;
  border-radius: 6px;
  background: #020204;
  box-shadow: var(--shadow);
}

.viewer-stage img {
  cursor: zoom-in;
}

.viewer-stage.zoomed {
  align-items: flex-start;
  justify-content: flex-start;
  overflow: auto;
  padding: 18px;
}

.viewer-stage.zoomed img {
  max-width: none;
  max-height: none;
  cursor: zoom-out;
}

.viewer-nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  width: 52px;
  height: 72px;
  transform: translateY(-50%);
  font-size: 54px;
  line-height: 1;
  pointer-events: auto;
}

.viewer-nav.previous {
  left: 18px;
}

.viewer-nav.next {
  right: 18px;
}

.viewer-nav:hover,
.viewer-button:hover,
.viewer-download:hover {
  border-color: rgba(83, 216, 255, 0.32);
  background: rgba(10, 11, 15, 0.96);
}

.login-page {
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-shell {
  width: min(420px, calc(100vw - 32px));
}

.login-panel {
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #050609;
  box-shadow: var(--shadow);
}

.brand-mark {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--cyan);
  color: #020204;
  font-weight: 900;
  margin-bottom: 20px;
}

.login-panel h1 {
  margin: 0;
}

.login-form {
  margin-top: 24px;
}

.error-banner {
  margin-top: 18px;
  padding: 12px;
  border-left: 2px solid var(--red);
  background: rgba(255, 93, 115, 0.08);
  color: var(--red);
}

.info-banner {
  margin-top: 18px;
  padding: 12px;
  border-left: 2px solid var(--green);
  background: rgba(88, 230, 154, 0.08);
  color: var(--green);
}

@media (max-width: 1180px) {
  .workspace {
    width: 100%;
    padding: 24px 22px 36px;
  }

  .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 920px) {
  .topbar {
    padding: 0 18px;
  }

  .workspace {
    display: block;
    padding: 22px 18px 34px;
    overflow-x: visible;
  }

  .split-resizer {
    display: none;
  }

  .tool-pane {
    position: static;
    width: auto;
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }

  .results-pane {
    padding-left: 0;
    margin-top: 28px;
  }
}

@media (max-width: 620px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    padding: 14px 16px;
  }

  .topbar-actions {
    width: 100%;
    justify-content: space-between;
  }

  .workspace {
    padding: 18px 14px 28px;
  }

  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  .results-header,
  .job-head {
    flex-direction: column;
  }

  .job-head-actions {
    justify-content: flex-start;
  }

  .output-grid {
    grid-template-columns: 1fr;
  }

  .output-tile {
    width: 100%;
  }

  .details-row {
    grid-template-columns: 1fr;
  }

  .details-label {
    padding: 10px 0 0;
  }

  .viewer-title {
    max-width: 48vw;
  }

  .viewer-download {
    display: none;
  }
}

/* ── Phase 3.2: Email verification banner ─────────────────────────────────── */
.verify-banner {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  background: rgba(255, 190, 92, 0.08);
  border-bottom: 1px solid rgba(255, 190, 92, 0.25);
  color: var(--amber);
  padding: 0.65rem 1.25rem;
  font-size: 0.875rem;
  line-height: 1.4;
}

.verify-banner strong {
  color: var(--text);
}

.verify-banner-form {
  margin: 0;
  flex-shrink: 0;
}

.verify-banner-btn {
  background: transparent;
  border: 1px solid rgba(255, 190, 92, 0.4);
  color: var(--amber);
  padding: 0.3rem 0.85rem;
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 700;
  transition: background 0.15s, border-color 0.15s;
}

.verify-banner-btn:hover {
  background: rgba(255, 190, 92, 0.1);
  border-color: var(--amber);
}

.verify-banner-success {
  background: rgba(88, 230, 154, 0.08);
  border-bottom: 1px solid rgba(88, 230, 154, 0.25);
  color: var(--green);
}

.verify-banner-warning {
  background: rgba(255, 190, 92, 0.12);
  border-bottom: 1px solid rgba(255, 190, 92, 0.3);
  color: var(--amber);
}

.active-invoice-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  background: rgba(83, 216, 255, 0.06);
  border: 1px solid rgba(83, 216, 255, 0.4);
  border-radius: 8px;
  color: var(--text-soft);
  padding: 0.75rem 1.25rem;
  margin: 0 auto 1.5rem;
  max-width: 900px;
  font-size: 0.9rem;
}
.active-invoice-banner[hidden] { display: none; }
.active-invoice-banner strong { color: var(--text); }
.active-invoice-banner .active-invoice-resume {
  background: var(--cyan);
  border: none;
  color: #020204;
  padding: 0.4rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.875rem;
}
.active-invoice-banner .active-invoice-resume:hover { background: var(--cyan-hover); }
#active-invoice-status-pill {
  display: inline-block;
  padding: 0.05rem 0.4rem;
  border-radius: 4px;
  background: var(--cyan-soft);
  color: var(--cyan);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-left: 0.25rem;
}

.public-footer {
  text-align: center;
  margin: 2rem auto 1rem;
  font-size: 0.78rem;
  color: var(--muted-2);
  letter-spacing: 0.02em;
}
.public-footer a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
}
.public-footer a:hover {
  color: var(--cyan);
}

/* Phase 3: image-to-video / reference-to-video image tray */
/* Phase 9: image tray now uses the same dashed-border dropzone chrome as
   the Upscale dropzone — see .upscale-dropzone above.  Same hover/dragover
   accents so both drop targets look consistent. */
.image-tray {
  padding: 14px 16px;
  margin: 0.4rem 0;
  border: 1.5px dashed var(--line-strong);
  border-radius: 8px;
  background: var(--bg-field);
  color: var(--muted);
  transition: border-color 140ms ease, background 140ms ease;
  /* Stick to the top of the form pane while scrolling so the tray stays
     visible while operator browses long history to drag more refs in. */
  position: sticky;
  top: 0;
  z-index: 5;
}
.image-tray:hover {
  border-color: rgba(83, 216, 255, 0.45);
  background: rgba(83, 216, 255, 0.04);
  color: var(--text-soft);
}
.image-tray-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
}
.image-tray-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.image-tray-thumb {
  position: relative;
  width: 72px;
  height: 96px;
  border-radius: 4px;
  overflow: hidden;
  background: #0d0e14;
  border: 1px solid #2a2c38;
}
.image-tray.empty {
  /* Empty state: centred icon + label, like the upscale dropzone.  Header
     row is hidden in this state (rendered via JS) so the focal point is
     the call-to-action. */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 100px;
  text-align: center;
  padding: 22px 16px;
}
.image-tray.empty .image-tray-thumbs { display: none; }
.image-tray.empty .image-tray-header { display: none; }
.image-tray-empty-icon {
  font-size: 22px;
  line-height: 1;
}
.image-tray-empty-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-soft);
}
.image-tray-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.image-tray-thumb-index {
  position: absolute;
  bottom: 2px;
  left: 2px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-size: 0.65rem;
  padding: 1px 5px;
  border-radius: 3px;
  font-weight: 600;
}
.image-tray-thumb-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  font-size: 0.7rem;
  line-height: 18px;
  text-align: center;
  cursor: pointer;
  padding: 0;
}
.image-tray-hint {
  margin-top: 0.4rem;
  font-size: 0.75rem;
}
.image-tray.error .image-tray-hint { color: #f87171; }

/* Phase 9: when 2 images are present and the model supports both modes
   (img2vid first+last vs ref2vid), the picker lets the operator choose. */
.image-tray-mode-picker {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.03);
}
.image-tray-mode-picker[hidden] { display: none; }
.image-tray-mode-picker .subtle {
  font-size: 12px;
  margin-right: 4px;
}

/* Phase 3 polish: drag-and-drop visual feedback */
.image-tray.drop-target {
  background: rgba(83, 216, 255, 0.08);
  border-style: solid;
  border-color: var(--cyan);
  box-shadow: 0 0 0 2px rgba(83, 216, 255, 0.4);
}
.output-tile[draggable="true"] {
  cursor: grab;
}
.output-tile[draggable="true"]:active {
  cursor: grabbing;
}
.output-tile.dragging,
.image-tray-thumb.dragging {
  opacity: 0.4;
}
.image-tray-thumb {
  cursor: grab;
}
.image-tray-thumb:active {
  cursor: grabbing;
}
/* Help tooltips — a subtle ⓘ glyph inline with the label text.  No background
   pill (operator feedback: previous version "looked like a badge, took space").
   Renders as a faint glyph that pops cyan on hover/focus.  Tooltip popup is
   built in JS (app.js → _showHelpTooltip) — see .help-tooltip below. */
.help-icon {
  display: inline;
  margin-left: 4px;
  padding: 0;
  background: none;
  color: var(--muted);
  font-style: normal;
  font-weight: 400;
  font-size: 0.95em;
  line-height: 1;
  opacity: 0.55;
  cursor: help;
  user-select: none;
  vertical-align: baseline;
  transition: opacity 0.15s, color 0.15s;
}
.help-icon:hover,
.help-icon:focus-visible {
  opacity: 1;
  color: var(--cyan);
  outline: none;
}

/* The label-text wrapper keeps the field name + help icon on one row, so
   the icon doesn't take a vertical slot of its own under the global
   `label { display: grid }` rule.  See dashboard.html — generated by the
   regex pass that wrapped all label text + icon pairs. */
.label-text {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

/* Checkbox-style labels (enable_web_search, generate_audio, use_pro,
   enable_prompt_enhancer): override the global label{display:grid} so the
   checkbox + label text + help icon flow inline on a single row.
   No !important — :has() bumps specificity to (0,0,1,1) which beats the
   plain `label` selector, and crucially it does NOT beat inline
   `style="display:none"` written by JS setHidden. */
label:has(> input[type="checkbox"]) {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Tooltip is rendered into <body> by the JS handler in app.js — that lets us
   use position: fixed and calculate placement against the viewport, avoiding
   the clipping issues of the previous pure-CSS pseudo-element approach
   (operator screenshots 2026-05-02). */
.help-tooltip {
  position: fixed;
  width: 240px;
  max-width: calc(100vw - 24px);
  padding: 9px 12px;
  background: var(--bg-card);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  font-style: normal;
  line-height: 1.45;
  letter-spacing: 0;
  white-space: normal;
  text-align: left;
  text-transform: none;
  z-index: 1000;
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  /* Hidden by default; JS toggles visibility + sets position. */
  display: none;
}

/* Preset description shown under the model dropdown — populated by
   applyPresetToImageForm / applyPresetToVideoForm. */
.preset-description {
  margin-top: -4px;
  margin-bottom: 12px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.025);
  border-left: 3px solid rgba(83, 216, 255, 0.4);
  border-radius: 0 6px 6px 0;
  font-size: 12px;
  color: var(--text-soft);
  line-height: 1.4;
}
.preset-description:empty { display: none; }

/* Phase 5: structured failure display */
.error-kind-badge {
  display: inline-block;
  padding: 0.05rem 0.45rem;
  margin-right: 0.4rem;
  border-radius: 4px;
  background: var(--bg-soft);
  color: var(--red);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
}
.error-kind-badge.ban-warning {
  background: rgba(255, 93, 115, 0.25);
  color: var(--text);
  animation: pulse-ban 1.6s infinite;
}
@keyframes pulse-ban {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 93, 115, 0.7); }
  50% { box-shadow: 0 0 0 4px rgba(255, 93, 115, 0); }
}
.error-text.ban-warning {
  border-left: 3px solid var(--red);
  padding-left: 0.5rem;
  background: rgba(255, 93, 115, 0.1);
}
.error-debug-button {
  margin-left: 0.5rem;
  font-size: 0.7rem;
  padding: 0.1rem 0.5rem;
}
.error-details-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}
.error-details-shell {
  background: var(--bg-card);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  max-width: 900px;
  width: 100%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}
.error-details-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--line);
}
.error-details-body {
  flex: 1;
  overflow: auto;
  padding: 1rem;
  margin: 0;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.78rem;
  color: var(--text-soft);
  white-space: pre-wrap;
  word-break: break-word;
}

/* Phase 7 — showcase / inspiration gallery */
.showcase-body {
  background: #050609;
  color: var(--text);
}
.showcase-main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 18px 20px 60px;
}
.showcase-controls {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 22px;
}
.showcase-tabs {
  display: flex;
  gap: 6px;
}
.showcase-tabs .tab {
  text-decoration: none;
  padding: 8px 18px;
  border-radius: 6px;
  font-weight: 700;
  color: var(--muted);
}
.showcase-tabs .tab.active {
  background: var(--text);
  color: #050609;
}
.showcase-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.filter-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-left: 8px;
}
.filter-label:first-child { margin-left: 0; }
.filter-pill {
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-soft);
  text-decoration: none;
  background: transparent;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.filter-pill:hover {
  border-color: var(--line-strong);
  color: var(--text);
}
.filter-pill.active {
  background: rgba(83, 216, 255, 0.12);
  border-color: rgba(83, 216, 255, 0.55);
  color: var(--cyan);
}
.showcase-funnel-banner {
  background: linear-gradient(120deg, rgba(83, 216, 255, 0.1), rgba(83, 216, 255, 0.02));
  border: 1px solid rgba(83, 216, 255, 0.3);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 13px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
/* Masonry via CSS columns — items pack with their natural aspect-ratio,
   no fixed tile heights.  Mirrors Civitai's grid where landscape and
   portrait works coexist without empty space.  Items flow column-major
   (top-down then left-right) — fine since we sort by reactions DESC. */
.showcase-grid {
  column-count: auto;
  column-width: 280px;
  column-gap: 10px;
}
@media (min-width: 1500px) { .showcase-grid { column-width: 300px; } }
@media (max-width: 800px)  { .showcase-grid { column-width: 220px; } }

.showcase-tile {
  break-inside: avoid;
  margin: 0 0 10px;
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  background: #0d0e14;
  cursor: pointer;
  display: block;
}
.showcase-tile img,
.showcase-tile video {
  display: block;
  width: 100%;
  height: auto;
  background: #050609;
}

.showcase-video-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 14px;
  padding: 3px 8px;
  border-radius: 4px;
  pointer-events: none;
  backdrop-filter: blur(4px);
}

/* Reaction pills — visible at bottom-left in idle state.  On tile hover the
   Remix CTA + author overlay slides in at the same place, so we fade the
   stats out to avoid visual collision (operator feedback 2026-05-03). */
.showcase-stats-overlay {
  position: absolute;
  bottom: 8px;
  left: 8px;
  display: flex;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  pointer-events: none;
  z-index: 1;
  opacity: 1;
  transition: opacity 0.15s ease;
}
.showcase-tile:hover .showcase-stats-overlay {
  opacity: 0;
}
.showcase-stats-overlay span {
  background: rgba(0, 0, 0, 0.65);
  padding: 3px 7px;
  border-radius: 999px;
  backdrop-filter: blur(6px);
  display: inline-flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
}

/* Full-tile hover overlay — gradient backdrop + Remix CTA + meta. */
.showcase-hover {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 8px;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.4) 0%,
    transparent 30%,
    transparent 50%,
    rgba(0, 0, 0, 0.85) 100%
  );
  opacity: 0;
  transition: opacity 0.18s ease;
  pointer-events: none;
}
.showcase-tile:hover .showcase-hover { opacity: 1; }
.showcase-hover > * { pointer-events: auto; }

.showcase-hover-top {
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
}
.showcase-hover-bottom {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: stretch;
}
.showcase-author {
  color: rgba(255, 255, 255, 0.85);
  font-size: 11px;
  font-weight: 500;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}
.showcase-author a {
  color: var(--cyan);
  text-decoration: none;
  font-weight: 700;
}
.showcase-author a:hover { text-decoration: underline; }
.showcase-author .model-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  background: rgba(83, 216, 255, 0.18);
  border: 1px solid rgba(83, 216, 255, 0.35);
  border-radius: 999px;
  color: var(--cyan);
  font-weight: 600;
  font-size: 10px;
}
.showcase-author .model-tag.muted {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--muted);
}
.showcase-remix-btn {
  display: block;
  text-align: center;
  background: var(--cyan);
  color: #050609;
  font-weight: 800;
  font-size: 13px;
  padding: 9px 14px;
  border-radius: 6px;
  text-decoration: none;
  transition: background 0.12s, transform 0.08s;
  box-shadow: 0 4px 14px rgba(83, 216, 255, 0.35);
}
.showcase-remix-btn:hover { background: #7be2ff; }
.showcase-remix-btn:active { transform: scale(0.97); }
.showcase-delete {
  background: rgba(0, 0, 0, 0.6);
  color: rgba(248, 113, 113, 0.9);
  border: 1px solid rgba(248, 113, 113, 0.3);
  border-radius: 50%;
  width: 26px;
  height: 26px;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  backdrop-filter: blur(6px);
}
.showcase-delete:hover {
  background: rgba(248, 113, 113, 0.2);
  border-color: rgba(248, 113, 113, 0.7);
  color: #f87171;
}
.showcase-empty {
  text-align: center;
  padding: 80px 20px;
  color: var(--muted);
}
.showcase-footer {
  margin-top: 32px;
  padding: 18px;
  text-align: center;
  font-size: 11px;
}
.showcase-footer a { color: var(--text-soft); }

/* ===== Phase 6b — Upscale tab (multi-file batch panel) ===== */

.upscale-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 140px;
  padding: 28px 16px;
  margin-bottom: 16px;
  border: 1.5px dashed var(--line-strong);
  border-radius: 8px;
  background: var(--bg-field);
  color: var(--muted);
  cursor: pointer;
  text-align: center;
  transition: border-color 140ms ease, background 140ms ease;
}
.upscale-dropzone:hover,
.upscale-dropzone:focus-visible {
  border-color: rgba(83, 216, 255, 0.45);
  background: rgba(83, 216, 255, 0.04);
  color: var(--text-soft);
  outline: none;
}
.upscale-dropzone.is-dragover {
  border-color: var(--cyan);
  background: rgba(83, 216, 255, 0.08);
  color: var(--text);
}
.upscale-dropzone-icon {
  font-size: 24px;
  line-height: 1;
}
.upscale-dropzone-label {
  font-size: 13px;
  font-weight: 700;
}
.upscale-dropzone-count {
  font-size: 12px;
  color: var(--muted-2);
}

.upscale-thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}
.upscale-thumbs:empty {
  display: none;
}

.upscale-thumb {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 6px;
  overflow: hidden;
  background: #050609;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}
.upscale-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.upscale-thumb-placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #0a0b0f 0%, #14161c 100%);
}
.upscale-thumb-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: rgba(248, 92, 92, 0.85);
  color: #fff;
  font-size: 16px;
  line-height: 1;
  font-weight: 800;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.upscale-thumb-remove:hover {
  background: rgba(248, 92, 92, 1);
}
.upscale-thumb-dims {
  position: absolute;
  right: 4px;
  bottom: 4px;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 3px;
  background: rgba(2, 2, 4, 0.7);
  color: var(--text-soft);
}

.upscale-badge {
  position: absolute;
  left: 4px;
  bottom: 4px;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.upscale-badge.is-included {
  background: rgba(88, 230, 154, 0.85);
  color: #052517;
}
.upscale-badge.is-excluded {
  background: rgba(248, 92, 92, 0.9);
  color: #fff;
}
.upscale-badge.is-uploading {
  background: rgba(83, 216, 255, 0.85);
  color: #022035;
}
.upscale-badge.is-failed {
  background: rgba(248, 92, 92, 0.9);
  color: #fff;
  cursor: help;
}

.upscale-config {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px 12px;
  margin: 0 0 12px;
  display: grid;
  gap: 8px;
}
.upscale-config legend {
  padding: 0 6px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.upscale-upscaler-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.upscaler-name {
  font-size: 14px;
  font-weight: 800;
  color: var(--cyan);
}

.upscale-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.upscale-pill {
  flex: 1 1 60px;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 6px;
  border: 1px solid var(--line-strong);
  background: var(--bg-field);
  color: var(--text-soft);
  font-weight: 700;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}
.upscale-pill:hover:not(:disabled) {
  border-color: rgba(83, 216, 255, 0.45);
  color: var(--text);
}
.upscale-pill.is-selected {
  background: rgba(83, 216, 255, 0.18);
  border-color: var(--cyan);
  color: var(--cyan);
}
.upscale-pill.is-greyed,
.upscale-pill:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.upscale-hint {
  margin: 4px 0 0;
}

/* ===== Phase 8c — Civitai-style sliders + aspect tiles ===== */

.slider-field {
  display: block;
  margin-bottom: 18px;
}
.slider-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 700;
}
.slider-controls {
  display: flex;
  align-items: center;
  gap: 14px;
}
.slider-controls .slider-range { flex: 1; min-width: 0; }
.slider-number {
  width: 64px;
  flex-shrink: 0;
  padding: 4px 8px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 13px;
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--line);
  border-radius: 5px;
}
input[type="range"].slider-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(
    to right,
    var(--cyan) 0%,
    var(--cyan) var(--slider-fill, 50%),
    rgba(255, 255, 255, 0.12) var(--slider-fill, 50%),
    rgba(255, 255, 255, 0.12) 100%
  );
  outline: none;
  cursor: pointer;
  box-shadow: none;
}
.slider-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #ffffff;
  border: 2px solid #050609;
  cursor: grab;
  /* Centre vertically on the 6px track: -((thumb_height - track_height) / 2). */
  margin-top: -5px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}
.slider-range::-webkit-slider-thumb:active { cursor: grabbing; }
.slider-range::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #ffffff;
  border: 2px solid #050609;
  cursor: grab;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}
.slider-range::-moz-range-track {
  background: transparent;
  height: 4px;
}

/* Quick-pick chips on slider's label row (Creative/Balanced/Precise etc). */
.quick-picks {
  display: inline-flex;
  gap: 4px;
}
.quick-pick {
  appearance: none;
  border: 0;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-soft);
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 5px;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}
.quick-pick:hover {
  background: rgba(255, 255, 255, 0.10);
  color: var(--text);
}
.quick-pick.is-selected {
  background: var(--cyan);
  color: #020204;
}

/* Sampler quick-pick pills (Fast / Popular).  Same look as quick-picks. */
#sampler-pills {
  display: inline-flex;
  gap: 4px;
}
#sampler-pills .upscale-pill {
  flex: 0 0 auto;
  min-height: 0;
  padding: 4px 9px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.06);
  border: 0;
  border-radius: 5px;
  color: var(--text-soft);
}
#sampler-pills .upscale-pill:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.10);
  border: 0;
  color: var(--text);
}
#sampler-pills .upscale-pill.is-selected {
  background: var(--cyan);
  color: #020204;
  border: 0;
}

/* Aspect ratio tiles — equal-width compact buttons.  auto-fit lets 3 / 4 / 5
   options all share one row without overflow; tile height stays minimal so
   the form doesn't grow when more aspect choices are added. */
.aspect-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: 4px;
  margin-top: 4px;
}
.aspect-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 10px 4px 8px;
  min-height: 78px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-soft);
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
  font-family: inherit;
}
.aspect-tile:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}
.aspect-tile.is-selected {
  background: rgba(255, 255, 255, 0.10);
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--text);
}
.aspect-tile-shape {
  display: block;
  width: calc(22px * var(--aspect-w) / max(var(--aspect-w), var(--aspect-h)));
  height: calc(22px * var(--aspect-h) / max(var(--aspect-w), var(--aspect-h)));
  border: 1.5px solid currentColor;
  border-radius: 2px;
  margin-bottom: 1px;
}
.aspect-tile-ratio {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.aspect-tile-dims {
  font-size: 10px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* "Advanced" details panel — make it visually contained like Civitai's */
details[data-field="advanced"] {
  margin-top: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
details[data-field="advanced"] > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
  margin-bottom: 14px;
}
details[data-field="advanced"] > summary::-webkit-details-marker { display: none; }
details[data-field="advanced"] > summary::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  /* Closed: chevron points right (▶); rotated to point down when open. */
  transform: rotate(-45deg);
  transition: transform 160ms ease;
  margin-right: 2px;
}
details[data-field="advanced"][open] > summary::before {
  transform: rotate(45deg);
}
details[data-field="advanced"][open] > summary { margin-bottom: 18px; }

/* ============================================================
   Pricing & billing pages — shared chrome
   Both pricing.html and billing.html use <body class="billing-page">.
   Extracted from inline <style> blocks; all colors via tokens.
   ============================================================ */

.billing-page {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  padding: 32px 16px;
}

.billing-shell {
  max-width: 900px;
  margin: 0 auto;
}

.billing-header {
  text-align: center;
  margin-bottom: 40px;
}

.billing-header h1 {
  font-size: 28px;
  font-weight: 800;
  margin: 0 0 8px;
  line-height: 1.2;
  color: var(--text);
}

.billing-header p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

/* flex+wrap+justify-center: 5-tier menu lays out 3+2 with row 2 centred. */
.tier-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px;
  margin-bottom: 40px;
}

.tier-card {
  /* Phase 2 wrap-fix: was `flex: 0 1 240px; max-width: 280px;` which froze
     each card at 240 px and forced ugly mid-phrase line-breaks ("Unlimited
     generations for / 24 hours").  Allow grow + bump max-width so 3-up
     rows fill the 900px container cleanly (~286px each) and 5-up rows
     use 2nd-row centring.  Combined with text-wrap: pretty on <li> the
     remaining wraps land at natural word boundaries. */
  flex: 1 1 240px;
  max-width: 320px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: border-color 0.15s;
}

.tier-card.current {
  border-color: var(--cyan);
  box-shadow: 0 0 0 1px var(--cyan);
}

.tier-card .tier-name {
  font-size: 19px;
  font-weight: 700;
  color: var(--text);
}

.tier-card .tier-price {
  font-size: 32px;
  font-weight: 800;
  color: var(--cyan);
  line-height: 1.1;
}

.tier-card .tier-price span {
  font-size: 16px;
  font-weight: 400;
  color: var(--muted);
}

.tier-card .tier-features {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tier-card .tier-features li {
  font-size: 14px;
  color: var(--text-soft);
  line-height: 1.5;
  /* text-wrap: pretty (Chrome/Edge 117+, Firefox 121+, Safari 17.5+):
     balances last-line wraps so phrases like "$2.71/day · 46% off"
     stay together instead of breaking mid-token. */
  text-wrap: pretty;
}

.tier-card .tier-features li::before {
  content: "✓ ";
  color: var(--green);
  font-weight: 700;
}

.tier-card .current-badge {
  display: inline-block;
  background: var(--cyan);
  color: #020204;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-top: 4px;
  align-self: flex-start;
}

.cta-btn,
.subscribe-btn {
  margin-top: auto;
  display: block;
  width: 100%;
  background: var(--cyan);
  border: 0;
  color: #020204;
  padding: 11px 20px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: background 0.15s;
}

.cta-btn:hover,
.subscribe-btn:hover {
  background: var(--cyan-hover);
}

.subscribe-btn:disabled {
  background: var(--line-strong);
  color: var(--muted);
  cursor: not-allowed;
}

.payments-section {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 32px;
}

.payments-section h2 {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 12px;
  color: var(--text);
}

.payments-section p {
  font-size: 14px;
  color: var(--text-soft);
  margin: 5px 0;
}

.payments-section .coming-soon {
  color: var(--muted);
  font-size: 13px;
}

.billing-footer {
  text-align: center;
  color: var(--muted-2);
  font-size: 13px;
  margin-top: 16px;
}

.billing-footer a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
}

.billing-footer a:hover {
  color: var(--cyan);
}

/* Brand mark used at the top of pricing/billing pages — small cyan square
   with the "RM" wordmark.  See also .login-shell .brand-mark above. */
.brand-mark.brand-mark-pricing {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 17px;
  margin: 0 auto 16px;
}

/* Billing page topbar — non-sticky variant (default .topbar is sticky and
   z-index 10; billing wants relative so the modal-overlay sits cleanly
   above without weird stacking context interactions). */
.billing-topbar {
  position: relative;
  z-index: 1;
}

.topbar-email {
  font-size: 13px;
  color: var(--muted);
}

/* ============================================================
   Billing modal — invoice payment dialog
   Shared with admin's TOTP modal via .modal-overlay only.
   ============================================================ */

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 1000;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  padding: 16px 0;
}

.modal-overlay.open {
  display: flex;
}

@media (min-width: 580px) {
  .modal-overlay {
    align-items: center;
    padding: 0;
  }
}

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 500px;
  width: 100%;
  margin: 16px;
}

.modal-title {
  font-size: 19px;
  font-weight: 800;
  margin-bottom: 20px;
  color: var(--text);
}

.modal-row {
  margin-bottom: 16px;
}

.modal-label {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 5px;
}

.modal-value {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px;
  letter-spacing: -0.01em;
  word-break: break-all;
  background: var(--bg-field);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 9px 12px;
  color: var(--text);
  line-height: 1.4;
}

.dashboard-link-row {
  display: flex;
  justify-content: center;
  margin: 24px 0 8px;
}

.dashboard-link {
  display: inline-block;
  padding: 10px 24px;
  border: 1px solid var(--cyan);
  border-radius: var(--radius-md);
  color: var(--cyan);
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
  transition: background 0.15s, color 0.15s;
}

.dashboard-link:hover {
  background: var(--cyan);
  color: #020204;
}

.copy-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.copy-row .modal-value {
  flex: 1;
}

.copy-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line-strong);
  color: var(--text);
  padding: 6px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
  transition: background 0.12s;
}

.copy-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.copy-btn.copied {
  background: rgba(88, 230, 154, 0.15);
  border-color: rgba(88, 230, 154, 0.4);
  color: var(--green);
}

.modal-amount-big {
  font-size: 32px;
  font-weight: 800;
  color: var(--cyan);
  text-align: center;
  margin: 16px 0;
}

.modal-status {
  text-align: center;
  padding: 12px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 16px;
}

.modal-status.waiting {
  background: rgba(83, 216, 255, 0.08);
  color: var(--cyan);
}

.modal-status.detected,
.modal-status.confirmed {
  background: rgba(88, 230, 154, 0.1);
  color: var(--green);
}

.modal-status.expired {
  background: rgba(255, 93, 115, 0.1);
  color: var(--red);
}

.modal-status.underpaid {
  background: rgba(255, 190, 92, 0.1);
  color: var(--amber);
}

.modal-countdown {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 16px;
}

.modal-countdown span {
  color: var(--amber);
  font-weight: 700;
}

.modal-note {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  line-height: 1.5;
}

#invoiceModal .modal-note-underpaid { display: none; }
#invoiceModal[data-status="underpaid"] .modal-note-default { display: none; }
#invoiceModal[data-status="underpaid"] .modal-note-underpaid { display: block; }

.modal-close-btn {
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line-strong);
  color: var(--text);
  padding: 10px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 14px;
  margin-top: 16px;
  transition: background 0.12s;
}

.modal-close-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--cyan);
  border-top-color: transparent;
  border-radius: var(--radius-pill);
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================================
   Admin page — only on <body class="admin-page">
   Wider layout, table-heavy. Buttons & badges scoped to .admin-page
   so future pages with .btn can have their own definition.
   ============================================================ */

.admin-page {
  background: var(--bg);
  color: var(--text);
}

.admin-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

.admin-shell h2 {
  font-size: 20px;
  font-weight: 700;
  margin: 32px 0 12px;
  color: var(--cyan);
}

.admin-shell h3 {
  font-size: 16px;
  font-weight: 700;
  margin: 24px 0 8px;
  color: var(--muted);
}

.admin-shell table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.admin-shell th {
  text-align: left;
  padding: 7px 10px;
  color: var(--muted);
  border-bottom: 1px solid var(--line-strong);
  font-weight: 700;
  white-space: nowrap;
}

.admin-shell td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.admin-shell tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

.admin-page .badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
}

.admin-page .badge-admin {
  background: var(--cyan);
  color: #020204;
}

.admin-page .badge-user {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-soft);
}

.admin-page .badge-active {
  background: rgba(88, 230, 154, 0.15);
  color: var(--green);
}

.admin-page .badge-inactive,
.admin-page .badge-disabled {
  background: rgba(255, 93, 115, 0.15);
  color: var(--red);
}

.admin-page .badge-tier {
  background: var(--cyan-soft);
  color: var(--cyan);
}

.admin-page .btn {
  display: inline-block;
  padding: 5px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  transition: background 0.12s;
}

.admin-page .btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.admin-page .btn-danger {
  border-color: rgba(255, 93, 115, 0.4);
  background: rgba(255, 93, 115, 0.08);
  color: var(--red);
}

.admin-page .btn-danger:hover {
  background: rgba(255, 93, 115, 0.16);
}

.admin-page .btn-safe {
  border-color: rgba(88, 230, 154, 0.4);
  background: rgba(88, 230, 154, 0.08);
  color: var(--green);
}

.admin-page .btn-safe:hover {
  background: rgba(88, 230, 154, 0.16);
}

.admin-page .btn-accent {
  border-color: rgba(83, 216, 255, 0.4);
  background: var(--cyan-soft);
  color: var(--cyan);
}

.admin-page .btn-accent:hover {
  background: rgba(83, 216, 255, 0.2);
}

.admin-page .actions-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.admin-page .tier-form,
.admin-page .until-form {
  display: inline-flex;
  gap: 5px;
  align-items: center;
}

/* Native form widgets inside admin tables — narrower than dashboard's
   global rule which sets width:100%.  Box-shadow disabled to match the
   .btn neighbours (no inset ring). */
.admin-page .tier-form select,
.admin-page .until-form input[type="date"] {
  width: auto;
  background: var(--bg-field);
  border: 1px solid var(--line-strong);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 4px 7px;
  font-size: 13px;
  box-shadow: none;
}

.admin-page .audit-table td {
  font-size: 13px;
  color: var(--text-soft);
}

.admin-page .audit-table td:first-child {
  color: var(--muted-2);
  white-space: nowrap;
}

.admin-page .event-type {
  color: var(--cyan);
  font-weight: 700;
}

.admin-page .details-json {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color: var(--muted);
  font-size: 12px;
}

/* Admin TOTP modal contents.  .modal-overlay is shared with billing. */
.admin-page .modal {
  background: var(--bg-card);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  padding: 24px;
  max-width: 520px;
  width: 100%;
  margin: 16px;
}

.admin-page .modal h3 {
  margin-top: 0;
  color: var(--red);
}

.admin-page .uri-box {
  background: var(--bg-field);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px;
  word-break: break-all;
  color: var(--cyan);
  margin: 12px 0;
}

.admin-page .codes-list {
  list-style: none;
  padding: 12px;
  margin: 8px 0 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 14px;
  color: var(--green);
  background: var(--bg-field);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.admin-page .modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* Small inline helpers replacing former style="..." attributes in admin.html. */
.admin-page .cell-meta {
  color: var(--muted-2);
  font-size: 12px;
  white-space: nowrap;
}

.admin-page .cell-soft {
  color: var(--text-soft);
}

.admin-page .row-empty {
  color: var(--muted);
  text-align: center;
  padding: 16px;
}

.admin-page .section-desc {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 8px;
}

.admin-page .inline-select {
  width: auto;
  margin-left: 8px;
  font-size: 13px;
  padding: 2px 6px;
  background: var(--bg-soft);
  color: var(--text-soft);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  box-shadow: none;
}

.admin-page .summary-meta {
  margin-left: 12px;
  font-size: 12px;
  color: var(--muted);
}

.admin-page .btn-tiny {
  margin-left: 8px;
  font-size: 12px;
  padding: 3px 8px;
}

.admin-page .modal-email-row {
  font-weight: 700;
  margin-bottom: 8px;
}

.admin-page .modal-helper-text {
  color: var(--text-soft);
  font-size: 14px;
  margin: 0 0 12px;
}

.admin-page .codes-heading {
  color: var(--green);
  margin-top: 0;
}
