:root {
  --canvas: #f7f6f2;
  --surface: #ffffff;
  --surface-subtle: #f3f5f1;
  --ink: #16241d;
  --ink-secondary: #42534a;
  --muted: #66776e;
  --brand: #0e4d3a;
  --brand-hover: #093a2b;
  --brand-soft: #e7f3ec;
  --brand-ring: rgba(14, 77, 58, 0.16);
  --amber-bg: #fdf6e9;
  --amber-border: #ebd4a7;
  --amber-ink: #7c4d0f;
  --danger: #a93622;
  --danger-bg: #fdf1ef;
  --line: #e4e8e1;
  --line-strong: #cdd6cb;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(18, 35, 26, 0.04), 0 4px 12px rgba(18, 35, 26, 0.035);
  --shadow-md: 0 8px 26px rgba(18, 35, 26, 0.09);
  --serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", "SimSun", Georgia, serif;
  --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--canvas);
}

a { color: inherit; text-decoration: none; }
button, .btn, select, input, textarea { font: inherit; }
button, .btn {
  cursor: pointer;
  color: inherit;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 25;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.site-nav, main, .footer-inner {
  max-width: 1140px;
  margin: 0 auto;
}

.site-nav {
  height: 60px;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 24px;
}

.brand { display: flex; align-items: center; gap: 9px; flex: none; }
.logo { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: var(--brand); color: #fff; }
.brand strong { font-family: var(--serif); font-size: 20px; font-weight: 700; letter-spacing: 0.02em; }

.links { display: flex; align-items: center; gap: 4px; }
.links a { padding: 6px 12px; border-radius: 999px; font-size: 14.5px; color: var(--ink-secondary); white-space: nowrap; }
.links a:hover { background: var(--surface-subtle); color: var(--brand); }
.links a.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }

.btn-account {
  margin-left: auto;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  border-radius: 999px;
  padding: 6px 15px;
  min-height: 36px;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}
.btn-account:hover { border-color: var(--brand); color: var(--brand); }

/* Announcement */
.notice-bar {
  margin-bottom: 16px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: var(--amber-bg);
  border: 1px solid var(--amber-border);
  color: var(--amber-ink);
  font-size: 14px;
}

/* Main */
main { padding: 24px 24px 64px; min-height: calc(100vh - 122px); }
h1, h2, h3, p { margin: 0; }
p, .muted, small { color: var(--muted); }

.intro { margin-bottom: 16px; }
.intro h1 { font-family: var(--serif); font-size: clamp(23px, 3vw, 30px); line-height: 1.25; }
.intro p { margin-top: 4px; font-size: 14px; }

/* Buttons */
button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 8px 14px;
  min-height: 40px;
  font-size: 14px;
  font-weight: 500;
}

button:hover:not(:disabled), .btn:hover, a:focus-visible, button:focus-visible {
  border-color: var(--brand);
  color: var(--brand);
  outline: none;
}
button:focus-visible, .btn:focus-visible { box-shadow: 0 0 0 3px var(--brand-ring); }
button:disabled { opacity: 0.52; cursor: not-allowed; }

.primary { background: var(--brand); color: #fff; border-color: var(--brand); font-weight: 600; }
.primary:hover:not(:disabled) { background: var(--brand-hover); border-color: var(--brand-hover); color: #fff; }
.danger-btn { color: var(--danger); border-color: #e6bdb4; }
.danger-btn:hover:not(:disabled) { background: var(--danger-bg); border-color: var(--danger); color: var(--danger); }

.link { background: none; border: 0; padding: 4px 2px; min-height: auto; color: var(--brand); font-weight: 500; }
.link:hover { text-decoration: underline; }

/* Workspace */
.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.72fr) minmax(268px, 0.82fr);
  gap: 20px;
  align-items: start;
}

.surface, .side-card, .record, .kpi-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.surface { padding: 24px; }
.group + .group { border-top: 1px solid var(--line); margin-top: 20px; padding-top: 20px; }

.step-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.step-title { display: flex; align-items: center; gap: 8px; font-size: 16.5px; font-weight: 700; }
.step-num {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--brand-soft);
  color: var(--brand);
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 700;
}

