/* === css/style.css === */
/* miliya — editorial ledger / 账房
   Warm paper, ink text, one vermilion accent. Serif display, sans body,
   tabular mono numerals. No gradients, no generic card grids. */

:root {
  --paper: #f6f1e7;
  --paper-2: #efe8da;
  --surface: #fdfaf3;
  --surface-2: #f3ecdd;
  --ink: #221d16;
  --ink-2: #4a4236;
  /* --muted contrast (WCAG AA, verified by relative-luminance calculation):
     #6f6557 on --paper #f6f1e7 = 5.08:1, on --surface-2 #f3ecdd = 4.86:1,
     on --surface #fdfaf3 = 5.48:1 — all above 4.5:1 for body text.
     (Previous #7d7263 was 4.18:1 on paper and failed.)
     Dark theme #9a8d76 on #17140f = 5.64:1, on #211c15 = 5.19:1 — passes.
     --faint (#a79c8a, 2.4:1) is decorative only (status dots), never body text. */
  --muted: #6f6557;
  --faint: #a79c8a;
  --line: #ddd3bf;
  --line-strong: #c9bc9f;
  --accent: #b23a1e;
  --accent-deep: #8f2c15;
  --accent-soft: #f3ddd4;
  --accent-ink: #fdfaf3;
  --ok: #2e6b3a;
  --warn: #9a6a00;
  --bad: #a3261c;
  --shadow: 0 1px 2px rgba(34, 29, 22, .06), 0 8px 24px rgba(34, 29, 22, .06);
  --radius: 4px;
  --serif: "Songti SC", "Noto Serif SC", "STSong", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
}

html[data-theme="dark"] {
  --paper: #17140f;
  --paper-2: #1e1a13;
  --surface: #211c15;
  --surface-2: #2a241b;
  --ink: #ede4d3;
  --ink-2: #cfc4ae;
  --muted: #9a8d76;
  --faint: #6e6350;
  --line: #38301f;
  --line-strong: #4d4330;
  --accent: #e0684a;
  --accent-deep: #f0805f;
  --accent-soft: #3a241c;
  --accent-ink: #1a120c;
  --ok: #7cc48a;
  --warn: #d9a63f;
  --bad: #e0705f;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .3);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.65;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3 { font-weight: 600; line-height: 1.35; margin: 0 0 .5em; }
p { margin: 0 0 .75em; }
::selection { background: var(--accent-soft); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

.num, .ledger-table td.num-col, .ledger-table th.num-col { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 0; background: var(--ink); color: var(--paper); padding: 8px 14px; z-index: 200; }
.skip-link:focus { left: 8px; top: 8px; }

.kicker {
  font-size: 11px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--accent); font-weight: 700; margin: 0 0 10px;
}
.display, .display-sm {
  font-family: var(--serif); font-weight: 600; letter-spacing: .01em;
  font-size: clamp(34px, 5vw, 52px); line-height: 1.25; margin: 0 0 16px;
}
.display-sm { font-size: clamp(28px, 4vw, 38px); }
.lede { font-size: 16.5px; color: var(--ink-2); max-width: 56ch; }
.section-title {
  font-family: var(--serif); font-size: 20px; margin: 40px 0 14px;
  padding-bottom: 8px; border-bottom: 1px solid var(--line-strong);
}
.br-sm { display: none; }

/* ---------- topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1180px; margin: 0 auto; padding: 0 20px;
  height: 58px; display: flex; align-items: center; gap: 24px;
}
.logo { display: flex; align-items: baseline; gap: 8px; color: var(--ink); }
.logo:hover { text-decoration: none; }
.logo-mark {
  font-family: var(--serif); font-size: 19px; font-weight: 700;
  background: var(--accent); color: var(--accent-ink);
  width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 3px; line-height: 1; transform: translateY(3px);
}
.logo-word { font-family: var(--serif); font-size: 21px; font-weight: 700; letter-spacing: .02em; }
.logo-tag { font-size: 11px; letter-spacing: .18em; color: var(--muted); }
.topnav { display: flex; gap: 4px; margin-left: 8px; }
.topnav a {
  color: var(--ink-2); font-size: 14px; padding: 6px 10px; border-radius: var(--radius);
}
.topnav a:hover { text-decoration: none; color: var(--ink); background: var(--surface-2); }
.topnav a.active { color: var(--accent); font-weight: 700; box-shadow: inset 0 -2px 0 var(--accent); border-radius: 0; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.top-user { font-size: 13px; color: var(--muted); max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.balance-chip {
  display: flex; align-items: baseline; gap: 5px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 999px; padding: 5px 12px; font-size: 13px; color: var(--ink);
}
.balance-chip:hover { border-color: var(--line-strong); }
.balance-credits { font-weight: 700; font-size: 14px; }
.balance-unit { color: var(--muted); font-size: 12px; }
.balance-warn, .low-balance {
  color: var(--bad); font-size: 12px; font-weight: 700;
}
.balance-bar { height: 3px; background: var(--paper-2); }
.balance-bar-fill { height: 100%; background: var(--accent); width: 0; transition: width .5s ease; }
.balance-bar-fill.warn { background: var(--warn); }
.balance-bar-fill.danger { background: var(--bad); }

.icon-btn {
  background: none; border: 1px solid transparent; border-radius: var(--radius);
  width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-2); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--line); }

/* ---------- buttons / forms ---------- */
.btn {
  font-family: var(--sans); font-size: 14px; line-height: 1.4;
  border-radius: var(--radius); padding: 9px 18px; cursor: pointer;
  border: 1px solid transparent; transition: background .15s ease, border-color .15s ease, opacity .15s ease;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn-primary:hover:not(:disabled) { background: var(--accent-deep); }
.btn-outline { background: transparent; border-color: var(--line-strong); color: var(--ink); }
.btn-outline:hover:not(:disabled) { border-color: var(--ink-2); background: var(--surface); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--ink); }
.btn-danger { background: var(--bad); color: #fff; }
.btn-danger:hover:not(:disabled) { filter: brightness(1.08); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; }
.link-btn { background: none; border: none; color: var(--accent); cursor: pointer; padding: 0; font-size: inherit; }
.link-btn:hover { text-decoration: underline; }

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 12.5px; font-weight: 600; letter-spacing: .06em; color: var(--ink-2); margin-bottom: 5px; }
.field .opt { font-style: normal; font-weight: 400; color: var(--muted); }
.field.inline { display: flex; align-items: center; gap: 8px; margin-bottom: 0; }
.field.inline > span { margin-bottom: 0; white-space: nowrap; }
input[type="text"], input[type="email"], input[type="password"], input[type="search"],
input[type="number"], input[type="date"], input[type="datetime-local"], select, textarea {
  font-family: var(--sans); font-size: 14.5px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--radius); padding: 9px 11px; width: 100%;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input:disabled { background: var(--surface-2); color: var(--muted); }
select { width: auto; cursor: pointer; }
textarea { resize: vertical; }
.form-error {
  color: var(--bad); background: color-mix(in srgb, var(--bad) 8%, transparent);
  border-left: 3px solid var(--bad); padding: 8px 12px; font-size: 13.5px; margin: 0 0 14px;
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.row-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 12px 0; }
.section-actions { margin: 0 0 16px; }

/* ---------- layout ---------- */
.main { max-width: 1180px; margin: 0 auto; padding: 32px 20px 80px; }
.view-page { max-width: 980px; margin: 0 auto; }
.view-narrow { max-width: 720px; }
.page-head { margin-bottom: 28px; padding-bottom: 20px; border-bottom: 2px solid var(--ink); }
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px 22px; margin-bottom: 20px;
  box-shadow: var(--shadow);
}

/* ---------- auth ---------- */
.auth-layout { display: grid; grid-template-columns: 1.05fr .95fr; gap: 48px; align-items: start; padding-top: 24px; }
.auth-intro { padding-top: 24px; }
.auth-facts { margin: 32px 0 0; border-top: 1px solid var(--line-strong); }
.auth-facts div { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.auth-facts dt { color: var(--muted); font-size: 13px; }
.auth-facts dd { margin: 0; font-weight: 600; font-size: 14px; text-align: right; }
.auth-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px 28px; box-shadow: var(--shadow); }
.auth-card h2 { font-family: var(--serif); font-size: 22px; }
.auth-switch { text-align: center; margin: 16px 0 0; font-size: 14px; color: var(--muted); }
.status-strip { margin-top: 20px; padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); }
.status-overall { font-weight: 700; margin-bottom: 8px; }
.status-list { list-style: none; margin: 0; padding: 0; }
.status-list li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.status-list li:last-child { border-bottom: none; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 7px; vertical-align: middle; }
.status-dot.healthy { background: var(--ok); }
.status-dot.degraded { background: var(--warn); }
.status-dot.down { background: var(--bad); }
.status-dot.unknown { background: var(--faint); }

/* ---------- chat ---------- */
.view-chat { max-width: none; padding: 0; margin: -32px -20px -80px; }
.chat-shell { display: flex; height: calc(100vh - 61px); min-height: 480px; }
.chat-sidebar {
  width: 268px; flex-shrink: 0; border-right: 1px solid var(--line);
  background: var(--paper-2); display: flex; flex-direction: column; overflow: hidden;
}
.sidebar-head { padding: 16px 14px 10px; border-bottom: 1px solid var(--line); }
.conv-search { display: flex; align-items: center; gap: 8px; margin-top: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0 10px; }
.conv-search svg { color: var(--muted); flex-shrink: 0; }
.conv-search input { border: none; background: none; padding: 8px 0; box-shadow: none !important; }
.sidebar-label { font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); font-weight: 700; padding: 14px 16px 6px; margin: 0; }
.conv-list { list-style: none; margin: 0; padding: 0 8px 12px; overflow-y: auto; flex: 1; }
.conv-item { display: flex; align-items: center; gap: 4px; border-radius: var(--radius); }
.conv-item.active { background: var(--surface); box-shadow: inset 2px 0 0 var(--accent); }
.conv-item button.conv-open { flex: 1; min-width: 0; background: none; border: none; text-align: left; padding: 9px 10px; cursor: pointer; color: var(--ink); font-size: 14px; }
.conv-item button.conv-open:hover { color: var(--accent); }
.conv-title { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-meta { display: block; font-size: 11.5px; color: var(--muted); }
.conv-item .conv-actions { display: none; gap: 2px; padding-right: 4px; }
.conv-item:hover .conv-actions, .conv-item:focus-within .conv-actions { display: flex; }
.conv-actions button { background: none; border: none; color: var(--muted); cursor: pointer; padding: 4px 6px; font-size: 12px; border-radius: 3px; }
.conv-actions button:hover { color: var(--accent); background: var(--surface-2); }
.sidebar-empty, .sidebar-loading { padding: 12px 16px; }

.chat-main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--paper); }
.chat-toolbar {
  display: flex; align-items: center; gap: 16px; padding: 10px 20px;
  border-bottom: 1px solid var(--line); background: var(--surface);
  flex-wrap: wrap;
}
.chat-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chat-tools select { font-size: 13px; padding: 6px 8px; max-width: 150px; }
.agent-toggle[aria-pressed="true"] {
  background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 700;
}
.sidebar-toggle { display: none; }
.model-picker { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; min-width: 0; }
.model-picker select { font-weight: 600; border: none; background: transparent; padding: 6px 4px; font-size: 15px; }
.model-picker select:focus { box-shadow: none; }
.model-meta { margin: 0; font-size: 12.5px; color: var(--muted); }
.model-meta .num { color: var(--ink-2); }
.chat-balance { margin-left: auto; display: flex; align-items: baseline; gap: 6px; font-size: 14px; white-space: nowrap; }
.chat-balance .num { font-weight: 700; font-size: 16px; }
.low-balance { display: block; font-size: 12px; }

.chat-scroll { flex: 1; overflow-y: auto; padding: 28px 20px 16px; scroll-behavior: smooth; }
.chat-empty { max-width: 620px; margin: 6vh auto 0; text-align: left; }
.suggestions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.suggestions button {
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 999px;
  padding: 8px 16px; font-size: 13.5px; color: var(--ink-2); cursor: pointer;
}
.suggestions button:hover { border-color: var(--accent); color: var(--accent); }

