:root {
  /* X-POS IT brand: deep slate from the app icon, circuit teal, spark orange */
  --navy: #16233a;
  --navy-2: #22344f;
  --accent: #0d7f8a;
  --accent-2: #0a6a74;
  --accent-soft: #e2f4f5;
  --glow: #5fd6e0;
  --spark: #f08a24;
  --spark-soft: #fdf0e2;
  --bg: #edf1f4;
  --panel: #ffffff;
  --line: #d3dce3;
  --line-soft: #e7edf1;
  --text: #1c2733;
  --muted: #5f6f7e;
  --ok: #1f7a4d;
  --ok-soft: #e3f4ea;
  --warn: #9a6400;
  --warn-soft: #fff4dc;
  --err: #b42318;
  --err-soft: #fde8e6;
  --row-alt: #f6f9fa;
  --row-hover: #e6f4f5;
  font-size: 13px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; }
a { color: var(--accent); }

.topbar { height: 44px; background: var(--navy); color: #fff; display: flex; align-items: center;
  justify-content: space-between; padding: 0 16px; position: sticky; top: 0; z-index: 20; }
.test-env .topbar { background: #b45309; }
.test-env .top-right select { background: #92400e; border-color: #d97706; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; color: #fff; text-decoration: none; }
#module-name { margin-left: -6px; color: #c9d6e6; font-weight: 500; }
body.home .sidenav { display: none; }
[hidden] { display: none !important; }
.logo { background: #fff; color: var(--navy); font-weight: 800; border-radius: 4px; padding: 2px 6px; font-size: 12px; }
.top-right label { font-size: 12px; color: #c9d6e6; display: flex; gap: 6px; align-items: center; }
.top-right select { background: var(--navy-2); color: #fff; border: 1px solid #3d5f8c; }

.shell { display: flex; min-height: calc(100vh - 44px); }
.sidenav { width: 200px; flex: none; background: #f8fafc; border-right: 1px solid var(--line); padding: 8px 0 24px; }
.sidenav a { display: block; padding: 6px 18px; color: var(--text); text-decoration: none; border-left: 3px solid transparent; }
.sidenav a:hover { background: var(--row-hover); }
.sidenav a.active { background: var(--accent-soft); border-left-color: var(--accent); color: var(--navy); font-weight: 600; }
.nav-group { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
  padding: 14px 18px 4px; font-weight: 600; }
main { flex: 1; min-width: 0; padding: 16px 20px 40px; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.page-head h1 { font-size: 18px; margin: 0; color: var(--navy); display: flex; align-items: center; gap: 10px; }
.toolbar { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 12px; margin-bottom: 12px; }
.panel h2 { font-size: 13px; margin: 0 0 10px; color: var(--navy); text-transform: uppercase; letter-spacing: .04em; }

button, .btn { font: inherit; border: 1px solid var(--line); background: #fff; color: var(--text); padding: 5px 12px;
  border-radius: 3px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
button:hover, .btn:hover { background: var(--row-hover); }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover, .btn.primary:hover { background: var(--accent-2); }
button.danger { color: var(--err); border-color: #f0c2bd; }
button.danger:hover { background: var(--err-soft); }
button:disabled { opacity: .5; cursor: default; }
button.icon { padding: 2px 7px; color: var(--muted); }

input, select, textarea { font: inherit; border: 1px solid var(--line); border-radius: 3px; padding: 4px 6px; background: #fff; color: var(--text); }
input:focus, select:focus, textarea:focus { outline: 2px solid #8fdde4; outline-offset: -1px; border-color: var(--accent); }
input[readonly], input:disabled, select:disabled, textarea:disabled { background: #f3f5f8; color: #4b5866; }
.num-in { text-align: right; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px 14px; }
.field { display: flex; flex-direction: column; gap: 3px; }
.field > span { font-size: 11px; color: var(--muted); font-weight: 600; }
.field.req > span::after { content: " *"; color: var(--err); }
.field.wide { grid-column: 1 / -1; }
.field.check { flex-direction: row; align-items: center; gap: 6px; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 10px; }
.filters .field input, .filters .field select { min-width: 120px; }
.filters .field.check { align-self: center; padding-top: 14px; }
.filters .field.check input { min-width: 0; }

.grid-wrap { overflow: auto; max-height: calc(100vh - 230px); border: 1px solid var(--line); border-radius: 3px; background: #fff; }
table.grid { border-collapse: collapse; width: 100%; }
table.grid th { position: sticky; top: 0; background: #e3ecf0; color: var(--navy); text-align: left; font-weight: 600;
  padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; cursor: pointer; user-select: none; z-index: 1; }
table.grid th.r, table.grid td.r { text-align: right; }
table.grid td { padding: 5px 8px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; max-width: 340px;
  overflow: hidden; text-overflow: ellipsis; }
table.grid tbody tr:nth-child(even) { background: var(--row-alt); }
table.grid tbody tr.click:hover { background: var(--row-hover); cursor: pointer; }
table.grid tfoot td { font-weight: 700; background: #f1f4f8; border-top: 2px solid var(--line); position: sticky; bottom: 0; }
table.grid tr.inactive td { color: #9aa5b1; }
table.grid tr.week-detail > td { padding: 2px 0 10px 28px; background: #f7f9fb; max-width: none; }
table.grid tr.week-detail table.grid th { position: static; }
.grid-meta { font-size: 11px; color: var(--muted); margin: 6px 2px 0; }
.empty { padding: 24px; text-align: center; color: var(--muted); }

table.lines td { padding: 2px 3px; overflow: visible; max-width: none; }
table.lines input, table.lines select { width: 100%; padding: 3px 5px; border-color: transparent; background: transparent; }
table.lines tr:hover input, table.lines tr:hover select, table.lines input:focus, table.lines select:focus { border-color: var(--line); background: #fff; }
table.lines select[data-f="recv"] { min-width: 140px; }
table.lines td.ln { color: var(--muted); text-align: right; width: 32px; padding-right: 6px; }
table.lines .ext { font-weight: 600; }

.inv-bottom { display: grid; grid-template-columns: 1fr 340px; gap: 12px; align-items: start; }
.totals table { width: 100%; border-collapse: collapse; }
.totals td { padding: 4px 2px; }
.totals td:last-child { text-align: right; width: 140px; }
.totals input { width: 130px; text-align: right; }
.totals tr.sep td { border-top: 1px solid var(--line); }
.totals .big { font-size: 15px; font-weight: 700; }
.diff-ok { color: var(--ok); font-weight: 700; }
.diff-bad { color: var(--err); font-weight: 700; }
table.lines input.ext-off { border-color: var(--err); color: var(--err); background: #fde8ec; }

.badge { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 10px; display: inline-block; }
.s-Open { background: var(--warn-soft); color: var(--warn); }
.s-Posted { background: var(--accent-soft); color: var(--accent); }
.s-Paid { background: var(--ok-soft); color: var(--ok); }
.s-Resave { background: var(--err-soft); color: var(--err); }
.s-Credit { background: #f1e8fb; color: #6b3fa0; }
.s-Manual { background: #eef1f5; color: var(--muted); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-bottom: 12px; }
.card { background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 4px; padding: 12px 14px; }
.card .k { font-size: 11px; text-transform: uppercase; color: var(--muted); letter-spacing: .05em; font-weight: 600; }
.card .v { font-size: 22px; font-weight: 700; color: var(--navy); margin-top: 4px; font-variant-numeric: tabular-nums; }
.card .s { font-size: 12px; color: var(--muted); }
.card.warn { border-left-color: #d99a00; }
.card.bad { border-left-color: var(--err); }
.card.good { border-left-color: var(--ok); }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 12px; flex-wrap: wrap; }
.tabs button { border: 1px solid transparent; border-bottom: none; border-radius: 4px 4px 0 0; background: transparent; padding: 7px 14px; }
.tabs button.on { background: #fff; border-color: var(--line); color: var(--navy); font-weight: 600; margin-bottom: -1px; }

.modal-back { position: fixed; inset: 0; background: rgba(20, 30, 45, .45); display: flex; align-items: flex-start;
  justify-content: center; padding: 50px 16px; z-index: 50; overflow: auto; }
.modal { background: #fff; border-radius: 6px; width: 720px; max-width: 100%; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.modal header { padding: 12px 16px; border-bottom: 1px solid var(--line); font-weight: 700; color: var(--navy); font-size: 15px;
  display: flex; justify-content: space-between; align-items: center; }
.modal .body { padding: 16px; }
.modal footer { padding: 10px 16px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 8px; }
.modal footer .right { display: flex; gap: 8px; }

#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { padding: 10px 14px; border-radius: 4px; background: var(--ok); color: #fff; box-shadow: 0 4px 14px rgba(0,0,0,.2); max-width: 460px; }
.toast.err { background: var(--err); }

.map-table td { padding: 5px 8px; border-bottom: 1px solid var(--line-soft); }
.map-table select { min-width: 220px; }
.muted { color: var(--muted); }
.note { background: var(--accent-soft); border: 1px solid #bfe3e6; padding: 10px 12px; border-radius: 4px; margin-bottom: 12px; line-height: 1.5; }
.errlist { max-height: 240px; overflow: auto; background: var(--err-soft); padding: 8px 12px; border-radius: 4px; font-family: ui-monospace, monospace; font-size: 12px; }
.loading { color: var(--muted); padding: 20px; }

@media (max-width: 900px) {
  .shell { flex-direction: column; }
  .sidenav { width: auto; display: flex; flex-wrap: wrap; padding: 4px 8px; }
  .sidenav .nav-group { display: none; }
  .sidenav a { padding: 6px 10px; border-left: none; }
  main { padding: 12px 16px 40px; }
  .inv-bottom { grid-template-columns: 1fr; }
}
@media print {
  .topbar, .sidenav, .toolbar, .filters, .tabs { display: none !important; }
  .grid-wrap { max-height: none; overflow: visible; border: none; }
  main { padding: 0; }
}

.ta-menu { position: absolute; z-index: 200; max-height: 320px; overflow-y: auto; background: #fff; border: 1px solid var(--line);
  border-radius: 4px; box-shadow: 0 6px 20px rgba(0,0,0,.15); max-width: 560px; }
.ta-item { padding: 5px 10px; cursor: pointer; border-bottom: 1px solid var(--line-soft); display: flex; flex-direction: column; }
.ta-item b { font-weight: 600; color: var(--text); }
.ta-item span { font-size: 11px; color: var(--muted); }
.ta-item:hover, .ta-item.on { background: var(--accent-soft); }

.totals tr.charge td { padding: 0 2px 6px; font-size: 11px; color: var(--muted); text-align: left !important; width: auto !important; }
.totals tr.charge select { width: 100%; font-size: 11px; padding: 2px 4px; color: var(--muted); }
.totals tr.charge [data-preview] { padding: 3px 2px 0; color: var(--accent); line-height: 1.4; }

.post-date { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
table.batch-inv td { overflow: visible; }
table.batch-inv select, table.batch-inv input { width: 100%; padding: 3px 5px; }

table.batch-inv .rev-col { width: 70px; text-align: center; }
table.batch-inv .rev-col input { width: 18px; height: 18px; cursor: pointer; }
table.batch-inv tr.reviewed td { background: #f1faf4; }
.review-count { display: inline-flex; align-items: center; }

/* home: module launcher */
.modules { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; max-width: 900px; }
.module-card { display: flex; gap: 16px; align-items: flex-start; background: #fff; border: 1px solid var(--line); border-radius: 6px;
  padding: 20px; text-decoration: none; color: var(--text); border-top: 4px solid var(--accent); }
.module-card:hover { background: var(--row-hover); box-shadow: 0 4px 14px rgba(0,0,0,.08); }
.module-card.inv { border-top-color: var(--ok); }
.module-card .mk { flex: none; width: 56px; height: 56px; border-radius: 8px; background: var(--navy); color: #fff; font-weight: 800;
  display: flex; align-items: center; justify-content: center; font-size: 15px; }
.module-card.inv .mk { background: var(--ok); }
.module-card.rpt { border-top-color: #6b4fa0; }
.module-card.rpt .mk { background: #6b4fa0; }
.rpt-groups .module-card { cursor: default; }
.rpt-groups .module-card .ml a { display: inline-block; margin-right: 14px; }
.module-card.soon { opacity: .55; border-top-color: var(--line); }
.module-card.soon .mk { background: #9aa5b1; }
iframe.pdf { width: 100%; height: calc(100vh - 230px); min-height: 500px; border: 1px solid var(--line); background: #fff; }
table.opslines td { vertical-align: top; }
table.opslines td { max-width: none; }
table.opslines textarea { width: 100%; font-family: ui-monospace, monospace; font-size: 12px; resize: vertical; }
table.opslines td[data-names] { font-size: 11px; line-height: 1.5; }
table.opslines tr.sec td { background: var(--accent-soft); font-weight: 700; color: var(--navy); }
table.opslines tr.grp td { font-weight: 600; padding-top: 8px; }
table.opslines tr.changed td { background: #fff8e1; }
.module-card h2 { margin: 2px 0 6px; font-size: 17px; color: var(--navy); }
.module-card p { margin: 0 0 8px; line-height: 1.45; }
.module-card .ml { font-size: 12px; color: var(--accent); }

/* inventory count sheet */
.count-wrap { max-height: calc(100vh - 300px); }
table.count-sheet td { overflow: visible; }
table.count-sheet tr.area-head td { background: #e9f1ea; color: var(--navy); border-top: 2px solid var(--line); padding: 7px 8px; position: sticky; top: 29px; z-index: 1; }
table.count-sheet tbody tr[data-line]:nth-child(even) { background: var(--row-alt); }
table.count-sheet tr.counted td { background: #f4fbf6; }
table.count-sheet input.qty { width: 96px; font-weight: 600; }
table.count-sheet input[data-pick] { width: 100%; }
table.count-sheet select[data-cu] { width: 100%; }
table.count-sheet tr.area-add td { padding: 2px 8px 8px; }
table.count-sheet tr.area-add button { color: var(--accent); }
.sheets { display: grid; grid-template-columns: 340px 1fr; gap: 12px; align-items: start; }
table.area-list td { max-width: 230px; }
table.area-list tr.on td { background: var(--accent-soft); font-weight: 600; }
.nowrap { white-space: nowrap; }
@media (max-width: 900px) { .sheets { grid-template-columns: 1fr; } }
@media print {
  .count-sheet button, .count-sheet .area-add, .note, .cards .card .s { display: none !important; }
  .count-wrap { max-height: none; overflow: visible; }
  table.count-sheet input.qty { border: none; border-bottom: 1px solid #999; border-radius: 0; }
  table.count-sheet tr.area-head td { position: static; }
}

/* printable count sheets */
.print-sheets { background: #fff; border: 1px solid var(--line); border-radius: 4px; padding: 16px 20px; }
.ps-area { margin-bottom: 22px; }
.ps-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap;
  border-bottom: 2px solid var(--navy); padding-bottom: 4px; margin-bottom: 4px; font-size: 15px; color: var(--navy); }
.ps-meta { font-size: 11px; color: var(--muted); }
table.ps-table { width: 100%; border-collapse: collapse; }
table.ps-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
  border-bottom: 1px solid #999; padding: 4px 6px; }
table.ps-table td { padding: 0 6px; height: 26px; border-bottom: 1px solid #ccc; }
table.ps-table th.r, table.ps-table td.r { text-align: right; }
table.ps-table td.ps-qty { border-left: 1px solid #999; border-right: 1px solid #999; text-align: right; font-weight: 600; }
table.ps-table tfoot td { font-weight: 700; border-bottom: none; }
table.ps-table tr { break-inside: avoid; }
@media print {
  .no-print { display: none !important; }
  .print-sheets { border: none; padding: 0; }
  .ps-break { break-before: page; }
  /* 30% smaller than the screen (13px -> 9px), rows and spacing shrunk to match */
  .print-sheets { font-size: 9px; }
  .ps-area { margin-bottom: 10px; }
  .ps-head { font-size: 10.5px; padding-bottom: 2px; margin-bottom: 2px; }
  .ps-meta { font-size: 8px; }
  table.ps-table th { font-size: 7.5px; padding: 2px 4px; }
  table.ps-table td { height: 18px; padding: 0 4px; border-bottom: 1px solid #555; }   /* a clear line under every item */
  table.ps-table thead th { border-bottom: 1.5px solid #000; }
  table.ps-table td, table.ps-table th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .ps-head { break-after: avoid; }
  table.ps-table thead { display: table-header-group; }
  body { background: #fff; }
  @page { margin: 12mm; }
}

/* recipes: rolodex */
.module-card.rec { border-top-color: var(--spark); }
.module-card.rec .mk { background: linear-gradient(145deg, #f59a3c, #d96f12); }
.rolodex { display: grid; grid-template-columns: 300px 1fr; gap: 14px; align-items: start; }
.rdx-index { background: #fff; border: 1px solid var(--line); border-radius: 4px; padding: 8px; position: sticky; top: 56px; }
.rdx-index > input { width: 100%; margin-bottom: 6px; }
.rdx-letters { display: flex; flex-wrap: wrap; gap: 2px; margin-bottom: 6px; }
.rdx-letters button { padding: 1px 5px; font-size: 11px; min-width: 22px; justify-content: center; }
.rdx-letters button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.rdx-list { max-height: calc(100vh - 250px); overflow-y: auto; border-top: 1px solid var(--line-soft); }
.rdx-row { padding: 5px 8px; border-bottom: 1px solid var(--line-soft); cursor: pointer; display: flex; flex-direction: column; }
.rdx-row b { font-weight: 600; }
.rdx-row span { font-size: 11px; color: var(--muted); }
.rdx-row em { color: var(--accent); font-style: normal; font-weight: 600; }
.rdx-row:hover { background: var(--row-hover); }
.rdx-row.on { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.rdx-card { position: relative; background: #fffdf7; border: 1px solid #e3d9c2; border-radius: 6px; padding: 18px 22px 14px;
  box-shadow: 0 2px 0 #efe6d2, 0 4px 0 #e6dcc4, 0 8px 18px rgba(0,0,0,.08);
  background-image: repeating-linear-gradient(#fffdf7 0 23px, #eef3f8 23px 24px); }
.rdx-card.archived { background-color: #f6f6f4; background-image: none; border-color: var(--line); }
.rdx-tab { position: absolute; top: -14px; left: 24px; background: #fffdf7; border: 1px solid #e3d9c2; border-bottom: none;
  border-radius: 6px 6px 0 0; padding: 0 14px; font-weight: 800; color: #b4541a; line-height: 14px; font-size: 12px; }
.rdx-card.archived .rdx-tab { background: #f6f6f4; border-color: var(--line); color: var(--muted); }
.rdx-card header { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 10px; }
.rdx-card h2 { margin: 0 0 3px; font-size: 19px; color: var(--navy); }
.rdx-card h3 { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 16px 0 4px; }
.rdx-facts { display: flex; flex-wrap: wrap; gap: 6px 22px; }
.rdx-facts span { display: block; font-size: 10px; text-transform: uppercase; color: var(--muted); letter-spacing: .05em; }
.rdx-facts div { font-weight: 600; }
table.rdx-table { width: 100%; border-collapse: collapse; background: rgba(255,255,255,.7); }
table.rdx-table th { text-align: left; font-size: 11px; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--line); padding: 3px 6px; }
table.rdx-table td { padding: 3px 6px; border-bottom: 1px solid var(--line-soft); }
table.rdx-table .r { text-align: right; }
table.rdx-table tr.unlinked td { background: var(--err-soft); }
.rdx-proc { white-space: pre-wrap; line-height: 1.5; background: rgba(255,255,255,.7); padding: 8px 10px; border-radius: 3px; }
.rdx-card footer { margin-top: 14px; display: flex; justify-content: flex-end; }
.var-under { color: var(--accent); font-weight: 700; }
details.panel summary { cursor: pointer; font-weight: 600; color: var(--warn); }
@media (max-width: 900px) { .rolodex { grid-template-columns: 1fr; } .rdx-index { position: static; } }
.rdx-back { display: none; }
/* phones: the list fills the screen; a tapped recipe's card replaces it (← Recipes / Back returns) */
@media (max-width: 700px) {
  .rolodex { grid-template-columns: minmax(0, 1fr); }
  .rolodex:not(.open) .rdx-card-wrap, .rolodex.open .rdx-index { display: none; }
  .rdx-list { max-height: none; }
  .rdx-row { padding: 10px 8px; }
  .rdx-back { display: inline-flex; margin-right: auto; }
  .rdx-card { padding: 16px 12px 12px; }
  .rdx-card header { flex-direction: column; }
  .rdx-card header .toolbar { width: 100%; }
}
table.rec-lines td { white-space: normal; }
table.rec-lines td.ln { width: 28px; }
table.rec-lines td.nowrap { white-space: nowrap; }
table.fix-table td { white-space: normal; overflow: visible; max-width: none; vertical-align: middle; }
table.fix-table td.fix-used { font-size: 12px; color: var(--muted); max-width: 360px; }
table.fix-table tr.fixed td { background: var(--ok-soft); }
.rdx-card footer { gap: 6px; }

/* Photo Inbox: the invoice photo beside the entry form */
.inv-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 38%); gap: 12px; align-items: start; }
.photo-pane { position: sticky; top: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 8px; }
.photo-tools { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.photo-tools .muted { flex: 1; font-size: 11px; }
.photo-view { max-height: calc(100vh - 120px); overflow: auto; background: #f3f4f6; text-align: center; }
.photo-view img { max-width: 100%; cursor: zoom-in; transition: transform .15s; }
.photo-view img.zoom { max-width: none; width: 220%; cursor: zoom-out; }
.photo-view iframe { width: 100%; height: calc(100vh - 140px); border: 0; }
.grid.lines tr.unmatched td, .unmatched-key { background: #fde8ec; }
.grid.lines tr.guess td, .guess-key { background: #fff6d6; }
.grid.link-lines tr.unmatched td:first-child { background: #fde8ec; }
.grid.link-lines tr.guess td:first-child { background: #fff6d6; }
.unmatched-key, .guess-key { padding: 0 4px; border-radius: 3px; }
table.lines input.cost-off { border-color: #e08a00; color: #9a5b00; background: #fff0d9; }
.cost-off-key { padding: 0 4px; border-radius: 3px; background: #fff0d9; color: #9a5b00; font-weight: 600; }
@media (max-width: 1100px) { .inv-split { grid-template-columns: minmax(0, 1fr); } .photo-pane { position: static; } }

/* ================================================================== X-POS IT brand */
.topbar { height: 52px; background: linear-gradient(180deg, #1c2c47 0%, var(--navy) 100%);
  box-shadow: inset 0 -1px 0 rgba(95,214,224,.55), 0 2px 10px rgba(10,20,35,.18); }
.shell { min-height: calc(100vh - 52px); }
.brand { gap: 12px; }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; border: 1px solid rgba(95,214,224,.6);
  box-shadow: 0 0 10px rgba(95,214,224,.35); display: block; }
.wordmark { font-size: 19px; font-weight: 800; letter-spacing: .02em; line-height: 1;
  background: linear-gradient(180deg, #ffffff 0%, #c9d3dc 55%, #9fb0bf 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.wordmark b, .hero h1 b { margin-left: .28em; color: var(--glow); -webkit-text-fill-color: var(--glow); font-weight: 800; }
#company { color: #c9d6e6; font-weight: 500; font-size: 13px; padding-left: 12px; border-left: 1px solid rgba(255,255,255,.18); }
#module-name { margin-left: 0; font-size: 13px; font-weight: 600; color: #dff7f9; }
#module-name:not(:empty) { padding: 3px 10px; border-radius: 12px; background: rgba(95,214,224,.14); border: 1px solid rgba(95,214,224,.35); }
.top-right label { color: #b9c8d6; }
.top-right select { background: var(--navy-2); border: 1px solid #3a5272; border-radius: 4px; padding: 4px 6px; }

/* TEST copy: brand bar stays, with an unmistakable amber hazard stripe and pill */
.test-env .topbar { background: linear-gradient(180deg, #1c2c47 0%, var(--navy) 100%);
  border-bottom: 5px solid transparent;
  border-image: repeating-linear-gradient(135deg, #f59e0b 0 14px, #16233a 14px 28px) 5; }
.test-env .top-right select { background: var(--navy-2); border-color: #f59e0b; }
#env-pill { font-size: 11px; font-weight: 700; letter-spacing: .03em; color: #1c1400; background: #f59e0b;
  padding: 3px 10px; border-radius: 12px; text-transform: uppercase; }

/* side nav: teal rail, orange "node" on the active page */
.sidenav { background: #f7fafb; }
.sidenav a.active { position: relative; background: var(--accent-soft); border-left-color: var(--accent); color: var(--navy); }
.sidenav a.active::after { content: ""; position: absolute; right: 12px; top: 50%; width: 7px; height: 7px; margin-top: -3.5px;
  border-radius: 50%; background: var(--spark); box-shadow: 0 0 0 3px rgba(240,138,36,.2); }
.nav-group { color: var(--accent-2); display: flex; align-items: center; gap: 8px; }
.nav-group::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, #bfe3e6, transparent); }
/* side nav stays put while the page scrolls; scrolls on its own if taller than the window */
.sidenav { position: sticky; top: 52px; align-self: flex-start; height: calc(100vh - 52px); overflow-y: auto; box-sizing: border-box; }
.nav-group { font-size: 13px; font-weight: 800; }
@media (max-width: 900px) { .sidenav { position: static; height: auto; overflow: visible; } }

button.primary, .btn.primary { background: linear-gradient(180deg, #11929e, var(--accent)); border-color: var(--accent-2); }
.panel { border-radius: 6px; }
.panel h2 { display: flex; align-items: center; gap: 8px; }
.panel h2::before { content: ""; width: 4px; height: 13px; border-radius: 2px; background: var(--accent); }
.page-head h1 { font-size: 19px; }

/* home hero */
.hero { position: relative; overflow: hidden; display: flex; align-items: center; gap: 26px; max-width: 900px;
  margin-bottom: 20px; padding: 22px 28px; border-radius: 12px; color: #fff;
  background: radial-gradient(circle at 12% 50%, rgba(95,214,224,.22), transparent 45%), linear-gradient(135deg, #1e3150 0%, var(--navy) 60%, #101a2b 100%);
  box-shadow: 0 8px 26px rgba(16,26,43,.25), inset 0 0 0 1px rgba(95,214,224,.35); }
.hero-circuit { position: absolute; top: 0; right: 0; width: 50%; height: 100%; color: var(--glow); pointer-events: none; }
.hero-circuit g:first-child { opacity: .35; }
.hero-circuit .nodes circle { fill: var(--spark); filter: drop-shadow(0 0 4px rgba(240,138,36,.8)); }
.hero-logo { position: relative; width: 132px; height: 132px; border-radius: 27px; flex: none;
  box-shadow: 0 0 0 1px rgba(95,214,224,.5), 0 0 26px rgba(95,214,224,.35); }
.hero-text { position: relative; }
.hero-kicker { font-size: 11px; text-transform: uppercase; letter-spacing: .14em; color: var(--glow); font-weight: 700; }
.hero h1 { margin: 4px 0 8px; font-size: 34px; font-weight: 800; letter-spacing: .02em; line-height: 1;
  background: linear-gradient(180deg, #fff 0%, #c9d3dc 60%, #9fb0bf 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { margin: 0; color: #c4d2df; font-size: 14px; line-height: 1.5; max-width: 520px; }
@media (max-width: 640px) { .hero { flex-direction: column; text-align: center; } .hero-logo { width: 110px; height: 110px; border-radius: 22px; } }

/* module cards: icon tiles in the app-icon style */
.module-card { border-radius: 10px; border-top-width: 3px; transition: box-shadow .15s, transform .15s; }
.module-card:hover { background: #fff; transform: translateY(-2px); box-shadow: 0 8px 22px rgba(16,26,43,.12), 0 0 0 1px rgba(95,214,224,.5); }
.module-card .mk { position: relative; border-radius: 12px; background: linear-gradient(145deg, #22344f, var(--navy));
  color: var(--glow); box-shadow: inset 0 0 0 1px rgba(95,214,224,.45), 0 0 10px rgba(95,214,224,.2); letter-spacing: .03em; }
.module-card .mk::after { content: ""; position: absolute; top: 7px; right: 7px; width: 6px; height: 6px; border-radius: 50%; background: var(--spark); }
.module-card.inv .mk { background: linear-gradient(145deg, #2a9a63, var(--ok)); color: #fff; box-shadow: none; }
.module-card.rec .mk { color: #fff; box-shadow: none; }
.module-card.rec .mk::after, .module-card.inv .mk::after, .module-card.rpt .mk::after { background: #fff; opacity: .8; }
.module-card.rpt .mk { background: linear-gradient(145deg, #7d60b4, #6b4fa0); color: #fff; box-shadow: none; }

/* home: modules down the left, weekly sales in the middle, logo banner on the right */
.home-grid { display: grid; grid-template-columns: minmax(0, 440px) minmax(440px, 640px) minmax(320px, 440px);
  grid-template-rows: auto 1fr; column-gap: 20px; row-gap: 20px; align-items: start; }
.home-grid > * { grid-column: 1; min-width: 0; }
.home-grid > .modules { grid-row: 1; align-content: start; }
.home-grid > .modules-hint { grid-row: 2; }
.home-grid > .sales-col { grid-column: 2; grid-row: 1 / span 2; }
.home-grid > .hero { grid-column: 3; grid-row: 1; }
/* not wide enough for three columns: banner drops under the sales card */
@media (max-width: 1550px) { .home-grid { grid-template-columns: minmax(0, 440px) minmax(440px, 640px); grid-template-rows: auto auto 1fr; }
  .home-grid > .modules { grid-row: 1 / span 2; } .home-grid > .modules-hint { grid-row: 3; }
  .home-grid > .sales-col { grid-row: 1; } .home-grid > .hero { grid-column: 2; grid-row: 2; } }
@media (max-width: 1150px) { .home-grid { grid-template-columns: minmax(0, 900px); grid-template-rows: none; }
  .home-grid > * { grid-column: 1 !important; grid-row: auto !important; } }
.home-grid .hero { margin-bottom: 0; max-width: none; }
.home-grid .modules { grid-template-columns: 1fr; gap: 12px; width: 100%; max-width: 440px; }
.home-grid .hero { gap: 16px; padding: 16px 18px; }
.home-grid .hero-logo { width: 96px; height: 96px; border-radius: 20px; }
.home-grid .hero h1 { font-size: 26px; }
.home-grid .hero p { font-size: 12.5px; }
.home-grid .hero-circuit { width: 36%; }
/* home: drag to reorder modules */
.modules [data-mod] { cursor: grab; }
.modules [data-mod]:active { cursor: grabbing; }
.modules .module-card.dragging { opacity: .35; outline: 2px dashed var(--accent); outline-offset: 2px; transform: none; box-shadow: none; }
.modules-hint { font-size: 11px; color: var(--muted); max-width: 440px; margin-top: -8px; }
.modules-hint a { margin-left: 6px; }
.s-Accrual { background: var(--spark-soft); color: #a85a0c; }
.s-Reversal { background: #eef1f5; color: #4b5866; }
/* accruals: fixed or % of Ops Statement lines */
.seg { display: flex; gap: 16px; flex-wrap: wrap; padding: 4px 0; }
.seg label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text); font-weight: 400; }
.pct-in { display: flex; align-items: center; gap: 4px; }
.pct-in input { width: 90px; }
.base-list { max-height: 210px; overflow-y: auto; border: 1px solid var(--line); border-radius: 4px; padding: 4px 8px; background: #fff; margin-top: 4px; }
.base-list label { display: flex; gap: 6px; align-items: center; padding: 2px 0; font-size: 12px; font-weight: 400; color: var(--text); }
.pct-chip { display: inline-block; font-weight: 700; color: var(--accent-2); background: var(--accent-soft); border-radius: 4px; padding: 0 5px; }

/* module icons: brand line art on the module's tile colour */
.module-card .mk::after { display: none; }
.module-card .mk .mod-ico { width: 40px; height: 40px; overflow: visible; }
.mod-ico .spark { fill: var(--spark); filter: drop-shadow(0 0 3px rgba(240,138,36,.7)); }
.mod-ico .node { fill: currentColor; }
.module-card.inv .mk, .module-card.rpt .mk { color: #fff; }
.module-card.rec .mk { color: #fff; }
.module-card.rec .mod-ico .spark { fill: var(--navy); filter: drop-shadow(0 0 2px rgba(255,255,255,.8)); }
.module-card .mk .mod-ico { filter: drop-shadow(0 1px 1px rgba(0,0,0,.18)); }
.module-card:not(.inv):not(.rec):not(.rpt):not(.soon) .mk .mod-ico { filter: drop-shadow(0 0 4px rgba(95,214,224,.45)); }

/* in-module Home link: a larger light-theme button with a house icon at the top of the side nav */
.sidenav a.nav-home { display: grid; grid-template-columns: 26px 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center;
  margin: 6px 10px 12px; padding: 9px 12px; border-radius: 10px; border: 1px solid #bfe3e6; border-left: 3px solid var(--accent);
  color: var(--navy); text-decoration: none; background: #fff; box-shadow: 0 1px 3px rgba(16,26,43,.08);
  transition: box-shadow .15s, transform .15s, background .15s; }
.sidenav a.nav-home:hover { background: var(--accent-soft); transform: translateY(-1px); box-shadow: 0 3px 10px rgba(13,127,138,.18); }
.sidenav a.nav-home svg { grid-row: 1 / 3; width: 26px; height: 26px; fill: none; stroke: var(--accent); stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round; }
.sidenav a.nav-home span { font-size: 15px; font-weight: 700; letter-spacing: .02em; line-height: 1.1; }
.sidenav a.nav-home small { font-size: 10px; color: var(--accent); text-transform: uppercase; letter-spacing: .08em; line-height: 1.2; }
.sidenav a.nav-home.active::after { display: none; }
@media (max-width: 900px) {
  .sidenav a.nav-home { margin: 2px 6px 2px 0; padding: 5px 10px; grid-template-columns: 20px auto; }
  .sidenav a.nav-home svg { width: 20px; height: 20px; } .sidenav a.nav-home small { display: none; }
}

/* home: sales week to date (Micros), then period / year to date below it */
.sales-col { display: grid; gap: 20px; }
.sales-sub { font-size: 11px; color: var(--muted); margin-top: 3px; }
.sales-tabs { display: flex; width: fit-content; margin-top: 10px; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.sales-tabs button { border: 0; border-radius: 0; background: #fff; color: var(--muted); font-size: 12px; font-weight: 600; padding: 5px 11px; cursor: pointer; box-shadow: none; }
.sales-tabs button + button { border-left: 1px solid var(--line); }
.sales-tabs button.on { background: var(--accent); color: #fff; }
.sales-card { --ty: #0d7f8a; --ly: #9aa9b8; background: #fff; border: 1px solid var(--line); border-top: 3px solid var(--accent); border-radius: 10px;
  padding: 14px 16px 12px; font-variant-numeric: tabular-nums; }
.sales-card h2 { margin: 0; font-size: 15px; color: var(--navy); }
.sales-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.sales-nav { display: flex; align-items: center; gap: 4px; }
.sales-nav button.icon { font-size: 16px; line-height: 1; padding: 3px 9px; }
.sales-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 12px 0 10px; }
.sales-stat { border: 1px solid var(--line-soft); border-radius: 8px; padding: 10px 12px; background: var(--row-alt); }
.sales-stat .k { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; color: var(--navy); }
.sales-stat .when, .sales-stat .ly { font-size: 11px; color: var(--muted); }
.sales-stat .v { font-size: 24px; font-weight: 700; color: var(--navy); margin: 4px 0 0; }
.sales-stat .sv { margin-top: 4px; font-size: 13px; }
.sv { display: inline-flex; align-items: baseline; gap: 4px; font-weight: 600; white-space: nowrap; }
.sv i { font-style: normal; font-size: 9px; }
.sv small { font-weight: 600; margin-left: 4px; }
.sv.good { color: var(--ok); } .sv.bad { color: var(--err); } .sv.flat { color: var(--muted); }
.sales-plot { position: relative; }
.sales-legend { display: flex; gap: 14px; align-items: center; font-size: 11px; color: var(--muted); }
.sales-legend span:first-child { margin-right: auto; font-weight: 700; color: var(--navy); text-transform: uppercase; letter-spacing: .05em; }
.sales-card i.ty, .sales-card i.ly { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; background: var(--ty); }
.sales-card i.ly { background: var(--ly); }
.sales-chart { display: block; width: 100%; height: auto; margin-top: 4px; }
.sales-chart .g { stroke: var(--line-soft); stroke-width: 1; } .sales-chart .g.base { stroke: var(--line); }
.sales-chart .ax { font-size: 10px; fill: var(--muted); } .sales-chart .day { font-weight: 600; fill: var(--text); }
.sales-chart .day.on { fill: var(--accent); font-weight: 800; }
.sales-chart .ty { fill: var(--ty); } .sales-chart .ly { fill: var(--ly); }
.sales-chart .today { fill: var(--accent-soft); opacity: .7; }
.sales-chart .hit { fill: transparent; } .sales-chart .hit:hover { fill: rgba(22,35,58,.05); }
.sales-tip { position: absolute; z-index: 5; pointer-events: none; background: #fff; border: 1px solid var(--line); border-radius: 6px;
  box-shadow: 0 6px 18px rgba(16,26,43,.16); padding: 7px 10px; font-size: 12px; min-width: 170px; }
.sales-tip div { display: flex; align-items: center; margin-top: 3px; color: var(--muted); }
.sales-tip div > span { margin-left: auto; padding-left: 14px; color: var(--text); font-weight: 600; }
.sales-tip div > .sv.good { color: var(--ok); } .sales-tip div > .sv.bad { color: var(--err); }
table.sales-table { width: 100%; border-collapse: collapse; margin-top: 8px; }
table.sales-table th { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); text-align: left; padding: 5px 6px;
  border-bottom: 1px solid var(--line); }
table.sales-table td { padding: 5px 6px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
table.sales-table td:first-child { font-weight: 600; color: var(--navy); }
table.sales-table .num { text-align: right; }
table.sales-table td small { display: block; font-size: 11px; color: var(--muted); font-weight: 400; }
table.sales-table td .sv { flex-direction: column; align-items: flex-end; gap: 0; font-size: 12px; }
table.sales-table td .sv i { display: none; }
table.sales-table td .sv small { font-weight: 400; color: inherit; margin: 0; }
.sales-foot { margin-top: 8px; font-size: 11px; color: var(--muted); line-height: 1.5; }
.sales-target { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; padding: 9px 12px;
  border: 1px solid #f3cf9f; border-left: 4px solid var(--spark); border-radius: 8px; background: var(--spark-soft); color: var(--navy); }
.sales-target span { font-weight: 700; text-transform: uppercase; letter-spacing: .05em; font-size: 12px; }
.sales-target b { font-size: 20px; text-align: right; line-height: 1.1; }
.sales-target small { display: block; font-size: 11px; font-weight: 400; color: var(--muted); text-transform: none; letter-spacing: 0; }

/* GL Export / POS → GL Mapping */
table.glweeks tr.cur td { background: #fff7e6; }
table.glweeks tr.muted td { color: var(--muted); }
.posgl { display: grid; grid-template-columns: repeat(auto-fill, minmax(460px, 1fr)); gap: 12px; align-items: start; }
.posgl .panel { margin: 0; }
.posgl tr.changed td { background: #fff7e6; }
@media (max-width: 600px) { .posgl { grid-template-columns: 1fr; } }

/* inventory count: LBW / Food card, area jump bar; count sheets: shelf position */
.card .v.split-v { display: grid; grid-template-columns: auto auto; justify-content: start; gap: 0 10px; align-items: baseline; font-size: 18px; }
.card .v.split-v small { font-size: 11px; color: var(--muted, #667); font-weight: 600; text-transform: uppercase; }
.card .v.split-v b { text-align: right; font-variant-numeric: tabular-nums; }
.area-jump { display: flex; gap: 8px; align-items: baseline; margin-bottom: 8px; font-size: 12px; }
.area-jump .jump-label { white-space: nowrap; }
.area-jump .jump-list { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
table.count-sheet .unit-btn { background: none; border: none; padding: 0; font: inherit; color: inherit; cursor: pointer; text-align: left; }
table.count-sheet .unit-btn .caret { color: #99a; font-size: 10px; }
table.count-sheet .unit-btn:hover { color: var(--accent); text-decoration: underline dotted; }
table.count-sheet .unit-btn.changed { color: #b35c00; font-weight: 600; }
table.count-sheet input[data-cuq] { width: 100%; }
.area-jump .jump-group { display: inline-flex; gap: 4px; align-items: center; }
.area-jump .jump-group b { color: var(--navy); margin-right: 2px; }
.area-jump button { padding: 3px 8px; font-size: 12px; }
.area-jump button i { font-style: normal; color: #889; font-size: 11px; }
.area-jump button.done { background: #e6f4ea; border-color: #9fd0ae; }
.area-jump button.done i { color: #2e7d46; }
table.sheet-items input.pos-in { width: 44px; padding: 2px 4px; color: #667; }
table.sheet-items tr.flash td { animation: rowflash 1.6s ease-out; }
@keyframes rowflash { from { background: #fff3c4; } to { background: transparent; } }
.add-item .inline-pos { margin-left: 10px; font-size: 12px; color: #667; }
@media print { .area-jump { display: none !important; } table.count-sheet button.unit-btn { display: inline !important; } table.count-sheet .unit-btn .caret { display: none; } }

/* item prices: items a count counted without a price, and any item without one */
table.grid tr.row-flag td { background: #fff1c2 !important; }
table.grid tr.row-flag td:first-child { box-shadow: inset 4px 0 0 #e0a000; font-weight: 600; }
table.grid tr.row-noprice td { background: #fff9e8; }
.note.warn-note { background: #fff6d6; border-color: #f0d27a; }

/* food & LBW cost report */
table.fc-table td { font-variant-numeric: tabular-nums; }
table.fc-table tfoot td { position: static; }
table.fc-table tr.fc-sel td { background: #e8f4f1 !important; font-weight: 600; }
table.iv-areas tr.iv-loc td { background: var(--ink, #1f2a37) !important; color: #fff; font-weight: 700; letter-spacing: .02em; }
table.iv-areas tr.iv-area td { background: #f3f5f8 !important; font-weight: 600; }
table.iv-areas tr.iv-area:hover td { background: #e9edf2 !important; }
/* Inventory Variance › By GL code: squeezed to fit a normal screen */
table.iv-gl { font-size: 12.5px; }
table.iv-gl th { white-space: normal; padding: 4px 5px; vertical-align: bottom; line-height: 1.2; }
table.iv-gl td { padding: 3px 5px; }
table.iv-gl td.iv-item { max-width: 210px; }
table.iv-gl td.iv-where { max-width: 130px; }
table.iv-gl .iv-tip { color: #b7791f; cursor: help; }
details.fc-why { border-top: 1px solid var(--line-soft); padding: 8px 0; }
details.fc-why summary { cursor: pointer; }
.fc-scroll { overflow-x: auto; }

/* Product Mix */
h2.px-master { font-size: 16px; margin: 18px 0 6px; color: var(--navy); }
h2.px-master .muted { font-size: 13px; font-weight: 500; }
details.px-dept { margin: 0 0 8px; border: 1px solid var(--line); border-radius: 4px; background: #fff; }
details.px-dept > summary { cursor: pointer; padding: 7px 10px; }
details.px-dept > summary .muted { margin-left: 6px; font-size: 12px; }
details.px-dept table { margin: 0; }
table.px-table th:nth-child(1), table.px-table td:nth-child(1) { width: 80px; }
table.px-table th:nth-child(2), table.px-table td:nth-child(2) { min-width: 220px; }
table.px-table th:nth-child(n+3), table.px-table td:nth-child(n+3) { width: 84px; }
table.px-table tr.px-sub td { font-weight: 700; border-top: 2px solid var(--line); }
.px-tag { font-size: 10px; text-transform: uppercase; letter-spacing: .04em; background: #fff1cc; color: #8a5a00; border-radius: 3px; padding: 1px 5px; margin-left: 4px; }

/* General Ledger */
.module-card.gl { border-top-color: #1f6f8b; }
.module-card.gl .mk { background: linear-gradient(145deg, #2b86a6, #1f6f8b); color: #fff; box-shadow: none; }
.module-card.gl .mk::after { background: #fff; opacity: .8; }
table.gl-ledger th:nth-child(2), table.gl-ledger td:nth-child(2) { min-width: 200px; }
table.gl-ledger tr.gl-type td { background: var(--line-soft, #f1f3f6); font-weight: 700; color: var(--navy); padding-top: 10px; }
table.gl-ledger td.gl-cell { cursor: pointer; }
table.gl-ledger td.gl-cell:hover { background: #e8f4f1; }
table.gl-ledger td.gl-cell.sel { background: #cfeae3 !important; outline: 1px solid #2a9a83; }

/* Link Lines: one line at a time, with its Vendor Item box */
.grid.lines tr.unconv td:first-child { box-shadow: inset 4px 0 0 var(--err); }
.grid.lines tr.unconv [data-f="recv"] { border-color: var(--err); background: var(--err-soft); }
.unconv-key { padding: 0 4px; border-radius: 3px; box-shadow: inset 4px 0 0 var(--err); background: var(--err-soft); }
.ll-split { display: grid; grid-template-columns: 300px 1fr; gap: 12px; min-height: 420px; }
.ll-list { max-height: 64vh; overflow: auto; border: 1px solid var(--line); border-radius: 6px; padding: 4px; }
.ll-row { display: grid; grid-template-columns: 26px 1fr; gap: 0 6px; width: 100%; text-align: left; margin: 0 0 3px;
  padding: 5px 6px; border: 1px solid var(--line-soft); border-left: 4px solid var(--line); border-radius: 4px; background: var(--panel); cursor: pointer; }
.ll-row .ll-n { grid-row: span 2; color: var(--muted); }
.ll-row .ll-d { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ll-row .ll-st { font-size: 11px; color: var(--muted); }
.ll-row.cur { outline: 2px solid var(--accent); }
.ll-row.unmatched { border-left-color: #e58a9c; background: #fde8ec; }
.ll-row.guess { border-left-color: #e0b400; background: #fff6d6; }
.ll-row.unconv { border-left-color: var(--err); background: var(--err-soft); }
.ll-row.costoff { border-left-color: var(--spark); background: var(--spark-soft); }
.ll-row.done { border-left-color: var(--ok); background: var(--ok-soft); }
.ll-row.done .ll-st { color: var(--ok); font-weight: 600; }
.ll-box { max-height: 64vh; overflow: auto; }
.ll-inv { padding: 8px 10px; background: var(--row-alt); border: 1px solid var(--line-soft); border-radius: 6px; margin-bottom: 8px; }
.vi-box { border: 1px solid var(--line); border-radius: 6px; margin: 10px 0 0; padding: 6px 10px 10px; }
.vi-box legend { font-weight: 600; padding: 0 4px; }
.ll-conv { margin-top: 8px; padding: 6px 8px; border-radius: 4px; font-weight: 600; }
.ll-conv.ok { background: var(--ok-soft); color: var(--ok); }
.ll-conv.bad { background: var(--err-soft); color: var(--err); }
.ll-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 10px; }

/* Labor Reports › Payroll Report */
table.pr-table th, table.pr-table td { white-space: nowrap; }
table.pr-table td:nth-child(1) { width: 96px; }
table.pr-table td:nth-child(4) { min-width: 100px; }
table.pr-table tr.pr-emp td { background: var(--navy) !important; color: #fff; font-weight: 700; }
table.pr-table tr.pr-emp td .muted { color: #c7d3dc; }
.pr-ed { color: var(--spark); }

/* Sales Reports › POS Sales Report */
.ps-cols { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.ps-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; align-items: start; margin-top: 14px; }
.ps-panel { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; margin-bottom: 14px; }
.ps-grid .ps-panel { margin-bottom: 0; }
.ps-panel h3 { margin: 0; padding: 6px 10px; background: var(--navy); color: #fff; font-size: 12.5px; text-align: center; font-weight: 600; }
.ps-panel h3 span { font-weight: 400; color: #c7d3dc; }
.ps-panel.teal h3 { background: var(--accent); }
.ps-panel.teal2 h3 { background: var(--accent-2); }
.ps-panel.spark h3 { background: var(--spark); }
.ps-panel.slate h3 { background: var(--navy-2); }
.ps-panel.grey h3 { background: var(--muted); }
table.ps-table th { position: static; }
table.ps-table tfoot td { position: static; }
.ps-misc { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 18px; padding: 8px 10px; }
.ps-misc h4 { margin: 4px 0 2px; color: var(--accent); font-size: 12px; }
.ps-ml { display: flex; justify-content: space-between; padding: 2px 0 2px 8px; border-bottom: 1px solid var(--line-soft); }
.ps-ml.b { font-weight: 700; }
@media (max-width: 1100px) { .ps-cols { grid-template-columns: 1fr; } }

/* Photo Inbox: number of photos waiting for review */
.nav-count { display: inline-block; min-width: 18px; padding: 0 6px; margin-left: 6px; border-radius: 9px; background: #d32f2f;
  color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; vertical-align: 1px; }
.nav-count[hidden] { display: none; }

/* Tools module */
.module-card.tools { border-top-color: #b5472f; }
.module-card.tools .mk { background: linear-gradient(145deg, #cf6048, #b5472f); color: #fff; box-shadow: none; }

/* Tools: Guest Check Reproduction */
.gc-filters .gc-q input { min-width: 300px; font-size: 15px; padding: 6px 10px; }
.gc-quick { display: flex; gap: 4px; flex-wrap: wrap; }
.gc-quick button.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-2); font-weight: 600; }
.gc-help { font-size: 12px; margin: 0 2px 10px; }
.gc-help b { color: var(--text); font-weight: 600; }
.gc-cols { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 16px; align-items: start; }
.gc-cols aside { position: sticky; top: 56px; max-height: calc(100vh - 68px); overflow: auto; }
.gc-grid { max-height: calc(100vh - 235px); }
.gc-grid tr.sel td { background: var(--accent-soft); }
.gc-grid tr:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.gc-l4 { font-variant-numeric: tabular-nums; font-weight: 700; }
.gc-hit { font-size: 11px; color: var(--accent-2); overflow: hidden; text-overflow: ellipsis; }
.gc-empty div { margin-top: 10px; }
.gc-none { border: 1px dashed var(--line); border-radius: 4px; padding: 40px 16px; text-align: center; }
.gc-bar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 10px; margin-bottom: 10px; }
.gc-mods { display: flex; gap: 6px; align-items: center; font-size: 12px; }
.receipt { background: #fff; border: 1px solid var(--line); border-radius: 2px; padding: 20px 22px 24px; box-shadow: 0 3px 10px rgba(16,26,43,.1);
  font: 13px/1.45 "Courier New", Courier, ui-monospace, monospace; color: #1a1a1a; }
.rc { display: flex; justify-content: space-between; gap: 10px; }
.rc span { min-width: 0; overflow-wrap: anywhere; }
.rc b { font-weight: inherit; white-space: nowrap; }
.rc-mod { padding-left: 18px; font-size: 12px; }
.rc-title, .rc-center, .rc-copy, .rc-small { justify-content: center; text-align: center; }
.rc-title { font-size: 20px; font-weight: 700; letter-spacing: .06em; }
.rc-copy { font-weight: 700; }
.rc-total { font-size: 16px; font-weight: 700; margin-top: 2px; }
.rc-small { font-size: 11px; color: var(--muted); }
.rc-gap { height: 10px; }
.rc-rule { border-top: 1px dashed #8a8a8a; margin: 7px 0; }
@media (max-width: 1100px) { .gc-cols { grid-template-columns: minmax(0, 1fr); } .gc-cols aside { position: static; max-height: none; } .gc-grid { max-height: 50vh; } }

/* Guest check payment detail: authorization vs final */
.gc-pay table { width: 100%; border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.gc-pay th { text-align: left; font-size: 11px; color: var(--muted); padding: 0 4px 4px; border-bottom: 1px solid var(--line); }
.gc-pay td { padding: 5px 4px 1px; vertical-align: top; }
.gc-pay .r { text-align: right; }
.gc-pay tbody { border-bottom: 1px solid var(--line-soft); }
.gc-pay tfoot td { font-weight: 700; padding-top: 6px; }
.gc-pay .pd-sub td { padding: 0 4px 6px; font-size: 11px; color: var(--muted); }
.gc-pay .pd-sub span { display: block; }
.gc-pay .pd-note { font-weight: 600; color: var(--text); }
.gc-pay tbody.pd-bad .pd-note { color: var(--err); }
.gc-pay tbody.pd-warn .pd-note { color: var(--warn); }
.gc-pay tbody.pd-ok .pd-note { color: var(--ok); }
.pd-head { padding: 8px 10px; border-radius: 4px; background: #eef1f5; margin-bottom: 10px; line-height: 1.4; }
.pd-head.pd-bad { background: var(--err-soft); } .pd-head.pd-bad b { color: var(--err); }
.pd-head.pd-warn { background: var(--warn-soft); } .pd-head.pd-warn b { color: var(--warn); }
.pd-head.pd-ok { background: var(--ok-soft); } .pd-head.pd-ok b { color: var(--ok); }
.pd-rev { margin-top: 10px; font-size: 12px; }
.pd-rev div { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); }

/* POS Server Report */
table.sv-table th, table.sv-table td { white-space: nowrap; font-variant-numeric: tabular-nums; }
table.sv-table tfoot td { position: static; border-top: 2px solid var(--line); }
table.sv-table th.sv-th { cursor: pointer; }
table.sv-table th.sv-th:hover { color: var(--accent); }
.sv-step { display: flex; gap: 4px; }
.sv-grid { margin: 10px; }

/* Deposits */
table.deposits td { vertical-align: top; }
.dep-bag { display: flex; gap: 6px; align-items: center; margin-bottom: 4px; }
.dep-bag [data-a] { width: 100px; text-align: right; }
.dep-bag [data-slip] { width: 110px; }
.dep-bag [data-n] { flex: 1; min-width: 120px; }
.dep-why { font-size: 11px; max-width: 220px; margin-left: auto; white-space: normal; }
tr.dep-missing td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
@media (max-width: 760px) { .dep-bag { flex-wrap: wrap; } .dep-why { display: none; } }

/* ---------------------------------------------------------------- sign-in, user menu, Users page */
body.signed-out .shell, body.signed-out .top-right, body.signed-out #module-name { display: none; }
.top-right { position: relative; display: flex; align-items: center; gap: 14px; }
.user-chip { background: transparent; border: 1px solid #3d5f8c; color: #fff; display: flex; align-items: center; gap: 8px;
  padding: 3px 10px; border-radius: 16px; }
.user-chip:hover { background: var(--navy-2); }
.uc-name { font-weight: 600; }
.uc-role { font-size: 11px; color: #c9d6e6; }
.uc-caret { font-size: 10px; color: #c9d6e6; }
.user-menu { position: absolute; right: 0; top: 38px; background: #fff; border: 1px solid var(--line); border-radius: 6px;
  box-shadow: 0 8px 24px rgba(22,35,58,.18); min-width: 200px; padding: 4px; z-index: 40; display: flex; flex-direction: column; }
.user-menu[hidden] { display: none; }
.user-menu button { border: none; text-align: left; padding: 8px 12px; border-radius: 4px; background: #fff; }
.user-menu button:hover { background: var(--row-hover); }
.auth-back { min-height: calc(100vh - 44px); display: flex; align-items: flex-start; justify-content: center; padding: 8vh 16px 40px; }
.auth-card { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  overflow: hidden; box-shadow: 0 10px 30px rgba(22,35,58,.12); }
.auth-brand { background: var(--navy); padding: 18px 22px; display: flex; align-items: center; gap: 12px; }
.auth-body { padding: 20px 22px 22px; }
.auth-body h1 { font-size: 18px; margin: 0 0 6px; color: var(--navy); }
.auth-body form { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.auth-body input:not([type=checkbox]) { font-size: 16px; padding: 8px 10px; }
.auth-note { color: var(--muted); margin: 0 0 6px; }
.auth-hint { color: var(--muted); font-size: 12px; margin: -6px 0 0; }
.auth-warn { background: var(--warn-soft); color: var(--warn); padding: 8px 10px; border-radius: 4px; }
.auth-err { background: var(--err-soft); color: var(--err); padding: 8px 10px; border-radius: 4px; }
.auth-err[hidden], .auth-hint[hidden], [data-devname][hidden] { display: none; }
.auth-go { padding: 9px 12px; font-size: 15px; }
button.link { border: none; background: none; color: var(--accent); padding: 4px; margin-top: 8px; }
button.link:hover { background: none; text-decoration: underline; }
.pin-people { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0 6px; }
.pin-people button { padding: 14px 8px; font-size: 15px; font-weight: 600; }
.pin-dots { display: flex; justify-content: center; gap: 14px; margin: 16px 0; }
.pin-dots i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--navy); }
.pin-dots i.on { background: var(--navy); }
.pin-dots.shake { animation: pinshake .35s; }
@keyframes pinshake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.pin-pad button { padding: 16px 0; font-size: 22px; font-weight: 600; border-radius: 8px; text-align: center; }
.form-grid.one { grid-template-columns: 1fr; }
.field .inline { display: flex; gap: 6px; }
.field .inline input { flex: 1; }
.role-help { color: var(--muted); font-size: 12px; }
.u-Active { background: var(--ok-soft); color: var(--ok); }
.u-Inactive { background: #eef1f5; color: var(--muted); }
.u-Locked { background: var(--err-soft); color: var(--err); }
.u-New { background: var(--warn-soft); color: var(--warn); }
@media (max-width: 600px) { .uc-role { display: none; } }

/* ---------------------------------------------------------------- per-role screens (Phase 2) */
/* A screen the role can look at but not change: a banner, and its save / post / delete / add buttons hidden. */
body.readonly #main::before { content: "View only. Your role can look at this screen but not change it."; display: block;
  background: var(--accent-soft); color: var(--navy); border: 1px solid #b9e3e6; border-radius: 4px; padding: 7px 12px; margin-bottom: 12px; font-weight: 600; }
body.readonly #main :is([data-save], [data-add], [data-del], [data-post], [data-postall], [data-unpost], [data-new], [data-sync], [data-reset],
  [data-pay], [data-commit], [data-archive], [data-activate], .post-date, button.danger, .page-head .toolbar .primary),
body.readonly #modal-root footer :is(.primary, .danger) { display: none !important; }
body.cant-ap_export :is([data-exp], [data-bexp], [data-selready]) { display: none !important; }
body.cant-count_post #main[data-page="count"] :is([data-post], [data-unpost]) { display: none !important; }
.home-grid.no-sales > .hero { grid-column: 2; }
@media (max-width: 1550px) { .home-grid.no-sales > .hero { grid-row: 1; } }
@media (max-width: 1150px) { .home-grid.no-sales > .hero { grid-column: 1; grid-row: auto; } }

/* ---------------------------------------------------------------- Roles & permissions grid */
.perm-wrap { overflow-x: auto; padding: 0; }
table.perm { border-collapse: collapse; width: 100%; min-width: 640px; }
table.perm th, table.perm td { padding: 6px 10px; border-bottom: 1px solid var(--line-soft); text-align: left; }
table.perm thead th { position: sticky; top: 0; background: #f8fafc; font-size: 12px; color: var(--navy); vertical-align: bottom; }
table.perm thead th small { display: block; font-weight: 400; color: var(--muted); }
table.perm thead th .link { margin: 0; padding: 0; font-weight: 700; font-size: 12px; }
table.perm .perm-group td { background: var(--bg); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
table.perm .perm-area { min-width: 260px; }
table.perm select { min-width: 92px; }
table.perm select.lv-none { color: var(--muted); background: #f4f6f8; }
table.perm select.lv-view { color: var(--accent-2); background: var(--accent-soft); }
table.perm select.lv-change { color: var(--ok); background: var(--ok-soft); font-weight: 600; }
table.perm .perm-owner { color: var(--muted); font-size: 12px; }
table.perm td.perm-edited { background: var(--spark-soft); }

/* ---------------------------------------------------------------- Activity and record history */
.stamp { font-size: 12px; color: var(--muted); margin: -6px 0 10px; }
.stamp b { color: var(--text); font-weight: 600; }
.stamp .link { margin: 0; padding: 0 2px; font-size: 12px; }
.act-meta { margin-bottom: 10px; }
.chg { border: 1px solid var(--line-soft); border-radius: 4px; margin-bottom: 8px; }
.chg-h { background: #f8fafc; padding: 5px 8px; font-size: 12px; border-bottom: 1px solid var(--line-soft); }
.chg-t { border-collapse: collapse; width: 100%; font-size: 12px; }
.chg-t td { padding: 3px 8px; vertical-align: top; word-break: break-word; }
.chg-t td:first-child { color: var(--muted); width: 28%; }
.chg-t td.old { color: var(--err); text-decoration: line-through; text-decoration-color: rgba(180,35,24,.4); }
.chg-t td.new { color: var(--ok); }
.hist-h { font-size: 12px; margin: 10px 0 4px; }
details.sent { margin-top: 8px; }
details.sent summary { cursor: pointer; color: var(--accent); }
details.sent pre { max-height: 320px; overflow: auto; background: #f8fafc; border: 1px solid var(--line-soft); padding: 8px; font-size: 11px; }

/* ---------------------------------------------------------------- Telegram bot */
table.kv { border-collapse: collapse; }
table.kv td { padding: 4px 12px 4px 0; vertical-align: top; }
table.kv td:first-child { color: var(--muted); white-space: nowrap; }
code.tg-code { font-size: 16px; background: #f4f6f8; padding: 3px 8px; border-radius: 4px; border: 1px solid var(--line); }

/* ---------------------------------------------------------------- phone app */
.nav-toggle, .quick-actions { display: none; }
.snap { display: flex; flex-direction: column; gap: 10px; }
.snap-big { display: block; text-align: center; padding: 14px 12px; font-size: 16px; border-radius: 8px; cursor: pointer; }
.snap .form-grid { grid-template-columns: 1fr; margin-top: 4px; }
.snap-status { text-align: center; padding: 18px 6px; }
.snap-result { text-align: left; line-height: 1.45; margin-bottom: 12px; }
.snap-next { justify-content: center; }
.spinner { width: 34px; height: 34px; margin: 0 auto 12px; border-radius: 50%; border: 4px solid var(--accent-soft);
  border-top-color: var(--accent); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 700px) {
  html { -webkit-text-size-adjust: 100%; }
  .topbar { padding: 0 8px; padding-top: env(safe-area-inset-top); height: calc(52px + env(safe-area-inset-top)); gap: 6px; }
  .nav-toggle { display: block; flex: none; background: none; border: 0; color: #fff; font-size: 22px; padding: 4px 8px; }
  body.home .nav-toggle, body.signed-out .nav-toggle { visibility: hidden; width: 0; padding: 0; }
  .brand { gap: 8px; min-width: 0; }
  .brand-mark { width: 30px; height: 30px; }
  .wordmark { font-size: 16px; }
  #company { display: none !important; }
  #module-name { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 30vw; }
  .top-right { gap: 6px; }
  .top-right label { font-size: 0; gap: 0; }
  .top-right select { max-width: 30vw; font-size: 13px; }
  .user-chip { padding: 3px 8px; }
  .uc-name { max-width: 22vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  /* the module menu slides in from the left */
  .shell { display: block; }
  .sidenav { position: fixed !important; top: 0; left: 0; bottom: 0; height: 100dvh !important; width: 270px; max-width: 85vw;
    z-index: 60; display: block !important; padding: calc(12px + env(safe-area-inset-top)) 0 30px; overflow-y: auto;
    transform: translateX(-105%); transition: transform .2s ease; box-shadow: 4px 0 24px rgba(0,0,0,.25); }
  .sidenav .nav-group { display: block !important; }
  .sidenav a { padding: 10px 20px; border-left: 3px solid transparent; }
  body.nav-open .sidenav { transform: none; }
  body.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(20,30,45,.45); z-index: 55; }

  main { padding: 12px 10px 60px; }
  .page-head h1 { font-size: 17px; }
  .page-head .toolbar { width: 100%; }
  input, select, textarea { font-size: 16px; }                      /* stops iPhone zooming into fields */
  button, .btn { min-height: 38px; }
  .form-grid { grid-template-columns: 1fr; }
  .filters .field { flex: 1 1 140px; }
  .filters .field input, .filters .field select { min-width: 0; width: 100%; }
  .grid-wrap { max-height: none; }
  .modal-back { padding: 0; align-items: stretch; }
  .modal { width: 100% !important; max-width: 100%; border-radius: 0; min-height: 100dvh; display: flex; flex-direction: column; }
  .modal .body { flex: 1; overflow-y: auto; }
  .modal footer { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
  .user-menu { position: fixed; right: 8px; top: calc(56px + env(safe-area-inset-top)); }

  /* home: everyday jobs first, big tap targets */
  .quick-actions { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
  .qa { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 6px; background: #fff;
    border: 1px solid var(--line); border-radius: 10px; font-size: 26px; color: var(--navy); text-decoration: none; font-family: inherit; }
  .qa span { font-size: 12px; font-weight: 600; }
  .home-grid .hero { display: none; }
  .home-grid .modules { max-width: none; }
  .module-card { padding: 12px; }
  .modules-hint { display: none; }
}
@media (max-width: 700px) {
  /* wide tables (invoice lines, count sheets…) scroll inside their box; the page itself stays phone-width */
  #main .panel, #main :has(> table:not(.grid)), #main :has(> table.lines) { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  #main img { max-width: 100%; height: auto; }
}
@media (max-width: 700px) {
  #main div { min-width: 0; }                      /* grid / flex boxes shrink to the phone instead of stretching the page */
  #main .ps-cols { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 700px) {
  .wordmark { white-space: nowrap; font-size: 15px; }
  .wordmark b { margin-left: .2em; }
  /* counting on a phone: item, count unit and quantity on screen; the price column is left out */
  .area-jump .jump-group { flex-wrap: wrap; }
  table.count-sheet th:nth-child(3), table.count-sheet td:nth-child(3) { display: none; }
  table.count-sheet th:nth-child(1), table.count-sheet td:nth-child(1) { width: 26px !important; padding-left: 4px; padding-right: 4px; }
  table.count-sheet td { white-space: normal; }
  table.count-sheet th:nth-child(4) { width: 110px !important; }
  table.count-sheet th:nth-child(5) { width: 88px !important; }
  table.count-sheet td select { max-width: 104px; }
  table.count-sheet td input { width: 80px; padding: 8px 6px; text-align: right; }
}

/* PDF / photo viewer (app.js fileViewer): full screen, with a Close bar */
body.fv-open { overflow: hidden; }
.file-viewer { position: fixed; inset: 0; z-index: 300; background: #525659; display: flex; flex-direction: column; }
.fv-bar { display: flex; align-items: center; gap: 10px; background: var(--navy, #16233a); color: #fff;
  padding: calc(8px + env(safe-area-inset-top)) 12px 8px; }
.fv-bar .fv-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fv-bar .fv-acts { display: flex; gap: 6px; }
.fv-bar button, .fv-bar .btn { white-space: nowrap; }
.fv-close { font-weight: 700; min-height: 40px; padding: 0 14px; }
.fv-body { flex: 1; overflow: auto; -webkit-overflow-scrolling: touch; display: flex; flex-direction: column;
  align-items: center; gap: 10px; padding: 8px 8px calc(20px + env(safe-area-inset-bottom)); }
.fv-page { background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.4); max-width: 100%; height: auto; }
.fv-frame { flex: 1; width: 100%; border: 0; background: #fff; }
.fv-body:has(.fv-frame) { padding: 0; }
.fv-img { max-width: 100%; background: #fff; cursor: zoom-in; }
.fv-img.zoom { max-width: none; cursor: zoom-out; }
.fv-msg { color: #fff; margin: 40px 16px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.fv-inline { padding: 30px 12px; text-align: center; }
@media (max-width: 700px) { .fv-bar .fv-title { font-size: 14px; } }
/* inventory count on a phone: floating button back to the area jump list (app.js countPage) */
.jump-back { position: fixed; right: 14px; bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 30;
  background: var(--navy); color: #fff; border-color: var(--navy); border-radius: 20px; padding: 0 16px;
  box-shadow: 0 3px 10px rgba(0,0,0,.25); }
.jump-back[hidden] { display: none; }
.area-jump, table.count-sheet tr.area-head { scroll-margin-top: 8px; }

/* ---- Ask Higgins: chat panel on the right; full screen on phones */
.higgins-btn { background: var(--accent); border: 1px solid var(--glow); color: #fff; border-radius: 16px; padding: 4px 12px;
  display: flex; align-items: center; gap: 6px; font: inherit; font-weight: 600; cursor: pointer; }
.higgins-btn:hover { background: var(--accent-2); }
.hg-open .higgins-btn { background: var(--glow); color: var(--navy); }
.higgins { position: fixed; top: 52px; right: 0; bottom: 0; width: 420px; max-width: 100vw; z-index: 40; background: var(--panel);
  border-left: 1px solid var(--line); box-shadow: -6px 0 24px rgba(20,30,45,.14); display: flex; flex-direction: column; }
@media (min-width: 1100px) { body.hg-open .shell { margin-right: 420px; } }
.hg-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px 8px 14px;
  border-bottom: 1px solid var(--line); background: var(--accent-soft); }
.hg-title { display: flex; align-items: baseline; gap: 6px; color: var(--navy); min-width: 0; }
.hg-title b { font-size: 15px; }
.hg-title small { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hg-actions { display: flex; gap: 4px; flex: none; }
.hg-actions button { font-size: 12px; padding: 3px 8px; }
.hg-x { font-size: 15px !important; }
.hg-list { border-bottom: 1px solid var(--line); max-height: 45%; overflow-y: auto; padding: 6px; background: var(--row-alt); }
.hg-list button { display: flex; flex-direction: column; align-items: flex-start; width: 100%; text-align: left; border: 0;
  background: none; padding: 6px 8px; border-radius: 4px; cursor: pointer; font: inherit; }
.hg-list button:hover, .hg-list button.on { background: var(--row-hover); }
.hg-list button span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.hg-list small { color: var(--muted); }
.hg-msgs { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.hg-msg { max-width: 92%; padding: 8px 11px; border-radius: 10px; line-height: 1.45; overflow-wrap: anywhere; }
.hg-msg p { margin: 0 0 6px; } .hg-msg p:last-child { margin-bottom: 0; }
.hg-msg ul, .hg-msg ol { margin: 4px 0 6px; padding-left: 20px; }
.hg-msg code { background: var(--row-alt); padding: 0 3px; border-radius: 3px; }
.hg-me { align-self: flex-end; background: var(--navy); color: #fff; border-bottom-right-radius: 3px; }
.hg-bot { align-self: flex-start; background: var(--row-alt); border: 1px solid var(--line-soft); border-bottom-left-radius: 3px; }
.hg-src { margin-top: 6px; font-size: 11px; color: var(--muted); }
.hg-err { color: var(--err); background: var(--err-soft); border-color: #f5c2bd; }
.hg-table { overflow-x: auto; margin: 4px 0 6px; }
.hg-table table { border-collapse: collapse; font-size: 12px; }
.hg-table th, .hg-table td { border: 1px solid var(--line); padding: 3px 6px; text-align: left; white-space: nowrap; }
.hg-table th { background: var(--accent-soft); }
.hg-status { align-self: flex-start; color: var(--muted); font-style: italic; display: flex; align-items: center; gap: 8px; }
.hg-dots { width: 22px; height: 6px; background: radial-gradient(circle, var(--accent) 2.5px, transparent 3px) 0 0 / 8px 6px repeat-x;
  animation: hgpulse 1s infinite alternate; }
@keyframes hgpulse { from { opacity: .3; } to { opacity: 1; } }
.hg-hello { color: var(--text); line-height: 1.5; }
.hg-suggest { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
.hg-suggest button { text-align: left; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 6px 12px;
  cursor: pointer; font: inherit; color: var(--accent-2); }
.hg-suggest button:hover { background: var(--accent-soft); }
.hg-ask { display: flex; gap: 6px; padding: 8px; border-top: 1px solid var(--line); background: #fff;
  padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
.hg-ask textarea { flex: 1; resize: none; font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; }
.hg-ask button { align-self: stretch; }
@media (max-width: 700px) {
  .higgins { top: 0; width: 100vw; z-index: 70; padding-top: env(safe-area-inset-top); }
  .higgins-btn { padding: 4px 8px; }
  .higgins-btn .hg-label { display: none; }
  .hg-title small { display: none; }
}