/* Mode Dual-Tab Switcher (常用场景 | 自定义) */
.mode-tabs {
  display: inline-flex;
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 3px;
  gap: 3px;
}

.mode-tabs button {
  border: 0;
  background: transparent;
  min-height: 34px;
  padding: 5px 15px;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-secondary);
}

.mode-tabs button[aria-selected="true"] {
  background: var(--brand);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(14, 77, 58, 0.2);
}

/* Upload Dropzone */
.drop {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  border: 1.5px dashed #a4bdb0;
  border-radius: var(--radius-md);
  background: #f7faf8;
  min-height: 106px;
  padding: 16px;
  cursor: pointer;
  text-align: center;
  overflow: hidden;
}

.drop:hover, .drop.drag { border-color: var(--brand); background: var(--brand-soft); }
.drop:focus-within { outline: 2px solid var(--brand); outline-offset: 2px; }
.drop-icon { color: var(--brand); }
.drop strong { font-size: 15.5px; color: var(--ink); }
.drop small { font-size: 13px; color: var(--muted); }

.upload-meter {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 4px;
  border: 0;
  accent-color: var(--brand);
  appearance: none;
  background: transparent;
}
.upload-meter::-webkit-progress-bar { background: transparent; }
.upload-meter::-webkit-progress-value { background: var(--brand); }
.upload-meter[value="0"] { opacity: 0; }

.meter-el {
  width: 100%;
  height: 8px;
  margin-top: 6px;
  accent-color: var(--brand);
}

.file-input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }

.files { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 7px; }
.files:empty { display: none; }
.files li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  font-size: 14px;
}
.file-meta { display: flex; align-items: center; gap: 8px; min-width: 0; overflow-wrap: anywhere; }
.file-ext {
  flex: none;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--brand-soft);
  color: var(--brand);
  text-transform: uppercase;
}
.file-actions { display: flex; gap: 10px; flex: none; }

/* Scenario Grid */
.preset-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.preset-grid[hidden] { display: none; }

.preset-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  gap: 5px;
  padding: 13px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  min-height: 76px;
  width: 100%;
}

.preset-card:hover { border-color: #9ab9aa; background: #fafcfa; color: var(--ink); }
.preset-card[aria-pressed="true"] {
  border-color: var(--brand);
  background: var(--brand-soft);
  box-shadow: 0 0 0 2px var(--brand-ring);
  color: var(--ink);
}

.preset-head { display: flex; align-items: center; gap: 7px; width: 100%; padding-right: 20px; }
.preset-icon { display: inline-flex; color: var(--brand); flex: none; }
.preset-title { font-size: 15px; font-weight: 700; color: var(--ink); line-height: 1.25; white-space: nowrap; }
.preset-sub { font-size: 12.5px; line-height: 1.35; color: var(--muted); }

.preset-check {
  position: absolute;
  top: 10px;
  right: 10px;
  display: none;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  align-items: center;
  justify-content: center;
}
.preset-card[aria-pressed="true"] .preset-check { display: inline-flex; }

/* Tweaks Panel */
.tweaks-panel {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.tweaks-panel:empty, .tweaks-panel[hidden] { display: none; }

.tweak-group { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tweak-k { font-size: 13px; color: var(--muted); font-weight: 600; }

.segmented {
  display: inline-flex;
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
}

.segmented button {
  border: 0;
  background: transparent;
  min-height: 34px;
  padding: 4px 11px;
  font-size: 13.5px;
  border-radius: 6px;
  color: var(--ink-secondary);
}
.segmented button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--brand);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(18, 35, 26, 0.09);
}

.toggle-pill {
  min-height: 36px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 13.5px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-secondary);
}
.toggle-pill[aria-pressed="true"] {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand);
  font-weight: 600;
}

/* Inputs */
.field { display: grid; gap: 6px; margin-top: 12px; }
.field > span { font-size: 14px; font-weight: 600; color: var(--ink); }

.field textarea, .field input, .field select, select, .search {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: var(--surface);
  color: var(--ink);
  font-size: 15px;
}
.field input[type="checkbox"] { width: auto; padding: 0; margin: 0 6px 0 0; vertical-align: middle; }
.field textarea:focus, .field input:focus, .field select:focus, .search:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-ring);
}
textarea { resize: vertical; min-height: 80px; line-height: 1.55; }
textarea.tall { min-height: 132px; }

