:root {
  --blue: #16386b; --blue-light: #eaf0f9; --blue-mid: #2d5aa6; --red: #b91c1c; --green: #15803d; --amber: #b45309; --amber-light: #fff7ed;
  --ink: #1c2434; --muted: #6b7486; --line: #e2e6ee; --bg: #f4f6fa; --card: #fff; --radius: 12px; --side: 220px;
  /* safe-area insets, read once from iOS and corrected by App.fixInsets (the Duo reports a top inset while its status bar sits on the side) */
  --sat: env(safe-area-inset-top, 0px); --sar: env(safe-area-inset-right, 0px); --sab: env(safe-area-inset-bottom, 0px); --sal: env(safe-area-inset-left, 0px);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.4; }
a { color: var(--blue-mid); text-decoration: none; }
a:hover { text-decoration: underline; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }   /* iOS Safari otherwise enlarges text in wide blocks on its own, which made wide form labels look like headings */
#app { display: grid; grid-template-columns: var(--side) 1fr; grid-template-rows: auto auto 1fr; min-height: 100vh; padding-left: var(--sal); padding-right: var(--sar); }
#sidebar { grid-row: 1 / span 3; background: var(--blue); color: #fff; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; height: 100dvh; padding-top: var(--sat); }
.brand { display: flex; align-items: center; gap: 10px; padding: 16px 16px 12px; border-bottom: 1px solid rgba(255,255,255,.15); }
.brand .logo { background: #fff; color: var(--blue); font-weight: 800; border-radius: 8px; padding: 6px 8px; font-size: 13px; letter-spacing: .5px; }
.brand b { display: block; font-size: 15px; } .brand small { opacity: .75; font-size: 11px; }
#nav { display: flex; flex-direction: column; padding: 10px 8px; gap: 2px; overflow-y: auto; flex: 1 1 auto; min-height: 0; -webkit-overflow-scrolling: touch; }   /* the menu scrolls on its own; the page scrolls separately */
#nav a { color: rgba(255,255,255,.88); padding: 8px 10px; border-radius: 8px; font-size: 13.5px; }
#nav a:hover { background: rgba(255,255,255,.1); text-decoration: none; }
#nav a.active { background: rgba(255,255,255,.18); color: #fff; font-weight: 600; }
#nav a.accent { background: #fff; color: var(--blue); font-weight: 700; margin: 4px 0 8px; }
#nav .navsec { display: flex; align-items: center; gap: 8px; font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: #f5c56b; padding: 16px 10px 5px; font-weight: 800; }
#nav .navsec::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, rgba(245,197,107,.55), rgba(245,197,107,0)); }
#nav .navsec + a { margin-top: 1px; }
.sidefoot { margin-top: auto; flex: 0 0 auto; padding: 12px 16px; font-size: 12px; opacity: .75; display: flex; justify-content: center; gap: 8px; } .sidefoot a { color: #fff; }
.picker { display: inline-flex; gap: 6px; flex-wrap: wrap; }
#leaveline { grid-column: 2; background: var(--card); border-bottom: 1px solid var(--line); padding: 4px 16px; font-size: 12px; color: var(--muted); line-height: 1.4; } #leaveline a { color: inherit; text-decoration: none; } #leaveline b { color: var(--green); } #leaveline.late b { color: var(--amber); }
#offlinebar { grid-column: 2; background: var(--amber-light); color: var(--amber); border-bottom: 1px solid #f0c27a; padding: 8px 16px; font-size: 13px; position: sticky; top: var(--topbar-h, 52px); z-index: 19; }   /* --topbar-h is measured by app.js, so the bar always sits right under the top bar whatever its height */ #offlinebar button { margin-left: 8px; }
#syncbtn { background: var(--blue-light); color: var(--blue); border-radius: 16px; padding: 5px 10px; font-size: 14px; order: 8; min-width: 36px; } #syncbtn.off { background: var(--amber-light); color: var(--amber); } #syncbtn.pending .pcount { background: var(--red); color: #fff; border-radius: 10px; padding: 0 6px; font-size: 11px; font-weight: 700; }
.evt.pending { opacity: .7; border: 1px dashed #fff; }
.badge.stalebadge { background: var(--amber-light); color: var(--amber); font-size: 11px; vertical-align: middle; margin-left: 6px; }
body.offline .no-offline { opacity: .5; pointer-events: none; }
.f > span { font-size: 12px; color: var(--muted); font-weight: 600; }
.chips.who { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.chips.who label.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 16px; font-size: 13px; color: var(--ink); background: var(--card); cursor: pointer; user-select: none; }
.chips.who label.chip.on { background: var(--blue); border-color: var(--blue); color: #fff; }
.chips.who label.chip input { display: none; }
#topbar { background: var(--card); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; padding: 0 16px; padding-top: var(--sat); position: sticky; top: 0; z-index: 20; min-width: 0; min-height: 52px; }   /* the page runs under the status bar (viewport-fit=cover); the bar pads itself by the real inset, so no blank band appears above it */   /* min-width 0: a grid item otherwise grows to its content and the page scrolls sideways on phones */
#menubtn { display: none; background: none; border: 0; font-size: 22px; color: var(--blue); padding: 4px 6px; line-height: 1; }
#globalsearch { position: relative; flex: 1; max-width: 520px; min-width: 0; flex: 1 1 120px; }
#commentbtn { background: var(--blue-light); color: var(--blue); border-radius: 16px; padding: 5px 10px; font-size: 15px; position: relative; order: 9; }
#noticewrap { position: relative; order: 8; } #noticebtn { background: var(--blue-light); color: var(--blue); border-radius: 16px; padding: 5px 10px; font-size: 15px; position: relative; }
#noticecount { position: absolute; top: -4px; right: -4px; background: var(--red); color: #fff; font-size: 10px; border-radius: 9px; padding: 1px 5px; font-weight: 700; }
#noticemenu { position: absolute; top: 110%; right: 0; width: 340px; max-width: calc(100vw - 20px); background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(20,30,60,.2); z-index: 60; padding: 6px; }
#noticemenu .nt { display: block; padding: 8px 10px; border-radius: 8px; color: var(--ink); text-decoration: none; } #noticemenu .nt:hover { background: var(--blue-light); } #noticemenu .nt b { display: block; } #noticemenu .nt .when { font-size: 11px; color: var(--muted); }
#noticemenu .foot { display: flex; justify-content: space-between; padding: 6px 10px; border-top: 1px solid var(--line); margin-top: 4px; }
#commentcount { position: absolute; top: -4px; right: -4px; background: var(--red); color: #fff; font-size: 10px; border-radius: 9px; padding: 1px 5px; font-weight: 700; }
#drawer { position: fixed; top: 0; right: 0; width: 380px; max-width: 100vw; height: 100vh; background: #fff; border-left: 1px solid var(--line); box-shadow: -10px 0 30px rgba(20,30,60,.15); z-index: 80; display: flex; flex-direction: column; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
#drawer-body { padding: 12px 14px; overflow-y: auto; flex: 1; }
.cmt { border-left: 3px solid var(--blue-light); padding: 6px 10px; margin: 6px 0; background: #fafbfd; border-radius: 0 8px 8px 0; }
.cmt.reply { margin-left: 18px; } .cmt .meta { font-size: 11px; color: var(--muted); margin-top: 3px; } .cmt.resolved { opacity: .55; }
.cmt .body { white-space: pre-wrap; font-size: 13.5px; }
.comments-box textarea { min-height: 54px; }
.badge.policy { background: #e0ecff; color: #1e40af; } .badge.product { background: #ecfdf5; color: #047857; } .badge.promotion { background: #fdf2f8; color: #9d174d; }
.badge.open { background: #fff7ed; color: var(--amber); } .badge.adopted { background: #e6f4ea; color: var(--green); } .badge.declined, .badge.expired { background: #f3f4f6; color: #6b7280; }
.lowstock { color: var(--red); font-weight: 700; } .instock { color: var(--green); font-weight: 700; }
#whoami { width: auto; max-width: 150px; padding: 6px 8px; border-radius: 16px; font-size: 13px; background: var(--blue-light); border-color: transparent; color: var(--blue); font-weight: 600; }
#globalsearch input { width: 100%; padding: 8px 12px; border: 1px solid var(--line); border-radius: 20px; font-size: 14px; background: var(--bg); }
#main { padding: 20px 24px 60px; max-width: 1280px; width: 100%; box-sizing: border-box; min-width: 0; }   /* border-box: on phones width 100% plus padding used to overflow by 24px */
h1 { font-size: 22px; margin: 0 0 14px; } h2 { font-size: 16px; margin: 20px 0 8px; } h3 { font-size: 14px; margin: 14px 0 6px; }
.pagehead { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.pagehead h1 { margin: 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; }
.card.tight { padding: 8px 12px; }
.grid { display: grid; gap: 14px; } .grid.c2 { grid-template-columns: 1fr 1fr; } .grid.c3 { grid-template-columns: repeat(3, 1fr); } .grid.c4 { grid-template-columns: repeat(4, 1fr); }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.stat b { display: block; font-size: 24px; } .stat span { color: var(--muted); font-size: 12px; }
.stat.warn b { color: var(--amber); } .stat.good b { color: var(--green); }
.stat.shortcut { display: flex; align-items: center; gap: 10px; padding: 10px 14px; }
.stat.shortcut b { font-size: 18px; color: var(--blue-mid); } .stat.shortcut span { color: var(--ink); font-size: 13.5px; font-weight: 500; }
.dash-sec { display: flex; align-items: center; gap: 10px; font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 18px 0 8px; font-weight: 800; }
.dash-sec::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.dash-sec:first-of-type { margin-top: 4px; }
.cal-title { margin: 0 0 8px; font-size: 20px; }
.schedbar { gap: 14px; }
.seg { display: inline-flex; align-items: stretch; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--card); }
.seg > .btn, .seg > button, .seg > input { border-radius: 0 !important; margin: 0; border: 0; border-right: 1px solid var(--line); box-shadow: none; }
.seg > *:last-child { border-right: 0; }
.seg > .btn.on { background: var(--blue); color: #fff; }
.seg > input[type=date] { width: 150px; padding: 6px 10px; background: var(--card); }
@media (max-width: 900px) {
  .pagehead .actions.schedbar { flex-wrap: wrap; overflow: visible; gap: 8px; }
  .schedbar .seg { flex: 0 0 auto; } .schedbar .seg > .btn, .schedbar .seg > button { padding: 8px 10px; font-size: 13px; white-space: nowrap; } .schedbar .seg > input[type=date] { width: 130px; }
  .schedbar .seg:last-child { flex: 1 1 100%; min-width: 0; } .schedbar .seg:last-child > * { flex: 1 1 0; min-width: 0; text-align: center; white-space: normal; line-height: 1.2; }
}
.contract-frame { width: 100%; border: 0; border-radius: var(--radius); background: var(--bg); display: block; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .3px; background: #fafbfd; }   /* not sticky: a pinned header hid the top row while scrolling */
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
tr.clickable { cursor: pointer; } tr.clickable:hover td { background: var(--blue-light); }
tr.selected td { background: #e6f4ea; }
/* table sorting and filtering (App.enhanceTables) */
.tbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 8px; }
.tbar input { max-width: 240px; flex: 1 1 140px; } .tbar select { width: auto; max-width: 200px; }
.tbar .count { font-size: 12px; color: var(--muted); margin-left: auto; white-space: nowrap; }
th.sortable { cursor: pointer; user-select: none; } th.sortable:hover { color: var(--blue); }
th.sortable::after { content: ' \2195'; opacity: .35; } th.sortable.asc::after { content: ' \25B2'; opacity: 1; } th.sortable.desc::after { content: ' \25BC'; opacity: 1; }
tr.tf-hide { display: none !important; }
.stat.shortcut.ai b { color: var(--gold, #e3b24a); }   /* AI tool tiles on the dashboard */
/* Ask the app (chat with Claude) */
#askbtn { position: fixed; right: calc(18px + var(--sar)); bottom: 18px; z-index: 70; background: var(--blue); color: #fff; border-radius: 999px; padding: 10px 16px; font-weight: 700; box-shadow: 0 6px 20px rgba(20,30,60,.3); }
#askpanel { position: fixed; right: 18px; bottom: 70px; width: 400px; max-width: calc(100vw - 36px); height: 560px; max-height: calc(100vh - 90px); background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 16px 40px rgba(20,30,60,.25); z-index: 75; display: flex; flex-direction: column; overflow: hidden; }
#askbody { flex: 1; overflow-y: auto; padding: 10px 12px; font-size: 13.5px; }
#askbody .ask { margin: 6px 0; padding: 8px 11px; border-radius: 12px; max-width: 92%; }
#askbody .ask.user { background: var(--blue); color: #fff; margin-left: auto; } #askbody .ask.assistant { background: var(--bg); }
#askbody .ask p { margin: 0 0 6px; } #askbody .ask p:last-child { margin-bottom: 0; } #askbody .ask ul { margin: 4px 0 4px 18px; padding: 0; } #askbody .ask.user a { color: #fff; }
#askform { display: flex; gap: 6px; padding: 8px 10px; border-top: 1px solid var(--line); } #askform input { flex: 1; min-width: 0; } #askform button { padding: 7px 12px; }
html.dark #askpanel { background: var(--card); border-color: var(--line); } html.dark #askbody .ask.assistant { background: #0f1420; }
@media (max-width: 600px) {
  /* full screen on a phone, pinned to the top: iOS's old 100vh included the space behind Safari's toolbar, which pushed the header off the top when the panel hung from the bottom */
  #askpanel { top: 0; right: 0; bottom: auto; width: 100vw; max-width: 100vw; height: 100vh; height: 100dvh; max-height: 100dvh; border-radius: 0; }
  #askpanel .drawer-head { padding: 12px 12px; padding-top: calc(12px + var(--sat)); } #askpanel #askclose { padding: 9px 14px; font-size: 15px; font-weight: 700; }
  #askform { padding-bottom: calc(8px + var(--sab)); }
  #askbody { overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
  body.ask-open { overflow: hidden; }
  #askbtn { bottom: calc(14px + var(--sab)); right: calc(14px + var(--sar)); }
}
.tap-call, .tap-route { text-decoration: underline dotted; text-underline-offset: 2px; cursor: pointer; } .tap-call:hover, .tap-route:hover { color: var(--blue); }
.pre { white-space: pre-wrap; font-size: 12.5px; }
.muted { color: var(--muted); } .small { font-size: 12px; } .right { text-align: right; } .nowrap { white-space: nowrap; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11.5px; font-weight: 600; background: var(--blue-light); color: var(--blue); white-space: nowrap; }
.badge.needs_order { background: #fff7ed; color: var(--amber); } .badge.ordered, .badge.submitted { background: #e0ecff; color: #1e40af; }
.badge.awaiting_payoff { background: #fdf2f8; color: #9d174d; } .badge.complete, .badge.received, .badge.paid_off, .badge.paid { background: #e6f4ea; color: var(--green); }
.badge.backordered, .badge.partially_received { background: #fef3c7; color: #92400e; } .badge.canceled, .badge.written_off { background: #f3f4f6; color: #6b7280; }
.badge.draft { background: #f3f4f6; color: #4b5563; } .badge.to_ship { background: #fef3c7; color: #92400e; } .badge.hold { background: #fee2e2; color: var(--red); } .badge.delivered { background: #ecfdf5; color: #047857; }
button, .btn { background: var(--blue); color: #fff; border: 0; border-radius: 8px; padding: 8px 14px; font-size: 13.5px; font-weight: 600; cursor: pointer; font-family: inherit; }
button:hover { filter: brightness(1.08); } button:disabled { opacity: .5; cursor: default; }
button.secondary, .btn.secondary { background: var(--blue-light); color: var(--blue); }
button.danger { background: var(--red); } button.ghost { background: transparent; color: var(--blue-mid); padding: 4px 8px; }
button.small { padding: 4px 10px; font-size: 12.5px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.pagehead .actions > button, .pagehead .actions > .btn { white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; line-height: 1.2; }   /* one line of text per button, so a row of actions is one height */
form .row, .row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 600; min-width: 120px; flex: 1; }
label.f.short { flex: 0 0 110px; min-width: 90px; } label.f.wide { flex: 2 0 240px; } label.f.check { flex-direction: row; align-items: center; min-width: 0; flex: 0 0 auto; color: var(--ink); font-weight: 500; font-size: 13px; }
input, select, textarea { font: inherit; padding: 7px 9px; border: 1px solid #cfd6e2; border-radius: 8px; background: #fff; color: var(--ink); width: 100%; }
input[type=checkbox], input[type=radio] { width: auto; }
input[type=date], input[type=time], input[type=datetime-local], input[type=month] { -webkit-appearance: none; appearance: none; min-width: 0; display: block; }
input[type=date]::-webkit-date-and-time-value, input[type=time]::-webkit-date-and-time-value, input[type=datetime-local]::-webkit-date-and-time-value { text-align: left; } textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid #9db8e8; border-color: var(--blue-mid); }
input.money { text-align: right; font-variant-numeric: tabular-nums; }
.ac { position: relative; }
.ac-list { position: absolute; top: 100%; left: 0; right: 0; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(20,30,60,.15); z-index: 50; max-height: 360px; overflow-y: auto; margin-top: 4px; }
.ac-item { padding: 8px 12px; cursor: pointer; border-bottom: 1px solid #f0f2f6; }
.ac-item:last-child { border-bottom: 0; } .ac-item:hover, .ac-item.active { background: var(--blue-light); }
.ac-item b { display: block; } .ac-item small { color: var(--muted); display: block; } .ac-item .alias { color: var(--amber); font-size: 12px; }
.ac-item.new { color: var(--green); font-weight: 600; }
.ac-sec { font-size: 10.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); font-weight: 700; padding: 8px 12px 2px; background: #fafbfd; }
#globalsearch .ac-list { max-height: 70vh; }
.toast { position: relative; background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 10px; margin-top: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.2); font-size: 13.5px; max-width: 420px; }
.toast.error { background: var(--red); } .toast.ok { background: var(--green); }
#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 100; }
#confirmbox { position: fixed; inset: 0; background: rgba(20,30,60,.45); z-index: 120; display: flex; align-items: center; justify-content: center; padding: 16px; }
.confirmcard { background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; max-width: 420px; width: 100%; box-shadow: 0 20px 50px rgba(0,0,0,.3); } .confirmcard p { margin: 0 0 14px; font-size: 15px; }
::selection { background: var(--blue-mid); color: #fff; }
#modal { position: fixed; inset: 0; background: rgba(20,30,60,.45); z-index: 90; display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; }
.modal-card { background: #fff; border-radius: 14px; padding: 18px 20px; width: 100%; max-width: 720px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.loading { color: var(--muted); padding: 30px; text-align: center; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 12px; flex-wrap: wrap; }
.tabs button { background: none; color: var(--muted); border-radius: 8px 8px 0 0; padding: 8px 12px; font-weight: 600; }
.tabs button.active { color: var(--blue); border-bottom: 2px solid var(--blue); }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 4px 10px; font-size: 13px; } .kv dt { color: var(--muted); } .kv dd { margin: 0; }
.items-table input[type=number] { width: 70px; } .items-table input.money { width: 100px; }
.items-table td { padding: 4px 6px; }
.warn { background: var(--amber-light); border: 1px solid #fcd9b6; color: var(--amber); padding: 8px 12px; border-radius: 8px; font-size: 13px; }
.warn.good { background: #e6f4ea; border-color: #b7e1c1; color: var(--green); }
.note { background: #fffbeb; border-left: 3px solid #f59e0b; padding: 8px 12px; border-radius: 6px; margin-bottom: 8px; }
.note.pinned { border-left-color: var(--red); background: #fff1f2; } .note .meta { font-size: 11px; color: var(--muted); margin-top: 4px; }
.total-line { display: flex; justify-content: space-between; padding: 4px 0; } .total-line.big { font-size: 18px; font-weight: 700; border-top: 2px solid var(--ink); margin-top: 6px; padding-top: 8px; }
.alias-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--blue-light); border-radius: 14px; padding: 3px 10px; margin: 2px 4px 2px 0; font-size: 12.5px; }
.alias-chip button { background: none; color: var(--muted); padding: 0 2px; font-size: 14px; }
.print-only { display: none; }
.card { overflow-x: auto; }
.bignum { font-size: 44px; font-weight: 800; letter-spacing: -1px; line-height: 1.1; }
span.check { color: var(--green); font-weight: 700; } span.nocheck { color: #cbd2de; }
@media (max-width: 1100px) and (min-width: 901px) { .grid.c4 { grid-template-columns: 1fr 1fr; } .grid.c3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 900px) {
  input, select, textarea { font-size: 16px; }
  input:not([type=checkbox]):not([type=radio]):not([type=file]), select { height: 40px; line-height: 1.2; }
  button, .btn { padding: 10px 14px; }
  #topbar { gap: 8px; padding: var(--sat) 10px 0; } #globalsearch input { font-size: 16px; }
  .pagehead { flex-direction: column; align-items: stretch; } .pagehead > * { min-width: 0; max-width: 100%; } .pagehead .actions select { max-width: 120px; } .pagehead .actions { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }
  .bignum { font-size: 36px; }
  #app { grid-template-columns: 1fr; } #offlinebar, #leaveline { grid-column: 1; }
  #sidebar { position: fixed; left: -260px; width: 240px; transition: left .2s; z-index: 60; } #sidebar.open { left: 0; }
  #menubtn { display: block; font-size: 28px; padding: 6px 8px; min-width: 44px; min-height: 44px; } #main { padding: 14px 12px 60px; }
  /* tablets: tighter tables so fewer of them need to scroll inside their card; the orders list drops its money
     breakdown columns (the order page has them) */
  table { font-size: 12.5px; } th, td { padding: 6px 6px; } td { overflow-wrap: anywhere; }
  .orderstable th:nth-child(8), .orderstable td:nth-child(8), .orderstable th:nth-child(10), .orderstable td:nth-child(10) { display: none; }
  #sidebar.open::after { content: ''; position: fixed; top: 0; bottom: 0; left: 240px; right: 0; background: rgba(10, 20, 40, .35); }   /* dims the page behind the open nav; a tap on it closes the nav */
  .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: 1fr; } th { position: static; }
}
@media (min-width: 601px) and (max-width: 900px) {   /* tablets only: the densest tables drop a low-value column so they fit without scrolling */
  .acctable th:nth-child(3), .acctable td:nth-child(3), .acctable th:nth-child(10), .acctable td:nth-child(10) { display: none; }
  .legacytable th:nth-child(7), .legacytable td:nth-child(7) { display: none; }
  .prodtable th:nth-child(3), .prodtable td:nth-child(3), .prodtable th:nth-child(7), .prodtable td:nth-child(7) { display: none; }
}
/* Narrow phones (iPhone Duo outer screen, small iPhones): the top bar wraps into two rows.
   Row 1: menu, who-am-I, role, then the action buttons pushed to the right. Row 2: the search, full width.
   Without this the search box shrank to a blank pill over the + button and the right-hand buttons ran off screen. */
@media (max-width: 600px) {
  #app { grid-template-rows: auto auto 1fr; }   /* the desktop 52px row would clip the second line */
  #topbar { flex-wrap: wrap; gap: 6px; padding: 6px 10px; padding-top: calc(6px + var(--sat)); }
  #whoami { flex: 1 1 60px; min-width: 0; max-width: 130px; }   /* small basis so the row never wraps mid-way; it grows up to 130px when there is room */
  #quickadd { margin-left: auto; }
  #syncbtn, #commentbtn { padding: 5px 9px; }   /* the + and theme buttons keep their own later rules */
  #syncbtn { min-width: 32px; }
  #globalsearch { order: 10; flex: 1 1 100%; max-width: none; }
  #globalsearch input { padding: 7px 12px; }
  /* Short fields (Date, Method, Check #) are a fixed 110px on desktop. iPhone date pickers refuse to shrink below
     about 125px, so the Date box used to spill over the Method box beside it. On phones short fields share the row
     evenly and wrap to their own line when two do not fit. */
  label.f.short { flex: 1 1 130px; min-width: 0; }
  label.f > input, label.f > select, label.f > textarea { min-width: 0; max-width: 100%; }
  /* Enter layaway payments: seven columns do not fit a phone, and sideways scrolling hid the amount box while typing.
     Each row becomes a small block: ref, customer and remaining on top, last paid under it, then amount, check # and Save. */
  .paytable thead { display: none; }
  .paytable, .paytable tbody { display: block; }
  .paytable tr { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 4px 10px; align-items: start; padding: 10px 0; border-bottom: 1px solid var(--line); }
  .paytable td { display: block; border: 0; padding: 0; width: auto !important; }
  .paytable td:nth-child(1) { grid-column: 1; grid-row: 1; }
  .paytable td:nth-child(2) { grid-column: 2; grid-row: 1; }
  .paytable td:nth-child(3) { grid-column: 3; grid-row: 1; }
  .paytable td:nth-child(4) { grid-column: 2 / 4; grid-row: 2; }
  .paytable td:nth-child(4)::before { content: 'Last paid '; color: var(--muted); }
  .paytable td:nth-child(5) { grid-column: 1 / 3; grid-row: 3; text-align: left; }
  .paytable td:nth-child(6) { grid-column: 3; grid-row: 3; }
  .paytable td:nth-child(5)::before, .paytable td:nth-child(6)::before { display: block; font-size: 11px; color: var(--muted); font-weight: 600; margin-bottom: 2px; }
  .paytable td:nth-child(5)::before { content: 'Amount $'; }
  .paytable td:nth-child(6)::before { content: 'Check #'; }
  .paytable td:nth-child(5) input { width: 100% !important; max-width: none; } .paytable td:nth-child(6) input { width: 96px !important; }   /* the markup sets a desktop width inline; a fixed check box keeps the right column narrow */
  .paytable td:nth-child(7) { grid-column: 1 / -1; grid-row: 4; }
  .paytable td[colspan] { grid-column: 1 / -1; }
  /* Orders list: ten columns do not fit a phone. Each order becomes a block: number, customer and total on top;
     date, status and pink form under it; type and items last. Subtotal and commissions are left to the order page. */
  .orderstable thead { display: none; }
  .orderstable, .orderstable tbody { display: block; }
  .orderstable tr { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 2px 10px; align-items: start; padding: 9px 0; border-bottom: 1px solid var(--line); }
  .orderstable td { display: block; border: 0; padding: 0; }
  .orderstable td:nth-child(1) { grid-column: 1; grid-row: 1; font-weight: 700; }
  .orderstable td:nth-child(3) { grid-column: 2; grid-row: 1; font-weight: 600; }
  .orderstable td:nth-child(9) { grid-column: 3; grid-row: 1; text-align: right; font-weight: 700; }
  .orderstable td:nth-child(2) { grid-column: 1; grid-row: 2; font-size: 12px; color: var(--muted); }
  .orderstable td:nth-child(5) { grid-column: 2; grid-row: 2; }
  .orderstable td:nth-child(6) { grid-column: 3; grid-row: 2; text-align: right; }
  .orderstable td:nth-child(4) { grid-column: 1; grid-row: 3; font-size: 12px; color: var(--muted); }
  .orderstable td:nth-child(7) { grid-column: 2 / -1; grid-row: 3; font-size: 12px; color: var(--muted); }
  .orderstable td:nth-child(8), .orderstable td:nth-child(10) { display: none; }
  .orderstable td[colspan] { grid-column: 1 / -1; }
  /* Every other data table (three or more columns) becomes a list of blocks on a phone: one block per row, each cell
     labelled with its column heading, so nothing scrolls sideways. Headings (and sorting) come back above 600px. */
  table.stackable thead { display: none; }
  table.stackable, table.stackable tbody { display: block; }
  table.stackable tr { display: block; padding: 8px 0; border-bottom: 1px solid var(--line); }
  table.stackable td { display: flex; gap: 8px; align-items: baseline; border: 0; padding: 2px 0; text-align: left; }
  table.stackable td[data-label]::before { content: attr(data-label); flex: 0 0 34%; max-width: 120px; color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .3px; }
  table.stackable td:not([data-label]) { padding-top: 4px; }
  table.stackable td.num, table.stackable th.num { text-align: left; }
  table.stackable td:empty { display: none; }
  table.stackable td input:not([type=checkbox]), table.stackable td select { max-width: 100%; }
  table.stackable td { min-width: 0; overflow-wrap: anywhere; white-space: normal; } table.stackable td > * { max-width: 100%; }
  table.stackable td.pre, table.stackable pre { white-space: pre-wrap; word-break: break-word; }
  .pagehead .actions { flex-wrap: wrap; overflow: visible; }   /* action buttons wrap instead of hiding off the right edge */
  /* filters and the table toolbar: tighter on a phone */
  .row { gap: 8px; } label.f.short { flex: 1 1 110px; }
  .tbar input { flex: 1 1 100%; max-width: none; } .tbar select { flex: 1 1 calc(50% - 60px); max-width: none; }
}
@media (max-width: 400px) { #rolebadge { display: none !important; } #topbar { gap: 5px; } #syncbtn, #themebtn, #commentbtn, #noticebtn { padding: 5px 7px; } #syncbtn { min-width: 30px; } #whoami { flex-basis: 54px; padding: 6px 6px; } }   /* the narrowest screens: six buttons on the first row */   /* the role still shows as the select's tooltip; the Admin page has the full picture */
@media print {
  #sidebar, #topbar, #toasts, .no-print { display: none !important; }
  #app { display: block; } #main { padding: 0; max-width: none; } body { background: #fff; } .card { border: 0; padding: 0; }
  .print-only { display: block; }
}
.cal-head { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; padding: 0 0 4px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-day { min-width: 0; overflow: hidden; min-height: 96px; border: 1px solid var(--line); border-radius: 8px; padding: 4px; background: #fff; cursor: pointer; font-size: 12px; }
.cal-day.other { background: #f7f8fb; color: var(--muted); } .cal-day.today { border-color: var(--blue); box-shadow: inset 0 0 0 1px var(--blue); }
.cal-day .n { font-weight: 700; margin-bottom: 3px; } .cal-day.week { min-height: 160px; }
.wleg { font-size: 10.5px; color: var(--muted); padding: 1px 4px 1px 10px; border-left: 2px dotted var(--line); margin: 0 0 0 6px; } .wleg.total { border-left: 0; margin: 6px 0 0; padding: 4px 0 0; border-top: 1px dashed var(--line); font-weight: 600; }
.evt { background: var(--k); color: #fff; border-radius: 5px; padding: 2px 6px; margin: 2px 0; font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.evt .t { opacity: .85; } .evt.done, tr.done { opacity: .55; text-decoration: line-through; } .evt.canceled, tr.canceled { opacity: .4; text-decoration: line-through; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; font-size: 12px; } .legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; }
.qr { width: 110px; height: 110px; }
@media (max-width: 900px) { .cal-grid { gap: 2px; } .cal-day { min-height: 60px; padding: 2px; } .evt { font-size: 10px; padding: 1px 3px; } .cal-day .n { font-size: 11px; } }
.print-page { font-size: 13px; color: #000; max-width: 7.5in; margin: 0 auto; }
.print-page h1 { font-size: 22px; } .print-page table th { position: static; background: #eee; color: #000; }
.print-page .hdr { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 18px; }
.print-page .box { border: 1px solid #999; padding: 10px 12px; border-radius: 6px; margin: 10px 0; }
.pl-cat { font-size: 15px; color: var(--blue); margin: 16px 0 4px; border-bottom: 2px solid var(--blue); padding-bottom: 2px; }
table.pl td, table.pl th { padding: 5px 8px; }
@media print { .pl-cat { break-after: avoid; } table.pl { break-inside: auto; } table.pl tr { break-inside: avoid; } }

/* ---------- dark theme (html.dark is set by App.applyTheme: Auto follows the device) ---------- */
html.dark {
  --blue: #1e4a8a; --blue-light: #1b2a44; --blue-mid: #7fa6e6; --red: #f87171; --green: #4ade80; --amber: #fbbf24; --amber-light: #3a2a10;
  --ink: #e6eaf2; --muted: #98a2b8; --line: #2a3447; --bg: #0f1420; --card: #171e2d;
  color-scheme: dark;
}
html.dark body { background: var(--bg); color: var(--ink); }
html.dark #sidebar { background: #0b1a33; }
html.dark .brand .logo { background: #e6eaf2; color: #0b1a33; }
html.dark #topbar { background: var(--card); border-color: var(--line); }
html.dark #globalsearch input, html.dark input, html.dark select, html.dark textarea { background: #0f1420; color: var(--ink); border-color: #334155; }
html.dark input:focus, html.dark select:focus, html.dark textarea:focus { outline-color: #335a9a; }
html.dark #whoami, html.dark #commentbtn { background: var(--blue-light); color: #cfe0ff; }
html.dark th { background: #121a2a; color: var(--muted); }
html.dark tr.clickable:hover td { background: #1f2a40; }
html.dark tr.selected td { background: #13301f; }
html.dark button, html.dark .btn { background: #2d5aa6; color: #fff; }
html.dark button.secondary, html.dark .btn.secondary { background: var(--blue-light); color: #cfe0ff; }
html.dark button.ghost { background: transparent; color: var(--blue-mid); }
html.dark button.danger { background: #b91c1c; }
html.dark .ac-list, html.dark .modal-card, html.dark #drawer { background: var(--card); border-color: var(--line); box-shadow: 0 10px 30px rgba(0,0,0,.6); }
html.dark .ac-item { border-color: #22304a; } html.dark .ac-item:hover, html.dark .ac-item.active { background: #1f2a40; }
html.dark .ac-sec { background: #121a2a; }
html.dark .ac-item.new { color: var(--green); } html.dark .ac-item .alias { color: var(--amber); }
html.dark .stat, html.dark .card { background: var(--card); border-color: var(--line); }
html.dark .badge { background: var(--blue-light); color: #cfe0ff; }
html.dark .badge.needs_order, html.dark .badge.open { background: #3a2a10; color: #fbbf24; }
html.dark .badge.ordered, html.dark .badge.submitted, html.dark .badge.policy { background: #172554; color: #93c5fd; }
html.dark .badge.awaiting_payoff, html.dark .badge.promotion { background: #3b1024; color: #f9a8d4; }
html.dark .badge.complete, html.dark .badge.received, html.dark .badge.paid_off, html.dark .badge.paid, html.dark .badge.adopted, html.dark .badge.delivered, html.dark .badge.product { background: #0f2e1b; color: #4ade80; }
html.dark .badge.backordered, html.dark .badge.partially_received, html.dark .badge.to_ship { background: #3a2a10; color: #fcd34d; }
html.dark .badge.canceled, html.dark .badge.written_off, html.dark .badge.draft, html.dark .badge.declined, html.dark .badge.expired { background: #1f2937; color: #9ca3af; }
html.dark .badge.hold { background: #3b1010; color: #fca5a5; }
html.dark .warn { background: var(--amber-light); border-color: #5a4218; color: #fcd34d; }
html.dark .warn.good { background: #0f2e1b; border-color: #1f5a35; color: #4ade80; }
html.dark .note { background: #2a2410; border-left-color: #f59e0b; } html.dark .note.pinned { background: #3b1010; border-left-color: var(--red); }
html.dark .cmt { background: #121a2a; border-left-color: #2d5aa6; }
html.dark .cal-day { background: var(--card); border-color: var(--line); } html.dark .cal-day.other { background: #0f1420; color: var(--muted); } html.dark .cal-day.today { border-color: #7fa6e6; box-shadow: inset 0 0 0 1px #7fa6e6; }
html.dark .tabs button { color: var(--muted); } html.dark .tabs button.active { color: #cfe0ff; border-bottom-color: #7fa6e6; }
html.dark .alias-chip { background: var(--blue-light); color: #cfe0ff; }
html.dark .toast { background: #e6eaf2; color: #0f1420; } html.dark .toast.error { background: #b91c1c; color: #fff; } html.dark .toast.ok { background: #15803d; color: #fff; }
html.dark .total-line.big { border-top-color: var(--ink); }
html.dark .pl-cat { color: #93c5fd; border-bottom-color: #93c5fd; }
html.dark .print-page, html.dark .print-page table th { color: var(--ink); }
html.dark .print-page .box { border-color: #475569; }
html.dark img.qr { background: #fff; padding: 4px; border-radius: 6px; }
html.dark span.check { color: var(--green); } html.dark span.nocheck { color: #3b4760; }
html.dark .evt { color: #fff; }
html.dark .sidefoot { opacity: .6; }
#quickadd { position: relative; order: 7; }
#quickbtn { background: var(--blue); color: #fff; border-radius: 16px; padding: 4px 12px; font-size: 18px; line-height: 1; font-weight: 700; }
#quickmenu { overscroll-behavior: contain; position: absolute; top: 110%; right: 0; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(20,30,60,.2); min-width: 220px; z-index: 60; padding: 6px; }
#quickmenu a, #quickmenu button { display: block; width: 100%; text-align: left; background: none; color: var(--ink); padding: 8px 10px; border-radius: 8px; font-size: 13.5px; font-weight: 500; }
#quickmenu a:hover, #quickmenu button:hover { background: var(--blue-light); text-decoration: none; }
#quickmenu .sec { display: flex; align-items: center; gap: 8px; font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: var(--blue-mid); padding: 10px 10px 4px; font-weight: 800; }
#quickmenu .sec::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, var(--blue-mid), transparent); opacity: .5; }
#quickmenu .sec:first-child { padding-top: 6px; }
@media (max-width: 600px) {   /* after the rules above so it wins: on narrow phones the quick menu spans the screen under the top bar's first row */
  #quickadd { position: static; }
  #quickmenu { top: 46px; left: 10px; right: 10px; min-width: 0; max-height: calc(100vh - 60px); max-height: calc(100dvh - 60px); overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
  body.menu-open { overflow: hidden; }   /* the page stays put while the + menu is open; the menu scrolls on its own */
}
.stop { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); margin: 4px 0; cursor: grab; }
.stop.dragging { opacity: .4; } .stop .time { min-width: 76px; font-weight: 700; } .stop .body { flex: 1; }
.leg { display: flex; align-items: center; gap: 8px; padding: 2px 0 2px 24px; color: var(--muted); font-size: 12.5px; }
.leg i { display: inline-block; width: 2px; height: 18px; background: var(--line); margin-left: 12px; }
.dropzone { height: 10px; border-radius: 6px; margin: 0 0 0 24px; } .dropzone.over { height: 30px; background: var(--blue-light); border: 2px dashed var(--blue-mid); }
.stop .handle { color: var(--muted); font-size: 18px; line-height: 1; padding-top: 2px; }
#themebtn { background: var(--blue-light); color: var(--blue); border-radius: 16px; padding: 5px 10px; font-size: 14px; order: 8; }
html.dark #themebtn { color: #cfe0ff; }
@media print {
  html.dark { --ink: #000; --muted: #444; --bg: #fff; --card: #fff; --line: #ccc; color-scheme: light; }
  html.dark body, html.dark .card, html.dark .print-page { background: #fff !important; color: #000 !important; }
  html.dark .print-page table th { background: #eee !important; color: #000 !important; }
}

/* Sign-in and waiting-for-approval screens (the app itself is hidden behind them) */
#authscreen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; background: var(--bg, #eef2f7); }
.authcard { background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 14px; padding: 26px 24px; max-width: 440px; width: 100%; box-shadow: 0 8px 30px rgba(20,30,60,.12); }
.authcard .brand { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; } .authcard .brand small { display: block; font-size: 12px; opacity: .7; }
.authcard .logo { background: var(--blue); color: #fff; font-weight: 800; border-radius: 9px; padding: 7px 9px; font-size: 14px; }
.authcard h2 { margin: 0 0 8px; } .authcard p { margin: 0 0 12px; line-height: 1.45; } .authcard .actions { margin-top: 14px; }
#gsibtn { margin: 10px 0 6px; min-height: 44px; }
#whoami.signed { pointer-events: none; }
.costdiff.over { color: var(--red); font-weight: 600; } .costdiff.under { color: var(--green); font-weight: 600; }
/* signed in with Google: the name picker gives way to a chip with a small account menu */
#mewrap { position: relative; flex: 0 0 auto; }
#mechip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 3px; border-radius: 16px; background: var(--blue-light); color: var(--blue); border: none; font-weight: 600; font-size: 13px; line-height: 1; cursor: pointer; }
#mechip img, #mechip .ini { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; display: inline-flex; align-items: center; justify-content: center; background: var(--blue); color: #fff; font-size: 12px; }
#memenu { position: absolute; top: 115%; left: 0; min-width: 230px; background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(20,30,60,.18); padding: 10px 12px; z-index: 30; }
#memenu .who { margin-bottom: 8px; line-height: 1.35; }
html.dark #mechip { color: #cfe0ff; }
@media (max-width: 400px) { #mechip .nm { display: none; } #mechip { padding-right: 3px; } }
/* drag-to-reorder lists (dashboard and menu customizing) */
.sortrow { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 8px; border: 1px solid transparent; }
.sortrow label { flex: 1; display: flex; gap: 6px; align-items: center; margin: 0; }
.sortrow .drag { cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; color: var(--muted); padding: 2px 6px; font-size: 16px; line-height: 1; }
.sortrow.dragging { background: var(--blue-light); border-color: var(--blue-mid); opacity: .9; }
.sorting .sortrow:not(.dragging) { transition: transform .1s; }
/* search results page */
.srow { display: block; padding: 9px 6px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; } .srow:last-child { border-bottom: 0; } .srow:hover { background: var(--blue-light); }
.srow small { display: block; color: var(--muted); margin-top: 2px; } .srow .alias { margin-left: 8px; font-size: 12px; color: var(--amber); }
/* phones: the bell, + and account menus hang from the top bar and span the screen instead of overflowing an edge */
@media (max-width: 700px) {
  #noticemenu, #quickmenu, #memenu { position: fixed; left: calc(10px + var(--sal)); right: calc(10px + var(--sar)); top: calc(var(--topbar-h, 52px) + 6px);   /* the insets keep them clear of a status column on the side (iPhone Duo) */ width: auto; max-width: none; max-height: calc(100vh - var(--topbar-h, 52px) - 24px); max-height: calc(100dvh - var(--topbar-h, 52px) - 24px); overflow: auto; }
}
/* stars: favorites on menu links, + entries, customers and pieces */
button.star { background: none; border: 0; padding: 2px 6px; font-size: 18px; line-height: 1; color: var(--muted); cursor: pointer; min-width: 0; min-height: 0; } button.star.on { color: #e0a81c; } button.star:hover { color: #e0a81c; }
#nav a[data-nav] { position: relative; padding-right: 34px; } #nav .navstar { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); font-size: 15px; opacity: .45; padding: 4px 6px; } #nav .navstar:hover, #nav a.fav .navstar { opacity: 1; color: #f5c56b; }
#quickmenu .qrow { display: flex; align-items: center; } #quickmenu .qrow > a, #quickmenu .qrow > button:not(.star) { flex: 1 1 auto; min-width: 0; } #quickmenu .qrow .star { flex: 0 0 auto; width: auto; padding: 4px 8px; }   /* the star keeps its own width; the generic 100% rule above would otherwise squeeze the label */
.starred-card .srow { display: flex; align-items: center; gap: 8px; } .starred-card .srow .star { margin-left: auto; }
/* price list sheet */
.pl-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; border-bottom: 3px solid var(--blue); padding-bottom: 10px; margin-bottom: 6px; }
.pl-brand { font-size: 26px; font-weight: 800; letter-spacing: .01em; color: var(--blue); } .pl-sub { color: var(--muted); font-size: 13px; margin-top: 2px; } .pl-date { color: var(--muted); font-size: 13px; }
.pl-note { font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
.pl-group { margin-top: 18px; } .pl-cat { font-size: 15px; text-transform: uppercase; letter-spacing: .08em; color: var(--blue); border-bottom: 1px solid var(--line); padding-bottom: 4px; margin: 0 0 4px; }
table.pl-customer th { font-size: 11px; } table.pl-customer td { padding: 8px 8px; font-size: 14px; } table.pl-customer tbody tr:nth-child(even) { background: rgba(22,56,107,.04); } .pl-name { font-weight: 600; } .pl-price { font-weight: 700; } .pl-stock { width: 1%; white-space: nowrap; }
.pl-foot { margin-top: 18px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 8px; }
html.dark table.pl-customer tbody tr:nth-child(even) { background: rgba(255,255,255,.03); } html.dark .pl-brand, html.dark .pl-cat { color: #9fc0ff; }
@media print { .pl-sheet { max-width: none !important; } }
/* conversion visits: the two priorities are hard to miss */
.priority-band { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 12px; padding: 10px 14px; border-radius: 10px; margin: 0 0 12px; font-size: 15px; font-weight: 600; }
.priority-band b { font-size: 13px; letter-spacing: .12em; padding: 3px 9px; border-radius: 6px; }
.priority-band span { font-weight: 400; font-size: 13px; opacity: .85; flex-basis: 100%; }
.priority-band.urgent { background: #fdecec; color: #991b1b; border-left: 6px solid var(--red); } .priority-band.urgent b { background: var(--red); color: #fff; }
.priority-band.low { background: var(--blue-light); color: var(--blue); border-left: 6px solid var(--blue-mid); } .priority-band.low b { background: var(--blue-mid); color: #fff; }
html.dark .priority-band.urgent { background: #3a1414; color: #fca5a5; } html.dark .priority-band.low { color: #cfe0ff; }
tr.starred > td { background: rgba(224,168,28,.08); }
/* bottom tab bar (phones and tablets): the four everyday pages plus More, which opens the full menu as a sheet */
#tabbar { display: none; }
#navbackdrop { position: fixed; inset: 0; background: rgba(10, 20, 40, .4); z-index: 59; }
@media (max-width: 900px) {
  #menubtn { display: none !important; }
  #tabbar { display: flex; position: fixed; left: var(--sal); right: var(--sar); bottom: 0; z-index: 58; background: var(--card); border-top: 1px solid var(--line); padding: 4px 4px calc(4px + var(--sab)); box-shadow: 0 -4px 16px rgba(20,30,60,.06); }
  #tabbar a span, #tabbar button span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #tabbar a, #tabbar button { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 48px; padding: 4px 2px; border: 0; background: none; border-radius: 10px; color: var(--muted); font-size: 11px; font-weight: 600; text-decoration: none; line-height: 1; }
  #tabbar svg { width: 24px; height: 24px; } #tabbar a.active { color: var(--blue); } #tabbar a.active svg { filter: drop-shadow(0 0 0 transparent); } #tabbar a:active, #tabbar button:active { background: var(--blue-light); }
  #main { padding-bottom: calc(76px + var(--sab)) !important; }
  #askbtn { bottom: calc(70px + var(--sab)); }
  #askpanel { padding-bottom: calc(60px + var(--sab)); }
  /* the menu is a sheet from the bottom instead of a drawer from the left */
  #sidebar { left: var(--sal); right: var(--sar); width: auto; top: auto; bottom: 0; height: auto; max-height: 82vh; max-height: 82dvh; padding-top: 0; transform: translateY(105%); transition: transform .25s ease; border-radius: 18px 18px 0 0; box-shadow: 0 -8px 30px rgba(10,20,40,.35); overflow-y: auto; overscroll-behavior: contain; z-index: 60; }
  #sidebar.open { left: 0; transform: none; }
  #sidebar.open::after { content: none; }
  #sheethandle { display: block; padding: 10px 0 6px; touch-action: none; cursor: grab; } #sheethandle::before { content: ''; display: block; width: 44px; height: 5px; border-radius: 3px; background: rgba(255,255,255,.35); margin: 0 auto; }
  #sidebar .brand { touch-action: none; }
  #sidebar .brand { padding-top: 6px; }
  #sidebar .sidefoot { padding-bottom: calc(16px + var(--sab)); }
}
@media print { #tabbar, #navbackdrop { display: none !important; } }
html.dark #tabbar { background: #0f1a2e; border-top-color: #1f2a44; } html.dark #tabbar a.active { color: #9fc0ff; }
body:has(#sidebar.open) #askbtn, body.menu-open #askbtn { visibility: hidden; }   /* the floating Ask button stays out of an open menu sheet */
#sheethandle { display: none; }
@media (max-width: 900px) { #sheethandle { display: block; } }
/* things pinned to the screen's right edge stay inside the app's edge on devices with a side status strip */
#askpanel { right: calc(18px + var(--sar)); }
#drawer { right: var(--sar); }
@media (max-width: 900px) { #askpanel { right: var(--sar); left: var(--sal); width: auto; max-width: none; } }
#toasts { right: calc(12px + var(--sar)); }
/* a date field never wraps its value; the reference column keeps four-digit numbers on one line */
label.f.short:has(> input[type=date]) { flex-basis: 160px; min-width: 160px; }   /* the box grows with the field, so a full date never spills into the next one */
label.f > input[type=date] { width: 100%; min-width: 0; }
input[type=date]:not(label.f > *) { min-width: 140px; }
.paytable td:first-child, .paytable th:first-child { white-space: nowrap; }
/* the amount and check boxes take 110px when there is room and give some back when there is not, so the table fits its
   card on a mid-width screen (iPhone Duo unfolded) instead of making the card scroll sideways */
.paytable input.amt, .paytable input.ref { width: 100%; min-width: 70px; max-width: 110px; }
.paytable th:nth-child(5), .paytable td:nth-child(5), .paytable th:nth-child(6), .paytable td:nth-child(6) { width: 126px; }
/* page usage: a thin bar showing each page against the most used one */
.usebar { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; min-width: 60px; } .usebar i { display: block; height: 100%; background: var(--blue-mid); border-radius: 4px; }
ul.plain { list-style: none; padding: 0; margin: 0; } ul.plain li { padding: 6px 0; border-bottom: 1px solid var(--line); } ul.plain li:last-child { border-bottom: 0; }
/* App.heal: while the viewport mode is switched to drop the stale status-bar strip (iPhone Duo), the page is narrower
   for an instant and would flash the phone layout; it is hidden for that instant instead */
html.healing #app, html.healing #tabbar, html.healing #askbtn { visibility: hidden !important; }
/* comments panel: the link to every comment in the app; all-comments page rows */
.drawer-sub { padding: 12px 14px 2px; }
.drawer-sub .btn { display: inline-flex; align-items: center; }   /* a link's padding only counts in the layout once it is a box, so the button no longer touches the heading line */
.cmtrow td { vertical-align: top; } .cmtrow .where { font-weight: 600; } .cmtrow .cbody { white-space: pre-wrap; } .cmtrow.resolved { opacity: .6; }
/* weekly report and expenses */
.statgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-top: 12px; }
.statgrid .stat b { font-size: 20px; }
.weeknav { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.badge.submitted { background: #fff7ed; color: var(--amber); } .badge.approved { background: #e0ecff; color: #1e40af; } .badge.reimbursed { background: #e6f4ea; color: var(--green); } .badge.rejected { background: #f3f4f6; color: #6b7280; }
.rcpt { display: inline-block; margin-right: 6px; } .rcpt img { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); vertical-align: middle; }
/* dialogs stay clear of a status bar or column on either side */
#modal, #confirmbox { padding-left: calc(16px + var(--sal)); padding-right: calc(16px + var(--sar)); }
/* The notification panel is navy with light text in both themes, so it reads as a layer above the page instead of
   blending into the cards beneath it. Each notice is its own lifted row with a gold edge. */
#noticemenu { background: var(--blue); border: 1px solid #2d5aa6; box-shadow: 0 18px 44px rgba(10, 20, 45, .45), 0 0 0 1px rgba(255, 255, 255, .06) inset; padding: 8px; color: #fff; }
#noticemenu::before { content: 'Notifications'; display: block; padding: 4px 8px 8px; font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: #f5c56b; }
#noticemenu .nt { background: rgba(255, 255, 255, .09); color: rgba(255, 255, 255, .88); border-left: 3px solid #f5c56b; margin-bottom: 6px; padding: 9px 11px; line-height: 1.35; }
#noticemenu .nt b { color: #fff; margin-bottom: 2px; }
#noticemenu .nt:hover { background: rgba(255, 255, 255, .17); text-decoration: none; }
#noticemenu .nt .when { color: rgba(255, 255, 255, .62); margin-top: 3px; }
#noticemenu .nt.muted { color: rgba(255, 255, 255, .72); border-left-color: transparent; background: transparent; }
#noticemenu .foot { border-top: 1px solid rgba(255, 255, 255, .18); align-items: center; padding: 8px 8px 2px; }
#noticemenu .foot a { color: #cfe0ff; } #noticemenu .foot button { color: #fff; background: rgba(255, 255, 255, .12); border: 0; }
#noticemenu .foot button:hover { background: rgba(255, 255, 255, .22); }
html.dark #noticemenu { background: #1d3a6b; border-color: #4a76c4; box-shadow: 0 20px 54px rgba(0, 0, 0, .75), 0 0 0 1px rgba(255, 255, 255, .07) inset; }
/* Customize dialogs: a heading for each group, and plain tick rows for what can be added */
.pickhead { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 14px 6px 4px; padding-bottom: 4px; border-bottom: 1px solid var(--line); }
.pickhead:first-of-type { margin-top: 4px; }
.pickhead .muted { text-transform: none; letter-spacing: 0; font-weight: 400; margin-left: 6px; }
.pickrow { display: flex; align-items: center; gap: 8px; padding: 5px 6px 5px 34px; border-radius: 8px; margin: 0; cursor: pointer; }
.pickrow:hover { background: var(--blue-light); } html.dark .pickrow:hover { background: rgba(255, 255, 255, .06); }
.pickrow input, .sortrow input { flex: none; }

/* ---- Every popup wears the notification panel's look: navy, light text, gold accents, in both themes. ----
   The + menu, the account menu, search and name lookups, dialogs, confirmations, the comments panel, the Ask panel and
   the toasts. The colour variables are re-pointed inside each popup, so whatever a page puts in a dialog (muted text,
   lines, links, tables, cards) follows along without each page being touched. */
html:root :is(#quickmenu, #memenu, .ac-list, .modal-card, .confirmcard, #drawer, #askpanel) {
  --ink: #fff; --muted: rgba(255, 255, 255, .68); --line: rgba(255, 255, 255, .2); --card: rgba(255, 255, 255, .07); --bg: rgba(255, 255, 255, .08);
  --blue-light: rgba(255, 255, 255, .14); --blue-mid: #a9c8ff; --amber: #f5c56b; --amber-light: rgba(245, 197, 107, .18); --green: #86e3a4;
  color-scheme: dark; accent-color: #f5c56b;
  background: #16386b; color: #fff; border: 1px solid #2d5aa6;
  box-shadow: 0 18px 44px rgba(10, 20, 45, .45), 0 0 0 1px rgba(255, 255, 255, .06) inset;
}
html.dark:root :is(#quickmenu, #memenu, .ac-list, .modal-card, .confirmcard, #drawer, #askpanel) { background: #1d3a6b; border-color: #4a76c4; box-shadow: 0 20px 54px rgba(0, 0, 0, .75), 0 0 0 1px rgba(255, 255, 255, .07) inset; }
.confirmcard { border-radius: 14px; padding: 18px 20px; max-width: 460px; width: 100%; } .confirmcard p { margin: 0 0 14px; font-size: 15px; line-height: 1.45; }
/* headings: titles stay white, section headings take the gold small caps of the notification panel */
html:root :is(#quickmenu, #memenu, .ac-list, .modal-card, .confirmcard, #drawer, #askpanel) h2 { color: #fff; }
html:root :is(#quickmenu, #memenu, .ac-list, .modal-card, .confirmcard, #drawer, #askpanel) :is(h3, .pickhead), html:root #quickmenu .sec, html:root .drawer-head > b { color: #f5c56b; font-size: 11.5px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
html:root #quickmenu .sec::after { background: linear-gradient(90deg, #f5c56b, transparent); opacity: .45; }
html:root :is(#quickmenu, #memenu, .ac-list, .modal-card, .confirmcard, #drawer, #askpanel) .pickhead { border-bottom-color: rgba(255, 255, 255, .18); } html:root :is(#quickmenu, #memenu, .ac-list, .modal-card, .confirmcard, #drawer, #askpanel) .pickhead .muted { color: rgba(255, 255, 255, .6); }
/* fields */
html:root :is(#quickmenu, #memenu, .ac-list, .modal-card, .confirmcard, #drawer, #askpanel) :is(input:not([type=checkbox]):not([type=radio]), select, textarea) { background: rgba(255, 255, 255, .1); color: #fff; border-color: rgba(255, 255, 255, .3); }
html:root :is(#quickmenu, #memenu, .ac-list, .modal-card, .confirmcard, #drawer, #askpanel) :is(input, textarea)::placeholder { color: rgba(255, 255, 255, .5); }
html:root :is(#quickmenu, #memenu, .ac-list, .modal-card, .confirmcard, #drawer, #askpanel) :is(input, select, textarea):focus { outline: 2px solid rgba(245, 197, 107, .55); border-color: #f5c56b; }
html:root :is(#quickmenu, #memenu, .ac-list, .modal-card, .confirmcard, #drawer, #askpanel) select option { background: #16386b; color: #fff; }
html:root :is(#quickmenu, #memenu, .ac-list, .modal-card, .confirmcard, #drawer, #askpanel) input[type=file] { background: transparent; color: rgba(255, 255, 255, .85); }
/* tables, cards and rows inside a popup */
html:root :is(#quickmenu, #memenu, .ac-list, .modal-card, .confirmcard, #drawer, #askpanel) th { background: rgba(255, 255, 255, .08); color: rgba(255, 255, 255, .72); }
html:root :is(#quickmenu, #memenu, .ac-list, .modal-card, .confirmcard, #drawer, #askpanel) tr.clickable:hover td { background: rgba(255, 255, 255, .1); } html:root :is(#quickmenu, #memenu, .ac-list, .modal-card, .confirmcard, #drawer, #askpanel) tr.selected td { background: rgba(134, 227, 164, .16); }
html:root :is(#quickmenu, #memenu, .ac-list, .modal-card, .confirmcard, #drawer, #askpanel) :is(.card, .stat) { background: rgba(255, 255, 255, .07); border-color: rgba(255, 255, 255, .16); box-shadow: none; }
html:root :is(#quickmenu, #memenu, .ac-list, .modal-card, .confirmcard, #drawer, #askpanel) .cmt { background: rgba(255, 255, 255, .09); border-left-color: #f5c56b; }
html:root :is(#quickmenu, #memenu, .ac-list, .modal-card, .confirmcard, #drawer, #askpanel) :is(.tap-call, .tap-route):hover { color: #fff; }
/* buttons in dialogs and panels: gold for the main action, soft white for the rest */
html:root :is(#memenu, .modal-card, .confirmcard, #drawer, #askpanel) :is(button, .btn):not(.secondary):not(.ghost):not(.danger):not(.star) { background: #f5c56b; color: #10264a; }
html:root :is(#memenu, .modal-card, .confirmcard, #drawer, #askpanel) :is(button, .btn).secondary { background: rgba(255, 255, 255, .14); color: #fff; }
html:root :is(#memenu, .modal-card, .confirmcard, #drawer, #askpanel) button.ghost { background: transparent; color: #cfe0ff; }
html:root :is(#memenu, .modal-card, .confirmcard, #drawer, #askpanel) :is(button, .btn):hover { filter: brightness(1.1); text-decoration: none; }
html:root :is(#memenu, .modal-card, .confirmcard, #drawer, #askpanel) :is(button, .btn):disabled { opacity: .5; filter: none; }
/* the menus and lookups */
html:root #quickmenu :is(a, button):hover, html:root .ac-list .ac-item:is(:hover, .active) { background: rgba(255, 255, 255, .15); }
html:root .ac-list .ac-item { border-bottom-color: rgba(255, 255, 255, .12); } html:root .ac-list .ac-item.new { color: #86e3a4; }
/* the Ask panel's bubbles */
html:root #askpanel #askbody .ask.assistant { background: rgba(255, 255, 255, .09); } html:root #askpanel #askbody .ask.user { background: rgba(245, 197, 107, .22); color: #fff; }
/* toasts */
#toasts .toast { background: #16386b; color: #fff; border: 1px solid #2d5aa6; border-left: 4px solid #f5c56b; box-shadow: 0 12px 30px rgba(10, 20, 45, .45); }
#toasts .toast.ok { background: #16386b; color: #fff; border-left-color: #4ade80; }
#toasts .toast.error { background: #7a1f1f; color: #fff; border-color: #b91c1c; border-left-color: #ffb4b4; }
html.dark #toasts .toast:not(.error) { background: #1d3a6b; border-color: #4a76c4; }
/* comment form: the Post button lines up with the two fields beside it and is the same height */
.cmt-form .row { align-items: flex-end; gap: 8px; }
.cmt-form .row label.f.short { flex: 1 1 110px; }
.cmt-form .row > button { flex: 0 0 auto; align-self: flex-end; height: 34px; padding: 0 16px; font-size: 13.5px; }
@media (max-width: 900px) { .cmt-form .row > button { height: 40px; padding: 0 18px; font-size: 15px; } }
.cmt-form .postingas { margin-top: 6px; }
/* replying: a bar above the box names who is being answered, and the comment itself is marked */
.replybar { font-size: 12.5px; padding: 6px 10px; margin-bottom: 6px; border-radius: 8px; background: var(--blue-light); border-left: 3px solid #f5c56b; }
.replybar a { margin-left: 8px; }
.cmt.replying-to { outline: 2px solid #f5c56b; outline-offset: 1px; }
/* the close button every popup carries in its top right corner (App.popX) */
html:root .popx { position: absolute; top: 6px; right: 8px; z-index: 3; width: 30px; height: 30px; min-width: 0; min-height: 0; padding: 0; display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 8px; background: transparent; color: rgba(255, 255, 255, .82); font-size: 21px; font-weight: 400; line-height: 1; cursor: pointer; text-align: center; }
html:root .popx:hover { background: rgba(255, 255, 255, .15); color: #fff; filter: none; }
html:root .popx.inline { position: static; flex: 0 0 auto; }
.popxrow { position: sticky; top: 0; height: 0; display: flex; justify-content: flex-end; z-index: 3; } html:root .popxrow .popx { position: relative; top: 4px; right: 6px; background: rgba(22, 56, 107, .85); }
.modal-card, .confirmcard { position: relative; }   /* the dropdown menus are already positioned, which is all the x needs */
#modal-body > h2:first-child, .confirmcard p, #memenu .who { padding-right: 30px; }
html:root #quickmenu .sec:first-of-type { padding-right: 36px; }
#toasts .toast { padding-right: 38px; } html:root #toasts .popx { top: 50%; transform: translateY(-50%); right: 5px; width: 26px; height: 26px; font-size: 18px; }
/* the menu sheet on phones closes with an x as well as a swipe; on a wide screen the menu is always there, so no x */
#sheetx { display: none; }
@media (max-width: 900px) { html:root #sidebar #sheetx { display: inline-flex; top: 16px; right: 12px; width: 34px; height: 34px; font-size: 24px; } }
html:root #quickmenu .popx { display: inline-flex; width: 30px; padding: 0; text-align: center; background: transparent; font-size: 21px; font-weight: 400; }
html:root #quickmenu .popx:hover { background: rgba(255, 255, 255, .15); }
/* pull down to refresh: a chip that slides out from under the header as you pull */
#ptr { position: fixed; left: 50%; top: calc(var(--topbar-h, 52px) - 44px); z-index: 18; transform: translate(-50%, 0); opacity: 0; pointer-events: none; display: flex; align-items: center; gap: 8px;
  padding: 8px 15px; border-radius: 999px; background: #16386b; color: #fff; border: 1px solid #2d5aa6; box-shadow: 0 8px 22px rgba(10, 20, 45, .4); font-size: 13px; font-weight: 600; white-space: nowrap; }
html.dark #ptr { background: #1d3a6b; border-color: #4a76c4; }
#ptr.settle { transition: transform .2s ease, opacity .2s ease; }
#ptr .ptr-ic { display: inline-block; color: #f5c56b; font-size: 15px; line-height: 1; transition: transform .15s; }
#ptr.ready .ptr-ic { transform: rotate(180deg); }
#ptr.busy .ptr-ic { animation: ptrspin .8s linear infinite; transition: none; }
@keyframes ptrspin { to { transform: rotate(360deg); } }
@media print { #ptr { display: none; } }