.messages { list-style: none; margin: 0 auto; padding: 0; max-width: 780px; }
.msg { margin-bottom: 26px; animation: fadein .25s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.msg-role { font-size: 11px; letter-spacing: .18em; text-transform: uppercase; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.msg-user .msg-role { color: var(--accent); }
.msg-body {
  font-size: 15.5px; line-height: 1.75; white-space: pre-wrap; word-break: break-word;
}
.msg-user .msg-body {
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 16px; display: inline-block; max-width: 92%;
}
.msg-assistant .msg-body { font-family: var(--sans); }
.msg-body code { font-family: var(--mono); font-size: .88em; background: var(--surface-2); border: 1px solid var(--line); border-radius: 3px; padding: 1px 5px; }
.msg-body pre { background: var(--ink); color: var(--paper); border-radius: var(--radius); padding: 14px 16px; overflow-x: auto; margin: 10px 0; }
.msg-body pre code { background: none; border: none; padding: 0; color: inherit; }
.msg-body strong { font-weight: 700; }
.stream-caret { display: inline-block; width: 8px; height: 1.1em; background: var(--accent); vertical-align: text-bottom; margin-left: 2px; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.msg-error { color: var(--bad); border-left: 3px solid var(--bad); padding: 8px 12px; background: color-mix(in srgb, var(--bad) 7%, transparent); font-size: 14px; }

.cost-chip {
  display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0 10px;
  margin-top: 10px; font-family: var(--mono); font-size: 12px; color: var(--muted);
  border-top: 1px solid var(--line); padding-top: 8px; cursor: pointer; background: none; border-left: none; border-right: none; border-bottom: none; text-align: left;
}
.cost-chip:hover { color: var(--accent); }
.cost-chip .cost-amount { color: var(--ink); font-weight: 700; }
.cost-chip .sep { color: var(--line-strong); }
.msg-actions { margin-top: 8px; display: flex; gap: 8px; }
.msg-actions button { background: none; border: 1px solid var(--line); border-radius: var(--radius); color: var(--muted); font-size: 12.5px; padding: 4px 10px; cursor: pointer; }
.msg-actions button:hover { color: var(--accent); border-color: var(--accent); }

.composer-wrap { border-top: 1px solid var(--line); background: var(--surface); padding: 14px 20px 12px; }
.stream-actions { max-width: 780px; margin: 0 auto 8px; display: flex; justify-content: center; }
.composer { max-width: 780px; margin: 0 auto; display: flex; gap: 10px; align-items: flex-end; background: var(--paper); border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 6px 6px 6px 14px; }
.composer:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.composer textarea { border: none; background: none; padding: 8px 0; max-height: 160px; box-shadow: none !important; }
.send-btn { border-radius: var(--radius); width: 38px; height: 38px; padding: 0; flex-shrink: 0; }
.composer-hint { text-align: center; margin: 8px 0 0; }

/* ---------- plans ---------- */
.plan-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; margin-bottom: 8px; }
.plan-card { background: var(--surface); padding: 26px 24px; border-right: 1px solid var(--line); position: relative; display: flex; flex-direction: column; }
.plan-card:last-child { border-right: none; }
.plan-card.current { background: var(--accent-soft); }
.plan-card.current::before { content: "当前套餐"; position: absolute; top: 0; right: 0; background: var(--accent); color: var(--accent-ink); font-size: 11px; letter-spacing: .12em; padding: 4px 10px; border-radius: 0 0 0 4px; font-weight: 700; }
.plan-name { font-family: var(--serif); font-size: 22px; margin-bottom: 4px; }
.plan-price { font-family: var(--mono); font-size: 30px; font-weight: 700; margin: 6px 0 2px; }
.plan-price small { font-size: 13px; font-weight: 400; color: var(--muted); }
.plan-credits { font-size: 13px; color: var(--ink-2); margin-bottom: 12px; }
.plan-features { list-style: none; margin: 0 0 18px; padding: 12px 0 0; border-top: 1px solid var(--line); font-size: 13.5px; color: var(--ink-2); flex: 1; }
.plan-features li { padding: 4px 0 4px 16px; position: relative; }
.plan-features li::before { content: ""; position: absolute; left: 0; top: 12px; width: 7px; height: 1.5px; background: var(--accent); }
.plan-limits { font-size: 12px; color: var(--muted); margin-bottom: 16px; }
.plan-limits .num { color: var(--ink-2); }
.pack-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.pack-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; text-align: left; cursor: pointer; transition: border-color .15s ease; }
.pack-card:hover, .pack-card.selected { border-color: var(--accent); }
.pack-card.selected { box-shadow: 0 0 0 3px var(--accent-soft); }
.pack-credits { font-family: var(--mono); font-size: 22px; font-weight: 700; }
.pack-bonus { color: var(--ok); font-size: 12.5px; font-weight: 700; }
.pack-price { font-family: var(--mono); font-size: 15px; color: var(--ink-2); margin-top: 4px; }
.checkout { margin-top: 28px; }
.checkout-price { font-size: 26px; font-weight: 700; }
.provider-list { border: none; padding: 0; margin: 16px 0; }
.provider-list legend { font-size: 12.5px; font-weight: 600; letter-spacing: .06em; color: var(--ink-2); margin-bottom: 8px; }
.provider-opt { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 8px; cursor: pointer; background: var(--paper); }
.provider-opt:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.provider-opt input { width: auto; accent-color: var(--accent); }
.provider-opt .provider-note { margin-left: auto; font-size: 12px; color: var(--muted); }
.provider-opt.unavailable { opacity: .75; }
.provider-opt.unavailable .provider-note { color: var(--warn); font-weight: 600; }
.order-status { font-weight: 700; font-size: 13px; }
.order-status.pending { color: var(--warn); }
.order-status.paid { color: var(--ok); }
.order-status.cancelled { color: var(--muted); text-decoration: line-through; }
.demo-badge { display: inline-block; background: var(--accent); color: var(--accent-ink); font-size: 11px; letter-spacing: .14em; font-weight: 700; padding: 3px 9px; border-radius: 3px; margin-bottom: 10px; }

/* ---------- ledger / tables ---------- */
.summary-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; margin-bottom: 24px; background: var(--surface); }
.summary-cards.three { grid-template-columns: repeat(3, 1fr); }
.summary-card { padding: 18px 20px; border-right: 1px solid var(--line); }
.summary-card:last-child { border-right: none; }
.summary-card .big { font-size: 24px; font-weight: 700; margin: 2px 0 0; }
.summary-card .muted { margin: 2px 0 0; }
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-bottom: 18px; padding: 14px 16px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); }
.ledger-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.ledger-table th {
  text-align: left; font-size: 11px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted); font-weight: 700; padding: 11px 14px; border-bottom: 2px solid var(--line-strong);
  background: var(--surface-2); white-space: nowrap;
}
.ledger-table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.ledger-table tbody tr:last-child td { border-bottom: none; }
.ledger-table tbody tr:hover { background: color-mix(in srgb, var(--accent) 3%, transparent); }
.ledger-table .num-col { text-align: right; white-space: nowrap; }
.ledger-table tr.expandable { cursor: pointer; }
.ledger-table tr.detail-row td { background: var(--paper-2); border-bottom: 1px solid var(--line-strong); }
.cost-math { font-family: var(--mono); font-size: 12.5px; color: var(--ink-2); line-height: 1.9; }
.cost-math .formula-total { color: var(--ink); font-weight: 700; border-top: 1px solid var(--line-strong); margin-top: 6px; padding-top: 6px; display: inline-block; }
.status-pill { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; border: 1px solid; }
.status-pill.ok { color: var(--ok); border-color: var(--ok); }
.status-pill.failed { color: var(--bad); border-color: var(--bad); }
.status-pill.refunded { color: var(--warn); border-color: var(--warn); }
.pager { display: flex; align-items: center; gap: 14px; margin-top: 16px; justify-content: center; }

/* ---------- redeem / invite / settings ---------- */
.redeem-card h2, .demo-topup h2, .settings-card h2 { font-family: var(--serif); font-size: 19px; }
.invite-code { font-size: 30px; font-weight: 700; letter-spacing: .06em; margin: 4px 0 12px; }
.invite-url { word-break: break-all; margin-top: 10px; }
.rules-list { list-style: none; margin: 0; padding: 0; }
.rules-list li { padding: 10px 0 10px 18px; border-bottom: 1px solid var(--line); position: relative; font-size: 14.5px; }
.rules-list li::before { content: ""; position: absolute; left: 0; top: 19px; width: 8px; height: 1.5px; background: var(--accent); }
.settings-card { margin-bottom: 16px; }
.tier-line { font-size: 18px; margin-bottom: 4px; }
.tier-name { font-family: var(--serif); font-weight: 700; font-size: 22px; margin-right: 10px; }
.danger-zone { border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); }

/* ---------- admin ---------- */
.admin-tabs { display: flex; gap: 2px; border-bottom: 2px solid var(--ink); margin-bottom: 24px; overflow-x: auto; }
.admin-tabs button {
  background: none; border: none; padding: 10px 16px; font-size: 14.5px; cursor: pointer;
  color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -2px; white-space: nowrap;
}
.admin-tabs button:hover { color: var(--ink); }
.admin-tabs button[aria-selected="true"] { color: var(--accent); font-weight: 700; border-bottom-color: var(--accent); }
.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 8px; }
.chart-card h2 { font-family: var(--serif); font-size: 17px; margin-bottom: 14px; }
.bars { display: flex; flex-direction: column; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 130px 1fr 110px; gap: 10px; align-items: center; font-size: 13px; }
.bar-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { height: 10px; background: var(--paper-2); border-radius: 2px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); min-width: 2px; transition: width .4s ease; }
.bar-value { text-align: right; font-family: var(--mono); font-size: 12.5px; color: var(--muted); }
.health-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; }
.health-badge .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.health-badge.healthy { color: var(--ok); } .health-badge.healthy .dot { background: var(--ok); }
.health-badge.degraded { color: var(--warn); } .health-badge.degraded .dot { background: var(--warn); }
.health-badge.down { color: var(--bad); } .health-badge.down .dot { background: var(--bad); }
.health-badge.unknown { color: var(--muted); } .health-badge.unknown .dot { background: var(--faint); }
.action-links { display: flex; gap: 8px; flex-wrap: wrap; white-space: nowrap; }
.action-links button { background: none; border: none; color: var(--accent); cursor: pointer; padding: 2px 0; font-size: 13px; }
.action-links button:hover { text-decoration: underline; }
.action-links button.danger { color: var(--bad); }
.code-form { margin-bottom: 20px; }
#code-batch-list { font-family: var(--mono); font-size: 12.5px; width: 100%; }

/* ---------- toast / modal ---------- */
.toast-root { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  background: var(--ink); color: var(--paper); padding: 11px 18px; border-radius: var(--radius);
  font-size: 14px; box-shadow: var(--shadow); animation: fadein .2s ease; max-width: min(92vw, 520px); text-align: center;
}
.toast.error { background: var(--bad); color: #fff; }
.modal-root { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-root[hidden] { display: none; }
.modal-scrim { position: absolute; inset: 0; background: rgba(20, 16, 10, .55); }
.modal {
  position: relative; background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--radius); box-shadow: var(--shadow); max-width: 560px; width: 100%;
  max-height: 86vh; overflow-y: auto; padding: 26px 28px; animation: fadein .18s ease;
}
.modal h2 { font-family: var(--serif); font-size: 21px; }
.modal .modal-close { position: absolute; top: 12px; right: 14px; }
.ledger-detail dl { margin: 0; }
.ledger-detail .dl-row { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.ledger-detail .dl-row dt { color: var(--muted); }
.ledger-detail .dl-row dd { margin: 0; text-align: right; font-family: var(--mono); }
.drawer-scrim { position: fixed; inset: 0; background: rgba(20, 16, 10, .45); z-index: 60; }
.drawer-scrim[hidden] { display: none; }

/* ---------- bottom nav (mobile) ---------- */
.bottom-nav { display: none; }

/* ---------- skeleton ---------- */
.skeleton { color: transparent !important; background: linear-gradient(90deg, var(--surface-2) 25%, var(--paper-2) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 3px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .auth-layout { grid-template-columns: 1fr; gap: 28px; }
  .auth-intro { padding-top: 0; }
  .plan-grid, .pack-grid { grid-template-columns: 1fr; }
  .plan-card { border-right: none; border-bottom: 1px solid var(--line); }
  .plan-card:last-child { border-bottom: none; }
  .summary-cards, .summary-cards.three { grid-template-columns: 1fr 1fr; }
  .summary-card:nth-child(2n) { border-right: none; }
  .summary-card { border-bottom: 1px solid var(--line); }
  .chart-grid { grid-template-columns: 1fr; }
  .topnav { display: none; }
  .logo-tag { display: none; }
  .bottom-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
    background: var(--surface); border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    overflow-x: auto;
  }
  .bottom-nav a { flex: 1 0 auto; min-width: 52px; text-align: center; font-size: 12.5px; color: var(--muted); padding: 8px 6px; border-radius: var(--radius); white-space: nowrap; }
  .bottom-nav a.active { color: var(--accent); font-weight: 700; background: var(--accent-soft); }
  .main { padding-bottom: 110px; }
  .view-chat { margin-bottom: -110px; }
  .chat-shell { height: calc(100vh - 61px - 52px); }
  .chat-sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 70; width: min(300px, 84vw);
    transform: translateX(-105%); transition: transform .25s ease; box-shadow: var(--shadow);
  }
  .chat-sidebar.open { transform: none; }
  .sidebar-toggle { display: inline-flex; }
  .chat-balance .low-balance { display: none; }
  .br-sm { display: block; }
  .form-grid { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: 96px 1fr 86px; }
}
@media (max-width: 560px) {
  .topbar-inner { gap: 10px; padding: 0 12px; }
  .top-user { display: none; }
  .main { padding: 20px 14px 110px; }
  .summary-cards, .summary-cards.three { grid-template-columns: 1fr; }
  .summary-card { border-right: none; }
  .model-meta { display: none; }
  .msg-user .msg-body { max-width: 100%; }
}

/* ---------- ledger charts (inline SVG) ---------- */
.ledger-charts { margin-bottom: 8px; }
.ledger-charts .section-title { margin-top: 8px; }
.chart-card figure, figure.chart-card { margin: 0; }
.chart-card h3 { font-family: var(--serif); font-size: 17px; margin-bottom: 14px; }
.svg-chart svg { display: block; width: 100%; height: auto; }
.svg-chart .chart-bar { fill: var(--accent); }
.svg-chart .chart-bar:hover { fill: var(--accent-deep); }
.svg-chart text { font-family: var(--mono); font-size: 10px; fill: var(--muted); }

/* ---------- ledger source badges ---------- */
.source-badge {
  display: inline-block; font-size: 11.5px; font-weight: 700; line-height: 1.5;
  padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line-strong);
  color: var(--ink-2); white-space: nowrap;
}
.source-badge.source-agent { color: var(--accent); border-color: var(--accent); }
.source-badge.source-scheduled { color: var(--warn); border-color: var(--warn); }
.source-badge.source-tool { color: var(--ok); border-color: var(--ok); }