.extra-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.file-add {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 13px;
  min-height: 38px;
  border-radius: var(--radius-sm);
  border: 1px dashed #a4bdb0;
  color: var(--brand);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  background: #f8fbf9;
}
.file-add:hover { background: var(--brand-soft); border-color: var(--brand); }

.submit-zone { margin-top: 18px; }
.submit { width: 100%; min-height: 48px; font-size: 16px; border-radius: var(--radius-md); }
.submit-note { margin-top: 8px; font-size: 13px; color: var(--muted); text-align: center; }

/* Sidebar & Linked Sample */
.sidebar { display: grid; gap: 16px; }
.side-card { overflow: hidden; }

.sample-art {
  background:
    repeating-linear-gradient(135deg, rgba(14, 77, 58, 0.05) 0 1px, transparent 1px 14px),
    #e2ebe5;
  display: grid;
  place-items: center;
  padding: 18px;
  height: 210px;
  overflow: hidden;
}
.sample-art img {
  height: 224px;
  max-width: 100%;
  object-fit: contain;
  border-radius: 3px;
  box-shadow: 0 10px 24px rgba(17, 42, 30, 0.22);
  transform: rotate(-2.5deg);
  transition: transform .2s ease;
}
.side-card:hover .sample-art img { transform: rotate(0deg) scale(1.02); }
.sample-body {
  padding: 15px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.sample-body h2 { font-size: 15.5px; font-weight: 700; }
.sample-body small { display: block; font-size: 13px; }

.recent-card { padding: 18px; }
.recent-card h3 { font-size: 15px; font-weight: 700; margin-bottom: 8px; }
.recent { margin-top: 16px; }

/* Scene Switcher on /prototype */
.scene-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.scene-tabs a {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  font-size: 14px;
  color: var(--ink-secondary);
}
.scene-tabs a.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  font-weight: 600;
}

