:root {
  --brand: #C8161D; --brand-deep: #9E0D14; --brand-soft: #E84A50;
  --brand-wash: #FBEEEF; --brand-light: #FCE4E5;
  --ink: #1A1A1A; --ink-2: #333; --ink-3: #666; --ink-4: #999; --ink-5: #BBB;
  --bg: #F4F5F7; --card: #FFFFFF; --card-2: #FAFBFC; --line: #E5E5E7; --line-soft: #EFEFF1;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
body { font-family: 'Noto Sans SC', sans-serif; background: var(--bg); color: var(--ink); line-height: 1.6; -webkit-font-smoothing: antialiased; }

/* ===== Login ===== */
.login-overlay { position: fixed; inset: 0; z-index: 100; background: linear-gradient(135deg,#1a0e10,#2d0a0d 40%,#C8161D); display: flex; align-items: center; justify-content: center; }
.login-card { background: #fff; border-radius: 10px; padding: 34px 36px; width: 360px; box-shadow: 0 20px 60px rgba(0,0,0,0.35); }
.login-card .lg { font-family: 'Oswald'; font-weight: 700; color: var(--brand); letter-spacing: 0.1em; font-size: 18px; }
.login-card h2 { font-size: 18px; margin: 6px 0 18px; color: var(--ink); }
.login-card input { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 6px; font: inherit; margin-bottom: 12px; }
.login-card button { width: 100%; padding: 11px; background: var(--brand); color: #fff; border: none; border-radius: 6px; font: 500 15px 'Noto Sans SC'; cursor: pointer; }
.login-card button:hover { background: var(--brand-deep); }
.login-card .err { color: var(--brand); font-size: 13px; min-height: 18px; }

/* ===== Loading ===== */
.loading-overlay { position: fixed; inset: 0; z-index: 90; background: rgba(26,14,16,0.5); display: flex; align-items: center; justify-content: center; }
.loading-card { background: #fff; border-radius: 10px; padding: 28px 36px; width: 400px; max-width: 86vw; box-shadow: 0 20px 60px rgba(0,0,0,0.35); text-align: center; }
.loading-title { font-size: 16px; font-weight: 700; color: var(--ink); margin-bottom: 18px; }
.loading-bar { height: 8px; background: var(--line-soft); border-radius: 6px; overflow: hidden; }
.loading-bar-fill { height: 100%; width: 38%; background: linear-gradient(90deg, var(--brand), var(--brand-soft)); border-radius: 6px; animation: indet 1.1s ease-in-out infinite; }
@keyframes indet { 0% { margin-left: -40%; } 100% { margin-left: 100%; } }
.loading-step { margin-top: 14px; font-size: 13.5px; color: var(--ink-2); font-weight: 500; }
.loading-hint { margin-top: 6px; font-size: 11.5px; color: var(--ink-4); }

/* ===== Confirm modal ===== */
.modal-overlay { position: fixed; inset: 0; z-index: 95; background: rgba(26,14,16,0.5); display: flex; align-items: center; justify-content: center; animation: mfade 0.12s ease-out; }
@keyframes mfade { from { opacity: 0; } to { opacity: 1; } }
.modal-card { background: #fff; border-radius: 10px; padding: 22px 26px; width: 460px; max-width: 88vw; box-shadow: 0 24px 64px rgba(0,0,0,0.38); border-top: 4px solid var(--brand); }
.modal-title { font-size: 15px; font-weight: 700; color: var(--ink); margin-bottom: 12px; }
.modal-msg { font-size: 14px; color: var(--ink-2); line-height: 1.85; white-space: pre-line; margin-bottom: 22px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }
.modal-actions .btn { padding: 8px 22px; font-size: 13.5px; }

/* ===== Toolbar ===== */
.toolbar { position: sticky; top: 0; z-index: 50; background: #fff; border-bottom: 1px solid var(--line); padding: 10px 16px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; box-shadow: 0 2px 10px rgba(0,0,0,0.05); }
.toolbar .tb-logo { font-family: 'Oswald'; font-weight: 700; color: var(--brand); letter-spacing: 0.1em; margin-right: 4px; }
.toolbar .tb-logo small { color: var(--ink-4); font-family: 'Noto Sans SC'; font-weight: 500; letter-spacing: 0; }
.btn { font-family: 'Noto Sans SC'; font-size: 13px; font-weight: 500; padding: 8px 14px; border: 1px solid var(--line); background: #fff; color: var(--ink-2); cursor: pointer; border-radius: 4px; display: inline-flex; align-items: center; gap: 6px; transition: all 0.15s; }
.btn:hover { border-color: var(--brand-soft); color: var(--brand); }
.btn:disabled { opacity: 0.6; cursor: default; }
.btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn.primary:hover { background: var(--brand-deep); color: #fff; }
.btn.ai { background: linear-gradient(95deg,#6B5B95,#C8161D 120%); color: #fff; border-color: transparent; }
.btn.ai:hover { filter: brightness(1.08); color: #fff; }
.btn svg { width: 14px; height: 14px; fill: currentColor; }
.toolbar select { font: inherit; font-size: 13px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 4px; background: #fff; color: var(--ink-2); max-width: 240px; }
.toolbar #status { font-size: 12px; color: var(--ink-3); margin-left: auto; }
.toolbar #status b { color: var(--brand); }
[contenteditable]:focus { outline: 2px solid var(--brand-soft); }
.edit-hint { display: none; }
body.editing .edit-hint { display: block; background: #FFF7E6; border-bottom: 1px solid #F0D98A; color: #8A6D1B; font-size: 12.5px; padding: 8px 16px; text-align: center; }
.edit-hint b { color: var(--brand-deep); }

.empty-state { text-align: center; color: var(--ink-4); padding: 80px 20px; font-size: 15px; }

.dashboard { max-width: 1280px; margin: 0 auto; background: var(--bg); padding: 0; }

/* ===== Banner ===== */
.banner { background: linear-gradient(95deg, #1a0e10 0%, #2d0a0d 30%, #C8161D 100%); padding: 20px 32px; display: flex; align-items: center; justify-content: space-between; color: #fff; position: relative; overflow: hidden; }
.banner::before { content: ''; position: absolute; inset: 0; background-image: radial-gradient(2px 2px at 30% 25%, rgba(255,255,255,0.6), transparent), radial-gradient(1.5px 1.5px at 65% 70%, rgba(255,255,255,0.5), transparent), radial-gradient(2.5px 2.5px at 85% 30%, rgba(255,255,255,0.7), transparent), radial-gradient(1px 1px at 15% 80%, rgba(255,255,255,0.4), transparent); background-size: 100% 100%; pointer-events: none; }
.banner-l { display: flex; align-items: center; gap: 18px; position: relative; z-index: 1; }
.logo-block { min-width: 64px; padding: 0 10px; height: 64px; background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.2); display: flex; align-items: center; justify-content: center; flex-direction: column; }
.logo-block .l1 { font-family: 'Oswald', sans-serif; font-size: 12px; letter-spacing: 0.15em; color: rgba(255,255,255,0.85); font-weight: 700; }
.logo-block .l2 { font-family: 'Noto Sans SC', sans-serif; font-size: 11px; color: #fff; font-weight: 700; margin-top: 2px; letter-spacing: 0.1em; }
.banner-title { font-size: 26px; font-weight: 700; letter-spacing: 0.05em; color: #fff; text-shadow: 0 2px 8px rgba(0,0,0,0.3); }
.banner-title .br { color: rgba(255,255,255,0.7); margin: 0 10px; font-weight: 300; }
.banner-title .em { color: #FFE5B4; font-family: 'Oswald', sans-serif; font-size: 22px; margin: 0 6px; letter-spacing: 0.05em; }
.banner-r { display: flex; gap: 14px; align-items: center; position: relative; z-index: 1; }
.banner-r .pill { background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.25); padding: 6px 12px; font-size: 12px; color: #fff; display: flex; align-items: center; gap: 6px; }
.banner-r .pill .lbl { color: rgba(255,255,255,0.7); font-size: 10px; letter-spacing: 0.1em; }
.banner-r .pill .val { font-weight: 700; }

/* ===== Module header / summary ===== */
.mod-head { background: var(--card); border-left: 4px solid var(--brand); padding: 12px 18px; display: flex; align-items: center; gap: 12px; margin: 16px 0 0; }
.mod-head-icon { width: 22px; height: 22px; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; }
.mod-head-icon svg { width: 14px; height: 14px; fill: #fff; }
.mod-head-title { font-size: 16px; font-weight: 700; color: var(--ink); letter-spacing: 0.05em; }
.mod-head-en { font-family: 'Oswald', sans-serif; font-size: 11px; letter-spacing: 0.2em; color: var(--ink-4); text-transform: uppercase; margin-left: auto; }
.summary-strip { background: var(--card); padding: 18px 24px; border-top: 1px solid var(--line); display: flex; align-items: flex-start; gap: 12px; font-size: 14.5px; line-height: 1.95; color: var(--ink-2); }
.summary-strip::before { content: '▶'; color: var(--brand); font-size: 13px; margin-top: 4px; flex-shrink: 0; }
.summary-strip .sum-title { font-weight: 700; color: var(--ink); margin-right: 8px; font-size: 15px; }
.summary-strip strong { color: var(--brand); font-weight: 700; font-family: 'Oswald', sans-serif; font-size: 16.5px; margin: 0 1px; }

/* ===== Row / KPI / rank ===== */
.row { display: grid; grid-template-columns: 132px 1fr 320px; gap: 0; background: var(--card); border-top: 1px solid var(--line); min-height: 200px; }
.row.tall { min-height: 248px; }
.kpi-corner { background: linear-gradient(135deg, #FBEEEF 0%, #ffffff 100%); padding: 18px 14px; border-right: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.kpi-icon { width: 36px; height: 36px; background: var(--brand); border-radius: 50%; display: flex; align-items: center; justify-content: center; margin-bottom: 12px; box-shadow: 0 4px 12px rgba(200,22,29,0.25); }
.kpi-icon svg { width: 18px; height: 18px; fill: #fff; }
.kpi-num { font-family: 'Oswald', sans-serif; font-size: 36px; font-weight: 700; line-height: 1; color: var(--brand-deep); }
.kpi-num .u { font-family: 'Noto Sans SC', sans-serif; font-size: 13px; color: var(--ink-3); font-weight: 400; margin-left: 2px; }
.kpi-delta { margin-top: 8px; background: var(--brand); color: #fff; padding: 2px 10px; font-size: 11px; font-weight: 700; font-family: 'Oswald', sans-serif; letter-spacing: 0.05em; }
.kpi-label { margin-top: 10px; font-size: 12px; color: var(--ink-3); letter-spacing: 0.1em; font-weight: 500; }
.chart-mid { padding: 18px 22px; border-right: 1px solid var(--line); display: flex; flex-direction: column; justify-content: center; }
.rank-box { padding: 14px 18px; background: var(--card-2); }
.rank-title { font-size: 12px; font-weight: 700; color: var(--ink-2); letter-spacing: 0.08em; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 6px; }
.rank-title::before { content: ''; width: 3px; height: 12px; background: var(--brand); }
.rank-title .arrow { margin-left: auto; color: var(--ink-4); font-size: 9px; }
.rank-row { display: grid; grid-template-columns: 84px 1fr 30px; gap: 10px; align-items: center; padding: 5px 0; font-size: 12px; position: relative; }
.rank-row .rank-name { color: var(--ink-2); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-bar { background: var(--line-soft); height: 16px; position: relative; overflow: hidden; }
.rank-bar-fill { height: 100%; background: linear-gradient(90deg, var(--brand) 0%, var(--brand-soft) 100%); transition: width 1s cubic-bezier(0.2,0.8,0.2,1); }
.rank-bar-fill.alt { background: linear-gradient(90deg, #2C5F8D 0%, #4A89BD 100%); }
.rank-bar-fill.alt2 { background: linear-gradient(90deg, #D4842B 0%, #E5A653 100%); }
.rank-num { font-family: 'Oswald', sans-serif; font-size: 13px; font-weight: 700; color: var(--ink); text-align: right; }
.rank-empty { font-size: 11.5px; color: var(--ink-4); padding: 16px 4px; text-align: center; line-height: 1.7; }
.hbar-list { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.hbar-row { display: grid; grid-template-columns: 92px 1fr 32px; gap: 12px; align-items: center; font-size: 12px; position: relative; }
.hbar-row .hbar-cat { color: var(--ink-2); font-weight: 500; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar-track { position: relative; height: 22px; background: var(--line-soft); }
.hbar-fill { height: 100%; background: var(--brand); transition: width 1.2s cubic-bezier(0.2,0.8,0.2,1); }
.hbar-fill.lvl-2 { opacity: 0.82; } .hbar-fill.lvl-3 { opacity: 0.64; } .hbar-fill.lvl-4 { opacity: 0.46; } .hbar-fill.lvl-5 { opacity: 0.3; }
.hbar-num { font-family: 'Oswald', sans-serif; font-weight: 700; color: var(--ink); font-size: 14px; text-align: right; }

/* ===== Donuts ===== */
.donut-grid-wrapper { position: relative; width: 100%; padding-bottom: 24px; }
.donut-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 12px; width: 100%; }
.donut-brace { position: absolute; bottom: 0; left: 0; height: 10px; border-left: 1px solid var(--ink-4); border-right: 1px solid var(--ink-4); border-bottom: 1px solid var(--ink-4); display: flex; justify-content: center; align-items: flex-end; }
.donut-brace span { background: var(--card); padding: 0 8px; transform: translateY(50%); font-size: 11px; color: var(--ink-3); font-weight: 500; letter-spacing: 0.1em; white-space: nowrap; }
.donut-brace strong { color: var(--brand); font-family: 'Oswald', sans-serif; font-size: 14px; margin: 0 2px; }
.donut-cell { text-align: center; position: relative; }
.donut-tag { display: inline-block; padding: 4px 12px; color: #fff; font-size: 12px; font-weight: 700; letter-spacing: 0.04em; margin-bottom: 4px; border-radius: 12px; position: relative; white-space: nowrap; }
.donut-tag::after { content: ''; position: absolute; bottom: -4px; left: 50%; transform: translateX(-50%); width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 4px solid currentColor; }
.donut-tag span { color: #fff; }
.donut-svg { width: 100%; height: 104px; }
.donut-svg .ring-bg { fill: none; stroke: var(--line-soft); stroke-width: 11; }
.donut-svg .ring-fg { fill: none; stroke-width: 11; stroke-linecap: round; transform: rotate(-90deg); transform-origin: center; }
.donut-svg .ring-fg.r-design { stroke: var(--ink); stroke-width: 4; stroke-dasharray: 238.8 238.8 !important; }
.donut-wrap { position: relative; width: 100%; }
.donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
.donut-num { font-family: 'Oswald', sans-serif; font-size: 27px; font-weight: 700; color: var(--ink); line-height: 1; pointer-events: auto; min-width: 20px; text-align: center; }
.donut-pct { font-size: 10px; color: var(--ink-3); margin-top: 3px; }

/* ===== Detail table ===== */
.detail-section { background: var(--card); margin-top: 16px; }
.detail-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.detail-table thead th { background: var(--ink); color: #fff; padding: 14px 16px; text-align: left; font-weight: 500; font-size: 13.5px; letter-spacing: 0.08em; border-right: 1px solid rgba(255,255,255,0.1); }
.detail-table thead th:last-child { border-right: none; }
.detail-table tbody td { padding: 10px 16px; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); vertical-align: top; line-height: 1.85; }
.detail-table tbody td:last-child { border-right: none; }
.detail-table tbody tr:nth-child(even) { background: var(--card-2); }
.detail-table .cat-cell { width: 116px; text-align: center; font-weight: 700; letter-spacing: 0.04em; vertical-align: middle; }
.detail-table .cat-name { white-space: nowrap; display: inline-block; }
.detail-table .prod-cell { width: 150px; font-weight: 700; color: var(--ink); }
.detail-table .owner-cell { width: 110px; text-align: center; }
.detail-table .owner-tag { display: inline-block; background: var(--ink); color: #fff; padding: 3px 10px; font-size: 12px; letter-spacing: 0.05em; white-space: nowrap; }
.detail-table .desc-cell { color: var(--ink-2); line-height: 1.85; font-size: 13.5px; }
.detail-table .desc-cell strong { color: var(--brand-deep); background: var(--brand-light); padding: 0 4px; font-weight: 700; }
.detail-table .num-pill { display: inline-block; min-width: 18px; height: 18px; line-height: 18px; padding: 0 3px; text-align: center; background: var(--brand); color: #fff; font-family: 'Oswald', sans-serif; font-size: 11px; font-weight: 700; margin-right: 6px; }

/* ===== Plan / footer ===== */
.plan-section { background: var(--card); margin-top: 16px; }
.plan-grid { display: grid; grid-template-columns: 132px 1fr; border-top: 1px solid var(--line); }
.plan-side { background: var(--ink); color: #fff; padding: 24px 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; position: relative; }
.plan-side::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px; background: var(--brand); }
.plan-side .ico { width: 36px; height: 36px; background: var(--brand); margin-bottom: 12px; display: flex; align-items: center; justify-content: center; }
.plan-side .ico svg { width: 18px; height: 18px; fill: #fff; }
.plan-side .ttl { font-size: 17px; font-weight: 700; letter-spacing: 0.4em; writing-mode: vertical-rl; margin-top: 8px; }
.plan-rows { padding: 4px 24px 18px; }
.plan-row { display: grid; grid-template-columns: 48px 120px 1fr; gap: 20px; align-items: center; padding: 18px 0; border-bottom: 1px dashed var(--line); position: relative; }
.plan-row:last-child { border-bottom: none; }
.plan-num { font-family: 'Oswald', sans-serif; font-size: 28px; font-weight: 700; color: var(--brand); line-height: 1; background: var(--brand-wash); border: 2px solid var(--brand); width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; }
.plan-tag { background: var(--ink); color: #fff; padding: 8px 10px; font-size: 13px; text-align: center; letter-spacing: 0.05em; font-weight: 500; }
.plan-text { font-size: 14.5px; color: var(--ink-2); line-height: 1.9; }
.plan-text strong { color: var(--brand-deep); background: var(--brand-light); padding: 1px 6px; font-weight: 700; margin: 0 1px; }
footer { margin-top: 16px; padding: 18px 32px; background: var(--ink); color: rgba(255,255,255,0.7); display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; font-size: 11px; font-family: 'Oswald', sans-serif; letter-spacing: 0.15em; position: relative; }
footer::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: linear-gradient(90deg, var(--brand) 0%, var(--brand-deep) 100%); }
footer .seal { background: var(--brand); color: #fff; padding: 4px 12px; font-weight: 700; letter-spacing: 0.2em; }

@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.row, .mod-head, .summary-strip, .detail-section, .plan-section, .banner { animation: fadeUp 0.5s ease-out backwards; }

/* ===== Edit mode + add/del ===== */
body.editing [data-bind] { outline: 1px dashed rgba(200,22,29,0.45); outline-offset: 2px; border-radius: 2px; cursor: text; }
body.editing [data-bind]:hover { outline-color: var(--brand-soft); }
body.editing [data-bind]:focus { outline: 2px solid var(--brand); }
body.editing .banner [data-bind] { outline-color: rgba(255,255,255,0.6); }
body.editing .plan-side [data-bind], body.editing .detail-table thead [data-bind] { outline-color: rgba(255,255,255,0.5); }
.edit-only { display: none; }
body.editing .edit-only { display: block; }
body.editing .edit-del.edit-only { display: inline-flex; }
.edit-add { font: 500 12px 'Noto Sans SC', sans-serif; color: var(--brand); background: var(--brand-wash); border: 1px dashed var(--brand-soft); border-radius: 4px; padding: 4px 10px; cursor: pointer; }
.edit-add:hover { background: var(--brand-light); }
.edit-del { width: 18px; height: 18px; line-height: 16px; text-align: center; border-radius: 50%; background: #fff; color: var(--brand); border: 1px solid var(--brand-soft); font-size: 13px; cursor: pointer; align-items: center; justify-content: center; box-shadow: 0 1px 3px rgba(0,0,0,0.18); z-index: 3; }
.edit-del:hover { background: var(--brand); color: #fff; }
.plan-row .edit-del { position: absolute; top: 8px; right: 0; }
body.editing .rank-row, body.editing .hbar-row { padding-right: 16px; }
.rank-row .edit-del, .hbar-row .edit-del { position: absolute; right: -4px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; line-height: 14px; font-size: 12px; }
.desc-cell .edit-del { position: absolute; top: 8px; right: 8px; }
.cat-cell .edit-del { position: absolute; top: 4px; right: 4px; }

/* ---------- 版块隐藏 ---------- */
.mod-head, .summary-strip, .chart-mid, .rank-box, .detail-section, .plan-section { position: relative; }
.sec-eye { display: none; position: absolute; top: 7px; right: 8px; z-index: 4; align-items: center; gap: 4px;
  font: 600 11px 'Noto Sans SC', sans-serif; color: var(--ink-3); background: #fff;
  border: 1px solid var(--line); border-radius: 13px; padding: 3px 10px; cursor: pointer; box-shadow: 0 1px 4px rgba(0,0,0,0.12); }
.sec-eye.inline { position: relative; top: auto; right: auto; margin-left: 12px; flex: 0 0 auto; }
.sec-eye svg { width: 13px; height: 13px; }
.sec-eye:hover { border-color: var(--brand); color: var(--brand); }
.sec-eye.off { color: #fff; background: var(--brand); border-color: var(--brand); box-shadow: 0 1px 5px rgba(200,22,29,0.35); }
body.editing .sec-eye { display: inline-flex; }

/* 非编辑视图 + 打印：隐藏的整块消失 */
body:not(.editing) .is-hidden { display: none !important; }
/* 编辑态：保留可见，加红虚框 + 半透明罩 + 「已隐藏」角标，可点「显示」恢复 */
body.editing .is-hidden { outline: 1.5px dashed var(--brand); outline-offset: -3px; }
body.editing .is-hidden::before { content: ''; position: absolute; inset: 0; background: rgba(255,255,255,0.55); z-index: 1; pointer-events: none; }
body.editing [data-sec].is-hidden::after { content: '已隐藏'; position: absolute; top: 7px; left: 50%; transform: translateX(-50%);
  background: var(--brand); color: #fff; font: 600 10px 'Noto Sans SC', sans-serif; letter-spacing: 0.08em;
  padding: 2px 10px; border-radius: 11px; z-index: 3; pointer-events: none; }

/* 行内单元被隐藏 → 桌面下该行退化为 flex 自动重排，不留空位
   （≤1024px 时 .row 本就是单列 1fr，隐藏单元会自动收起，无需处理） */
@media (min-width: 1025px) {
  body:not(.editing) .row:has(> .is-hidden) { display: flex; }
  body:not(.editing) .row:has(> .is-hidden) > * { flex: 1 1 0; min-width: 0; }
  body:not(.editing) .row:has(> .is-hidden) > .kpi-corner { flex: 0 0 132px; }
  body:not(.editing) .row:has(> .is-hidden) > .chart-mid { border-right: none; }
}

@media (max-width: 1024px) {
  .row { grid-template-columns: 1fr; }
  .kpi-corner { flex-direction: row; gap: 14px; padding: 14px; border-right: none; border-bottom: 1px solid var(--line); justify-content: flex-start; }
  .chart-mid { border-right: none; border-bottom: 1px solid var(--line); }
  .donut-grid { grid-template-columns: repeat(4, 1fr) !important; gap: 8px; }
  .donut-brace { display: none; }
  .banner { flex-direction: column; align-items: flex-start; gap: 14px; }
  .plan-grid { grid-template-columns: 1fr; }
  .plan-side .ttl { writing-mode: horizontal-tb; }
  .plan-row { grid-template-columns: 1fr !important; gap: 8px; }
  .detail-table thead { display: none; }
  .detail-table tbody td { display: block; width: auto !important; border-right: none; }
  .detail-table .cat-cell { text-align: left; }
}
@page { size: A4 landscape; margin: 10mm; }
@media print {
  .toolbar, .edit-hint, .login-overlay { display: none !important; }
  body { background: #fff; }
  .dashboard { max-width: 100%; }
  .row, .banner, .mod-head { animation: none; break-inside: avoid; }
  [data-bind] { outline: none !important; }
  .edit-only, .edit-del, .sec-eye { display: none !important; }
  .is-hidden { display: none !important; }
  .row:has(> .is-hidden) { display: flex; }
  .row:has(> .is-hidden) > * { flex: 1 1 0; min-width: 0; }
  .row:has(> .is-hidden) > .kpi-corner { flex: 0 0 132px; }
  .row:has(> .is-hidden) > .chart-mid { border-right: none; }
  .banner, .kpi-icon, .kpi-delta, .donut-tag, .owner-tag, .num-pill, .plan-num, .plan-tag, .plan-side, footer, .detail-table thead th, .cat-cell { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}
