:root {
  color-scheme: light;
  --bg-app: #f9f8f6;
  --bg-panel: #ffffff;
  --bg-hover: #f3f0ea;
  --border: #e8e6e1;
  --border-strong: #d0cdc6;
  --text-main: #191919;
  --text-muted: #6b6965;
  --text-muted-light: #9c9a94;
  --primary: #191919;
  --primary-coral: #d97753;
  --primary-soft: #fcf1ee;
  --success: #127852;
  --success-soft: #eaf5f0;
  --warning: #b25e00;
  --warning-soft: #fbf1e6;
  --danger: #b91c1c;
  --danger-soft: #fdf2f2;
  --usage-input-text: #127852;
  --usage-input-background: transparent;
  --usage-output-text: #7c3aed;
  --usage-output-background: transparent;
  --usage-cache-read-text: #2563eb;
  --usage-cache-read-background: transparent;
  --usage-cache-write-text: #a16207;
  --usage-cache-write-background: transparent;
  --usage-rate-le50-text: #b91c1c;
  --usage-rate-le50-background: transparent;
  --usage-rate-le70-text: #a16207;
  --usage-rate-le70-background: transparent;
  --usage-rate-le90-text: #2563eb;
  --usage-rate-le90-background: transparent;
  --usage-rate-le100-text: #127852;
  --usage-rate-le100-background: transparent;
  --request-cache-prefix-lock-text: #191919;
  --request-cache-prefix-lock-background: transparent;
  --request-cache-cache-anchor-text: #191919;
  --request-cache-cache-anchor-background: transparent;
  --request-cache-cache-budget-insufficient-text: #b25e00;
  --request-cache-cache-budget-insufficient-background: #fbf1e6;
  --request-cache-block-hash-change-text: #b25e00;
  --request-cache-block-hash-change-background: #fbf1e6;
  --shadow-flat: 0 1px 3px rgba(25, 25, 25, 0.05);
  --shadow-popup: 0 12px 30px rgba(25, 25, 25, 0.08);
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", Courier, monospace;
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, select, input, textarea {
  font: inherit;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background-color: var(--bg-panel);
  color: var(--text-main);
  transition: all 0.15s ease;
  box-shadow: var(--shadow-flat);
}

button {
  padding: 8px 16px;
  cursor: pointer;
  font-weight: 700;
  font-size: 13.5px;
}

button:hover:not(:disabled) {
  border-color: var(--text-main);
  background-color: var(--bg-hover);
}

button:disabled { cursor: not-allowed; opacity: 0.45; }

button.primary {
  background-color: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

button.primary:hover:not(:disabled) {
  background-color: #2b2b2b;
  border-color: #2b2b2b;
  color: #fff;
  transform: translateY(-1px);
}

button.ghost { background-color: transparent; border-color: transparent; box-shadow: none; }
button.ghost:hover:not(:disabled) { background-color: var(--bg-hover); }
button.small { padding: 6px 10px; font-size: 12px; }
button.pill-btn { border-radius: 999px; }
button.small.pill-btn { padding: 6px 16px; }
button.danger-light { background-color: var(--danger-soft); border-color: #fecdd3; color: var(--danger); }
button.danger-light:hover:not(:disabled) { background-color: #ffe4e6; border-color: var(--danger); }

select, input { min-height: 38px; padding: 8px 12px; font-size: 13.5px; }
select:focus, input:focus, textarea:focus { outline: none; border-color: var(--primary-coral); box-shadow: 0 0 0 1px var(--primary-coral); }

textarea {
  width: 100%;
  min-height: 190px;
  padding: 14px;
  resize: vertical;
  font-family: var(--font-mono);
  line-height: 1.55;
}

.advanced-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr); gap: 14px; margin-top: 16px; }
.param-box { display: grid; gap: 10px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background-color: var(--bg-app); }
.param-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.param-head h4 { margin: 0; font-size: 14px; font-weight: 800; color: var(--text-main); }
.param-head span { font-size: 11.5px; font-weight: 700; color: var(--text-muted); }
.param-box textarea { min-height: 220px; background-color: var(--bg-panel); }
.usage-appearance-layout { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(260px, 0.55fr); gap: 14px; margin-top: 16px; align-items: start; }
.usage-color-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.usage-color-row { display: grid; grid-template-columns: minmax(88px, 1fr) auto auto auto; align-items: center; gap: 8px; min-height: 48px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background-color: var(--bg-app); }
.usage-color-name { min-width: 0; font-size: 12px; color: var(--text-main); }
.usage-color-control, .usage-transparent-control { display: inline-flex; align-items: center; gap: 5px; color: var(--text-muted); font-size: 11px; font-weight: 700; white-space: nowrap; }
.usage-color-control input[type="color"] { width: 34px; min-width: 34px; height: 30px; min-height: 30px; padding: 2px; border-radius: 7px; cursor: pointer; }
.usage-color-control input[type="color"]:disabled { cursor: not-allowed; opacity: 0.38; }
.usage-transparent-control input { min-height: 0; box-shadow: none; }
.usage-preview-box { display: grid; gap: 10px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background-color: var(--bg-app); position: sticky; top: 12px; }
.usage-preview-box .usage-lines.detail { margin: 0; background-color: var(--bg-panel); }
.usage-preview-actions { display: inline-flex; align-items: center; justify-content: flex-end; gap: 4px; }
.usage-preview-editor { padding: 2px 0; }
.usage-preview-clickable { cursor: pointer; transition: border-color 0.15s ease, box-shadow 0.15s ease; }
.usage-preview-clickable:hover { border-color: var(--primary-coral); box-shadow: 0 0 0 1px var(--primary-coral); }
.usage-sample-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.usage-sample-grid label { display: grid; gap: 3px; min-width: 0; color: var(--text-muted); font-size: 10.5px; font-weight: 700; }
.usage-sample-grid label:last-child { grid-column: 1 / -1; }
.usage-sample-grid input { width: 100%; min-width: 0; min-height: 32px; padding: 5px 8px; font-family: var(--font-mono); font-size: 11.5px; }
.usage-appearance-actions { justify-content: flex-end; margin-top: 12px; }
.config-management-actions { display: inline-flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.request-cache-appearance-layout { grid-template-columns: minmax(0, 1.15fr) minmax(340px, 0.85fr); }
.request-cache-preview { padding: 12px; border: 1px solid var(--border); border-radius: 10px; background-color: var(--bg-panel); }
.request-cache-preview .request-cache-summary-row { grid-template-columns: 8em minmax(0, 1fr); gap: 6px; }
.request-cache-preview .request-cache-appearance-value,
.request-cache-preview .request-cache-status-chip { white-space: nowrap; }

pre {
  margin: 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #191919;
  color: #f7f3ed;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 56vh;
  font-size: 13px;
}

#detailPre {
  flex: 1 1 auto;
  min-height: 420px;
  max-height: none;
}


h1, h2, h3, p { margin-top: 0; }
code {
  font-family: var(--font-mono);
  background: var(--bg-app);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 4px;
}

.app-shell { display: grid; grid-template-columns: 280px minmax(0, 1fr); min-height: 100vh; }
.mobile-menu-button, .sidebar-backdrop { display: none; }

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px;
  background-color: var(--bg-panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 28px;
  z-index: 10;
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 44px; height: 44px; display: grid; place-items: center; color: var(--primary-coral); }
.brand-title { font-size: 15px; font-weight: 800; letter-spacing: -0.01em; }
.brand-subtitle { font-size: 11px; color: var(--text-muted); font-weight: 500; }

.nav { display: grid; gap: 6px; }
.nav-item {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 10px 14px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  box-shadow: none;
}
.nav-item:hover { background-color: var(--bg-hover); color: var(--text-main); }
.nav-item.active { background-color: var(--bg-hover); color: var(--text-main); box-shadow: inset 3px 0 0 var(--primary-coral); border-radius: 0 8px 8px 0; padding-left: 17px; }

.sidebar-footer { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 12px; }
.sidebar-address { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); background-color: var(--bg-app); padding: 6px 10px; border-radius: 6px; border: 1px solid var(--border); }
.note, small { color: var(--text-muted); }
.note { font-size: 12.5px; }

.main { min-width: 0; padding: 32px 40px 80px; }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 32px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.eyebrow { font-size: 14px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--primary-coral); margin-bottom: 8px; }
.topbar h1 { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; margin: 0; }
.status-pills, .button-row, .hero-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.button-row.compact { gap: 6px; }

