:root {
  color-scheme: light;
  --ground:#e9efe8; --surface:#ffffff; --raised:#f5f8f4; --active:#e9eee8;
  --border:#e0e6df; --rule:#e9eee8; --control:#cfd8cf;
  --text:#111814; --muted:#59645c; --faint:#6e7770;
  --primary:#14382a; --chart:#2f6b4f;
  --positive:#2f6b4f; --negative:#c53a30; --warning:#9b641e;
  --pill-positive-bg:#e9f1ea; --pill-positive-ink:#14382a;
  --pill-negative-bg:#fff3f1; --pill-negative-ink:#c53a30;
  --pill-warning-bg:#fff8ea; --pill-warning-ink:#9b641e;
  --pill-neutral-bg:#f5f8f4; --pill-neutral-ink:#59645c;
  --radius-card:16px; --radius-control:9px; --sidebar-width:232px;
  --gap:12px; --pad:24px; --control-height:36px; --row-height:52px;
  --fs-title:31px; --fs-section:19px; --fs-kpi:34px; --fs-body:14px; --fs-small:12px;
  --ink:var(--text); --ink-1:var(--text); --ink-2:#3d3d3d; --line:var(--border);
  --paper:var(--surface); --bg:var(--ground); --canvas:var(--ground);
  --green:var(--primary); --green-700:#2f6b4f; --green-soft:var(--raised);
  --red:var(--negative); --red-soft:var(--pill-negative-bg);
  --cyan:var(--muted); --amber:var(--warning);
  --page-outer:var(--ground); --panel-2:var(--raised); --border-soft:var(--rule);
  --accent:var(--primary); --accent-strong:var(--text); --accent-soft:var(--raised);
  --accent-2:var(--primary); --on-accent:#ffffff; --glow:transparent;
  --rail:#14382a; --rail-2:#10271c; --rail-ink:rgba(247,251,248,.82); --rail-ink-2:rgba(247,251,248,.68); --rail-hot:#ffffff;
  /* pre-blended white-over-rail solids: alpha backgrounds misread as text by the detector */
  --rail-line:#27483b; --rail-hover:#234538; --rail-active:#305044;
  --rail-hover-ink:#e6ede7; --rail-bright:#f4f9f5; --brand-plate:#f7fbf8;
  --green-hover:#214c37; --backdrop:rgba(16,28,20,.44);
  --on-green-plate:rgba(255,255,255,.22); --disabled-ink:#9aa69e;
  --r-lg:16px; --r:9px; --r-sm:7px;
  --shadow:none; --shadow-lg:0 1px 2px rgba(20,40,30,.035);
  --shadow-pop:0 14px 34px rgba(20,42,30,.13);
  --font:-apple-system,BlinkMacSystemFont,"SF Pro Text","SF Pro Display","PingFang SC","Hiragino Sans GB","Segoe UI",sans-serif;
  --font-mono:"SF Mono","SFMono-Regular","Cascadia Mono","Menlo",monospace;
  --font-number:"SF Pro Display","SF Pro Text","PingFang SC","Hiragino Sans GB","Segoe UI",sans-serif;
  --ease-out:cubic-bezier(.23,1,.32,1);
  --ease-drawer:cubic-bezier(.32,.72,0,1);
}
* { box-sizing:border-box; letter-spacing:0; }
* { scrollbar-width:thin; scrollbar-color:var(--control) transparent; }
::selection { background:rgba(47,107,79,.18); }
input,textarea { caret-color:var(--green-700); }
[hidden] { display:none !important; }
body { margin:0; background:var(--page-outer); color:var(--ink); font-family:var(--font); font-size:14px; line-height:1.55; }
button,input,select,textarea { font:inherit; color:inherit; }
button { min-height:32px; border:none; border-radius:7px; padding:6px 12px; background:var(--paper); box-shadow:var(--shadow); cursor:pointer; font-weight:600; font-size:13px; transition:background .15s ease,box-shadow .2s ease,transform .16s var(--ease-out); }
button:hover:not(:disabled) { background:var(--panel-2); }
button:disabled { cursor:default; color:var(--disabled-ink); background:var(--panel-2); box-shadow:none; }
button.primary { background:var(--green); color:var(--on-accent); box-shadow:0 10px 26px -10px var(--glow); }
button.primary:hover:not(:disabled) { background:var(--green-hover); }
button.primary:disabled { background:var(--panel-2); color:var(--disabled-ink); box-shadow:none; }
button.danger { color:var(--red); background:transparent; box-shadow:none; }
button.danger:hover:not(:disabled) { background:rgba(192,69,60,.08); }
:focus-visible { outline:2px solid var(--green-700); outline-offset:3px; }
input,select,textarea { min-width:0; min-height:36px; border:1px solid var(--border); border-radius:9px; background:var(--paper); padding:7px 12px; box-shadow:var(--shadow); font-weight:600; }
input:hover,select:hover,textarea:hover { border-color:var(--line); }
input:focus,select:focus,textarea:focus { border-color:var(--green-700); box-shadow:0 0 0 3px var(--green-soft); outline:none; }
input[readonly] { background:var(--panel-2); box-shadow:none; color:var(--muted); }
input[type=checkbox] { min-height:0; width:16px; height:16px; accent-color:var(--green-700); flex-shrink:0; padding:0; box-shadow:none; }
input[type=radio] { min-height:0; width:16px; height:16px; accent-color:var(--green-700); flex-shrink:0; padding:0; box-shadow:none; }
label { display:flex; flex-direction:column; gap:7px; font-size:13px; font-weight:600; color:var(--muted); }
.check-label { display:flex; flex-direction:row; align-items:center; gap:8px; font-weight:600; color:var(--muted); }
h1,h2,h3,p { margin:0; }
h1 { font-size:31px; font-weight:600; line-height:1.12; letter-spacing:0; }
h2 { font-size:19px; font-weight:600; line-height:1.2; }
h3 { font-size:15px; font-weight:600; }
.muted { color:var(--muted); font-size:12px; }
.table-tag { margin:12px 0 4px; font-weight:700; }
.brand-mark { display:grid; place-items:center; width:32px; height:32px; background:var(--green); color:var(--on-accent); border-radius:10px; font-size:18px; font-weight:700; }

/* ---------- login ---------- */
.login-screen { min-height:100dvh; display:grid; place-items:center; padding:44px 20px; background:var(--page-outer); }
.login-shell { display:grid; grid-template-columns:1fr 1fr; width:min(880px,100%); border-radius:var(--r-lg); overflow:hidden; box-shadow:var(--shadow-lg); background:var(--paper); }
.login-brandside { position:relative; background:var(--rail); color:var(--rail-bright); padding:36px; display:flex; flex-direction:column; overflow:hidden; }
.login-brand { display:flex; align-items:center; gap:10px; font-size:16px; font-weight:800; }
.login-slogan { margin-top:auto; font-size:25px; font-weight:800; line-height:1.35; position:relative; z-index:1; }
.login-side-note { margin-top:14px; color:var(--rail-ink-2); font-size:12px; font-weight:600; position:relative; z-index:1; }
.login-mark { position:absolute; right:-28px; bottom:-64px; font-size:220px; font-weight:800; color:rgba(99,199,149,.08); line-height:1; pointer-events:none; }
.login-formside { padding:36px; display:flex; flex-direction:column; justify-content:center; background:var(--paper); }
.login-form { width:100%; max-width:340px; display:grid; gap:13px; margin:0 auto; }
.login-form h1,
.login-form h2 { margin-bottom:8px; }
.login-submit { margin-top:6px; width:100%; min-height:42px; }