/* ---------- provider badges (plans checkout) ---------- */
.provider-badge {
  display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .06em;
  padding: 2px 7px; border-radius: 3px; background: var(--accent-soft); color: var(--accent);
  margin-left: 8px; white-space: nowrap;
}
.provider-note.unverified { color: var(--warn); font-weight: 600; }

/* ---------- attached files (chat composer) ---------- */
.attached-files {
  max-width: 780px; margin: 0 auto 10px; display: flex; flex-wrap: wrap; gap: 8px;
}
.attached-files[hidden] { display: none; }
.file-chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--surface-2); border: 1px solid var(--line-strong);
  border-radius: var(--radius); padding: 6px 8px 6px 11px; font-size: 13px;
}
.file-chip .file-name { font-weight: 600; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-chip .file-meta { color: var(--muted); font-size: 12px; font-family: var(--mono); }
.file-chip .file-remove {
  background: none; border: none; color: var(--muted); cursor: pointer;
  font-size: 15px; line-height: 1; padding: 2px 4px; border-radius: 3px;
}
.file-chip .file-remove:hover { color: var(--bad); background: var(--surface); }
.attach-btn { flex-shrink: 0; margin-bottom: 2px; }

/* ---------- agent tools-used block ---------- */
.tools-used {
  margin-top: 10px; border-top: 1px solid var(--line); padding-top: 10px; font-size: 13.5px;
}
.tools-used .tools-title {
  font-size: 11px; letter-spacing: .18em; text-transform: uppercase;
  font-weight: 700; color: var(--muted); margin: 0 0 6px;
}
.tools-used ul { list-style: none; margin: 0 0 6px; padding: 0; }
.tools-used li { padding: 2px 0 2px 14px; position: relative; }
.tools-used li::before { content: ""; position: absolute; left: 0; top: 12px; width: 7px; height: 1.5px; background: var(--accent); }
.tools-used .tools-meta { color: var(--muted); font-size: 12.5px; margin: 0; }
.agent-thinking { color: var(--muted); font-style: normal; }
.agent-thinking .stream-caret { margin-left: 6px; }

/* ---------- templates ---------- */
.template-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 8px; }
.template-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; display: flex; flex-direction: column;
}
.template-card h3 { font-family: var(--serif); font-size: 17px; margin-bottom: 2px; }
.template-card .template-preview {
  color: var(--ink-2); font-size: 13.5px; white-space: pre-wrap; word-break: break-word;
  margin: 8px 0 12px; flex: 1;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
.template-meta { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.builtin-badge {
  display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .08em;
  padding: 2px 7px; border-radius: 3px; background: var(--surface-2);
  border: 1px solid var(--line-strong); color: var(--ink-2);
}

/* ---------- scheduled tasks ---------- */
.schedule-kind { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin: 0 0 14px; background: var(--paper); }
.schedule-kind legend { font-size: 12.5px; font-weight: 600; letter-spacing: .06em; color: var(--ink-2); padding: 0 6px; }
.schedule-opt { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 14px; }
.schedule-opt input[type="radio"] { width: auto; accent-color: var(--accent); }
.schedule-opt input[type="time"], .schedule-opt input[type="number"] { width: auto; max-width: 110px; padding: 6px 8px; }
.task-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; margin-bottom: 16px; box-shadow: var(--shadow); }
.task-card.disabled { opacity: .72; }
.task-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.task-head h3 { font-family: var(--serif); font-size: 18px; margin: 0; }
.task-prompt { color: var(--ink-2); font-size: 13.5px; white-space: pre-wrap; word-break: break-word; margin: 10px 0; }
.task-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.task-meta .num { color: var(--ink-2); }
.runs-list { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.runs-list .run-row {
  display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: baseline;
  padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13.5px;
}
.runs-list .run-row:last-child { border-bottom: none; }
.run-error { color: var(--bad); font-size: 12.5px; }

/* ---------- models comparison ---------- */
.sort-btn {
  background: none; border: none; cursor: pointer; padding: 0;
  font: inherit; font-size: 11px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted); font-weight: 700; white-space: nowrap;
}
.sort-btn:hover { color: var(--accent); }
.sort-btn .sort-arrow { color: var(--accent); }

/* ---------- memory (settings) ---------- */
.memory-list { list-style: none; margin: 0 0 16px; padding: 0; }
.memory-item {
  display: flex; gap: 12px; align-items: flex-start; padding: 12px 0;
  border-bottom: 1px solid var(--line); font-size: 14px;
}
.memory-item:last-child { border-bottom: none; }
.memory-body { flex: 1; min-width: 0; }
.memory-key { font-weight: 700; }
.memory-key .memory-cat { font-weight: 400; color: var(--muted); font-size: 12.5px; margin-left: 8px; }
.memory-value { color: var(--ink-2); white-space: pre-wrap; word-break: break-word; margin: 2px 0; }
.memory-updated { color: var(--muted); font-size: 12px; margin: 0; }
.memory-item .action-links { flex-shrink: 0; }

/* ---------- command palette ---------- */
.palette-root { position: fixed; inset: 0; z-index: 250; display: flex; align-items: flex-start; justify-content: center; padding: 12vh 16px 20px; }
.palette-root[hidden] { display: none; }
.palette {
  position: relative; background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--radius); box-shadow: var(--shadow); width: 100%; max-width: 560px;
  overflow: hidden; animation: fadein .15s ease;
}
.palette input[type="text"] {
  border: none; border-bottom: 1px solid var(--line-strong); border-radius: 0;
  padding: 14px 18px; font-size: 16px; box-shadow: none !important; background: var(--surface);
}
.palette-list { list-style: none; margin: 0; padding: 6px 0; max-height: 46vh; overflow-y: auto; }
.palette-list li {
  padding: 10px 18px; cursor: pointer; display: flex; justify-content: space-between; gap: 12px;
  font-size: 14.5px;
}
.palette-list li .palette-hint { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.palette-list li.selected, .palette-list li:hover { background: var(--accent-soft); }
.palette-list li.help-item { cursor: default; }
.palette-list li.help-item:hover { background: none; }
.palette-footer {
  margin: 0; padding: 10px 18px; border-top: 1px solid var(--line);
  font-size: 12.5px; color: var(--muted); background: var(--surface-2);
}
.palette-empty { padding: 16px 18px; color: var(--muted); font-size: 14px; }

@media (max-width: 700px) {
  .template-grid { grid-template-columns: 1fr; }
  .chat-tools select { max-width: 118px; }
  .file-chip .file-name { max-width: 140px; }
}


/* === css/r3-landing.css === */
/* miliya — public landing page (Round 3, feature 1).
 * Only styles new to the landing page live here; everything else reuses
 * style.css (kicker, display, lede, card, btn, auth-layout, auth-facts,
 * status-strip, plan-grid, ledger-table, rules-list, demo-badge…).
 * All colours come from the style.css custom properties, so dark mode
 * (html[data-theme="dark"]) works with no extra rules. */

/* While the landing page is open, hide the auth-only navigation; the logo
 * and theme toggle stay visible. */
body.landing-open .topnav { display: none; }
body.landing-open .bottom-nav { display: none; }

/* Hero call-to-action row. */
.landing-cta { margin: 22px 0 0; }
.landing-cta .btn { min-width: 168px; }

/* "为什么是透明账本" card, below the live status strip. */
.landing-why { margin-top: 20px; }

/* FAQ: native <details>, hairline rules, vermilion +/- marker. */
.landing-faq details { border-bottom: 1px solid var(--line); }
.landing-faq details:first-child { border-top: 1px solid var(--line-strong); }
.landing-faq summary {
  cursor: pointer; list-style: none;
  font-family: var(--serif); font-size: 16.5px; font-weight: 600;
  padding: 14px 28px 14px 0; position: relative;
}
.landing-faq summary::-webkit-details-marker { display: none; }
.landing-faq summary::after {
  content: "+"; position: absolute; right: 2px; top: 13px;
  color: var(--accent); font-family: var(--mono); font-size: 17px; line-height: 1;
}
.landing-faq details[open] summary::after { content: "\2212"; }
.landing-faq summary:hover { color: var(--accent); }
.landing-faq p { color: var(--ink-2); margin: 0 0 16px; max-width: 68ch; }

/* Footer: hairline rule + trust statement. */
.landing-footer {
  margin-top: 48px; padding-top: 20px;
  border-top: 2px solid var(--ink); text-align: center;
}
.landing-footer-brand {
  font-family: var(--serif); font-weight: 700; font-size: 17px; margin-bottom: 4px;
}
.landing-footer p:last-child { margin-bottom: 0; }
.landing-footer a { margin: 0 4px; }

@media (max-width: 720px) {
  .landing-cta { flex-direction: column; align-items: stretch; }
  .landing-cta .btn { width: 100%; }
  .landing-faq summary { font-size: 15.5px; }
}


/* === css/r3-code.css === */
/* Round 3: agent multi-step timeline (rendered by web/js/r3-code.js).
 * Lives inside the existing .tools-used block, so it inherits the
 * block's border/background and the li dash marker from style.css.
 * Uses only the shared theme variables; works in light and dark mode.
 */

.agent-steps-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.agent-step-label {
  font-weight: 700;
  color: var(--ink);
  margin-right: 6px;
}

.agent-step-summary {
  color: var(--ink-2);
}

.agent-step-cost {
  color: var(--muted);
  margin-left: 6px;
  white-space: nowrap;
}

.agent-step-error {
  color: var(--bad);
  margin-left: 6px;
}

.agent-steps-capped {
  color: var(--warn);
}

.agent-step-ledger {
  margin-left: 6px;
}

.agent-step-stdout {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.5;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 10px;
  margin: 6px 0 2px;
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--ink-2);
}

.agent-step-stderr {
  color: var(--bad);
}


/* === css/r3-auth.css === */
/* miliya Round 3 — auth hardening (r3-auth.js). Keeps to the existing
 * design tokens (var(--surface), var(--line), var(--muted), --radius)
 * and reuses .card / .btn / .field / .auth-card from style.css. */

/* Reset view: single centred auth column (no intro column). */
.r3-auth-col {
  grid-column: 1 / -1;
  max-width: 460px;
  margin: 0 auto;
  width: 100%;
}

/* Small status pill used in the verification + sessions cards. */
.r3-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  vertical-align: middle;
}
.r3-badge-ok {
  color: #1a7f37;
  border-color: #b7dfc2;
  background: #f0f9f2;
}
.r3-badge-warn {
  color: #9a6700;
  border-color: #f0d9a8;
  background: #fdf6e3;
}

/* Sessions list. */
.r3-session-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.r3-session {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.r3-session-main {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 8px;
  min-width: 0;
}
.r3-session-device {
  font-weight: 600;
  overflow-wrap: anywhere;
}
.r3-session-meta {
  flex-basis: 100%;
}


/* === css/r3-conv.css === */
/* miliya Round 3 — conversation depth (fork / edit / folders).
   Companion to js/r3-conv.js. Uses the theme variables from css/style.css. */

/* --- per-message tools (class .msg-tools, NOT .msg-actions: app.js's
   updateRegenerateButton removes .msg-actions nodes) --- */
.msg-tools { margin-top: 8px; display: flex; gap: 8px; }
.msg-tools button {
  background: none; border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--muted); font-size: 12.5px; padding: 4px 10px; cursor: pointer;
}
.msg-tools button:hover { color: var(--accent); border-color: var(--accent); }

/* --- "已编辑" marker on the message role line --- */
.edited-label {
  font-weight: 400; letter-spacing: normal; text-transform: none;
  margin-left: 6px;
}

/* --- sidebar filter row (inserted after the search field) --- */
.conv-filter-row {
  display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap;
}
.conv-filter-row select {
  flex: 1 1 0; min-width: 0; font-size: 12.5px;
  padding: 6px 4px; background: var(--surface);
}
.conv-filter-row .btn { flex-shrink: 0; white-space: nowrap; }

