/* Sign-offs tab. Colours come from index.html's :root variables only, so
   light/dark already works. Scoped under #signoff, plus .so-overlay for the
   Staff panel's sheets (they sit on <body>). */
#signoff { flex: 1; min-height: 0; overflow: auto; }
#signoff h2 { margin: 0 0 6px; font-size: 18px; }
#signoff h3 { margin: 0 0 10px; font-size: 15px; }
#signoff .so-muted, .so-overlay .so-muted { color: var(--muted); }
#signoff .so-small, .so-overlay .so-small { font-size: 12px; }
#signoff .so-bad, .so-overlay .so-bad { color: var(--n-fg); }
#signoff .so-ok { color: var(--y-fg); font-weight: 600; }
#signoff .so-warn, .so-overlay .so-warn { color: var(--n-fg); font-size: 12px; margin-top: 3px; }
#signoff td.so-warn { font-size: inherit; margin: 0; }
#signoff .btn:disabled, .so-overlay .btn:disabled { opacity: 0.5; cursor: default; }
#signoff .so-row, .so-overlay .so-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 14px; }
.so-banner { background: var(--hl); color: var(--ink); border: 1px solid var(--orange); border-radius: 6px; padding: 6px 12px; margin-bottom: 10px; font-size: 13px; font-weight: 600; }

/* Load + reading */
.so-load, .so-reading { max-width: 760px; margin: 10px auto; background: var(--paper); border: 1px solid var(--rule); border-radius: 12px; padding: 22px; }
.so-drop { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 34px 16px; margin: 14px 0 8px;
  border: 2px dashed var(--rule-mid); border-radius: 10px; cursor: pointer; text-align: center; }
.so-drop:hover, .so-drop.over { border-color: var(--orange); background: var(--hl); }
.so-drop.off { opacity: 0.5; cursor: default; }
.so-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.so-drop span { color: var(--muted); font-size: 13px; }
.so-bar { height: 8px; background: var(--track); border-radius: 4px; overflow: hidden; margin: 8px 0 14px; }
.so-bar span { display: block; height: 100%; background: var(--orange); transition: width 0.2s; }
.so-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.so-thumbs figure { margin: 0; }
.so-thumbs img { width: 100%; border: 1px solid var(--rule); border-radius: 4px; display: block; }
.so-thumbs figcaption { font-size: 11px; text-align: center; color: var(--muted); }