/* Records & Badges */
.row, .actions, .bar, .chips { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.bar { justify-content: space-between; }

.record {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  margin: 7px 0;
  width: 100%;
  text-align: left;
  border-radius: var(--radius-md);
}
.record:hover { border-color: #9ab9aa; }
.record strong { word-break: break-word; color: var(--ink); font-size: 14.5px; }

.flag {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--brand);
  background: var(--brand-soft);
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.flag.failed { color: var(--danger); background: var(--danger-bg); }
.flag.pending { color: var(--amber-ink); background: var(--amber-bg); }

/* QA Banner */
.qa-banner {
  margin-top: 14px;
  border-radius: var(--radius-md);
  padding: 12px 14px;
  border: 1px solid #cce3d6;
  background: #f3faf6;
  font-size: 14px;
}
.qa-banner.has-notice { border-color: var(--amber-border); background: var(--amber-bg); }
.qa-banner-head { font-weight: 700; color: var(--brand); margin-bottom: 4px; }
.qa-banner.has-notice .qa-banner-head { color: var(--amber-ink); }
.qa-notices { margin: 0; padding-left: 18px; color: var(--ink-secondary); }
.qa-notices li { padding: 2px 0; }

/* Processing Steps */
.steps { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin: 18px 0 12px; width: 100%; }
.step { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 9px 6px; font-size: 13.5px; color: var(--muted); background: var(--surface-subtle); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.step.done { border-color: #b7d7c6; background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.step.on { border-color: var(--brand); background: var(--brand); color: #fff; font-weight: 700; }

/* Always-visible Task Requirements & Processing Log */
.task-meta-panel {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
  border: 1px solid var(--line);
}
.task-meta-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.task-meta-head h3 { font-size: 14.5px; font-weight: 700; color: var(--brand); }
.task-meta-grid { display: grid; gap: 8px; }
.task-meta-item { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 10px; align-items: baseline; font-size: 14px; }
.task-meta-k { color: var(--muted); font-weight: 600; font-size: 13px; }
.task-meta-v { color: var(--ink); word-break: break-word; }
.task-file-list { display: flex; flex-wrap: wrap; gap: 6px; }
.task-file-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink-secondary);
}
.task-file-role {
  font-size: 11px;
  font-weight: 700;
  color: var(--brand);
  background: var(--brand-soft);
  padding: 1px 5px;
  border-radius: 4px;
}
.task-log-title { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 13px; font-weight: 600; color: var(--muted); }
.task-meta-panel .log { margin: 6px 0 0; }

/* Preview Reader */
.reader { margin-top: 18px; }
.reader-grid { margin-top: 12px; display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 14px; }
.thumbs { position: relative; display: flex; flex-direction: column; gap: 8px; max-height: 76vh; overflow: auto; }
.thumbs button { flex: none; flex-direction: column; gap: 4px; font-size: 12.5px; padding: 5px; border-radius: var(--radius-sm); border: 1.5px solid var(--line); }
.thumbs button.active { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); font-weight: 700; }
.thumbs img { width: 100%; display: block; border-radius: 2px; aspect-ratio: auto 210/297; }

.sheet {
  --preview-pad: 20px;
  --preview-height: 76vh;
  position: relative;
  background: #2b3530;
  border-radius: var(--radius-md);
  padding: var(--preview-pad);
  height: var(--preview-height);
  overflow: auto;
  scrollbar-gutter: stable;
}
.sheet:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.reader-page { width: min(100%, 740px); margin: 0 auto; }
.reader-page + .reader-page { margin-top: 16px; }
.reader-page:last-child { min-height: calc(var(--preview-height) - 2 * var(--preview-pad)); }
.reader-page img { display: block; width: 100%; height: auto; background: #fff; border-radius: 2px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.32); }
.sheet.zoom .reader-page { width: 145%; max-width: none; margin: 0; }

.pager input { width: 54px; padding: 5px 6px; text-align: center; }
.pager button { padding: 6px 10px; min-height: 36px; }

/* Admin Dashboard */
.kpi-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi-card { padding: 16px 18px; border-radius: var(--radius-md); }
.kpi-card small { display: block; font-size: 13px; color: var(--muted); }
.kpi-val { font-family: var(--serif); font-size: 26px; font-weight: 700; color: var(--ink); margin: 4px 0 2px; }
.kpi-val.ok { color: var(--brand); }
.kpi-val.warn { color: var(--danger); }

.meter-bar { height: 7px; background: var(--surface-subtle); border-radius: 999px; overflow: hidden; margin-top: 8px; border: 1px solid var(--line); }
.meter-fill { height: 100%; background: var(--brand); border-radius: 999px; }

.scene-bars { display: grid; gap: 8px; margin-top: 10px; }
.scene-bar-row { display: grid; grid-template-columns: 110px 1fr 78px; gap: 10px; align-items: center; font-size: 13.5px; }

.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 12px 0; }
.filter-bar select, .filter-bar input { width: auto; min-width: 130px; }

.sample-admin-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.sample-admin-card { border: 1px solid var(--line); border-radius: var(--radius-md); padding: 12px; background: var(--surface-subtle); display: grid; gap: 8px; }
.sample-admin-card img { width: 100%; height: 150px; object-fit: contain; background: #fff; border-radius: 6px; border: 1px solid var(--line); }

.admin-preview-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 12px; max-height: 55vh; overflow: auto; }
.admin-preview-grid img { width: 100%; border-radius: 4px; border: 1px solid var(--line); }

/* Misc */
.recordlist { margin-top: 14px; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0; }
.tabs button[aria-selected="true"] { background: var(--brand-soft); color: var(--brand); border-color: var(--brand); font-weight: 600; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.log { padding-left: 18px; color: var(--muted); font-size: 13.5px; }
.log li { padding: 3px 0; }
.authbox { max-width: 420px; margin: 24px auto; }
.authbox button { margin-top: 12px; }
.errorbox { color: var(--danger); font-size: 14px; margin-top: 8px; min-height: 18px; }

details { margin-top: 14px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-subtle); border: 1px solid var(--line); }
summary { cursor: pointer; color: var(--brand); font-weight: 600; font-size: 14px; }

dialog { border: 1px solid var(--line); border-radius: var(--radius-lg); color: var(--ink); max-width: min(620px, 95vw); width: 100%; padding: 20px 22px 24px; box-shadow: var(--shadow-md); }
dialog::backdrop { background: rgba(18, 34, 26, 0.45); }
.dialogbar { display: flex; justify-content: flex-end; }
.dialogbar button { border: 0; font-size: 22px; min-height: 32px; padding: 2px 8px; background: transparent; color: var(--muted); }
.dialogbar + div h2 { font-family: var(--serif); font-size: 20px; margin-bottom: 8px; }

#toast:not(:empty) {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: #163728;
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14.5px;
  box-shadow: var(--shadow-md);
  z-index: 40;
  max-width: 92vw;
  text-align: center;
}

