* { box-sizing: border-box; }
[hidden] { display: none !important; }   /* beat explicit display:flex/grid rules below */
html, body { height: 100%; margin: 0; }
body { font: 14px/1.45 system-ui, "Segoe UI", Roboto, sans-serif; color: #1c2530;
       background: #eef1f4; display: flex; flex-direction: column; }
h1, h2 { margin: 0; }
button { font: inherit; }

/* ================= LANDING ================= */
#view-landing { flex: 1; overflow: auto; }
.land { max-width: 900px; margin: 0 auto; padding: 40px 24px 60px; }
.landhead { display: flex; gap: 18px; align-items: center; margin-bottom: 34px; }
.logo { width: 64px; height: 64px; border-radius: 14px; background: #1f2d3d; color: #fff;
        display: grid; place-items: center; font-weight: 800; letter-spacing: 1px; font-size: 20px; }
.land h1 { font-size: 26px; }
.sub { color: #5a6675; margin: 4px 0 0; }
.step { background: #fff; border: 1px solid #dde3e9; border-radius: 12px; padding: 22px 24px; margin-bottom: 20px; }
.step h2 { font-size: 17px; display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.step .num { width: 26px; height: 26px; border-radius: 50%; background: #3d8bfd; color: #fff;
             display: grid; place-items: center; font-size: 14px; }
.rolecards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.rolecard { text-align: left; border: 2px solid #dde3e9; background: #fbfcfe; border-radius: 12px;
            padding: 20px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; transition: .12s; }
.rolecard:hover { border-color: #3d8bfd; box-shadow: 0 4px 14px rgba(61,139,253,.15); transform: translateY(-1px); }
.rolecard.sel { border-color: #3d8bfd; background: #eef5ff; }
.rolecard .ic { width: 40px; height: 40px; border-radius: 10px; background: #e6eefc; color: #3d8bfd;
                display: grid; place-items: center; font-size: 20px; margin-bottom: 6px; }
.rolecard b { font-size: 16px; }
.rolecard span { color: #5a6675; font-size: 13px; }

.projcards { display: flex; flex-direction: column; gap: 22px; }
.lanegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.lane .laneh { display: flex; align-items: baseline; gap: 9px; margin-bottom: 10px;
               border-bottom: 2px solid #e7ecf1; padding-bottom: 6px; }
.lane .lanet { font-weight: 700; font-size: 15px; }
.lane .lanec { font-size: 12px; font-weight: 700; color: #5a6675; background: #eef1f4;
               border-radius: 10px; padding: 1px 9px; }
.lane .lanesub { font-size: 12px; color: #8a94a1; }
.lane .lane-empty { color: #aab2bc; font-style: italic; margin: 2px 0 0; }
.pcard { border: 1px solid #dde3e9; border-radius: 10px; padding: 16px; background: #fbfcfe; display: flex;
         flex-direction: column; gap: 8px; }
.pcard .pn { font-weight: 700; }
.pcard .pmeta { font-size: 12px; color: #6a7583; }
.pcard .pbar2 { height: 7px; background: #e4e9ee; border-radius: 4px; overflow: hidden; display: flex; }
.pcard .pbar2 i { display: block; height: 100%; }
.pcard .pbar2 .a { background: #f0ad00; } .pcard .pbar2 .v { background: #2fa25a; }
.pcard .row { display: flex; justify-content: space-between; align-items: center; }
.pcard .st { font-size: 11px; text-transform: uppercase; letter-spacing: .4px; padding: 2px 7px;
             border-radius: 9px; background: #eef1f4; color: #5a6675; }
.pcard button { background: #3d8bfd; color: #fff; border: 0; padding: 7px; border-radius: 6px; cursor: pointer; font-weight: 600; }

.uploadbox { margin-top: 18px; border: 1px dashed #c3ccd5; border-radius: 10px; padding: 4px 16px; background: #fafbfc; }
.uploadbox summary { cursor: pointer; padding: 12px 0; font-weight: 600; color: #3d5a80; }
#uploadform { display: grid; gap: 12px; padding: 6px 0 16px; max-width: 420px; }
#uploadform label { display: grid; gap: 4px; font-size: 13px; color: #37424f; }
#uploadform input, #uploadform select { padding: 7px 8px; border: 1px solid #cfd6dd; border-radius: 6px; font: inherit; }

/* ================= WORKSPACE BAR ================= */
header#bar { display: flex; align-items: center; gap: 12px; padding: 8px 14px; background: #1f2d3d;
             color: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.3); z-index: 5; }
#home { background: #35485c; color: #cdd7e2; border: 0; padding: 6px 12px; border-radius: 5px; cursor: pointer; }
.wname { font-weight: 700; max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rolebadge { font-size: 12px; background: #3d8bfd; padding: 3px 10px; border-radius: 10px; font-weight: 600; }
.rolebadge.reviewer { background: #2fa25a; }
.spacer { flex: 1; }
.pstatus { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; padding: 3px 8px; border-radius: 10px; background: #35485c; }
.pstatus.in_annotation { background: #6c5a1f; } .pstatus.submitted { background: #1f5a6c; } .pstatus.verified { background: #1f6c3a; }
.saved { font-size: 12px; color: #9fb0c2; min-width: 120px; text-align: right; transition: .2s; }
.saved.saving { color: #ffd76a; } .saved.ok { color: #7fe0a3; }
.primary { background: #3d8bfd; color: #fff; border: 0; padding: 7px 14px; border-radius: 5px; cursor: pointer; font-weight: 600; }
.primary:disabled { background: #55606c; cursor: not-allowed; opacity: .7; }

/* ================= WORKSPACE GRID ================= */
main#view-work { flex: 1; display: grid; grid-template-columns: 190px 1fr 6px var(--revw, 620px); min-height: 0; }
#tasks, #viewer, #review { min-height: 0; }
#splitter { background: #cdd5dd; cursor: col-resize; }
#splitter:hover, #splitter.dragging { background: #3d8bfd; }
#tasks { background: #f7f9fb; border-right: 1px solid #d5dbe1; overflow: auto; }
#review { background: #fff; border-left: 1px solid #d5dbe1; display: flex; flex-direction: column; }
.asidehead { position: sticky; top: 0; background: #e7ecf1; padding: 8px 12px; font-weight: 700; font-size: 12px;
             text-transform: uppercase; letter-spacing: .5px; border-bottom: 1px solid #d5dbe1;
             display: flex; justify-content: space-between; align-items: center; z-index: 2; }
.asidehead .hint, .count { font-weight: 500; color: #6a7583; text-transform: none; letter-spacing: 0; }

/* task list */
.task { padding: 8px 10px; border-bottom: 1px solid #e6eaee; cursor: pointer; display: flex; align-items: center; gap: 8px; }
.task:hover { background: #eef4ff; }
.task.active { background: #dceaff; border-left: 3px solid #3d8bfd; padding-left: 7px; }
.task .pg { font-weight: 700; min-width: 40px; }
.task .dot { width: 9px; height: 9px; border-radius: 50%; background: #cfd6dd; }
.task .dot.ann { background: #f0ad00; } .task .dot.rev { background: #2fa25a; }

/* viewer */
#viewer { display: flex; flex-direction: column; background: #55606c; overflow: hidden; }
.vtoolbar { display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: #45505c; color: #dfe4ea; font-size: 12px; }
.vtoolbar button { background: #5c6875; color: #fff; border: 0; height: 26px; min-width: 28px; border-radius: 4px; cursor: pointer; }
.vtoolbar #zoom-fit { padding: 0 10px; }
.vhint { opacity: .6; margin-left: auto; }
#scanwrap { flex: 1; overflow: auto; cursor: grab; }
#scanwrap.grabbing { cursor: grabbing; }
#scan { transform-origin: 0 0; display: block; user-select: none; -webkit-user-drag: none; }

/* ================= page panel ================= */
#tablewrap { flex: 1; overflow: auto; }

/* task list: numbered vs reference-only pages */
.task.ref { opacity: .72; }
.task .tag { font-size: 9px; background: #d5dbe1; color: #55606c; border-radius: 3px; padding: 1px 4px; margin-left: auto; }
.task.ref .pg { color: #8a94a1; font-weight: 600; }

/* review tools bar */
#reviewtools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 7px 10px;
               background: #f2f5f8; border-bottom: 1px solid #e2e7ec; font-size: 12px; }
#reviewtools button { border: 0; border-radius: 5px; padding: 5px 10px; cursor: pointer; font-size: 12px; font-weight: 600; }
.btn-live { background: #6f42c1; color: #fff; } .btn-live:disabled { opacity: .6; cursor: default; }
.btn-ghost { background: #e2e7ec; color: #37424f; }
#reviewtools input, #reviewtools select { padding: 4px 6px; border: 1px solid #cfd6dd; border-radius: 5px; font: inherit; }
.reftext { padding: 30px 22px; color: #6a7583; text-align: center; }
.reftext b { color: #37424f; }

/* ===== digitisation (editable tables) ===== */
.dg-legend { display: flex; gap: 16px; align-items: center; padding: 7px 10px; font-size: 12px;
             background: #f2f5f8; border-bottom: 1px solid #e2e7ec; flex-wrap: wrap; }
.dg-legend .lg { display: inline-flex; align-items: center; gap: 5px; color: #55606c; }
.dg-legend .sw { width: 13px; height: 13px; border-radius: 3px; display: inline-block; }
.sw.ai { background: #ffe0b2; border: 1px solid #f0ad4e; } .sw.correct { background: #d7f5df; }
.sw.edited { background: #fff3cd; } .sw.added { background: #e57373; }
.sw.deleted { background: #d6dbe0; }
.dgblock { margin: 10px 6px 14px; }
.dgtitle { font-size: 12px; font-weight: 700; color: #2c3e50; margin: 6px 2px; display: flex; gap: 6px; align-items: center; }
.dgtitle .acts { margin-left: auto; display: flex; gap: 5px; }
.dgtitle button { border: 0; border-radius: 5px; padding: 3px 9px; cursor: pointer; font-size: 11px; font-weight: 600; }
.dg-add { background: #e2e7ec; color: #2c3e50; }
table.dg { border-collapse: collapse; width: 100%; font-size: 12.5px; }
table.dg td { border: 1px solid #d5dbe1; padding: 0; vertical-align: top; }
table.dg td.rowact { width: 20px; background: #eef1f4; text-align: center; padding: 0; }
.rowdel { border: 0; background: transparent; color: #c0392b; cursor: pointer; font-size: 12px; line-height: 1; padding: 4px 2px; }
.rowdel:hover { color: #922b21; }
.dgcell { position: relative; }
/* Cells are multi-line now: a long sentence wraps and is readable in place instead of being clipped in
   a one-line box that only the double-click card could show. Height is set from the content in JS and
   capped, so one 20k-character cell cannot make a row hundreds of lines tall. */
.dgcell textarea, .dgtextrow textarea { display: block; resize: none; overflow-y: hidden;
        line-height: 1.35; min-height: 1.35em; white-space: pre-wrap; word-break: break-word; }
.dgcell :is(input, textarea) { width: 100%; border: 0; background: transparent; padding: 5px 36px 5px 6px; font: inherit; }
.dgcell :is(input, textarea):focus { outline: 2px solid #3d8bfd; outline-offset: -2px; background: #fff; }
.dgcell :is(input, textarea):disabled { color: #9aa3ad; text-decoration: line-through; }
.dgcell.ai { background: #ffe8cc; }   /* unreviewed AI cell = to rectify */
.dgcell.correct { background: #d7f5df; } .dgcell.edited { background: #fff3cd; } .dgcell.added { background: #e57373; }
.dgcell.deleted { background: #d6dbe0; }
.dgdel { position: absolute; top: 3px; width: 15px; height: 15px; border: 1px solid #b7c0ca;
        border-radius: 3px; background: #fff; cursor: pointer; font-size: 10px; line-height: 13px;
        text-align: center; padding: 0; right: 2px; color: #c0392b; }
.dgcell.deleted .dgdel { background: #7a828b; color: #fff; border-color: #7a828b; }
.dgtextrow { margin: 6px 2px; position: relative; }
.dgtextrow :is(input, textarea) { width: 100%; border: 1px dashed #dbe1e7; border-radius: 4px; padding: 5px 36px 5px 7px; font: inherit; }
.dgtextrow.deleted :is(input, textarea), .dgcell.deleted :is(input, textarea) { text-decoration: line-through; color: #8a94a1; }
.dg-start { margin: 26px auto; display: block; padding: 11px 18px; background: #6f42c1; color: #fff;
            border: 0; border-radius: 7px; cursor: pointer; font-weight: 600; font-size: 14px; }
.dg-note { text-align: center; color: #6a7583; font-size: 13px; margin-top: 8px; }
.dg-bgind { font-size: 12px; color: #5b45a8; margin-left: 4px; }
.dg-bgind.paused { color: #b23b37; font-weight: 600; }
.task .dg-prog { font-size: 11px; color: #6a7583; flex: 1; }
.task .dg-prog.done { color: #1f7a43; font-weight: 600; }

/* overlay + toast */
#overlay { position: fixed; inset: 0; background: rgba(20,28,38,.55); display: grid; place-items: center; z-index: 30; }
.ovbox { background: #fff; border-radius: 12px; padding: 26px 30px; width: 360px; text-align: center; box-shadow: 0 12px 40px rgba(0,0,0,.3); }
#ovtitle { font-weight: 700; margin-top: 8px; } .ovmsg { color: #6a7583; font-size: 13px; margin: 6px 0 14px; min-height: 18px; }
.pbar { height: 8px; background: #e4e9ee; border-radius: 5px; overflow: hidden; }
.pbar i { display: block; height: 100%; width: 0; background: #3d8bfd; transition: width .15s; }
.spinner { width: 34px; height: 34px; border: 4px solid #dbe3ec; border-top-color: #3d8bfd; border-radius: 50%;
           margin: 0 auto; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%) translateY(20px); background: #1c2530;
         color: #fff; padding: 9px 16px; border-radius: 6px; font-size: 13px; opacity: 0; pointer-events: none; transition: .2s; z-index: 40; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); } .toast.err { background: #b23b37; }

/* approval lock + whole-table delete */
.primary.warn { background: #d98a00; }
.dg-lock { font-size: 12px; color: #6c5a1f; background: #fff6d6; border: 1px solid #ecd58a; border-radius: 5px; padding: 4px 9px; }
#tablewrap.locked .dgcell:not(.deleted) :is(input, textarea):disabled { text-decoration: none; color: #1c2530; background: transparent; }
#tablewrap.locked .dgcell :is(input, textarea) { padding-right: 6px; }
.dgblock.deleted table.dg { opacity: .55; }
.dgblock.deleted .dgtitle { color: #7a828b; }
.dg-deltable { background: #f3d4d1; color: #922b21; }
.dg-deltable:hover { background: #e8b4af; }

/* auth + team + assignment */
.authgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.authform { display: grid; gap: 10px; padding: 16px; border: 1px solid #dde3e9; border-radius: 10px; background: #fbfcfe; }
.authform.setup { grid-column: 1 / -1; border-color: #3d8bfd; background: #eef5ff; }
.authform label { display: grid; gap: 4px; font-size: 13px; color: #37424f; }
.authform input { padding: 7px 8px; border: 1px solid #cfd6dd; border-radius: 6px; font: inherit; }
.authform .btn-ghost { padding: 7px 12px; border: 0; border-radius: 6px; cursor: pointer; font-weight: 600; }
.userchip { font-size: 12px; background: #35485c; color: #dfe4ea; padding: 3px 9px; border-radius: 10px; margin-left: auto; font-weight: 500; }
.step h2 .userchip { background: #e7ecf1; color: #37424f; }
.btn-ghost.small { padding: 3px 9px; font-size: 12px; border: 0; border-radius: 5px; cursor: pointer; background: #e2e7ec; color: #37424f; margin-left: 8px; }
.btn-ghost.small.danger { background: #f3d4d1; color: #922b21; }
.btn-ghost.small.danger:hover { background: #e8b4af; }
header#bar .btn-ghost.small { background: #35485c; color: #cdd7e2; }
.wassign { font-size: 12px; color: #9fb0c2; }
.teamform { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 6px 0 10px; }
.teamform input { padding: 7px 8px; border: 1px solid #cfd6dd; border-radius: 6px; font: inherit; min-width: 260px; }
.teamlist { display: grid; gap: 6px; padding-bottom: 12px; }
.teamrow { display: flex; gap: 10px; align-items: center; padding: 6px 10px; background: #fff; border: 1px solid #e2e7ec; border-radius: 6px; font-size: 13px; }
.teamrow .hint { flex: 1; }
.teamrow .uname { flex: 1; display: flex; align-items: baseline; gap: 8px; }
.teamrow .uname .hint { flex: none; }
.roleselect { padding: 5px 8px; border: 1px solid #cfd6dd; border-radius: 6px; font: inherit; background: #fff; }
.jobno { color: #5a6675; font-weight: 700; }
.srck { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; padding: 1px 6px; border-radius: 8px; vertical-align: middle; }
.srck.digital { background: #e3f0fb; color: #1f5fa6; }
.srck.scanned { background: #f0ece3; color: #8a6d3b; }
.taskcard .pn { font-size: 15px; }
.pcard .cardacts { gap: 8px; flex-wrap: wrap; }
.pcard .cardacts button { padding: 6px 12px; }
.pcard .cardacts button.alt { background: #e2e7ec; color: #2c3e50; }
.assignctl { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; flex: 1; }
.assignctl select { padding: 4px 6px; border: 1px solid #cfd6dd; border-radius: 5px; font: inherit; font-size: 12px; max-width: 160px; }

/* simpler cards: one state line, one Open button; header mode switch; help box */
.pcard .state { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 9px; align-self: flex-start; }
.pcard .state.busy { background: #e8e2fb; color: #5b45a8; } .pcard .state.ready { background: #e6eefc; color: #2456a6; }
.pcard .state.work { background: #fdefda; color: #9a6400; } .pcard .state.review { background: #dff3f7; color: #1f5a6c; }
.pcard .state.done { background: #e3f6ea; color: #1f7a43; } .pcard .state.warn { background: #fde2e0; color: #b23b37; }
.pcard .cardacts { justify-content: space-between; }
.assignctl select:disabled { opacity: .55; cursor: not-allowed; }
.modeswitch { display: inline-flex; border: 1px solid #55606c; border-radius: 6px; overflow: hidden; }
.modeswitch button { border: 0; background: transparent; color: #cdd7e2; padding: 4px 10px; cursor: pointer; font-size: 12px; }
.modeswitch button.on { background: #3d8bfd; color: #fff; }
.helpbtn { width: 20px; height: 20px; border-radius: 50%; border: 1px solid #b7c0ca; background: #fff; color: #55606c; cursor: pointer; font-size: 12px; font-weight: 700; padding: 0; margin-left: 6px; }
.helpbox { margin: 8px 10px; padding: 10px 14px; background: #fff6d6; border: 1px solid #ecd58a; border-radius: 8px; font-size: 13px; }
.helpbox ul { margin: 6px 0 0; padding-left: 18px; } .helpbox li { margin: 3px 0; }
.helpbox code { background: #fff; padding: 0 4px; border-radius: 3px; }

.pcard .cardacts button.resume { background: #2fa25a; color: #fff; }
.pcard .cardacts button.pausebtn { background: #f4e2c4; color: #8a5a1b; }
.pcard .cardacts button.pausebtn:hover { background: #edd3a6; }

/* edit-PDF (trim) modal */
.modal { position: fixed; inset: 0; background: rgba(20,28,38,.55); display: flex; align-items: center;
         justify-content: center; z-index: 50; padding: 20px; }
.modalbox { background: #fff; border-radius: 12px; width: min(920px, 96vw); max-height: 92vh; display: flex;
            flex-direction: column; box-shadow: 0 18px 60px rgba(0,0,0,.35); overflow: hidden; }
.modalhead { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid #e7ecf1; font-size: 16px; }
.modalhead .spacer, .modalfoot .spacer { flex: 1; }
.editrow { display: flex; align-items: center; gap: 12px; padding: 10px 18px; flex-wrap: wrap; }
.editrow label { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.editrow input[type=text] { padding: 7px 9px; border: 1px solid #cfd6dd; border-radius: 6px; font: inherit; min-width: 280px; }
.editrow input.pnum { width: 70px; padding: 7px 8px; border: 1px solid #cfd6dd; border-radius: 6px; font: inherit; text-align: center; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px;
          padding: 12px 18px; overflow-y: auto; background: #f6f8fa; }
.thumb { border: 2px solid #2fa25a; border-radius: 8px; overflow: hidden; background: #fff; position: relative; }
.thumb img { display: block; width: 100%; height: auto; }
.thumb .tlabel { position: absolute; left: 0; bottom: 0; right: 0; font-size: 11px; font-weight: 700; text-align: center;
                 background: rgba(47,162,90,.9); color: #fff; padding: 2px; }
.thumb.removed { border-color: #d9808a; opacity: .45; }
.thumb.removed img { filter: grayscale(1); }
.thumb.removed .tlabel { background: rgba(146,43,33,.8); }
.modalfoot { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-top: 1px solid #e7ecf1; flex-wrap: wrap; }

/* floating draggable + resizable cell editor (no backdrop) */
.cellcard { position: fixed; z-index: 60; display: flex; flex-direction: column; background: #fff;
            border: 1px solid #cfd6dd; border-radius: 10px; box-shadow: 0 12px 40px rgba(0,0,0,.28);
            width: 380px; height: 240px; min-width: 240px; min-height: 150px; max-width: 92vw; max-height: 86vh;
            resize: both; overflow: hidden; }
.cellcard-hd { display: flex; align-items: center; gap: 8px; padding: 8px 10px; cursor: move; user-select: none;
               background: #f2f5f8; border-bottom: 1px solid #e7ecf1; border-radius: 10px 10px 0 0;
               font-weight: 700; font-size: 13px; }
.cellcard-title { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cellcard-x { border: 0; background: transparent; cursor: pointer; font-size: 15px; color: #5a6675; line-height: 1; }
.cellcard-ta { flex: 1; margin: 8px; padding: 8px; border: 1px solid #cfd6dd; border-radius: 6px; font: inherit; resize: none; }
.cellcard-acts { display: flex; gap: 8px; justify-content: flex-end; padding: 0 10px 10px; }

/* supervisor model re-digitise control */
.dg-model { display: inline-flex; align-items: center; gap: 6px; margin-left: 10px; padding-left: 10px;
            border-left: 1px solid #d7dee5; }
.dg-modellbl { font-size: 12px; color: #5a6675; }
.dg-modelsel, .dg-modelcustom, .dg-modelpages { padding: 4px 6px; border: 1px solid #cfd6dd; border-radius: 6px; font: inherit; font-size: 12px; }
.dg-modelcustom { width: 180px; }

.pcard .uploader { color: #8a94a1; font-size: 11.5px; }
.pcard .cardacts button.danger { background: #f3d4d1; color: #922b21; }
.pcard .cardacts button.danger:hover { background: #e8b4af; }

.peoplecol { padding: 6px 0 10px; } .peoplecol > b { display: block; margin: 6px 0; font-size: 13px; color: #37424f; }

.vrotate { display: inline-flex; align-items: center; gap: 3px; }
.vrotate .vrlabel { opacity: .7; margin: 0 2px 0 6px; }
.vrotate button { background: #5c6875; color: #fff; border: 0; height: 26px; min-width: 26px; border-radius: 4px; cursor: pointer; font-size: 14px; }
.vrotate button:hover { background: #6b7885; }

/* undo/redo + double-click expand card + column resize + repeated-header note */
#reviewtools #btnundo:disabled, #reviewtools #btnredo:disabled { opacity: .45; cursor: default; }
.dgcell { position: relative; }
.colresize { position: absolute; top: 0; right: -3px; width: 7px; height: 100%; cursor: col-resize; z-index: 3; }
.colresize:hover { background: rgba(61,139,253,.35); }
.dgdel { z-index: 4; }
table.dg col.colact { width: 24px; }
table.dg td.dgcell { overflow: hidden; }
.cardov { position: fixed; inset: 0; background: rgba(20,28,38,.5); display: grid; place-items: center; z-index: 60; }
.cardbox { background: #fff; border-radius: 10px; width: min(680px, 92vw); max-height: 82vh; padding: 16px 18px;
           box-shadow: 0 16px 48px rgba(0,0,0,.35); display: flex; flex-direction: column; gap: 10px; }
.cardhd { font-weight: 700; color: #2c3e50; }
.cardta { width: 100%; min-height: 180px; max-height: 55vh; resize: vertical; font: 14px/1.5 ui-monospace, monospace;
          border: 1px solid #cfd6dd; border-radius: 6px; padding: 10px; }
.cardacts2 { display: flex; gap: 8px; justify-content: flex-end; }
.cardacts2 button { padding: 7px 14px; border: 0; border-radius: 6px; cursor: pointer; font-weight: 600; }
.dg-headnote { margin: 8px 6px; padding: 6px 10px; background: #eef3f8; border: 1px solid #d5dbe1; border-radius: 6px;
               font-size: 12px; color: #55606c; }
.linklike { background: none; border: 0; color: #3d8bfd; cursor: pointer; font: inherit; text-decoration: underline; padding: 0; }

/* ---- 2026-09-03: fewer-clicks controls (resume bar, row confirm, jump chip, auto-next) ---- */
.resumebar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 14px; margin-bottom: 18px;
             background: #eef5ff; border: 1px solid #cfe0fb; border-radius: 10px; }
.resumebar button { background: #3d8bfd; color: #fff; border: 0; padding: 9px 16px; border-radius: 7px;
                    cursor: pointer; font-weight: 700; }
.resumebar button:hover { background: #2f7ae5; }
.rowok { border: 0; background: transparent; color: #2fa25a; cursor: pointer; font-size: 12px; line-height: 1;
         padding: 4px 2px; font-weight: 700; }
.rowok:hover { color: #1f7a43; }
table.dg td.rowact { width: 32px; }
.count.clickable { cursor: pointer; text-decoration: underline dotted; }
.count.clickable:hover { color: #2456a6; }
label.autonext { font-size: 12px; color: #55606c; display: inline-flex; align-items: center; gap: 4px;
                 padding: 2px 6px; background: #eef1f4; border-radius: 5px; cursor: pointer; }
label.autonext input { margin: 0; }
#primary.notready { background: #dfe5ec; color: #55606c; }
#primary.notready:hover { background: #d3dae3; }
#newacctform b { font-size: 13px; }
#newacctform input { min-width: 180px; }

/* ---- trim/render progress inside the edit-PDF modal (the step that used to look frozen) ---- */
.setupprog { padding: 10px 18px 0; }
.setupprog-row { display: flex; justify-content: space-between; align-items: baseline;
                 font-size: 13px; color: #2c3e50; margin-bottom: 6px; }
.setupprog-row #edit-progress-pct { font-variant-numeric: tabular-nums; color: #5a6675; font-size: 12px; }
.setupprog .pbar { height: 6px; }
.modalfoot button:disabled { opacity: .5; cursor: default; }

/* ---- how a page reads: the AI's version stands unless the annotator changes it ---- */
#tablewrap .dgcell.ai { background: #fbfcfe; }              /* untouched = calm; accepted on page review */
#tablewrap .dgcell.ai :is(input, textarea) { color: #1c2530; }
#tablewrap .dgcell.tmpl { background: #f4f6f8; }                       /* pre-printed form text */
#tablewrap .dgcell.tmpl :is(input, textarea) { color: #6a7583; font-style: italic; }
.dg-legend .sw.tmpl { background: #f4f6f8; border-color: #cdd5dd; }
/* a removed cell/row offers to put itself back — never the same ✕ meaning two different things */
.dgundo { position: absolute; top: 3px; right: 2px; width: 15px; height: 15px; border: 1px solid #9db7a8;
          background: #eaf5ee; color: #1f7a43; border-radius: 3px; cursor: pointer; font-size: 10px;
          line-height: 1; padding: 0; z-index: 4; }
.dgundo:hover { background: #d7ecdf; }
.rowundo { border: 0; background: transparent; color: #1f7a43; cursor: pointer; font-size: 12px;
           line-height: 1; padding: 4px 2px; font-weight: 700; }
.dgtextrow .dgundo { position: static; margin-left: 6px; }
.dg-pagerev { background: #2fa25a; color: #fff; font-weight: 700; padding: 7px 14px; border: 0;
              border-radius: 6px; cursor: pointer; }
.dg-pagerev:hover { background: #268a4c; }
.dg-pagerev.done { background: #7fb99a; }
#reviewtools .dg-pagerev { order: -1; }

/* the autosave indicator when a save actually FAILED — it used to sit on "Saving…" for ever */
.saved.failed { color: #b3261e; font-weight: 600; }

/* a page-level notice above the cells: empty AI answer, truncated output */
.dgnotice { margin: 8px 12px; padding: 10px 12px; border: 1px solid #d9a441; background: #fff8e6;
  border-radius: 6px; font-size: 13px; line-height: 1.4; }

/* an empty column position offered for the annotator to fill (no AI reading of its own) */
.dgcell.pad :is(input, textarea) { background: repeating-linear-gradient(45deg, transparent, transparent 5px,
  rgba(127,127,127,.07) 5px, rgba(127,127,127,.07) 10px); }

/* ---- drag to reorder: rows and whole tables ---------------------------------------------------- */
.rowdrag { border: 0; background: transparent; cursor: grab; color: #8a94a1; font-size: 12px;
           line-height: 1; padding: 0 2px; }
.rowdrag:hover { color: #3d8bfd; }
.rowdrag.off { cursor: not-allowed; opacity: .35; }          /* row is part of a merged cell */
.blockdrag { border: 0; background: transparent; cursor: grab; color: #8a94a1; font-size: 13px;
             padding: 0 6px 0 0; }
.blockdrag:hover { color: #3d8bfd; }
body.dragging { cursor: grabbing; user-select: none; }
body.dragging .rowdrag, body.dragging .blockdrag { cursor: grabbing; }
/* where the row/table would land */
tr.drop-before > td { box-shadow: inset 0 2px 0 0 #3d8bfd; }
tr.drop-after  > td { box-shadow: inset 0 -2px 0 0 #3d8bfd; }
.dgblock.drop-before, .dgtextrow.drop-before { box-shadow: 0 -3px 0 -1px #3d8bfd; }
.dgblock.drop-after,  .dgtextrow.drop-after  { box-shadow: 0 3px 0 -1px #3d8bfd; }
.dg-addtable { display: block; margin: 14px auto 4px; }

/* ================= DASHBOARD (supervisor): work done over time, per person ================= */
.land.wide { max-width: 1200px; }
#dashbtn { margin-left: auto; }                       /* sits with the user chip, not with the heading */
#dashbtn:not([hidden]) + .userchip { margin-left: 8px; }
/* categorical slots in FIXED order (a person keeps their slot = colour); validated on white. Text never
   wears these — they colour marks and swatches only. */
.dash { --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100;
        --series-5: #e87ba4; --series-6: #008300; --series-7: #4a3aa7; --series-8: #e34948;
        --series-other: #b8bfc7; --ink: #1c2530; --ink-2: #5a6675; --ink-3: #8a94a1; --grid: #e6e9ed;
        --up: #1f7a3a; color: var(--ink); }
.dfilters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; padding-bottom: 14px;
            border-bottom: 1px solid #e7ecf1; }
.dfield { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); }
.dfield .btn-ghost.small { margin-left: 0; }
.dfield select, .dcustom input { padding: 5px 8px; border: 1px solid #cfd6dd; border-radius: 6px; font: inherit;
                                 color: var(--ink); background: #fff; max-width: 100%; }
.dcustom { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); }
.seg { display: inline-flex; max-width: 100%; overflow-x: auto; border: 1px solid #cfd6dd; border-radius: 6px; background: #fff; }
.seg button { flex: none; border: 0; background: transparent; color: var(--ink-2); padding: 5px 11px; cursor: pointer;
              font-size: 13px; white-space: nowrap; }
.seg button + button { border-left: 1px solid #e2e7ec; }
.seg button:hover:not(:disabled):not(.on) { background: #f2f5f8; }
.seg button.on { background: #3d8bfd; color: #fff; }
.seg button:disabled { color: #b5bdc6; cursor: not-allowed; }
/* refetch keeps the frame: the previous render stays, dimmed — no skeleton, no layout jump */
.dbody { transition: opacity .15s; }
.dash.loading .dbody { opacity: .55; }

.dnow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 14px 0; font-size: 13px; }
.dnowh { color: var(--ink); margin-right: 4px; }
.dnowchip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 3px 10px; border: 1px solid #dde3e9;
            border-radius: 14px; background: #fbfcfe; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dnowchip > span { overflow: hidden; text-overflow: ellipsis; }
.dnowchip > .hint { flex: none; overflow: visible; }               /* the job name gives way, not "3 min ago" */
.dsw { display: inline-block; flex: none; width: 10px; height: 10px; border-radius: 2px; vertical-align: -1px; }

.dtiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.dtile { min-width: 0; border: 1px solid #e2e7ec; border-radius: 10px; padding: 12px 14px; background: #fbfcfe; }
.dtile .dl { font-size: 13px; color: var(--ink-2); }
.dtile .dv { font-size: 26px; font-weight: 600; line-height: 1.25; margin-top: 2px; }   /* proportional figures */
.dtile .ds, .dtile .dd { font-size: 12px; color: var(--ink-2); }
.dtile .dd { margin-top: 3px; }
.dd .up { color: var(--up); } .dd .down { color: var(--ink-2); }

.dcard { margin-top: 16px; border: 1px solid #e2e7ec; border-radius: 10px; padding: 14px 16px; background: #fff; min-width: 0; }
.dcardh { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-bottom: 10px; }
.dcardh .btn-ghost.small { margin-left: 0; }
.dctitle { margin-right: auto; }
.dctitle b { font-size: 15px; }
.dlegend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-bottom: 8px; font-size: 12.5px; color: var(--ink); }
.dlegend span { display: inline-flex; align-items: center; gap: 6px; }
.dplotwrap { position: relative; }
.dplot svg { display: block; width: 100%; height: auto; touch-action: pan-y; }
.dplot svg:focus { outline: none; }
.dplot svg:focus-visible { outline: 2px solid #3d8bfd; outline-offset: 2px; border-radius: 4px; }
.dplot text { font-size: 11px; font-variant-numeric: tabular-nums; }
.dempty { margin: 0; padding: 36px 8px; text-align: center; color: var(--ink-3); font-size: 13px; }
.dtip { position: absolute; z-index: 5; pointer-events: none; min-width: 150px; max-width: min(280px, 100%);
        background: #fff; border: 1px solid #dde3e9; border-radius: 8px; padding: 8px 10px;
        box-shadow: 0 6px 20px rgba(20,28,38,.14); font-size: 12px; }
.dtiph { color: var(--ink-2); margin-bottom: 5px; font-weight: 600; }
.dtipg { display: grid; grid-template-columns: 12px auto minmax(0, 1fr); gap: 3px 8px; align-items: center; }
.dtipg .k { width: 12px; height: 3px; border-radius: 2px; }                /* line-key, not a box */
.dtipg .v { font-weight: 700; color: var(--ink); text-align: right; font-variant-numeric: tabular-nums; }
.dtipg .v.zero { font-weight: 500; color: var(--ink-3); }
.dtipg .n { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dtipg .tot { align-self: stretch; border-top: 1px solid #e7ecf1; padding-top: 3px; }

/* tables scroll inside their own wrapper — never the page */
.dtablewrap { overflow-x: auto; }
table.dtable { width: 100%; border-collapse: collapse; font-size: 13px; }
.dtable th { text-align: left; font-weight: 600; font-size: 12px; color: var(--ink-2); padding: 6px 8px;
             border-bottom: 1px solid #e2e7ec; white-space: nowrap; }
.dtable td { padding: 7px 8px; border-bottom: 1px solid #eef1f4; vertical-align: top; }
.dtable .dnum { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dtable tfoot th, .dtable tfoot td { border-top: 1px solid #e2e7ec; border-bottom: 0; font-weight: 600; color: var(--ink); }
.dtable .idle { color: var(--ink-3); }
.dtable .who { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.dtable .dsub { display: block; font-size: 12px; color: var(--ink-2); }
.dtable .nowrap { white-space: nowrap; }
.dtable .dwork { min-width: 180px; } .dtable .djob { min-width: 200px; }   /* narrow screens scroll, not squeeze */
.dpeople tbody tr { cursor: pointer; }
.dpeople tbody tr:hover { background: #f5f8fc; }
.dpeople tbody tr:focus-visible { outline: 2px solid #3d8bfd; outline-offset: -2px; }
.dpeople tbody tr.sel { background: #eef5ff; }
.drole { font-size: 11px; padding: 1px 7px; border-radius: 9px; background: #eef1f4; color: var(--ink-2); }
.drole.sup { background: #e3f6ea; color: #1f5a3a; } .drole.gone { background: #f4f1ee; color: #8a6d3b; }
.dmore { margin-top: 8px; }

@media (max-width: 640px) {
  #step-bmr h2, #step-dash h2 { flex-wrap: wrap; row-gap: 6px; }
  .land.wide { padding-left: 10px; padding-right: 10px; }
  #step-dash { padding: 16px 12px; }
  .dtiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .dtile { padding: 10px 12px; }
  .dtile .dv { font-size: 22px; }
  .dcard { padding: 12px 10px; }
  /* a squeezed table wraps every cell into ragged rows: keep each row on its line and scroll sideways */
  table.dtable { width: max-content; min-width: 100%; }
  /* the measure picker as a 2×2 grid; the inner hairlines are shadows the rounded frame clips at its edge */
  #dash-metric { display: grid; grid-template-columns: 1fr 1fr; width: 100%; overflow: hidden; }
  #dash-metric button { border-left: 0; box-shadow: -1px -1px 0 #e2e7ec; }
}
.dash .hint { color: var(--ink-2); font-size: 12.5px; font-weight: 400; }