/* Assign: list | pages | form */
.so-assign { display: grid; grid-template-columns: 230px minmax(0, 1fr) 300px; gap: 14px; min-height: 100%; align-items: start; }
.so-list, .so-form { background: var(--paper); border: 1px solid var(--rule); border-radius: 12px; position: sticky; top: 0; }
.so-list { display: flex; flex-direction: column; max-height: calc(100vh - 220px); }
.so-listhead { padding: 10px 12px; border-bottom: 1px solid var(--rule); display: flex; flex-direction: column; font-size: 13px; overflow-wrap: anywhere; }
.so-list ol { list-style: none; margin: 0; padding: 4px 0; overflow: auto; flex: 1; }
.so-list li { display: flex; gap: 8px; align-items: baseline; padding: 5px 12px; cursor: pointer; font-size: 13px; border-left: 3px solid transparent; }
.so-list li:hover { background: var(--row-hover); }
.so-list li.cur { background: var(--hl); border-left-color: var(--orange); }
.so-list li .n { color: var(--muted); font-size: 11px; width: 20px; text-align: right; flex: none; }
.so-list li .t { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.so-list li .p { color: var(--muted); font-size: 11px; flex: none; }
.so-list li.todo .t b { color: var(--n-fg); }
.so-list li.done .t b { color: var(--y-fg); }
.so-list li.skip .t { color: var(--muted); text-decoration: line-through; }
.so-listfoot { padding: 10px 12px; border-top: 1px solid var(--rule); display: flex; flex-direction: column; gap: 6px; }

.so-pages { display: flex; flex-direction: column; gap: 14px; }
.so-pages figure { margin: 0; background: var(--paper); border: 1px solid var(--rule); border-radius: 8px; padding: 8px; position: relative; }
.so-pages img { width: 100%; display: block; cursor: zoom-in; }
.so-pages figcaption { font-size: 12px; color: var(--muted); margin-top: 4px; }
.so-split { position: absolute; top: 12px; left: 12px; z-index: 1; }
.so-assign.zoomed { grid-template-columns: 230px minmax(0, 1fr) 300px; }
.so-assign.zoomed .so-pages { overflow-x: auto; }
.so-assign.zoomed .so-pages img { width: 200%; max-width: none; cursor: zoom-out; }

.so-form { padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.so-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.so-form input:not([type=checkbox]):not([type=radio]), .so-form select {
  font: inherit; font-size: 14px; color: var(--ink); background: var(--paper); border: 1px solid var(--rule); border-radius: 6px; padding: 7px 9px; width: 100%; }
.so-form input:focus, .so-form select:focus { outline: 2px solid var(--orange); outline-offset: -1px; }
.so-form label.so-check { flex-direction: row; align-items: center; gap: 6px; margin-top: -4px; }
.so-levels { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.so-levels legend { font-size: 12px; color: var(--muted); padding: 0; margin-bottom: 4px; }
.so-levels label { border: 1px solid var(--rule); border-radius: 8px; padding: 6px; text-align: center; cursor: pointer; gap: 0; }
.so-levels label:has(input:checked) { border-color: var(--orange); background: var(--hl); }
.so-levels input { position: absolute; opacity: 0; pointer-events: none; }
.so-levels b { color: var(--ink); font-size: 13px; }
.so-levels small { font-size: 10px; }
.so-form .so-row { margin-top: 4px; }
.so-form .so-row .btn[type=submit] { flex: 1; }
.so-skip { align-self: flex-start; }

/* Review + results */
.so-review { max-width: 1100px; margin: 0 auto; }
.so-table { width: 100%; border-collapse: collapse; background: var(--paper); border: 1px solid var(--rule); border-radius: 8px; font-size: 13px; margin-top: 10px; }
.so-table th, .so-table td { border: 0; border-bottom: 1px solid var(--rule); padding: 8px 10px; text-align: left; vertical-align: top; background: transparent; }
.so-table th { font-size: 12px; color: var(--muted); font-weight: 600; }
.so-table tr.off td { color: var(--muted); }
.so-table tr.same td { color: var(--muted); }
#signoff .so-folder { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 14px 0 0; padding: 10px 12px;
  background: var(--paper); border: 1px solid var(--rule); border-radius: 8px; font-size: 13px; }
#signoff .so-folder .btn { padding: 4px 10px; }
#signoff .so-folder .so-warn { flex-basis: 100%; margin: 0; }
#signoff .so-marks { white-space: nowrap; }
#signoff .so-marks .so-ok { font-weight: 600; }

@media (max-width: 900px) {
  .so-assign, .so-assign.zoomed { grid-template-columns: 1fr; }
  .so-list, .so-form { position: static; }
  .so-list { max-height: 220px; }
  .so-form { order: -1; }
  .so-table { font-size: 12px; }
  .so-table th:last-child, .so-table td:last-child { display: none; }
}

/* Staff panel + Add staff form (staff-panel.js) */
#signoff .so-top { display: flex; justify-content: flex-end; margin-bottom: 8px; }
.so-inline { display: flex; gap: 6px; }
.so-inline input { flex: 1; min-width: 0; }
.so-inline .btn { flex: none; white-space: nowrap; padding: 6px 10px; }
.so-overlay { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,0.45); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 16px; overflow: auto; }
.so-sheet { background: var(--paper); color: var(--ink); border: 1px solid var(--rule); border-radius: 12px; width: 640px; max-width: 100%; padding: 16px 18px 18px; box-shadow: 0 10px 40px rgba(0,0,0,0.3); }
.so-sheet.so-addstaff { width: 520px; }
.so-sheethead { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.so-sheethead h2 { margin: 0; flex: 1; font-size: 18px; }
.so-x { border: 0; background: transparent; color: var(--muted); font-size: 26px; line-height: 1; cursor: pointer; padding: 0 4px; }
.so-staffbar { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin-bottom: 8px; }
.so-staffbar input[type=search] { font: inherit; font-size: 14px; padding: 6px 9px; border: 1px solid var(--rule); border-radius: 6px; background: var(--paper); color: var(--ink); flex: 1; min-width: 160px; }
.so-staffbar .so-check { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; }
.so-stafflist { list-style: none; margin: 0; padding: 0; border: 1px solid var(--rule); border-radius: 8px; max-height: 60vh; overflow: auto; }
.so-stafflist li { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-bottom: 1px solid var(--rule); }
.so-stafflist li:last-child { border-bottom: 0; }
.so-stafflist li.off .nm b { color: var(--muted); }
.so-stafflist .nm { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.so-stafflist .nm small { font-size: 11px; color: var(--muted); }
.so-stafflist .nm small.so-bad { color: var(--n-fg); }
.so-switch { flex: none; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--rule); background: var(--paper); color: var(--ink);
  border-radius: 999px; padding: 3px 10px 3px 4px; font: inherit; font-size: 12px; cursor: pointer; min-width: 92px; }
.so-switch span { width: 26px; height: 16px; border-radius: 8px; background: var(--track); position: relative; transition: background 0.15s; }
.so-switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--paper); box-shadow: 0 1px 2px rgba(0,0,0,0.3); transition: left 0.15s; }
.so-switch[aria-checked="true"] span { background: var(--y-fg); }
.so-switch[aria-checked="true"] span::after { left: 12px; }
.so-switch:disabled { opacity: 0.5; cursor: progress; }
.so-addform .so-two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.so-addform label small { font-size: 11px; }
.so-addform select[multiple] { padding: 4px; }
.so-dupes { border: 1px solid var(--orange); background: var(--hl); border-radius: 8px; padding: 8px 10px; }
.so-dupes .so-warn { margin: 0 0 6px; font-size: 13px; }
@media (max-width: 520px) { .so-addform .so-two { grid-template-columns: 1fr; } }