/* --- folder manager modal --- */
.r3-modal-sub { font-size: 13px; margin: 18px 0 8px; color: var(--ink-2); }
.r3-folder-list { display: flex; flex-direction: column; gap: 8px; }
.r3-folder-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: var(--radius);
}
.r3-folder-row .r3-folder-name { flex: 1; min-width: 0; padding: 6px 8px; font-size: 14px; }
.r3-folder-row .muted { white-space: nowrap; }
.r3-color-dot {
  width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0;
  border: 1px solid var(--line-strong);
}
.r3-move-list {
  display: flex; flex-direction: column; gap: 6px;
  max-height: 260px; overflow-y: auto;
}
.r3-move-row { display: flex; align-items: center; gap: 10px; }
.r3-move-title {
  flex: 1; min-width: 0; font-size: 13.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.r3-move-row select { flex-shrink: 0; max-width: 46%; font-size: 13px; padding: 5px 4px; }


/* === css/r3-admin.css === */
/* miliya Round 3 — admin analytics depth (feature 5).
 * Styles for the extra cards rendered by web/js/r3-admin.js into
 * #admin-analytics. Reuses the design tokens from web/css/style.css
 * (--accent, --muted, --ok, --bad, --line) so both themes work. */

#r3-admin-depth .r3-full-card { margin-bottom: 16px; }
#r3-admin-depth .r3-grid { margin-top: 16px; }

/* Grouped daily chart: revenue = accent, cost = muted, margin marker green/red. */
#r3-admin-depth .r3-bar-rev { fill: var(--accent); }
#r3-admin-depth .r3-bar-cost { fill: var(--muted); }
#r3-admin-depth .r3-bar-margin-pos { fill: var(--ok); }
#r3-admin-depth .r3-bar-margin-neg { fill: var(--bad); }

#r3-admin-depth .r3-legend {
  display: flex; gap: 18px; margin: 8px 0 4px;
  font-size: 13px; color: var(--ink-2);
}
#r3-admin-depth .r3-legend span { display: inline-flex; align-items: center; gap: 6px; }
#r3-admin-depth .r3-swatch {
  display: inline-block; width: 10px; height: 10px; border-radius: 2px;
}
#r3-admin-depth .r3-sw-rev { background: var(--accent); }
#r3-admin-depth .r3-sw-cost { background: var(--muted); }
#r3-admin-depth .r3-sw-margin { background: var(--ok); }

/* Negative margin reads as a loss. */
#r3-admin-depth .r3-neg { color: var(--bad); }


/* === css/r4-dashboard.css === */
/* miliya Round 4 — personal usage dashboard + budget alerts (feature 1).
 * Styles for #view-dashboard, rendered by web/js/r4-dashboard.js.
 * Reuses the design tokens from web/css/style.css (--accent, --muted,
 * --warn, --bad, --line, --serif, --mono) so both themes work. */

/* Range selector: segmented buttons, accent = active. */
#view-dashboard .r4-range {
  display: inline-flex;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 20px;
  background: var(--surface);
}
#view-dashboard .r4-range button {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--ink-2);
  font: inherit;
  font-size: 13.5px;
  padding: 8px 18px;
  cursor: pointer;
}
#view-dashboard .r4-range button + button { border-left: 1px solid var(--line); }
#view-dashboard .r4-range button:hover { background: var(--surface-2); color: var(--ink); }
#view-dashboard .r4-range button.active {
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}
#view-dashboard .r4-range button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

#view-dashboard .r4-breakdowns { margin-top: 16px; }

/* Budget card. */
#view-dashboard .r4-budget-card { margin-top: 16px; }
#view-dashboard .r4-budget-card h2 {
  font-family: var(--serif);
  font-size: 17px;
  margin-bottom: 10px;
}
#view-dashboard .r4-budget-line { font-size: 15px; margin: 6px 0 10px; }

/* Threshold warning banner: amber at 50%/80%, red at 100%+. */
#view-dashboard .r4-banner {
  border: 1px solid var(--warn);
  border-left: 4px solid var(--warn);
  background: var(--surface-2);
  color: var(--ink);
  padding: 10px 14px;
  margin: 0 0 12px;
  font-size: 14px;
}
#view-dashboard .r4-banner.danger {
  border-color: var(--bad);
  border-left-color: var(--bad);
}

/* Budget progress bar: accent fill, amber at >=80%, red at >=100%. */
#view-dashboard .r4-progress {
  height: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 16px;
}
#view-dashboard .r4-progress-fill {
  height: 100%;
  background: var(--accent);
  transition: width .3s ease;
}
#view-dashboard .r4-progress-fill.warn { background: var(--warn); }
#view-dashboard .r4-progress-fill.danger { background: var(--bad); }

/* Budget form: label + input + buttons on one row (wraps on mobile). */
#view-dashboard .r4-budget-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 4px 0 10px;
}
#view-dashboard .r4-budget-form label { font-size: 14px; color: var(--ink-2); }
#view-dashboard .r4-budget-form input {
  width: 150px;
  font: inherit;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  padding: 7px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
}
#view-dashboard .r4-budget-form input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 0;
  border-color: var(--accent);
}

@media (max-width: 640px) {
  #view-dashboard .r4-range button { padding: 8px 14px; }
  #view-dashboard .r4-budget-form input { width: 120px; }
}


/* === css/r4-account.css === */
/* miliya Round 4 — data export + account deletion (r4-account.js)
 * and the referral funnel stat cards injected by enterInvite().
 * Keeps to the existing design tokens (var(--surface), var(--line),
 * var(--line-strong), var(--muted), var(--accent), var(--bad), --radius)
 * and reuses .card / .btn / .field / .summary-card from style.css.
 * No CDN, no external URLs.
 */

/* Invite: five stat cards instead of three (created by enterInvite). */
.summary-cards.r4-five {
  grid-template-columns: repeat(5, 1fr);
}
@media (max-width: 900px) {
  .summary-cards.r4-five {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 560px) {
  .summary-cards.r4-five {
    grid-template-columns: 1fr;
  }
}

/* Settings "数据与账号" card. */
#r4-account-card .r4-subhead {
  font-size: 15px;
  margin: 20px 0 6px;
}
#r4-account-card .r4-subhead:first-of-type {
  margin-top: 12px;
}
#r4-account-card .r4-danger-head {
  color: var(--bad);
  margin-top: 0;
}
.r4-danger-block {
  margin-top: 20px;
  padding: 14px 16px 4px;
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--bad);
  border-radius: var(--radius);
  background: var(--surface-2);
}


/* === css/r4-status.css === */
/* miliya — public status page (Round 4, feature 4).
 * Only styles new to the status page live here; everything else reuses
 * style.css (kicker, display-sm, lede, section-title, card, btn, field,
 * form-error, row-actions, status-dot, num, muted…).
 * All colours come from the style.css custom properties, so dark mode
 * (html[data-theme="dark"]) works with no extra rules. */

/* Overall banner: surface card with a status-coloured left rule. */
.r4-banner {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--faint);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
.r4-banner-healthy { border-left-color: var(--ok); }
.r4-banner-degraded { border-left-color: var(--warn); }
.r4-banner-down { border-left-color: var(--bad); }
.r4-banner-title {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 6px;
}
.r4-banner-note { color: var(--ink-2); margin: 0; }
.r4-banner-note .num { font-weight: 600; }

/* Channel cards: two-column grid, single column on narrow screens. */
.r4-channel-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
.r4-channel-card { margin: 0; }
.r4-channel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.r4-channel-head h3 {
  font-family: var(--serif);
  font-size: 18px;
  margin: 0;
}
.r4-health-pill {
  flex: 0 0 auto;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
}
.r4-health-healthy { color: var(--ok); }
.r4-health-degraded { color: var(--warn); }
.r4-health-down { color: var(--bad); }
.r4-channel-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
  margin: 0 0 12px;
}
.r4-channel-facts div { margin: 0; }
.r4-channel-facts dt {
  font-size: 11.5px;
  letter-spacing: .08em;
  color: var(--muted);
  margin-bottom: 2px;
}
.r4-channel-facts dd { margin: 0; font-size: 15px; }
.r4-channel-facts dd .num { font-size: 15px; }
.r4-uptime-none { color: var(--muted); font-size: 13.5px; }
.r4-channel-models { margin: 0; }

/* Admin incident form card. */
.r4-admin-card { margin-top: 28px; }
.r4-admin-card h2 { font-family: var(--serif); font-size: 19px; }

/* Incidents: open ones get a vermilion left rule so they stand out. */
.r4-incident { margin: 0 0 14px; }
.r4-incident.r4-incident-open { border-left: 4px solid var(--accent); }
.r4-incident-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.r4-incident-head h3 {
  font-family: var(--serif);
  font-size: 17px;
  margin: 0;
}
.r4-incident-badge {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  color: var(--ink-2);
}
.r4-incident-badge.r4-incident-open { /* open */
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-deep);
}
.r4-incident-badge.r4-incident-investigating {
  background: var(--surface-2);
  border-color: var(--warn);
  color: var(--warn);
}
.r4-incident-badge.r4-incident-resolved {
  background: var(--surface-2);
  color: var(--ok);
  border-color: var(--ok);
}
.r4-incident-message { color: var(--ink-2); white-space: pre-wrap; }
.r4-incident-actions { margin: 10px 0 0; }

@media (max-width: 720px) {
  .r4-channel-grid { grid-template-columns: 1fr; }
  .r4-channel-facts { grid-template-columns: 1fr 1fr; }
}


/* === css/r4-abuse.css === */
/* miliya Round 4 — abuse prevention (feature 7).
 * Styles for the admin abuse queue tab (injected by web/js/r4-abuse.js),
 * the tool-injection warning banner in chat, and the "blocked" step in the
 * r3-code.js steps timeline. Reuses the design tokens from
 * web/css/style.css (--accent, --muted, --bad, --warn, --line, --serif,
 * --mono) so both themes work. */

/* --- admin abuse queue --- */

.r4-abuse-actions { justify-content: space-between; }

.r4-abuse-filter { display: inline-flex; gap: 6px; }

.r4-abuse-filter-btn[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.r4-abuse-note { margin: -6px 0 4px; }

.r4-abuse-detail {
  max-width: 420px;
  word-break: break-word;
  color: var(--ink-2);
}

.r4-abuse-ops { white-space: nowrap; text-align: right; }

/* --- tool-injection warning banner (chat, next to the steps timeline) --- */

.agent-warnings {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid var(--warn);
  border-left: 3px solid var(--warn);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.agent-warnings p { margin: 0; font-size: 13.5px; color: var(--ink-2); }
.agent-warnings p + p { margin-top: 6px; }
.agent-warnings strong { color: var(--warn); }

/* --- blocked step in the agent steps timeline (rendered by r3-code.js) --- */

.agent-step-blocked .agent-step-label { color: var(--bad); }
.agent-step-blocked .agent-step-summary { color: var(--bad); }


/* === css/r5-teams.css === */
/* miliya Round 5 — team workspaces (Worker A).
 * Styles for #view-teams, rendered by web/js/r5-teams.js, plus the chat
 * composer team selector injected by app.js (#team-select).
 * Reuses the design tokens from web/css/style.css (--accent, --muted,
 * --warn, --bad, --line, --serif, --mono) so both themes work. */

/* Team cards in the list: full-width click targets. */
#view-teams .r5-team-card { cursor: pointer; margin-bottom: 12px; }
#view-teams .r5-team-card:hover { border-color: var(--accent); }
#view-teams .r5-team-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
#view-teams .r5-team-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
#view-teams .r5-team-head h2 {
  font-family: var(--serif);
  font-size: 18px;
  margin: 0;
}
#view-teams .r5-team-meta { margin: 8px 0 0; color: var(--ink-2); }

/* Role badge next to a team name or in the detail header. */
#view-teams .r5-role-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 2px 10px;
  white-space: nowrap;
}

/* Create / redeem / fund / invite forms: label + input + button on one
 * row (wraps on mobile). */
#view-teams .r5-form-card { margin-bottom: 16px; }
#view-teams .r5-form-card h2 {
  font-family: var(--serif);
  font-size: 17px;
  margin-bottom: 10px;
}
#view-teams .r5-form-card h3 {
  font-family: var(--serif);
  font-size: 15px;
  margin: 18px 0 8px;
}
#view-teams .r5-inline-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
}
#view-teams .r5-inline-form .field { margin: 0; flex: 1 1 220px; }
#view-teams .r5-inline-form .field input,
#view-teams .r5-inline-form .field select { width: 100%; }

/* Detail header. */
#view-teams .r5-detail-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 4px 0 16px;
}
#view-teams .r5-detail-head h2 {
  font-family: var(--serif);
  font-size: 22px;
  margin: 0;
}

/* Member table actions: role select + limit input + buttons. */
#view-teams .r5-member-actions { white-space: nowrap; }
#view-teams .r5-member-actions select,
#view-teams .r5-member-actions input[type="number"] {
  font-size: 13px;
  padding: 5px 6px;
  margin-right: 6px;
  vertical-align: middle;
}
#view-teams .r5-member-actions input[type="number"] { width: 96px; }
#view-teams .r5-member-actions .btn { margin-right: 4px; }

/* Pending invites. */
#view-teams .r5-invite-list { list-style: none; padding: 0; margin: 0; }
#view-teams .r5-invite-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
#view-teams .r5-invite-list li:last-child { border-bottom: none; }
#view-teams .r5-invite-code { font-weight: 700; letter-spacing: 0.04em; }

/* Team ledger totals line. */
#view-teams .r5-ledger-totals { font-size: 15px; margin: 4px 0 14px; }
#view-teams .r5-ledger-totals .num { font-weight: 700; }

/* Chat composer team selector (injected into .chat-tools by app.js).
 * Inherits the toolbar select sizing from style.css; the wider cap
 * keeps team names readable. */
.chat-tools #team-select { max-width: 190px; }

@media (max-width: 640px) {
  #view-teams .r5-member-actions { white-space: normal; }
  #view-teams .r5-member-actions input[type="number"] { width: 80px; }
  .chat-tools #team-select { max-width: 130px; }
}


/* === css/r5-compare.css === */
/* miliya Round 5 — multi-model comparison chat (Worker C).
 * Styles for #view-compare, rendered by web/js/r5-compare.js.
 * Reuses the design tokens from web/css/style.css (--accent, --muted,
 * --ok, --bad, --line, --serif, --mono) so both themes work, and the
 * editorial identity: warm paper, ink text, vermilion accent, serif
 * headings, monospace numbers. */

#view-compare .r5-ephemeral {
  margin: -6px 0 18px;
}