/* ---------- workspace shell: floating panel + dark rail ---------- */
.workspace { position:relative; display:grid; grid-template-columns:228px minmax(0,1fr); min-height:calc(100dvh - 52px); max-width:1560px; margin:26px auto; background:var(--bg); border-radius:var(--r-lg); box-shadow:var(--shadow-lg); }
.workspace::before { content:""; position:absolute; inset:0 auto 0 0; width:228px; background:var(--rail); border-radius:var(--r-lg) 0 0 var(--r-lg); z-index:0; }
.workspace::after { display:none; }
.sidebar { position:sticky; top:26px; height:calc(100dvh - 52px); display:flex; flex-direction:column; background:transparent; border-right:none; padding:20px 14px 16px; z-index:1; color:var(--rail-ink); }
.brand { display:flex; align-items:center; gap:11px; padding:2px 8px; font-size:15.5px; color:var(--rail-bright); }
.brand-text { display:flex; flex-direction:column; line-height:1.25; }
.brand-text small { font-size:12px; color:var(--rail-ink-2); font-weight:600; }
.sidebar nav { display:grid; gap:3px; margin-top:20px; overflow:auto; }
.sidebar nav button { position:relative; display:flex; align-items:center; text-align:left; background:transparent; border:none; border-radius:12px; padding:0 12px; min-height:42px; color:var(--rail-ink); font-size:13.5px; font-weight:600; box-shadow:none; }
.nav-group-title { padding:16px 12px 5px; color:var(--rail-ink-2); font-size:12px; font-weight:600; border-top:1px solid var(--rail-hover); margin-top:10px; }
.sidebar-footer { display:grid; gap:6px; margin-top:auto; padding:18px 8px 0; border-top:1px solid var(--rail-hover); overflow-wrap:anywhere; }
.sidebar-footer .muted { color:var(--rail-ink-2); }
.sidebar-footer button { justify-self:start; margin-top:9px; font-size:12px; background:transparent; box-shadow:none; color:var(--rail-ink); border-radius:9px; padding:6px 8px; min-height:32px; }
.sidebar-footer button { display:inline-flex; align-items:center; gap:7px; }
.sidebar-footer button svg { width:14px; height:14px; }
.sidebar-footer button:hover:not(:disabled) { background:var(--rail-hover); color:var(--rail-bright); }
.main-area { min-width:0; z-index:1; }
.topbar { display:flex; align-items:center; gap:12px; min-height:64px; background:transparent; padding:20px 30px 0; border-bottom:none; }
.header-actions { margin-left:auto; display:flex; align-items:center; gap:10px; }
.icon-button { display:grid; place-items:center; width:38px; height:38px; padding:0; flex-shrink:0; font-size:18px; border-radius:50%; background:var(--paper); box-shadow:var(--shadow); color:var(--muted); }
.icon-button:hover:not(:disabled) { background:var(--panel-2); }
.filters { display:flex; align-items:flex-end; flex-wrap:wrap; gap:10px; margin:14px 30px 0; padding:10px 14px; border-bottom:none; border-radius:var(--r); background:var(--paper); box-shadow:var(--shadow); }
.filters label { min-width:160px; gap:4px; font-size:12px; font-weight:600; }
.filters input,.filters select { width:100%; min-height:34px; }
.filters button[type=submit] { background:var(--green); color:var(--on-accent); box-shadow:0 10px 26px -10px var(--glow); }
.filters button[type=submit]:hover:not(:disabled) { background:var(--green-hover); }
.error { color:var(--red); background:rgba(192,69,60,.08); padding:11px 14px; border-radius:var(--r-sm); overflow-wrap:anywhere; }
.banner,.notice { margin:16px 30px 0; }
.notice { color:var(--green); background:var(--green-soft); padding:11px 14px; border-radius:var(--r-sm); }
main { padding:18px 30px 38px; max-width:1600px; }
.section-head { display:flex; align-items:center; flex-wrap:wrap; gap:12px; margin-bottom:16px; }
.section-head .muted { margin-left:auto; }
.rank-tabs { display:flex; gap:14px; margin:0 0 0 auto; }
.search-label { font-weight:400; }
.section { padding:23px 0; border-top:1px solid var(--border-soft); }
.metrics { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:16px; margin:0 0 20px; border:none; background:transparent; }
.metric { min-width:0; padding:16px 18px; background:var(--paper); border-radius:var(--r-lg); box-shadow:var(--shadow-lg); border-right:none; }
.metric-label { display:flex; align-items:center; justify-content:space-between; gap:7px; font-size:12px; font-weight:500; color:var(--muted); }
.metric-label { justify-content:flex-start; gap:8px; }
.metric-label .tag { margin-left:auto; }
.metric-ic { display:grid; place-items:center; width:34px; height:34px; border-radius:10px; background:var(--green-soft); color:var(--green-700); flex:none; }
.metric-ic svg { width:17px; height:17px; }
body.fx .fx-item { opacity:0; transform:translateY(10px); }
body.fx .fx-item.in { opacity:1; transform:none; transition:opacity .32s ease, transform .32s var(--ease-out); }
.metric-value { margin:12px 0 8px; font-family:var(--font-number); font-size:24px; font-weight:600; font-variant-numeric:tabular-nums; overflow-wrap:anywhere; }
.metric-value.pending-value { font-size:19px; color:var(--muted); font-weight:600; }
.metric-basis { display:inline-flex; width:max-content; max-width:100%; color:var(--muted); font-size:12px; min-height:17px; cursor:help; border-bottom:1px dotted currentColor; }
.metric-positive .metric-value { color:var(--green); }
.metric-negative .metric-value { color:var(--red); }
.metric-zero .metric-value { color:var(--muted); }
.profit-overview { padding-top:4px; border-top:0; }
.profit-overview .metrics { margin-bottom:0; }
.profit-overview .metric-value { font-size:24px; white-space:nowrap; }
.profit-cost-block { padding-top:22px; }
.profit-cost-block .section-head { margin-bottom:10px; }
.profit-negative { color:var(--red); }
.profit-overview + .section .analysis-rank-scroll table { min-width:760px; }
.analysis-attention { margin-top:22px; padding:14px 0 0; border-top:1px solid var(--line); }
.analysis-attention .section-head { margin-bottom:8px; }
.analysis-attention ul { margin:0; padding:0; list-style:none; }
.analysis-attention li { display:flex; align-items:center; gap:10px; padding:8px 0; border-bottom:1px solid var(--line); font-size:13px; }
.analysis-attention li > svg { width:16px; height:16px; flex:none; color:var(--amber); }
.analysis-attention li > span { flex:1; min-width:0; }
.analysis-attention li > button { flex:none; background:transparent; box-shadow:none; color:var(--green); }
.profit-ranking-tools { display:flex; align-items:center; flex-wrap:wrap; gap:16px; }
.profit-ranking-tools > .check-label { font-size:12px; }
.finance-contribution > .section-head { flex-wrap:wrap; gap:12px; }
.finance-contribution .analysis-contribution-body table { min-width:760px; }
.tag { display:inline-flex; align-items:center; gap:5px; white-space:nowrap; padding:3px 9px; font-size:12px; font-weight:600; border-radius:999px; background:rgba(44,122,140,.10); color:var(--cyan); }
.tag::before { content:""; width:6px; height:6px; border-radius:50%; background:currentColor; }
.tag.pending { background:rgba(183,122,22,.12); color:var(--amber); }
.tag.danger { background:rgba(192,69,60,.10); color:var(--red); }
.tag.inactive { color:var(--muted); background:var(--panel-2); }
.split { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:24px; }
.split > * { min-width:0; }
.empty { padding:36px 16px; text-align:center; color:var(--muted); border:0; border-radius:0; background:transparent; font-size:13px; }
.empty p { margin-top:7px; font-size:12px; }
.access-empty { padding:45px 0; max-width:500px; }
.access-empty h2 { margin-bottom:12px; }
.access-empty button { margin-top:20px; }
.table-wrap { width:100%; overflow:auto; background:var(--paper); border:none; border-radius:var(--r-lg); box-shadow:var(--shadow-lg); }
table { width:100%; border-collapse:collapse; text-align:left; font-size:14px; }
th { position:sticky; top:0; z-index:2; font-weight:500; color:var(--faint); background:var(--paper); white-space:nowrap; font-size:12px; padding:12px 16px; border-bottom:1px solid var(--line); }
th,td { vertical-align:middle; }
td { padding:13px 16px; border-bottom:1px solid var(--border-soft); overflow-wrap:anywhere; }
tbody tr:last-child td { border-bottom:0; }
tbody tr:hover { background:var(--panel-2); }
td .nowrap { white-space:nowrap; }
td.numeric,th.numeric { text-align:right; font-family:var(--font-number); font-weight:600; font-variant-numeric:tabular-nums; white-space:nowrap; }
td .numeric { font-family:var(--font-number); font-weight:600; font-variant-numeric:tabular-nums; white-space:nowrap; }
.row-actions { display:flex; flex-wrap:wrap; gap:4px; }
.row-actions button { padding:4px 10px; min-height:30px; font-size:12px; background:transparent; box-shadow:none; color:var(--green-700); }
.row-actions button:hover:not(:disabled) { background:var(--green-soft); }
.row-actions button.danger { color:var(--red); background:transparent; }
.row-actions button.danger:hover:not(:disabled) { background:rgba(192,69,60,.08); }
.page-tools .row-actions button.primary { background:var(--green); color:var(--on-accent); box-shadow:0 10px 26px -10px var(--glow); }
.page-tools .row-actions button.primary:hover:not(:disabled) { background:var(--green-hover); }
.role-list { display:flex; gap:5px; flex-wrap:wrap; }
.scope-text { max-width:240px; font-size:12px; }
.page-tools { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:12px; margin-bottom:14px; }
.page-tools input { width:260px; max-width:100%; }
.module-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); border-top:1px solid var(--border-soft); }
.module-row { display:flex; gap:12px; align-items:center; justify-content:space-between; padding:17px 13px; border-bottom:1px solid var(--border-soft); }
.module-row button { font-size:12px; padding:4px 10px; }
.status-list { margin:0; }
.status-list > div { display:flex; gap:20px; justify-content:space-between; padding:16px 0; border-bottom:1px solid var(--border-soft); }
.status-list dt { font-size:13px; }
.status-list dd { margin:0; font-size:13px; color:var(--muted); }
.data-footer { display:flex; flex-wrap:wrap; justify-content:space-between; gap:12px; padding:16px 30px 26px; color:var(--muted); font-size:12px; }

