/* Rutu Labs additions to the shared stylesheet */
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px 12px; padding: 14px 16px 16px; align-items: end; }
.filters .fld { margin: 0; }
.filters input, .filters select { width: 100%; }
.filters .actions { display: flex; gap: 8px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px; display: grid; gap: 10px; align-content: start; }
.card h3 { font-size: 16px; font-weight: 600; margin: 0; }
.card .port { font-size: 26px; font-weight: 700; letter-spacing: -.01em; line-height: 1; }
.card .row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.mini-grid { display: grid; gap: 3px; width: 64px; aspect-ratio: 210/297; padding: 5px; border: 1.5px solid var(--line-strong); border-radius: 3px; background: var(--surface-2); }
.mini-grid.land { aspect-ratio: 297/210; width: 84px; }
.mini-grid i { background: var(--accent); opacity: .55; border-radius: 1px; }
.pill { display: inline-block; font-size: 12.5px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--surface-2); color: var(--ink-2); }
.pill.on { background: var(--accent-soft); color: var(--accent); }
.pill.bad { background: color-mix(in srgb, var(--stat) 14%, transparent); color: var(--stat); }
.tbl td .sub2 { display: block; color: var(--ink-3); font-size: 13px; }
.warn { color: var(--urgent); font-size: 13px; display: block; }
.act .btn { margin: 2px 0 2px 4px; }
.log li { display: grid; grid-template-columns: 76px 90px 1fr; gap: 10px; padding: 9px 16px; border-top: 1px solid var(--line); font-size: 14px; }
.log .t { color: var(--ink-3); }
.log .k { font-weight: 600; font-size: 12.5px; }
.log .k.error, .log .k.rejected { color: var(--stat); }
.log .k.pdf, .log .k.print { color: var(--accent); }
.setup { background: var(--surface-2); border-radius: 8px; padding: 12px 14px; font-size: 14px; }
.setup code { font-size: 14px; }
@media (max-width: 900px) { .log li { grid-template-columns: 60px 1fr; } .log .k { grid-column: 1; } }
.mini-grid.dark { background: #111; }
.fieldgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 0 12px; }
.fieldgrid .chk { margin: 4px 0; }
.head-actions select { max-width: 240px; }
.pill.warn { background: color-mix(in srgb, var(--urgent) 15%, transparent); color: var(--urgent); }
.logos { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
@media (max-width: 600px) { .logos { grid-template-columns: 1fr; } }
.log li .k { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pmodal[data-kind=film] .lay-only { display: none; }
.pmodal[data-kind=layout] .film-only { display: none; }
.film-only { border-left: 3px solid var(--accent); padding-left: 12px; margin: 4px 0 12px; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl.compact { min-width: 0; }
.filters .actions { flex-wrap: wrap; }
.pick summary { cursor: pointer; font-weight: 600; }
.pick-list { max-height: 230px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; }
.pick-row { display: block; width: 100%; text-align: left; padding: 8px 12px; border: 0; border-bottom: 1px solid var(--line); background: none; cursor: pointer; font: inherit; color: inherit; }
.pick-row:last-child { border-bottom: 0; }
.pick-row span { display: block; font-size: 13px; color: var(--ink-3); }
.pick-row:hover, .pick-row.on { background: var(--accent-soft); }
.pick-list p { padding: 10px 12px; margin: 0; }
.btn.wa { border-color: #25D366; color: #128C7E; }
textarea { font: inherit; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink); }
.pk-layouts { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.pk-layouts .chk { margin: 2px 0; }
.pk-pages { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; max-height: 58vh; overflow-y: auto; padding: 2px; }
.pk-page-label { font-size: 12.5px; font-weight: 600; color: var(--ink-3); margin-bottom: 4px; }
.pk-page { display: grid; gap: 4px; aspect-ratio: 210/297; padding: 6px; background: #fff; border: 1px solid var(--line-strong); border-radius: 4px; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.pk-page.land { aspect-ratio: 297/210; }
.pk-cell { position: relative; background: #000; border-radius: 2px; overflow: hidden; cursor: grab; min-height: 0; }
.pk-cell img { width: 100%; height: 100%; object-fit: contain; display: block; pointer-events: none; }
.pk-cell.empty { background: transparent; border: 1.5px dashed #c9ced6; cursor: default; }
.pk-cell.dragging { opacity: .35; }
.pk-cell.over { outline: 3px solid var(--accent); outline-offset: -3px; }
.pk-num { position: absolute; left: 3px; bottom: 3px; background: rgba(60,60,60,.85); color: #fff; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 3px; }
.pk-x { position: absolute; right: 3px; top: 3px; width: 24px; height: 24px; border: 0; border-radius: 4px; background: #d93025; color: #fff; font-size: 17px; line-height: 1; cursor: pointer; }
.pk-move { position: absolute; right: 3px; bottom: 3px; display: flex; gap: 2px; }
.pk-move button { width: 22px; height: 20px; border: 0; border-radius: 3px; background: rgba(255,255,255,.85); font-size: 10px; cursor: pointer; padding: 0; }
.pk-move button:disabled { opacity: .3; cursor: default; }
@media (hover: hover) { .pk-x, .pk-move { opacity: 0; transition: opacity .12s; } .pk-cell:hover .pk-x, .pk-cell:hover .pk-move, .pk-cell:focus-within .pk-x, .pk-cell:focus-within .pk-move { opacity: 1; } }
.pk-removed { display: flex; flex-wrap: wrap; gap: 8px; }
.pk-back { position: relative; width: 96px; height: 72px; padding: 0; border: 1px solid var(--line-strong); border-radius: 4px; background: #000; cursor: pointer; overflow: hidden; }
.pk-back img { width: 100%; height: 100%; object-fit: contain; opacity: .5; }
.pk-back span { position: absolute; inset: auto 0 0 0; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; padding: 2px 0; }
#modal.wide { width: min(1080px, 96vw); }
.mini-sw { display: inline-block; width: 14px; height: 14px; border-radius: 50%; margin-right: 6px; vertical-align: -2px; background: conic-gradient(#3E9B4F 0 72deg, #E2732B 72deg 144deg, #2F6FC2 144deg 216deg, #D9A21E 216deg 288deg, #7A68C9 288deg); }

/* ---------- monospace ---------- */
:root { --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace; }
.mono { font-family: var(--mono); }

/* ---------- Library: modality buttons on top ---------- */
.modbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.modbtn { display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; min-height: 42px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); color: var(--ink-2); font: inherit; font-weight: 650; cursor: pointer; }
.modbtn span { min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); color: var(--ink-3); font-size: 12.5px; font-weight: 600; text-align: center; }
.modbtn i { font-style: normal; color: var(--accent); font-size: 13px; }
.modbtn:hover { border-color: var(--accent); color: var(--ink); }
.modbtn.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.modbtn.on span { background: rgba(255, 255, 255, .22); color: inherit; }
.modbtn.on i { color: inherit; }

/* ---------- Reading: the trainer ---------- */
#modal.xwide { width: min(1320px, 97vw); }
.tr-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr); gap: 18px; margin-top: 4px; }
@media (max-width: 900px) { .tr-grid { grid-template-columns: 1fr; } }
.tr-fields { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; align-items: center; }
.tr-f { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 2px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; }
.tr-f i { width: 12px; height: 12px; border-radius: 3px; background: var(--c); }
.tr-f.on { border-color: var(--c); box-shadow: 0 0 0 2px color-mix(in srgb, var(--c) 25%, transparent); }
.tr-scroll { max-height: 56vh; overflow: auto; border: 1px solid var(--line-strong); border-radius: 8px; background: #000; }
.tr-stage { position: relative; cursor: crosshair; touch-action: none; user-select: none; }
.tr-stage img { display: block; width: 100%; height: auto; pointer-events: none; }
.tr-box { position: absolute; border: 2px solid; box-sizing: border-box; pointer-events: none; }
.tr-box span { position: absolute; left: -2px; bottom: 100%; padding: 0 5px; color: #fff; font-size: 10.5px; font-weight: 700; white-space: nowrap; border-radius: 3px 3px 0 0; }
.tr-draw { position: absolute; border: 2px dashed #fff; background: rgba(255, 255, 255, .15); pointer-events: none; }

/* ---------- Library: row actions, with the rest under More (so the table fits without scrolling sideways) ---------- */
.act-row { display: flex; gap: 6px; justify-content: flex-end; align-items: center; flex-wrap: nowrap; }
.more { position: relative; }
.more .menu { display: none; }   /* hidden copy of the row's items; shown in #floatmenu */
.menu-float { position: fixed; z-index: 90; min-width: 210px; padding: 6px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 10px; box-shadow: 0 12px 32px rgba(10, 20, 40, .22); display: flex; flex-direction: column; }
.menu-float[hidden] { display: none; }
.mi { display: block; width: 100%; text-align: left; padding: 9px 12px; border: 0; border-radius: 7px; background: none; color: var(--ink); font: inherit; font-size: 14px; text-decoration: none; cursor: pointer; white-space: nowrap; }
.mi:hover, .mi:focus-visible { background: var(--accent-soft); outline: none; }
.mi.danger { color: var(--stat); }
/* wide tables elsewhere: keep their sideways scrollbar on screen, not below a long list */
.tbl-wrap { overflow-x: auto; }
.tbl-wrap.scroll-y { max-height: calc(100vh - 220px); overflow-y: auto; }

/* ---------- collection counter ---------- */
.nav .count.alert { background: var(--stat); color: var(--stat-ink); }
.modbtn.alert span { background: var(--stat); color: var(--stat-ink); }
.ct-search input { width: 100%; max-width: 420px; margin-bottom: 14px; font-size: 16px; padding: 10px 14px; }
.ct-list { display: grid; gap: 10px; }
.packet { background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--accent); border-radius: 10px; padding: 12px 16px; }
.packet.overdue { border-left-color: var(--stat); }
.packet.done { border-left-color: var(--line-strong); opacity: .85; }
.pk-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.pk-name { font-size: 17px; }
.pk-id { margin-left: 10px; font-family: var(--mono); font-weight: 700; font-size: 15px; padding: 1px 8px; border-radius: 6px; background: var(--surface-2); }
.pk-acts { display: flex; gap: 8px; align-items: center; }
.od { color: var(--stat); }
.pk-items { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; }
.pk-items li { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.pk-items li .m { margin-left: auto; }
/* narrow screens (including Windows display scaling): fold From and PACS into Details so nothing is off-screen */
.lib-tbl .fold { display: none; }
@media (max-width: 1300px) { .lib-tbl .c-from, .lib-tbl .c-pacs { display: none; } .lib-tbl .fold { display: block; } }

/* a button that is working */
.btn[aria-busy=true] { cursor: progress; opacity: .85; }
.spin { display: inline-block; width: 12px; height: 12px; margin-right: 7px; vertical-align: -1px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation-duration: 2.4s; } }

/* Please confirm, as a button */
.pillbtn { border: 0; cursor: pointer; font: inherit; font-size: 12.5px; font-weight: 600; }
.pillbtn:hover, .pillbtn:focus-visible { filter: brightness(.94); outline: 2px solid var(--urgent); outline-offset: 1px; }
/* Choose images: a layout per page */
.pk-page-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pk-page-label select { font-size: 13px; padding: 3px 6px; max-width: 170px; }
.pk-page.pk-black { background: #000; border-color: #000; }   /* (not .blk: that name is already used elsewhere) */
.pk-paper { display: block; font-size: 11.5px; color: var(--ink-3); margin-top: 3px; }
/* page previews keep the page's own width: cells shrink to fit (thumbnails must not widen the page) */
.pk-page { width: 100%; min-width: 0; box-sizing: border-box; }
.pk-cell { min-width: 0; }
.pk-cell img { max-width: 100%; max-height: 100%; }
/* narrow screens (including Windows display scaling): the row's four buttons as two rows of two */
@media (max-width: 1300px) { .lib-tbl .act-row { display: grid; grid-template-columns: auto auto; gap: 5px; justify-content: end; } .lib-tbl .act-row > * { text-align: center; } }
.pk-page { min-height: 0; overflow: hidden; }

/* Choose images: add a page, remove an empty one */
.pk-page-tools { display: inline-flex; align-items: center; gap: 4px; }
.pk-addpage { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 140px; border: 2px dashed var(--line-strong); border-radius: 6px; background: none; color: var(--ink-2); font: inherit; font-weight: 600; cursor: pointer; }
.pk-addpage span { font-size: 28px; line-height: 1; }
.pk-addpage:hover { border-color: var(--accent); color: var(--accent); }
.pk-cell.empty.over { outline: 3px solid var(--accent); outline-offset: -3px; }

/* The Library reacts to ITS OWN width, not the screen's: a side-by-side window is narrow even on a wide screen. When the
   table area is too narrow for columns, each PDF becomes a compact card with all its buttons in one wrapping row. */
#lib-list .tbl-wrap { container-type: inline-size; }
@container (max-width: 860px) {
  .lib-tbl thead { display: none; }
  .lib-tbl, .lib-tbl tbody { display: block; width: 100%; }
  .lib-tbl tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 4px 14px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .lib-tbl td { display: block; border: 0; padding: 0; min-width: 0; }
  .lib-tbl td.c-from, .lib-tbl td.c-pacs { display: none; }
  .lib-tbl .fold { display: block; }
  .lib-tbl td.act { grid-column: 1 / -1; margin-top: 6px; }
  .lib-tbl .act-row { display: flex !important; flex-wrap: wrap; gap: 6px; justify-content: flex-start; }
}
@container (max-width: 480px) { .lib-tbl tr { grid-template-columns: minmax(0, 1fr); } }

/* 2.5: the result of "Check the log", and a PDF's history of changes */
.setup.bad { box-shadow: inset 3px 0 0 var(--stat); }
.hist summary { cursor: pointer; font-size: 14px; color: var(--ink-2); }
.hist-list { list-style: none; margin: 6px 0 0; padding: 0; font-size: 13.5px; max-height: 180px; overflow: auto; }
.hist-list li { padding: 6px 0; border-top: 1px solid var(--line); }
.hist-list li > span { display: block; font-size: 12.5px; }
.hist-list code { font-size: 13px; }

/* 2.7: print queue */
.sp-printers { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; margin-bottom: 14px; }
.sp-card { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--surface); }
.sp-card.lv-error { border-color: color-mix(in srgb, var(--stat) 55%, var(--line)); box-shadow: inset 3px 0 0 var(--stat); }
.sp-card.lv-warn { box-shadow: inset 3px 0 0 var(--urgent); }
.sp-name { font-weight: 600; margin-bottom: 4px; overflow-wrap: anywhere; }
.sp-state { display: flex; align-items: center; gap: 7px; margin-bottom: 2px; }
.sp-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--ink-3); }
.sp-dot.lv-ok { background: #16803d; } .sp-dot.lv-warn { background: var(--urgent); } .sp-dot.lv-error { background: var(--stat); }
.sp-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.sp-filters input { flex: 1 1 260px; max-width: 420px; }
.sp-filters select { width: auto; }
.sp-tbl tr.sp-bad td { background: color-mix(in srgb, var(--stat) 6%, transparent); }
.pill-btn { border: 0; cursor: pointer; font: inherit; }
.pill-btn:hover { text-decoration: underline; }
.sp-card { color: var(--ink); }
.sp-tbl td:nth-child(1) { width: 1%; }
.sp-tbl td:nth-child(2) { min-width: 190px; }
.sp-tbl td:nth-child(3) { min-width: 150px; }
.sp-tbl td:nth-child(4) { min-width: 220px; }
.sp-tbl td:last-child { width: 1%; }