/* Model picker: checkbox rows with name, tier badge, price and note. */
#view-compare .r5-picker {
  margin-bottom: 16px;
}
#view-compare .r5-picker legend {
  font-family: var(--serif);
  font-size: 17px;
  padding: 0 6px;
}
#view-compare .r5-model-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}
#view-compare .r5-model {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  cursor: pointer;
  background: var(--surface);
}
#view-compare .r5-model:hover { border-color: var(--line-strong); }
#view-compare .r5-model:has(input:checked) {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}
#view-compare .r5-model:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
#view-compare .r5-model.disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
#view-compare .r5-model input {
  accent-color: var(--accent);
  margin: 0;
}
#view-compare .r5-model-name {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 700;
}
#view-compare .r5-tier {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 3px;
  padding: 1px 5px;
}
#view-compare .r5-model-price {
  font-size: 13px;
  color: var(--ink-2);
}
#view-compare .r5-model-note { color: var(--warn); }
#view-compare .r5-model-desc {
  flex-basis: 100%;
  font-size: 12.5px;
}
#view-compare .r5-count { margin: 12px 0 0; }

/* Prompt composer. */
#view-compare .r5-composer { margin-bottom: 16px; }
#view-compare .r5-composer textarea {
  width: 100%;
  resize: vertical;
}
#view-compare .r5-error { margin: 0 0 16px; }

/* Side-by-side columns: one per model, equal width, stacked on mobile. */
#view-compare .r5-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  align-items: start;
  margin-bottom: 16px;
}
#view-compare .r5-columns:empty { display: none; }
#view-compare .r5-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
#view-compare .r5-col-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
  margin-bottom: 12px;
}
#view-compare .r5-col-head h2 {
  font-family: var(--serif);
  font-size: 17px;
  margin: 0;
  overflow-wrap: anywhere;
}
#view-compare .r5-status {
  flex-shrink: 0;
  font-size: 12.5px;
  color: var(--muted);
}
#view-compare .r5-status.waiting { color: var(--muted); }
#view-compare .r5-status.streaming { color: var(--accent); }
#view-compare .r5-status.done { color: var(--ok); }
#view-compare .r5-status.failed { color: var(--bad); }
#view-compare .r5-col-body {
  font-size: 15px;
  line-height: 1.7;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  min-height: 3em;
}
#view-compare .r5-col-foot {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
#view-compare .r5-col-foot:empty { display: none; }
#view-compare .r5-col-foot .cost-chip {
  /* Reuses the chat cost-chip style; allow wrapping in narrow columns. */
  white-space: normal;
  text-align: left;
  line-height: 1.6;
}

/* Summary bar: per-model totals table. */
#view-compare .r5-summary { margin-bottom: 16px; }
#view-compare .r5-summary .r5-total td {
  font-weight: 700;
  border-top: 2px solid var(--line-strong);
}

@media (max-width: 640px) {
  #view-compare .r5-columns { grid-template-columns: 1fr; }
  #view-compare .r5-model-list { grid-template-columns: 1fr; }
}


/* === css/r5-announce.css === */
/* miliya — in-app announcements (Round 5, Worker E).
 * Only styles new to the bell, the dropdown panel and the admin
 * announcement tab live here; everything else reuses style.css
 * (icon-btn, card, btn, field, form-error, section-title, muted…).
 * All colours come from the style.css custom properties, so dark mode
 * (html[data-theme="dark"]) works with no extra rules. */

/* Bell wrapper: anchors the dropdown panel to the topbar. */
.r5-announce-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.r5-announce-bell {
  position: relative;
}

/* Unread badge: vermilion dot-count on the bell's upper right. */
.r5-announce-badge {
  position: absolute;
  top: 1px;
  right: 0;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 11px;
  font-weight: 700;
  line-height: 17px;
  text-align: center;
  font-family: var(--mono);
}

/* Dropdown panel: paper card hanging under the bell. */
.r5-announce-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: -6px;
  width: 380px;
  max-width: calc(100vw - 24px);
  max-height: min(70vh, 520px);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 80;
}
.r5-announce-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--line);
}
.r5-announce-head h2 {
  font-family: var(--serif);
  font-size: 18px;
  margin: 0;
}
.r5-announce-close {
  width: 28px;
  height: 28px;
  font-size: 20px;
  line-height: 1;
}
.r5-announce-list {
  padding: 6px 0;
}
.r5-announce-empty {
  padding: 18px 16px;
  margin: 0;
}

/* One announcement: unread rows carry the vermilion dot + soft tint. */
.r5-announce-item {
  border-bottom: 1px solid var(--line);
}
.r5-announce-item:last-child {
  border-bottom: none;
}
.r5-announce-item.r5-announce-unread {
  background: var(--accent-soft);
}
.r5-announce-item-btn {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  padding: 12px 16px;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
}
.r5-announce-item-btn:hover {
  background: var(--surface-2);
}
.r5-announce-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--faint);
}
.r5-announce-unread .r5-announce-dot {
  background: var(--accent);
}
.r5-announce-item-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.r5-announce-title {
  font-weight: 600;
  line-height: 1.45;
}
.r5-announce-unread .r5-announce-title {
  font-weight: 700;
}
.r5-announce-date {
  font-size: 12.5px;
}
.r5-announce-body {
  margin: 0;
  padding: 0 16px 14px 34px;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Admin tab: compact rows under the create form. */
.r5-admin-card {
  margin-bottom: 8px;
}
.r5-admin-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 2px;
  border-bottom: 1px solid var(--line);
}
.r5-admin-row:last-child {
  border-bottom: none;
}
.r5-admin-row-main {
  min-width: 0;
}
.r5-admin-row-title {
  font-weight: 600;
  margin: 0 0 4px;
}
.r5-admin-row-main .muted {
  margin: 0 0 4px;
}
.r5-admin-row-body {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.r5-target-pill {
  display: inline-block;
  padding: 1px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 12px;
  color: var(--ink-2);
  background: var(--surface-2);
}

@media (max-width: 560px) {
  .r5-announce-panel {
    /* On narrow screens the panel spans nearly the full width, anchored
     * to the bar's edges (the topbar's backdrop-filter makes it the
     * containing block for fixed descendants; the bar spans the full
     * viewport width, so left/right 12px lands at the viewport edge). */
    position: fixed;
    top: 62px;
    right: 12px;
    left: 12px;
    width: auto;
  }
  .r5-admin-row {
    flex-direction: column;
    gap: 8px;
  }
}


/* === css/r5-tour.css === */
/* miliya — first-run guided tour (Round 5, Worker E).
 * Only styles new to the tour live here; buttons reuse style.css
 * (btn, btn-primary, btn-ghost, num). All colours come from the
 * style.css custom properties, so dark mode
 * (html[data-theme="dark"]) works with no extra rules. */

/* Highlight ring: a fixed box over the target whose oversized
 * box-shadow dims the rest of the page (the classic cutout trick —
 * no separate scrim element needed). pointer-events: none so the
 * page underneath stays clickable. */
.r5-tour-ring {
  position: fixed;
  z-index: 1000;
  pointer-events: none;
  border: 2px solid var(--accent);
  border-radius: 8px;
  box-shadow: 0 0 0 9999px rgba(20, 16, 10, 0.45);
}

/* Tooltip card: paper surface, serif title, vermilion step marker. */
.r5-tour-tip {
  position: fixed;
  z-index: 1001;
  width: 320px;
  max-width: calc(100vw - 24px);
  padding: 16px 18px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.r5-tour-close {
  position: absolute;
  top: 6px;
  right: 8px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  padding: 4px 6px;
}
.r5-tour-close:hover {
  color: var(--ink);
}
.r5-tour-step {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
}
.r5-tour-title {
  font-family: var(--serif);
  font-size: 19px;
  margin: 0 0 6px;
  padding-right: 20px;
}
.r5-tour-body {
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.65;
  margin: 0 0 14px;
}
.r5-tour-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

@media (max-width: 560px) {
  /* On narrow screens the tooltip takes nearly the full width so its
   * text stays readable; the JS still places it below the target
   * when there is room, above it when the target sits at the bottom
   * of the screen (bottom nav). */
  .r5-tour-tip {
    width: calc(100vw - 24px);
  }
}


/* === css/r6-voice.css === */
/* miliya — voice input + read-aloud in chat (Round 6, Worker C).
 * Only styles new to voice live here; the mic button reuses .icon-btn
 * from style.css and the settings card reuses .card/.settings-card.
 * All colours come from the style.css custom properties, so dark mode
 * (html[data-theme="dark"]) works with no extra rules. */

/* Mic button in the composer. While listening it turns vermilion and
 * pulses (a soft ring that breathes out from the button). */
.r6-voice-mic.listening {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
  animation: r6-voice-pulse 1.4s ease-in-out infinite;
}
@keyframes r6-voice-pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 35%, transparent); }
  50% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--accent) 0%, transparent); }
}

/* Listening status line above the composer, with a blinking dot. */
.r6-voice-status {
  max-width: 780px;
  margin: 0 auto 8px;
  text-align: center;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.r6-voice-status::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  margin-right: 7px;
  vertical-align: 1px;
  animation: r6-voice-blink 1.2s ease-in-out infinite;
}
@keyframes r6-voice-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

@media (prefers-reduced-motion: reduce) {
  .r6-voice-mic.listening,
  .r6-voice-status::before {
    animation: none;
  }
}

/* Per-message read-aloud row (own class, not .msg-actions: app.js
 * rebuilds .msg-actions when the regenerate button moves). */
.r6-voice-actions {
  margin-top: 8px;
  display: flex;
  gap: 8px;
}
.r6-voice-speak {
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  width: 30px;
  height: 28px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.r6-voice-speak:hover {
  color: var(--accent);
  border-color: var(--accent);
}
.r6-voice-speak.speaking {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* Voice off: hide the mic, the listening line and every speaker
 * button. The Settings toggle itself is unaffected (it lives in the
 * settings card, outside these selectors). */
body.r6-voice-off .r6-voice-mic,
body.r6-voice-off .r6-voice-status,
body.r6-voice-off .r6-voice-actions {
  display: none !important;
}

/* Settings toggle row. */
.r6-voice-toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin: 10px 0 0;
}
.r6-voice-toggle-row input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: var(--accent);
  cursor: pointer;
}


/* === css/r6-tasks.css === */
/* miliya Round 6 — task run history with cost + task templates (Worker G).
 * Styles for web/js/r6-tasks.js. Uses the theme variables from style.css,
 * so light/dark both work. */

/* --- template picker inside the task creation form --- */
.r6-template-picker {
  margin: 16px 0 4px;
  padding: 14px 16px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.r6-template-picker h3 { margin: 0 0 4px; font-size: 15px; }
.r6-template-picker > p { margin: 0 0 12px; }
.r6-template-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}
.r6-template-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.r6-template-card h4 { margin: 0 0 6px; font-size: 14.5px; }
.r6-template-card p { margin: 0 0 8px; }
.r6-template-meta { font-size: 12.5px; }

/* --- enriched run history rows (inside .runs-list) --- */
.r6-runs-title { margin: 0 0 8px; font-size: 14px; }
.r6-runs-rows .run-row { flex-wrap: wrap; }
.r6-run-cost { color: var(--ink-2); font-size: 13px; white-space: nowrap; }
.r6-runs-more { margin-top: 10px; }


/* === css/r6-share.css === */
/* miliya — conversation sharing (Round 6, Worker D).
 * Only styles new to the shared view and the share modal live here;
 * everything else reuses style.css (kicker, display-sm, lede, messages,
 * msg, msg-role, msg-body, btn, field, form-error, row-actions, num,
 * muted…). Message rows reuse the chat's .msg classes so a shared
 * conversation looks like the conversation itself. All colours come
 * from the style.css custom properties, so dark mode
 * (html[data-theme="dark"]) works with no extra rules. */

/* Shared view: the message list reads as one continuous transcript;
 * the per-message timestamp sits quietly under each message. */
.r6-shared-messages { margin-top: 8px; }
.r6-shared-messages .msg { margin-bottom: 22px; }
.r6-msg-time { margin: 6px 0 0; font-size: 12.5px; }

/* Footer call-to-action: a small link, not a login wall. */
.r6-shared-cta {
  margin: 32px 0 0;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 15px;
}
.r6-shared-cta a { font-weight: 600; }

/* Share modal: the expiry picker is a row of radio options. */
.r6-expiry {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 14px 12px;
  margin: 0 0 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
}
.r6-expiry legend {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--ink-2);
  padding: 0 6px;
}
.r6-expiry label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14.5px;
  cursor: pointer;
}
.r6-expiry input { accent-color: var(--accent); }

/* The share link input is readonly — keep it visually quiet. */
#r6-share-url { cursor: text; }


/* === css/r6-promo.css === */
/* Round 6: promo codes (Worker F) — promo input row on the plans checkout. */
.promo-row { display: flex; align-items: flex-end; gap: 10px; margin: 12px 0 4px; }
.promo-row[hidden] { display: none; }
.promo-field { flex: 1; margin-bottom: 0; }
.promo-field input { text-transform: uppercase; }
#promo-preview { margin: 6px 0 0; }
#promo-preview.promo-error { color: var(--warn); }


/* === css/r6-routing.css === */
/* miliya — user routing preference (Round 6, Worker E).
 * Only styles new to the routing card live here; layout, fields and
 * buttons reuse style.css (.card, .field, .btn, .muted, .row-actions,
 * .form-error). All colours come from the style.css custom properties,
 * so dark mode (html[data-theme="dark"]) works with no extra rules. */