.pill, .badge, .tag {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border-strong);
  background-color: var(--bg-panel);
  border-radius: 4px;
  padding: 6px 12px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  box-shadow: var(--shadow-flat);
  min-height: 32px;
  white-space: nowrap;
}
.pill.active { border-color: var(--text-main); background-color: var(--bg-hover); color: var(--text-main); }
.badge.success, .tag.success, .cache-hit { background-color: var(--success-soft); color: var(--success); border-color: #add8c3; }
.badge.warning, .tag.warning, .cache-creation { background-color: var(--warning-soft); color: var(--warning); border-color: #eccfb3; }
.badge.danger, .tag.danger, .cache-error { background-color: var(--danger-soft); color: var(--danger); border-color: #fca5a5; }
.cache-unknown { background-color: var(--primary-soft); color: var(--primary-coral); border-color: #f7c5bd; }
.cache-none { background-color: var(--bg-app); color: var(--text-muted); }

.page { display: none; }
.page.active { display: block; }
.hero-card, .panel, .stat-card, .channel-card { background-color: var(--bg-panel); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-flat); }
.hero-card { padding: 28px 36px; display: flex; justify-content: space-between; gap: 24px; align-items: center; margin-bottom: 24px; }
.hero-card p { color: var(--text-muted); max-width: 780px; margin: 0; font-size: 15.5px; line-height: 1.7; }
.hero-eyebrow { font-size: 22px; margin-bottom: 4px; }

.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat-card { position: relative; padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; }
.stat-card span { color: var(--text-muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.02em; }
.stat-card strong { font-family: var(--font-mono); font-size: 20px; font-weight: 800; color: var(--text-main); word-break: break-all; }
.stat-card small { font-size: 11.5px; color: var(--text-muted); margin-top: auto; }
.stat-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stat-row strong { font-family: var(--font-mono); font-size: 20px; font-weight: 800; color: var(--text-main); }

.two-col { display: grid; grid-template-columns: minmax(320px, 0.65fr) minmax(0, 1fr); gap: 18px; }
.panel { padding: 24px; margin-bottom: 18px; }
.panel-head, .section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; border-bottom: 1px dashed var(--border); padding-bottom: 12px; }
.panel-actions { display: inline-flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.section-head { align-items: flex-start; }
.panel-head h3, .section-head h2 { margin: 0; font-weight: 800; }
.section-head p { color: var(--text-muted); margin: 8px 0 0; }
.panel-subtitle { margin: 3px 0 0; color: var(--text-muted); font-size: 12.5px; }

.kv-list { display: grid; gap: 2px; }
.kv { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 16px; padding: 10px 0; border-bottom: 1px dashed var(--border); font-size: 13.5px; }
.kv span:first-child { color: var(--text-muted); font-weight: 500; }
.kv span:last-child { font-weight: 700; color: var(--text-main); word-break: break-word; }
.kv-mono, .td-mono { font-family: var(--font-mono); font-size: 12.5px; }

.quick-stack { display: grid; gap: 10px; }
.quick-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-app); }
.quick-row span { font-weight: 700; font-size: 13.5px; }
.quick-row em { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); margin-left: 6px; font-style: normal; }
.quick-controls { display: inline-flex; align-items: center; justify-content: flex-end; gap: 8px; flex-shrink: 0; }

.channel-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 24px; }
.channel-card { position: relative; padding: 20px; display: flex; flex-direction: column; gap: 12px; border-color: var(--border-strong); }
.channel-card.active { border-color: var(--primary-coral); background-color: var(--bg-app); box-shadow: inset 0 2px 0 var(--primary-coral); }
.channel-card h3 { font-size: 19px; font-weight: 800; margin: 0; }
.channel-card button { margin-top: auto; align-self: stretch; }
.channel-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: auto; }
.channel-actions button { margin-top: 0; }
.channel-form { display: grid; gap: 8px; margin: 2px 0 4px; }
.channel-form .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
label { display: grid; gap: 7px; color: var(--text-muted); font-weight: 700; font-size: 13px; }
.channel-form label { gap: 4px; font-size: 11px; }
.channel-form input, .channel-form select { min-height: 34px; padding: 6px 10px; font-size: 12.5px; border-radius: 7px; width: 100%; }
.channel-form input { font-family: var(--font-mono); }
.channel-card .card-del { position: absolute; top: 12px; right: 12px; z-index: 1; width: 26px; height: 26px; min-height: 0; padding: 0 0 2px; display: grid; place-items: center; border-radius: 8px; font-size: 17px; line-height: 1; color: var(--text-muted); background-color: var(--bg-app); box-shadow: none; align-self: auto; margin-top: 0; }
.channel-card .card-del:hover { color: var(--danger); border-color: var(--danger); background-color: var(--danger-soft); transform: none; }
.editable-title { padding-right: 28px; }
.name-display { display: inline; width: auto; min-height: 0; padding: 0; border: 0; color: var(--text-main); background: transparent; box-shadow: none; font: inherit; text-align: left; align-self: start; margin-top: 0; cursor: text; }
.name-display:hover { color: var(--primary-coral); background: transparent; transform: none; }
.name-input { font-size: 19px; font-weight: 800; border: 1px dashed var(--border-strong); border-radius: 7px; padding: 4px 8px; width: 100%; font-family: var(--font-sans); min-height: auto; }
.channel-card.add-card { align-items: center; justify-content: center; text-align: center; gap: 8px; border: 1.5px dashed var(--border-strong); background-color: transparent; box-shadow: none; cursor: pointer; min-height: 220px; }
.channel-card.add-card:hover { border-color: var(--primary-coral); background-color: var(--bg-app); }
.add-plus { width: 46px; height: 46px; display: grid; place-items: center; padding-bottom: 4px; border-radius: 50%; background-color: var(--bg-hover); color: var(--primary-coral); font-size: 26px; font-weight: 400; line-height: 1; }
.add-card:hover .add-plus { background-color: var(--primary-coral); color: #fff; }

.set-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--border); }
.set-row:last-child { border-bottom: 0; }
.set-info { min-width: 0; }
.set-title { font-size: 14.5px; font-weight: 800; margin-bottom: 3px; }
.set-desc { font-size: 12.5px; color: var(--text-muted); line-height: 1.5; }
.set-control { flex-shrink: 0; display: flex; align-items: center; gap: 10px; }
.anchor-ignore-control { flex-wrap: wrap; justify-content: flex-end; }
.anchor-ignore-control .compact-field { min-width: 108px; }
.anchor-ignore-control #ignoreLastAnchorCount { width: 74px; min-width: 74px; }
.anchor-ignore-control button { white-space: nowrap; }
.anchor-ignore-status { margin-top: 10px; min-height: 0; color: var(--text-muted); font-size: 12px; line-height: 1.55; }
.anchor-ignore-status.warning { color: var(--warning); font-weight: 700; }
.anchor-ignore-status.success { color: var(--success); font-weight: 700; }
.switch { position: relative; width: 46px; height: 26px; flex-shrink: 0; cursor: pointer; }
.switch input { display: none; }
.switch .track { position: absolute; inset: 0; background-color: var(--border-strong); border-radius: 999px; transition: background-color 0.18s ease; }
.switch .thumb { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background-color: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.25); transition: transform 0.18s ease; }
.switch input:checked + .track { background-color: var(--text-main); }
.switch input:checked + .track + .thumb { transform: translateX(20px); }
.lock-state-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 800; padding: 5px 11px; border-radius: 999px; background-color: var(--success-soft); color: var(--success); border: 1px solid #add8c3; }
.lock-state-badge.off { background-color: var(--bg-app); color: var(--text-muted); border-color: var(--border-strong); }
.lock-state-badge.warning { background-color: var(--warning-soft); color: var(--warning); border-color: #eccfb3; }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 9px; overflow: hidden; background-color: var(--bg-panel); }
.seg button { flex: 1 1 0; min-width: 72px; border: 0; border-radius: 0; box-shadow: none; padding: 8px 16px; background: transparent; color: var(--text-muted); font-size: 13px; white-space: nowrap; }
.seg button.active { background-color: var(--text-main); color: #fff; }
.seg button:hover:not(.active) { background-color: var(--bg-hover); color: var(--text-main); transform: none; }
.ttl-seg button { min-width: 64px; padding-inline: 12px; }
.system-message-seg button { min-height: 42px; line-height: 1.25; white-space: normal; }
.marker-options { flex-wrap: wrap; justify-content: flex-end; }
.marker-code { font-family: var(--font-mono); font-size: 13px; font-weight: 700; background-color: var(--warning-soft); color: var(--warning); border: 1px solid #eccfb3; border-radius: 7px; padding: 6px 12px; }
.cache-note { margin: 14px 0 0; line-height: 1.6; }
.prompt-map { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 16px; align-items: center; background-color: var(--bg-app); padding: 20px; border-radius: 10px; border: 1px dashed var(--border-strong); }
.prompt-block { border-radius: 8px; padding: 16px 20px; text-align: center; font-weight: 700; font-size: 13.5px; border: 1px solid var(--border); background-color: var(--bg-panel); }
.prompt-block.stable { color: var(--success); border-color: #add8c3; background-color: var(--success-soft); }
.prompt-block.dynamic { color: var(--primary-coral); border-color: #f7c5bd; background-color: #fdf5f3; }
.marker { font-family: var(--font-mono); font-weight: 900; font-size: 13px; background-color: #fef3c7; color: #b45309; border: 1px dashed #f59e0b; padding: 8px 12px; border-radius: 6px; }
.compact-field { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.compact-field span { font-size: 11.5px; }
.compact-field select { min-width: 148px; }
.compact-field input { width: 110px; font-family: var(--font-mono); }
.compact-field input:disabled { cursor: not-allowed; opacity: 0.5; background-color: var(--bg-app); }
.processing-order-panel { margin-top: 16px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background-color: var(--bg-app); }
.processing-order-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.processing-order-head > div { display: grid; gap: 2px; }
.processing-order-head strong { font-size: 13px; }
.processing-order-head span { color: var(--text-muted); font-size: 11.5px; }
.processing-order-list { display: grid; gap: 7px; }
.processing-order-item { display: grid; grid-template-columns: 26px 18px minmax(0, 1fr) auto; align-items: center; gap: 8px; min-width: 0; padding: 8px 9px; border: 1px solid var(--border); border-radius: 9px; background-color: var(--bg-panel); }
.processing-order-item:focus { outline: none; border-color: var(--primary-coral); box-shadow: 0 0 0 1px var(--primary-coral); }
.processing-order-item.dragging { opacity: 0.55; border-style: dashed; }
.processing-order-item.inactive { border-color: var(--border); background-color: #f2f1ee; color: var(--text-muted-light); opacity: 0.64; }
.processing-order-item.inactive .processing-order-index { background-color: var(--text-muted-light); }
.processing-order-item.inactive .processing-order-content strong,
.processing-order-item.inactive .processing-order-content span,
.processing-order-item.inactive .processing-order-drag { color: var(--text-muted-light); }
.processing-order-index { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 999px; background-color: var(--primary); color: #fff; font-family: var(--font-mono); font-size: 11px; font-weight: 800; }
.processing-order-drag { color: var(--text-muted-light); cursor: grab; font-weight: 900; letter-spacing: -3px; }
.processing-order-content { display: grid; gap: 1px; min-width: 0; }
.processing-order-content strong { font-size: 12.5px; }
.processing-order-content span { color: var(--text-muted); font-size: 11px; line-height: 1.4; }
.processing-order-actions { display: flex; gap: 3px; }
.processing-order-actions button { padding-inline: 7px; }
.processing-order-warning { margin-top: 9px; min-height: 18px; color: var(--text-muted); font-size: 11.5px; line-height: 1.5; }
.processing-order-warning.warning { color: var(--warning); font-weight: 700; }
.processing-order-warning.success { color: var(--success); font-weight: 700; }

.breakpoint-budget-wrap { margin-top: 16px; padding: 16px; border: 1px solid var(--border); border-radius: 12px; background-color: var(--bg-app); }
.breakpoint-budget-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.breakpoint-budget-head strong { font-size: 13px; }
.breakpoint-budget-head span { color: var(--text-muted); font-family: var(--font-mono); font-size: 11.5px; text-align: right; }
.breakpoint-budget { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.budget-slot { min-height: 42px; display: grid; place-items: center; padding: 7px 8px; border: 1px dashed var(--border-strong); border-radius: 9px; color: var(--text-muted); background-color: var(--bg-panel); font-size: 11.5px; font-weight: 800; text-align: center; }
.budget-slot.head { border-style: solid; border-color: #f7c5bd; background-color: var(--primary-soft); color: var(--primary-coral); }
.budget-slot.anchor { border-style: solid; border-color: #add8c3; background-color: var(--success-soft); color: var(--success); }
.budget-slot.retiring { border-style: solid; border-color: #eccfb3; background-color: var(--warning-soft); color: var(--warning); }
.budget-slot.unavailable { background-color: var(--border); color: var(--text-muted); }
.policy-note { margin: 10px 0 0; line-height: 1.55; }
.policy-warning { margin: 12px 0 2px; padding: 10px 12px; border-left: 3px solid var(--warning); border-radius: 0 8px 8px 0; background-color: var(--warning-soft); line-height: 1.55; }
.policy-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.cache-policy-panel .kv-list { margin-top: 14px; }

.log-toolbar { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 16px; margin-bottom: 16px; }
.log-filters { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.compact-number-field input { width: 104px; }
.log-persistence-note { margin: -4px 0 12px; }
.log-persistence-note.danger { color: var(--danger); font-weight: 700; }
.log-controls { display: flex; align-items: center; gap: 10px; }
.field { display: grid; gap: 6px; font-size: 12px; font-weight: 700; color: var(--text-muted); }
.field select { min-width: 120px; }
.toggle-field { display: inline-flex; align-items: center; gap: 10px; padding: 0 4px; font-size: 13px; font-weight: 800; color: var(--text-main); }
.toggle-field em { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); font-style: normal; margin-left: 4px; }
.table-wrap { overflow: auto; border: 1px solid var(--border-strong); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; min-width: 900px; }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
th { background-color: var(--bg-app); color: var(--text-muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; border-bottom: 1px solid var(--border-strong); }
td { font-size: 13.5px; }
.request-cache-cell { min-width: 280px; font-family: var(--font-sans); }
.request-cache-summary { display: grid; gap: 6px; margin: 0; }
.request-cache-summary-row { display: grid; grid-template-columns: 9em minmax(0, 1fr); gap: 8px; align-items: start; min-width: 0; }
.request-cache-summary-label, .request-cache-summary-value { margin: 0; }
.request-cache-summary-label { color: var(--text-muted); font-size: 11.5px; font-weight: 800; line-height: 1.5; white-space: nowrap; }
.request-cache-summary-value { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; min-width: 0; color: var(--text-main); line-height: 1.5; overflow-wrap: anywhere; }
.request-cache-summary-text { min-width: 0; }
.request-cache-summary-id { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.request-cache-prefix-lock-value .request-cache-appearance-value { color: var(--request-cache-prefix-lock-text); background-color: var(--request-cache-prefix-lock-background); }
.request-cache-cache-anchor-value .request-cache-appearance-value { color: var(--request-cache-cache-anchor-text); background-color: var(--request-cache-cache-anchor-background); }
.request-cache-budget-insufficient-chip { color: var(--request-cache-cache-budget-insufficient-text) !important; background-color: var(--request-cache-cache-budget-insufficient-background) !important; border-color: currentColor !important; }
.request-cache-block-hash-change-chip { color: var(--request-cache-block-hash-change-text) !important; background-color: var(--request-cache-block-hash-change-background) !important; border-color: currentColor !important; }
.request-cache-appearance-value, .meta-value.request-cache-prefix-detail, .meta-value.request-cache-anchor-detail { display: inline-block; max-width: 100%; padding: 1px 6px; border-radius: 5px; }
.meta-value.request-cache-prefix-detail { color: var(--request-cache-prefix-lock-text); background-color: var(--request-cache-prefix-lock-background); }
.meta-value.request-cache-anchor-detail { color: var(--request-cache-cache-anchor-text); background-color: var(--request-cache-cache-anchor-background); }
.request-cache-status-chip { display: inline-flex; align-items: center; min-height: 20px; max-width: 100%; padding: 1px 7px; border: 1px solid var(--border-strong); border-radius: 999px; background-color: var(--bg-app); color: var(--text-muted); font-size: 11.5px; font-weight: 800; line-height: 1.4; white-space: normal; }
.request-cache-status-chip.warning { border-color: #eccfb3; background-color: var(--warning-soft); color: var(--warning); }
.request-cache-status-chip.danger { border-color: #fca5a5; background-color: var(--danger-soft); color: var(--danger); }
tr:hover td { background-color: var(--bg-app); }
.pagination { display: flex; justify-content: center; align-items: center; gap: 12px; margin-top: 14px; }

.drawer { display: none; position: fixed; inset: 0; z-index: 100; }
.drawer.open { display: block; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(25, 25, 25, 0.3); backdrop-filter: blur(1.5px); }
.drawer-panel { position: absolute; right: 0; top: 0; height: 100%; width: min(840px, 98vw); background: var(--bg-panel); border-left: 1px solid var(--border-strong); padding: 28px 32px; overflow: hidden; box-shadow: var(--shadow-popup); display: flex; flex-direction: column; }
.detail-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding-right: 4px; }
.drawer-head { border-bottom: 1px solid var(--border-strong); padding-bottom: 18px; margin-bottom: 20px; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.drawer-head h2 { font-size: 22px; font-weight: 800; margin: 0; }
.drawer-actions { margin-top: auto; padding-top: 18px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.detail-tabs { flex: 0 0 auto; z-index: 3; background: var(--bg-panel); padding-top: 4px; }
.tab { background: none; border: 0; border-bottom: 2px solid transparent; border-radius: 0; box-shadow: none; color: var(--text-muted); padding: 8px 14px; font-size: 13.5px; }
.tab:hover { background-color: var(--bg-hover); color: var(--text-main); transform: none; }
.tab.active { border-bottom-color: var(--primary-coral); color: var(--text-main); }
.meta-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 24px; }
.meta-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.meta-cell { border: 1px solid var(--border); border-radius: 10px; background-color: var(--bg-app); padding: 12px 14px; display: flex; flex-direction: column; gap: 5px; }
.meta-label { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.03em; }
.meta-value { font-size: 16px; font-weight: 800; color: var(--text-main); font-family: var(--font-mono); word-break: break-all; }
.meta-value.coral { color: var(--primary-coral); }
.meta-value.success { color: var(--success); }
.section-label { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 800; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin: 22px 0 12px; }
.section-label::after { content: ""; flex: 1; height: 1px; background-color: var(--border); }
.action-label { justify-content: space-between; }
.action-label::after { display: none; }
.label-actions { display: flex; gap: 8px; flex: none; }
.body-stream { display: flex; flex-direction: column; gap: 10px; }
.msg-card { border: 1px solid var(--border); border-radius: 12px; background-color: var(--bg-panel); overflow: hidden; }
.msg-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; background-color: var(--bg-app); border-bottom: 1px solid var(--border); cursor: pointer; user-select: none; }
.msg-card-head:hover { background-color: var(--bg-hover); }
.msg-left, .msg-right { display: flex; align-items: center; gap: 10px; min-width: 0; }
.msg-right { flex: 1 1 auto; justify-content: flex-end; flex-wrap: wrap; }
.msg-head-hashes { display: inline-flex; justify-content: flex-end; flex-wrap: wrap; gap: 5px 9px; min-width: 0; font-family: var(--font-mono); font-size: 10.5px; color: var(--text-muted-light); }
.msg-head-hash { white-space: nowrap; }
.msg-head-hash.changed { color: var(--primary-coral); font-weight: 900; }
.msg-caret { font-size: 11px; color: var(--text-muted); transition: transform 0.18s ease; }
.msg-card.collapsed:not(.has-cache-breakpoints) .msg-body { display: none; }
.msg-card.collapsed.has-cache-breakpoints .msg-content-block { display: none; }
.msg-card.collapsed.has-cache-breakpoints .msg-body { padding: 0 16px 10px; max-height: none; overflow: visible; }
.msg-card.collapsed:not(.has-cache-breakpoints) .msg-card-head { border-bottom: 0; }
.msg-card.collapsed.has-cache-breakpoints .msg-body > .cache-divider { margin: 10px 0 0; }
.msg-card.collapsed .msg-caret { transform: rotate(-90deg); }
.msg-role { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 800; letter-spacing: 0.04em; }
.role-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.role-dot.system { background-color: #6366f1; }
.role-dot.user { background-color: var(--success); }
.role-dot.assistant { background-color: var(--primary-coral); }
.role-dot.tool { background-color: var(--warning); }
.role-dot.definition { background-color: var(--warning); }
.role-dot.definition { background-color: #8b5cf6; }
.msg-index, .msg-meta { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); }
.msg-meta { white-space: nowrap; }
.msg-index { color: var(--text-muted-light); }
.msg-body { padding: 14px 16px; font-size: 13.5px; line-height: 1.6; color: var(--text-main); white-space: pre-wrap; word-break: break-word; max-height: 220px; overflow-y: auto; }
.msg-content-block + .msg-content-block { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border); }
.msg-content-block > .msg-index { display: block; margin-bottom: 4px; }
.msg-content-text { white-space: pre-wrap; word-break: break-word; }
.msg-body > .cache-divider { margin: 12px 0; }
.msg-body > .unused-cache-divider { margin: 6px 0; }
.msg-card.is-prefix { border-color: #c7d2cb; }
.msg-card.is-prefix .msg-card-head { background-color: var(--success-soft); border-bottom-color: #c7d2cb; }
.cache-divider { display: flex; align-items: center; gap: 12px; margin: 4px 0; padding: 10px 16px; border-radius: 10px; background: repeating-linear-gradient(45deg, var(--success-soft), var(--success-soft) 10px, #e0f1ea 10px, #e0f1ea 20px); border: 1px dashed var(--success); }
.cache-icon { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 7px; background-color: var(--success); color: #fff; flex-shrink: 0; }
.cache-text { display: flex; flex-direction: column; }
.cache-title { font-size: 12.5px; font-weight: 800; color: var(--success); }
.cache-sub { font-family: var(--font-mono); font-size: 11px; color: #4b7a66; }
.cache-divider.fixed-head { border-color: var(--primary-coral); background: repeating-linear-gradient(45deg, var(--primary-soft), var(--primary-soft) 10px, #f8e6e1 10px, #f8e6e1 20px); }
.cache-divider.fixed-head .cache-icon { background-color: var(--primary-coral); }
.cache-divider.fixed-head .cache-title, .cache-divider.fixed-head .cache-sub { color: var(--primary-coral); }
.cache-divider.retiring-anchor { border-color: var(--warning); background: repeating-linear-gradient(45deg, var(--warning-soft), var(--warning-soft) 10px, #f8e8d7 10px, #f8e8d7 20px); }
.cache-divider.retiring-anchor .cache-icon { background-color: var(--warning); }
.cache-divider.retiring-anchor .cache-title, .cache-divider.retiring-anchor .cache-sub { color: var(--warning); }
.cache-divider.unused-cache-divider { min-height: 24px; justify-content: center; padding: 3px 10px; border-color: var(--border-strong); border-style: dashed; border-radius: 7px; background: #f1f0ed; color: var(--text-muted-light); }
.unused-cache-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11.5px; font-weight: 700; line-height: 1.2; }
.breakpoint-diagnostics { display: flex; flex-wrap: wrap; gap: 8px; margin: -2px 0 14px; }
.breakpoint-chip { display: inline-flex; align-items: center; gap: 7px; max-width: 100%; padding: 7px 10px; border: 1px solid var(--border); border-radius: 999px; background-color: var(--bg-app); color: var(--text-muted); font-size: 11.5px; }
.breakpoint-chip strong { color: var(--text-main); white-space: nowrap; }
.breakpoint-chip code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border: 0; padding: 0; background: transparent; color: inherit; }
.breakpoint-chip.empty { border-style: dashed; border-radius: 9px; }
.usage-lines { color: var(--text-main); }
.usage-lines.detail { margin: 0 0 14px; padding: 13px 15px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-app); }
.usage-grid { display: grid; grid-template-columns: minmax(0, 1fr) 1px minmax(0, 1fr); gap: 8px 10px; align-items: stretch; }
.usage-metric { display: grid; justify-items: center; align-content: start; gap: 2px; min-width: 0; text-align: center; }
.usage-grid-divider { width: 1px; align-self: stretch; background-color: var(--border-strong); }
.usage-label { color: var(--text-muted); line-height: 1.25; }
.usage-value { display: inline-block; max-width: 100%; padding: 1px 5px; border-radius: 5px; font-family: var(--font-mono); font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.usage-value-input { color: var(--usage-input-text); background-color: var(--usage-input-background); }
.usage-value-output { color: var(--usage-output-text); background-color: var(--usage-output-background); }
.usage-value-cache-read { color: var(--usage-cache-read-text); background-color: var(--usage-cache-read-background); }
.usage-value-cache-write { color: var(--usage-cache-write-text); background-color: var(--usage-cache-write-background); }
.usage-rate-value.rate-le50 { color: var(--usage-rate-le50-text); background-color: var(--usage-rate-le50-background); }
.usage-rate-value.rate-le70 { color: var(--usage-rate-le70-text); background-color: var(--usage-rate-le70-background); }
.usage-rate-value.rate-le90 { color: var(--usage-rate-le90-text); background-color: var(--usage-rate-le90-background); }
.usage-rate-value.rate-le100 { color: var(--usage-rate-le100-text); background-color: var(--usage-rate-le100-background); }
.usage-value.unavailable { color: var(--text-muted-light); background-color: transparent; font-weight: 700; }
.usage-rate-row { grid-column: 1 / -1; display: flex; align-items: baseline; justify-content: center; gap: 7px; padding-top: 3px; border-top: 1px dashed var(--border); text-align: center; }
.usage-lines.compact { min-width: 178px; font-size: 11.5px; }
.usage-lines.compact .usage-grid { gap: 6px 8px; }
.usage-lines.detail .usage-label { font-size: 13px; }
.usage-lines.detail .usage-value { font-size: 15px; }
.usage-stats.empty { display: block; padding: 12px 14px; border: 1px dashed var(--border-strong); border-radius: 10px; color: var(--text-muted); font-size: 12px; }
.empty-hint { border: 1px dashed var(--border-strong); border-radius: 10px; padding: 18px; color: var(--text-muted); background: var(--bg-app); }

.guide-toc { flex: 0 0 auto; display: flex; flex-wrap: wrap; gap: 8px; padding-bottom: 16px; margin-bottom: 8px; border-bottom: 1px solid var(--border); }
.guide-toc-item { font-size: 12.5px; font-weight: 700; color: var(--text-muted); text-decoration: none; padding: 6px 12px; border: 1px solid var(--border-strong); border-radius: 999px; background-color: var(--bg-panel); transition: all 0.15s ease; }
.guide-toc-item:hover { border-color: var(--text-main); color: var(--text-main); }
.guide-toc-item.active { background-color: var(--text-main); border-color: var(--text-main); color: #fff; }
.guide-body { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; overflow-y: auto; padding-right: 4px; }
.guide-section { padding: 22px 0; border-bottom: 1px dashed var(--border); }
.guide-section:last-child { border-bottom: 0; }
.guide-section h3 { font-size: 18px; font-weight: 800; margin: 0 0 10px; }
.guide-section p { color: var(--text-muted); margin: 0; }
.guide-section ul, .guide-section ol { margin: 0; padding-left: 20px; color: var(--text-muted); display: grid; gap: 8px; }
.guide-section li { line-height: 1.65; }
.guide-section code { font-family: var(--font-mono); font-size: 12px; color: var(--text-main); background-color: var(--bg-app); border: 1px solid var(--border); border-radius: 6px; padding: 1px 5px; }
.guide-callout { margin-top: 12px !important; padding: 12px 14px; border: 1px solid var(--border-strong); border-radius: 12px; background-color: var(--bg-app); }
.guide-placeholder { font-size: 13px; color: var(--text-muted-light); font-style: italic; }

@media (max-width: 980px) {
  body.nav-open { overflow: hidden; }
  .app-shell { grid-template-columns: 1fr; }
  .mobile-menu-button {
    display: inline-flex;
    position: fixed;
    left: 14px;
    bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    z-index: 80;
    min-height: 42px;
    padding: 10px 14px;
    border-radius: 999px;
    background: var(--text-main);
    border-color: var(--text-main);
    color: #fff;
    box-shadow: var(--shadow-popup);
    transition: opacity 0.18s ease, transform 0.18s ease;
  }
  .mobile-menu-button::before { content: "☰"; margin-right: 6px; }
  body.nav-open .mobile-menu-button, body.mobile-menu-hidden .mobile-menu-button { opacity: 0; pointer-events: none; transform: translateY(16px); }
  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgba(25, 25, 25, 0.28);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
  }
  body.nav-open .sidebar-backdrop { opacity: 1; pointer-events: auto; }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(82vw, 300px);
    height: 100vh;
    height: 100dvh;
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow-popup);
    z-index: 70;
    overflow-y: auto;
  }
  body.nav-open .sidebar { transform: translateX(0); }
  .nav { grid-template-columns: 1fr; }
  .main { padding: 18px 14px calc(128px + env(safe-area-inset-bottom, 0px)); }
  .topbar { padding-left: 0; }
  .status-pills { display: flex; flex-wrap: wrap; gap: 6px; }
  .status-pills .pill { flex: 0 1 auto; max-width: 100%; justify-content: center; padding: 5px 9px; font-size: 11.5px; }
  .topbar, .hero-card, .section-head, .set-row, .log-toolbar { flex-direction: column; align-items: stretch; }
  .quick-row { flex-direction: row; align-items: center; }
  .ttl-quick-row { flex-direction: column; align-items: stretch; }
  .quick-controls { justify-content: flex-end; }
  #quickTtlSeg { width: 100%; }
  #quickTtlSeg button { min-width: 0; padding-inline: 7px; }
  .set-control, .compact-field { width: 100%; }
  .set-control > .seg { width: 100%; }
  .set-control > .seg button { min-width: 0; padding-inline: 8px; }
  .marker-options { justify-content: flex-start; }
  .compact-field { justify-content: space-between; }
  .compact-field select, .compact-field input { min-width: min(62vw, 230px); }
  .breakpoint-budget-head { align-items: flex-start; flex-direction: column; }
  .breakpoint-budget-head span { text-align: left; }
  .budget-slot { min-height: 52px; padding: 6px 4px; }
  .policy-actions { display: grid; grid-template-columns: 1fr; }
  .log-controls { justify-content: space-between; }
  .stat-grid, .stat-grid.three, .two-col, .channel-grid, .advanced-grid, .usage-appearance-layout, .usage-color-grid, .meta-grid, .meta-grid.three, .prompt-map, .channel-form .form-row { grid-template-columns: 1fr; }
  .usage-preview-box { position: static; }
  .request-cache-appearance-layout { grid-template-columns: 1fr; }
  .config-management-actions { justify-content: flex-start; }
  .processing-order-head { align-items: stretch; flex-direction: column; }
  .processing-order-item { grid-template-columns: 26px 18px minmax(0, 1fr); }
  .processing-order-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .usage-sample-grid { grid-template-columns: 1fr; }
  .usage-sample-grid label:last-child { grid-column: auto; }
  .anchor-ignore-control { justify-content: flex-start; }
  .quick-panel { order: -1; }
  .table-wrap { overflow: visible; border: 0; border-radius: 0; }
  table { min-width: 0; border-collapse: separate; border-spacing: 0 12px; }
  thead { display: none; }
  tbody, tr, td { display: block; width: 100%; }
  tr { padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-panel); box-shadow: var(--shadow-flat); }
  tr:hover td { background: transparent; }
  td { display: block; padding: 7px 0; border-bottom: 1px dashed var(--border); font-size: 13px; line-height: 1.5; word-break: break-word; }
  td:last-child { border-bottom: 0; }
  td::before { content: attr(data-label); display: block; margin-bottom: 3px; color: var(--text-muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; }
  td small { color: var(--text-muted); }
  .request-cache-cell { min-width: 0; }
  .request-cache-summary-row { grid-template-columns: 8.5em minmax(0, 1fr); }
  .log-action-cell { padding-top: 4px; padding-bottom: 2px; }
  .log-action-cell::before { display: none; }
  .log-action-cell button { width: 100%; }
  .drawer-panel { width: 100vw; height: 100vh; height: 100dvh; padding: 22px 22px calc(34px + env(safe-area-inset-bottom, 0px)); }
  .guide-toc { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 10px; }
  .guide-toc-item { flex: 0 0 auto; }
  .tabs { overflow-x: auto; padding-bottom: 4px; }
  .detail-tabs { margin-left: -22px; margin-right: -22px; padding-left: 22px; padding-right: 22px; }
  .tab { flex: 0 0 auto; }
  .msg-card-head { align-items: flex-start; flex-wrap: wrap; }
  .msg-right { margin-left: auto; }
  #detailPre { min-height: 52vh; }
  .kv { grid-template-columns: 1fr; gap: 4px; }
}