/* ---------- dialogs ---------- */
dialog { border:none; border-radius:16px; padding:25px; box-shadow:var(--shadow-pop); max-height:calc(100dvh - 40px); width:min(760px,calc(100vw - 32px)); background:var(--paper); }
dialog[open] { animation:dialogIn .22s var(--ease-out); }
@keyframes dialogIn { from { opacity:0; transform:translateY(8px) scale(.985); } to { opacity:1; transform:none; } }
dialog::backdrop { background:var(--backdrop); }
.password-dialog,.confirm-dialog { max-width:460px; }
.master-dialog { max-width:620px; }
/* 核算规则录入：独立版式，和档案字段维护的表单分开 */
.master-dialog.rule-dialog { max-width:920px; }
.rule-step { margin-top:18px; }
.rule-step + .rule-step { border-top:1px solid var(--line); padding-top:16px; }
.rule-step > h3 { margin:0 0 10px; font-size:13px; color:var(--muted); }
#detail-dialog { width:min(1040px,94vw); max-width:min(1040px,94vw); }
.dialog-heading { display:flex; align-items:center; justify-content:space-between; gap:16px; margin-bottom:22px; }
.dialog-heading { padding-bottom:14px; border-bottom:1px solid var(--border-soft); margin-bottom:18px; }
.dialog-heading h2 { min-width:0; overflow-wrap:anywhere; }
.dialog-footer { display:flex; justify-content:flex-end; gap:10px; margin-top:24px; padding-top:18px; border-top:1px solid var(--border-soft); }
.dialog-footer button { min-width:88px; }
.account-dialog .error { margin-top:15px; }
.form-grid { display:grid; grid-template-columns:1fr 1fr; gap:14px 16px; }
.label-text { display:block; }
.label-text.required::after { content:"*"; color:var(--red); margin-left:2px; }
.rule-wide { grid-column:1 / -1; min-width:0; }
.rule-parameters { margin-top:20px; }
.rule-group { grid-column:1 / -1; border:1px solid var(--line); border-radius:var(--r-sm); padding:12px 14px 14px; margin:0 0 12px; }
.rule-group > legend { padding:0 6px; font-size:12px; font-weight:600; color:var(--muted); }
.rule-group .form-grid { gap:12px 16px; }
.field-hint { font-size:12px; font-weight:400; color:var(--muted); opacity:.9; line-height:1.4; }
.rule-sub { display:block; margin-top:4px; }
/* 规则引擎 · 核算规则：灰度优先，标签弱化，间距按 4/8/16/24 刻度 */
.rules-workspace { display:flex; flex-direction:column; gap:16px; }
.rule-type-chips { display:flex; flex-wrap:wrap; gap:8px; }
.rule-type-chips button { display:inline-flex; align-items:center; gap:8px; flex-shrink:0; white-space:nowrap; min-height:30px; padding:0 10px; border:1px solid var(--line); border-radius:999px; background:transparent; box-shadow:none; font-size:12px; font-weight:600; color:var(--muted); }
.rule-type-chips button:hover:not(:disabled) { background:var(--panel-2); color:var(--ink); }
.rule-type-chips button small { font-size:12px; font-weight:500; opacity:.72; }
.rule-type-chips button i { font-style:normal; font-size:12px; font-weight:700; font-variant-numeric:tabular-nums; padding:1px 7px; border-radius:999px; background:var(--panel-2); color:var(--muted); }
.rule-type-chips button[aria-current="true"], .rule-type-chips button[aria-current="true"]:hover:not(:disabled) { background:var(--green); border-color:var(--green); color:var(--on-accent); }
.rule-type-chips button[aria-current="true"] i { background:var(--on-green-plate); color:var(--on-accent); }
.rules-filters { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.rules-filters select, .rules-filters input { height:34px; min-height:34px; padding:0 10px; border:1px solid var(--line); border-radius:var(--r-sm); background:var(--paper); box-shadow:none; font-size:12px; font-weight:500; }
.rules-filters input { width:260px; }
.rules-count { margin-left:auto; font-size:12px; color:var(--muted); font-variant-numeric:tabular-nums; }
.rules-workspace td .row-actions button.danger { color:var(--muted); }
.rules-workspace td .row-actions button.danger:hover:not(:disabled) { color:var(--red); background:rgba(192,69,60,.08); }
.rules-table td:first-child { min-width:150px; }
.rule-checks { display:flex; flex-wrap:wrap; gap:12px 18px; }
.rule-checks legend { float:none; width:100%; }
.rule-segment { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; padding:14px 0; border-bottom:1px solid var(--line); }
.rule-segment button { justify-self:start; }
.rule-detail { display:grid; grid-template-columns:150px minmax(0,1fr); gap:12px 18px; margin:0; }
.rule-detail dt { color:var(--muted); }
.rule-detail dd { margin:0; overflow-wrap:anywhere; }
/* 页签与筛选快捷条：全站同一套（描边底、选中实心、计数弱化徽标），并允许换行避免被裁切 */
.ledger-tabs { display:flex; flex-wrap:wrap; gap:8px; margin-bottom:14px; }
.line-summary summary { cursor:pointer; color:var(--muted); font-weight:600; }
.line-summary[open] summary { margin-bottom:4px; }
.analysis-rank-scroll { max-height:480px; overflow-y:auto; }
.tab-group { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.tab-group + .tab-group { border-left:1px solid var(--border-soft); padding-left:12px; margin-left:4px; }
.ledger-tabs .tab-group-label { margin:0; font-size:12px; font-weight:600; color:var(--muted); white-space:nowrap; }
.ledger-tabs button { flex-shrink:0; border:1px solid var(--line); border-radius:999px; background:transparent; box-shadow:none; padding:0 12px; min-height:32px; font-size:12px; font-weight:600; color:var(--muted); }
.ledger-tabs button:hover:not(:disabled) { background:var(--panel-2); color:var(--ink); }
.ledger-tabs button[aria-current] { color:var(--on-accent); background:var(--green); border-color:var(--green); font-weight:700; }
.ledger-tabs button[aria-current]:hover:not(:disabled) { color:var(--on-accent); background:var(--green); }
.ledger-tabs button span { margin-left:6px; font-size:12px; font-weight:700; font-variant-numeric:tabular-nums; padding:1px 6px; border-radius:999px; background:var(--panel-2); color:var(--muted); }
.ledger-tabs button[aria-current] span { background:var(--on-green-plate); color:var(--on-accent); }
.ledger-tabs button[aria-current=page] span { color:rgba(248,250,246,.75); }
.finance-queue-section { margin:18px 0 24px; }
.finance-details { margin:18px 0; border-top:1px solid var(--border-soft); border-bottom:1px solid var(--border-soft); }
.finance-details summary { min-height:50px; padding:14px 4px; cursor:pointer; font-weight:800; list-style-position:inside; }
.finance-details summary > .muted { float:right; margin-left:12px; }
.finance-details summary::marker { color:var(--green); }
.finance-details summary:focus-visible { outline:2px solid var(--green); outline-offset:3px; }
.finance-details h3 { margin:18px 0 8px; }
.finance-quick-actions { margin:12px 0 18px; }
.finance-amount { display:flex; align-items:baseline; justify-content:space-between; gap:12px; }
.finance-amount small,.finance-object-note { color:var(--muted); font-size:12px; }
.finance-object-note { display:block; max-width:360px; margin-top:4px; overflow-wrap:anywhere; }
.operation-line { position:relative; padding:18px 80px 18px 0; border-bottom:1px solid var(--border-soft); }
.operation-line { padding:14px 62px 16px 14px; border:none; background:var(--panel-2); border:1px solid var(--border-soft); border-radius:var(--r-sm); margin-top:10px; }
.remove-line { position:absolute; right:0; top:18px; }
.remove-line { right:12px; top:12px; width:32px; height:32px; min-height:32px; }
.copy-line { position:absolute; right:44px; top:18px; }
.copy-line { right:50px; top:12px; width:32px; height:32px; min-height:32px; }
.line-section { margin-top:24px; }
.line-section > button,[data-add-line] { margin-top:14px; }
.line-section > button,[data-add-line] { background:transparent; box-shadow:none; color:var(--green); font-weight:700; padding:7px 12px; }
.line-section > button::before,[data-add-line]::before { content:"+ "; font-weight:800; }
.line-section > button:hover:not(:disabled),[data-add-line]:hover:not(:disabled) { background:var(--green-soft); }
#confirm-reason-label { margin-top:16px; }
fieldset { border:0; padding:0; margin:20px 0 0; }
legend { font-weight:700; font-size:13px; margin-bottom:11px; }
.checks { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px 14px; }
.checks { display:flex; flex-wrap:wrap; gap:8px; }
.checks .check-label { position:relative; flex-direction:row; align-items:center; padding:8px 14px; border-radius:999px; background:var(--panel-2); font-size:12px; font-weight:700; color:var(--ink-2); cursor:pointer; }
.checks .check-label input { position:absolute; width:1px; height:1px; opacity:0; margin:0; }
.checks .check-label:has(input:checked) { background:var(--green); color:var(--on-accent); }
.checks .check-label:has(input:focus-visible) { outline:2px solid var(--green); outline-offset:2px; }
.form-check { background:var(--panel-2); border-radius:var(--r-sm); padding:14px 16px; display:grid; gap:9px; margin-top:20px; }
.form-check h4 { font-size:12px; font-weight:800; color:var(--ink-1); }
.form-check .check-row2 { display:flex; align-items:center; gap:9px; font-size:12px; color:var(--ink-2); }
.form-check .check-row2 svg { width:14px; height:14px; flex:none; }
.form-check .check-row2.ok svg { color:var(--green); }
.form-check .check-row2.warn svg { color:var(--amber); }
.form-check .check-row2 .go { margin-left:auto; font-size:12px; font-weight:750; color:var(--green); cursor:pointer; background:none; border:none; box-shadow:none; padding:2px 4px; }
.scope-grid { display:grid; grid-template-columns:1fr 1fr; gap:16px; }
.scope-box { margin-top:20px; border:1px solid var(--border-soft); padding:12px; border-radius:var(--r-sm); background:var(--panel-2); }
.scope-box summary { font-weight:700; font-size:13px; cursor:pointer; }
.scope-search { width:100%; margin:12px 0 9px; min-height:32px; font-size:12px; }
.scope-options { max-height:168px; overflow:auto; display:grid; gap:8px; }
.scope-options label { font-size:12px; font-weight:400; color:var(--ink); }
.scope-options small { color:var(--muted); }
.default-fields { margin-top:11px; color:var(--muted); font-size:12px; }
.password-dialog label { margin-bottom:15px; }
.mobile-only { display:none; }
.nav-scrim { display:none; }

@media (max-width:1100px) {
  .metrics { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .module-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (max-width:1200px) {
  .profit-overview .metrics { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (max-width:760px) {
  .login-shell { grid-template-columns:1fr; }
  .login-brandside { padding:26px; }
  .login-slogan { font-size:21px; }
  .login-mark { font-size:140px; }
  .workspace { display:block; max-width:none; margin:0; border-radius:0; min-height:100dvh; box-shadow:none; }
  .workspace::before { display:none; }
  .workspace::after { display:none; }
  .table-wrap table { min-width:640px; }
  .sidebar { position:fixed; z-index:30; width:260px; top:0; left:0; height:100dvh; padding:24px 15px 18px; background:var(--rail); border-radius:0; transform:translateX(-100%); transition:transform .15s ease; }
  .sidebar.open { transform:translateX(0); }
  .sidebar .brand { font-size:18px; }
  .sidebar .brand button { margin-left:auto; }
  .sidebar nav button[aria-current=page]::before { left:-15px; }
  .mobile-only { display:grid; }
  .nav-scrim { display:block; position:fixed; inset:0; z-index:29; background:rgba(16,28,20,.5); border:0; width:100%; height:100%; border-radius:0; }
  .topbar { min-height:56px; padding:14px 16px 0; }
  h1 { font-size:18px; }
  .header-actions { gap:7px; }
  .header-actions .muted { display:none; }
  .filters { margin:12px 16px 0; padding:12px 14px; gap:10px; }
  .filters label { width:calc(50% - 5px); min-width:0; }
  .filters label:last-of-type { flex:1; }
  main { padding:16px 16px 30px; }
  .metric { padding:15px; }
  .metric-value { font-size:23px; }
  .profit-overview .metric-value { font-size:16px; }
  .profit-overview .metrics { grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
  .profit-overview .metric { padding:14px 12px; }
  .profit-overview .metric-ic { display:none; }
  .profit-overview .metric-label { flex-wrap:wrap; gap:5px; }
  .analysis-attention li { align-items:flex-start; flex-wrap:wrap; }
  .analysis-attention li > span { flex-basis:calc(100% - 30px); }
  .analysis-attention li > button { margin-left:26px; padding:4px 0; min-height:36px; }
  .metric-label { align-items:flex-start; font-size:12px; }
  .profit-cost-block .table-wrap table { min-width:0; }
  .split { grid-template-columns:1fr; gap:20px; }
  .module-grid { grid-template-columns:1fr; }
  .data-footer { padding:14px 16px 22px; }
  .notice,.banner { margin:14px 16px 0; }
  .form-grid,.scope-grid { grid-template-columns:1fr; gap:12px; }
  .rule-detail { grid-template-columns:110px minmax(0,1fr); gap:10px; }
  .checks { grid-template-columns:repeat(2,minmax(0,1fr)); }
  dialog { padding:18px; max-height:calc(100dvh - 24px); }
  th,td { padding:10px 12px; }
}
@media (prefers-reduced-motion:reduce) {
  * { animation-duration:.01ms !important; transition-duration:.01ms !important; }
}

.ledger-summary { margin:10px 0 0; color:var(--muted); font-size:12px; }
.period-pick { display:inline-flex; align-items:center; gap:8px; color:var(--muted); font-size:12px; }
.period-pick select { min-height:34px; }
.ledger-pager { display:flex; gap:10px; align-items:center; justify-content:flex-end; margin-top:12px; }
.ledger-pager button { min-height:32px; padding:5px 12px; }
.ledger-pager span { font-size:12px; }

#confirm-message { white-space:pre-line; max-height:46vh; overflow:auto; }

/* Excel 导入 */
.import-dialog { width:min(980px,94vw); max-width:min(980px,94vw); }
.import-upload-row { display:flex; gap:12px; align-items:center; flex-wrap:wrap; }
.import-upload-row input[type=file] { flex:1 1 280px; min-width:0; padding:9px 12px; }
.import-history-list { list-style:none; margin:16px 0 0; padding:0; display:grid; gap:8px; }
.import-history-list button { width:100%; display:flex; flex-direction:column; gap:3px; align-items:flex-start; text-align:left; padding:10px 14px; border-radius:var(--r-sm); box-shadow:var(--shadow); }
.import-history-list strong { font-size:13.5px; }
.import-danger-zone { display:flex; gap:12px; align-items:center; flex-wrap:wrap; margin-top:16px; padding-top:14px; border-top:1px solid var(--border-soft); }
.import-danger-zone .muted { font-size:12px; }
.import-costing { border:1px solid var(--line); border-radius:var(--r-sm); background:var(--panel-2); padding:10px 14px; margin:10px 0; font-size:12px; line-height:1.7; }
.import-costing-head { font-weight:700; margin-bottom:2px; }
.import-costing p { margin:2px 0; overflow-wrap:anywhere; }
.import-costing-warn { color:var(--red); }
.import-detail { max-width:340px; overflow-wrap:anywhere; font-size:12px; color:var(--muted); }
.import-actions { display:flex; gap:14px; align-items:flex-end; flex-wrap:wrap; margin-top:16px; padding-top:16px; border-top:1px solid var(--border-soft); }
.import-actions select { min-width:170px; }
.import-report-link { align-self:center; font-weight:700; font-size:13px; color:var(--green); }
.import-fix-row td { background:var(--panel-2); }
.import-fix { display:flex; gap:14px; align-items:flex-end; flex-wrap:wrap; }
.import-fix select { min-width:200px; }
.import-dialog table td:nth-child(2), .import-dialog table td:nth-child(4), .import-dialog table td:nth-child(5), .import-dialog table td:last-child { white-space:nowrap; }

/* Achromatic ledger application shell. */
html { background:var(--ground); }
body {
  min-height:100dvh;
  background:var(--ground);
  color:var(--text);
  font-family:var(--font);
  font-size:var(--fs-body);
  line-height:1.45;
}
button,
input,
select,
textarea { font-family:var(--font); }
button {
  min-height:var(--control-height);
  border:1px solid var(--border);
  border-radius:var(--radius-control);
  padding:0 12px;
  background:var(--surface);
  box-shadow:none;
  color:var(--text);
  font-size:13px;
  font-weight:500;
  transition:background .15s ease,border-color .15s ease,color .15s ease,transform .16s var(--ease-out);
}
button:hover:not(:disabled) { background:var(--raised); border-color:var(--control); }
button.primary { border-color:var(--primary); background:var(--primary); color:#fff; }
button.primary:hover:not(:disabled) { border-color:#000; background:#000; }
button.primary:disabled { border-color:var(--raised); background:var(--raised); color:var(--faint); }
button.secondary { border-color:var(--raised); background:var(--raised); }
button.danger { border-color:transparent; background:transparent; color:var(--negative); }
button.danger:hover:not(:disabled) { border-color:transparent; background:var(--pill-negative-bg); }
button:active:not(:disabled):not(.nav-scrim):not(.th-sort) { transform:scale(.97); }
button:disabled { border-color:var(--raised); background:var(--raised); color:var(--faint); box-shadow:none; }
:focus-visible { outline:2px solid var(--text); outline-offset:2px; }

input,
select,
textarea {
  min-height:var(--control-height);
  border:1px solid var(--control);
  border-radius:var(--radius-control);
  padding:7px 10px;
  background:var(--surface);
  box-shadow:none;
  color:var(--text);
  font-size:13px;
  font-weight:400;
}
input:hover,
select:hover,
textarea:hover { border-color:var(--control); }
input:focus,
select:focus,
textarea:focus {
  border-color:var(--text);
  box-shadow:0 0 0 3px rgba(10,10,10,.07);
  outline:none;
}
input[readonly] { background:var(--raised); color:var(--muted); }
label { gap:6px; color:var(--muted); font-size:var(--fs-small); font-weight:400; }
h1,
h2,
h3 { font-weight:600; letter-spacing:0; }
h1 { font-size:var(--fs-title); line-height:1.2; }
h2 { font-size:var(--fs-section); line-height:1.35; }
h3 { font-size:14px; line-height:1.35; }
.muted { color:var(--muted); font-size:var(--fs-small); }
.numeric,
.nowrap.numeric { font-family:var(--font-number); font-weight:600; font-variant-numeric:tabular-nums; }
a { color:var(--text); text-underline-offset:2px; }
.error {
  border:0;
  border-radius:var(--radius-card);
  background:var(--pill-negative-bg);
  color:var(--pill-negative-ink);
}
.notice {
  border:0;
  border-radius:var(--radius-control);
  background:var(--green-soft);
  color:var(--green-700);
}

.workspace {
  grid-template-columns:var(--sidebar-width) minmax(0,1fr);
  min-height:100dvh;
  max-width:none;
  margin:0;
  border-radius:0;
  background:var(--ground);
  box-shadow:none;
}
.workspace::before,
.workspace::after { display:none; }
.sidebar {
  top:0;
  height:100dvh;
  padding:20px 16px 18px;
  border-right:0;
  background:var(--rail);
  color:var(--rail-ink);
}
.brand {
  gap:10px;
  padding:2px 8px 20px;
  border-bottom:1px solid var(--rail-line);
  color:var(--rail-bright);
}
.brand-mark {
  width:32px;
  height:32px;
  border-radius:10px;
  background:var(--brand-plate);
  color:var(--rail);
  font-family:var(--font);
  font-size:17px;
  font-weight:700;
  line-height:1;
}
.brand-text { line-height:1.3; }
.brand-text strong { font-size:15px; font-weight:600; }
.brand-text small { color:var(--rail-ink-2); font-size:12px; letter-spacing:0; }
.sidebar nav { gap:2px; margin-top:22px; }
.sidebar nav button {
  min-height:42px;
  gap:10px;
  border:0;
  border-radius:12px;
  padding:0 12px;
  background:transparent;
  box-shadow:none;
  color:var(--rail-ink);
  font-size:14px;
  font-weight:500;
  text-align:left;
}
.sidebar nav button svg { width:16px; height:16px; opacity:.72; color:inherit; }
.sidebar nav button:hover:not(:disabled) { background:var(--rail-hover); color:var(--rail-hover-ink); }
.sidebar nav button[aria-current=page],
.sidebar nav button[aria-current=page]:hover:not(:disabled) {
  background:var(--rail-active);
  color:var(--rail-hot);
  font-weight:600;
}
.sidebar nav button[aria-current=page]::before { display:none; }
.sidebar nav button[aria-current=page] svg { opacity:1; color:var(--rail-hot); }
.sidebar nav button:disabled { background:transparent; color:rgba(247,251,248,.4); }
.nav-group-title {
  margin-top:18px;
  padding:18px 10px 6px;
  border-top:1px solid var(--rail-line);
  color:var(--rail-ink-2);
  font-size:12px;
  font-weight:400;
  letter-spacing:0;
}
.sidebar-footer {
  gap:5px;
  padding:16px 8px 0;
  border-top:1px solid var(--rail-line);
}
.sidebar-footer .muted { color:var(--rail-ink-2); font-size:12px; }
.sidebar-footer button {
  min-height:30px;
  margin-top:8px;
  border:0;
  border-radius:5px;
  padding:4px 6px;
  background:transparent;
  color:var(--rail-ink);
}
.sidebar-footer button:hover:not(:disabled) { background:var(--rail-hover); color:var(--rail-bright); }
button.nav-scrim,
button.nav-scrim:hover:not(:disabled) {
  border:0;
  border-radius:0;
  background:rgba(10,10,10,.28);
}

.main-area { min-width:0; background:var(--ground); padding:18px; }
.content-region {
  width:100%;
  max-width:1600px;
  margin:0 auto;
  padding:8px 32px 28px;
  background:var(--surface);
  border-radius:var(--radius-card);
  box-shadow:var(--shadow-lg);
}
.topbar {
  position:relative;
  top:auto;
  z-index:1;
  min-height:0;
  align-items:flex-start;
  gap:16px;
  padding:24px 0 0;
  border:0;
  background:transparent;
}
.topbar h1 {
  display:block;
  font-size:var(--fs-title);
  font-weight:600;
}
.topbar h1::before { display:none; }
.header-actions { margin-left:auto; align-items:center; gap:6px; }
.header-actions .muted { color:var(--muted); font-size:13px; }
.icon-button {
  width:36px;
  height:36px;
  min-height:36px;
  border:1px solid transparent;
  border-radius:var(--radius-control);
  padding:0;
  background:transparent;
  box-shadow:none;
  color:var(--muted);
  font-size:16px;
}
.icon-button:hover:not(:disabled) { border-color:var(--border); background:var(--raised); color:var(--text); }
.icon-button svg { width:16px; height:16px; }
.filters {
  align-items:center;
  gap:12px;
  margin:16px 0 0;
  padding:10px 0;
  border:0;
  border-radius:0;
  background:transparent;
  box-shadow:none;
}
.filters label { flex-direction:row; align-items:center; gap:8px; min-width:220px; font-size:13px; }
.filters label input,
.filters label select { flex:1; min-width:170px; }
.filters input,
.filters select { min-height:var(--control-height); }
.filters button[type=submit] {
  min-height:var(--control-height);
  border-color:var(--primary);
  border-radius:var(--radius-control);
  padding:0 18px;
  background:var(--primary);
  color:#fff;
  box-shadow:none;
}
.filters button[type=submit]:hover:not(:disabled) { border-color:var(--green-hover); background:var(--green-hover); }
.banner,
.notice { margin:14px 0 0; padding:10px 12px; }
#content { padding:24px 0 0; }
.section { margin-top:12px; padding:0; border:0; }
.section-head { gap:10px; margin-bottom:10px; }
.section-head h2 { font-size:var(--fs-section); }
.section-head h3 { font-size:14px; }
.section-head .muted { margin-left:auto; font-size:13px; }

.metrics {
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:0;
  overflow:visible;
  margin:0;
  border:0;
  border-top:1px solid var(--border);
  border-bottom:1px solid var(--border);
  border-radius:0;
  background:transparent;
  box-shadow:none;
}
.metric {
  min-width:0;
  padding:14px 16px;
  border:0;
  border-right:1px solid var(--border-soft);
  border-radius:0;
  background:transparent;
  box-shadow:none;
}
.metric:last-child { border-right:0; }
.metric:hover { translate:0; background:transparent; box-shadow:none; }
.metric-label { align-items:center; gap:8px; color:var(--muted); font-size:13px; font-weight:400; }
.metric-ic { display:none; }
.metric-name { min-width:0; }
.metric-label .tag { margin-left:auto; }
.metric-value {
  margin:8px 0 0;
  color:var(--text);
  font-family:var(--font-number);
  font-size:var(--fs-kpi);
  font-weight:600;
  line-height:1.1;
  white-space:nowrap;
}
.profit-overview .metric-value { font-size:var(--fs-kpi); }
.metric-value.pending-value { color:var(--muted); font-size:20px; }
.metric-positive .metric-value,
.metric-negative .metric-value,
.metric-zero .metric-value { color:var(--text); }
.profit-overview { padding-top:0; border-top:0; }
.profit-overview .metric-empty .metric-value { font-size:19px; color:var(--muted); font-weight:600; }
.th-sort { display:inline-flex; align-items:center; gap:4px; justify-content:flex-end; width:100%; min-height:0; padding:0; border:0; background:transparent; box-shadow:none; color:inherit; font:inherit; font-weight:inherit; }
.th-sort .sort-caret { display:inline-grid; place-items:center; width:11px; height:11px; opacity:0; transition:opacity .16s ease, transform .16s var(--ease-out); }
.th-sort .sort-caret svg { width:100%; height:100%; }
.th-sort.is-asc .sort-caret { transform:rotate(180deg); }
.th-sort:hover .sort-caret, .th-sort.is-active .sort-caret { opacity:.85; }
.th-sort.is-active { color:var(--green-700); }
.banner-retry { margin-left:12px; min-height:26px; padding:0 10px; border:0; border-radius:7px; background:var(--green); color:var(--on-accent); font-size:12px; font-weight:600; box-shadow:none; }
.banner-retry:hover:not(:disabled) { background:var(--green-hover); }
.row-expandable { cursor:pointer; }
.name-cell { display:flex; align-items:center; gap:8px; min-width:0; }
.name-cell strong { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.row-chevron { display:inline-grid; place-items:center; width:20px; height:20px; min-height:20px; padding:0; border:0; border-radius:6px; background:transparent; box-shadow:none; color:var(--faint); flex:none; transition:transform .16s var(--ease-out), background .14s ease; }
.row-chevron svg { width:13px; height:13px; }
.row-chevron:hover { background:var(--raised); color:var(--green-700); }
tr[aria-expanded="true"] .row-chevron { transform:rotate(180deg); color:var(--green-700); }
.drill-row > td { padding:0; background:var(--raised); border-bottom:1px solid var(--line); }
.drill-clip { display:grid; grid-template-rows:0fr; opacity:0; transition:grid-template-rows .28s var(--ease-out), opacity .18s ease; }
.drill-row.is-open .drill-clip { grid-template-rows:1fr; opacity:1; }
.drill-inner { overflow:hidden; }
.drill-body { padding:12px 16px 14px; }
.drill-head { display:flex; justify-content:space-between; gap:10px; margin-bottom:6px; font-size:12px; color:var(--muted); }
.drill-body .table-wrap { border-radius:0; box-shadow:none; background:transparent; }
.drill-loading { font-size:12px; color:var(--muted); }
.trend-tip { position:absolute; top:6px; z-index:3; padding:4px 8px; border:1px solid var(--line); border-radius:7px; background:var(--surface); box-shadow:var(--shadow-pop); color:var(--ink); font-family:var(--font-number); font-size:12px; font-weight:600; font-variant-numeric:tabular-nums; white-space:nowrap; pointer-events:none; }
.trend-cross { position:absolute; top:8px; bottom:26px; width:1px; background:var(--control); pointer-events:none; }
.trend-peak { font-family:var(--font-number); font-weight:600; color:var(--muted); font-variant-numeric:tabular-nums; }
.tag.quiet::before { display:none; }
.tag.quiet { color:var(--faint); font-weight:500; }
.command-palette { width:min(560px,calc(100vw - 32px)); padding:0; border:0; border-radius:14px; background:var(--surface); box-shadow:var(--shadow-pop); overflow:hidden; }
.command-palette::backdrop { background:var(--backdrop); }
.command-palette input { width:100%; min-height:52px; border:0; border-bottom:1px solid var(--border-soft); border-radius:0; background:transparent; box-shadow:none; padding:0 18px; font-size:15px; font-weight:500; }
.command-palette input:focus { border-color:var(--border-soft); box-shadow:none; }
/* keyboard-initiated surface: no open animation */
.command-palette[open] { animation:none; }
#palette-list { list-style:none; margin:0; padding:6px; max-height:320px; overflow:auto; }
#palette-list li { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:9px 12px; border-radius:8px; font-size:14px; cursor:pointer; }
#palette-list li.is-active { background:var(--raised); }
#palette-list li.is-active span:first-child { color:var(--green-700); font-weight:600; }
.palette-foot { display:flex; gap:16px; padding:9px 18px; border-top:1px solid var(--border-soft); color:var(--faint); font-size:12px; }
@media (min-width:761px) {
  .profit-overview .metrics { grid-template-columns:repeat(4,minmax(0,1fr)); }
  .profit-overview .metric:nth-child(3) { order:-2; grid-column:span 2; }
  .profit-overview .metric:nth-child(4) { order:-1; grid-column:span 2; display:flex; align-items:baseline; gap:10px; }
  .profit-overview .metric:nth-child(3):not(.metric-empty) .metric-value { font-size:56px; line-height:1; }
  .profit-overview .metric:nth-child(4):not(.metric-empty) .metric-value { font-size:28px; }
  .profit-overview .metric:nth-child(4) .metric-value { order:-1; }
  .profit-overview .metric:nth-child(4) .metric-label { margin-left:0; }
  .profit-overview .metric:nth-child(1),
  .profit-overview .metric:nth-child(2) { grid-column:span 2; }
  .profit-overview .metric:nth-child(1):not(.metric-empty) .metric-value,
  .profit-overview .metric:nth-child(2):not(.metric-empty) .metric-value { font-size:24px; }
}
.profit-cost-block,
#analysis-profit-ranking,
#analysis-trend,
.analysis-attention {
  margin-top:18px;
  padding:16px 0 0;
  border:0;
  border-top:1px solid var(--border);
  border-radius:0;
  background:transparent;
}
.profit-cost-block .table-wrap,
#analysis-profit-ranking .table-wrap,
#analysis-trend .table-wrap {
  border:0;
  border-radius:0;
  background:transparent;
}
.profit-cost-block th,
.profit-cost-block td,
#analysis-profit-ranking th,
#analysis-profit-ranking td { padding:8px 10px; }
.profit-cost-block table { table-layout:fixed; }
.profit-cost-block th:first-child,
.profit-cost-block td:first-child { width:55%; }
.analysis-attention .section-head { margin-bottom:4px; }
.analysis-attention ul { margin:0; padding:0; list-style:none; }
.analysis-attention ul { display:grid; grid-template-columns:repeat(auto-fit,minmax(230px,1fr)); border-top:1px solid var(--border-soft); }
.analysis-attention li {
  flex-direction:column;
  align-items:flex-start;
  flex-wrap:nowrap;
  gap:5px;
  padding:13px 20px;
  border-bottom:0;
  border-right:1px solid var(--border-soft);
  font-size:13px;
}
.analysis-attention li:first-child { padding-left:0; }
.analysis-attention li:last-child { border-right:0; padding-right:0; }
.analysis-attention li > svg {
  display:none;
}
.analysis-attention li > span { min-width:0; font-size:13px; color:var(--muted); }
.analysis-attention li > span strong { font-size:15px; font-weight:600; color:var(--text); }
.analysis-attention li > button {
  min-height:26px;
  border:0;
  border-radius:0;
  padding:0;
  background:transparent;
  box-shadow:none;
  color:var(--green-700);
  font-size:12px;
  font-weight:600;
}
.analysis-attention li > button:hover:not(:disabled) { border:0; background:transparent; }
.profit-negative { color:var(--negative); }
.profit-ranking-tools,
.rank-tabs { gap:14px; }
.rank-tabs .check-label { color:var(--muted); font-size:12px; }

.tag {
  min-height:20px;
  gap:5px;
  border:0;
  border-radius:0;
  padding:0;
  background:transparent;
  color:var(--muted);
  font-size:12px;
  font-weight:600;
  white-space:nowrap;
}
.tag::before { display:inline-block; content:""; width:5px; height:5px; border-radius:50%; background:currentColor; }
.tag.pending { background:transparent; color:var(--amber); }
.tag.danger { background:transparent; color:var(--red); }
.tag.inactive { background:transparent; color:var(--faint); }
.tag.pending { background:transparent; color:var(--amber); }
.tag.danger { background:transparent; color:var(--red); }
.tag.inactive { background:transparent; color:var(--faint); }

.table-wrap {
  border:1px solid var(--border);
  border-radius:var(--radius-card);
  background:var(--surface);
  box-shadow:none;
}
table { font-size:13px; }
th {
  position:static;
  padding:10px 14px;
  border-bottom:1px solid var(--border);
  background:transparent;
  color:var(--muted);
  font-size:var(--fs-small);
  font-weight:400;
  white-space:nowrap;
}
td {
  padding:11px 14px;
  border-bottom:1px solid var(--rule);
  color:var(--text);
  font-size:13px;
}
tbody tr:last-child td { border-bottom:0; }
tbody tr:hover { background:var(--raised); }
tbody tr { transition:background-color .12s ease; }
td.numeric,
th.numeric { text-align:right; font-variant-numeric:tabular-nums; white-space:nowrap; }
td .numeric { font-family:var(--font-mono); font-variant-numeric:tabular-nums; white-space:nowrap; }
td > button:not(.primary) {
  min-height:24px;
  border:0;
  border-radius:0;
  padding:2px 0;
  background:transparent;
  color:var(--text);
  font-size:12px;
  text-decoration:underline;
  text-underline-offset:2px;
}
td > button:not(.primary):hover:not(:disabled) { border:0; background:transparent; }
.empty {
  border:0;
  border-radius:0;
  background:transparent;
  color:var(--muted);
}
.analysis-rank-scroll { max-height:480px; }
.mobile-data-list { display:none; }
.row-actions { gap:10px; }
.row-actions button {
  min-height:24px;
  border:0;
  border-radius:0;
  padding:2px 0;
  background:transparent;
  box-shadow:none;
  color:var(--text);
  font-size:12px;
  text-decoration:underline;
  text-underline-offset:2px;
}
.row-actions button:hover:not(:disabled) { border:0; background:transparent; }
.row-actions button.danger { color:var(--negative); }
.page-tools .row-actions button.primary {
  min-height:var(--control-height);
  border:1px solid var(--primary);
  border-radius:var(--radius-control);
  padding:0 12px;
  background:var(--primary);
  color:#fff;
  text-decoration:none;
}
.page-tools .row-actions button.primary:hover:not(:disabled) {
  border-color:#000;
  background:#000;
  color:#fff;
}

.page-tools {
  align-items:center;
  gap:10px;
  margin-bottom:12px;
  padding:14px 16px;
  border:1px solid var(--border);
  border-radius:var(--radius-card);
  background:var(--surface);
}
.page-tools > :first-child { margin-right:auto; }
.page-tools h2 { font-size:20px; }
.page-tools .muted { font-size:13px; }
.page-tools input { width:240px; min-height:var(--control-height); }
.page-tools h2 .muted { margin-left:6px; }
.page-tools .template-download,
.ledger-import-bar .template-download {
  min-height:var(--control-height);
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:0 12px;
  border:1px solid var(--border);
  border-radius:var(--radius-control);
  background:var(--surface);
  color:var(--text);
  font-size:13px;
  font-weight:500;
  text-decoration:none;
  white-space:nowrap;
}
.page-tools .template-download:hover,
.ledger-import-bar .template-download:hover { background:var(--raised); border-color:var(--control); }
.ledger-import-bar {
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:10px;
  margin-bottom:10px;
}
.period-pick { flex-direction:row; align-items:center; gap:8px; color:var(--muted); font-size:12px; }
.period-pick select { min-height:var(--control-height); }
.ledger-tabs {
  gap:8px 18px;
  margin-bottom:12px;
  padding-bottom:10px;
  border-bottom:1px solid var(--border);
}
.tab-group { gap:10px; }
.tab-group + .tab-group { margin-left:0; padding-left:0; border-left:0; }
.ledger-tabs .tab-group-label { color:var(--muted); font-size:13px; }
.ledger-tabs button {
  min-height:34px;
  border:0;
  border-bottom:2px solid transparent;
  border-radius:0;
  padding:0 1px;
  background:transparent;
  box-shadow:none;
  color:var(--muted);
  font-size:13px;
  font-weight:400;
}
.ledger-tabs button:hover:not(:disabled) { border-bottom-color:var(--control); background:transparent; color:var(--text); }
.ledger-tabs button[aria-current],
.ledger-tabs button[aria-current]:hover:not(:disabled) {
  border-bottom-color:var(--text);
  background:transparent;
  color:var(--text);
  font-weight:500;
}
.ledger-tabs button span {
  margin-left:6px;
  padding:0;
  border-radius:0;
  background:transparent;
  color:var(--muted);
  font-family:var(--font-mono);
  font-size:12px;
}
.ledger-summary { margin-top:8px; color:var(--muted); font-size:13px; }
.ledger-pager { margin-top:10px; }
.ledger-pager button { min-height:30px; }

.analysis-bridge summary,
.analysis-details summary { color:var(--text); font-size:13px; font-weight:500; }
.analysis-bridge,
.analysis-details { margin-top:12px; padding:16px 0; border-top:1px solid var(--border); border-bottom:1px solid var(--border); }
.bridge-track { gap:8px; }
.bridge-node { border:1px solid var(--border); border-radius:var(--radius-card); background:var(--surface); }
.bridge-step { color:var(--muted); }
.bridge-node h3 { color:var(--muted); font-size:12px; }
.bridge-node .metric-value { color:var(--text); font-size:20px; }

dialog {
  border:0;
  border-radius:16px;
  background:var(--surface);
  box-shadow:var(--shadow-pop);
}
dialog::backdrop { background:rgba(10,10,10,.34); }
dialog[open] { animation:dialogIn .18s var(--ease-out); }
.dialog-heading {
  margin-bottom:18px;
  padding-bottom:12px;
  border-bottom:1px solid var(--border);
}
.dialog-heading h2 { font-size:20px; }
.dialog-footer {
  gap:8px;
  margin-top:20px;
  padding-top:16px;
  border-top:1px solid var(--border);
}
.form-grid { gap:14px 16px; }
fieldset { margin-top:18px; }
legend { margin-bottom:8px; color:var(--muted); font-size:12px; font-weight:400; }
.operation-line {
  margin-top:10px;
  border:1px solid var(--border);
  border-radius:var(--radius-card);
  background:var(--raised);
}
.line-section > button,
button[data-add-line] {
  margin-top:10px;
  border:0;
  background:transparent;
  color:var(--text);
  text-decoration:underline;
  text-underline-offset:2px;
}
.line-section > button::before,
button[data-add-line]::before { content:"+"; margin-right:6px; }
.checks { gap:6px; }
.checks .check-label {
  min-height:30px;
  border:1px solid var(--border);
  border-radius:4px;
  padding:5px 9px;
  background:var(--surface);
  color:var(--muted);
  font-weight:400;
}
.checks .check-label:has(input:checked) { border-color:var(--text); background:var(--active); color:var(--text); }
.form-check {
  border:1px solid var(--border);
  border-radius:var(--radius-card);
  background:var(--raised);
}
.form-check h4 { color:var(--text); }
.form-check .check-row2 { color:var(--muted); }
.form-check .check-row2.ok svg { color:var(--positive); }
.form-check .check-row2.warn svg { color:var(--warning); }
.form-check .check-row2 .go { color:var(--text); text-decoration:underline; }
.scope-box {
  border:1px solid var(--border);
  border-radius:var(--radius-card);
  background:var(--raised);
}
.scope-search { min-height:32px; }
.default-fields { color:var(--muted); font-size:12px; }

.rules-workspace { gap:14px; }
.rule-type-chips { gap:14px; }
.rule-type-chips button {
  min-height:32px;
  border:0;
  border-bottom:2px solid transparent;
  border-radius:0;
  padding:0 1px;
  background:transparent;
  box-shadow:none;
  color:var(--muted);
  font-size:13px;
  font-weight:400;
}
.rule-type-chips button:hover:not(:disabled) { border-bottom-color:var(--control); background:transparent; color:var(--text); }
.rule-type-chips button[aria-current="true"],
.rule-type-chips button[aria-current="true"]:hover:not(:disabled) {
  border-bottom-color:var(--text);
  background:transparent;
  color:var(--text);
  font-weight:500;
}
.rule-type-chips button small,
.rule-type-chips button i { color:var(--muted); background:transparent; }
.rules-filters select,
.rules-filters input { height:var(--control-height); min-height:var(--control-height); border-radius:var(--radius-control); }
.rule-group {
  border:1px solid var(--border);
  border-radius:var(--radius-card);
  background:var(--raised);
}
.rule-step + .rule-step { border-top-color:var(--border); }
.rule-step > h3 { color:var(--text); }
.rule-detail dt { color:var(--muted); }

.finance-details { border-color:var(--border); }
.finance-details summary { color:var(--text); }
.finance-details summary::marker { color:var(--muted); }
.finance-object-note { color:var(--muted); }
.import-history-list button {
  border:1px solid var(--border);
  border-radius:var(--radius-card);
  background:var(--surface);
  box-shadow:none;
}
.import-history-list button:hover:not(:disabled) { border-color:var(--control); background:var(--raised); }
.import-costing { border:1px solid var(--border); border-radius:var(--radius-card); background:var(--raised); }
.import-actions,
.import-danger-zone { border-top-color:var(--border); }
.import-report-link { color:var(--text); }
.import-fix-row td { background:var(--raised); }
.data-footer {
  margin-top:10px;
  padding:14px 0 0;
  border-top:1px solid var(--border);
  background:transparent;
  color:var(--muted);
  font-size:12px;
}

.login-screen { padding:40px 20px; background:var(--ground); }
.login-shell {
  width:min(920px,100%);
  grid-template-columns:minmax(0,1fr) minmax(360px,.9fr);
  border:1px solid var(--border);
  border-radius:var(--radius-card);
  background:var(--surface);
  box-shadow:none;
}
.login-brandside {
  padding:40px;
  border:0;
  background:var(--rail);
  color:var(--rail-bright);
}
.login-brand { color:var(--rail-bright); font-size:16px; }
.login-slogan { max-width:390px; color:var(--rail-bright); font-size:28px; font-weight:600; line-height:1.25; }
.login-side-note { color:var(--rail-ink-2); }
.login-mark { color:var(--rail-bright); opacity:.06; }
.login-formside { padding:40px; background:var(--surface); }
.login-form { max-width:350px; gap:13px; }
.login-form h1,
.login-form h2 { margin-bottom:8px; font-size:24px; font-weight:600; }
.login-submit { width:100%; min-height:40px; }

@media (max-width:1180px) {
  .metrics { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (max-width:900px) {
  .icon-button { width:44px; height:44px; min-height:44px; }
  .filters button[type=submit] { min-height:44px; }
  .workspace { display:block; min-height:100dvh; }
  .workspace::before { display:none; }
  .sidebar {
    position:fixed;
    z-index:30;
    top:0;
    left:0;
    width:100%;
    max-width:420px;
    height:100dvh;
    padding:22px 16px 18px;
    border-right:0;
    border-radius:0;
    background:var(--rail);
    visibility:hidden;
    pointer-events:none;
    transform:translateX(-100%);
    transition:transform .32s var(--ease-drawer),visibility .32s linear;
  }
  .sidebar.open { visibility:visible; pointer-events:auto; transform:translateX(0); }
  .sidebar .brand { border-bottom:1px solid var(--rail-line); }
  .sidebar .brand button { margin-left:auto; }
  .mobile-only { display:grid; }
  .nav-scrim {
    position:fixed;
    inset:0;
    z-index:29;
    display:block;
    width:100%;
    height:100%;
  }
  .content-region { padding:0 16px 24px; }
  .topbar { align-items:center; padding:14px 0 0; }
  .topbar h1 { font-size:28px; }
  .header-actions { gap:4px; }
  .header-actions .muted { display:none; }
  .filters {
    display:grid;
    grid-template-columns:minmax(0,1fr) minmax(0,1fr);
    gap:10px;
    margin-top:16px;
    padding:12px;
  }
  .filters label { flex-direction:column; align-items:stretch; width:auto; min-width:0; gap:5px; }
  .filters button[type=submit] { grid-column:1 / -1; width:100%; }
  #content { padding-top:16px; }
  .metrics,
  .profit-overview .metrics { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .metric { padding:14px; }
  .metric-value { font-size:22px; }
  .profit-overview .metrics { grid-template-columns:1fr; }
  .profit-overview .metric { border-right:0; border-bottom:1px solid var(--border-soft); }
  .profit-overview .metric:last-child { border-bottom:0; }
  .profit-overview .metric:nth-child(3):not(.metric-empty) .metric-value { font-size:40px; }
  .profit-overview .metric:nth-child(4):not(.metric-empty) .metric-value { font-size:23px; }
  .profit-overview .metric:nth-child(1):not(.metric-empty) .metric-value,
  .profit-overview .metric:nth-child(2):not(.metric-empty) .metric-value { font-size:20px; }
  .metric-label { flex-wrap:wrap; gap:5px; }
  .metric-label .tag { margin-left:auto; }
  .analysis-attention li { align-items:flex-start; flex-wrap:nowrap; }
  .analysis-attention li > span { flex-basis:auto; }
  .analysis-attention li > button { margin-left:0; }
  .page-tools {
    display:grid;
    grid-template-columns:minmax(0,1fr) auto;
    align-items:end;
    gap:10px 12px;
    padding:14px;
  }
  .page-tools > :first-child { grid-column:1 / -1; }
  .page-tools .period-pick { justify-self:start; }
  .page-tools .row-actions { justify-self:end; flex-wrap:nowrap; }
  .page-tools .row-actions button { flex:none; }
  .page-tools input { width:100%; }
  .ledger-tabs { flex-wrap:wrap; margin-right:0; padding-bottom:10px; }
  .ledger-tabs .tab-group { flex-wrap:wrap; }
  .ledger-tabs button { flex:none; }
  .table-wrap { overflow:auto; }
  .table-wrap table { min-width:680px; }
  .profit-cost-block .table-wrap table,
  .table-wrap:has(.table-compact) table { min-width:0; }
  .form-grid,
  .scope-grid { grid-template-columns:1fr; }
  dialog {
    width:calc(100vw - 20px);
    max-height:calc(100dvh - 20px);
    padding:18px;
  }
  .login-shell { grid-template-columns:1fr; }
  .login-brandside { min-height:250px; padding:28px; }
  .login-slogan { margin-top:auto; font-size:22px; }
  .login-formside { padding:28px 22px 32px; }
  .login-mark { font-size:150px; }
}

@media (max-width:640px) {
  .metric-value,
  .profit-overview .metric-value { font-size:18px; }
  .desktop-data-table { display:none; }
  .mobile-data-list { display:block; }
  .mobile-data-row { padding:11px 0; border-bottom:1px solid var(--rule); }
  .mobile-data-row:last-child { border-bottom:0; }
  .mobile-data-main { display:flex; align-items:baseline; justify-content:space-between; gap:12px; }
  .mobile-data-main strong { min-width:0; font-weight:500; }
  .mobile-data-main .numeric { flex:none; font-size:13px; }
  .mobile-data-meta {
    display:flex;
    flex-wrap:wrap;
    gap:3px 12px;
    margin-top:4px;
    color:var(--muted);
    font-size:12px;
  }
  .mobile-data-meta span { white-space:nowrap; }
  .mobile-data-meta button {
    min-height:22px;
    border:0;
    border-radius:0;
    padding:0;
    background:transparent;
    color:var(--text);
    font-size:12px;
    text-decoration:underline;
    text-underline-offset:2px;
  }
  .table-wrap-compact { overflow:visible; }
  .table-compact,
  .table-compact tbody { display:block; width:100%; }
  .table-compact thead { display:none; }
  .table-compact tr {
    display:flex;
    flex-wrap:wrap;
    align-items:center;
    gap:4px 12px;
    padding:11px 14px;
    border-bottom:1px solid var(--rule);
  }
  .table-compact tr:last-child { border-bottom:0; }
  .table-compact td {
    display:block;
    min-width:0;
    padding:0;
    border:0;
    font-size:13px;
  }
  .table-compact td:first-child { flex:1 1 calc(100% - 106px); font-weight:500; }
  .table-compact td:nth-child(2) { flex:0 0 auto; margin-left:auto; text-align:right; }
  .table-compact td:nth-child(n+3) {
    flex:0 1 auto;
    min-width:0;
    max-width:100%;
    color:var(--muted);
    font-size:12px;
    overflow-wrap:anywhere;
  }
  .table-compact td:nth-child(n+3)::before { content:attr(data-label) "："; color:var(--faint); }
  .table-compact td:nth-child(n+3) > * { max-width:100%; }
  .table-compact td:has(.role-list),
  .table-compact td:has(.scope-text) { flex:0 0 100%; }
  .table-compact .role-list { max-width:100%; }
  .table-compact .scope-text { display:block; max-width:100%; white-space:normal; }
  .table-compact td.numeric { text-align:left; }
  .table-compact .row-actions { gap:8px; }
}

@media (prefers-reduced-motion:reduce) {
  * { animation-duration:.01ms !important; transition-duration:.01ms !important; scroll-behavior:auto !important; }
}


/* ---------- signature motion (ported from the 3032 demo) ---------- */
#page-title .split-char { display:inline-block; }
.rank-tabs { position:relative; display:flex; gap:4px; padding:3px; border:0; margin:0; background:var(--raised); border-radius:9px; }
.rank-tabs .seg-ind { position:absolute; top:3px; bottom:3px; left:3px; width:0; z-index:0; border-radius:7px; background:var(--surface); box-shadow:var(--shadow-lg); transition:left .24s var(--ease-out), width .24s var(--ease-out); }
.rank-tabs .check-label { position:relative; z-index:1; margin:0; padding:4px 12px; border-radius:7px; color:var(--muted); font-size:13px; font-weight:500; cursor:pointer; }
.rank-tabs .check-label input { position:absolute; opacity:0; width:1px; height:1px; }
.rank-tabs .check-label:has(input:checked) { color:var(--ink); font-weight:600; }
.rank-tabs .check-label:has(input:focus-visible) { outline:2px solid var(--green-700); outline-offset:2px; }
input[name="losses-only"] { appearance:none; -webkit-appearance:none; width:30px; height:18px; border-radius:999px; background:var(--control); position:relative; cursor:pointer; transition:background .2s ease; box-shadow:none; padding:0; min-height:0; }
input[name="losses-only"]::after { content:""; position:absolute; top:2px; left:2px; width:14px; height:14px; border-radius:50%; background:#fff; box-shadow:0 1px 2px rgba(20,40,30,.18); transition:transform .24s cubic-bezier(.34,1.45,.5,1), width .16s var(--ease-out); }
input[name="losses-only"]:checked { background:var(--green-700); box-shadow:inset 0 1px 2px rgba(16,39,28,.22); }
input[name="losses-only"]:checked::after { transform:translateX(12px); }
input[name="losses-only"]:active::after { width:17px; }
input[name="losses-only"]:checked:active::after { transform:translateX(9px); }
#content.swap-in { animation:swapIn .28s var(--ease-out); }
@keyframes swapIn { from { opacity:.35; } to { opacity:1; } }
.metric, .analysis-attention li, #analysis-trend { position:relative; }
.spot::after { content:""; position:absolute; inset:0; border-radius:inherit; pointer-events:none; background:radial-gradient(240px circle at var(--spot-x,50%) var(--spot-y,50%), rgba(47,107,79,.08), transparent 65%); }
@media (hover:hover) and (pointer:fine) {
  button.primary { position:relative; isolation:isolate; overflow:hidden; }
  button.primary::before { content:""; position:absolute; inset:0; z-index:-1; transform:translateX(-130%); background:linear-gradient(105deg, transparent 40%, rgba(255,255,255,.18) 50%, transparent 60%); }
  button.primary:hover::before { animation:shine .46s var(--ease-out); }
}
@keyframes shine { from { transform:translateX(-130%); } to { transform:translateX(130%); } }

/* ---------- round-2 UI refinements ---------- */
.empty-cta { margin-top:14px; min-height:36px; padding:0 14px; border:0; border-radius:8px; background:var(--green); color:var(--on-accent); font-size:13px; font-weight:600; box-shadow:none; }
.empty-cta:hover:not(:disabled) { background:var(--green-hover); }
.palette-hint { display:none; }
@media (hover:hover) and (pointer:fine) {
  .palette-hint { display:inline-flex; align-items:center; min-height:24px; padding:2px 7px; border:1px solid var(--border); border-radius:6px; background:var(--surface); color:var(--faint); font-family:var(--font-mono); font-size:12px; font-weight:600; box-shadow:none; }
  .palette-hint:hover:not(:disabled) { color:var(--ink); border-color:var(--control); }
}
.mobile-detail { padding:4px 0 10px; }
.mobile-detail .table-wrap { overflow:visible; border-radius:0; box-shadow:none; background:transparent; }
.mobile-detail table, .mobile-detail tbody, .mobile-detail tr, .mobile-detail td { display:block; width:100%; }
.mobile-detail thead { display:none; }
.mobile-detail tr { padding:9px 0; border-bottom:1px solid var(--border-soft); }
.mobile-detail tr:last-child { border-bottom:0; }
.mobile-detail td { display:flex; align-items:baseline; justify-content:space-between; gap:12px; padding:2px 0; border:0; font-size:13px; }
.mobile-detail td::before { content:attr(data-label); color:var(--faint); font-size:12px; flex:none; }
.mobile-detail td .numeric { text-align:right; }
