:root {
  --ink: #142233;
  --ink-soft: #465462;
  --paper: #f3f6f7;
  --surface: #ffffff;
  --line: #d9e1e5;
  --mist: #e7eef1;
  --blue: #276b8f;
  --blue-soft: #d8eaf2;
  --mint: #cce8dd;
  --green: #24725c;
  --orange: #ff7547;
  --orange-soft: #fff0ea;
  --red: #b73d3d;
  --mono: "SFMono-Regular", Consolas, monospace;
  --shadow: 0 18px 45px rgba(20, 34, 51, .08);
  --radius: 16px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
html { background: var(--paper); color: var(--ink); font-family: "PingFang SC", "Microsoft YaHei", sans-serif; }
body { margin: 0; min-height: 100vh; background: linear-gradient(135deg, #eef3f5 0, var(--paper) 48%, #edf4f2 100%); }
a { color: var(--blue); text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid rgba(39,107,143,.28); outline-offset: 3px; }

.side-rail { position: fixed; inset: 0 auto 0 0; width: 232px; padding: 26px 18px 20px; overflow-x: hidden; overflow-y: auto; background: #132335; color: #eaf1f5; display: flex; flex-direction: column; z-index: 20; }
.brand { display: flex; align-items: center; gap: 12px; color: white; padding: 0 8px 26px; }
.brand-mark { flex: 0 0 auto; width: 40px; height: 40px; display: block; border-radius: 10px; box-shadow: 0 8px 20px rgba(5,13,20,.3); }
.brand-mark.large { width: 54px; height: 54px; border-radius: 15px; margin-bottom: 24px; }
.brand strong, .brand small { display: block; }
.brand strong { letter-spacing: .08em; }
.brand small { color: #8da2b1; font-size: 11px; margin-top: 3px; letter-spacing: .18em; }
.side-rail nav { display: grid; gap: 5px; }
.side-rail nav a { color: #aebdca; padding: 11px 13px; border-radius: 9px; font-size: 14px; transition: .18s ease; }
.side-rail nav a:hover, .side-rail nav a.active { background: rgba(255,255,255,.09); color: white; transform: translateX(2px); }
.side-rail nav a.active::before { content: ""; display: inline-block; width: 5px; height: 5px; margin: 0 9px 2px 0; border-radius: 50%; background: var(--orange); }
.nav-divider { color: #627789; font-size: 10px; letter-spacing: .18em; text-transform: uppercase; padding: 22px 13px 5px; }
.rail-foot { margin-top: auto; border-top: 1px solid rgba(255,255,255,.1); padding: 18px 8px 0; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; }
.rail-user-avatar { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid rgba(255,117,71,.22); border-radius: 50%; background: rgba(255,117,71,.11); color: #ff9673; font: 700 13px "SFMono-Regular", Consolas, monospace; }
.rail-user { min-width: 0; }
.rail-foot small, .rail-foot strong { display: block; }
.rail-foot small { color: #7890a0; font-size: 10px; }
.rail-foot strong { overflow: hidden; margin-top: 2px; color: #dce7ed; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.menu-button, .nav-scrim { display: none; }

.app-shell { margin-left: 232px; padding: 42px 48px 70px; min-height: 100vh; }
.app-content { width: 100%; max-width: 1520px; margin: 0 auto; }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 30px; background: radial-gradient(circle at 20% 20%, #dce9ee 0, transparent 35%), linear-gradient(145deg, #f6f8f8, #eaf1ef); }
.login-card { width: min(520px, 100%); background: rgba(255,255,255,.92); padding: 52px; border: 1px solid rgba(255,255,255,.8); border-radius: 26px 8px 26px 8px; box-shadow: var(--shadow); }
.login-card h1 { font-size: clamp(32px, 6vw, 48px); line-height: 1.18; margin: 10px 0 14px; }

h1, h2 { font-family: "Songti SC", "STSong", "SimSun", serif; font-weight: 700; }
h1 { margin: 5px 0 8px; font-size: clamp(30px, 4vw, 43px); letter-spacing: -.035em; }
h2 { margin: 0; font-size: 22px; }
p { color: var(--ink-soft); line-height: 1.65; }
.muted, .subtle { color: #71808c; }
.mono { font-family: "SFMono-Regular", Consolas, monospace; letter-spacing: -.03em; }
.eyebrow { margin: 0; color: var(--blue); font-family: "SFMono-Regular", Consolas, monospace; font-size: 10px; font-weight: 700; letter-spacing: .18em; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 28px; margin: 0 0 28px; }
.page-head > div > p:last-child { margin: 0; }

.message-stack { position: fixed; top: 20px; right: 24px; width: min(420px, calc(100vw - 48px)); z-index: 50; display: grid; gap: 8px; }
.message { background: var(--ink); color: white; padding: 13px 16px; border-radius: 10px; box-shadow: var(--shadow); font-size: 13px; }
.message.error { background: var(--red); }
.message.warning { background: #96631a; }

.primary-button, .secondary-button { min-height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 17px; border-radius: 9px; border: 1px solid transparent; cursor: pointer; font-weight: 650; font-size: 13px; transition: transform .16s ease, box-shadow .16s ease, background .16s ease; }
.primary-button { background: var(--ink); color: white; box-shadow: 0 8px 18px rgba(20,34,51,.13); }
.primary-button:hover, .secondary-button:hover { transform: translateY(-1px); }
.primary-button:disabled, .secondary-button:disabled, .text-button:disabled { cursor: not-allowed; opacity: .45; transform: none; }
.secondary-button { background: white; color: var(--ink); border-color: var(--line); }
.wide { width: 100%; }
.disabled { opacity: .45; pointer-events: none; }
.text-button { border: 0; padding: 0; background: transparent; color: inherit; cursor: pointer; font-size: 12px; }
.rail-foot .text-button { color: #8fa3b1; }

.danger-text { color: var(--orange) !important; }
.ok-text { color: var(--green) !important; }

.dashboard-head { margin-bottom: 24px; }
.overview-status { --status-accent: #57bf98; position: relative; display: grid; grid-template-columns: minmax(340px, .95fr) minmax(500px, 1.05fr); overflow: hidden; border-radius: 5px 18px 5px 18px; background: var(--ink); color: white; box-shadow: var(--shadow); }
.overview-status::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 5px; z-index: 1; background: var(--status-accent); }
.overview-status.tone-attention { --status-accent: var(--orange); }
.overview-status.tone-paused { --status-accent: #df9652; }
.overview-status.tone-idle { --status-accent: #88a1af; }
.overview-verdict { min-width: 0; padding: 29px 32px 28px 35px; border-right: 1px solid rgba(255,255,255,.11); }
.overview-verdict-label { display: flex; align-items: center; gap: 8px; color: #8ca0ae; font: 700 9px var(--mono); letter-spacing: .16em; }
.overview-verdict-label span { width: 6px; height: 6px; border-radius: 50%; background: var(--status-accent); box-shadow: 0 0 0 5px color-mix(in srgb, var(--status-accent) 15%, transparent); }
.overview-state { display: inline-flex; align-items: center; margin-top: 24px; padding: 5px 9px; border: 1px solid color-mix(in srgb, var(--status-accent) 34%, transparent); border-radius: 20px; background: color-mix(in srgb, var(--status-accent) 12%, transparent); color: var(--status-accent); font-size: 10px; font-weight: 700; }
.overview-verdict h2 { max-width: 480px; margin: 11px 0 8px; color: white; font-size: clamp(25px, 2.6vw, 34px); line-height: 1.2; }
.overview-verdict p { max-width: 520px; margin: 0; color: #a5b6c1; font-size: 11px; line-height: 1.7; }
.overview-link { display: inline-flex; align-items: center; gap: 8px; margin-top: 17px; color: white; font-size: 11px; font-weight: 650; }
.overview-link span { color: var(--status-accent); transition: transform .16s ease; }
.overview-link:hover span { transform: translateX(3px); }
.overview-facts { min-width: 0; display: grid; grid-template-columns: 1fr 1fr; margin: 0; }
.overview-facts > div { min-width: 0; padding: 25px 26px 22px; border-right: 1px solid rgba(255,255,255,.1); border-bottom: 1px solid rgba(255,255,255,.1); }
.overview-facts > div:nth-child(2n) { border-right: 0; }
.overview-facts > div:nth-last-child(-n+2) { border-bottom: 0; }
.overview-facts dt { color: #8299a8; font-size: 10px; }
.overview-facts dd { display: flex; align-items: center; gap: 8px; min-height: 26px; margin: 8px 0 4px; color: white; font-size: 17px; font-weight: 700; }
.overview-facts small { display: block; color: #8da1af; font-size: 9px; line-height: 1.55; }
.mode-dot { width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: #86a0ae; }
.mode-dot.mode-live { background: var(--orange); box-shadow: 0 0 0 5px rgba(255,117,71,.1); }
.run-state { color: #b9c8d1; }
.run-success { color: #72c9a7; }
.run-partial, .run-skipped { color: #e8bd78; }
.run-failed { color: #ff9470; }
.run-running { color: #75c3e1; }
.run-result-link { display: inline-flex; align-items: center; gap: 8px; padding-bottom: 2px; border-bottom: 1px solid color-mix(in srgb, currentColor 35%, transparent); }
.run-result-link span { transition: transform .16s ease; }
.run-result-link:hover span { transform: translateX(3px); }
.run-result-link:focus-visible { outline: 2px solid currentColor; outline-offset: 5px; }
.next-run-countdown { color: inherit; transition: color .16s ease; }
.next-run-countdown.is-urgent { color: #ff8061; }

.overview-section { margin-top: 28px; }
.overview-section-head { display: flex; align-items: end; justify-content: space-between; gap: 26px; margin-bottom: 13px; }
.overview-section-head h2 { margin-top: 5px; }
.overview-section-head > p { margin: 0 0 2px; color: #74838d; font-size: 10px; text-align: right; }
.plan-state-grid { display: grid; grid-template-columns: repeat(4, 1fr); overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255,255,255,.88); box-shadow: 0 8px 25px rgba(20,34,51,.035); }
.plan-state-grid article { --state-color: #8aa1ae; position: relative; min-width: 0; min-height: 108px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 21px 21px 20px 24px; border-right: 1px solid var(--line); }
.plan-state-grid article:last-child { border-right: 0; }
.plan-state-grid article::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--state-color); }
.plan-state-grid .state-active { --state-color: #54aa87; }
.plan-state-grid .state-pending { --state-color: #d2a54d; }
.plan-state-grid .state-stopped, .plan-state-grid .state-failed { --state-color: var(--orange); }
.plan-state-grid span { display: block; color: var(--ink); font-size: 12px; font-weight: 700; }
.plan-state-grid small { display: block; margin-top: 7px; color: #84919a; font-size: 9px; line-height: 1.45; }
.plan-state-count { flex: 0 0 auto; padding-bottom: 3px; border-bottom: 1px solid transparent; color: var(--ink); font: 700 34px/1 var(--mono); transition: color .16s ease, border-color .16s ease; }
.plan-state-count:hover { border-color: currentColor; color: var(--state-color); }
.plan-state-count:focus-visible { border-color: currentColor; outline: 2px solid var(--state-color); outline-offset: 5px; }
.dashboard-content { display: grid; grid-template-columns: minmax(0, 1.42fr) minmax(320px, .78fr); gap: 20px; align-items: start; margin-top: 20px; }
.dashboard-panel-head { min-height: 83px; }
.dashboard-panel-head h2 { margin-top: 4px; }
.dashboard-panel-head small { display: block; margin-top: 5px; color: #82909a; font-size: 9px; }
.dashboard-plan-table { min-width: 720px; }
.dashboard-plan-status { min-width: 142px; }
.dashboard-plan-counts { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.dashboard-plan-counts span + span { padding-left: 8px; border-left: 1px solid var(--line); }
.dashboard-plan-counts strong { font: 700 10px/1 var(--mono); }
.dashboard-plan-counts .is-running strong { color: var(--green); }
.dashboard-plan-counts .is-stopped strong { color: var(--red); }
.dashboard-action-list .action-result { padding: 3px 7px; border-radius: 20px; background: #edf4f1; color: var(--green); font-size: 9px; font-weight: 700; }
.dashboard-action-list .action-result.is-failed { background: var(--orange-soft); color: var(--red); }
.panel { background: rgba(255,255,255,.9); border: 1px solid rgba(217,225,229,.9); border-radius: var(--radius); box-shadow: 0 9px 28px rgba(20,34,51,.04); overflow: hidden; }
.panel-head { padding: 22px 24px 17px; display: flex; justify-content: space-between; align-items: end; border-bottom: 1px solid var(--line); }
.panel-head a { font-size: 12px; }
.table-wrap { overflow-x: auto; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; }
.table-wrap table { min-width: 640px; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { color: #788691; font-weight: 600; text-align: left; padding: 11px 16px; background: #f7f9fa; white-space: nowrap; }
td { padding: 14px 16px; border-top: 1px solid #e9eef0; vertical-align: middle; }
td strong { font-size: 12px; }
.table-sub { display: block; margin-top: 4px; color: #89959f; font-size: 10px; }
.inline-action { margin-top: 7px; padding: 0; border: 0; background: transparent; color: var(--blue); font-size: 10px; cursor: pointer; }
.table-actions { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.table-actions form { margin: 0; }
.table-actions .secondary-button { min-height: 34px; padding: 6px 10px; }
.reason-cell { min-width: 220px; max-width: 430px; line-height: 1.55; color: var(--ink-soft); }
.empty-cell { text-align: center; padding: 55px; color: #84919b; }
.status { display: inline-flex; align-items: center; padding: 4px 8px; border-radius: 20px; background: var(--mist); color: var(--ink-soft); white-space: nowrap; }
.status-active { background: var(--mint); color: var(--green); }
.status-pending, .status-unknown { background: #fff3d9; color: #8b641e; }
.status-stopped, .status-failed { background: var(--orange-soft); color: var(--red); }

.action-list article { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; padding: 16px 20px; border-top: 1px solid #e8edef; align-items: start; }
.action-list article:first-child { border-top: 0; }
.action-list p { margin: 4px 0; font-size: 12px; line-height: 1.45; }
.action-list small { color: #8a969e; }
.action-mark { width: 9px; height: 9px; background: var(--blue); border-radius: 50%; margin-top: 5px; }
.action-create, .action-pause { background: var(--orange); }
.action-would_create, .action-would_pause { background: #9b7bbb; }
.empty-state { padding: 54px 26px; text-align: center; color: var(--ink-soft); }
.empty-state strong { display: block; font-family: "Songti SC", serif; font-size: 20px; color: var(--ink); }
.empty-state .primary-button, .empty-state .secondary-button { margin-top: 18px; }
.empty-state.compact { padding: 35px 20px; }
.empty-state.wide { grid-column: 1 / -1; background: white; border: 1px dashed #cbd6db; border-radius: var(--radius); }

.settings-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(300px, .75fr); gap: 20px; align-items: start; }
.form-panel { padding: 28px; }
.form-panel.narrow { max-width: 760px; }
.form-panel h2 { margin-bottom: 24px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 19px; }
.field { display: grid; align-content: start; gap: 7px; }
.field.full, .form-actions.full, .form-error.full { grid-column: 1 / -1; }
.field label, .stack-form label { color: var(--ink); font-weight: 650; font-size: 12px; }
input[type="text"], input[type="search"], input[type="password"], input[type="number"], input[type="url"], input[type="time"], select, textarea { width: 100%; min-height: 42px; border: 1px solid #cfdade; border-radius: 8px; background: #fbfcfc; color: var(--ink); padding: 9px 11px; transition: border .15s, box-shadow .15s; }
textarea { resize: vertical; line-height: 1.55; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(39,107,143,.1); outline: none; }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--orange); }
.check-field { grid-template-columns: 1fr auto; align-items: center; padding: 14px; background: var(--orange-soft); border-radius: 9px; }
.check-field label { grid-column: 1; }
.check-field input { grid-column: 2; grid-row: 1; }
.code-input { font-family: "SFMono-Regular", Consolas, monospace; font-size: 11px; background: #152536; color: #dceaf0; border-color: #152536; }
.form-actions { grid-column: 1 / -1; display: flex; gap: 10px; padding-top: 7px; }
.errorlist, .form-error { margin: 0; padding: 9px 12px; list-style: none; border-radius: 7px; color: var(--red); background: #fff0f0; font-size: 11px; }
.stack-form { display: grid; gap: 17px; margin-top: 30px; }
.stack-form label { display: grid; gap: 7px; }

.connection-card { position: relative; background: var(--ink); color: white; padding: 30px; border-radius: 5px 18px 5px 18px; overflow: hidden; }
.connection-card::after { content: ""; position: absolute; width: 160px; height: 160px; border: 1px solid rgba(255,255,255,.08); border-radius: 50%; right: -70px; top: -75px; }
.connection-card h2 { font-size: 28px; margin: 8px 0 24px; }
.connection-card dl { display: grid; grid-template-columns: 90px 1fr; gap: 12px; font-size: 12px; margin: 0 0 25px; }
.connection-card dt { color: #8097a7; }
.connection-card dd { margin: 0; }
.connection-light { position: absolute; top: 28px; right: 28px; width: 11px; height: 11px; border-radius: 50%; background: #6f8290; }
.connection-card.connected .connection-light { background: #4fc496; box-shadow: 0 0 0 7px rgba(79,196,150,.12); }

.risk-banner { max-width: 760px; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 17px; margin-bottom: 18px; padding: 17px 20px; border: 1px solid #cfe2dc; background: #edf7f3; border-radius: 12px; }
.risk-banner.unlocked { background: var(--orange-soft); border-color: #ffd1c2; }
.risk-symbol { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; background: var(--green); color: white; font-weight: 800; }
.risk-banner.unlocked .risk-symbol { background: var(--orange); }
.control-page-head { align-items: end; margin-bottom: 40px; padding-top: 6px; }
.control-page-head > div { max-width: 760px; }
.control-page-head h1 { font-size: 46px; }
.control-page-date { flex: 0 0 auto; margin: 0 0 4px; color: #75838d; font-size: 11px; }
.control-page-date time { margin-left: 5px; color: var(--ink); font: 700 11px var(--mono); }
.control-flow-panel { padding: 0; }
.control-flow { margin: 0; padding: 0; list-style: none; }
.control-flow-step { display: grid; grid-template-columns: minmax(190px, .58fr) minmax(0, 2.25fr) minmax(190px, .62fr); gap: 30px; align-items: center; min-height: 240px; padding: 30px 34px 30px 28px; border-top: 1px solid var(--line); }
.control-flow-step:first-child { border-top: 0; }
.control-flow-step:last-child { min-height: 260px; }
.control-token-step { background: #f8fafb; }
.control-flow-spine { align-self: stretch; display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 13px; align-items: start; padding-top: 5px; border-right: 1px solid #c9d9e0; }
.control-step-number { color: var(--blue); font: 800 17px/1 var(--mono); letter-spacing: -.05em; }
.control-flow-copy h2 { font-size: 24px; line-height: 1.18; }
.control-flow-copy p { max-width: 180px; margin: 12px 0 0; color: #6f7e89; font-size: 11px; line-height: 1.7; }
.control-flow-body { min-width: 0; }
.control-safety-fields { display: grid; grid-template-columns: minmax(180px, .68fr) minmax(300px, 1.32fr); gap: 24px; align-items: start; }
.control-safety-fields .field { min-width: 0; }
.control-toggle-field { grid-template-columns: 1fr auto; }
.control-toggle-field label { grid-column: 1; }
.control-toggle-field input { grid-column: 2; grid-row: 1; width: 22px; height: 22px; }
.control-toggle-field .errorlist, .control-toggle-field .field-help { grid-column: 1 / -1; }
.control-flow-action { align-self: stretch; display: flex; flex-direction: column; justify-content: center; gap: 11px; padding-left: 28px; border-left: 1px solid var(--line); }
.control-flow-action .primary-button, .control-flow-action .secondary-button, .control-flow-action form { width: 100%; }
.control-flow-action small { color: #7d8992; font-size: 9px; line-height: 1.55; text-align: center; }
.token-status { width: fit-content; display: inline-flex; margin-bottom: 19px; padding: 5px 9px; border-radius: 20px; background: var(--mint); color: var(--green); font-size: 10px; font-weight: 700; white-space: nowrap; }
.state-attention .token-status, .state-expired .token-status { background: var(--orange-soft); color: var(--red); }
.state-missing .token-status { background: var(--mist); color: #71808c; }
.control-token-body { display: grid; grid-template-columns: minmax(190px, .66fr) minmax(350px, 1.34fr); gap: 28px; align-items: start; }
.control-token-account small, .control-token-account strong { display: block; }
.control-token-account small { color: #7d8b95; font-size: 9px; }
.control-token-account > strong { overflow: hidden; margin-top: 8px; color: var(--ink); font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.control-token-account p, .control-token-expiry p { margin: 14px 0 0; color: #788791; font-size: 9px; line-height: 1.6; }
.control-token-expiry-title { display: block; margin-bottom: 10px; color: var(--ink); font-size: 11px; }
.control-token-dates { display: grid; grid-template-columns: 1fr 1fr; overflow: hidden; border: 1px solid #cfdade; border-radius: 9px; background: var(--line); }
.control-token-dates > div { min-width: 0; padding: 13px 15px; background: #fbfcfc; }
.control-token-dates > div + div { border-left: 1px solid var(--line); }
.control-token-dates small, .control-token-dates strong { display: block; }
.control-token-dates small { color: #7d8b95; font-size: 9px; }
.control-token-dates strong { overflow: hidden; margin-top: 7px; color: var(--ink); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.token-actions { gap: 9px; }
.token-actions form { margin: 0; }
.control-webhook-body { display: grid; gap: 14px; }
.control-webhook-guide { padding: 12px 15px; border: 1px solid #d8e4e9; border-radius: 8px; background: #f4f8fa; }
.control-webhook-guide > strong { display: block; color: var(--ink); font-size: 10px; }
.control-webhook-guide p { margin: 5px 0 0; color: #71808c; font-size: 9px; line-height: 1.6; }
.control-webhook-guide details { margin-top: 7px; }
.control-webhook-guide summary { width: fit-content; color: var(--blue); cursor: pointer; font-size: 9px; }
.control-webhook-guide pre { overflow-x: auto; margin: 9px 0 0; padding: 10px 12px; border-radius: 7px; background: var(--ink); color: #dceaf0; font: 9px/1.55 var(--mono); }
.control-flow-footnote { margin: 0; padding: 17px 28px; border-top: 1px solid var(--line); color: #84919a; font-size: 9px; }
.template-page-head { align-items: center; margin-bottom: 18px; }
.template-page-head > div { max-width: 720px; }
.template-page-head > .primary-button { background: #167b5c; box-shadow: 0 8px 18px rgba(22,123,92,.18); }
.page-intro { max-width: 680px; margin: 8px 0 0; font-size: 13px; }
.back-link { display: inline-block; margin-bottom: 17px; color: #6f7d87; font-size: 11px; }
.template-workspace { position: relative; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.94); box-shadow: 0 8px 25px rgba(20,34,51,.035); }
.template-toolbar { min-height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 22px; padding: 10px 14px 10px 18px; border-bottom: 1px solid var(--line); }
.template-toolbar .bulk-enable-form { display: flex; align-items: center; gap: 11px; min-width: 0; }
.template-select-all { display: flex; align-items: center; gap: 7px; color: #53636e; font-size: 10px; cursor: pointer; white-space: nowrap; }
.template-select-all input, .template-select { width: 16px; height: 16px; margin: 0; accent-color: var(--blue); cursor: pointer; }
.template-selected-count { padding-left: 11px; border-left: 1px solid var(--line); color: #61717d; font-size: 10px; white-space: nowrap; }
.template-bulk-button { min-height: 34px; padding: 6px 12px; border: 1px solid; border-radius: 7px; background: white; cursor: pointer; font-size: 10px; font-weight: 700; }
.template-bulk-button.is-enable { border-color: #a7d2c4; color: var(--green); }
.template-bulk-button.is-disable { border-color: #efbbbb; color: var(--red); }
.template-bulk-button:disabled { cursor: not-allowed; opacity: .42; }
.template-filter-controls { display: flex; align-items: center; gap: 9px; }
.template-search-field input { width: min(245px, 26vw); min-height: 38px; padding: 8px 11px; border: 1px solid #ccd8de; border-radius: 7px; background: white; color: var(--ink); font-size: 10px; }
.template-status-filter { min-height: 38px; display: flex; align-items: center; gap: 7px; padding: 0 8px 0 11px; border: 1px solid #ccd8de; border-radius: 7px; background: white; color: #667680; font-size: 10px; }
.template-status-filter select { min-height: 28px; padding: 3px 23px 3px 4px; border: 0; background-color: transparent; color: var(--ink); font-size: 10px; }
.template-table-scroll { overflow: visible; }
.template-table { width: 100%; min-width: 1040px; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
.template-col-select { width: 3.4%; }
.template-col-identity { width: 20.6%; }
.template-col-status { width: 12.3%; }
.template-col-capacity { width: 11.2%; }
.template-col-wait { width: 14%; }
.template-col-stop { width: 14%; }
.template-col-create { width: 14.5%; }
.template-col-actions { width: 10%; }
.template-table th { height: 45px; padding: 10px 11px; background: #fbfcfc; color: #5e6e79; font: 700 10px var(--mono); letter-spacing: .02em; text-align: left; vertical-align: middle; }
.template-table th:first-child { padding-inline: 10px 0; }
.template-table th:last-child { text-align: center; }
.template-column-step { color: var(--blue); }
.template-table td { position: relative; height: 116px; padding: 16px 11px 14px; border-top: 1px solid var(--line); color: var(--ink-soft); vertical-align: top; }
.template-table td + td { border-left: 1px solid #edf1f3; }
.template-table-row { transition: background .15s ease; }
.template-table-row:hover { background: #fbfdfd; }
.template-table-row[hidden] { display: none; }
.template-select-cell { padding-inline: 10px 0 !important; text-align: center; }
.template-identity-cell > span { display: block; }
.template-name-link { display: block; overflow: hidden; color: #195f86; font-family: "Songti SC", "STSong", "SimSun", serif; font-size: 16px; font-weight: 700; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.template-name-link:hover { text-decoration: underline; text-underline-offset: 4px; }
.template-account { overflow: hidden; margin-top: 8px; color: #788792; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.template-meta { overflow: hidden; margin-top: 9px; color: #82909a; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.template-status-cell > span { width: fit-content; max-width: 100%; display: flex; align-items: center; }
.template-state { gap: 7px; color: var(--green); font-size: 10px; font-weight: 700; }
.template-state-dot { width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: var(--green); }
.is-scheduled .template-state { color: #9a6700; }
.is-scheduled .template-state-dot { background: #d6a117; }
.is-disabled .template-state { color: #778691; }
.is-disabled .template-state-dot { background: #aab6bd; }
.template-mode-chip, .template-scope-chip { min-height: 23px; margin-top: 7px; padding: 4px 7px; border-radius: 5px; font-size: 9px; line-height: 1.35; }
.template-mode-chip { background: var(--orange-soft); color: var(--red); font-weight: 700; }
.template-scope-chip { overflow: hidden; background: var(--blue-soft); color: #2f637c; text-overflow: ellipsis; white-space: nowrap; }
.template-step-cell p { margin: 0 0 7px; color: #4c5b66; font-size: 10.5px; line-height: 1.4; }
.template-step-cell p strong { color: var(--ink); }
.template-step-cell small { display: block; margin-top: 11px; color: #84919a; font-size: 9px; line-height: 1.4; }
.template-capacity-cell p { white-space: nowrap; }
.template-capacity-value { margin-right: 2px; color: var(--ink); font: 700 24px/1 var(--mono); }
.template-condition-mode { display: block; margin-bottom: 8px; color: var(--ink); font-size: 10.5px; line-height: 1.35; }
.template-condition-list { display: flex; flex-wrap: wrap; gap: 4px; }
.template-condition-list span { padding: 4px 6px; border-radius: 5px; background: var(--blue-soft); color: #315d72; font-size: 8.5px; line-height: 1; white-space: nowrap; }
.template-condition-list .is-empty { background: #edf1f3; color: #7d8a93; }
.template-create-cell small { position: relative; padding-left: 12px; }
.template-payload-state::before { content: ""; position: absolute; top: 3px; left: 0; width: 6px; height: 6px; border-radius: 50%; background: #cf8a48; }
.template-payload-state.is-ready::before { background: var(--green); }
.template-actions-cell { padding-inline: 8px !important; vertical-align: middle !important; }
.template-row-actions { display: flex; align-items: center; justify-content: center; gap: 6px; }
.template-row-actions form { margin: 0; }
.template-toggle-button, .template-more-button { min-width: 46px; min-height: 32px; display: inline-flex; align-items: center; justify-content: center; padding: 6px 9px; border: 1px solid #cad7dd; border-radius: 7px; background: white; color: #566671; cursor: pointer; font-size: 10px; font-weight: 700; line-height: 1; }
.template-toggle-button.is-enable { border-color: #67ad93; background: #f4fbf8; color: var(--green); }
.template-toggle-button.is-stop { border-color: #d6dfe3; background: #fbfcfc; color: #64737d; }
.template-action-menu { position: relative; z-index: 2; }
.template-action-menu[open] { z-index: 30; }
.template-more-button { min-width: 52px; list-style-position: inside; }
.template-more-button::marker { color: #84939d; font-size: 7px; }
.template-action-menu[open] .template-more-button { border-color: #9bb7c4; background: #f7fafb; color: var(--blue); }
.template-more-menu { position: absolute; top: calc(100% + 7px); right: 0; width: 144px; padding: 5px; border: 1px solid #d2dde2; border-radius: 9px; background: white; box-shadow: 0 15px 35px rgba(20,34,51,.14); }
.template-more-menu a, .template-more-menu button { width: 100%; min-height: 34px; display: flex; align-items: center; padding: 7px 10px; border: 0; border-radius: 6px; background: transparent; color: #43535e; cursor: pointer; font-size: 10px; text-align: left; }
.template-more-menu a:hover, .template-more-menu button:hover { background: #f1f6f8; color: var(--blue); }
.template-delete-action { margin-top: 4px !important; padding-top: 4px; border-top: 1px solid var(--line); }
.template-delete-action button { color: var(--red); }
.template-filter-empty { min-height: 180px; display: grid; place-content: center; gap: 7px; border-top: 1px solid var(--line); text-align: center; }
.template-filter-empty strong { color: var(--ink); font-size: 13px; }
.template-filter-empty span { color: #7d8b95; font-size: 10px; }
.template-table-foot { min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 10px 18px; border-top: 1px solid var(--line); color: #7e8c96; font-size: 9px; }
.template-empty p { margin: 8px 0 0; font-size: 12px; }

@media (min-width: 1181px) {
  .template-page-head, .template-workspace { margin-left: -36px; margin-right: -48px; }
}

.version-tag { padding: 7px 10px; border: 1px solid var(--line); border-radius: 6px; color: #73808a; font: 11px "SFMono-Regular", monospace; }
.import-panel { margin-top: 16px; max-width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px 22px; border: 1px dashed #bccbd1; border-radius: 12px; }
.template-editor { display: grid; gap: 14px; }
.editor-section { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255,255,255,.9); box-shadow: 0 8px 24px rgba(20,34,51,.035); }
.editor-section-head { display: grid; grid-template-columns: 44px 1fr; gap: 13px; align-items: start; padding: 20px 24px 17px; border-bottom: 1px solid var(--line); }
.editor-section-head > span { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--ink); color: white; font: 700 10px "SFMono-Regular", Consolas, monospace; }
.editor-section-head h2 { margin: 0; font-size: 19px; }
.editor-section-head p { margin: 3px 0 0; color: #76858f; font-size: 10px; line-height: 1.5; }
.editor-section-body { padding: 22px 24px 24px; }
.form-grid-three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field-help { color: #82909a; font-size: 9px; line-height: 1.45; }
.live-start-field small { grid-column: 1 / -1; }
.live-room-material-note { padding: 15px 17px; border: 1px solid #cfe2dc; border-radius: 10px; background: #edf7f3; }
.live-room-material-note strong { color: var(--green); font-size: 12px; }
.live-room-material-note small { color: #64766f; font-size: 10px; }
.inline-manage-link { width: fit-content; font-size: 11px; font-weight: 650; }
.prerequisite-grid { margin-bottom: 18px; }
.threshold-box { padding: 17px 18px 18px; border: 1px solid #dce5e8; border-radius: 11px; background: #f7f9fa; }
.threshold-box-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.threshold-box-head strong { font-size: 12px; }
.threshold-box-head small { color: #84919a; font-size: 9px; }
.threshold-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.conditional-panel { margin-top: 18px; padding: 17px 18px 18px; border: 1px solid #dce5e8; border-radius: 11px; background: #f7f9fa; }
.audience-editor { margin-top: 14px; }
.audience-body { display: grid; gap: 19px; padding: 19px; }
.audience-choice-grid { align-items: start; }
.choice-field { min-width: 0; margin: 0; padding: 14px; border: 1px solid #dce5e8; border-radius: 9px; }
.choice-field legend { padding: 0 5px; color: var(--ink); font-size: 12px; font-weight: 650; }
.choice-field > div { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px 13px; }
.choice-field label { display: flex; align-items: flex-start; gap: 7px; color: var(--ink-soft); font-size: 10px; line-height: 1.45; }
.choice-field input { flex: 0 0 auto; width: 16px; height: 16px; margin: 0; }
.source-field { max-width: 520px; margin-bottom: 17px; }
.payload-editor { overflow: hidden; border: 1px solid #dce5e8; border-radius: 10px; background: #f8fafb; }
.payload-editor summary { display: flex; justify-content: space-between; align-items: center; gap: 15px; padding: 15px 17px; cursor: pointer; color: var(--ink); font-size: 11px; font-weight: 700; }
.payload-editor summary small { color: #7f8c95; font-size: 9px; font-weight: 400; }
.payload-field { padding: 0 17px 17px; }
.payload-field textarea { min-height: 280px; }
.editor-actions { display: flex; align-items: center; gap: 10px; padding: 13px 16px; border: 1px solid rgba(217,225,229,.9); border-radius: 12px; background: rgba(255,255,255,.94); box-shadow: 0 12px 30px rgba(20,34,51,.08); }
.editor-actions span { margin-left: auto; color: #84919a; font-size: 9px; }
.template-import-panel { margin-top: 25px; background: rgba(255,255,255,.7); }
.template-import-panel p { margin: 4px 0 0; font-size: 10px; }
.pursuit-target-plan { align-content: start; }
.plan-query-control { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.plan-query-control .secondary-button { white-space: nowrap; }
.plan-search-result { display: grid; gap: 3px; padding: 10px 12px; border: 1px solid rgba(39,107,143,.24); border-left: 3px solid var(--blue); border-radius: 8px; background: #f3f8fa; }
.plan-search-result[hidden] { display: none; }
.plan-search-result strong { color: var(--ink); font-size: 11px; }
.plan-search-result span { color: #60727e; font: 9px/1.5 var(--mono); }
.plan-search-status { color: #73838e; font-size: 9px; line-height: 1.45; }
.plan-search-status.is-error { color: var(--red); }
.material-query-field { padding-top: 4px; }
.material-query-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; }
.material-query-head > div { display: grid; gap: 5px; }
.material-query-head .secondary-button { flex: 0 0 auto; }
.material-id-store { display: grid; gap: 6px; }
.material-id-store label { color: var(--ink); font-size: 10px; font-weight: 650; }
.material-id-store textarea { min-height: 76px; font: 10px/1.55 var(--mono); }
.material-query-summary { min-height: 35px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 11px; border-radius: 7px; background: #f5f7f8; color: #6f7f89; font-size: 9px; }
.material-query-summary span.is-error { color: var(--red); }
.material-query-summary strong { color: var(--blue); font: 9px var(--mono); white-space: nowrap; }
.material-choice-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; max-height: 360px; overflow: auto; padding: 2px; }
.material-choice-list[hidden] { display: none; }
.material-choice-row { min-width: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 10px; padding: 11px 12px; border: 1px solid #dce4e7; border-radius: 8px; background: #fff; cursor: pointer; transition: border .15s, background .15s, box-shadow .15s; }
.material-choice-row:hover { border-color: #b9cbd3; }
.material-choice-row.selected { border-color: rgba(39,107,143,.45); background: #f1f8fa; box-shadow: inset 3px 0 var(--blue); }
.material-choice-row input { margin: 0; }
.material-choice-copy { min-width: 0; display: grid; gap: 3px; }
.material-choice-copy strong { overflow: hidden; color: var(--ink); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.material-choice-copy small { overflow: hidden; color: #73838e; font: 9px var(--mono); text-overflow: ellipsis; white-space: nowrap; }
.material-query-empty { grid-column: 1 / -1; padding: 22px; border: 1px dashed #cbd6db; border-radius: 8px; color: #73838e; text-align: center; font-size: 10px; }
.material-panel { margin-bottom: 16px; }
.material-count { color: #7b8993; font: 10px var(--mono); }
.material-metric-table-wrap { border-bottom: 1px solid var(--line); }
.material-metric-table { min-width: 1500px; font-size: 10px; }
.material-metric-table th { padding: 10px 12px; font-size: 9px; }
.material-metric-table td { padding: 10px 12px; }
.material-metric-table th:nth-child(n+4), .material-metric-table .metric-cell { text-align: right; }
.material-metric-table tbody tr { transition: background .15s, box-shadow .15s; }
.material-metric-table tbody tr:hover { background: #f8fbfc; }
.material-metric-table tbody tr.selected, .material-metric-table tbody tr:has(input:checked) { background: #f1f8fa; box-shadow: inset 3px 0 var(--blue); }
.material-metric-table input { width: 17px; height: 17px; margin: 0; }
.material-table-identity { min-width: 190px; display: grid; grid-template-columns: 48px minmax(0, 1fr); align-items: center; gap: 9px; }
.material-table-identity .material-preview { width: 48px; height: 48px; }
.metric-cell { font-variant-numeric: tabular-nums; white-space: nowrap; }
.material-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 11px; padding: 18px 20px; }
.material-card { min-width: 0; display: grid; grid-template-columns: auto 64px minmax(0, 1fr); align-items: center; gap: 10px; min-height: 86px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: #fbfcfc; cursor: pointer; transition: border .15s, box-shadow .15s, background .15s; }
.material-card:hover { border-color: #aec3cc; }
.material-card.selected, .material-card:has(input:checked) { border-color: #7ea9bd; background: #f1f8fa; box-shadow: inset 3px 0 var(--blue); }
.material-card input { width: 17px; height: 17px; margin: 0; }
.material-preview { width: 64px; height: 64px; display: grid; place-items: center; overflow: hidden; border-radius: 7px; background: var(--ink); }
.material-preview img { width: 100%; height: 100%; object-fit: cover; }
.material-placeholder { color: #91a5b3; font: 8px var(--mono); letter-spacing: .08em; }
.material-copy { min-width: 0; }
.material-copy strong, .material-copy small { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.material-copy strong { color: var(--ink); font-size: 11px; }
.material-copy small { margin-top: 5px; color: #7d8b94; font-size: 8px; }
.material-toolbar { display: grid; grid-template-columns: auto minmax(220px, 480px); align-items: center; gap: 12px; padding: 16px 20px 0; }
.material-toolbar label { font-size: 11px; font-weight: 650; }
.material-actions { display: flex; align-items: center; gap: 14px; padding: 0 20px 20px; }
.material-actions-top { padding: 16px 20px 0; }
.material-actions span { color: #82909a; font-size: 9px; }
.filter-bar { background: white; border: 1px solid var(--line); border-radius: 10px; padding: 13px 16px; margin-bottom: 18px; }
.filter-bar label { display: flex; align-items: center; gap: 13px; color: #6f7d87; font-size: 11px; }
.filter-bar select { width: min(520px, 100%); }
.plan-query-panel { max-width: 1120px; margin-bottom: 18px; }
.plan-query-form { display: grid; grid-template-columns: minmax(190px, .45fr) minmax(720px, 1.55fr); gap: 28px; align-items: end; padding: 24px; }
.plan-query-form label { color: var(--ink); font-weight: 700; font-size: 13px; }
.plan-query-form > div:first-child small { display: block; margin-top: 6px; color: #7c8992; font-size: 9px; }
.plan-query-control { display: grid; grid-template-columns: minmax(190px, 1fr) minmax(130px, .55fr) minmax(155px, .65fr) auto; gap: 9px; align-items: end; }
.plan-date-control, .plan-status-control { display: grid; gap: 5px; }
.plan-date-control span, .plan-status-control span { color: #77858f; font-size: 9px; }
.plan-date-control input { width: 100%; min-height: 42px; padding: 8px 10px; border: 1px solid #cfdade; border-radius: 8px; background: #fbfcfc; color: var(--ink); font-size: 11px; }
.query-notice { max-width: 920px; padding: 20px 22px; border: 1px solid var(--line); border-radius: 12px; background: white; }
.query-notice strong { font-family: "Songti SC", "STSong", "SimSun", serif; font-size: 18px; }
.query-notice p { margin: 5px 0; font-size: 12px; }
.query-notice a { font-size: 11px; font-weight: 650; }
.error-notice { border-color: #f0cccc; background: #fff6f6; }
.plan-result-head { display: flex; justify-content: space-between; align-items: stretch; gap: 14px; margin: 18px 0 12px; }
.account-locator { min-width: 0; display: grid; grid-template-columns: auto auto 1fr; align-items: center; gap: 10px; padding: 13px 16px; border-radius: 5px 14px 5px 14px; background: var(--ink); color: white; }
.account-locator span { color: var(--orange); font: 700 10px "SFMono-Regular", Consolas, monospace; letter-spacing: .14em; }
.account-locator strong { font-size: 15px; }
.account-locator small { padding-left: 10px; border-left: 1px solid rgba(255,255,255,.15); color: #91a5b3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result-count { display: flex; align-items: baseline; gap: 7px; padding: 10px 16px; }
.result-count strong { font: 700 26px "SFMono-Regular", Consolas, monospace; }
.result-count span { color: var(--ink-soft); font-size: 11px; }
.plan-statistics-panel { margin-bottom: 18px; }
.plan-statistics-panel .panel-head > div small, .panel > .panel-head > div small { display: block; margin-top: 5px; color: #7c8992; font-size: 9px; }
.plan-statistics-panel .panel-head p { max-width: 650px; margin: 0; color: #687782; font-size: 9px; text-align: right; }
.plan-statistics-table { min-width: 1080px !important; }
.auto-plan-table { min-width: 1180px !important; }
.auto-plan-table td { padding-block: 9px; }
.auto-plan-table td:first-child { min-width: 180px; }
.auto-plan-table .quality-column,
.auto-plan-table .quality-cell { width: 132px; min-width: 132px; }
.auto-plan-table .operation-column,
.auto-plan-table td:last-child { width: 104px; min-width: 104px; }
.auto-plan-table .plan-row-actions { min-width: 0; }
.auto-plan-name { display: block; white-space: nowrap; }
.auto-plan-table .quality-cell small { margin-top: 4px; line-height: 1.35; }
.auto-plan-head { align-items: center; }
.plan-detail-counts { display: flex; align-items: center; gap: 14px; color: var(--ink-soft); font-size: 10px; white-space: nowrap; }
.plan-detail-counts strong { color: var(--ink); font: 700 13px "SFMono-Regular", Consolas, monospace; }
.bulk-enable-form { display: flex; align-items: center; gap: 10px; margin: 0; }
.bulk-enable-form > span { color: #74838d; font-size: 10px; white-space: nowrap; }
.bulk-enable-form > span strong { color: var(--ink); font: 700 11px var(--mono); }
.bulk-enable-form .primary-button { min-height: 36px; padding: 7px 13px; white-space: nowrap; }
.quality-cell { min-width: 190px; }
.quality-cell small { display: block; margin-top: 6px; color: #76858f; font-size: 9px; line-height: 1.45; }
.plan-row-actions { min-width: 218px; display: flex; align-items: center; gap: 8px; }
.plan-row-actions form { margin: 0; }
.plan-time-budget { min-width: 154px; display: grid; gap: 5px; }
.plan-settings-editor { position: relative; width: max-content; }
.plan-settings-editor summary { width: max-content; color: var(--blue); cursor: pointer; font-size: 10px; font-weight: 650; list-style: none; }
.plan-settings-editor summary::-webkit-details-marker { display: none; }
.plan-settings-editor summary::after { content: " ↗"; }
.plan-settings-editor[open] summary { color: var(--ink); }
.plan-settings-editor form { position: absolute; top: calc(100% + 7px); left: 0; z-index: 25; width: 220px; display: grid; gap: 10px; margin: 0; padding: 13px; border: 1px solid var(--line); border-radius: 10px; background: white; box-shadow: 0 16px 38px rgba(20,34,51,.18); }
.plan-settings-editor label { display: grid; gap: 5px; color: #687782; font-size: 9px; font-weight: 650; }
.plan-settings-editor input { width: 100%; min-height: 36px; padding: 7px 9px; border: 1px solid #cfdade; border-radius: 7px; color: var(--ink); font: 11px var(--mono); }
.plan-settings-editor .primary-button { min-height: 36px; padding: 7px 11px; }
.global-page-head { margin-bottom: 18px; }
.read-boundary { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; padding: 10px 12px; border-left: 4px solid var(--blue); background: rgba(216,234,242,.72); color: #315d72; font-size: 10px; }
.read-boundary strong { color: var(--ink); margin-right: 4px; }
.read-boundary span { padding: 4px 7px; border: 1px solid rgba(39,107,143,.2); border-radius: 4px; background: rgba(255,255,255,.6); }
.read-boundary .blocked { margin-left: auto; border-color: #ffc9b7; background: var(--orange-soft); color: var(--red); font-weight: 700; }
.global-query-panel { position: relative; z-index: 5; margin-bottom: 14px; overflow: visible; }
.global-account-controls { display: flex; align-items: center; gap: 10px; padding: 18px 22px; }
.global-account-form { min-width: 0; flex: 1; display: grid; grid-template-columns: auto minmax(260px, 520px); align-items: center; gap: 12px; }
.global-account-form label { font-size: 12px; font-weight: 700; }
.global-refresh-form { margin: 0; }
.global-account-controls.has-aweme { display: grid; grid-template-columns: auto minmax(220px, 1fr) auto minmax(190px, .72fr) auto auto; grid-template-areas: "account-label account-select aweme-label aweme-select account-view full-refresh"; }
.has-aweme .global-account-form, .has-aweme .aweme-picker { display: contents; }
.has-aweme .global-account-form label { grid-area: account-label; }
.has-aweme .global-account-form select { grid-area: account-select; }
.global-account-view { grid-area: account-view; }
.has-aweme .global-refresh-form { grid-area: full-refresh; }
.aweme-picker-label { grid-area: aweme-label; font-size: 12px; font-weight: 700; white-space: nowrap; }
.aweme-dropdown { position: relative; grid-area: aweme-select; min-width: 0; }
.aweme-dropdown summary { min-height: 42px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 11px; border: 1px solid #cfdade; border-radius: 8px; background: #fbfcfc; color: var(--ink); cursor: pointer; font-size: 12px; list-style: none; }
.aweme-dropdown summary::-webkit-details-marker { display: none; }
.aweme-dropdown summary::after { content: "⌄"; color: #71808c; font-size: 16px; line-height: 1; transition: transform .16s ease; }
.aweme-dropdown[open] summary { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(39,107,143,.1); }
.aweme-dropdown[open] summary::after { transform: rotate(180deg); }
.aweme-dropdown-menu { position: absolute; top: calc(100% + 7px); left: 0; width: min(420px, calc(100vw - 40px)); border: 1px solid var(--line); border-radius: 10px; background: white; box-shadow: 0 18px 45px rgba(20,34,51,.16); overflow: hidden; z-index: 20; }
.aweme-dropdown-help { margin: 0; padding: 10px 12px 8px; border-bottom: 1px solid var(--line); color: #667580; font-size: 9px; line-height: 1.55; }
.aweme-dropdown-options { max-height: 290px; display: grid; gap: 3px; padding: 7px; overflow-y: auto; }
.aweme-dropdown-actions { padding: 8px; border-top: 1px solid var(--line); background: #f7f9fa; }
.aweme-dropdown-actions .secondary-button { width: 100%; min-height: 36px; }
.snapshot-status { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 16px; border: 1px solid #cfe2dc; border-radius: 9px; background: #edf7f3; }
.snapshot-status > div { display: flex; align-items: center; gap: 8px; }
.snapshot-status strong { font-size: 12px; }
.snapshot-status p { margin: 0; color: #64766f; font-size: 10px; }
.snapshot-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(36,114,92,.12); }
.snapshot-empty-state { margin-top: 18px; }
.resource-index { display: grid; grid-template-columns: repeat(4, 1fr); margin: 14px 0 18px; border: 1px solid var(--line); border-top: 3px solid var(--ink); border-radius: 0 0 12px 12px; background: rgba(255,255,255,.82); }
.resource-index div { display: grid; grid-template-columns: 1fr auto; gap: 3px 10px; padding: 14px 18px; border-right: 1px solid var(--line); }
.resource-index div:last-child { border-right: 0; }
.resource-index span { color: var(--ink); font-size: 13px; font-weight: 700; }
.resource-index strong { grid-row: 1 / 3; grid-column: 2; align-self: center; font: 700 27px "SFMono-Regular", Consolas, monospace; }
.resource-index small { color: var(--blue); font: 700 9px "SFMono-Regular", Consolas, monospace; letter-spacing: .12em; }
.global-section { margin-top: 18px; }
.global-plan-table { min-width: 1040px !important; }
.global-filter-strip { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 14px 0 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.78); }
.global-filter-strip form { display: flex; align-items: center; gap: 9px; min-width: 0; }
.global-filter-strip label { color: #61717d; font-size: 10px; font-weight: 650; white-space: nowrap; }
.global-filter-strip select { width: min(330px, 44vw); min-height: 36px; border: 1px solid var(--line); border-radius: 8px; padding: 6px 31px 6px 10px; background: white; color: var(--ink); font-size: 11px; }
.global-filter-strip .secondary-button { min-height: 36px; padding: 6px 13px; font-size: 11px; }
.global-filter-strip a { font-size: 10px; white-space: nowrap; }
.global-filter-strip > span { color: #7b8993; font: 9px var(--mono); white-space: nowrap; }
.global-plan-head { align-items: center; }
.global-plan-head-actions { display: flex; align-items: center; gap: 9px; }
.global-status-filter { display: flex; align-items: center; gap: 7px; }
.global-status-filter label { color: #687883; font-size: 10px; font-weight: 650; white-space: nowrap; }
.global-status-filter select { min-width: 118px; min-height: 38px; border: 1px solid var(--line); border-radius: 9px; padding: 7px 30px 7px 10px; background: white; color: var(--ink); font-size: 11px; }
.global-plan-tabs { display: flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 10px; background: #edf2f4; }
.global-plan-tab { display: flex; align-items: center; gap: 9px; border: 0; border-radius: 7px; padding: 8px 12px; background: transparent; color: #667580; font-size: 11px; font-weight: 650; cursor: pointer; transition: background .16s ease, color .16s ease, box-shadow .16s ease; }
.global-plan-tab small { min-width: 20px; border-radius: 9px; padding: 2px 5px; background: rgba(20,34,51,.07); font: 700 8px var(--mono); text-align: center; }
.global-plan-tab[data-plan-tab="live"][aria-selected="true"] { background: var(--blue); color: white; box-shadow: 0 4px 11px rgba(39,107,143,.2); }
.global-plan-tab[data-plan-tab="product"][aria-selected="true"] { background: var(--orange); color: white; box-shadow: 0 4px 11px rgba(255,117,71,.2); }
.global-plan-tab[aria-selected="true"] small { background: rgba(255,255,255,.2); }
.plan-data-panel[hidden] { display: none; }
.plan-delete-form { margin: 0; }
.plan-delete-form .danger-action { color: var(--red); white-space: nowrap; }
.plan-delete-form .danger-action:disabled { color: #8a969e; }
.manual-stop-form .stop-plan-button { min-height: 34px; padding: 6px 11px; border-color: #efc8c3; background: #fff7f5; color: var(--red); white-space: nowrap; }
.manual-stop-form .stop-plan-button:hover { border-color: #e5aaa2; background: #fff0ed; }
.manual-stop-form .stop-plan-button:disabled { border-color: var(--line); background: #f5f7f8; color: #8a969e; opacity: 1; }
.aweme-option { min-width: 0; display: grid; grid-template-columns: auto 1fr; gap: 8px; align-items: center; padding: 9px 10px; border-radius: 7px; background: white; cursor: pointer; }
.aweme-option:hover { background: #f3f7f8; }
.aweme-option.selected { background: var(--orange-soft); box-shadow: inset 3px 0 var(--orange); }
.aweme-option.excluded { background: #fff3f1; box-shadow: inset 3px 0 var(--red); }
.aweme-option.excluded strong { color: var(--red); }
.aweme-option input { width: 16px; height: 16px; margin: 0; }
.aweme-option span, .aweme-option strong, .aweme-option small { min-width: 0; display: block; }
.aweme-option strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.aweme-option small { margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #76858f; font-size: 8px; }
.global-chart-head-actions { display: flex; align-items: center; margin-left: auto; }
.global-chart-tabs { display: flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 10px; background: #edf2f4; }
.global-chart-tab { border: 0; border-radius: 7px; padding: 7px 13px; background: transparent; color: #667580; font-size: 11px; font-weight: 650; cursor: pointer; }
.global-chart-tab[data-ranking-mode="live"][aria-pressed="true"] { background: var(--blue); color: white; }
.global-chart-tab[data-ranking-mode="product"][aria-pressed="true"] { background: var(--orange); color: white; }
.global-chart-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.global-chart-item { min-width: 0; padding: 14px 14px 16px; border-right: 1px solid var(--line); }
.global-chart-item:last-child { border-right: 0; }
.global-chart-item > div { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 7px; }
.global-chart-item strong { font-size: 12px; }
.global-chart-item span { color: #87949d; font-family: var(--mono); font-size: 8px; letter-spacing: .12em; }
.global-chart-item canvas { width: 100%; height: 230px; display: block; }
.global-chart-empty { padding: 54px 20px; text-align: center; color: #84919b; font-size: 12px; }
.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 17px; margin-bottom: 20px; }
.chart-card { min-width: 0; background: white; border: 1px solid var(--line); border-radius: var(--radius); padding: 19px; }
.chart-card.wide { grid-column: 1 / -1; }
.chart-card > div { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.chart-card span { font-size: 12px; font-weight: 650; }
.chart-card strong { color: #8a969e; font-size: 10px; }
.chart-card canvas { width: 100%; height: 190px; display: block; }

.analysis-page-head { align-items: center; margin-bottom: 20px; }
.analysis-page-head > div { max-width: 760px; }
.analysis-query-panel { margin-bottom: 18px; overflow: hidden; border: 1px solid var(--line); border-radius: 5px 16px 5px 16px; background: rgba(255,255,255,.92); box-shadow: 0 10px 28px rgba(20,34,51,.045); }
.analysis-scope-switch { display: flex; gap: 6px; padding: 14px 18px 0; }
.analysis-scope-switch label { position: relative; cursor: pointer; }
.analysis-scope-switch input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.analysis-scope-switch span { min-height: 34px; display: inline-flex; align-items: center; padding: 7px 13px; border: 1px solid var(--line); border-radius: 18px; background: white; color: #687782; font-size: 10px; font-weight: 650; transition: background .16s ease, border-color .16s ease, color .16s ease; }
.analysis-scope-switch input:checked + span { border-color: var(--ink); background: var(--ink); color: white; }
.analysis-scope-switch input:focus-visible + span { outline: 3px solid rgba(39,107,143,.28); outline-offset: 3px; }
.analysis-scope-switch input:disabled + span { opacity: .42; cursor: not-allowed; }
.analysis-query-grid { display: grid; grid-template-columns: minmax(320px, 1.65fr) minmax(150px, .55fr) minmax(150px, .55fr); gap: 14px; padding: 14px 18px 18px; }
.analysis-field { min-width: 0; display: grid; gap: 6px; }
.analysis-field label { color: #687782; font-size: 9px; font-weight: 650; }
.analysis-field input[type="date"] { width: 100%; min-height: 42px; padding: 8px 10px; border: 1px solid #cfdade; border-radius: 8px; background: #fbfcfc; color: var(--ink); font: 11px var(--mono); }
.analysis-target-field select { font-size: 11px; }
.analysis-range-note { margin: -8px 18px 14px; color: #996124; font-size: 9px; }
.analysis-loading { min-height: 92px; display: flex; align-items: center; gap: 15px; margin-bottom: 18px; padding: 20px 23px; border: 1px solid #c9dde5; border-radius: 5px 16px 5px 16px; background: #edf6f8; }
.analysis-loading[hidden] { display: none; }
.analysis-loading > span { width: 34px; height: 34px; flex: 0 0 auto; border: 2px solid #b9d1dc; border-top-color: var(--orange); border-radius: 50%; animation: analysis-spin .8s linear infinite; }
.analysis-loading strong, .analysis-loading small { display: block; }
.analysis-loading strong { font-family: "Songti SC", "STSong", "SimSun", serif; font-size: 16px; }
.analysis-loading small { margin-top: 4px; color: #6f808b; font-size: 9px; }
@keyframes analysis-spin { to { transform: rotate(360deg); } }

.ai-brief { position: relative; display: grid; grid-template-columns: 54px minmax(0, 1fr); overflow: hidden; border: 1px solid #cbd6db; border-radius: 5px 19px 5px 19px; background: rgba(255,255,255,.96); box-shadow: var(--shadow); }
.ai-brief::before { content: ""; position: absolute; top: 0; right: 0; width: 130px; height: 4px; background: var(--blue); }
.ai-brief.tone-positive::before { background: var(--green); }
.ai-brief.tone-negative::before { background: var(--orange); }
.ai-brief-spine { display: grid; align-content: space-between; justify-items: center; padding: 25px 0 20px; border-right: 1px solid #314355; background: var(--ink); }
.ai-brief-spine span { color: #7f96a6; font: 700 8px var(--mono); letter-spacing: .18em; writing-mode: vertical-rl; }
.ai-brief-spine span:nth-child(2) { color: #b5c5cf; }
.ai-brief-spine span:last-child { color: var(--orange); }
.ai-brief-main { min-width: 0; }
.ai-verdict { padding: 31px 34px 27px; border-bottom: 1px solid var(--line); }
.ai-verdict-kicker { display: flex; align-items: center; gap: 10px; }
.ai-verdict-kicker > span { color: var(--blue); font: 700 9px var(--mono); letter-spacing: .14em; text-transform: uppercase; }
.ai-verdict-kicker strong { padding: 4px 8px; border-radius: 4px; background: #edf1f3; color: #60717c; font-size: 9px; }
.ai-verdict-kicker strong.tone-positive { background: #e5f3ed; color: var(--green); }
.ai-verdict-kicker strong.tone-negative { background: var(--orange-soft); color: var(--red); }
.ai-verdict h2 { max-width: 900px; margin: 13px 0 9px; font-size: clamp(25px, 3vw, 36px); line-height: 1.25; letter-spacing: -.025em; }
.ai-verdict > p { max-width: 850px; margin: 0; color: #4f5f6b; font-size: 13px; }
.ai-context-line { display: flex; flex-wrap: wrap; gap: 7px 18px; margin-top: 18px; }
.ai-context-line span { position: relative; color: #77858f; font-size: 9px; }
.ai-context-line span:not(:last-child)::after { content: ""; position: absolute; top: 3px; right: -10px; width: 2px; height: 2px; border-radius: 50%; background: #98a5ad; }
.ai-metric-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-bottom: 1px solid var(--line); background: #f8fafb; }
.ai-metric-strip > div { min-width: 0; min-height: 111px; display: grid; align-content: center; gap: 5px; padding: 18px 21px; border-right: 1px solid var(--line); }
.ai-metric-strip > div:last-child { border-right: 0; }
.ai-metric-strip span { color: #71808b; font-size: 9px; }
.ai-metric-strip strong { overflow: hidden; color: var(--ink); font-size: clamp(18px, 2vw, 25px); text-overflow: ellipsis; white-space: nowrap; }
.ai-metric-strip small { font-size: 8px; }
.tone-positive { color: var(--green) !important; }
.tone-negative { color: var(--red) !important; }
.tone-neutral { color: #7b8993 !important; }
.ai-reading-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(280px, .65fr); }
.ai-findings, .ai-actions { min-width: 0; padding: 27px 30px 30px; }
.ai-actions { border-left: 1px solid var(--line); background: #f9fafb; }
.ai-section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; margin-bottom: 17px; }
.ai-section-title > span { font-family: "Songti SC", "STSong", "SimSun", serif; font-size: 18px; font-weight: 700; }
.ai-section-title small { color: #84929b; font: 700 8px var(--mono); letter-spacing: .14em; }
.ai-finding-list { display: grid; }
.ai-finding-list article { display: grid; grid-template-columns: 42px minmax(0, 1fr); gap: 13px; padding: 14px 0; border-top: 1px solid #e6ebed; }
.ai-finding-list article:first-child { padding-top: 0; border-top: 0; }
.finding-mark { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid #ccd7dc; border-radius: 50%; color: #667680; font-size: 9px; font-weight: 700; }
.finding-mark.tone-positive { border-color: #b9d9cc; background: #eef7f3; }
.finding-mark.tone-negative { border-color: #efc6b9; background: #fff5f1; }
.ai-finding-list strong { display: block; margin-bottom: 4px; font-size: 11px; }
.ai-finding-list p { margin: 0; color: #63727d; font-size: 10px; line-height: 1.6; }
.ai-actions ol { display: grid; gap: 13px; margin: 0; padding: 0; list-style: none; }
.ai-actions li { display: grid; grid-template-columns: 24px 1fr; gap: 10px; align-items: start; }
.ai-actions li > span { width: 22px; height: 22px; display: grid; place-items: center; border: 1px solid #bdcbd1; border-radius: 50%; color: var(--blue); font: 700 8px var(--mono); }
.ai-actions li p { margin: 1px 0 0; color: #4f5f6b; font-size: 10px; line-height: 1.55; }
.analysis-trend { padding: 26px 30px 30px; border-top: 1px solid var(--line); }
.analysis-trend-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.analysis-trend .chart-card { padding: 15px; border-radius: 10px; background: #fbfcfc; }
.analysis-trend .chart-card canvas { height: 160px; }
.ai-source-line { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 12px 30px; border-top: 1px solid var(--line); background: #f5f8f9; color: #82909a; font-size: 8px; }
.analysis-empty p { margin: 8px 0 0; font-size: 11px; }
.analysis-empty div { display: flex; justify-content: center; gap: 9px; }

.ai-chat-fab { position: fixed; right: 28px; bottom: 28px; z-index: 45; display: flex; align-items: center; gap: 11px; min-width: 178px; padding: 9px 15px 9px 9px; border: 1px solid rgba(255,255,255,.12); border-radius: 16px 5px 16px 5px; background: var(--ink); color: white; cursor: pointer; box-shadow: 0 16px 38px rgba(20,34,51,.26); text-align: left; transition: transform .18s ease, box-shadow .18s ease, background .18s ease; }
.ai-chat-fab:hover { background: #1d3b50; box-shadow: 0 20px 44px rgba(20,34,51,.32); transform: translateY(-2px); }
.ai-chat-fab:focus-visible { outline: 3px solid rgba(255,117,71,.3); outline-offset: 3px; }
.ai-chat-fab-mark { width: 38px; height: 38px; flex: 0 0 38px; display: grid; place-items: center; border-radius: 11px 3px 11px 3px; background: var(--orange); color: white; font: 750 10px var(--mono); letter-spacing: .08em; }
.ai-chat-fab.is-ready .ai-chat-fab-mark { box-shadow: inset 0 0 0 1px rgba(255,255,255,.22), 0 0 0 4px rgba(255,117,71,.11); }
.ai-chat-fab > span:last-child { display: grid; gap: 3px; }
.ai-chat-fab strong { font-size: 11px; letter-spacing: .03em; }
.ai-chat-fab small { color: #b9c7cf; font-size: 8px; }
.ai-chat-modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 24px; }
.ai-chat-modal[hidden] { display: none; }
.ai-chat-backdrop { position: absolute; inset: 0; background: rgba(13,28,39,.58); backdrop-filter: blur(3px); animation: ai-chat-backdrop-in .18s ease-out; }
.ai-chat-dialog { position: relative; width: min(1040px, 100%); height: min(720px, calc(100vh - 48px)); height: min(720px, calc(100dvh - 48px)); max-height: 720px; display: grid; grid-template-rows: auto minmax(0, 1fr); overflow: hidden; border: 1px solid #cbd6db; border-radius: 18px 6px 18px 6px; background: rgba(255,255,255,.98); box-shadow: 0 28px 90px rgba(7,19,27,.34); animation: ai-chat-dialog-in .2s cubic-bezier(.2,.75,.25,1); }
.ai-chat-head { min-height: 77px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 17px 20px 17px 24px; border-bottom: 1px solid var(--line); }
.ai-chat-head h2 { margin-top: 5px; font-size: 22px; }
.ai-chat-head-actions { display: flex; align-items: center; gap: 10px; }
.ai-chat-close { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid #d6e0e4; border-radius: 50%; background: white; color: #536570; cursor: pointer; font: 300 21px/1 Arial, sans-serif; transition: border-color .15s ease, color .15s ease, transform .15s ease; }
.ai-chat-close:hover { border-color: #f0b49f; color: var(--red); transform: rotate(4deg); }
.ai-model-state { display: inline-flex; align-items: center; gap: 7px; padding: 6px 9px; border: 1px solid #d8e0e4; border-radius: 5px; background: #f3f6f7; color: #7b8993; font: 8px var(--mono); }
.ai-model-state i { width: 6px; height: 6px; border-radius: 50%; background: #9eabb3; }
.ai-model-state.is-ready { border-color: #c6dfd6; background: #eef7f3; color: var(--green); }
.ai-model-state.is-ready i { background: var(--green); box-shadow: 0 0 0 3px rgba(36,114,92,.1); }
.ai-chat-layout { min-height: 0; display: grid; grid-template-columns: minmax(235px, .38fr) minmax(0, 1fr); }
.ai-chat-context { padding: 25px 24px; border-right: 1px solid var(--line); background: #f6f8f9; }
.context-label { display: block; margin-bottom: 12px; color: var(--blue); font: 700 8px var(--mono); letter-spacing: .12em; }
.ai-chat-context > strong { display: block; font-family: "Songti SC", "STSong", "SimSun", serif; font-size: 18px; line-height: 1.45; }
.ai-chat-context dl { display: grid; gap: 0; margin: 19px 0; border-top: 1px solid #dfe6e9; }
.ai-chat-context dl div { display: grid; grid-template-columns: 54px minmax(0, 1fr); gap: 8px; padding: 10px 0; border-bottom: 1px solid #dfe6e9; }
.ai-chat-context dt { color: #81909a; font-size: 9px; }
.ai-chat-context dd { margin: 0; color: #42535f; font-size: 9px; line-height: 1.5; }
.ai-chat-context > p { margin: 0 0 19px; color: #71808b; font-size: 9px; line-height: 1.65; }
.ai-prompt-list { display: grid; gap: 7px; }
.ai-prompt-list button { width: 100%; min-height: 35px; padding: 8px 10px; border: 1px solid #d5dfe3; border-radius: 7px; background: white; color: #52636e; cursor: pointer; font-size: 9px; text-align: left; transition: border-color .15s ease, color .15s ease, transform .15s ease; }
.ai-prompt-list button::before { content: "↗"; margin-right: 7px; color: var(--orange); font-family: var(--mono); }
.ai-prompt-list button:hover { border-color: #96b6c4; color: var(--blue); transform: translateX(2px); }
.ai-prompt-list button:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.ai-chat-workspace { min-width: 0; min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto; background: white; }
.ai-chat-messages { min-height: 0; display: grid; align-content: start; gap: 17px; padding: 28px 30px; overflow-y: auto; scroll-behavior: smooth; }
.ai-message { display: grid; grid-template-columns: 31px minmax(0, 1fr); gap: 10px; align-items: start; max-width: 86%; }
.ai-message > span { width: 29px; height: 29px; display: grid; place-items: center; border: 1px solid #b8cbd4; border-radius: 50%; background: #edf5f7; color: var(--blue); font: 700 8px var(--mono); }
.ai-message p { margin: 0; padding: 11px 14px; border: 1px solid #dce4e7; border-radius: 3px 12px 12px 12px; background: #f7f9fa; color: #3e4f5b; font-size: 11px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.ai-message.user { justify-self: end; grid-template-columns: minmax(0, 1fr) 31px; }
.ai-message.user > span { grid-column: 2; border-color: #f2c5b5; background: var(--orange-soft); color: var(--red); }
.ai-message.user p { grid-column: 1; grid-row: 1; border-color: #cadde5; border-radius: 12px 3px 12px 12px; background: #edf5f8; }
.ai-message.error p { border-color: #efcaca; background: #fff4f4; color: var(--red); }
.ai-message.pending p { display: flex; align-items: center; gap: 5px; min-height: 43px; }
.ai-message.pending i { width: 4px; height: 4px; border-radius: 50%; background: var(--blue); animation: ai-chat-dot 1s ease-in-out infinite; }
.ai-message.pending i:nth-child(2) { animation-delay: .14s; }
.ai-message.pending i:nth-child(3) { animation-delay: .28s; }
@keyframes ai-chat-dot { 0%, 70%, 100% { opacity: .25; transform: translateY(0); } 35% { opacity: 1; transform: translateY(-3px); } }
.ai-chat-form { padding: 16px 20px 18px; border-top: 1px solid var(--line); background: #f8fafb; }
.ai-chat-form > label { display: block; margin-bottom: 7px; color: #64747f; font-size: 9px; font-weight: 650; }
.ai-chat-form > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px; align-items: end; }
.ai-chat-form textarea { min-height: 58px; max-height: 150px; padding: 11px 12px; background: white; font-size: 11px; line-height: 1.55; resize: none; }
.ai-chat-form .primary-button { min-height: 44px; }
.ai-chat-form > small { display: block; margin-top: 6px; color: #8a969e; font-size: 8px; }
body.ai-chat-open { overflow: hidden; }
@keyframes ai-chat-backdrop-in { from { opacity: 0; } }
@keyframes ai-chat-dialog-in { from { opacity: 0; transform: translateY(12px) scale(.985); } }

@media (max-width: 1180px) {
  .control-flow-step { grid-template-columns: minmax(170px, .55fr) minmax(0, 1.8fr); }
  .control-flow-action { grid-column: 2; align-self: auto; align-items: center; flex-direction: row; padding: 14px 0 0; border-top: 1px solid var(--line); border-left: 0; }
  .control-flow-action .primary-button, .control-flow-action .secondary-button, .control-flow-action form { width: auto; min-width: 145px; }
  .control-flow-action small { max-width: 260px; text-align: left; }
  .token-actions { justify-content: flex-start; }
  .template-table-scroll { overflow-x: auto; }
  .threshold-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .overview-status { grid-template-columns: minmax(280px, .9fr) minmax(420px, 1.1fr); }
  .plan-state-grid { grid-template-columns: 1fr 1fr; }
  .plan-state-grid article { border-bottom: 1px solid var(--line); }
  .plan-state-grid article:nth-child(2n) { border-right: 0; }
  .plan-state-grid article:nth-last-child(-n+2) { border-bottom: 0; }
  .dashboard-content { grid-template-columns: 1fr; }
  .global-account-controls.has-aweme { grid-template-columns: auto minmax(220px, 1fr) auto minmax(190px, 1fr); grid-template-areas: "account-label account-select aweme-label aweme-select" ". account-view . full-refresh"; }
  .analysis-query-grid { grid-template-columns: minmax(280px, 1fr) minmax(140px, .5fr) minmax(140px, .5fr); }
}

@media (max-width: 1040px) {
  .overview-status { grid-template-columns: 1fr; }
  .overview-verdict { border-right: 0; border-bottom: 1px solid rgba(255,255,255,.1); }
}

@media (max-width: 820px) {
  .side-rail { visibility: hidden; padding-top: max(26px, env(safe-area-inset-top)); padding-bottom: max(20px, env(safe-area-inset-bottom)); overscroll-behavior: contain; transform: translateX(-100%); transition: transform .22s ease, visibility .22s ease; box-shadow: var(--shadow); }
  .side-rail.open { visibility: visible; transform: translateX(0); }
  .nav-scrim { display: block; position: fixed; inset: 0; z-index: 19; border: 0; background: rgba(13,28,39,.42); opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .22s ease, visibility .22s ease; }
  body.menu-open { overflow: hidden; }
  body.menu-open .nav-scrim { opacity: 1; visibility: visible; pointer-events: auto; }
  .menu-button { display: block; position: fixed; right: max(16px, env(safe-area-inset-right)); top: max(16px, env(safe-area-inset-top)); z-index: 30; min-width: 44px; min-height: 44px; border: 1px solid var(--line); background: white; border-radius: 8px; padding: 8px 11px; color: var(--ink); }
  .app-shell { margin-left: 0; padding: calc(70px + env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(45px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left)); }
  .page-head { align-items: flex-start; flex-direction: column; gap: 20px; margin-bottom: 24px; }
  .control-page-head { padding-top: 0; }
  .control-page-head h1 { font-size: 30px; }
  .control-page-date { margin: 0; }
  .control-flow-step { grid-template-columns: 1fr; gap: 22px; min-height: 0; padding: 25px 22px; }
  .control-flow-step:last-child { min-height: 0; }
  .control-flow-spine { grid-template-columns: 30px minmax(0, 1fr); padding: 0 0 18px; border-right: 0; border-bottom: 1px solid #c9d9e0; }
  .control-flow-copy p { max-width: 520px; }
  .control-flow-action { grid-column: 1; align-items: stretch; flex-direction: column; padding-top: 18px; }
  .control-flow-action .primary-button, .control-flow-action .secondary-button, .control-flow-action form { width: 100%; }
  .control-flow-action small { max-width: none; text-align: center; }
  .control-token-body { grid-template-columns: 1fr; }
  .overview-status { grid-template-columns: 1fr; }
  .overview-verdict { border-right: 0; border-bottom: 1px solid rgba(255,255,255,.1); }
  .settings-layout { grid-template-columns: 1fr; }
  .template-toolbar { align-items: stretch; flex-direction: column; gap: 12px; }
  .template-filter-controls { justify-content: flex-end; }
  .template-search-field input { width: min(360px, 60vw); }
  .form-grid-three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .plan-query-form { grid-template-columns: 1fr; gap: 16px; }
  .plan-query-control { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .plan-query-control .primary-button { width: 100%; }
  .plan-statistics-panel .panel-head { align-items: flex-start; flex-direction: column; gap: 10px; }
  .plan-statistics-panel .panel-head p { max-width: none; text-align: left; }
  .auto-plan-head { align-items: flex-start; flex-direction: column; gap: 10px; }
  .resource-index { grid-template-columns: 1fr 1fr; }
  .resource-index div:nth-child(2) { border-right: 0; }
  .resource-index div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .global-account-controls { align-items: stretch; flex-direction: column; }
  .global-account-form { grid-template-columns: 1fr; align-items: stretch; }
  .global-refresh-form .primary-button { width: 100%; }
  .global-account-controls.has-aweme { display: grid; grid-template-columns: 1fr; grid-template-areas: "account-label" "account-select" "aweme-label" "aweme-select" "account-view" "full-refresh"; }
  .aweme-dropdown-menu { width: 100%; }
  .snapshot-status { align-items: flex-start; flex-direction: column; }
  .global-filter-strip { align-items: stretch; flex-direction: column; }
  .global-filter-strip form { display: grid; grid-template-columns: 1fr auto; }
  .global-filter-strip label, .global-filter-strip a { grid-column: 1 / -1; }
  .global-filter-strip select { width: 100%; }
  .global-plan-head { align-items: stretch; flex-direction: column; gap: 14px; }
  .global-plan-head-actions { align-items: stretch; flex-direction: column; }
  .global-status-filter { justify-content: space-between; }
  .global-status-filter select { flex: 1; }
  .global-plan-tabs, .global-plan-tab { flex: 1; justify-content: center; }
  .global-chart-section .panel-head { align-items: stretch; flex-direction: column; gap: 14px; }
  .global-chart-head-actions { justify-content: flex-end; margin-left: 0; }
  .global-chart-grid { grid-template-columns: 1fr; }
  .global-chart-item { border-right: 0; border-bottom: 1px solid var(--line); }
  .global-chart-item:last-child { border-bottom: 0; }
  .analysis-query-grid { grid-template-columns: 1fr 1fr; }
  .analysis-target-field { grid-column: 1 / -1; }
  .ai-brief { grid-template-columns: 42px minmax(0, 1fr); }
  .ai-verdict { padding: 26px 24px 23px; }
  .ai-metric-strip { grid-template-columns: 1fr 1fr; }
  .ai-metric-strip > div:nth-child(2) { border-right: 0; }
  .ai-metric-strip > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .ai-reading-grid { grid-template-columns: 1fr; }
  .ai-actions { border-top: 1px solid var(--line); border-left: 0; }
  .ai-chat-modal { padding: 18px; }
  .ai-chat-dialog { height: min(720px, calc(100vh - 36px)); height: min(720px, calc(100dvh - 36px)); }
  .ai-chat-layout { grid-template-columns: minmax(210px, .42fr) minmax(0, 1fr); }
}

@media (max-width: 560px) {
  .login-card { padding: 32px 25px; }
  .primary-button, .secondary-button, input[type="text"], input[type="search"], input[type="password"], input[type="number"], input[type="url"], input[type="time"], select { min-height: 44px; }
  .chart-grid, .form-grid { grid-template-columns: 1fr; }
  .plan-query-control, .material-choice-list { grid-template-columns: 1fr; }
  .material-query-head { align-items: stretch; flex-direction: column; }
  .page-head > .primary-button, .page-head > .secondary-button, .page-head > form { width: 100%; }
  .page-head > form .primary-button, .page-head > form .secondary-button { width: 100%; }
  .panel-head { align-items: flex-start; flex-wrap: wrap; gap: 10px 18px; }
  .overview-verdict { padding: 25px 23px 24px 26px; }
  .overview-state { margin-top: 20px; }
  .overview-facts { grid-template-columns: 1fr; }
  .overview-facts > div, .overview-facts > div:nth-child(2n), .overview-facts > div:nth-last-child(-n+2) { padding: 20px 23px; border-right: 0; border-bottom: 1px solid rgba(255,255,255,.1); }
  .overview-facts > div:last-child { border-bottom: 0; }
  .overview-section-head { align-items: flex-start; flex-direction: column; gap: 8px; }
  .overview-section-head > p { text-align: left; }
  .plan-state-grid { grid-template-columns: 1fr; }
  .plan-state-grid article, .plan-state-grid article:nth-child(2n), .plan-state-grid article:nth-last-child(-n+2) { min-height: 96px; border-right: 0; border-bottom: 1px solid var(--line); }
  .plan-state-grid article:last-child { border-bottom: 0; }
  .field.full, .form-actions.full, .form-error.full, .chart-card.wide { grid-column: 1; }
  .form-panel { padding: 20px; }
  .control-safety-fields, .control-token-dates { grid-template-columns: 1fr; }
  .control-token-dates > div + div { border-top: 1px solid var(--line); border-left: 0; }
  .control-flow-footnote { padding: 16px 22px; }
  .import-panel { align-items: flex-start; flex-direction: column; }
  .form-grid-three, .threshold-grid { grid-template-columns: 1fr; }
  .template-toolbar .bulk-enable-form { flex-wrap: wrap; }
  .template-filter-controls { align-items: stretch; flex-direction: column; }
  .template-search-field input { width: 100%; min-height: 44px; }
  .template-status-filter { min-height: 44px; justify-content: space-between; }
  .template-status-filter select { flex: 1; min-height: 34px; }
  .template-bulk-button { min-height: 44px; }
  .template-toggle-button, .template-more-button { min-height: 44px; }
  .table-actions .secondary-button, .rail-foot .text-button { min-height: 44px; }
  .inline-action { min-height: 44px; padding-block: 8px; }
  .editor-section-head { grid-template-columns: 36px 1fr; padding: 18px; }
  .editor-section-body { padding: 18px; }
  .payload-editor summary { align-items: flex-start; flex-direction: column; }
  .editor-actions { flex-wrap: wrap; }
  .editor-actions span { width: 100%; margin-left: 0; }
  .choice-field > div { grid-template-columns: 1fr; }
  .material-grid { grid-template-columns: 1fr; padding: 14px; }
  .material-toolbar { grid-template-columns: 1fr; padding: 14px 14px 0; }
  .material-actions { align-items: flex-start; flex-direction: column; padding: 0 14px 16px; }
  .material-actions-top { padding: 14px 14px 0; }
  .filter-bar label { align-items: flex-start; flex-direction: column; }
  .plan-query-control { grid-template-columns: 1fr; }
  .plan-query-control .primary-button { width: 100%; }
  .plan-result-head { align-items: flex-start; flex-direction: column; }
  .read-boundary { flex-wrap: wrap; }
  .read-boundary .blocked { margin-left: 0; }
  .resource-index { grid-template-columns: 1fr; }
  .resource-index div, .resource-index div:nth-child(2) { border-right: 0; border-bottom: 1px solid var(--line); }
  .resource-index div:last-child { border-bottom: 0; }
  .analysis-page-head { gap: 18px; }
  .analysis-page-head .secondary-button { width: 100%; }
  .analysis-scope-switch { display: grid; grid-template-columns: repeat(3, 1fr); }
  .analysis-scope-switch span { justify-content: center; padding-inline: 7px; }
  .analysis-query-grid { grid-template-columns: 1fr; }
  .analysis-target-field { grid-column: 1; }
  .ai-brief { grid-template-columns: 31px minmax(0, 1fr); }
  .ai-brief-spine { padding-block: 20px; }
  .ai-verdict { padding: 23px 18px 20px; }
  .ai-context-line { display: grid; gap: 6px; }
  .ai-context-line span::after { display: none; }
  .ai-metric-strip { grid-template-columns: 1fr; }
  .ai-metric-strip > div, .ai-metric-strip > div:nth-child(2) { min-height: 90px; border-right: 0; border-bottom: 1px solid var(--line); }
  .ai-metric-strip > div:last-child { border-bottom: 0; }
  .ai-findings, .ai-actions, .analysis-trend { padding: 22px 18px; }
  .analysis-trend-grid { grid-template-columns: 1fr; }
  .ai-source-line { display: grid; padding: 12px 18px; }
  .analysis-empty div { align-items: stretch; flex-direction: column; }
  .ai-chat-fab { right: 16px; bottom: 16px; min-width: 164px; }
  .ai-chat-modal { align-items: end; padding: 10px 0 0; }
  .ai-chat-dialog { width: 100%; height: calc(100vh - 10px); height: calc(100dvh - 10px); max-height: none; border-right: 0; border-bottom: 0; border-left: 0; border-radius: 18px 18px 0 0; }
  .ai-chat-head { min-height: 68px; gap: 10px; padding: 13px 14px 13px 17px; }
  .ai-chat-head h2 { font-size: 19px; }
  .ai-chat-head .eyebrow { display: none; }
  .ai-chat-head-actions { gap: 7px; }
  .ai-model-state { max-width: 126px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ai-chat-close { width: 34px; height: 34px; flex: 0 0 34px; }
  .ai-chat-layout { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .ai-chat-context { min-width: 0; padding: 13px 16px 14px; overflow: hidden; border-right: 0; border-bottom: 1px solid var(--line); }
  .ai-chat-context > strong { overflow: hidden; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
  .ai-chat-context dl, .ai-chat-context > p { display: none; }
  .context-label { margin-bottom: 6px; }
  .ai-prompt-list { display: flex; gap: 7px; margin-top: 11px; overflow-x: auto; scrollbar-width: none; }
  .ai-prompt-list::-webkit-scrollbar { display: none; }
  .ai-prompt-list button { width: auto; min-width: max-content; min-height: 32px; }
  .ai-chat-workspace { grid-template-rows: minmax(0, 1fr) auto; }
  .ai-chat-messages { padding: 20px 16px; }
  .ai-message { max-width: 96%; }
  .ai-chat-form { padding: 12px 14px max(14px, env(safe-area-inset-bottom)); }
  .ai-chat-form > div { grid-template-columns: 1fr; }
  .ai-chat-form .primary-button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
