:root {
  --sidebar: #15232f;
  --sidebar-2: #1c2d3b;
  --canvas: #f3f6f7;
  --surface: #ffffff;
  --surface-2: #f7f9fa;
  --ink: #18242c;
  --muted: #697983;
  --line: #dbe3e7;
  --line-strong: #c3cfd5;
  --accent: #087f8c;
  --accent-strong: #056672;
  --accent-soft: #e5f4f4;
  --green: #21865d;
  --green-soft: #e8f5ee;
  --amber: #a76200;
  --amber-soft: #fff4df;
  --red: #b93846;
  --red-soft: #fcebed;
  --blue: #356ea5;
  --blue-soft: #eaf2f9;
  --purple: #76509a;
  --purple-soft: #f1ebf6;
  --shadow: 0 8px 24px rgba(22, 42, 53, .07);
  --sidebar-width: 236px;
  --radius: 6px;
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body {
  margin: 0;
  min-width: 320px;
  background: var(--canvas);
  color: var(--ink);
  font-family: Inter, "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  letter-spacing: 0;
}
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(8,127,140,.18); outline-offset: 1px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.center { text-align: center; }
.mono { font-family: Consolas, "SFMono-Regular", monospace; }

/* Login */
.login-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(420px, .82fr);
  background: #0d1419;
  color: white;
}
.login-visual {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  isolation: isolate;
  background: #102630 url("assets/legacy-system-preview.png") center / cover no-repeat;
}
.login-visual::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: rgba(5, 27, 35, .86);
}
.login-visual::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: .18;
  background-size: 40px 40px;
  background-image: linear-gradient(rgba(255,255,255,.17) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.17) 1px, transparent 1px);
}
.login-visual-content { width: min(690px, 78%); margin: auto; padding: 64px 0 24px; }
.login-brand, .mobile-brand { display: flex; align-items: center; gap: 11px; font-weight: 800; font-size: 16px; }
.brand-mark {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid rgba(255,255,255,.75);
  border-radius: 50%;
  background: var(--accent);
  color: white;
  font-weight: 900;
}
.login-kicker { margin: 54px 0 12px; color: #8fe0d9; font-size: 13px; font-weight: 700; }
.login-visual h1 { margin: 0; max-width: 640px; font-size: 58px; line-height: 1.15; font-weight: 700; }
.login-copy { max-width: 620px; margin: 24px 0 0; color: #cfdbde; font-size: 16px; line-height: 1.9; }
.login-chain { display: grid; grid-template-columns: 1fr 32px 1fr 32px 1fr; align-items: center; margin-top: 42px; padding: 18px 22px; border: 1px solid rgba(255,255,255,.2); background: rgba(8, 20, 25, .46); }
.login-chain span { text-align: center; }
.login-chain b { display: block; color: #8fe0d9; font-size: 18px; }
.login-chain small { display: block; margin-top: 2px; color: #b8c7cb; }
.login-chain i { text-align: center; color: #8ba1a7; font-style: normal; }
.login-visual-foot { display: flex; gap: 28px; padding: 28px 7%; color: #adbec3; font-size: 12px; }
.login-visual-foot span::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 7px; border-radius: 50%; background: #44c8b6; }
.login-panel { min-height: 100vh; display: grid; place-items: center; padding: 32px; background: #0d1114; }
.login-card { width: min(430px, 100%); padding: 44px 42px; border: 1px solid #2c353a; border-radius: 8px; background: #161c20; box-shadow: 0 24px 60px rgba(0,0,0,.32); }
.mobile-brand { display: none; }
.login-card-head p { margin: 0 0 5px; color: #77d3c7; font-size: 13px; font-weight: 700; }
.login-card-head h2 { margin: 0 0 34px; font-size: 28px; }
.field-label { display: block; margin: 18px 0 7px; color: #b9c4c8; font-size: 12px; font-weight: 700; }
.login-input { height: 48px; display: flex; align-items: center; gap: 10px; padding: 0 14px; border: 1px solid #39444a; border-radius: 5px; background: #1b2226; }
.login-input span { width: 22px; color: #77868d; font-size: 12px; text-align: center; }
.login-input input { width: 100%; border: 0; outline: 0; background: transparent; color: white; }
.remember { display: flex; align-items: center; gap: 8px; margin-top: 17px; color: #aebbc0; font-size: 12px; }
.remember input { accent-color: var(--accent); }
.login-error { min-height: 22px; margin: 11px 0 0; color: #ff8791; font-size: 12px; }
.login-submit { width: 100%; height: 50px; display: flex; justify-content: center; align-items: center; gap: 14px; margin-top: 4px; border: 0; border-radius: 5px; background: #35c6b0; color: #062824; font-weight: 900; }
.login-submit:hover { background: #53d4c1; }
.login-meta { margin: 28px 0 0; color: #6f7b80; text-align: center; font-size: 11px; }

/* Application shell */
.app { min-height: 100vh; display: flex; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 40; width: var(--sidebar-width); display: flex; flex-direction: column; background: var(--sidebar); color: #d8e1e5; box-shadow: 3px 0 14px rgba(19,33,43,.08); }
.sidebar-brand { height: 68px; display: flex; align-items: center; gap: 11px; padding: 0 18px; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar-brand .brand-mark { width: 32px; height: 32px; }
.sidebar-brand > span:last-child { display: flex; flex-direction: column; }
.sidebar-brand b { color: white; }
.sidebar-brand small { color: #8397a2; font-size: 10px; }
.sidebar-nav { flex: 1; padding: 16px 10px; overflow-y: auto; }
.nav-item { width: 100%; min-height: 42px; display: flex; align-items: center; gap: 11px; padding: 8px 11px; border: 0; border-radius: 5px; background: transparent; color: #aebdc5; text-align: left; }
.nav-item:hover { background: rgba(255,255,255,.06); color: white; }
.nav-item.active { background: #237fa0; color: white; box-shadow: inset 3px 0 #69d8ca; }
.nav-icon { width: 24px; height: 24px; display: inline-grid; place-items: center; flex: 0 0 auto; border: 1px solid rgba(255,255,255,.12); border-radius: 4px; font-size: 11px; font-weight: 800; }
.nav-caret { margin-left: auto; transition: transform .2s; }
.nav-group:not(.open) .nav-caret { transform: rotate(-90deg); }
.nav-submenu { max-height: 260px; overflow: hidden; transition: max-height .2s ease; }
.nav-group:not(.open) .nav-submenu { max-height: 0; }
.nav-item.sub { min-height: 38px; padding-left: 24px; font-size: 13px; }
.nav-item.sub .nav-icon { width: 22px; height: 22px; border-color: transparent; color: #79a3b5; }
.nav-badge { min-width: 20px; height: 20px; display: grid; place-items: center; margin-left: auto; padding: 0 5px; border-radius: 10px; background: #d4eee9; color: #145e56; font-size: 10px; font-weight: 800; }
.sidebar-foot { padding: 14px 14px 18px; border-top: 1px solid rgba(255,255,255,.08); }
.local-state { display: flex; gap: 9px; align-items: flex-start; padding: 9px; }
.state-dot { width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: #51c89f; box-shadow: 0 0 0 4px rgba(81,200,159,.12); }
.local-state > span:last-child { display: flex; flex-direction: column; }
.local-state b { font-size: 11px; color: #c7d4d9; }
.local-state small { color: #718891; font-size: 10px; }
.sidebar-logout { width: 100%; min-height: 34px; border: 1px solid rgba(255,255,255,.12); border-radius: 4px; background: transparent; color: #91a3ab; font-size: 12px; }
.sidebar-logout:hover { color: white; border-color: rgba(255,255,255,.28); }
.app-main { width: calc(100% - var(--sidebar-width)); min-height: 100vh; margin-left: var(--sidebar-width); }
.topbar { position: sticky; top: 0; z-index: 30; min-height: 68px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 20px; padding: 9px 24px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.96); backdrop-filter: blur(10px); }
.topbar-left, .topbar-actions, .topbar-context { display: flex; align-items: center; }
.topbar-left { gap: 14px; min-width: 0; }
.topbar-actions { gap: 7px; justify-content: flex-end; }
.topbar-context { gap: 9px; }
.topbar-context label { color: var(--muted); font-size: 11px; font-weight: 700; }
.topbar-context select { width: min(270px, 24vw); height: 36px; padding: 0 32px 0 10px; border: 1px solid var(--line); border-radius: 4px; background: white; color: var(--ink); }
.data-date { padding-left: 9px; border-left: 1px solid var(--line); color: var(--muted); font-size: 11px; white-space: nowrap; }
.breadcrumb { min-width: 0; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.breadcrumb b { color: var(--ink); }
.breadcrumb span + span::before { content: "/"; margin: 0 8px; color: #b7c2c7; }
.icon-button { width: 36px; height: 36px; display: inline-grid; place-items: center; border: 1px solid var(--line); border-radius: 4px; background: white; color: #52636d; font-size: 12px; font-weight: 800; }
.icon-button:hover { border-color: var(--accent); color: var(--accent); }
.menu-button { display: none; }
.user-button { height: 38px; display: flex; align-items: center; gap: 8px; margin-left: 4px; padding: 0 8px 0 4px; border: 0; background: transparent; color: var(--ink); }
.user-button span { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: #263a46; color: white; font-size: 11px; }
.user-button b { font-size: 12px; }
.content { max-width: 1680px; margin: 0 auto; padding: 24px 26px 52px; }
.view { display: none; }
.view.active { display: block; }

/* Common components */
.page-head { min-height: 58px; display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; margin-bottom: 18px; }
.page-head h1 { margin: 0; font-size: 23px; line-height: 1.25; }
.page-head p { max-width: 850px; margin: 6px 0 0; color: var(--muted); }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.btn { min-height: 36px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 6px 12px; border: 1px solid var(--line-strong); border-radius: 4px; background: white; color: var(--ink); font-weight: 700; font-size: 12px; }
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { border-color: var(--accent); background: var(--accent); color: white; }
.btn.primary:hover { background: var(--accent-strong); color: white; }
.btn.danger { color: var(--red); border-color: #e7b9bf; }
.btn.small { min-height: 29px; padding: 4px 8px; font-size: 11px; }
.btn.icon-only { width: 32px; padding: 0; }
.status { min-height: 23px; display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border: 1px solid var(--line); border-radius: 12px; font-size: 11px; font-weight: 800; white-space: nowrap; }
.status.good { color: var(--green); background: var(--green-soft); border-color: #b8dfca; }
.status.warn { color: var(--amber); background: var(--amber-soft); border-color: #f0d197; }
.status.risk { color: var(--red); background: var(--red-soft); border-color: #edbdc2; }
.status.info { color: var(--blue); background: var(--blue-soft); border-color: #c1d6ea; }
.status.neutral { color: #5e6e77; background: #f0f3f5; }
.panel { margin-bottom: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 1px 2px rgba(22,42,53,.03); }
.panel-head { min-height: 51px; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 15px; border-bottom: 1px solid var(--line); }
.panel-head h2, .panel-head h3 { margin: 0; font-size: 14px; }
.panel-head p { margin: 2px 0 0; color: var(--muted); font-size: 11px; }
.panel-body { padding: 15px; }
.kpi-grid { display: grid; grid-template-columns: repeat(6, minmax(130px, 1fr)); gap: 10px; margin-bottom: 16px; }
.kpi { min-height: 96px; padding: 13px 14px; border: 1px solid var(--line); border-top: 3px solid #6b7d86; border-radius: var(--radius); background: white; }
.kpi.good { border-top-color: var(--green); }
.kpi.warn { border-top-color: var(--amber); }
.kpi.risk { border-top-color: var(--red); }
.kpi.info { border-top-color: var(--blue); }
.kpi-label { color: var(--muted); font-size: 11px; }
.kpi-value { margin-top: 5px; font-size: 22px; line-height: 1.25; font-weight: 800; font-variant-numeric: tabular-nums; }
.kpi-note { margin-top: 4px; color: var(--muted); font-size: 10px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; min-width: 980px; border-collapse: collapse; }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { background: var(--surface-2); color: #52636d; font-size: 11px; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfcfc; }
.risk-row { background: #fffafa; }
.warn-row { background: #fffdf8; }
.table-input, .table-select { width: 100%; min-width: 76px; min-height: 31px; padding: 4px 6px; border: 1px solid var(--line-strong); border-radius: 3px; background: white; color: var(--ink); }
.table-input.name { min-width: 145px; }
.table-input.score-input { width: 76px; min-width: 70px; text-align: right; }
.table-select.cause { min-width: 150px; }
.form-grid { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 13px; }
.field label { display: block; margin-bottom: 5px; color: var(--muted); font-size: 11px; font-weight: 700; }
.field input, .field select, .field textarea { width: 100%; min-height: 38px; padding: 7px 9px; border: 1px solid var(--line-strong); border-radius: 4px; background: white; color: var(--ink); }
.field textarea { min-height: 84px; resize: vertical; }
.field.wide { grid-column: 1 / -1; }
.field-help { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.empty { padding: 54px 20px; text-align: center; color: var(--muted); }
.empty strong { display: block; margin-bottom: 4px; color: var(--ink); font-size: 15px; }
.notice { padding: 11px 13px; border-left: 3px solid var(--blue); background: var(--blue-soft); color: #38536b; }
.notice.warn { border-left-color: var(--amber); background: var(--amber-soft); color: #664719; }
.formula-bar { display: flex; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: 10px; }
.formula-bar code { padding: 2px 5px; border-radius: 3px; background: #edf2f4; color: var(--ink); }
.progress { width: 100%; height: 7px; overflow: hidden; border-radius: 4px; background: #e7ecee; }
.progress span { display: block; height: 100%; background: var(--accent); }
.filter-row { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }
.filter-row input, .filter-row select { min-height: 36px; padding: 6px 9px; border: 1px solid var(--line); border-radius: 4px; background: white; }
.filter-row input { min-width: 240px; }

/* Home */
.home-hero { min-height: 270px; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(360px, .75fr); margin-bottom: 18px; overflow: hidden; border: 1px solid #23404c; border-radius: var(--radius); background: #17303a; color: white; box-shadow: var(--shadow); }
.home-hero-copy { align-self: center; padding: 34px 38px; }
.home-hero-copy .eyebrow { margin: 0 0 9px; color: #74d3c5; font-size: 11px; font-weight: 800; }
.home-hero-copy h1 { margin: 0; max-width: 680px; font-size: 30px; line-height: 1.3; }
.home-hero-copy > p { max-width: 680px; margin: 13px 0 22px; color: #bdd0d6; }
.hero-actions { display: flex; gap: 9px; flex-wrap: wrap; }
.hero-actions .btn { border-color: rgba(255,255,255,.25); background: transparent; color: white; }
.hero-actions .btn.primary { border-color: #4bc5b4; background: #4bc5b4; color: #092b27; }
.hero-flow { display: grid; align-content: center; gap: 9px; padding: 26px; background: #10232b; }
.hero-step { min-height: 52px; display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid rgba(255,255,255,.12); background: rgba(255,255,255,.04); }
.hero-step b:first-child { color: #70d1c4; font-size: 15px; }
.hero-step span { color: #dce7e9; font-size: 12px; }
.hero-step small { color: #7f989f; }
.home-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(310px, .65fr); gap: 16px; }
.workflow-row { display: grid; grid-template-columns: repeat(4, 1fr); }
.workflow-cell { min-height: 130px; padding: 17px; border-right: 1px solid var(--line); }
.workflow-cell:last-child { border-right: 0; }
.workflow-cell .step-no { color: var(--accent); font-size: 11px; font-weight: 800; }
.workflow-cell h3 { margin: 8px 0 5px; font-size: 14px; }
.workflow-cell p { margin: 0; color: var(--muted); font-size: 11px; }
.project-list { display: grid; }
.project-list-item { width: 100%; display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; padding: 12px 15px; border: 0; border-bottom: 1px solid var(--line); background: white; color: var(--ink); text-align: left; }
.project-list-item:hover { background: var(--surface-2); }
.project-list-item:last-child { border-bottom: 0; }
.project-list-item h3 { margin: 0; font-size: 13px; }
.project-list-item p { margin: 3px 0 0; color: var(--muted); font-size: 10px; }

/* Projects */
.portfolio-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 16px; }
.summary-cell { padding: 14px; border-left: 3px solid var(--accent); background: white; border-top: 1px solid var(--line); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.summary-cell span { color: var(--muted); font-size: 11px; }
.summary-cell strong { display: block; margin-top: 4px; font-size: 21px; }
.project-name-cell strong { display: block; font-size: 13px; }
.project-name-cell small { display: block; max-width: 380px; margin-top: 3px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.action-cluster { display: flex; gap: 5px; justify-content: flex-end; }

/* VSM / TOC / ECRSI */
.data-readiness { display: flex; align-items: center; gap: 10px; }
.data-readiness .progress { width: 130px; }
.settings-grid { display: grid; grid-template-columns: repeat(5, minmax(150px, 1fr)); gap: 10px; }
.range-setting { padding: 11px; border: 1px solid var(--line); background: var(--surface-2); }
.range-setting-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 9px; }
.range-setting-head label { font-size: 11px; font-weight: 700; }
.range-setting-head output { color: var(--accent); font-weight: 800; }
.range-setting input[type="range"] { width: 100%; accent-color: var(--accent); }
.diagnostic-grid { display: grid; grid-template-columns: repeat(4, minmax(140px, 1fr)); gap: 10px; }
.score-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.score-box { min-height: 108px; display: grid; place-items: center; padding: 15px; border: 1px solid var(--line); border-top: 3px solid var(--blue); background: white; text-align: center; }
.score-box.risk { border-top-color: var(--red); background: var(--red-soft); }
.score-box.warn { border-top-color: var(--amber); background: var(--amber-soft); }
.score-box.good { border-top-color: var(--green); background: var(--green-soft); }
.score-box strong { display: block; font-size: 24px; }
.score-box span { color: var(--muted); font-size: 11px; }
.focus-steps { display: grid; grid-template-columns: repeat(5, minmax(155px, 1fr)); gap: 9px; }
.focus-step { min-height: 150px; padding: 13px; border: 1px solid var(--line); border-top: 3px solid var(--accent); background: var(--surface-2); }
.focus-step span { color: var(--accent); font-size: 10px; font-weight: 800; }
.focus-step strong { display: block; margin: 7px 0; }
.focus-step p { margin: 0; color: var(--muted); font-size: 11px; }
.principles { display: grid; grid-template-columns: repeat(5, 1fr); margin-bottom: 16px; border: 1px solid var(--line); background: white; }
.principle { min-height: 96px; padding: 14px; border-right: 1px solid var(--line); }
.principle:last-child { border-right: 0; }
.principle strong { display: inline-grid; width: 28px; height: 28px; place-items: center; margin-right: 7px; border-radius: 50%; color: white; background: var(--accent); }
.principle b { font-size: 12px; }
.principle span { display: block; margin-top: 8px; color: var(--muted); font-size: 10px; }
.principle.e strong { background: var(--red); }
.principle.c strong { background: var(--amber); }
.principle.r strong { background: var(--blue); }
.principle.s strong { background: var(--purple); }
.principle.i strong { background: var(--green); }

/* Data */
.data-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.data-action { min-height: 170px; padding: 20px; border: 1px solid var(--line); background: white; }
.data-action .data-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 4px; background: var(--accent-soft); color: var(--accent); font-weight: 900; }
.data-action h3 { margin: 13px 0 6px; }
.data-action p { min-height: 42px; margin: 0 0 16px; color: var(--muted); font-size: 11px; }
.schema-list { margin: 0; padding-left: 18px; color: var(--muted); }
.schema-list li { margin: 7px 0; }

/* Modal and toast */
.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 24px; background: rgba(9, 21, 27, .62); }
.modal { width: min(760px, 100%); max-height: calc(100vh - 48px); overflow: auto; border-radius: 7px; background: white; box-shadow: 0 24px 70px rgba(0,0,0,.25); }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.modal-head p { margin: 0 0 2px; color: var(--accent); font-size: 10px; font-weight: 800; }
.modal-head h2 { margin: 0; font-size: 18px; }
.modal-body { padding: 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 13px 20px; border-top: 1px solid var(--line); background: var(--surface-2); }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 130; max-width: 380px; padding: 11px 14px; border-radius: 4px; background: #1d303a; color: white; box-shadow: 0 12px 32px rgba(20,38,48,.24); opacity: 0; transform: translateY(8px); pointer-events: none; transition: .18s ease; }
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 1240px) {
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .settings-grid { grid-template-columns: repeat(3, 1fr); }
  .focus-steps { grid-template-columns: repeat(3, 1fr); }
  .topbar { grid-template-columns: 1fr auto; }
  .topbar-context { grid-row: 2; grid-column: 1 / -1; justify-content: flex-start; }
  .topbar-context select { width: min(420px, 60vw); }
}
@media (max-width: 980px) {
  .login-screen { grid-template-columns: 1fr; }
  .login-visual { min-height: 440px; }
  .login-visual-content { width: min(680px, 86%); padding-top: 45px; }
  .login-visual h1 { font-size: 42px; }
  .login-panel { min-height: 560px; }
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; }
  .sidebar.mobile-open { transform: translateX(0); }
  .app-main { width: 100%; margin-left: 0; }
  .menu-button { display: inline-grid; }
  .home-hero { grid-template-columns: 1fr; }
  .hero-flow { grid-template-columns: repeat(3, 1fr); }
  .home-grid { grid-template-columns: 1fr; }
  .workflow-row { grid-template-columns: repeat(2, 1fr); }
  .workflow-cell:nth-child(2) { border-right: 0; }
  .workflow-cell:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .form-grid { grid-template-columns: repeat(2, 1fr); }
  .data-actions { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .login-visual { display: none; }
  .login-panel { min-height: 100vh; padding: 18px; }
  .login-card { padding: 30px 24px; }
  .mobile-brand { display: flex; margin-bottom: 38px; }
  .topbar { min-height: 62px; grid-template-columns: 1fr auto; padding: 9px 12px; gap: 9px; }
  .topbar-actions .icon-button { display: none; }
  .user-button b { display: none; }
  .topbar-context { overflow-x: auto; }
  .topbar-context label, .data-date { display: none; }
  .topbar-context select { width: min(80vw, 360px); }
  .content { padding: 17px 12px 36px; }
  .page-head { flex-direction: column; }
  .page-actions { width: 100%; justify-content: flex-start; }
  .home-hero-copy { padding: 26px 22px; }
  .home-hero-copy h1 { font-size: 24px; }
  .hero-flow { grid-template-columns: 1fr; }
  .kpi-grid, .portfolio-summary, .score-strip { grid-template-columns: repeat(2, 1fr); }
  .kpi { min-height: 90px; }
  .kpi-value { font-size: 19px; }
  .form-grid, .settings-grid, .diagnostic-grid, .focus-steps, .principles { grid-template-columns: 1fr; }
  .principle { border-right: 0; border-bottom: 1px solid var(--line); }
  .principle:last-child { border-bottom: 0; }
  .workflow-row { grid-template-columns: 1fr; }
  .workflow-cell { border-right: 0; border-bottom: 1px solid var(--line); }
  .filter-row input { min-width: 100%; width: 100%; }
  .panel-head { align-items: flex-start; flex-direction: column; }
  .modal-backdrop { padding: 10px; }
  .toast { right: 12px; bottom: 12px; left: 12px; max-width: none; }
}
@media print {
  .sidebar, .topbar, .page-actions, .btn, .modal-backdrop, .toast { display: none !important; }
  .app-main { width: 100%; margin: 0; }
  .content { max-width: none; padding: 0; }
  body { background: white; }
  .panel, .kpi { box-shadow: none; break-inside: avoid; }
  .view { display: none !important; }
  .view.active { display: block !important; }
}
