:root {
  color-scheme: light;
  --bg: #f4f6fb;
  --card: #fff;
  --ink: #1c2745;
  --secondary: #4f607e;
  --muted: #8793ab;
  --line: #e7ebf3;
  --line-strong: #d9dfec;
  --primary: #5c5ce8;
  --primary-hover: #4b4bd0;
  --primary-soft: #efefff;
  --positive: #168e82;
  --positive-soft: #e9f7f3;
  --negative: #dc6465;
  --negative-soft: #fff0ef;
  --amber: #bc801b;
  --amber-soft: #fff4db;
  --shadow: 0 3px 16px rgb(31 44 82 / 3%);
  --radius: 13px;
  font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  font-size: 14px;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--bg); line-height: 1.6; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .46; }
button, input, select, textarea, a { outline: none; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 3px solid #9b9bfb; outline-offset: 3px;
}
button { transition: color .14s, background .14s, border-color .14s, box-shadow .14s; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); width: 17px; height: 17px; vertical-align: middle; }
input[type="range"] { accent-color: var(--primary); min-height: 26px; }
[hidden] { display: none !important; }
a { color: var(--primary); text-decoration: none; }
h1, h2, h3, h4, p { margin-top: 0; }
h1 { font-size: 23px; line-height: 1.4; letter-spacing: -.5px; margin-bottom: 7px; }
h2 { font-size: 18px; line-height: 1.5; margin-bottom: 0; }
h3 { font-size: 16px; line-height: 1.5; margin-bottom: 0; }
small { font-size: 12px; }
svg { flex-shrink: 0; }
.app-header { min-height: 86px; display: flex; align-items: center; gap: 44px; padding: 0 30px; background: white; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); flex-shrink: 0; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; background: var(--primary); color: white; box-shadow: 0 4px 12px #5c5ce81c; }
.brand-mark svg { width: 33px; height: 33px; }
.brand-title { font-size: 20px; font-weight: 700; letter-spacing: .2px; line-height: 1.45; }
.brand-title small { display: block; font-size: 9px; letter-spacing: 1.9px; color: #96a0b5; font-weight: 600; }
.main-nav { display: flex; align-self: stretch; gap: 28px; }
.nav-tab { position: relative; border: 0; background: none; padding: 0 9px; color: var(--secondary); font-weight: 500; font-size: 15px; white-space: nowrap; }
.nav-tab:hover { color: var(--primary); }
.nav-tab.active, .nav-tab.is-active, .nav-tab[aria-current="page"] { color: var(--primary); font-weight: 700; }
.nav-tab.active::after, .nav-tab.is-active::after, .nav-tab[aria-current="page"]::after { content: ""; position: absolute; bottom: 0; left: 4px; right: 4px; height: 3px; border-radius: 3px 3px 0 0; background: var(--primary); }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 20px; }
.header-tools { display: flex; align-items: center; gap: 4px; }
.header-tools .btn { font-size: 12px; padding: 7px 8px; min-height: 32px; }
.app-main { max-width: 1800px; margin: 0 auto; padding: 24px 26px 30px; }
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.page-heading p, .page-subtitle { margin: 0; font-size: 13px; color: var(--muted); }
.eyebrow { color: var(--muted); font-size: 10px; font-weight: 600; letter-spacing: 1.5px; text-transform: uppercase; }
.muted { color: var(--muted); }
.secondary { color: var(--secondary); }
.positive, .profit-positive, .win { color: var(--positive) !important; }
.negative, .profit-negative, .loss { color: var(--negative) !important; }
.neutral, .rest { color: var(--muted) !important; }
.draw, .tie { color: var(--amber) !important; }
.mono, .amount, .numeric { font-variant-numeric: tabular-nums; }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.flex { display: flex; align-items: center; gap: 10px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.spacer { flex: 1; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 39px; padding: 8px 15px; border: 1px solid var(--line-strong); border-radius: 7px; background: white; color: var(--secondary); font-size: 13px; font-weight: 500; white-space: nowrap; line-height: 1.4; }
.btn:hover:not(:disabled) { border-color: #b8b8ed; color: var(--primary); background: #fafaff; }
.btn-primary { color: white; border-color: var(--primary); background: var(--primary); box-shadow: 0 3px 8px #5c5ce815; }
.btn-primary:hover:not(:disabled) { color: white; background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-secondary { background: var(--primary-soft); border-color: #e2e2fc; color: var(--primary); }
.btn-danger { background: white; border-color: #f0d8d8; color: var(--negative); }
.btn-danger:hover:not(:disabled) { color: #c54749; background: var(--negative-soft); border-color: #dfb4b4; }
.btn-quiet, .btn-link { background: transparent; border-color: transparent; color: var(--muted); box-shadow: none; }
.btn-link { color: var(--primary); }
.btn-sm { min-height: 31px; padding: 5px 10px; font-size: 12px; }
.btn-icon { width: 34px; min-height: 34px; padding: 6px; }
.btn-block { width: 100%; }
.btn svg { width: 16px; height: 16px; }
.badge { display: inline-flex; align-items: center; justify-content: center; gap: 5px; padding: 3px 8px; border-radius: 5px; font-size: 11px; font-weight: 500; line-height: 1.6; white-space: nowrap; }
.badge-sim { color: #aa7617; background: var(--amber-soft); }
.header-actions > .badge-sim { padding: 6px 11px; border-radius: 20px; font-size: 11px; }
.badge-primary { color: var(--primary); background: var(--primary-soft); }
.badge-success { color: var(--positive); background: var(--positive-soft); }
.badge-muted { background: #f0f2f7; color: #7c88a0; }
.badge-danger { background: var(--negative-soft); color: var(--negative); }
.chip { display: inline-flex; align-items: center; padding: 4px 9px; border-radius: 5px; color: #6768a4; background: #f0f0fb; font-size: 11px; line-height: 1.5; white-space: nowrap; }
.chip-row, .tags { display: flex; flex-wrap: wrap; gap: 6px; }
.settings-layout { display: grid; grid-template-columns: 245px minmax(480px, 1fr) 282px; gap: 18px; align-items: start; }
.sidebar, .editor-panel, .summary-panel, .section-card, .chat-panel, .balance-panel, .timeline-panel { min-width: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.sidebar { padding: 18px 12px 14px; display: flex; flex-direction: column; min-height: 710px; }
.sidebar-header { padding: 0 5px 15px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sidebar-header h2 { font-size: 16px; }
.sidebar-header .count, .role-count { margin-left: 6px; color: var(--muted); font-size: 12px; font-weight: 400; }
.sidebar-header .btn { font-size: 11px; min-height: 32px; padding: 6px 9px; }
.search-wrap { position: relative; margin: 0 4px 15px; }
.search-wrap input { padding-left: 33px; background: #fafbfd; }
.search-icon { position: absolute; left: 11px; top: 10px; color: var(--muted); }
.role-list { display: flex; flex-direction: column; gap: 6px; overflow-y: auto; max-height: 690px; scrollbar-width: thin; scrollbar-color: #d8dcea transparent; }
.role-item { display: flex; align-items: center; width: 100%; gap: 11px; padding: 14px 11px; text-align: left; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--ink); }
.role-item:hover { background: #f7f8fc; }
.role-item.is-selected, .role-item.active, .role-item[aria-selected="true"] { background: var(--primary-soft); border-color: #e5e5ff; }
.role-avatar { width: 42px; height: 42px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; border-radius: 50%; background: #e7e4ff; color: #7270b8; font-size: 18px; font-weight: 600; }
.role-avatar.large { width: 66px; height: 66px; font-size: 25px; }
.role-avatar.small { width: 34px; height: 34px; font-size: 14px; }
.role-meta { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.role-meta strong { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.role-meta small, .role-meta span { color: var(--muted); font-size: 11px; }
.role-item.is-selected .role-meta small { color: #7b79aa; }
.sidebar-footer { margin-top: auto; padding: 20px 5px 0; }
.sidebar-footer .btn { width: 100%; }
.sidebar-note { padding: 11px 7px 0; color: var(--muted); font-size: 11px; text-align: center; }
.editor-panel { padding: 23px; }
.editor-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.editor-header h1 { font-size: 22px; margin-bottom: 5px; }
.editor-header p { color: var(--muted); font-size: 12px; margin: 0; }
.editor-header .field { max-width: 160px; }
.section-card { padding: 18px; margin-bottom: 15px; box-shadow: none; border-radius: 9px; }
.section-card:last-child { margin-bottom: 0; }
.section-title { display: flex; align-items: center; gap: 9px; font-size: 15px; font-weight: 650; margin-bottom: 16px; }
.section-title svg { width: 18px; height: 18px; color: var(--primary); }
.section-icon { display: grid; place-items: center; width: 25px; height: 25px; color: var(--primary); background: var(--primary-soft); border-radius: 7px; font-size: 13px; }
.section-title .muted { margin-left: auto; font-size: 11px; font-weight: 400; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 15px; }
.section-heading .section-title { margin-bottom: 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.form-grid.three, .form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid .full, .field.full, .span-2 { grid-column: 1 / -1; }
.field { min-width: 0; display: flex; flex-direction: column; gap: 7px; }
.field > label, .field-label { color: var(--secondary); font-size: 12px; line-height: 1.5; }
.field label strong { font-weight: 500; }
.control, input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]), select, textarea { width: 100%; min-height: 37px; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 6px; background: white; color: var(--ink); font-size: 13px; line-height: 1.45; }
select { padding-right: 25px; }
textarea { min-height: 90px; resize: vertical; }
input::placeholder, textarea::placeholder { color: #a4aec0; }
input:hover, select:hover, textarea:hover { border-color: #c3c9dd; }
input:focus, select:focus, textarea:focus { border-color: #9696e8; }
input:disabled, select:disabled { background: #f7f8fb; color: var(--muted); }
.control[aria-invalid="true"], input[aria-invalid="true"] { border-color: var(--negative); }
.field-help, .form-hint { color: var(--muted); font-size: 11px; line-height: 1.65; margin: 0; }
.field-help.negative { font-weight: 500; }
.input-unit { display: flex; align-items: center; border: 1px solid var(--line-strong); border-radius: 6px; overflow: hidden; background: white; }
.input-unit input { min-width: 0; border: 0 !important; border-radius: 0 !important; }
.input-unit > span { color: var(--muted); background: #f8f9fc; align-self: stretch; padding: 8px 10px; font-size: 12px; border-left: 1px solid var(--line); }
.input-unit:focus-within { border-color: #9696e8; box-shadow: 0 0 0 2px #5c5ce812; }
.inline-fields { display: flex; gap: 10px; align-items: center; }
.inline-fields > * { flex: 1; min-width: 0; }
.inline-fields > .separator { flex: 0; color: var(--muted); }
.segmented { display: flex; padding: 3px; gap: 3px; border-radius: 7px; background: #f6f7fb; border: 1px solid var(--line); }
.segmented button, .segmented label { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; padding: 7px 8px; border: 1px solid transparent; border-radius: 5px; background: transparent; color: var(--secondary); font-size: 12px; line-height: 1.5; text-align: center; cursor: pointer; }
.segmented button:hover { color: var(--primary); background: white; }
.segmented .is-active, .segmented .active, .segmented [aria-pressed="true"], .segmented label:has(input:checked) { color: var(--primary); background: white; border-color: #e2e2f7; font-weight: 600; box-shadow: 0 1px 3px #44446608; }
.segmented input[type="radio"] { position: absolute; opacity: 0; width: 0; height: 0; }
.segmented label:has(input:focus-visible) { outline: 3px solid #9b9bfb; outline-offset: 1px; }
.amount-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.amount-item { padding: 10px; border: 1px solid var(--line); border-radius: 7px; background: #fafbfd; }
.amount-item .inline-fields { gap: 5px; }
.amount-item input { padding: 6px !important; min-height: 32px !important; }
.amount-item label { display: block; color: var(--muted); font-size: 11px; margin-bottom: 6px; }
.checkbox-field, .toggle-row { display: flex; align-items: center; gap: 9px; color: var(--secondary); font-size: 12px; }
.toggle { position: relative; width: 34px; height: 20px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 100%; height: 100%; margin: 0; position: absolute; z-index: 1; cursor: pointer; }
.toggle span { display: block; width: 34px; height: 20px; border-radius: 20px; background: #d5daE5; transition: background .15s; }
.toggle span::after { content: ""; width: 16px; height: 16px; position: absolute; left: 2px; top: 2px; border-radius: 50%; background: white; box-shadow: 0 1px 3px #0002; transition: transform .15s; }
.toggle input:checked + span { background: var(--primary); }
.toggle input:checked + span::after { transform: translateX(14px); }
.toggle input:focus-visible + span { outline: 3px solid #9b9bfb; outline-offset: 3px; }
.summary-panel { padding: 20px; }
.summary-panel > h2 { font-size: 16px; margin-bottom: 24px; }
.summary-identity { display: flex; gap: 12px; align-items: center; padding-bottom: 22px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.summary-identity h3 { margin: 0 0 7px; font-size: 18px; }
.summary-identity .chip { font-size: 10px; padding: 3px 6px; }
.summary-lines, .summary-list { color: var(--secondary); font-size: 13px; line-height: 2; padding: 0; margin: 0 0 21px; list-style: none; }
.summary-list li { margin-bottom: 6px; }
.summary-list li::before { content: ""; display: inline-block; width: 4px; height: 4px; background: #adaddb; border-radius: 50%; margin-right: 9px; vertical-align: middle; }
.summary-card { padding: 15px; margin-top: 16px; border: 1px solid var(--line); border-radius: 9px; }
.summary-card h3 { font-size: 13px; margin: 0 0 12px; }
.summary-card.tinted, .message-preview { background: #f2f4ff; border-color: transparent; }
.mini-chat { display: flex; align-items: center; gap: 9px; margin: 12px 0; }
.mini-chat .role-avatar { width: 31px; height: 31px; font-size: 13px; }
.chat-bubble { display: inline-block; width: fit-content; padding: 9px 17px; border-radius: 4px 11px 11px 11px; color: #3e4480; background: #ececfd; font-size: 14px; font-weight: 500; font-variant-numeric: tabular-nums; }
.message-preview .chat-bubble, .tinted .chat-bubble { background: white; }
.validation-success { display: flex; align-items: center; gap: 9px; color: var(--positive); font-weight: 600; font-size: 14px; }
.validation-success::before { content: "✓"; display: grid; place-items: center; width: 23px; height: 23px; background: var(--positive-soft); border-radius: 50%; }
.actions-bar { display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin-top: 21px; padding-top: 18px; border-top: 1px solid var(--line); }
.actions-bar .muted { margin-right: auto; font-size: 11px; }
.page-footer { display: flex; justify-content: space-between; align-items: center; gap: 15px; color: var(--muted); font-size: 11px; padding: 20px 2px 0; }
.preview-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 11px; margin-bottom: 18px; }
.preview-toolbar select { width: auto; min-width: 130px; background: white; }
.preview-toolbar .segmented { min-width: 190px; }
.preview-toolbar .toolbar-note { font-size: 11px; color: var(--muted); }
.preview-toolbar .toolbar-actions { display: flex; gap: 10px; margin-left: auto; }
.stats-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 15px; margin-bottom: 19px; }
.stat-card { display: flex; align-items: center; gap: 14px; padding: 17px 19px; border: 1px solid var(--line); border-radius: 10px; background: white; box-shadow: var(--shadow); min-width: 0; }
.stat-icon { display: flex; align-items: center; justify-content: center; color: #7777d6; background: #f2f2ff; border-radius: 9px; width: 37px; height: 37px; flex-shrink: 0; }
.stat-icon svg { width: 21px; height: 21px; }
.stat-card .label, .stat-label { font-size: 11px; color: var(--muted); margin-bottom: 3px; }
.stat-card .value, .stat-value { font-size: 23px; font-weight: 650; letter-spacing: -.5px; line-height: 1.4; font-variant-numeric: tabular-nums; }
.stat-card small { color: var(--muted); font-size: 11px; font-weight: 400; margin-left: 4px; }
.preview-grid { display: grid; grid-template-columns: minmax(0, .91fr) minmax(0, 1.09fr); gap: 18px; align-items: start; }
.chat-panel { overflow: hidden; }
.panel-heading, .chat-panel-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 21px; border-bottom: 1px solid var(--line); }
.panel-heading h2, .chat-panel-header h2 { font-size: 15px; }
.panel-heading p { margin: 2px 0 0; color: var(--muted); font-size: 11px; }
.panel-heading .muted { font-size: 11px; }
.chat-feed { padding: 0 22px 18px; overflow-y: auto; height: 626px; scrollbar-width: thin; scrollbar-color: #d7dcea transparent; scroll-behavior: smooth; }
.round-divider { display: flex; align-items: center; gap: 13px; color: #8d98ae; font-size: 11px; margin: 23px 0 18px; }
.round-divider::before, .round-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.round-divider .badge { font-size: 10px; }
.chat-message { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 13px; }
.chat-message .role-avatar { width: 34px; height: 34px; font-size: 14px; }
.message-body { min-width: 0; flex: 1; }
.message-meta { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; font-size: 11px; }
.message-meta strong { font-size: 12px; font-weight: 600; }
.message-meta time, .message-time { color: #a1a9bb; font-size: 10px; margin-left: auto; }
.message-meta .badge { padding: 1px 5px; font-size: 9px; }
.system-result { margin: 10px 0 8px 44px; max-width: 400px; border-radius: 7px; padding: 11px 13px; background: #f7f8fb; border: 1px solid #eef0f6; color: var(--secondary); font-size: 12px; }
.system-result strong { font-weight: 600; }
.system-result .result-title { display: flex; align-items: center; gap: 7px; margin-bottom: 3px; }
.system-result .result-details { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 17px; font-variant-numeric: tabular-nums; font-size: 11px; }
.behavior-reason, .chat-reason { color: var(--muted); font-size: 11px; margin: 6px 0 0 44px; }
.rest-message { margin-left: 44px; color: #99a1b3; font-size: 12px; padding: 9px 12px; border-left: 2px solid #e3e6f0; background: #fafbfc; border-radius: 0 5px 5px 0; }
.chat-footer { padding: 9px 15px 12px; font-size: 11px; color: var(--muted); text-align: center; border-top: 1px solid #f1f3f8; }
.preview-right { display: flex; flex-direction: column; gap: 15px; min-width: 0; }
.balance-panel { padding: 18px 20px; }
.balance-panel h2 { font-size: 15px; }
.balance-chart { position: relative; margin-top: 12px; min-height: 190px; }
.balance-chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.balance-chart text { font-family: inherit; font-size: 10px; fill: #93a0b5; }
.balance-chart .chart-grid { stroke: #edf0f7; stroke-dasharray: 4 5; }
.balance-chart .chart-line { stroke: var(--primary); fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.balance-chart .chart-dot { fill: white; stroke: var(--primary); stroke-width: 2.5; }
.balance-chart .chart-active { fill: var(--primary); stroke: white; stroke-width: 3; }
.chart-summary { display: grid; grid-template-columns: repeat(3, 1fr); padding: 12px 0 0; margin-top: 5px; border-top: 1px solid var(--line); }
.chart-summary > div { padding: 0 14px; border-right: 1px solid var(--line); text-align: center; }
.chart-summary > div:last-child { border: 0; }
.chart-summary span { color: var(--muted); font-size: 10px; display: block; }
.chart-summary strong { display: block; font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.insight-card { padding: 16px 19px; border: 1px solid #e5e5f8; border-radius: 10px; background: #f0f1ff; }
.insight-card h3 { font-size: 13px; color: var(--primary); margin-bottom: 10px; }
.insight-card p { color: #797e9f; font-size: 12px; line-height: 1.8; margin: 0; }
.insight-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.insight-grid > div { text-align: center; border-right: 1px solid #dedff1; }
.insight-grid > div:last-child { border: 0; }
.insight-grid strong { display: block; font-size: 12px; font-weight: 600; }
.insight-grid span { display: block; color: #8086a5; font-size: 10px; margin-top: 3px; }
.table-panel { background: white; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.table-panel .panel-heading { border-bottom: 0; padding: 15px 18px 12px; }
.table-wrap { overflow-x: auto; overflow-y: auto; max-height: 264px; scrollbar-width: thin; scrollbar-color: #d8dcea transparent; }
.data-table { width: 100%; border-collapse: collapse; font-size: 12px; text-align: left; font-variant-numeric: tabular-nums; }
.data-table th { position: sticky; top: 0; z-index: 1; background: #f8f9fc; color: #8792a8; font-size: 10px; font-weight: 500; padding: 9px 12px; white-space: nowrap; }
.data-table td { padding: 9px 12px; border-top: 1px solid #f0f2f8; color: var(--secondary); white-space: nowrap; }
.data-table tr.is-active td, .data-table tr.active td, .data-table tr[aria-selected="true"] td { background: #f0f1ff; }
.data-table tbody tr:hover td { background: #f8f8ff; }
.data-table tbody tr { cursor: pointer; }
.data-table td:last-child, .data-table th:last-child { text-align: right; }
.data-table td.reason-cell { white-space: normal; min-width: 140px; max-width: 240px; font-size: 11px; }
.table-footer { padding: 9px 15px; color: var(--muted); font-size: 10px; text-align: right; border-top: 1px solid var(--line); }
.timeline-panel { margin-top: 18px; padding: 17px 20px 14px; }
.timeline-header { display: flex; justify-content: space-between; gap: 14px; align-items: center; margin-bottom: 12px; }
.timeline-header h2 { font-size: 15px; }
.timeline-legend { display: flex; align-items: center; gap: 14px; font-size: 10px; color: var(--muted); }
.legend-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: currentColor; margin-right: 5px; }
.timeline { display: grid; grid-template-columns: repeat(20, minmax(0, 1fr)); gap: 5px; }
.timeline-step { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 53px; padding: 6px 2px; border: 1px solid var(--line); border-radius: 6px; background: white; color: var(--secondary); font-size: 10px; }
.timeline-step strong { font-size: 12px; font-weight: 600; }
.timeline-step:hover { border-color: #b6b6ec; background: #fafaff; }
.timeline-step.is-active, .timeline-step.active, .timeline-step[aria-current="step"] { color: var(--primary); border-color: var(--primary); background: #f2f2ff; box-shadow: 0 0 0 1px #5c5ce810; }
.timeline-step.is-future { opacity: .5; }
.timeline-step .round-number { color: var(--secondary); font-size: 11px; }
.playback-controls { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 9px; margin-top: 15px; }
.playback-controls .btn { min-height: 33px; font-size: 12px; padding: 6px 12px; }
.playback-controls select { width: 75px; min-height: 33px; font-size: 12px; padding-top: 5px; padding-bottom: 5px; }
.playback-progress { margin-left: 10px; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.playback-note { margin-top: 11px; color: var(--muted); font-size: 10px; text-align: center; }
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 55px 24px; min-height: 230px; color: var(--muted); }
.empty-state .empty-icon { font-size: 32px; color: #aaaade; margin-bottom: 15px; }
.empty-state h2, .empty-state h3 { color: var(--ink); font-size: 17px; margin-bottom: 9px; }
.empty-state p { font-size: 13px; margin-bottom: 20px; max-width: 370px; }
.error-summary { background: #fff5f3; border: 1px solid #f1d8d3; border-radius: 7px; padding: 12px 15px; font-size: 12px; color: #bc5a50; margin-bottom: 16px; }
.error-summary ul { margin: 4px 0 0; padding-left: 18px; }
.info-banner { background: #f3f4ff; border: 1px solid #e4e5fc; border-radius: 7px; padding: 11px 14px; font-size: 12px; color: #777ba0; margin-bottom: 15px; }
.modal { width: min(660px, calc(100vw - 32px)); max-height: calc(100vh - 60px); border: 1px solid var(--line); border-radius: 15px; padding: 0; color: var(--ink); background: white; box-shadow: 0 25px 90px #17213d2e; }
.modal::backdrop { background: #17213b55; backdrop-filter: blur(3px); }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; padding: 23px 25px 18px; border-bottom: 1px solid var(--line); }
.modal-header h2 { font-size: 19px; margin-bottom: 4px; }
.modal-header p { margin: 0; color: var(--muted); font-size: 12px; }
.modal-body { padding: 21px 25px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 9px; padding: 17px 25px; border-top: 1px solid var(--line); background: #fcfcfe; }
.batch-preview { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin-top: 17px; }
.toast { position: fixed; bottom: 25px; left: 50%; transform: translate(-50%, 12px); opacity: 0; pointer-events: none; max-width: min(560px, calc(100vw - 32px)); padding: 11px 19px; background: #29334e; color: white; font-size: 13px; border-radius: 9px; box-shadow: 0 7px 30px #17213b25; z-index: 100; transition: opacity .2s, transform .2s; text-align: center; }
.toast.show, .toast.is-visible, .toast.visible { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: #a34b4f; }
.loading-state { min-height: 70vh; display: flex; align-items: center; justify-content: center; gap: 12px; color: var(--muted); }
.loading-dot { display: block; width: 10px; height: 10px; background: var(--primary); border-radius: 50%; animation: breathe 1s ease-in-out infinite alternate; }
.noscript-notice { padding: 30px; color: var(--negative); background: white; text-align: center; }
@keyframes breathe { to { opacity: .25; transform: scale(.7); } }
@media (min-width: 1600px) {
  .settings-layout { grid-template-columns: 270px minmax(560px, 1fr) 315px; gap: 22px; }
  .editor-panel { padding: 27px; }
  .section-card { padding: 21px; }
  .form-grid { gap: 17px 23px; }
  .sidebar { min-height: 760px; }
}
@media (max-width: 1250px) {
  .app-header { gap: 28px; padding: 0 22px; }
  .brand-title { font-size: 18px; }
  .header-actions { gap: 9px; }
  .header-tools { display: none; }
  .app-main { padding: 20px; }
  .settings-layout { grid-template-columns: 210px minmax(420px, 1fr) 248px; gap: 13px; }
  .editor-panel { padding: 18px; }
  .section-card { padding: 15px; }
  .summary-panel { padding: 17px; }
  .summary-identity { gap: 9px; }
  .summary-identity .role-avatar.large { width: 52px; height: 52px; font-size: 21px; }
  .stat-card { padding: 15px 13px; gap: 10px; }
  .stat-card .value, .stat-value { font-size: 21px; }
  .stat-icon { width: 31px; height: 31px; }
  .stats-grid { gap: 10px; }
  .segmented button, .segmented label { padding: 7px 5px; font-size: 11px; }
  .form-grid { gap: 12px; }
}
@media (max-width: 1080px) {
  .settings-layout { grid-template-columns: 210px minmax(0, 1fr); }
  .summary-panel { grid-column: 2; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
  .summary-panel > h2 { grid-column: 1 / -1; margin-bottom: 0; }
  .summary-panel .summary-card { margin: 0; }
  .summary-panel .summary-identity { margin: 0; border: 0; padding: 0; }
  .sidebar { grid-row: span 2; }
  .preview-grid { gap: 14px; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); }
  .stat-icon { display: none; }
  .preview-toolbar .toolbar-note { display: none; }
  .chat-feed { padding-left: 15px; padding-right: 15px; }
  .timeline { gap: 4px; }
  .timeline-step { min-height: 49px; }
}
@media (max-width: 900px) {
  .app-header { flex-wrap: wrap; gap: 0 22px; padding: 15px 20px 0; min-height: 104px; }
  .brand { flex: 1; }
  .brand-mark { width: 35px; height: 35px; border-radius: 10px; }
  .brand-mark svg { width: 29px; height: 29px; }
  .brand-title { font-size: 17px; }
  .brand-title small { font-size: 8px; }
  .header-actions { order: 1; }
  .main-nav { order: 2; width: 100%; height: 43px; margin-top: 7px; }
  .nav-tab { font-size: 13px; padding: 0 12px; }
  .app-main { padding: 17px; }
  .settings-layout { grid-template-columns: 1fr; gap: 15px; }
  .sidebar { min-height: 0; grid-row: auto; padding: 14px; }
  .sidebar-header { padding: 0 0 10px; }
  .search-wrap { margin: 0 0 12px; }
  .role-list { flex-direction: row; max-height: none; overflow-x: auto; overflow-y: hidden; padding-bottom: 4px; }
  .role-item { flex: 0 0 168px; padding: 10px; }
  .role-avatar { width: 36px; height: 36px; font-size: 15px; }
  .sidebar-footer { margin-top: 5px; padding: 5px 0 0; }
  .sidebar-footer .btn { width: auto; }
  .sidebar-note { display: none; }
  .summary-panel { grid-column: auto; }
  .preview-grid { grid-template-columns: 1fr; }
  .chat-feed { height: 460px; }
  .stats-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
  .stat-card { padding: 13px 10px; }
  .stat-card .value, .stat-value { font-size: 18px; }
  .stat-card .label, .stat-label { font-size: 10px; }
  .timeline { grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 6px; }
  .timeline-header { align-items: flex-start; }
  .preview-toolbar .toolbar-actions { margin-left: 0; }
  .header-tools { display: flex; }
  .header-tools .btn { font-size: 10px; padding: 4px; }
}
@media (max-width: 600px) {
  .app-header { padding: 13px 14px 0; }
  .brand-title { font-size: 15px; }
  .brand { gap: 8px; }
  .header-actions > .badge-sim { font-size: 9px; padding: 4px 7px; }
  .header-tools { display: none; }
  .app-main { padding: 12px; }
  .editor-panel, .summary-panel { padding: 15px; }
  .editor-header { flex-direction: column; gap: 12px; }
  .editor-header h1 { font-size: 20px; }
  .editor-header .field { max-width: none; width: 100%; }
  .section-card { padding: 13px; }
  .form-grid { grid-template-columns: 1fr; gap: 13px; }
  .form-grid.three, .form-grid-3 { grid-template-columns: 1fr; }
  .amount-row { gap: 6px; }
  .amount-item { padding: 7px; }
  .amount-item .inline-fields { flex-direction: column; align-items: stretch; }
  .segmented { flex-wrap: wrap; }
  .segmented button, .segmented label { min-width: 44px; }
  .summary-panel { display: flex; flex-direction: column; }
  .summary-panel .summary-identity { padding-bottom: 14px; }
  .summary-lines, .summary-list { margin-bottom: 0; }
  .actions-bar { flex-wrap: wrap; }
  .actions-bar .muted { flex-basis: 100%; }
  .actions-bar .btn { flex: 1; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-card:last-child { grid-column: 1 / -1; }
  .stat-card { padding: 13px 15px; }
  .stat-icon { display: flex; }
  .stat-card .value, .stat-value { font-size: 21px; }
  .preview-toolbar { gap: 8px; }
  .preview-toolbar select { flex: 1; min-width: 105px; }
  .preview-toolbar .segmented { flex: 1; min-width: 170px; }
  .preview-toolbar .toolbar-actions { width: 100%; }
  .preview-toolbar .toolbar-actions .btn { flex: 1; }
  .panel-heading, .chat-panel-header { padding: 14px 15px; }
  .panel-heading h2, .chat-panel-header h2 { font-size: 14px; }
  .chat-feed { height: 440px; padding: 0 13px 15px; }
  .balance-panel { padding: 15px; }
  .balance-chart { min-height: 150px; }
  .insight-grid { gap: 8px; }
  .timeline-panel { padding: 14px 12px; }
  .timeline-header { flex-direction: column; gap: 6px; }
  .timeline-legend { gap: 10px; font-size: 9px; }
  .timeline { gap: 4px; }
  .timeline-step { min-height: 46px; font-size: 9px; }
  .timeline-step strong { font-size: 11px; }
  .playback-controls { gap: 6px; }
  .playback-controls .btn { padding: 6px 9px; font-size: 11px; }
  .playback-progress { margin-left: 0; }
  .page-footer { flex-direction: column; align-items: flex-start; gap: 4px; font-size: 10px; }
  .modal-header, .modal-body, .modal-footer { padding: 18px; }
  .modal { max-height: calc(100vh - 30px); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* Live application components. */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.live-connection-card { display: flex; justify-content: space-between; align-items: flex-start; gap: 22px; padding: 19px 21px; background: white; border: 1px solid var(--line); border-radius: 11px; margin-bottom: 18px; }
.live-connection-card strong { font-size: 14px; }
.live-connection-card p { color: var(--secondary); font-size: 12px; margin: 6px 0 0; line-height: 1.9; }
.live-connection-card p.field-help { font-size: 11px; color: var(--muted); }
.live-connection-flags { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; flex-shrink: 0; max-width: 320px; }
.live-toolbar, .live-select-actions, .live-status-actions, .live-batch-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.live-toolbar { justify-content: space-between; margin: 17px 0 12px; }
.live-toolbar .muted { font-size: 11px; }
.live-status-actions .switch-field { min-height: 30px; font-size: 11px; }
.live-batch-actions { margin-bottom: 16px; }
.live-batch-actions > .field-help { margin-left: auto; }
.live-table-card { padding: 0; overflow: hidden; margin-bottom: 18px; }
.live-table-wrap { overflow: auto; max-height: 590px; scrollbar-width: thin; }
.live-table { min-width: 850px; }
.live-table th { position: sticky; top: 0; z-index: 1; }
.live-table td, .live-table th { text-align: left !important; padding: 13px !important; vertical-align: top; }
.live-table td small { display: block; color: var(--muted); font-size: 10px; line-height: 1.8; margin-top: 4px; }
.live-table td strong { font-size: 12px; font-weight: 600; }
.live-table .live-balance { font-variant-numeric: tabular-nums; font-weight: 600; }
.live-table .live-result-cell { min-width: 230px; max-width: 370px; white-space: normal; overflow-wrap: anywhere; font-size: 11px; line-height: 1.8; }
.live-balance-note { padding: 13px 17px; border-top: 1px solid var(--line); background: #fafbfe; margin: 0 !important; }
.live-fund-card { display: grid; grid-template-columns: minmax(190px, .75fr) minmax(460px, 1.25fr); align-items: center; gap: 25px; padding: 21px; background: white; border: 1px solid var(--line); border-radius: 11px; }
.live-fund-card h2 { font-size: 16px; margin-bottom: 6px; }
.live-fund-card p { color: var(--muted); font-size: 11px; line-height: 1.8; margin: 0; }
.live-fund-form { display: grid; grid-template-columns: minmax(120px, 1.3fr) minmax(75px, .65fr) minmax(100px, 1fr) auto; align-items: end; gap: 11px; }
.live-fund-form .btn { min-height: 37px; font-size: 12px; }
.live-history-card { margin-top: 22px; min-width: 0; padding: 21px; }
.live-history-heading, .live-history-summary, .live-history-pagination { display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.live-history-heading { align-items: flex-start; }
.live-history-heading > div { min-width: 0; }
.live-history-heading h2 { font-size: 18px; margin: 3px 0 8px; }
.live-history-heading > .btn { flex-shrink: 0; }
.live-history-filters { display: grid; grid-template-columns: minmax(130px, .5fr) minmax(200px, 1fr) auto; gap: 14px; align-items: end; max-width: 800px; margin: 18px 0; }
.live-history-filters > .field { min-width: 0; }
.live-history-filters > .btn { min-height: 39px; }
.live-history-summary { font-size: 12px; flex-wrap: wrap; margin: 14px 0; overflow-wrap: anywhere; }
.live-history-wrap { max-width: 100%; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.live-history-table { min-width: 850px; width: 100%; table-layout: fixed; }
.live-history-table th, .live-history-table td { padding: 12px !important; text-align: left !important; vertical-align: top; white-space: normal; overflow-wrap: anywhere; font-size: 12px; line-height: 1.8; }
.live-history-table th:nth-child(1) { width: 17%; }
.live-history-table th:nth-child(2) { width: 22%; }
.live-history-table th:nth-child(3) { width: 13%; }
.live-history-table th:nth-child(4) { width: 30%; }
.live-history-table td small { display: block; font-size: 11px; color: var(--muted); line-height: 1.8; }
.live-event-details { margin-top: 7px; }
.live-event-details summary { color: var(--primary); cursor: pointer; }
.live-event-details summary:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; border-radius: 3px; }
.live-event-details dl { margin: 8px 0 0; padding: 9px; background: var(--surface-soft, #f7f8fc); border-radius: 6px; font-size: 11px; }
.live-event-details dl > div + div { margin-top: 6px; }
.live-event-details dt { color: var(--muted); }
.live-event-details dd { margin: 0; }
.live-history-pagination { margin-top: 17px; flex-wrap: wrap; font-size: 12px; }
@media (max-width: 950px) {
  .live-fund-card { grid-template-columns: 1fr; gap: 17px; }
  .live-connection-card { flex-direction: column; gap: 12px; }
  .live-connection-flags { justify-content: flex-start; max-width: none; }
}
@media (max-width: 600px) {
  .live-connection-card, .live-fund-card { padding: 15px; }
  .live-fund-form { grid-template-columns: 1fr 1fr; }
  .live-batch-actions > .btn { flex: 1 0 42%; font-size: 12px; }
  .live-batch-actions > .field-help { margin-left: 0; flex-basis: 100%; }
  .live-status-actions { width: 100%; justify-content: space-between; }
  .live-history-card { padding: 15px; }
  .live-history-heading { flex-direction: column; }
  .live-history-filters { grid-template-columns: minmax(0, 1fr); }
}
.nav-tab[aria-selected="false"] { color: var(--secondary); font-weight: 500; }
.nav-tab[aria-selected="false"]::after { display: none; }
.btn-small { min-height: 32px; padding: 6px 10px; font-size: 11px; }
.btn-text { border-color: transparent; background: transparent; color: var(--primary); box-shadow: none; padding-left: 8px; padding-right: 8px; }
.sidebar, .summary-panel { align-self: start; }
.sidebar-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 5px 15px; }
.sidebar-heading h2 { font-size: 15px; white-space: nowrap; }
.sidebar-heading h2 > span { font-size: 11px; font-weight: 400; margin-left: 4px; }
.sidebar-heading .btn { min-height: 31px; font-size: 10px; padding: 5px 8px; }
.search-field { display: block; margin: 0 4px 13px; }
.search-field input { background: #fafbfd !important; padding-left: 12px !important; }
.sidebar-footer { display: flex; flex-direction: column; gap: 10px; }
.sidebar-footer > span { display: block; font-size: 10px; text-align: center; }
.role-avatar { color: hsl(var(--avatar-hue, 235) 37% 43%); background: hsl(var(--avatar-hue, 235) 65% 91%); }
.role-item.is-disabled { opacity: .58; }
.role-meta small { line-height: 1.5; }
.editor-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; margin-bottom: 20px; }
.editor-heading h1 { font-size: 23px; margin: 3px 0 5px; }
.editor-heading p, .preview-heading p { margin: 0; font-size: 12px; }
.editor-heading .eyebrow, .preview-heading .eyebrow, .modal-header .eyebrow { font-size: 9px; letter-spacing: 1.5px; }
.editor-heading .btn { margin-top: 4px; }
.section-number { display: inline-grid; place-items: center; width: 25px; height: 25px; border-radius: 7px; background: var(--primary-soft); color: var(--primary); font-size: 10px; font-weight: 650; letter-spacing: -.3px; }
.field > span:not(.switch-field) { color: var(--secondary); font-size: 12px; line-height: 1.5; }
.section-card > .field + .form-grid { margin-top: 15px; }
.section-card > .field-help { display: block; margin-top: 13px; }
.section-card > .btn { margin-top: 11px; }
.switch-field { display: inline-flex; align-items: center; gap: 8px; min-height: 37px; color: var(--secondary); font-size: 12px; cursor: pointer; }
.switch-field input { margin: 0; }
.modal-body > .switch-field { margin-top: 14px; }
.amount-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 32px; align-items: end; gap: 12px; margin-top: 12px; }
.amount-row > .btn { width: 32px; min-height: 37px; color: var(--muted); background: #fafbfd; }
.amount-row > .btn:hover:not(:disabled) { color: var(--negative); background: var(--negative-soft); border-color: #efccca; }
.summary-panel { padding: 0; background: transparent; border: 0; border-radius: 0; box-shadow: none; display: flex; flex-direction: column; gap: 15px; }
.summary-panel > .summary-card { margin: 0; background: white; padding: 20px; box-shadow: var(--shadow); border-radius: var(--radius); }
.summary-panel > .summary-card > h2 { font-size: 16px; margin: 0 0 23px; }
.summary-card .summary-identity { padding-bottom: 16px; margin-bottom: 0; border-bottom: 0; }
.summary-card .summary-identity h3 { margin-bottom: 6px; font-size: 19px; }
.chip-list { display: flex; flex-wrap: wrap; gap: 6px; padding-bottom: 17px; border-bottom: 1px solid var(--line); }
.habit-list { padding: 15px 0 16px; margin: 0; list-style: none; font-size: 12px; line-height: 1.9; color: var(--secondary); }
.habit-list li { margin: 5px 0; }
.habit-list b { color: var(--ink); font-weight: 600; }
.sample-messages { padding: 15px; border-radius: 9px; background: #f1f3fd; }
.sample-messages h3 { font-size: 13px; margin-bottom: 15px; }
.sample-messages p { font-size: 10px; margin: 13px 0 0; }
.sample-message { display: flex; align-items: center; gap: 10px; margin: 13px 0; }
.sample-message .role-avatar { width: 31px; height: 31px; font-size: 13px; }
.sample-message .chat-bubble { background: white; padding: 7px 14px; font-size: 13px; }
.summary-check { margin-top: 18px; padding-top: 15px; border-top: 1px solid var(--line); }
.summary-check > strong { color: var(--positive); font-size: 13px; font-weight: 600; }
.summary-check p { font-size: 10px; line-height: 1.8; margin: 7px 0 0; }
.summary-panel > .summary-card.subtle { background: #fafbfe; box-shadow: none; padding: 17px 19px; }
.summary-card.subtle h3 { font-size: 12px; color: var(--secondary); }
.summary-card.subtle p { font-size: 11px; line-height: 1.85; color: var(--secondary); margin: 0 0 8px; }
.summary-card.subtle p:last-child { margin-bottom: 0; color: var(--muted); }
.preview-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.preview-heading h1 { margin: 3px 0 5px; }
.preview-toolbar { padding: 17px 20px; background: white; border: 1px solid var(--line); border-radius: 11px; align-items: flex-end; box-shadow: var(--shadow); }
.preview-toolbar > .field { min-width: 155px; flex: 1; max-width: 290px; }
.preview-toolbar > .field:nth-child(3) { min-width: 200px; }
.preview-toolbar .toolbar-actions { padding-bottom: 0; margin-left: auto; }
.preview-toolbar .control { min-height: 38px; }
.preview-toolbar select { width: 100%; }
.rules-banner { padding: 10px 14px; margin: -3px 0 18px; font-size: 11px; line-height: 1.9; color: #8a8fa6; border: 1px solid #e7e9f2; border-radius: 7px; background: #f0f2f8; }
.rules-banner > span { display: inline-block; margin-right: 10px; color: #737a94; font-size: 10px; font-weight: 600; }
.preview-viewbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 20px; margin-bottom: 15px; }
.preview-viewbar > label { display: flex; align-items: center; gap: 12px; font-size: 12px; color: var(--secondary); }
.preview-viewbar select { width: 185px; }
.preview-viewbar > span { font-size: 10px; overflow-wrap: anywhere; }
.stat-card { flex-direction: column; align-items: flex-start; gap: 3px; }
.stat-card > span { font-size: 11px; color: var(--muted); line-height: 1.5; }
.stat-card > strong { font-size: 24px; line-height: 1.5; font-weight: 650; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.message-content { min-width: 0; flex: 1; }
.message-meta b { color: var(--ink); font-size: 12px; font-weight: 600; }
.message-meta small { color: #a1a9bb; font-size: 10px; margin-left: 5px; }
.chat-message .chat-bubble { font-size: 13px; padding: 8px 16px; }
.settlement-line { display: grid; grid-template-columns: minmax(45px, 1fr) minmax(45px, .7fr) minmax(95px, 1.3fr); gap: 6px; align-items: center; margin-top: 5px; font-size: 11px; font-variant-numeric: tabular-nums; }
.settlement-line > b { font-weight: 600; text-align: right; }
.settlement-line > span:last-child { text-align: right; }
.system-result > strong { display: block; font-size: 12px; margin-bottom: 7px; }
.system-result { max-width: none; }
.chat-rest { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 11px; margin: 0 0 10px 44px; border-left: 2px solid #e2e6ef; color: #8c96aa; background: #fafbfd; font-size: 11px; border-radius: 0 5px 5px 0; }
.chat-rest .badge { background: #edf0f6; font-size: 9px; color: #909aaf; padding: 1px 5px; }
.chat-rest b { font-weight: 500; }
.behavior-note { font-size: 11px; color: var(--muted); line-height: 1.8; margin: 7px 0 2px 44px; }
.balance-panel .panel-heading { border-bottom: 0; padding: 0 0 10px; }
svg.balance-chart { display: block; width: 100%; height: auto; min-height: 0; margin: 10px 0 0; overflow: visible; }
.insight-grid { grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)); }
.insight-grid > div { text-align: left; padding-right: 10px; }
.insight-grid > div:only-child { padding-right: 0; }
.insight-grid strong { font-size: 12px; margin-bottom: 4px; }
.insight-grid p { font-size: 11px; }
.details-panel { margin-bottom: 0; padding: 0; overflow: hidden; }
.details-panel .panel-heading { padding: 13px 16px; border-bottom: 0; }
.details-panel .panel-heading .btn { min-height: 29px; font-size: 10px; padding: 3px 0 3px 8px; }
.details-panel > .field-help { padding: 10px 16px; margin: 0; border-top: 1px solid var(--line); font-size: 10px; }
.data-table td, .data-table th { padding-left: 10px; padding-right: 10px; }
.data-table td:last-child, .data-table th:last-child { text-align: left; }
.data-table td:nth-last-child(2), .data-table th:nth-last-child(2), .data-table td:nth-last-child(3), .data-table th:nth-last-child(3) { text-align: right; }
.data-table tr.is-selected td { background: #f0f1ff; }
.data-table tbody tr { cursor: default; }
.table-round-button { background: transparent; border: 0; color: var(--primary); font-size: 11px; padding: 2px 4px; min-width: 21px; border-radius: 3px; }
.table-round-button:hover { background: #e5e5ff; }
.data-table td.reason-cell { min-width: 140px; font-size: 10px; line-height: 1.7; }
.timeline-panel > .panel-heading { padding: 0 0 13px; border-bottom: 0; }
.timeline-panel > .panel-heading .muted { font-size: 10px; }
.playback-controls > .muted { font-size: 11px; margin-left: 8px; font-variant-numeric: tabular-nums; }
.preview-empty { min-height: 420px; border: 1px dashed var(--line-strong); border-radius: 12px; background: white; }
.empty-state.compact { min-height: 120px; padding: 25px 12px; font-size: 12px; }
.toast.is-error { background: #a34b4f; }
#confirm-dialog { width: min(500px, calc(100vw - 32px)); max-height: calc(100vh - 60px); border: 1px solid var(--line); border-radius: 15px; padding: 0; color: var(--ink); background: white; box-shadow: 0 25px 90px #17213d2e; }
#confirm-dialog::backdrop { background: #17213b55; backdrop-filter: blur(3px); }
#confirm-dialog .modal-body p { margin: 0; font-size: 13px; line-height: 1.9; color: var(--secondary); }
@media (max-width: 1250px) {
  .sidebar-heading { gap: 5px; padding-left: 2px; padding-right: 2px; }
  .sidebar-heading h2 { font-size: 14px; }
  .sidebar-heading .btn { font-size: 10px; padding: 5px 6px; }
  .summary-panel > .summary-card { padding: 17px; }
  .stat-card > strong { font-size: 22px; }
  .editor-heading h1 { font-size: 21px; }
  .actions-bar { gap: 7px; flex-wrap: wrap; }
  .actions-bar .btn { font-size: 11px; padding: 8px 11px; }
  .actions-bar .muted { flex-basis: 100%; }
}
@media (max-width: 1080px) {
  .summary-panel { display: grid; grid-template-columns: minmax(0, 1fr); }
  .summary-panel .summary-identity { margin-bottom: 0; padding-bottom: 16px; }
  .summary-panel > .summary-card:first-child { display: grid; grid-template-columns: 1fr 1fr; gap: 0 22px; }
  .summary-panel > .summary-card > h2 { grid-column: 1 / -1; margin-bottom: 20px; }
  .summary-card .chip-list { align-content: center; padding-bottom: 16px; border-bottom: 0; }
  .summary-card .habit-list { padding-top: 5px; }
  .summary-check { grid-column: 1 / -1; }
  .preview-toolbar > .field { max-width: none; }
  .preview-toolbar .toolbar-actions { margin-left: 0; }
}
@media (max-width: 900px) {
  .sidebar-heading { padding: 0 0 12px; }
  .sidebar-heading h2 { font-size: 15px; }
  .sidebar-footer { flex-direction: row; align-items: center; justify-content: space-between; }
  .sidebar-footer > span { text-align: right; }
  .search-field { margin: 0 0 12px; }
  .role-item { flex-basis: 190px; }
  .summary-panel { display: flex; }
  .stat-card > strong { font-size: 19px; }
  .stat-card > span { font-size: 10px; }
  .actions-bar .muted { flex-basis: auto; }
  .actions-bar .btn { font-size: 12px; }
  .preview-heading { margin-bottom: 16px; }
  .preview-toolbar { padding: 15px; }
}
@media (max-width: 600px) {
  .editor-heading { gap: 10px; }
  .editor-heading h1 { font-size: 19px; }
  .editor-heading .btn { font-size: 10px; padding: 5px 7px; }
  .editor-heading p { font-size: 10px; }
  .editor-heading .eyebrow { font-size: 8px; }
  .amount-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 32px; gap: 9px; }
  .summary-panel > .summary-card:first-child { display: flex; flex-direction: column; }
  .summary-card .chip-list { padding-bottom: 14px; border-bottom: 1px solid var(--line); }
  .summary-card .habit-list { padding-top: 11px; }
  .summary-card .sample-messages { margin-top: 2px; }
  .summary-check { margin-top: 15px; }
  .actions-bar .muted { flex-basis: 100%; }
  .actions-bar .btn { flex: 1 0 auto; }
  .preview-heading { align-items: flex-start; }
  .preview-heading h1 { font-size: 20px; }
  .preview-heading p { font-size: 10px; }
  .preview-heading .badge { font-size: 9px; margin-top: 4px; padding: 3px 6px; }
  .preview-toolbar { padding: 13px; gap: 12px; }
  .preview-toolbar > .field { min-width: 120px; }
  .preview-toolbar > .field:nth-child(3) { min-width: 100%; }
  .preview-viewbar { gap: 8px; }
  .preview-viewbar > label { width: 100%; }
  .preview-viewbar select { flex: 1; }
  .preview-viewbar > span { font-size: 9px; }
  .stat-card > strong { font-size: 22px; }
  .stat-card:last-child { flex-direction: row; align-items: center; justify-content: space-between; }
  .message-meta small { font-size: 9px; }
  .system-result { padding: 10px; }
  .settlement-line { grid-template-columns: minmax(38px, 1fr) minmax(35px, .7fr) minmax(85px, 1.3fr); font-size: 10px; }
  .timeline-panel > .panel-heading { align-items: flex-start; flex-direction: column; gap: 5px; }
  .timeline-panel > .panel-heading .muted { font-size: 9px; }
  .preview-empty { min-height: 300px; }
}