.site-footer { border-top: 1px solid var(--line); padding: 16px 24px; color: var(--muted); font-size: 13.5px; }
.footer-inner { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.footer-links { display: flex; gap: 16px; }
.footer-links a:hover { color: var(--brand); }
.sr { position: absolute; clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; }
.compact { width: auto; max-width: 100%; }

/* Billing Paywall & Wallet UI (R27) */
.paywall-head { margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.paywall-meta { font-size: 13.5px; color: var(--ink-secondary); margin-top: 4px; }
.pay-options { display: grid; gap: 12px; margin-top: 12px; }
.pay-card {
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  background: var(--surface);
  display: grid;
  gap: 8px;
}
.pay-card.featured {
  border-color: var(--brand);
  background: linear-gradient(180deg, #f2faf5 0%, #ffffff 100%);
  box-shadow: 0 0 0 2px var(--brand-ring);
}
.pay-card-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.pay-card-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 16px; font-weight: 700; color: var(--ink); }
.pay-badge {
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: var(--brand);
  padding: 2px 9px;
  border-radius: 999px;
}
.pay-price { font-family: var(--serif); font-size: 22px; font-weight: 700; color: var(--brand); white-space: nowrap; }
.pay-orig { font-family: var(--sans); font-size: 13px; color: var(--muted); text-decoration: line-through; margin-left: 6px; font-weight: 400; }
.pay-desc { font-size: 13.5px; color: var(--ink-secondary); }
.pay-code-box {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  display: grid;
  gap: 10px;
}
.pay-code-row { display: flex; gap: 8px; align-items: center; }
.pay-code-row input { flex: 1; font-family: var(--mono); }
.pay-code-result { font-size: 13.5px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--line); }
.pay-code-result.ok { border-color: #b7d7c6; background: #f3faf6; }
.pay-code-result.warn { border-color: var(--amber-border); background: var(--amber-bg); color: var(--amber-ink); }
.pay-foot { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.pkg-mini-grid { display: grid; gap: 8px; margin-top: 10px; }
.pkg-mini { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--line); }

/* Issued Credential Card */
.cred-box {
  margin: 14px 0;
  padding: 16px;
  border-radius: var(--radius-md);
  background: #f3faf6;
  border: 1.5px solid #b7d7c6;
  display: grid;
  gap: 10px;
}
.cred-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; background: var(--surface); padding: 9px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line); }
.cred-val { font-family: var(--mono); font-size: 15px; font-weight: 700; color: var(--brand); letter-spacing: 0.04em; word-break: break-all; }
.cred-preview { width: 100%; border-radius: var(--radius-sm); border: 1px solid var(--line); margin-top: 6px; }
.pay-methods { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 4px; }
.pay-method-btn {
  flex: 1;
  min-width: 110px;
  min-height: 40px;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-weight: 600;
  color: var(--ink-secondary);
}
.pay-method-btn[aria-pressed="true"] {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand);
  box-shadow: 0 0 0 2px var(--brand-ring);
}
.qr-stage { display: grid; place-items: center; gap: 10px; padding: 14px; background: var(--surface); border-radius: var(--radius-md); border: 1px solid var(--line); margin: 10px 0; }
.qr-stage canvas { display: block; border-radius: 6px; border: 1px solid var(--line); }
.selftest-list { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 6px; font-size: 13.5px; }
.selftest-list li { padding: 7px 10px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface-subtle); }
.selftest-list li.ok { border-color: #b7d7c6; background: #f3faf6; color: var(--brand); }
.selftest-list li.bad { border-color: #e6bdb4; background: var(--danger-bg); color: var(--danger); }

/* Channel Funnel & Staff RBAC UI (R29) */
.funnel-bars { display: grid; gap: 8px; margin-top: 12px; }
.funnel-row { display: grid; grid-template-columns: 112px 1fr 120px; gap: 10px; align-items: center; font-size: 13.5px; }
.cliff-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.cliff-card { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-subtle); border: 1px solid var(--line); font-size: 13px; }
.cliff-card strong { display: block; font-size: 17px; color: var(--ink); margin-top: 2px; }
.perm-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.perm-item { display: flex; align-items: flex-start; gap: 7px; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--surface-subtle); border: 1px solid var(--line); font-size: 13.5px; cursor: pointer; }
.perm-item input { width: auto; margin-top: 3px; }
.table-wrap { overflow-x: auto; margin-top: 10px; }

