:root { --navy:#1F3355; --bg:#f4f5f7; --line:#e3e6ea; --muted:#6b7280; --text:#1a202c;
        --red:#c0392b; --amber:#b7791f; --green:#2f855a; --blue:#2b6cb0; --ctl:38px; }
* { box-sizing:border-box }
[hidden] { display:none !important }      /* the button/.btn display rules below must not undo hidden */
html, body { margin:0; height:100% }
body { font:15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background:var(--bg); color:var(--text) }
a { color:var(--blue); text-decoration:none } a:hover { text-decoration:underline }

/* header: title left, badges centred on the title's baseline, name box right — one 56px row */
header { background:var(--navy); color:#fff; height:56px; padding:0 20px; display:flex; align-items:center; gap:14px; position:sticky; top:0; z-index:5 }
header h1 { font-size:18px; margin:0; font-weight:600; letter-spacing:.2px; white-space:nowrap }
header h1 a { color:#fff }
header .badges { display:flex; align-items:center; gap:8px }
.badge { display:inline-flex; align-items:center; height:24px; font-size:12px; padding:0 10px; border-radius:999px; background:rgba(255,255,255,.16); line-height:1; white-space:nowrap }
.badge.rw { background:#2f855a } .badge.ro { background:#b7791f }
header .who { display:flex; align-items:center; gap:8px; margin-left:auto; font-size:13px; white-space:nowrap }
header .who input { font:inherit; height:32px; width:11em; padding:0 10px; border:1px solid rgba(255,255,255,.35); border-radius:6px; background:rgba(255,255,255,.12); color:#fff }
header .who input::placeholder { color:rgba(255,255,255,.6) }

/* page */
.wrap { max-width:1280px; margin:0 auto; padding:18px 20px 60px }
.bar { display:flex; align-items:center; gap:12px; flex-wrap:wrap; margin-bottom:14px; min-height:var(--ctl) }
.bar .grow { flex:1 }
.bar h2 { font-size:20px; margin:0; font-weight:600 }
.crumbs { color:var(--muted); font-size:13px; margin-bottom:6px }
.hint { color:var(--muted); font-size:13px }

button, .btn { font:inherit; font-size:14px; height:var(--ctl); padding:0 16px; border:1px solid #cbd2d9; background:#fff; border-radius:8px; cursor:pointer; color:var(--text); display:inline-flex; align-items:center; gap:6px; white-space:nowrap }
button:hover, .btn:hover { border-color:#a0aab5 }
button.primary { background:var(--navy); color:#fff; border-color:var(--navy) } button.primary:hover { background:#27406b }
button.good { background:var(--green); color:#fff; border-color:var(--green) }
button.quiet { border-color:transparent; background:transparent; color:var(--blue); padding:0 8px }
button.danger { color:var(--red) }
button:disabled { opacity:.5; cursor:default }
button.sm { height:30px; padding:0 10px; font-size:13px }
.btn.back { height:32px; padding:0 12px 0 10px; font-size:13.5px; color:var(--text); margin-right:4px } .btn.back:hover { background:#f8fafc; text-decoration:none }

/* cards + table */
.card { background:#fff; border:1px solid var(--line); border-radius:12px; overflow:hidden }
table { border-collapse:separate; border-spacing:0; width:100%; table-layout:fixed }
th { text-align:left; font-size:11.5px; text-transform:uppercase; letter-spacing:.05em; color:var(--muted); background:#fafbfc; padding:10px 12px; border-bottom:1px solid var(--line); white-space:nowrap }
td { padding:11px 12px; border-bottom:1px solid var(--line); vertical-align:top; overflow-wrap:anywhere }
tr:last-child td { border-bottom:0 }
tr.link:hover td { background:#f8fafc; cursor:pointer }
.sub { color:var(--muted); font-size:12.5px; margin-top:2px }
.num { font-variant-numeric:tabular-nums }
td.rownum { color:var(--muted); font-weight:600; text-align:right; padding-right:6px }
.empty { padding:48px 20px; text-align:center; color:var(--muted) }

/* status pills */
.pill { display:inline-flex; align-items:center; height:24px; padding:0 10px; border-radius:999px; font-size:12.5px; font-weight:500; white-space:nowrap; background:#edf2f7; color:#2d3748 }
.pill.uploaded { background:#edf2f7; color:#2d3748 }
.pill.working { background:#ebf8ff; color:#2b6cb0 }
.pill.working::before { content:''; width:9px; height:9px; border:2px solid #90cdf4; border-top-color:#2b6cb0; border-radius:50%; margin-right:6px; animation:spin .9s linear infinite }
.pill.ready { background:#fffaf0; color:#975a16 }
.pill.done { background:#f0fff4; color:#276749 }
@keyframes spin { to { transform:rotate(360deg) } }

/* notes + feedback cells */
ol.notes { margin:0; padding-left:1.4em; line-height:1.45 }
ol.notes li { margin:0 0 6px; padding-left:2px }
ol.notes li:first-child { font-weight:600 }
ol.notes li::marker { color:var(--muted); font-weight:600 }
td .wonum { font-weight:600; margin-top:4px }

/* actions dropdown */
.menu { position:relative; display:inline-block }
.menu-btn .caret { display:inline-block; width:7px; height:7px; border:solid var(--muted); border-width:0 1.5px 1.5px 0; transform:rotate(45deg); margin:-4px 2px 0 3px }
.menu-items { display:none; position:fixed; min-width:170px; background:#fff; border:1px solid var(--line); border-radius:10px; box-shadow:0 10px 28px rgba(15,23,42,.14); padding:5px; z-index:10 }
.menu.open .menu-items { display:block; z-index:50 }
.menu-items a, .menu-items button { display:block; width:100%; height:auto; text-align:left; border:0; background:none; padding:9px 12px; font:inherit; font-size:14px; border-radius:7px; color:var(--text); cursor:pointer; white-space:nowrap }
.menu-items a:hover, .menu-items button:hover:not(:disabled) { background:#f1f5f9; text-decoration:none }
.menu-items button.danger { color:var(--red) }
.menu-items button:disabled { color:#a0aab5; cursor:default }
textarea.fb { font:inherit; width:100%; min-height:38px; padding:8px 10px; border:1px solid #d7dde4; border-radius:8px; resize:none; overflow:hidden; background:#fff; display:block; line-height:1.4 }
textarea.fb:focus { outline:2px solid #90cdf4; border-color:#90cdf4 }
textarea.fb.saved { border-color:var(--green) }

/* upload dialog */
dialog { border:0; border-radius:14px; padding:0; width:min(560px, 94vw); box-shadow:0 20px 60px rgba(0,0,0,.25) }
dialog::backdrop { background:rgba(15,23,42,.45) }
dialog form { padding:22px 24px }
dialog h3 { margin:0 0 14px; font-size:18px }
.drop { border:2px dashed #cbd2d9; border-radius:12px; padding:26px 16px; text-align:center; color:var(--muted); background:#fafbfc; cursor:pointer }
.drop.over { border-color:var(--blue); background:#ebf8ff; color:var(--blue) }
.drop strong { color:var(--text) }
.files { margin:10px 0 0; padding:0; list-style:none; font-size:13.5px }
.files li { display:flex; justify-content:space-between; padding:6px 0; border-bottom:1px solid var(--line) }
.files li:last-child { border-bottom:0 }
label.f { display:block; margin-top:14px; font-size:13px; color:var(--muted) }
label.f input, label.f textarea { display:block; width:100%; font:inherit; font-size:15px; color:var(--text); margin-top:5px; padding:9px 10px; border:1px solid #d7dde4; border-radius:8px; background:#fff }
label.f textarea { min-height:64px; resize:vertical }
.dlg-actions { display:flex; justify-content:flex-end; gap:10px; margin-top:18px }
.picks { max-height:50vh; overflow:auto; border:1px solid var(--line); border-radius:10px }
.pick { display:flex; gap:10px; align-items:flex-start; padding:9px 12px; border-bottom:1px solid var(--line); cursor:pointer }
.pick:last-child { border-bottom:0 } .pick:hover { background:#f8fafc }
.pick input { margin-top:4px } .pick .sub { display:block }

/* login */
form.login { max-width:340px; margin:14vh auto; background:#fff; padding:30px 32px; border-radius:14px; box-shadow:0 6px 30px rgba(0,0,0,.08); text-align:center }
form.login h2 { margin:0 0 4px } form.login .sub { color:var(--muted); margin-bottom:16px }
form.login input { font-size:24px; letter-spacing:.35em; text-align:center; width:8em; padding:8px; border:1px solid #cbd2d9; border-radius:8px }
form.login button { margin-top:14px } form.login .bad { color:var(--red); margin-top:10px }

.toast { position:fixed; bottom:18px; left:50%; transform:translateX(-50%); background:#1a202c; color:#fff; padding:10px 16px; border-radius:8px; font-size:13.5px; opacity:0; transition:opacity .2s; pointer-events:none; max-width:90vw; z-index:20 }
.toast.show { opacity:1 } .toast.bad { background:#9b2c2c }

/* sheet view */
.split { display:grid; grid-template-columns:minmax(300px, 1fr) minmax(320px, 1fr); gap:18px; align-items:start }
.scan img { width:100%; border:1px solid var(--line); border-radius:8px; background:#fff; margin-bottom:10px }
.wo { padding:16px 18px }
.wo h4 { margin:0 0 6px; font-size:15px }
.wo pre { font:13.5px/1.45 ui-monospace, Consolas, monospace; white-space:pre-wrap; background:#fafbfc; border:1px solid var(--line); border-radius:8px; padding:10px 12px; margin:8px 0 }
details { margin-top:10px } summary { cursor:pointer; color:var(--muted); font-size:13px }
details pre { font:12px/1.4 ui-monospace, Consolas, monospace; white-space:pre-wrap; color:#4a5568 }
@media (max-width:820px) { .split { grid-template-columns:1fr } header { padding:0 12px } header .who span { display:none } .wrap { padding:12px } }