/* The per-mode hint sits directly under the mode select: pull it a
 * little closer to its select than a plain paragraph would sit. */
.r6-routing-card #r6-route-hint {
  margin-top: -8px;
}


/* === css/r7-admin.css === */
/* miliya — admin bulk operations + model deprecation (Round 7, Worker B).
 * Only styles new to the bulk/model admin tabs, the chat deprecation
 * notice and the settings notice card live here; everything else reuses
 * style.css (card, btn, field, form-error, ledger-table, status-pill…).
 * All colours come from the style.css custom properties, so dark mode
 * (html[data-theme="dark"]) works with no extra rules. */

/* Bulk cards: a little more air between the three operations. */
.r7-bulk-card h2 {
  font-family: var(--serif);
  font-size: 19px;
}

/* Counts line above a preview / result table. */
.r7-counts {
  margin: 16px 0 10px;
  font-size: 14px;
}

/* Per-item result pills: same shape as .status-pill, Round 7 names. */
.r7-pill {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid;
  white-space: nowrap;
}
.r7-pill-ok { color: var(--ok); border-color: var(--ok); }
.r7-pill-skip { color: var(--warn); border-color: var(--warn); }
.r7-pill-fail { color: var(--bad); border-color: var(--bad); }

/* Long result tables scroll instead of stretching the page. */
.r7-results-table {
  margin: 0;
}
#admin-bulk .table-wrap {
  max-height: 420px;
  overflow-y: auto;
}

/* Model rows in the deprecation tab (same layout as r5-admin-row). */
.r7-model-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 2px;
  border-bottom: 1px solid var(--line);
}
.r7-model-row:last-child {
  border-bottom: none;
}
.r7-model-row-main {
  min-width: 0;
}
.r7-model-row-title {
  font-weight: 600;
  margin: 0 0 4px;
}
.r7-model-row-main .muted {
  margin: 0 0 4px;
}
.r7-model-row-actions {
  flex-shrink: 0;
}

/* Chat deprecation notice: a vermilion-edged strip above the messages. */
.r7-dep-notice {
  margin: 0 16px 12px;
  padding: 12px 16px;
  background: var(--accent-soft);
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
}
.r7-dep-notice-text {
  margin: 0 0 10px;
  font-size: 14px;
  line-height: 1.6;
}
.r7-dep-notice-admin {
  display: block;
  margin-top: 6px;
  color: var(--ink-2);
}
.r7-dep-notice-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Settings notice card: one row per affected conversation. */
.r7-models-settings-card h2 {
  font-family: var(--serif);
  font-size: 19px;
}
.r7-settings-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
}
.r7-settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.r7-settings-row:last-child {
  border-bottom: none;
}
.r7-settings-row-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.r7-settings-row-title {
  font-weight: 600;
}

@media (max-width: 640px) {
  .r7-model-row {
    flex-direction: column;
    gap: 8px;
  }
  .r7-settings-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
}


/* === css/r7-search.css === */
/* miliya Round 7 — search caching + history (Worker C).
 * Styles for #view-searches, rendered by web/js/r7-search.js.
 * Reuses the design tokens from web/css/style.css (--accent, --muted,
 * --line, --serif, --mono) so both themes work. Badges reuse the global
 * .status-pill styles; only layout is defined here. */

/* Search form: label above, input + button in one row. */
#view-searches .r7-search-form { margin-bottom: 16px; }
#view-searches .r7-search-form label {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  margin-bottom: 8px;
}
#view-searches .r7-search-row { display: flex; gap: 10px; }
#view-searches .r7-search-row input {
  flex: 1;
  min-width: 0;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 9px 12px;
}
#view-searches .r7-search-row input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* Search results. */
#view-searches .r7-results { margin-bottom: 16px; }
#view-searches .r7-results h2 { margin-bottom: 8px; }
#view-searches .r7-cache-note {
  color: var(--ok);
  font-size: 13.5px;
  margin-bottom: 12px;
}
#view-searches .r7-cost-note {
  color: var(--muted);
  font-size: 13.5px;
  margin-bottom: 12px;
}
#view-searches .r7-result-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
#view-searches .r7-result-list li + li {
  border-top: 1px solid var(--line);
  margin-top: 12px;
  padding-top: 12px;
}
#view-searches .r7-result-list a {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
}
#view-searches .r7-result-list p { margin-top: 4px; }

/* History list: query + meta on the left, badge + cost on the right. */
#view-searches .r7-history-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
#view-searches .r7-history-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
#view-searches .r7-history-query {
  font-family: var(--serif);
  font-weight: 600;
  margin-bottom: 4px;
  overflow-wrap: anywhere;
}
#view-searches .r7-history-side {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  padding-top: 2px;
}
#view-searches .r7-history-cost { font-size: 13.5px; }
#view-searches #r7-history-more { margin-top: 14px; }

/* Forecast card on #view-dashboard (rendered by web/js/r4-dashboard.js,
 * Round 7). It lives in this file because web/css/r4-dashboard.css is
 * outside this worker's edit scope; the card only needs spacing — the
 * .num / .muted / .card styles come from style.css. */
#view-dashboard .r4-forecast-card { margin-top: 16px; }
#view-dashboard .r4-forecast-card h2 { margin-bottom: 10px; }
#view-dashboard .r4-forecast-line { font-size: 15px; margin-bottom: 8px; }


/* === css/r8-titling.css === */
/* miliya — conversation auto-title setting (Round 8, Worker C).
 * Only styles new to the auto-title card live here; the card reuses
 * .card/.settings-card from style.css. All colours come from the
 * style.css custom properties, so dark mode (html[data-theme="dark"])
 * works with no extra rules. */

/* Settings toggle row (same shape as .r6-voice-toggle-row). */
.r8-titling-toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin: 10px 0 0;
}
.r8-titling-toggle-row input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: var(--accent);
  cursor: pointer;
}
.r8-titling-toggle-row input[type="checkbox"]:disabled {
  cursor: wait;
  opacity: 0.6;
}


/* === css/r8-drill.css === */
/* miliya — admin channel failover drill (Round 8, Worker C).
 * Only styles new to the drill tab live here; the tab, card, selects
 * and tables reuse style.css (.admin-tabs, .card, .field,
 * .table-wrap, .ledger-table…). All colours come from the style.css
 * custom properties, so dark mode (html[data-theme="dark"]) works
 * with no extra rules. */

.r8-drill-card h2 {
  font-family: var(--serif);
  font-size: 19px;
}

/* Result block: the simulation badge is the first thing an admin
 * sees, so a drill can never be mistaken for a real outage. */
.r8-drill-result {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
.r8-drill-result h3 {
  font-size: 15px;
  margin: 18px 0 10px;
}
.r8-drill-head {
  margin: 0 0 4px;
  font-size: 14px;
}
.r8-drill-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--warn);
  color: var(--warn);
  white-space: nowrap;
  margin-right: 6px;
}

/* Long drill tables scroll instead of stretching the page. */
#admin-drill .table-wrap {
  max-height: 420px;
  overflow-y: auto;
}

.r8-drill-notes {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.6;
}
.r8-drill-notes li {
  margin-bottom: 4px;
}


/* === css/r8-offline.css === */
/* miliya — offline message queue (Round 8, Worker D).
 * Only styles new to the offline queue live here; the bar reuses the
 * composer column width (780px, see style.css) and every colour comes
 * from the style.css custom properties, so dark mode
 * (html[data-theme="dark"]) works with no extra rules. No external
 * URLs, no CDN. */

/* Queue status bar above the composer (hidden while the queue is
 * empty). Warm paper surface, ink text, one vermilion accent — the
 * waiting dot uses the warn ochre; while sending it turns vermilion
 * and pulses. */
.r8-offline-bar {
  max-width: 780px;
  margin: 0 auto 8px;
  padding: 7px 12px;
  text-align: center;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-2);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.r8-offline-bar::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warn);
  margin-right: 8px;
  vertical-align: 1px;
}
.r8-offline-bar.sending::before {
  background: var(--accent);
  animation: r8-offline-pulse 1.4s ease-in-out infinite;
}
@keyframes r8-offline-pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 35%, transparent); }
  50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 0%, transparent); }
}

@media (prefers-reduced-motion: reduce) {
  .r8-offline-bar.sending::before {
    animation: none;
  }
}

/* Retry button for failed items (Round 9): same small bordered
 * treatment as the .msg-actions buttons, sitting inline after the
 * bar text. Only rendered while the failed count is above zero. */
.r8-offline-retry {
  margin-left: 10px;
  padding: 2px 10px;
  font-family: inherit;
  font-size: 12px;
  line-height: 1.5;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  cursor: pointer;
}
.r8-offline-retry:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* A queued user message sits slightly muted until it is sent; the
 * chip names the state (same treatment as the .msg-actions buttons:
 * small, bordered, muted — the warn ochre marks "waiting"). */
.msg.r8-offline-pending {
  opacity: 0.85;
}
.msg.r8-offline-pending .msg-body {
  border-style: dashed;
}
.r8-offline-chip {
  display: inline-block;
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--warn);
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 2px 8px;
}

/* A failed placeholder keeps the muted queued treatment; only the
 * chip turns red (var(--bad)) and renames itself "发送失败". */
.r8-offline-chip.r8-offline-chip-failed {
  color: var(--bad);
}


/* === css/r11-gateway.css === */
/* miliya Round 11 — API Keys & Gateway quickstart styles */

.r11-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
}

.r11-secret-banner {
  border: 1px solid var(--accent, #b23a1e);
  background: var(--surface-alt, #fbf6ed);
  padding: 1rem 1.15rem;
  border-radius: 10px;
  margin-bottom: 1rem;
}

.r11-secret-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88rem;
  padding: 0.5rem 0.65rem;
  background: var(--bg, #f6f1e7);
  border: 1px solid var(--border, #dfd7c8);
  border-radius: 6px;
  word-break: break-all;
  margin: 0.5rem 0;
}

.r11-snippet-tabs {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.r11-snippet-tabs button.active {
  background: var(--accent, #b23a1e);
  color: #fff;
  border-color: var(--accent, #b23a1e);
}

.r11-code-block {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
  line-height: 1.5;
  padding: 0.85rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border, #dfd7c8);
  background: var(--bg, #f6f1e7);
  overflow-x: auto;
  white-space: pre;
  margin: 0 0 0.75rem 0;
}

.r11-tag {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--border, #dfd7c8);
  margin-right: 0.25rem;
}

.r11-admin-cred-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border, #dfd7c8);
}

.r11-admin-cred-row:last-child {
  border-bottom: none;
}


/* === css/r12-ops.css === */
/* miliya Round 12 — Admin Resource Ops, Pricing Matrix, Ops Alerts & Proof-of-Genuine styles */

.r12-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.r12-kpi-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  background: var(--surface, var(--card));
}

.r12-kpi-card .big {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0.25rem 0;
}

.r12-badge {
  display: inline-block;
  font-size: 0.74rem;
  line-height: 1.4;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-soft, rgba(128, 128, 128, 0.08));
  margin-right: 0.3rem;
}

.r12-badge-official_direct {
  border-color: rgba(24, 150, 90, 0.45);
  color: #16794a;
  background: rgba(24, 150, 90, 0.08);
}

.r12-badge-cloud_bedrock,
.r12-badge-cloud_vertex {
  border-color: rgba(37, 99, 235, 0.45);
  color: #1d4ed8;
  background: rgba(37, 99, 235, 0.08);
}

.r12-badge-sub_pool {
  border-color: rgba(217, 119, 6, 0.45);
  color: #b45309;
  background: rgba(217, 119, 6, 0.08);
}

.r12-badge-free_pool {
  border-color: rgba(13, 148, 136, 0.45);
  color: #0f766e;
  background: rgba(13, 148, 136, 0.08);
}

.r12-neg-alert {
  border: 1px solid var(--bad, #c93b2b);
  background: rgba(201, 59, 43, 0.08);
  border-radius: 10px;
  padding: 0.8rem 1rem;
  margin-bottom: 1rem;
}

.r12-neg-pill {
  color: var(--bad, #c93b2b);
  font-weight: 600;
}

.r12-preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.7rem;
  margin-top: 0.75rem;
}

.r12-preset-card {
  text-align: left;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.r12-preset-card:hover {
  border-color: var(--accent, #2563eb);
}

.r12-preset-card h4 {
  margin: 0 0 0.25rem;
  font-size: 0.92rem;
}

.r12-preset-card p {
  margin: 0.2rem 0 0;
  font-size: 0.78rem;
  opacity: 0.8;
}

.r12-genuine-card {
  margin-top: 1.25rem;
}

.r12-check-inline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.5rem 0;
}


/* === css/r13-flagship.css === */
/* miliya Round 13 — High-End SaaS Workspace Sidebar, Artifacts Preview,
 * Trust Center 30-Day Heatmap, Request X-Ray & System Doctor styles.
 * Harmonized with miliya's warm editorial paper / ink / vermilion design system.
 */

/* ---------- 1. Collapsible Left Workspace Sidebar (Desktop >= 960px) ---------- */

.r13-sidebar {
  display: none;
}

.r13-cmd-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--muted);
  font-size: 12.5px;
  cursor: pointer;
  transition: border-color .15s ease, color .15s ease, background .15s ease;
}

.r13-cmd-pill:hover {
  border-color: var(--accent);
  color: var(--ink);
  background: var(--surface-2);
}

.r13-cmd-kbd {
  font-family: var(--mono);
  font-size: 11px;
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink-2);
}

@media (min-width: 960px) {
  body.r13-sidebar-mode {
    --r13-sb-w: 224px;
  }
  body.r13-sidebar-mode.r13-sb-collapsed {
    --r13-sb-w: 62px;
  }

  body.r13-sidebar-mode .topbar {
    padding-left: var(--r13-sb-w);
    transition: padding-left .18s ease;
  }

  body.r13-sidebar-mode .topbar-inner {
    max-width: none;
    padding: 0 24px;
  }

  body.r13-sidebar-mode .topbar .topnav {
    display: none;
  }

  body.r13-sidebar-mode .topbar .logo {
    display: none;
  }

  body.r13-sidebar-mode .main {
    margin-left: var(--r13-sb-w);
    max-width: none;
    padding: 28px 32px 80px;
    transition: margin-left .18s ease;
  }

  body.r13-sidebar-mode .view-chat {
    margin: -28px -32px -80px;
  }

  body.r13-sidebar-mode .r13-sidebar {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--r13-sb-w);
    z-index: 60;
    background: var(--paper-2);
    border-right: 1px solid var(--line);
    transition: width .18s ease;
    overflow: hidden;
  }

  .r13-sb-head {
    height: 58px;
    padding: 0 12px 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--line);
    flex-shrink: 0;
  }

  .r13-sb-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--ink);
    font-family: var(--serif);
    font-size: 19px;
    font-weight: 700;
    text-decoration: none;
    overflow: hidden;
    white-space: nowrap;
  }

  .r13-sb-brand:hover {
    text-decoration: none;
  }

  .r13-sb-nav {
    flex: 1;
    overflow-y: auto;
    padding: 10px 8px 18px;
  }

  .r13-sb-group {
    margin-bottom: 12px;
  }

  .r13-sb-group-title {
    font-size: 10.5px;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 700;
    padding: 6px 10px 4px;
    white-space: nowrap;
    overflow: hidden;
  }

  .r13-sb-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    border-radius: 6px;
    color: var(--ink-2);
    font-size: 13.5px;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    transition: background .12s ease, color .12s ease;
  }

  .r13-sb-link:hover {
    text-decoration: none;
    background: var(--surface-2);
    color: var(--ink);
  }

  .r13-sb-link.active {
    background: var(--surface);
    color: var(--accent);
    font-weight: 700;
    box-shadow: inset 3px 0 0 var(--accent), 0 1px 2px rgba(0, 0, 0, .04);
  }

  .r13-sb-icon {
    width: 20px;
    text-align: center;
    font-size: 14px;
    flex-shrink: 0;
    opacity: .85;
  }

  body.r13-sidebar-mode.r13-sb-collapsed .r13-sb-brand-text,
  body.r13-sidebar-mode.r13-sb-collapsed .r13-sb-group-title,
  body.r13-sidebar-mode.r13-sb-collapsed .r13-sb-label {
    display: none;
  }

  body.r13-sidebar-mode.r13-sb-collapsed .r13-sb-head {
    padding: 0 8px;
    justify-content: center;
  }

  body.r13-sidebar-mode.r13-sb-collapsed .r13-sb-brand {
    display: none;
  }

  body.r13-sidebar-mode.r13-sb-collapsed .r13-sb-link {
    justify-content: center;
    padding: 8px 0;
  }
}

