:root {
  --ink: #2e2e38; --ink2: #5c5c6b; --muted: #747480; --line: #e1e1e8; --bg: #f6f6f9; --card: #ffffff;
  --yel: #ffe600; --yel-d: #8a6e00; --t1: #ffe600; --t2: #eb8c00; --t2-d: #b85e00; --rose: #db536a;
  --ok: #1f8a4c; --err: #c0392b; --blue: #2457a6;
  --r0: #e4e4ea; --r1: #d2d2da; --r2: #e8dc9a; --r3: #f2d84a; --r4: #ffe000; --r5: #ffd200;
  --top: 58px; --radius: 8px;
}
* { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--top) + 12px); }
body { margin: 0; font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--blue); }
h1 { font-size: 1.5rem; margin: 0 0 .3rem; line-height: 1.2; }
h2 { font-size: 1.05rem; margin: 0 0 .7rem; }
h3 { font-size: 1rem; margin: 0; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .err { color: var(--err); } .req { color: var(--err); }
code { background: #f0f0f4; padding: 2px 6px; border-radius: 4px; font-size: .95em; }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 50; height: var(--top); display: flex; align-items: center; gap: 18px; padding: 0 18px; background: var(--ink); color: #fff; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; white-space: nowrap; }
.mark { background: var(--yel); color: var(--ink); font-weight: 800; letter-spacing: .5px; padding: 5px 8px; border-radius: 4px; font-size: .9rem; }
.mark.big { font-size: 1.3rem; padding: 10px 12px; }
.brand-txt { display: flex; flex-direction: column; font-weight: 700; font-size: .92rem; line-height: 1.15; }
.brand-txt small { font-weight: 400; color: #c4c4cd; font-size: .75rem; }
.mainnav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.mainnav a { color: #d8d8e0; text-decoration: none; padding: 7px 11px; border-radius: 6px; white-space: nowrap; font-size: .92rem; }
.mainnav a:hover { background: #3a3a46; color: #fff; }
.mainnav a.on { background: var(--yel); color: var(--ink); font-weight: 600; }
.userbox { display: flex; align-items: center; gap: 12px; margin-left: auto; font-size: .88rem; white-space: nowrap; }
.userbox a { color: #fff; text-decoration: none; }
.userbox .me { font-weight: 600; } .userbox .logout { color: #c4c4cd; }
.langs a { padding: 3px 6px; border-radius: 4px; color: #9c9caa; font-weight: 600; font-size: .8rem; }
.langs a.on { color: var(--ink); background: #fff; }

main.narrow { max-width: 760px; margin: 28px auto; padding: 0 16px; }
main.wide { max-width: 1380px; margin: 24px auto; padding: 0 16px; }
.foot { text-align: center; color: var(--muted); font-size: .78rem; padding: 26px 16px; }
.score-page .foot { display: none; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px; }
.card.warn { border-color: #f0c96b; background: #fff8e0; }
.flash { max-width: 1280px; margin: 14px auto 0; padding: 10px 16px; border-radius: var(--radius); background: #e8f5ee; border: 1px solid #b9e0c8; }
.flash.err { background: #fdecea; border-color: #f3b8b1; color: var(--ink); }
.flash.pw { background: #fff8e0; border-color: #f0c96b; }
.notice { background: #f0f0f4; border-left: 4px solid var(--ink2); padding: 9px 12px; border-radius: 4px; margin-bottom: 12px; font-size: .9rem; }
.notice.warn { border-left-color: var(--err); background: #fdecea; }
.hint { background: #fff8e0; padding: 6px 10px; border-radius: 6px; display: inline-block; font-size: .88rem; }

/* buttons & forms */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid #cfcfd8; background: #fff; color: var(--ink); padding: 8px 14px; border-radius: 6px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; font-size: .92rem; }
.btn:hover { border-color: var(--ink2); }
.btn.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.primary:hover { background: #000; }
.btn.ghost { background: transparent; }
.btn.small { padding: 5px 10px; font-size: .84rem; }
.btn.block { width: 100%; justify-content: center; padding: 11px; }
.btn.link { border: none; background: none; padding: 6px 4px; }
.btn.danger { color: var(--err); }
input, select, textarea { font: inherit; border: 1px solid #cfcfd8; border-radius: 6px; padding: 8px 10px; width: 100%; background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus, .rb:focus-visible, .btn:focus-visible { outline: 3px solid rgba(255, 214, 0, .7); outline-offset: 1px; border-color: var(--ink2); }
label { display: block; font-size: .88rem; font-weight: 600; margin-bottom: 12px; }
label input, label select, label textarea { margin-top: 4px; font-weight: 400; }
.stack { display: grid; gap: 8px; margin-bottom: 14px; }
.checks-row { display: flex; gap: 16px; } .checks-row label { margin: 0; display: flex; gap: 5px; align-items: center; }
.checks-row input { width: auto; margin: 0; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.checks { list-style: none; padding: 0; } .checks .ok { color: var(--ok); } .checks .ko { color: var(--err); font-weight: 600; }

/* login */
.login-wrap { min-height: calc(100vh - var(--top) - 80px); display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 400px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 26px; box-shadow: 0 10px 30px rgba(46, 46, 56, .08); }
.login-head { display: flex; gap: 14px; align-items: center; margin-bottom: 18px; }
.login-head h1 { font-size: 1.25rem; margin: 0; } .login-head p { margin: 2px 0 0; color: var(--muted); font-size: .9rem; }

/* pills */
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .78rem; font-weight: 700; white-space: nowrap; }
.pill.t1 { background: var(--t1); color: var(--ink); } .pill.t2 { background: var(--t2); color: var(--ink); }
.st { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.st-todo { background: #ececf1; color: var(--ink2); } .st-draft { background: #fff2b3; color: #6b5600; }
.st-submitted { background: #d9f0e3; color: #17663a; } .st-conflict { background: #fde0dc; color: #a12d22; }

/* tables */
.tbl-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; background: #fff; }
.tbl th { text-align: left; background: #f0f0f4; color: var(--ink2); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .02em; padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; }
.tbl td { padding: 8px 10px; border-bottom: 1px solid #efeff3; vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.nowrap { white-space: nowrap; }
.tbl th.wrap { white-space: normal; min-width: 92px; line-height: 1.2; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rows-link tbody tr { cursor: pointer; } .rows-link tbody tr:hover { background: #fafae8; }
.tbl tr.in td:first-child { box-shadow: inset 4px 0 0 var(--yel); }
.tbl tr.cut td { border-bottom: 3px solid var(--ink); }
.mini-bar { display: inline-block; width: 60px; height: 6px; background: #ececf1; border-radius: 3px; vertical-align: middle; overflow: hidden; }
.mini-bar span { display: block; height: 100%; background: var(--ink2); }

/* jury home */
.hero { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; margin-bottom: 16px; flex-wrap: wrap; }
.progress-box { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; min-width: 260px; }
.big-num { font-size: 2.2rem; font-weight: 800; line-height: 1; } .big-num span { font-size: 1.1rem; color: var(--muted); font-weight: 600; }
.bar { height: 8px; background: #ececf1; border-radius: 4px; margin: 10px 0 12px; overflow: hidden; } .bar span { display: block; height: 100%; background: var(--ok); }
.rules-mini { font-size: .9rem; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 12px; }
.chip { padding: 5px 11px; border-radius: 999px; border: 1px solid #d5d5de; background: #fff; text-decoration: none; color: var(--ink); font-size: .85rem; }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }

/* KPI cards */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.kpi b { display: block; font-size: 1.7rem; line-height: 1.1; } .kpi span { color: var(--muted); font-size: .85rem; }

/* ===== scoring screen ===== */
.score-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(340px, 1fr); gap: 0; align-items: start; }
.dossier { padding: 18px 22px 40px; min-width: 0; }
.dossier-head { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 10px; }
.dh-id { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; flex-wrap: wrap; }
.fileno { font-weight: 800; background: var(--ink); color: #fff; padding: 2px 8px; border-radius: 4px; font-size: .85rem; }
.dossier-head h1 { font-size: 1.4rem; }
.dossier-head p { margin: 0; font-size: .9rem; }
.dh-nav { display: flex; gap: 8px; align-items: center; }
.quicklinks { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 16px; }
.ql { display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px; background: #fff; border: 1px solid #d5d5de; border-radius: 6px; text-decoration: none; color: var(--ink); font-weight: 600; font-size: .88rem; }
.ql span { display: inline-grid; place-items: center; width: 22px; height: 22px; background: var(--yel); border-radius: 4px; font-size: .8rem; }
.ql:hover { border-color: var(--ink); } .ql.off { color: var(--muted); font-weight: 400; background: #f3f3f6; } .ql.off span { background: #e1e1e8; }
.fsec { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px 6px; margin-bottom: 14px; }
.fsec h2 { font-size: .82rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink2); border-bottom: 2px solid var(--yel); display: inline-block; padding-bottom: 3px; }
.fgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0 18px; }
.fsec.long .fgrid { grid-template-columns: 1fr; }
.fld { padding: 7px 8px; margin: 0 -8px 6px; border-radius: 6px; transition: background .25s, box-shadow .25s; }
.fld .lbl { font-size: .74rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .02em; margin-bottom: 2px; }
.fld .val { font-size: .93rem; overflow-wrap: anywhere; }
.fsec.long .fld .val { font-size: .95rem; line-height: 1.55; max-width: 80ch; }
.fld.rel { background: #fffbe0; }
.fld.hl { background: #fff3a6; box-shadow: 0 0 0 2px #f2c400; }
.empty { color: #a0a0ad; font-style: italic; }
.chips-list { list-style: none; margin: 2px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.chips-list li { background: #f0f0f4; border-radius: 4px; padding: 2px 7px; font-size: .84rem; }

.panel { position: sticky; top: var(--top); height: calc(100vh - var(--top)); display: flex; flex-direction: column; background: #fff; border-left: 1px solid var(--line); }
.panel-tabs { display: flex; border-bottom: 1px solid var(--line); background: #fafafc; }
.panel-tabs a { flex: 1; text-align: center; padding: 9px 4px; font-size: .8rem; color: var(--ink2); text-decoration: none; border-bottom: 3px solid transparent; line-height: 1.2; }
.panel-tabs a b { display: block; color: var(--ink); }
.panel-tabs a.done { border-bottom-color: var(--ok); }
.panel-tabs a:hover { background: #f0f0f4; }
.panel-scroll { flex: 1; overflow-y: auto; padding: 14px 16px; scroll-behavior: smooth; }
.crit { margin-bottom: 22px; }
.crit-head { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: var(--ink); color: #fff; border-radius: 6px; margin-bottom: 10px; position: sticky; top: -14px; z-index: 2; }
.t2-page .crit-head { background: var(--ink); }
.crit-head .cw { background: var(--yel); color: var(--ink); font-weight: 800; border-radius: 4px; padding: 1px 6px; font-size: .85rem; }
.crit-head h3 { flex: 1; font-size: .95rem; }
.crit-head .cs { font-weight: 800; font-size: 1.05rem; } .crit-head .cs small { font-weight: 400; color: #c4c4cd; font-size: .75rem; }
.sub, .bitem { border: 1px solid var(--line); border-radius: 6px; padding: 10px 11px; margin-bottom: 10px; transition: box-shadow .2s; }
.sub:hover, .bitem:hover { box-shadow: 0 2px 10px rgba(46, 46, 56, .08); }
.sub.missing, label.just.missing textarea, textarea.missing { box-shadow: 0 0 0 2px var(--err); }
.sub-top { font-size: .9rem; font-weight: 600; display: flex; gap: 6px; align-items: baseline; }
.sub-top b { color: var(--yel-d); }
.sub-top .w, .bpt { margin-left: auto; font-size: .8rem; color: var(--ink2); background: #f0f0f4; padding: 1px 6px; border-radius: 4px; white-space: nowrap; }
.bpt.yes { background: #fff2b3; color: #6b5600; font-weight: 700; }
.look { font-size: .84rem; color: var(--ink2); margin: 5px 0 6px; }
.where { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin-bottom: 8px; }
.where span { font-size: .74rem; color: var(--muted); margin-right: 2px; }
.wchip { border: 1px dashed #b8b8c4; background: #fff; border-radius: 4px; font: inherit; font-size: .74rem; padding: 2px 6px; cursor: pointer; color: var(--ink2); max-width: 190px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wchip:hover { border-style: solid; border-color: #f2c400; background: #fffbe0; color: var(--ink); }
.rates { display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; }
.rb { border: 1px solid #c9c9d3; background: #fff; border-radius: 6px; padding: 8px 0; font: inherit; font-weight: 800; font-size: 1rem; cursor: pointer; color: var(--ink); transition: transform .08s; }
.rb:hover:not(:disabled) { transform: translateY(-1px); border-color: var(--ink); }
.rb.on { border-color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
.rb.on.r0 { background: var(--r0); } .rb.on.r1 { background: var(--r1); } .rb.on.r2 { background: var(--r2); } .rb.on.r3 { background: var(--r3); } .rb.on.r4 { background: var(--r4); } .rb.on.r5 { background: var(--r5); }
.rb:disabled { cursor: default; opacity: .75; } .rb.on:disabled { opacity: 1; }
.desc { font-size: .83rem; margin-top: 7px; padding: 7px 9px; border-radius: 5px; background: #f6f6f9; min-height: 2.3em; }
.desc.lv0 { background: #eeeef2; } .desc.lv1 { background: #e7e7ee; } .desc.lv2 { background: #f5efcb; } .desc.lv3 { background: #fbf0b5; } .desc.lv4 { background: #fff3a0; } .desc.lv5 { background: #ffec80; }
label.just { font-size: .84rem; margin-top: 4px; }
label.just textarea { resize: vertical; min-height: 54px; font-size: .9rem; }
.b-total { padding: 6px 2px 10px; }
.bitem .decl { margin: 5px 0 3px; }
.bitem details summary { cursor: pointer; color: var(--blue); }
.bitem details { margin-top: 2px; }
.bitem details .where { margin-top: 6px; }
.admin-tools { border-top: 2px solid var(--ink); padding-top: 12px; }
.admin-tools h3 { margin-bottom: 10px; }
.panel-foot { border-top: 1px solid var(--line); padding: 10px 16px 12px; background: #fff; box-shadow: 0 -4px 14px rgba(46, 46, 56, .06); }
.total-line { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.total-line > span:first-child { font-weight: 600; }
.total-line strong { font-size: 1.6rem; } .total-line small { color: var(--muted); }
.total-line .formula { flex-basis: 100%; }
.foot-actions { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.foot-actions #savestate { margin-right: auto; } #savestate.err { color: var(--err); }
.to-panel { display: none; }

/* guide */
.scale { display: grid; gap: 6px; }
.scale div { display: grid; grid-template-columns: 44px 130px 1fr; gap: 10px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px 6px 6px; }
.scale b { display: grid; place-items: center; height: 36px; border-radius: 5px; font-size: 1.1rem; }
.grid-tbl td { vertical-align: top; font-size: .86rem; }
.grid-tbl th.r1 { background: var(--r1); color: var(--ink); } .grid-tbl th.r3 { background: var(--r3); color: var(--ink); } .grid-tbl th.r5 { background: var(--r5); color: var(--ink); }
.cols2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

@media (max-width: 1000px) {
  .score-layout { grid-template-columns: 1fr; }
  .panel { position: static; height: auto; border-left: none; border-top: 4px solid var(--yel); }
  .panel-tabs { position: sticky; top: var(--top); z-index: 5; }
  .panel-scroll { overflow: visible; }
  .crit-head { position: static; }
  .panel-foot { position: sticky; bottom: 0; z-index: 6; }
  .total-line .formula { display: none; }
  .to-panel.hide { display: none; }
  .to-panel { display: block; position: fixed; right: 14px; bottom: 16px; z-index: 40; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 999px; text-decoration: none; font-weight: 700; box-shadow: 0 6px 18px rgba(0, 0, 0, .25); }
  .cols2 { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  :root { --top: 52px; }
  .topbar { gap: 10px; padding: 0 10px; }
  .brand-txt { display: none; }
  .mainnav a { padding: 6px 8px; font-size: .85rem; }
  .userbox .me { display: none; }
  .hide-sm { display: none; }
  .dossier { padding: 14px 12px 30px; }
  .fgrid { grid-template-columns: 1fr; }
  .scale div { grid-template-columns: 40px 1fr; } .scale div span:last-child { grid-column: 1 / -1; }
}
@media print { .topbar, .foot, .actions { display: none; } body { background: #fff; } }