/* Pricing Table & Wallet Pill */
.price-table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 14px; }
.price-table th, .price-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.price-table th { color: var(--muted); font-weight: 600; background: var(--surface-subtle); }
.wallet-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid #b7d7c6;
}

/* Admin Billing Editor */
.tier-row { display: grid; grid-template-columns: 76px 76px 96px 1fr 130px auto; gap: 8px; align-items: center; margin-top: 8px; }
.tier-row input, .tier-row select { padding: 7px 8px; font-size: 13.5px; }
.billing-section { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.billing-section:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.three { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.mono { font-family: var(--mono); }
.check-row { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 12px; }
.check-row label { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; }
.check-row input[type="checkbox"] { width: auto; margin: 0; }

/* Tablet */
@media (max-width: 920px) {
  .workspace { grid-template-columns: 1fr; }
  .kpi-grid, .sample-admin-grid, .three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tier-row { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 720px) {
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .task-meta-item { grid-template-columns: 1fr; gap: 3px; }
}

/* Mobile — Large, readable, thumb-friendly typography & flow preview */
@media (max-width: 640px) {
  body { font-size: 16px; }
  .site-nav { gap: 10px; padding: 0 14px; height: 58px; }
  .brand strong { font-size: 19px; }
  .logo { width: 30px; height: 30px; }
  .links a { padding: 7px 10px; font-size: 14px; }
  .btn-account { padding: 6px 13px; min-height: 36px; font-size: 14px; }
  main { padding: 16px 12px 48px; }
  .surface { padding: 16px; border-radius: var(--radius-md); }
  .step-title { font-size: 17px; }
  .mode-tabs button { min-height: 38px; padding: 6px 14px; font-size: 14.5px; }
  .drop strong { font-size: 16px; }
  .drop small { font-size: 13.5px; }
  .preset-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .preset-card { padding: 13px 12px; min-height: 78px; }
  .preset-title { font-size: 15.5px; }
  .preset-sub { font-size: 13px; }
  .tweaks-panel { flex-direction: column; align-items: stretch; gap: 10px; }
  .tweak-group { width: 100%; }
  .segmented { width: 100%; }
  .segmented button { flex: 1; min-height: 40px; font-size: 14px; padding: 6px 8px; }
  .toggle-pill { min-height: 40px; font-size: 14px; padding: 6px 14px; }
  .field textarea, .field input, .field select, select, .search { font-size: 16px; padding: 11px 12px; }
  .file-add { min-height: 42px; font-size: 14.5px; width: 100%; justify-content: center; }
  .submit { min-height: 50px; font-size: 16.5px; }
  .submit-note { font-size: 13.5px; }
  .steps { grid-template-columns: 1fr; gap: 6px; }
  .two, .kpi-grid, .sample-admin-grid, .admin-preview-grid { grid-template-columns: 1fr; }
  .reader-grid { display: block; }
  .thumbs { display: none; }
  /* Mobile natural page flow: eliminates nested scroll frustration */
  .sheet { height: auto; max-height: none; overflow-x: auto; overflow-y: visible; --preview-pad: 10px; }
  .reader-page:last-child { min-height: 0; }
  .pager { width: 100%; justify-content: space-between; }
  .pager button { min-height: 40px; font-size: 14px; }
  .sample-art { height: 175px; }
  .sample-art img { height: 190px; }
  .bar { align-items: flex-start; }
  .site-footer { padding: 16px 12px; font-size: 14px; }
}