/* ---------- 2. Chat Context Token/Cost Bar & Artifacts Preview ---------- */

.r13-context-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 5px 10px;
  margin-bottom: 6px;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}

.r13-context-stats {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.r13-artifact-btn {
  margin-left: 6px;
  font-size: 11.5px;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  cursor: pointer;
  font-weight: 600;
}

.r13-artifact-btn:hover {
  background: var(--accent);
  color: var(--accent-ink);
}

.r13-artifact-frame {
  width: 100%;
  height: 460px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #ffffff;
}

/* ---------- 3. Check-in Banner, Spend Optimizer & Session Traces ---------- */

.r13-ledger-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.r13-checkin-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  background: linear-gradient(135deg, var(--surface), var(--surface-2));
  border: 1px solid var(--line-strong);
  border-left: 4px solid var(--accent);
  border-radius: 6px;
  padding: 14px 18px;
  margin-bottom: 18px;
}

.r13-opt-tip {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  margin-top: 8px;
  background: var(--paper);
}

.r13-opt-tip strong {
  color: var(--ink);
}

.r13-opt-save {
  display: inline-block;
  margin-left: 6px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ok);
  font-weight: 700;
}

/* ---------- 4. Public Trust Center 30-Day Uptime Heatmap ---------- */

.r13-trust-card {
  margin-top: 20px;
}

.r13-heat-row {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.r13-heat-row:last-child {
  border-bottom: none;
}

.r13-heat-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
  font-size: 13.5px;
}

.r13-heat-bars {
  display: grid;
  grid-template-columns: repeat(30, 1fr);
  gap: 3px;
  height: 22px;
}

.r13-heat-cell {
  border-radius: 2px;
  background: var(--line);
  transition: transform .1s ease;
}

.r13-heat-cell:hover {
  transform: scaleY(1.18);
}

.r13-heat-cell.ok { background: var(--ok); }
.r13-heat-cell.degraded { background: var(--warn); }
.r13-heat-cell.down { background: var(--bad); }
.r13-heat-cell.no_data { background: var(--line); opacity: .55; }

.r13-pledge-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
}

.r13-pledge-list li {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 12.5px;
  color: var(--ink-2);
}

/* ---------- 5. Admin X-Ray, System Doctor & Visual Channel Checkboxes ---------- */

.r13-doctor-score {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
}

.r13-score-ring {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 4px solid var(--ok);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 700;
  color: var(--ok);
  flex-shrink: 0;
}

.r13-score-ring.warn { border-color: var(--warn); color: var(--warn); }
.r13-score-ring.fail { border-color: var(--bad); color: var(--bad); }

.r13-check-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
}

.r13-check-pill.ok,
.r13-check-pill.pass { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.r13-check-pill.warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.r13-check-pill.fail { background: color-mix(in srgb, var(--bad) 15%, transparent); color: var(--bad); }

.r13-channel-checks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 8px;
  margin: 8px 0 12px;
}

.r13-channel-check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  font-size: 13px;
  cursor: pointer;
}

.r13-channel-check input {
  width: auto;
  margin: 0;
}

.r13-project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 14px;
  margin-top: 12px;
}

.r13-project-card {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 16px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.r13-project-card h3 {
  margin: 0;
  font-size: 16px;
}

.r13-err-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.r13-err-pill {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--paper);
  font-size: 12px;
  font-family: var(--mono);
  cursor: pointer;
}

.r13-err-pill:hover {
  border-color: var(--accent);
}


/* === css/r14-platform.css === */
/* miliya Round 14 — Warm Editorial SaaS Redesign
 * Warm linen/cream surfaces, terracotta & honey-amber accents, espresso dark mode,
 * 6-section Admin sub-navigation, 3-step Account/Channel Slide-Over Drawer,
 * 210+ Model Marketplace, and Interactive API Playground X-Ray.
 */

:root {
  --paper: #f9f4eb;
  --paper-2: #f2eadc;
  --surface: #fffdf8;
  --surface-2: #f6efe2;
  --ink: #241d15;
  --ink-2: #4e4336;
  --muted: #6e6253;
  --line: #e4d9c5;
  --line-strong: #cfbfa2;
  --accent: #b83c1c;
  --accent-deep: #962d13;
  --accent-soft: #fae4da;
  --amber: #c97a16;
  --amber-soft: #fbf0da;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-warm: 0 2px 6px rgba(48, 33, 18, .05), 0 10px 28px rgba(48, 33, 18, .05);
}

html[data-theme="dark"] {
  --paper: #16120e;
  --paper-2: #1e1812;
  --surface: #231d16;
  --surface-2: #2c241b;
  --ink: #f1e8d9;
  --ink-2: #d3c6b1;
  --muted: #9f917a;
  --line: #3b3123;
  --line-strong: #524532;
  --accent: #e67250;
  --accent-deep: #f28766;
  --accent-soft: #3c241b;
  --amber: #e2a447;
  --amber-soft: #352915;
  --shadow-warm: 0 2px 8px rgba(0, 0, 0, .35), 0 12px 32px rgba(0, 0, 0, .32);
}

/* ---------- Warm Elevation & Spacious SaaS Surfaces ---------- */

.card, .summary-card, .auth-card, .r13-project-card {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-warm);
  border-color: var(--line);
}

.view-page {
  max-width: 1320px;
}

.view-page.view-narrow {
  max-width: 820px;
}

input, select, textarea {
  border-radius: var(--radius);
}

.btn {
  border-radius: var(--radius);
}

.btn-primary {
  box-shadow: 0 1px 2px rgba(184, 60, 28, .22);
}

/* ---------- White-Label Site Announcement Banner ---------- */

.r14-site-banner {
  background: linear-gradient(90deg, var(--amber-soft), var(--accent-soft));
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-size: 13px;
  padding: 7px 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.r14-site-banner button {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 15px;
  padding: 0 4px;
}

/* ---------- Onboarding Checklist Banner (0-channel state) ---------- */

.r14-onboard-banner {
  background: linear-gradient(135deg, var(--surface) 0%, var(--amber-soft) 100%);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-warm);
}

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

.r14-onboard-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.r14-onboard-step {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.r14-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
}

/* ---------- Admin 6-Section Left Sub-Navigation ---------- */

.r14-admin-shell {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  align-items: start;
}

.r14-admin-nav {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 12px 10px;
  box-shadow: var(--shadow-warm);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.r14-admin-section {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.r14-admin-sec-title {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 8px 10px 4px;
}

.r14-admin-item {
  appearance: none;
  background: transparent;
  border: none;
  border-radius: 7px;
  color: var(--ink-2);
  font-family: var(--sans);
  font-size: 13.5px;
  padding: 7px 10px;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background .12s ease, color .12s ease;
}

.r14-admin-item:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.r14-admin-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}

.r14-admin-content {
  min-width: 0;
}

@media (min-width: 960px) {
  .r14-admin-shell {
    grid-template-columns: 214px minmax(0, 1fr);
    gap: 22px;
  }
  .r14-admin-nav {
    position: sticky;
    top: 76px;
    flex-direction: column;
    flex-wrap: nowrap;
    max-height: calc(100vh - 96px);
    overflow-y: auto;
  }
  #view-admin.r14-nav-ready .admin-tabs {
    display: none;
  }
}

/* ---------- 3-Step Slide-Over Drawer (Account / Channel Onboarding) ---------- */

.r14-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 160;
  background: rgba(24, 17, 10, .48);
  backdrop-filter: blur(3px);
  display: flex;
  justify-content: flex-end;
}

.r14-drawer-backdrop[hidden] {
  display: none;
}

.r14-drawer {
  width: min(720px, 96vw);
  height: 100vh;
  background: var(--paper);
  border-left: 1px solid var(--line-strong);
  box-shadow: -12px 0 40px rgba(24, 17, 10, .2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.r14-drawer-head {
  padding: 16px 22px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.r14-drawer-steps {
  display: flex;
  gap: 6px;
  padding: 12px 22px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}

.r14-step-pill {
  flex: 1;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  border-radius: var(--radius);
  padding: 7px 10px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}

.r14-step-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.r14-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 22px 28px;
}

.r14-drawer-foot {
  padding: 14px 22px;
  background: var(--surface);
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

/* 14-Platform Selector Cards */
.r14-plat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.r14-plat-card {
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  cursor: pointer;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: border-color .14s ease, background .14s ease, transform .12s ease;
}

.r14-plat-card:hover {
  border-color: var(--accent);
  background: var(--surface-2);
  transform: translateY(-1px);
}

.r14-plat-card.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 22%, transparent);
}

.r14-plat-name {
  font-weight: 700;
  font-size: 13.5px;
  color: var(--ink);
}

.r14-plat-sub {
  font-size: 11.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Auth Mode Switch (Direct Key vs OAuth PKCE) */
.r14-mode-tabs {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 3px;
  gap: 3px;
  margin-bottom: 14px;
}

.r14-mode-tab {
  border: none;
  background: transparent;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
}

.r14-mode-tab.active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
}

/* Visual Model Redirect Editor */
.r14-redir-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.r14-chip-box {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 180px;
  overflow-y: auto;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.r14-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-family: var(--mono);
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--ink-2);
  cursor: pointer;
}

.r14-chip.selected {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

/* ---------- Batch Bar & Window Progress Bars ---------- */

.r14-batch-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  margin-bottom: 12px;
  background: var(--amber-soft);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
}

.r14-win-bar {
  width: 96px;
  height: 6px;
  border-radius: 999px;
  background: var(--paper-2);
  overflow: hidden;
  display: inline-block;
  vertical-align: middle;
}

.r14-win-fill {
  height: 100%;
  background: var(--ok);
  border-radius: 999px;
}

.r14-win-fill.warn { background: var(--amber); }
.r14-win-fill.hot { background: var(--bad); }

/* ---------- Model Marketplace (#view-models) ---------- */

.r14-market-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-warm);
}

.r14-plat-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.r14-pill-btn {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  border-radius: 999px;
  padding: 5px 13px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}

.r14-pill-btn:hover {
  border-color: var(--accent);
  color: var(--ink);
}

.r14-pill-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.r14-cap-badge {
  display: inline-block;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink-2);
  margin-right: 4px;
}

