[hidden] { display: none !important; }
:root {
  --bg: #f4f2ee; --panel: #ffffff; --ink: #1d1c1a; --muted: #6b6760; --line: #e6e2da; --line2: #d3cec4;
  --accent: #0f5d5a; --accent-ink: #fff; --accent-soft: #e2efed; --warn: #a3401f; --warn-soft: #f8e7e0;
  --good: #2e6b33; --good-soft: #e6f1e3; --tax: #6b4e00; --tax-soft: #fbf3dc; --amber: #8a5a00; --amber-soft: #fff1d6;
  --wa: #128c4a; --radius: 8px; --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.45 "Segoe UI", system-ui, -apple-system, Arial, sans-serif; }
a { color: var(--accent); text-decoration: none; } a:hover { text-decoration: underline; }
h1 { font-size: 20px; margin: 0; letter-spacing: -.2px; }
h2 { font-size: 15px; margin: 0 0 10px; }
h3 { font-size: 12px; margin: 0 0 8px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); }

.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 22px; padding: 0 20px; height: 52px; background: var(--ink); color: #fff; }
.brand { font-size: 17px; color: #fff; } .brand b { color: #7fd1c9; } .brand:hover { text-decoration: none; }
.top nav { display: flex; gap: 2px; flex: 1; overflow-x: auto; }
.top nav a { color: #cfcac1; padding: 7px 11px; border-radius: 6px; white-space: nowrap; }
.top nav a:hover { text-decoration: none; color: #fff; background: #ffffff14; }
.top nav a.on { color: #fff; background: #ffffff24; }
.badge { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: #e8743b; color: #fff; font-size: 11px; text-align: center; font-weight: 700; }
.who { color: #cfcac1; font-size: 12.5px; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.who select { background: #2b2a27; color: #fff; border: 1px solid #44423d; }
.who select.need { outline: 2px solid #e8743b; }

main { max-width: 1600px; margin: 0 auto; padding: 20px 22px 90px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; } .grow { flex: 1; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px; }
.muted { color: var(--muted); } .small { font-size: 12.5px; } .mono { font-family: var(--mono); font-size: 12.5px; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }

input, select, textarea, button { font: inherit; color: inherit; }
input, select, textarea { padding: 6px 8px; border: 1px solid var(--line2); border-radius: 6px; background: #fff; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
input[readonly] { background: #f6f4f0; color: var(--muted); }
textarea { resize: vertical; }
label.f { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
label.f > input, label.f > select, label.f > textarea { color: var(--ink); font-size: 14px; }
label.chk { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 6px; border: 1px solid var(--line2); background: #fff; cursor: pointer; white-space: nowrap; color: var(--ink); }
.btn:hover { border-color: var(--ink); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.1); }
.btn.wa { background: var(--wa); border-color: var(--wa); color: #fff; }
.btn.danger { color: var(--warn); border-color: #e2b7a8; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { padding: 3px 9px; font-size: 12.5px; }
.btn.lg { padding: 10px 18px; font-size: 15px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

table.t { width: 100%; border-collapse: collapse; }
table.t th { text-align: left; font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; padding: 8px; border-bottom: 1px solid var(--line2); background: #faf9f6; }
table.t td { padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t tr.click { cursor: pointer; } table.t tr.click:hover td { background: #faf8f3; }
table.t tr.tax td { background: var(--tax-soft); color: var(--tax); }
table.t tr.cancelled td { color: #aaa; } table.t tr.cancelled td .strike, table.t tr.cancelled td .docno { text-decoration: line-through; }
table.t tr.sel td { background: var(--accent-soft); }
table.t tfoot td { font-weight: 600; border-top: 1.5px solid var(--ink); border-bottom: 0; }
.scroll { overflow-x: auto; }

.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; background: #eeebe5; color: var(--muted); white-space: nowrap; }
.pill.open { background: var(--amber-soft); color: var(--amber); }
.pill.inv { background: var(--accent-soft); color: var(--accent); }
.pill.cx { background: var(--warn-soft); color: var(--warn); }
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.lock::before { content: "🔒 "; font-size: 10px; }

.grid { display: grid; gap: 10px 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } .g5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.span2 { grid-column: span 2; } .span3 { grid-column: span 3; } .span4 { grid-column: span 4; }

/* ledger finder */
.finder { position: relative; flex: 1; max-width: 640px; }
.finder input { width: 100%; font-size: 16px; padding: 10px 14px; border-width: 1.5px; }
.finder .results { position: absolute; top: calc(100% + 4px); left: 0; right: 0; background: #fff; border: 1px solid var(--line2); border-radius: 8px; box-shadow: 0 10px 30px #0002; max-height: 420px; overflow: auto; z-index: 15; }
.finder .results a { display: flex; gap: 10px; align-items: baseline; padding: 8px 12px; color: var(--ink); border-bottom: 1px solid var(--line); }
.finder .results a:hover, .finder .results a.hi { background: var(--accent-soft); text-decoration: none; }

.ledger-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.ledger-no { font-family: var(--mono); background: var(--ink); color: #fff; padding: 2px 9px; border-radius: 5px; font-size: 16px; }
.preview-name { font-size: 18px; padding: 10px 12px; border: 1px dashed var(--line2); border-radius: 6px; background: #faf9f6; }

.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 16px; }
.kpis > div { padding: 12px 16px; border-left: 1px solid var(--line); } .kpis > div:first-child { border-left: 0; }
.kpis span { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }
.kpis b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; margin-top: 2px; }
.kpis .due b { color: var(--warn); } .kpis .ok b { color: var(--good); }

/* booking entry grid — full width */
.entry { width: 100%; border-collapse: collapse; min-width: 1560px; }
.entry th { font-size: 11px; color: var(--muted); text-align: left; padding: 4px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; white-space: nowrap; }
.entry td { padding: 3px 4px; }
.entry input, .entry select { width: 100%; padding: 6px 7px; font-size: 14px; }
.entry .w-svc { width: 210px; } .entry .w-num { width: 120px; } .entry .w-pax { width: 64px; } .entry .w-dt { width: 140px; } .entry .w-chk { width: 46px; text-align: center; } .entry .w-vendor { width: 190px; }

.split { display: grid; grid-template-columns: minmax(0, 1fr) 390px; gap: 16px; align-items: start; }
.invbox { position: sticky; top: 68px; border: 2px solid var(--accent); }
.invbox.reissue { border-color: var(--amber); }
.invbox .totals td { padding: 4px 0; }
.invbox .totals .big td { font-size: 18px; font-weight: 700; border-top: 1.5px solid var(--ink); padding-top: 8px; }
.invbox input.amt { width: 110px; text-align: right; }
.banner { padding: 10px 12px; border-radius: 6px; background: var(--amber-soft); color: var(--amber); margin-bottom: 12px; font-size: 13px; }
.banner.info { background: var(--accent-soft); color: var(--accent); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line2); margin: -4px 0 12px; }
.tabs button { border: 0; background: none; padding: 8px 12px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }

/* customer tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); gap: 14px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px 12px; cursor: pointer; display: flex; flex-direction: column; gap: 8px; transition: box-shadow .15s, border-color .15s; }
.tile:hover { border-color: var(--accent); box-shadow: 0 4px 16px #0f5d5a1f; }
.tile .no { font-family: var(--mono); font-size: 26px; font-weight: 700; line-height: 1; }
.tile .nm { font-weight: 600; line-height: 1.3; min-height: 2.6em; }
.tile dl { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; margin: 0; font-size: 13px; }
.tile dt { color: var(--muted); } .tile dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.tile dd.due { color: var(--warn); font-weight: 700; } .tile dd.ok { color: var(--good); }
.tile dd.neg { color: var(--warn); }
.tile .ft { display: flex; gap: 6px; flex-wrap: wrap; min-height: 20px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips button { border: 1px solid var(--line2); background: #fff; border-radius: 999px; padding: 4px 12px; cursor: pointer; }
.chips button.on { background: var(--ink); color: #fff; border-color: var(--ink); }

.vote { display: inline-flex; gap: 6px; align-items: center; padding: 3px 10px; border-radius: 999px; background: #eeebe5; font-size: 12.5px; }
.vote.approve { background: var(--good-soft); color: var(--good); } .vote.reject { background: var(--warn-soft); color: var(--warn); }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 8px; box-shadow: 0 6px 20px #0003; z-index: 100; max-width: 90vw; }
.toast.err { background: var(--warn); }
dialog { border: 0; border-radius: 10px; padding: 0; box-shadow: 0 20px 60px #0004; width: min(760px, 94vw); }
dialog::backdrop { background: #1d1c1a66; }
dialog form { padding: 20px 22px; max-height: 88vh; overflow: auto; }
dialog .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.empty { padding: 36px; text-align: center; color: var(--muted); }
.sumbar { display: flex; gap: 28px; flex-wrap: wrap; }
.sumbar div span { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.sumbar div b { font-size: 17px; font-variant-numeric: tabular-nums; }
iframe.doc { width: 100%; height: 75vh; border: 1px solid var(--line); border-radius: 8px; background: #efece6; }
.sharebox { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin-top: 12px; }

#rtab td, #rtab th { white-space: nowrap; } #rtab td:nth-child(4) { white-space: normal; min-width: 240px; }

@media (max-width: 1100px) {
  .split { grid-template-columns: 1fr; } .invbox { position: static; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g4, .g5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media print { .top, .no-print { display: none !important; } }

/* ---------- v3 ---------- */
.works { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }
.work { display: grid; grid-template-columns: 42px 1fr; grid-template-rows: auto auto auto; column-gap: 12px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 16px 18px; color: var(--ink); transition: box-shadow .15s, border-color .15s, transform .15s; min-height: 132px; }
.work:hover { text-decoration: none; border-color: var(--accent); box-shadow: 0 6px 20px #0f5d5a1f; transform: translateY(-1px); }
.work .wi { grid-row: span 3; width: 42px; height: 42px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-size: 20px; }
.work .wt { font-weight: 600; } .work .wb { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; margin: 2px 0; }
.work .ws { font-size: 12.5px; color: var(--muted); }
.work.primary { background: var(--accent); color: #fff; border-color: var(--accent); } .work.primary .ws { color: #d4ebe8; }
.work.primary .wi { background: #ffffff26; color: #fff; }
.work.warn .wi { background: var(--amber-soft); color: var(--amber); } .work.warn .wb { color: var(--amber); }
.work.danger .wi { background: var(--warn-soft); color: var(--warn); } .work.danger .wb { color: var(--warn); }
table.t tr.rev td { background: var(--warn-soft); color: var(--warn); }
.strike { text-decoration: line-through; }
td.due { color: var(--warn); font-weight: 600; }
input.need, .entry input.need { border-color: var(--amber); background: var(--amber-soft); }
.tile .incharge { font-size: 12.5px; color: var(--muted); border-top: 1px dashed var(--line); padding-top: 6px; } .tile .incharge b { color: var(--ink); }
.thread { display: flex; flex-direction: column; gap: 8px; max-height: 50vh; overflow: auto; margin-top: 8px; }
.thread .msg { background: #f6f4f0; border-radius: 8px; padding: 8px 12px; max-width: 85%; }
.thread .msg.me { background: var(--accent-soft); align-self: flex-end; }
body.signed-out #nav, body.signed-out #who { display: none; }
.who { display: flex; align-items: center; gap: 8px; color: #cfcac1; font-size: 13px; white-space: nowrap; }
.who .btn { background: #2b2a27; color: #fff; border-color: #44423d; }
.login { max-width: 420px; margin: 8vh auto; } .login h1 { font-size: 24px; margin-bottom: 4px; }
.landing { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin: 14px 0 22px; }
.bigbtn { display: flex; flex-direction: column; gap: 6px; padding: 24px; border-radius: 14px; border: 1.5px solid var(--line2); background: var(--panel); color: var(--ink); cursor: pointer; text-align: left; font: inherit; }
.bigbtn:hover { border-color: var(--accent); text-decoration: none; box-shadow: 0 6px 20px #0f5d5a1f; }
.bigbtn b { font-size: 20px; } .bigbtn span { color: var(--muted); font-size: 13px; }
.bigbtn.primary { background: var(--accent); color: #fff; border-color: var(--accent); } .bigbtn.primary span { color: #d4ebe8; }
.bigbtn.warn { border-color: #e8743b; } .bigbtn.warn b { color: #b4521f; }
.entry .w-svc { min-width: 210px; } .entry select[name=service] { min-width: 200px; }

/* v7 */
dialog form { position: relative; }
.dlg-x { position: absolute; top: 10px; right: 12px; width: 32px; height: 32px; border: 0; border-radius: 6px; background: transparent;
  font-size: 22px; line-height: 1; color: var(--muted); cursor: pointer; z-index: 2; }
.dlg-x:hover { background: #0000000f; color: var(--ink); }
dialog form > h2:first-of-type { padding-right: 36px; }
body.viewonly #entryPanel, body.viewonly #invbox, body.viewonly main button.btn, body.viewonly #newCust,
body.viewonly .pick, body.viewonly [data-nav="settings"], body.viewonly .ledger-head .btn { display: none !important; }
body.viewonly .split { grid-template-columns: 1fr !important; }
/* search results inside the green "Find customer" box: normal dark text */
.bigbtn .finder .results a, .bigbtn .finder .results a span { color: var(--ink); }
.bigbtn .finder .results a .muted, .bigbtn .finder .results a .small { color: var(--muted); }
.bigbtn .finder .results .empty { color: var(--ink); }

.credit { text-align: center; font-size: 11.5px; color: var(--muted); padding: 18px 0 26px; }

.licbar { background: var(--amber-soft); color: var(--amber); padding: 8px 22px; font-size: 13.5px; border-bottom: 1px solid #e9d29a; }
.licbar.stop { background: var(--warn-soft); color: var(--warn); font-weight: 600; }
body.licence-off #entryPanel, body.licence-off #invbox, body.licence-off #newCust { display: none !important; }
@media (max-width: 1600px) { .top nav a { padding: 7px 8px; font-size: 14px; } .top .brand { margin-right: 4px; } }
