:root {
  --charcoal: #3a3a3a; --charcoal-dark: #262626; --charcoal-deep: #1d1d1d; --red: #c1121f; --red-dark: #9c0e19; --orange: #f28c28; --orange-dark: #d9741a; --orange-light: #fdebd9; --gold: #ffc043;
  --green: #1f8a5b; --green-bg: #e3f3ea; --yellow: #a67c00; --yellow-bg: #fff4cc; --amber: #c2410c; --amber-bg: #ffe6d1; --danger: #c1121f; --danger-bg: #fbe1e4; --darkred: #7a0c14; --darkred-bg: #f2d3d6; --grey: #6b7280; --grey-bg: #eceff3; --blue: #1d4ed8; --blue-bg: #dbe4ff;
  --bg: #f4f5f7; --surface: #ffffff; --border: #e1e5eb; --text: #1c1f26; --muted: #5f6772; --muted-light: #8b93a0;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .08);
  --radius: 10px; --sidebar-w: 244px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif; font-size: 14px; line-height: 1.45; }
a { color: var(--red); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 650; color: var(--charcoal); }
h1 { font-size: 22px; } h2 { font-size: 16px; } h3 { font-size: 14px; }
p { margin: 0 0 8px; }
[hidden] { display: none !important; }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); } .small { font-size: 12px; } .bold { font-weight: 650; } .nowrap { white-space: nowrap; }
.pos { color: var(--green); } .neg { color: var(--danger); } .warn { color: var(--amber); }
.mt { margin-top: 16px; } .mb { margin-bottom: 16px; } .mt-sm { margin-top: 8px; } .mb-sm { margin-bottom: 8px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }

/* ---------- Login ---------- */
.login-view { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: radial-gradient(circle at 15% 20%, rgba(242, 140, 40, .28), transparent 42%), radial-gradient(circle at 85% 80%, rgba(193, 18, 31, .35), transparent 45%), linear-gradient(135deg, #1d1d1d, #3a3a3a); }
.login-card { background: var(--surface); border-radius: 16px; padding: 34px 32px 26px; width: 100%; max-width: 420px; box-shadow: 0 24px 60px rgba(0, 0, 0, .35); }
.login-logo { max-width: 280px; width: 100%; height: auto; display: block; margin: 0 auto 8px; }
.login-title { text-align: center; color: var(--charcoal); font-weight: 700; letter-spacing: .6px; text-transform: uppercase; font-size: 12px; margin-bottom: 22px; padding-bottom: 14px; border-bottom: 3px solid var(--orange); }
.login-foot { margin-top: 18px; color: var(--muted); font-size: 12px; text-align: center; }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); background: var(--charcoal-dark); color: #e6e6e6; display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0; z-index: 30; transition: transform .2s ease; }
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 16px 16px 10px; background: #fff; }
.sidebar-logo { width: 100%; max-width: 200px; height: auto; display: block; }
.sidebar-app { padding: 8px 18px; font-size: 11px; letter-spacing: 1px; text-transform: uppercase; color: var(--gold); background: var(--charcoal-deep); border-bottom: 1px solid rgba(255, 255, 255, .06); }
.sidebar-close { display: none; margin-left: auto; color: var(--charcoal); }
.nav { flex: 1; overflow-y: auto; padding: 10px 0; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 18px; color: #cfcfcf; font-size: 13.5px; border-left: 3px solid transparent; }
.nav a:hover { background: rgba(255, 255, 255, .06); text-decoration: none; color: #fff; }
.nav a.active { background: rgba(255, 255, 255, .09); color: #fff; border-left-color: var(--orange); }
.nav .nav-group { padding: 12px 18px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: #8d8d8d; }
.nav-icon { width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; opacity: .9; }
.nav-icon svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav-badge { margin-left: auto; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; }
.sidebar-foot { padding: 12px 16px; border-top: 1px solid rgba(255, 255, 255, .08); }
.nav-user { font-size: 12px; line-height: 1.3; margin-bottom: 8px; } .nav-user b { color: #fff; display: block; } .nav-user span { color: #a8a8a8; }
.sidebar-foot-actions { display: flex; gap: 6px; }
.sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 25; }
.main { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-width: 0; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 10px 24px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.topbar-search { flex: 1; max-width: 560px; position: relative; }
.topbar-search input { width: 100%; }
.search-results { position: absolute; top: 100%; left: 0; right: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 10px 30px rgba(0, 0, 0, .12); margin-top: 4px; max-height: 320px; overflow: auto; z-index: 40; }
.search-results a { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 12px; color: var(--text); border-bottom: 1px solid var(--border); }
.search-results a:hover { background: #f7f8fa; text-decoration: none; }
.search-results .empty { padding: 10px 12px; color: var(--muted); }
#menu-btn { display: none; }
.alert-bell { margin-left: auto; position: relative; width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: var(--charcoal); }
.alert-bell:hover { background: var(--grey-bg); text-decoration: none; }
.bell-icon { width: 20px; height: 20px; display: block; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 8a6 6 0 0 0-12 0c0 7-3 9-3 9h18s-3-2-3-9'/%3E%3Cpath d='M13.7 21a2 2 0 0 1-3.4 0'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 8a6 6 0 0 0-12 0c0 7-3 9-3 9h18s-3-2-3-9'/%3E%3Cpath d='M13.7 21a2 2 0 0 1-3.4 0'/%3E%3C/svg%3E") center / contain no-repeat; }
.alert-count { position: absolute; top: 2px; right: 0; background: var(--red); color: #fff; font-size: 10.5px; font-weight: 700; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; }
.topbar-user { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.topbar-user b { color: var(--text); }
.content { padding: 22px 24px; flex: 1; }
.app-foot { padding: 12px 24px; color: var(--muted-light); font-size: 12px; text-align: center; }

/* ---------- Page header ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.page-head .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.crumbs { font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.crumbs a { color: var(--muted); }

/* ---------- Cards / grids ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 18px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head .hint { font-size: 12px; color: var(--muted); }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid > .card { margin-bottom: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); border-top: 3px solid var(--charcoal); }
.stat.green { border-top-color: var(--green); } .stat.yellow { border-top-color: var(--gold); } .stat.orange { border-top-color: var(--orange); } .stat.red { border-top-color: var(--red); } .stat.grey { border-top-color: var(--muted-light); } .stat.blue { border-top-color: var(--blue); }
.stat .label { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.stat .value { font-size: 24px; font-weight: 700; margin-top: 4px; color: var(--text); font-variant-numeric: tabular-nums; line-height: 1.2; }
.stat .hint { font-size: 12px; color: var(--muted); margin-top: 3px; }
a.stat { display: block; color: inherit; } a.stat:hover { text-decoration: none; border-color: var(--orange); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th, .tbl td { padding: 9px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.tbl th { background: #f6f7f9; color: var(--muted); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .3px; white-space: nowrap; }
.tbl tbody tr:hover { background: #fafbfc; }
.tbl tbody tr.clickable { cursor: pointer; }
.tbl tfoot td { font-weight: 700; background: #f6f7f9; }
.tbl .empty { text-align: center; color: var(--muted); padding: 22px; }
.tbl td.actions-cell { white-space: nowrap; text-align: right; }
.tbl .sub { display: block; font-size: 12px; color: var(--muted); }
.tbl tr.selected td { background: var(--orange-light); }
.vlink { color: var(--text); display: inline-block; min-width: 150px; } .vlink:hover { text-decoration: none; } .vlink:hover .reg { color: var(--red); }
.vlink .sub { white-space: nowrap; }
.reg { font-weight: 700; letter-spacing: .3px; color: var(--charcoal); white-space: nowrap; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: .3px; text-transform: uppercase; white-space: nowrap; line-height: 1.4; }
.badge::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.badge.plain::before { display: none; }
.st-draft { background: var(--grey-bg); color: var(--grey); }
.st-submitted { background: var(--blue-bg); color: var(--blue); }
.st-approved { background: var(--green-bg); color: var(--green); }
.st-approved_conditional { background: var(--amber-bg); color: var(--amber); }
.st-declined { background: var(--danger-bg); color: var(--danger); }
.st-withdrawn { background: var(--grey-bg); color: var(--muted-light); }
.rec-approve { background: var(--green-bg); color: var(--green); }
.rec-conditional { background: var(--amber-bg); color: var(--amber); }
.rec-refer { background: var(--yellow-bg); color: var(--yellow); }
.rec-decline { background: var(--danger-bg); color: var(--danger); }
.rec-none { background: var(--grey-bg); color: var(--grey); }
.dc-approved { background: var(--green-bg); color: var(--green); } .dc-approved_conditional { background: var(--amber-bg); color: var(--amber); } .dc-declined { background: var(--danger-bg); color: var(--danger); } .dc-returned { background: var(--grey-bg); color: var(--grey); }
.grade { display: inline-flex; align-items: center; justify-content: center; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 7px; font-weight: 800; font-size: 13px; color: #fff; background: var(--grey); }
.grade-A { background: var(--green); } .grade-B { background: #3e9a4a; } .grade-C { background: var(--orange); } .grade-D { background: #b8860b; } .grade-E { background: var(--red); }
.role-badge { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11.5px; font-weight: 700; background: var(--grey-bg); color: var(--charcoal); }
.role-admin { background: var(--orange-light); color: var(--orange-dark); } .role-approver { background: var(--blue-bg); color: var(--blue); } .role-officer { background: var(--green-bg); color: var(--green); }

/* ---------- Score ring & scorecard ---------- */
.ring { display: inline-block; }
.ring svg { display: block; }
.ring .track { fill: none; stroke: var(--grey-bg); stroke-width: 9; }
.ring .arc { fill: none; stroke-width: 9; stroke-linecap: round; transform: rotate(-90deg); transform-origin: 50% 50%; transition: stroke-dasharray .4s ease; }
.ring .arc.grade-A, .ring .arc.grade-B { stroke: var(--green); } .ring .arc.grade-C { stroke: var(--orange); } .ring .arc.grade-D { stroke: #b8860b; } .ring .arc.grade-E { stroke: var(--red); }
.ring .total { font-size: 26px; font-weight: 800; fill: var(--charcoal); } .ring .of { font-size: 10px; fill: var(--muted); font-weight: 600; letter-spacing: .5px; }
.score-head { display: grid; grid-template-columns: auto 1fr; gap: 20px; align-items: center; }
.score-head .headline { font-size: 18px; font-weight: 800; color: var(--charcoal); }
.score-head .figures { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 8px; font-size: 13px; }
.score-head .figures b { display: block; font-size: 15px; color: var(--text); font-variant-numeric: tabular-nums; }
.score-head .figures span { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; }
.sc-section { margin-bottom: 14px; }
.sc-section .sc-title { display: flex; justify-content: space-between; align-items: center; font-weight: 700; color: var(--charcoal); padding: 8px 0 4px; border-bottom: 2px solid var(--border); }
.sc-section .sc-title .pts { font-variant-numeric: tabular-nums; }
.sc-item { display: grid; grid-template-columns: 1fr 120px 64px; gap: 12px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.sc-item .lbl { font-weight: 600; color: var(--text); } .sc-item .note { display: block; color: var(--muted); font-size: 12px; font-weight: 400; margin-top: 1px; }
.sc-item .pts { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.bar { height: 8px; background: var(--grey-bg); border-radius: 999px; overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 999px; background: var(--green); }
.bar.mid > span { background: var(--orange); } .bar.low > span { background: var(--red); } .bar.zero > span { background: var(--red); min-width: 3px; }
.sc-section .bar { height: 10px; margin-top: 6px; }
.findings { list-style: none; margin: 0; padding: 0; }
.findings li { padding: 7px 10px; border-radius: 8px; margin-bottom: 6px; font-size: 13px; display: flex; gap: 8px; align-items: flex-start; }
.findings li::before { content: '●'; flex-shrink: 0; }
.findings.ko li { background: var(--danger-bg); color: var(--darkred); font-weight: 600; }
.findings.cap li { background: var(--yellow-bg); color: #6b5300; }
.findings.cond li { background: #f7f8fa; color: var(--text); border: 1px solid var(--border); } .findings.cond li::before { color: var(--orange); }
.findings.good li { background: var(--green-bg); color: var(--green); }
.findings.weak li { background: var(--amber-bg); color: var(--amber); }
.findings .none { color: var(--muted); font-style: italic; }
.banner { border-radius: var(--radius); padding: 14px 18px; margin-bottom: 18px; display: flex; gap: 14px; align-items: center; border: 1px solid transparent; }
.banner .headline { font-weight: 800; letter-spacing: .5px; font-size: 15px; }
.banner .detail { font-size: 13px; opacity: .9; }
.banner.rec-approve { background: var(--green-bg); color: var(--green); border-color: #bfe3cf; }
.banner.rec-conditional { background: var(--amber-bg); color: #8a2e0a; border-color: #f7c49a; }
.banner.rec-refer { background: var(--yellow-bg); color: #6b5300; border-color: #f3dd8a; }
.banner.rec-decline { background: var(--danger-bg); color: var(--danger); border-color: #f0b3b9; }
.banner.info { background: var(--blue-bg); color: var(--blue); border-color: #b9c9ff; }
.banner .banner-actions { margin-left: auto; }

/* ---------- Application form with live score panel ---------- */
.form-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.score-panel { position: sticky; top: 74px; }
.score-panel .ring { display: block; margin: 0 auto 6px; width: 120px; }
.score-panel .rec { text-align: center; margin-bottom: 10px; }
.score-panel .kv { font-size: 12.5px; }
.score-panel h3 { margin: 12px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.score-panel .findings li { font-size: 12px; padding: 5px 8px; }
.score-panel .mini-sections { display: grid; gap: 5px; margin-top: 4px; }
.score-panel .mini-sections div { display: grid; grid-template-columns: 1fr auto; gap: 8px; font-size: 12px; align-items: center; }
.score-panel .mini-sections .bar { grid-column: 1 / -1; height: 6px; }
.fieldset { border: 0; padding: 0; margin: 0 0 6px; }
.fieldset legend { font-weight: 700; color: var(--charcoal); font-size: 14px; padding: 14px 0 8px; border-top: 1px solid var(--border); width: 100%; margin-top: 6px; }
.fieldset:first-of-type legend { border-top: 0; margin-top: 0; padding-top: 0; }
.fieldset .form-grid { margin-bottom: 4px; }

/* ---------- Key/value ---------- */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 13px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
.kv.tight { gap: 4px 12px; }
.notes-box { white-space: pre-wrap; font-size: 13px; color: var(--text); background: #fafbfc; border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }
.big-ref { font-size: 24px; font-weight: 800; letter-spacing: .5px; color: var(--charcoal); }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.tabs button { background: none; border: 0; border-bottom: 3px solid transparent; padding: 9px 14px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; }
.tabs button.active { color: var(--red); border-bottom-color: var(--red); }
.tabs button:hover { color: var(--charcoal); }
.doc-row { display: grid; grid-template-columns: minmax(0, 1fr) 150px minmax(160px, 1fr) auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.doc-row .dl { font-weight: 600; } .doc-row .dl small { display: block; color: var(--muted); font-weight: 400; }
.doc-row.done .dl { color: var(--green); }
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.feed li .who { font-weight: 650; color: var(--charcoal); } .feed li .when { color: var(--muted); font-size: 12px; margin-left: 8px; }
.feed li .txt { margin-top: 3px; white-space: pre-wrap; }
.feed li.workflow .txt { background: var(--orange-light); border-radius: 8px; padding: 8px 10px; }
.decision-box { border: 2px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.decision-box.dc-approved { border-color: var(--green); } .decision-box.dc-approved_conditional { border-color: var(--orange); } .decision-box.dc-declined { border-color: var(--red); }
.options-tbl tr.fits td:last-child { color: var(--green); font-weight: 700; } .options-tbl tr.nofit td:last-child { color: var(--danger); font-weight: 700; }
.dist { display: flex; height: 16px; border-radius: 999px; overflow: hidden; background: var(--grey-bg); margin: 8px 0 10px; }
.dist span { display: block; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 12.5px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; text-decoration: none; }
.btn:hover { background: #f4f6f8; text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--red); border-color: var(--red); color: #fff; } .btn-primary:hover { background: var(--red-dark); }
.btn-accent { background: var(--orange); border-color: var(--orange); color: #fff; } .btn-accent:hover { background: var(--orange-dark); }
.btn-dark { background: var(--charcoal); border-color: var(--charcoal); color: #fff; } .btn-dark:hover { background: var(--charcoal-dark); }
.btn-success { background: var(--green); border-color: var(--green); color: #fff; } .btn-success:hover { background: #176f49; }
.btn-danger { background: #fff; border-color: var(--danger); color: var(--danger); } .btn-danger:hover { background: var(--danger-bg); }
.btn-ghost { background: transparent; border-color: rgba(255, 255, 255, .25); color: #ddd; } .btn-ghost:hover { background: rgba(255, 255, 255, .08); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; border-radius: 6px; }
.btn-block { width: 100%; }
.btn-link { background: none; border: 0; color: var(--red); padding: 2px 4px; font: inherit; cursor: pointer; font-weight: 600; } .btn-link:hover { text-decoration: underline; }
.btn-link.danger { color: var(--danger); }
.icon-btn { background: none; border: 0; font-size: 18px; cursor: pointer; color: var(--charcoal); padding: 4px 8px; border-radius: 6px; } .icon-btn:hover { background: var(--grey-bg); }

/* ---------- Forms ---------- */
input, select, textarea { font: inherit; color: var(--text); background: #fff; border: 1px solid #cdd3dc; border-radius: 8px; padding: 8px 10px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(242, 140, 40, .45); border-color: var(--orange); }
input[type=checkbox] { width: auto; }
textarea { resize: vertical; min-height: 70px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.field > span { color: var(--muted); font-weight: 600; font-size: 12px; }
.field > span.req::after { content: ' *'; color: var(--danger); }
.field .help { font-size: 12px; color: var(--muted); }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; padding-top: 22px; }
.check input { margin: 0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.form-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-section { grid-column: 1 / -1; font-weight: 700; color: var(--charcoal); border-top: 1px solid var(--border); padding-top: 12px; margin-top: 4px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; grid-column: 1 / -1; }
.form-error { grid-column: 1 / -1; background: var(--danger-bg); color: var(--danger); padding: 9px 12px; border-radius: 8px; font-size: 13px; }
.form-info { grid-column: 1 / -1; background: var(--orange-light); color: #7a3f08; padding: 9px 12px; border-radius: 8px; font-size: 13px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 14px; }
.filters .field { min-width: 150px; flex: 1 1 150px; max-width: 240px; }
.filters .field.wide { max-width: 320px; }
.filters .btn { height: 37px; }
.hint-box { font-size: 12.5px; color: var(--muted); background: #f7f8fa; border: 1px dashed var(--border); border-radius: 8px; padding: 8px 10px; }

/* ---------- Modal / toast ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(20, 20, 20, .5); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; z-index: 50; }
.modal { background: var(--surface); border-radius: 14px; width: 100%; max-width: 720px; box-shadow: 0 25px 60px rgba(0, 0, 0, .35); }
.modal.narrow { max-width: 480px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 20px; }
.toast-root { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 60; max-width: 420px; }
.toast { background: var(--charcoal-dark); color: #fff; padding: 11px 16px; border-radius: 8px; font-size: 13px; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); border-left: 4px solid var(--orange); }
.toast.success { border-left-color: var(--green); } .toast.error { border-left-color: var(--danger); } .toast.warn { border-left-color: var(--gold); }

/* ---------- Reports ---------- */
.report-tabs { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin-bottom: 16px; }
.report-tab { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; cursor: pointer; text-align: left; font: inherit; color: var(--text); }
.report-tab b { display: block; color: var(--charcoal); margin-bottom: 2px; }
.report-tab span { font-size: 12px; color: var(--muted); }
.report-tab.active { border-color: var(--orange); box-shadow: 0 0 0 2px rgba(242, 140, 40, .25); }
.report-tab:hover { border-color: var(--orange); }
.report-meta { font-size: 12.5px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 10px; }

/* ---------- Audit ---------- */
.audit-diff { font-family: Consolas, "Courier New", monospace; font-size: 11.5px; white-space: pre-wrap; background: #fafbfc; border: 1px solid var(--border); border-radius: 6px; padding: 8px; max-height: 260px; overflow: auto; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) { .form-layout { grid-template-columns: 1fr; } .score-panel { position: static; } }
@media (max-width: 960px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop.open { display: block; }
  .sidebar-close { display: inline-block; }
  .main { margin-left: 0; }
  #menu-btn { display: inline-block; }
  .topbar { padding: 8px 14px; }
  .content { padding: 16px 14px; }
  .topbar-user { display: none; }
  .doc-row { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat .value { font-size: 20px; }
  .modal-backdrop { padding: 12px 8px; }
  .modal-body { padding: 14px; }
  .page-head h1 { font-size: 19px; }
  .score-head { grid-template-columns: 1fr; }
  .sc-item { grid-template-columns: 1fr 50px; } .sc-item .bar { display: none; }
  .banner { flex-wrap: wrap; } .banner .banner-actions { margin-left: 0; width: 100%; }
  .filters .field { max-width: none; }
  .doc-row { grid-template-columns: 1fr; }
}
@media print {
  .sidebar, .topbar, .app-foot, .actions, .btn, .filters, .report-tabs, .tabs { display: none !important; }
  .main { margin-left: 0; }
  .card { box-shadow: none; break-inside: avoid; }
}