.r14-peak-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--amber-soft);
  color: var(--amber);
  border: 1px solid var(--line-strong);
}

/* ---------- Interactive API Playground (#view-playground) ---------- */

.r14-pg-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

@media (min-width: 960px) {
  .r14-pg-grid {
    grid-template-columns: 1.05fr 0.95fr;
  }
}

.r14-xray-kv {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.r14-xray-box {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px 11px;
}

.r14-xray-box .k {
  font-size: 11px;
  color: var(--muted);
  display: block;
}

.r14-xray-box .v {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}

.r14-pg-reply {
  white-space: pre-wrap;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  min-height: 120px;
  font-size: 14px;
  line-height: 1.65;
}

/* Compact Chat Group Picker */
#r14-group-select {
  max-width: 175px;
  font-size: 12.5px;
  padding: 4px 8px;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
}


/* === css/r15-agent.css === */
/* miliya Round 15 — Warm Split-Pane Agent Workspace, File Delivery Cards,
 * Live SSE Step Timeline & MCP Tool Server Manager.
 * Harmonized with Round 14 warm linen / terracotta / amber-espresso palette.
 */

/* ---------- Chat Shell Split-Pane Workspace Canvas ---------- */

.chat-shell.r15-canvas-open {
  display: flex;
  flex-direction: row;
  align-items: stretch;
}

.chat-shell.r15-canvas-open .chat-main {
  flex: 1 1 50%;
  min-width: 340px;
}

.r15-canvas {
  flex: 0 0 48%;
  width: 48%;
  min-width: 400px;
  max-width: 760px;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: -4px 0 24px rgba(48, 33, 18, .06);
  position: relative;
  z-index: 15;
  overflow: hidden;
}

.r15-canvas[hidden] {
  display: none !important;
}

.r15-canvas.r15-fullscreen {
  position: fixed;
  inset: 0;
  width: 100vw !important;
  max-width: 100vw !important;
  min-width: 0 !important;
  z-index: 260;
  border-left: none;
}

.r15-canvas-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: linear-gradient(180deg, var(--surface) 0%, var(--paper) 100%);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.r15-canvas-file {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.r15-ext-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 26px;
  padding: 0 7px;
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(184, 60, 28, .22);
  flex-shrink: 0;
}

.r15-ext-badge.is-svg {
  background: var(--amber-soft);
  color: var(--amber);
  border-color: rgba(201, 122, 22, .28);
}

.r15-ext-badge.is-code {
  background: var(--paper-2);
  color: var(--ink-2);
  border-color: var(--line-strong);
}

.r15-canvas-title-wrap {
  min-width: 0;
}

.r15-canvas-filename {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.r15-canvas-meta {
  margin: 1px 0 0;
  font-size: 11.5px;
  color: var(--muted);
}

.r15-canvas-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.r15-canvas-tabs {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 14px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.r15-tab-group {
  display: inline-flex;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
}

.r15-tab-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
  padding: 5px 11px;
  border-radius: 6px;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}

.r15-tab-btn:hover {
  color: var(--ink);
}

.r15-tab-btn.active {
  background: var(--surface);
  color: var(--accent);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(48, 33, 18, .08);
}

.r15-canvas-body {
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--paper);
}

.r15-pane {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: auto;
}

.r15-pane[hidden] {
  display: none !important;
}

.r15-preview-frame {
  width: 100%;
  height: 100%;
  flex: 1 1 auto;
  border: none;
  background: #ffffff;
}

.r15-preview-image-wrap {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--paper-2);
}

.r15-preview-image-wrap img {
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--radius);
  box-shadow: var(--shadow-warm);
}

.r15-preview-text {
  padding: 18px 20px;
  margin: 0;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--ink);
  background: var(--surface);
  flex: 1 1 auto;
}

.r15-source-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}

.r15-source-code {
  margin: 0;
  padding: 16px;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.6;
  white-space: pre;
  overflow: auto;
  flex: 1 1 auto;
  background: #231d16;
  color: #f3eadc;
}

.r15-files-list {
  list-style: none;
  margin: 0;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.r15-file-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.r15-file-row:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-warm);
}

.r15-file-row.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.r15-file-row-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.r15-file-row-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.r15-file-row-sub {
  font-size: 11.5px;
  color: var(--muted);
}

.r15-file-row-btns {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.r15-canvas-empty {
  padding: 36px 24px;
  text-align: center;
  color: var(--muted);
}

/* ---------- Toolbar Workspace Toggle Button ---------- */

.r15-ws-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  position: relative;
}

.r15-ws-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent);
  color: #fffdf8;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

/* ---------- Live Streaming Agent Steps Timeline ---------- */

.r15-live-steps {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--paper-2);
  border: 1px solid var(--line);
}

.r15-step-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--ink-2);
  line-height: 1.45;
}

.r15-step-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 5px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 11.5px;
  flex-shrink: 0;
}

.r15-step-item.is-workspace .r15-step-icon {
  background: var(--accent-soft);
  border-color: rgba(184, 60, 28, .25);
  color: var(--accent);
}

.r15-step-item.is-code .r15-step-icon {
  background: var(--amber-soft);
  border-color: rgba(201, 122, 22, .3);
  color: var(--amber);
}

.r15-step-item.is-error {
  color: var(--bad);
}

.r15-progress-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--accent);
  font-weight: 500;
  padding-top: 2px;
}

.r15-pulse-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  animation: r15Pulse 1.2s ease-in-out infinite;
}

.conv-item.r15-conv-running .conv-title::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: middle;
  animation: r15Pulse 1.2s ease-in-out infinite;
}

@keyframes r15Pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .35; transform: scale(.78); }
}

/* ---------- Rich File Delivery Cards inside Assistant Bubble ---------- */

.r15-artifact-deck {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 12px 0 6px;
}

.r15-artifact-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 14px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--surface) 0%, var(--paper) 100%);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-warm);
}

.r15-artifact-card-left {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  flex: 1 1 200px;
}

.r15-artifact-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  word-break: break-all;
}

.r15-artifact-sub {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
}

.r15-ver-pill {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--amber-soft);
  color: var(--amber);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
}

.r15-artifact-card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.r15-conv-ws-banner {
  margin: 8px 0 4px;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--amber-soft);
  border: 1px solid var(--line-strong);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--ink);
}

/* ---------- MCP Tool Server Manager ---------- */

.r15-mcp-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 12px 0 16px;
}

.r15-mcp-item {
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--paper);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.r15-mcp-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.r15-mcp-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.r15-mcp-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-2);
}

/* ---------- Responsive Narrow / Mobile Overlay ---------- */

@media (max-width: 1060px) {
  .r15-canvas {
    position: fixed;
    top: 56px;
    right: 0;
    bottom: 0;
    width: min(94vw, 560px);
    min-width: 0;
    max-width: 96vw;
    z-index: 180;
    box-shadow: -8px 0 36px rgba(24, 16, 10, .24);
  }
}


/* === css/r16-evolution.css === */
/* miliya Round 16 — Project Intelligence Evolution UI
 * Full GFM Markdown, Syntax Highlighting, Math & Mermaid Rendering,
 * Unified Resizable Split-Pane Canvas (Version Time-Machine + Public /a/ Share),
 * Chat Capability Pills, Coding Agent Deep Check, TOTP 2FA & Monthly Statement.
 * Preserves miliya's warm cream & terracotta aesthetic across light & dark themes.
 */

/* ---------- 1. Rich GFM Markdown Typography ---------- */
.r16-md {
  line-height: 1.68;
  word-break: break-word;
}
.r16-md h1, .r16-md h2, .r16-md h3, .r16-md h4 {
  margin: 14px 0 8px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.35;
}
.r16-md h1 { font-size: 1.32rem; border-bottom: 1px solid var(--border); padding-bottom: 4px; }
.r16-md h2 { font-size: 1.18rem; }
.r16-md h3 { font-size: 1.05rem; }
.r16-md h4 { font-size: 0.96rem; color: var(--muted); }
.r16-md p { margin: 6px 0 10px; }
.r16-md p:last-child { margin-bottom: 0; }
.r16-md ul, .r16-md ol {
  margin: 6px 0 12px;
  padding-left: 22px;
}
.r16-md li { margin: 4px 0; }
.r16-md li.r16-task-item {
  list-style: none;
  margin-left: -18px;
}
.r16-md blockquote {
  margin: 10px 0;
  padding: 8px 14px;
  border-left: 3px solid var(--accent, #c4572d);
  background: color-mix(in srgb, var(--accent, #c4572d) 7%, transparent);
  border-radius: 0 8px 8px 0;
  color: var(--muted);
}
.r16-md hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 14px 0;
}
.r16-md a {
  color: var(--accent, #c4572d);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.r16-md code.r16-inline-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.87em;
  padding: 1px 5px;
  border-radius: 5px;
  background: color-mix(in srgb, var(--ink) 7%, transparent);
  color: var(--ink);
}

/* GFM Tables */
.r16-table-wrap {
  overflow-x: auto;
  margin: 10px 0 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
}
.r16-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.r16-table th, .r16-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.r16-table th {
  background: color-mix(in srgb, var(--accent, #c4572d) 9%, var(--surface));
  font-weight: 600;
  color: var(--ink);
}
.r16-table tr:last-child td { border-bottom: 0; }

/* Code Blocks + Lightweight Syntax Colors */
.r16-code-wrap {
  margin: 10px 0 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: #1d1a17;
  color: #f4efe7;
}
.r16-code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 12px;
  background: #292420;
  border-bottom: 1px solid rgba(255, 245, 232, 0.08);
  font-size: 0.78rem;
}
.r16-code-lang {
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #e6a97a;
  font-weight: 600;
}
.r16-code-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.r16-code-btn {
  border: 1px solid rgba(255, 245, 232, 0.22);
  background: rgba(255, 255, 255, 0.06);
  color: #f4efe7;
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 0.75rem;
  cursor: pointer;
}
.r16-code-btn:hover {
  background: rgba(196, 87, 45, 0.35);
  border-color: #d9784f;
}
.r16-code-pre {
  margin: 0;
  padding: 12px 14px;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85rem;
  line-height: 1.55;
}
.r16-tok-kw { color: #f29e74; font-weight: 600; }
.r16-tok-str { color: #b7d98b; }
.r16-tok-num { color: #e9c46a; }
.r16-tok-cm { color: #9c8f82; font-style: italic; }

/* Math & Mermaid Blocks */
.r16-math-block {
  margin: 10px 0;
  padding: 12px 16px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent, #c4572d) 6%, var(--surface));
  border: 1px solid var(--border);
  font-family: "Cambria Math", "STIX Two Math", Georgia, serif;
  font-size: 1.04rem;
  text-align: center;
  overflow-x: auto;
}
.r16-math-inline {
  font-family: "Cambria Math", "STIX Two Math", Georgia, serif;
  padding: 0 3px;
  color: var(--ink);
}
.r16-mermaid-box {
  margin: 10px 0;
  padding: 12px;
  border-radius: 10px;
  border: 1px dashed var(--accent, #c4572d);
  background: color-mix(in srgb, var(--accent, #c4572d) 5%, var(--surface));
}
.r16-mermaid-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 0.82rem;
  font-weight: 600;
}

/* ---------- 2. Unified Resizable Split-Pane Canvas + Time-Machine ---------- */
.r15-canvas {
  position: relative;
}
.r16-resize-handle {
  position: absolute;
  left: -4px;
  top: 0;
  bottom: 0;
  width: 8px;
  cursor: col-resize;
  z-index: 5;
}
.r16-resize-handle:hover,
.r16-resize-handle.is-dragging {
  background: color-mix(in srgb, var(--accent, #c4572d) 35%, transparent);
}
.r16-ver-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--accent, #c4572d) 4%, var(--surface));
  font-size: 0.8rem;
  flex-wrap: wrap;
}
.r16-ver-bar select {
  font-size: 0.8rem;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
}

/* ---------- 3. Chat Composer Capability Pills ---------- */
.r16-cap-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.r16-cap-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.75rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s ease;
}
.r16-cap-pill:hover {
  border-color: var(--accent, #c4572d);
  color: var(--ink);
}
.r16-cap-pill.is-active {
  background: color-mix(in srgb, var(--accent, #c4572d) 14%, var(--surface));
  border-color: var(--accent, #c4572d);
  color: var(--accent, #c4572d);
  font-weight: 600;
}

/* ---------- 4. MCP Anti-Rug-Pull Warning & 2FA / Deep Check Cards ---------- */
.r15-mcp-item.is-rug-pull {
  border-color: var(--bad, #b93829) !important;
}
.r16-rug-warn {
  margin-bottom: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--bad, #b93829) 12%, transparent);
  color: var(--bad, #b93829);
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.r16-check-list {
  list-style: none;
  padding: 0;
  margin: 12px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.r16-check-list li {
  padding: 10px 12px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}
.r16-check-ok { color: var(--ok, #2b7a4b); font-weight: 700; }
.r16-check-fail { color: var(--bad, #b93829); font-weight: 700; }
.r16-totp-secret {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1rem;
  letter-spacing: 0.14em;
  padding: 8px 12px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent, #c4572d) 10%, var(--surface));
  border: 1px dashed var(--accent, #c4572d);
  display: inline-block;
  margin: 6px 0;
}
.r16-stmt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin: 12px 0;
}
.r16-stmt-kpi {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--accent, #c4572d) 4%, var(--surface));
}
.r16-stmt-kpi strong {
  display: block;
  font-size: 1.1rem;
  margin-top: 2px;
}

