/* Press Desk — original navy & blue look, with softer cards and cleaner spacing. */
:root {
  --bg: #f5f6f8; --card: #fff; --ink: #1c2230; --muted: #6b7385; --line: #e3e7ee; --line-2: #d5dbe5;
  --brand: #13315c; --brand-2: #1f4f8f; --brand-soft: #e9f0fa; --accent: #c8102e;
  --ok: #1e7b4a; --ok-soft: #e3f4ea; --warn: #a86400; --warn-soft: #fff1d9;
  --bad: #c8102e; --bad-soft: #fde6e9; --info: #1f4f8f; --info-soft: #e6f0ff;
  --radius: 10px; --shadow: 0 1px 2px rgba(16,30,54,.035);
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--ink); }
a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; font-weight: 650; letter-spacing: -.3px; margin: 0 0 20px; }
h2 { font-size: 15px; font-weight: 650; margin: 0 0 12px; }
.ico { width: 16px; height: 16px; vertical-align: -3px; flex-shrink: 0; }

/* ---- side menu ---- */
:root { --side: 236px; --side-closed: 68px; --side-bg: #0f2747; --side-ink: #b9c7dc; }
.side { position: fixed; inset: 0 auto 0 0; width: var(--side); background: var(--side-bg); color: var(--side-ink); z-index: 30;
  display: flex; flex-direction: column; padding: 14px 12px 12px; overflow: hidden; }
.nav-ready .side, .nav-ready .shell { transition: width .2s ease, margin-left .2s ease, transform .2s ease; }
.side-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 44px; padding: 0 2px 0 4px; }
.brand { display: flex; align-items: center; gap: 9px; color: #fff; font-weight: 700; font-size: 16px; min-width: 0; text-decoration: none !important; }
.brand img { height: 34px; max-width: 150px; object-fit: cover; object-position: left center; background: #fff; border-radius: 7px; padding: 2px 6px; display: block; }
.brand b { width: 34px; height: 34px; border-radius: 8px; background: #fff; color: var(--side-bg); display: grid; place-items: center; flex-shrink: 0; }
.side-toggle { width: 28px; height: 28px; flex-shrink: 0; border-radius: 7px; border: 1px solid rgba(255,255,255,.14); background: transparent;
  color: var(--side-ink); display: grid; place-items: center; cursor: pointer; padding: 0; }
.side-toggle:hover { background: rgba(255,255,255,.08); color: #fff; }
.paper { margin: 14px 4px 12px; padding: 0 0 14px; border-bottom: 1px solid rgba(255,255,255,.09); color: #fff; font-size: 15px; font-weight: 650;
  letter-spacing: -.1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; overflow-x: hidden; }
.side a[title] { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 8px; color: var(--side-ink); font-weight: 500;
  white-space: nowrap; position: relative; text-decoration: none; }
.side a[title] .ico { width: 18px; height: 18px; opacity: .85; }
.side a[title]:hover { background: rgba(255,255,255,.06); color: #fff; }
.side a[title].on { background: rgba(143,184,240,.14); color: #fff; }
.side a[title].on::before { content: ''; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: #8fb8f0; }
.side a[title].on .ico { opacity: 1; color: #8fb8f0; }
.side .lbl { overflow: hidden; text-overflow: ellipsis; }
.side .count { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: rgba(255,255,255,.12); color: #fff;
  font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.side .count.red { background: var(--accent); }
.side .sep { height: 1px; background: rgba(255,255,255,.09); margin: 10px 4px; }
.side-foot { border-top: 1px solid rgba(255,255,255,.09); padding-top: 10px; display: flex; flex-direction: column; gap: 4px; }
.me-row { display: flex; align-items: center; gap: 4px; }
.me-row .me { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 6px 6px; border-radius: 8px; color: #fff; font-weight: 500; text-decoration: none !important; }
.me-row .me:hover { background: rgba(255,255,255,.06); }
.av { width: 30px; height: 30px; flex-shrink: 0; border-radius: 50%; background: #2b4b7a; color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.me-row .out { width: 32px; height: 32px; flex-shrink: 0; border: 0; background: none; color: var(--side-ink); border-radius: 8px; cursor: pointer; display: grid; place-items: center; }
.me-row .out:hover { background: rgba(255,255,255,.08); color: #fff; }
.shell { min-height: 100vh; }
.has-side .shell { margin-left: var(--side); }
main { max-width: 1240px; padding: 30px 36px 56px; }
.mob, .scrim { display: none; }

/* collapsed: icon rail */
.nav-closed .side { width: var(--side-closed); padding-left: 10px; padding-right: 10px; }
.nav-closed.has-side .shell, .nav-closed .has-side .shell { margin-left: var(--side-closed); }
.nav-closed .side .lbl, .nav-closed .side .paper { display: none; }
.nav-closed .side-head { flex-direction: column; height: auto; gap: 10px; padding: 0; }
.nav-closed .brand img { width: 36px; height: 36px; max-width: none; padding: 2px; }
.nav-closed .side a[title] { justify-content: center; padding: 10px 0; }
.nav-closed .side a[title].on::before { left: -10px; }
.nav-closed .side .count { position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px; font-size: 10px; padding: 0 4px; }
.nav-closed .me-row { flex-direction: column; } .nav-closed .me-row .me { justify-content: center; padding: 4px 0; }
.nav-closed .side-nav { margin-top: 14px; }

/* ---- layout ---- */
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px 18px; }
.kv div label { margin-bottom: 0; }
.muted { color: var(--muted); } .mini { font-size: 12px; color: var(--muted); }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.pagehead { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 22px; }
.pagehead h1 { margin-bottom: 2px; } .pagehead p { margin: 0; color: var(--muted); font-size: 13px; }

/* ---- cards & stats ---- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; margin-bottom: 20px; box-shadow: var(--shadow); min-width: 0; }
.card > .row.spread:first-child { margin-bottom: 6px; }
.card > .row.spread:first-child h2 { margin-bottom: 0; }

/* one panel of figures, divided by hairlines */
.ledger { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  margin-bottom: 22px; box-shadow: var(--shadow); }
.ledger > a, .ledger > div { padding: 18px 22px; color: inherit; text-decoration: none; border-left: 1px solid var(--line); min-width: 0; }
.ledger > :first-child { border-left: 0; }
.ledger > a:hover { background: #fafbfd; }
.ledger .k { font-size: 13px; color: var(--muted); }
.ledger .v { font-size: 25px; font-weight: 650; letter-spacing: -.4px; margin: 6px 0 2px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ledger .v small { font-size: 14px; font-weight: 500; color: var(--muted); margin-right: 3px; letter-spacing: 0; }
.ledger .s { font-size: 12.5px; color: var(--muted); }
.ledger .warn .v { color: var(--warn); } .ledger .bad .v { color: var(--bad); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(172px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); position: relative; }
.stat .tile { position: absolute; top: 14px; right: 14px; width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: #eef1f5; color: var(--muted); }
.stat .tile.ok { background: var(--ok-soft); color: var(--ok); } .stat .tile.warn { background: var(--warn-soft); color: var(--warn); }
.stat .tile.bad { background: var(--bad-soft); color: var(--bad); } .stat .tile.info { background: var(--brand-soft); color: var(--brand-2); }
.stat .k { color: var(--muted); font-size: 13px; padding-right: 40px; }
.stat .v { font-size: 22px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .s { color: var(--muted); font-size: 12px; }
.stat .go { display: inline-flex; align-items: center; gap: 2px; font-size: 12.5px; font-weight: 600; margin-top: 6px; }
.stat .go .ico { width: 13px; height: 13px; }

/* ---- tables ---- */
table.t { width: 100%; border-collapse: collapse; }
table.t th, table.t td { padding: 11px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.t th { font-size: 12.5px; color: var(--muted); font-weight: 600; background: none; border-bottom-color: var(--line-2); white-space: nowrap; }
table.t tbody tr:hover td { background: #fafbfd; }
table.t tr:last-child td { border-bottom: 0; }
.num { text-align: right !important; font-variant-numeric: tabular-nums; }
tr.pick, tr.clickrow { cursor: pointer; } tr.pick.sel td { background: var(--brand-soft); } tr.on td { background: var(--brand-soft); font-weight: 600; }

/* ---- buttons ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; background: var(--brand-2); color: #fff; border: 1px solid var(--brand-2);
  padding: 9px 16px; border-radius: 8px; cursor: pointer; font: inherit; font-weight: 600; line-height: 1.2; white-space: nowrap; transition: background .15s; }
.btn:hover { background: var(--brand); border-color: var(--brand); text-decoration: none; }
.btn.ghost { background: #fff; color: var(--brand-2); border-color: var(--line-2); }
.btn.ghost:hover { background: var(--brand-soft); }
.btn.sm { padding: 5px 11px; font-size: 13px; }
.btn.red { background: var(--accent); border-color: var(--accent); }
.ib { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 8px;
  border: 1px solid transparent; background: transparent; color: #2a3346; cursor: pointer; padding: 0; transition: background .12s, color .12s; }
.ib .ico { width: 18px; height: 18px; }
.ib:hover { background: #edf1f7; color: var(--brand); text-decoration: none; }
.ib.ok:hover { background: var(--ok-soft); color: var(--ok); } .ib.warn:hover { background: var(--warn-soft); color: var(--warn); }
.ib.red:hover { background: var(--bad-soft); color: var(--bad); }
.ib:focus-visible { outline: 2px solid var(--brand-2); outline-offset: 1px; }
.acts { display: flex; gap: 2px; white-space: nowrap; align-items: center; }
.acts form { margin: 0; }

/* ---- tags ---- */
.tag { display: inline-block; white-space: nowrap; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--brand-soft); color: var(--brand-2); }
.st-paid { background: var(--ok-soft); color: var(--ok); } .st-issued { background: var(--warn-soft); color: var(--warn); }
.st-cancelled, .st-over { background: var(--bad-soft); color: var(--bad); } .st-draft { background: #eceef2; color: var(--muted); }
.st-part { background: var(--info-soft); color: var(--info); }
.pill { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 99px; background: #eceef2; color: var(--muted); margin-left: 4px; }
.amt-pos { color: var(--ok); } .amt-neg { color: var(--accent); }

/* ---- forms ---- */
label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
input, select, textarea { width: 100%; padding: 8px 10px; border: 1px solid #cfd4dd; border-radius: 7px; font: inherit; background: #fff; color: var(--ink); }
input[type=checkbox] { width: auto; accent-color: var(--brand-2); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand-2); box-shadow: 0 0 0 3px #dbe7f8; }
.picker { display: flex; gap: 6px; } .picker select, .picker input { flex: 1; }
.items td { padding: 5px 4px; } .items input { padding: 6px 8px; }
.optsel { display: flex; gap: 6px; flex-wrap: wrap; } .optsel select { width: auto; padding: 5px 6px; font-size: 13px; }
.formula { font-size: 12px; color: var(--muted); }
.totals { margin-left: auto; width: 330px; background: #f8fafc; border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px; }
.totals div { display: flex; justify-content: space-between; padding: 5px 0; border-bottom: 1px dashed var(--line-2); font-variant-numeric: tabular-nums; }
.totals .net { font-weight: 800; font-size: 16px; border-bottom: 0; }

/* ---- tabs ---- */
.tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs a { padding: 6px 13px; border-radius: 8px; background: #fff; border: 1px solid var(--line); color: var(--ink); font-weight: 500; }
.tabs a:hover { text-decoration: none; background: var(--brand-soft); }
.tabs a.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.subtabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; flex-wrap: wrap; }
.subtabs a { padding: 9px 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500; }
.subtabs a.on { color: var(--brand); border-color: var(--brand-2); font-weight: 600; }
.subtabs a:hover { text-decoration: none; color: var(--brand); }

/* ---- messages ---- */
.flash, .err { padding: 10px 14px; border-radius: 9px; margin-bottom: 14px; }
.flash.ok { background: var(--ok-soft); color: var(--ok); } .flash.err, .err { background: var(--bad-soft); color: #8a0b1f; }

/* ---- dialogs ---- */
dialog { border: 0; border-radius: 14px; padding: 0; width: min(560px, 94vw); box-shadow: 0 20px 60px rgba(10,20,40,.3); color: var(--ink); }
dialog::backdrop { background: rgba(15,25,45,.45); }
dialog .dh { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
dialog .dh h2 { margin: 0; }
dialog .db { padding: 16px 18px; max-height: 70vh; overflow-y: auto; }
dialog .df { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; background: #f8fafc; }
dialog.wide { width: min(860px, 96vw); }

/* ---- login & chat ---- */
.login { max-width: 400px; margin: 0 auto; padding: 12vh 0 40px; }
body:not(.has-side) { background: linear-gradient(var(--side-bg) 0 300px, var(--bg) 300px); }
.login-mark { display: flex; align-items: center; justify-content: center; gap: 10px; color: #fff; font-size: 20px; font-weight: 700; margin-bottom: 22px; }
.login-mark img { max-height: 56px; max-width: 240px; background: #fff; border-radius: 10px; padding: 6px 10px; }
.login-mark .pd { width: 38px; height: 38px; border-radius: 9px; background: #fff; color: var(--side-bg); display: grid; place-items: center; }
.login .card { padding: 30px 30px 26px; box-shadow: 0 18px 50px rgba(10,25,50,.18); border: 0; }
.login h1 { margin-bottom: 4px; } .login .card > p.muted { margin: 0 0 20px; }
.chat { display: flex; flex-direction: column; height: calc(100vh - 150px); min-height: 460px; padding: 0; overflow: hidden; }
.msgs { flex: 1; overflow-y: auto; padding: 22px 24px; display: flex; flex-direction: column; gap: 14px; }
.msg { max-width: 82%; padding: 11px 15px; border-radius: 12px; line-height: 1.55; overflow-wrap: anywhere; }
.msg.user { align-self: flex-end; background: var(--brand-2); color: #fff; border-bottom-right-radius: 4px; white-space: pre-wrap; }
.msg.assistant { align-self: flex-start; background: #f6f8fb; border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg p { margin: 0 0 8px; } .msg p:last-child { margin-bottom: 0; }
.msg ul, .msg ol { margin: 4px 0 8px; padding-left: 20px; } .msg h4 { margin: 10px 0 6px; font-size: 14px; }
.msg code { background: #eef1f6; padding: 1px 5px; border-radius: 4px; font-size: 12.5px; }
.msg .mdt { overflow-x: auto; margin: 6px 0 10px; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.msg .mdt table.t th, .msg .mdt table.t td { padding: 7px 10px; font-size: 13px; white-space: nowrap; }
.msg .bad { color: var(--bad); }
.msg .thinking { color: var(--muted); }
.msg .thinking::after { content: ''; display: inline-block; width: 1em; text-align: left; animation: dots 1.2s steps(4) infinite; }
@keyframes dots { 0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75% { content: '...'; } }
@media (prefers-reduced-motion: reduce) { .msg .thinking::after { animation: none; } }
.how { margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.how summary { cursor: pointer; } .how > div { margin-top: 8px; }
.how pre { margin: 4px 0 0; padding: 8px 10px; background: #fff; border: 1px solid var(--line); border-radius: 6px; white-space: pre-wrap; font-size: 11.5px; color: var(--ink); }
.chips[hidden] { display: none; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 24px 10px; margin: 0; }
.chips button { background: #fff; border: 1px solid var(--line-2); border-radius: 99px; padding: 5px 12px; cursor: pointer; font: inherit; font-size: 13px; color: var(--ink); }
.chips button:hover { background: var(--brand-soft); border-color: var(--brand-soft); }
.ask { display: flex; gap: 10px; align-items: flex-end; padding: 14px 24px 18px; border-top: 1px solid var(--line); }
.ask textarea { flex: 1; resize: none; min-height: 42px; max-height: 140px; line-height: 1.45; padding: 10px 12px; }
.ask .btn { height: 42px; padding: 0 20px; }
iframe.pdf { width: 100%; height: 80vh; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }

@media (max-width: 900px) {
  .has-side .shell, .nav-closed .has-side .shell { margin-left: 0; }
  .side, .nav-closed .side { width: 264px; transform: translateX(-100%); padding: 14px 12px 12px; }
  .nav-closed .side .lbl { display: inline; } .nav-closed .side .paper { display: block; }
  .nav-closed .side-head { flex-direction: row; } .nav-closed .side a[title] { justify-content: flex-start; padding: 9px 10px; }
  .nav-closed .me-row { flex-direction: row; } .nav-closed .side .count { position: static; }
  .nav-open .side { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  .nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(10,20,40,.4); z-index: 25; }
  .mob { display: flex; align-items: center; gap: 12px; height: 56px; padding: 0 16px; background: var(--side-bg); position: sticky; top: 0; z-index: 20; }
  .mob .ib { background: transparent; border-color: rgba(255,255,255,.2); color: #fff; }
  .ledger { grid-template-columns: 1fr 1fr; } .ledger > :nth-child(3) { border-left: 0; } .ledger > :nth-child(n+3) { border-top: 1px solid var(--line); }
  main { padding: 18px 16px 40px; } .split { grid-template-columns: 1fr; } .totals { width: 100%; }
  .items { display: block; overflow-x: auto; }
}
@media print {
  .side, .mob, .scrim, .noprint, .subtabs, .flash { display: none !important; }
  .has-side .shell { margin-left: 0 !important; }
  body { background: #fff; } main { padding: 0; max-width: none; }
  .card, .stat { box-shadow: none; border-color: #bbb; break-inside: avoid; }
}
.pw { position: relative; }
.pw input { padding-right: 40px; }
.pw-eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 32px; height: 30px; border: 0; background: none;
  color: var(--muted); cursor: pointer; display: grid; place-items: center; border-radius: 6px; }
.pw-eye:hover { color: var(--brand-2); background: var(--brand-soft); }
.navdot { display: inline-grid; place-items: center; min-width: 17px; height: 17px; padding: 0 4px; margin-left: 5px; border-radius: 9px;
  background: var(--accent); color: #fff; font-size: 10.5px; font-weight: 700; vertical-align: 1px; }
tr.hl td { background: #fff7e6; } tr.hl td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
tr.dim td { color: #9aa1ad; } tr.dim td a { color: #7f93b3; }

/* ---- home ---- */
.findbar { display: flex; align-items: center; background: #fff; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; height: 38px; }
.findbar select { width: auto; border: 0; border-right: 1px solid var(--line); border-radius: 0; height: 100%; padding: 0 8px; background: #fafbfc; font-size: 13px; }
.findbar input { border: 0; border-radius: 0; height: 100%; width: 250px; box-shadow: none !important; }
.findbar button { border: 0; background: none; color: var(--brand-2); width: 40px; height: 100%; cursor: pointer; display: grid; place-items: center; }
.findbar button:hover { background: var(--brand-soft); }
.findbar:focus-within { border-color: var(--brand-2); box-shadow: 0 0 0 3px #dbe7f8; }
details.menu { position: relative; }
details.menu > summary { list-style: none; } details.menu > summary::-webkit-details-marker { display: none; }
details.menu > div { position: absolute; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(16,30,54,.12); padding: 6px; min-width: 160px; z-index: 10; display: flex; flex-direction: column; }
details.menu > div button, details.menu > div a { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border: 0; background: none; border-radius: 7px;
  font: inherit; color: var(--ink); cursor: pointer; text-align: left; }
details.menu > div button:hover, details.menu > div a:hover { background: var(--brand-soft); text-decoration: none; }
table.t.compact td { padding: 10px 8px; vertical-align: middle; }
table.t.compact tr:first-child td { border-top: 0; }
.owe { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.owe > div { min-width: 0; }
.owe h3 { font-size: 12.5px; font-weight: 600; color: var(--muted); margin: 6px 0 6px; }
.owe a { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); color: var(--ink); }
.owe a:last-child { border-bottom: 0; }
.owe a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.owe a b { font-variant-numeric: tabular-nums; font-weight: 600; }
.owe a:hover { text-decoration: none; } .owe a:hover span { color: var(--brand-2); }
@media (max-width: 900px) { .findbar input { width: 100%; } .findbar { flex: 1 1 100%; } .owe { grid-template-columns: 1fr; } }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 10px 12px; margin-bottom: 14px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.tb-search { display: flex; gap: 8px; align-items: center; flex: 1 1 380px; min-width: 0; }
.tb-search select { width: 130px; }
.exportbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; flex-basis: 100%; padding-top: 10px; border-top: 1px solid var(--line); }
.exportbar .eb-title { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; margin-right: 2px; }
.exportbar select { width: 190px; }
.exportbar .eb-or { color: var(--muted); font-size: 13px; }
.exportbar details.menu > div { left: 0; right: auto; min-width: 210px; }
.btn[disabled] { opacity: .45; cursor: default; }

/* tables: quieter links, one strong link per row */
.nw { white-space: nowrap; }
table.t td a { color: var(--ink); }
table.t td a:hover { color: var(--brand-2); }
table.t td a.billno { color: var(--brand-2); font-weight: 650; }
table.t td .mini { margin-top: 1px; }
details.menu.more > summary.ib { list-style: none; }
details.menu.more > div { min-width: 200px; }
details.menu > div form { margin: 0; } details.menu > div form button { width: 100%; }
details.menu > div .danger { color: var(--bad); }
/* figure tiles: no icon squares, numbers carry the weight */
.stat .tile { display: none; }
.stat .k { padding-right: 0; }
.stat .v { font-size: 21px; font-weight: 650; letter-spacing: -.3px; }
@media (max-width: 600px) { table.t.compact td:nth-child(3) { display: none; } }
.month-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin: 28px 0 14px; scroll-margin-top: 16px; }
.month-head h2 { font-size: 20px; margin: 0 0 2px; } .month-head p { margin: 0; font-size: 13px; }
.month-head select { width: 190px; } .month-head form { margin: 0; }
.monthbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; margin: -8px 0 20px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.monthbar .mb-title { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; margin-right: 4px; }
.monthbar select { width: 230px; }

/* ---- AI: history page ---- */
.hist > table { width: 100%; border-collapse: separate; border-spacing: 0 12px; margin-top: -12px; }
.hist > table > tbody > tr > td { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.hq { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.hq b { display: block; font-size: 15px; } .hq .mini { display: block; margin-top: 2px; }
.ha { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); line-height: 1.55; overflow-wrap: anywhere; }
.ha p { margin: 0 0 8px; } .ha ul, .ha ol { margin: 4px 0 8px; padding-left: 20px; } .ha h4 { margin: 10px 0 6px; }
.ha .mdt, .ask-panel .mdt { overflow-x: auto; margin: 6px 0 10px; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.ha .mdt table.t th, .ha .mdt table.t td, .ask-panel .mdt table.t th, .ask-panel .mdt table.t td { padding: 7px 10px; font-size: 13px; white-space: nowrap; }
.empty { text-align: center; padding: 40px 20px; } .empty p { margin: 4px 0; }

/* ---- AI: Ask me anything button + panel ---- */
.ask-fab { position: fixed; right: 24px; bottom: 24px; z-index: 40; display: inline-flex; align-items: center; gap: 10px; height: 50px; padding: 0 22px 0 18px;
  border-radius: 25px; border: 0; background: #fff; color: #161b26; font: inherit; font-size: 14.5px; font-weight: 700; white-space: nowrap; cursor: grab;
  touch-action: none; user-select: none; isolation: isolate; box-shadow: 0 10px 28px rgba(20,30,50,.16), 0 2px 6px rgba(20,30,50,.08); }
/* the colourful ring: a gradient border around a white pill */
.ask-fab .ring { position: absolute; inset: 0; border-radius: inherit; padding: 2.5px; z-index: -1; pointer-events: none;
  background: conic-gradient(from 200deg, #19b8c4, #3b82f6, #22c55e, #d9e43a, #19b8c4);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; }
.ask-fab .ico { width: 20px; height: 20px; color: #161b26; }
.ask-fab:hover { box-shadow: 0 14px 34px rgba(20,30,50,.2), 0 2px 6px rgba(20,30,50,.08); }
.ask-fab.on { background: #fff; } .ask-fab.on .ico { color: var(--brand-2); }
.ask-fab.dragging { cursor: grabbing; box-shadow: 0 18px 40px rgba(20,30,50,.26); }
.ask-fab:focus-visible { outline: 3px solid #8fb8f0; outline-offset: 2px; }
.ask-panel { position: fixed; z-index: 39; width: min(420px, calc(100vw - 28px)); height: min(600px, calc(100vh - 110px)); display: flex; flex-direction: column;
  background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 24px 60px rgba(15,39,71,.22); overflow: hidden; }
.ask-panel[hidden] { display: none; }
.ask-panel header { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 12px 12px 16px; border-bottom: 1px solid var(--line); }
.ask-panel header b { display: inline-flex; align-items: center; gap: 8px; } .ask-panel header b .ico { color: var(--brand-2); }
.ask-panel header div { display: flex; align-items: center; gap: 2px; }
.ask-panel header .ask-new, .ask-panel header .ask-hist { font: inherit; font-size: 13px; padding: 5px 9px; border-radius: 7px; border: 0; background: none; color: var(--brand-2); cursor: pointer; }
.ask-panel header .ask-new:hover, .ask-panel header .ask-hist:hover { background: var(--brand-soft); text-decoration: none; }
.ask-panel header .ask-x { width: 30px; height: 30px; border: 0; background: none; border-radius: 7px; cursor: pointer; color: var(--muted); display: grid; place-items: center; }
.ask-panel header .ask-x:hover { background: #edf1f7; color: var(--ink); }
.ask-msgs { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.ask-panel .msg { max-width: 92%; font-size: 13.5px; }
.ask-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 10px; }
.ask-chips[hidden] { display: none; }
.ask-chips button { background: #fff; border: 1px solid var(--line-2); border-radius: 99px; padding: 4px 11px; font: inherit; font-size: 12.5px; cursor: pointer; color: var(--ink); }
.ask-chips button:hover { background: var(--brand-soft); border-color: var(--brand-soft); }
.ask-form { display: flex; gap: 8px; align-items: flex-end; padding: 12px; border-top: 1px solid var(--line); }
.ask-form textarea { flex: 1; resize: none; min-height: 40px; max-height: 120px; padding: 9px 11px; line-height: 1.4; }
.ask-form .btn { height: 40px; }
@media print { .ask-fab, .ask-panel { display: none !important; } }

/* ---- date picker ---- */
.flatpickr-calendar { border-radius: 12px; border: 1px solid var(--line); box-shadow: 0 16px 40px rgba(15,39,71,.16); font-family: inherit; }
.flatpickr-calendar.arrowTop::before, .flatpickr-calendar.arrowTop::after, .flatpickr-calendar.arrowBottom::before, .flatpickr-calendar.arrowBottom::after { display: none; }
.flatpickr-months { padding: 6px 4px 0; } .flatpickr-current-month { font-size: 14px; font-weight: 650; padding-top: 8px; }
.flatpickr-current-month .numInputWrapper { width: 6ch; } .flatpickr-current-month input.cur-year { font-weight: 650; }
.flatpickr-months .flatpickr-prev-month, .flatpickr-months .flatpickr-next-month { top: 6px; border-radius: 8px; padding: 8px; }
.flatpickr-months .flatpickr-prev-month:hover, .flatpickr-months .flatpickr-next-month:hover { background: var(--brand-soft); }
.flatpickr-months .flatpickr-prev-month:hover svg, .flatpickr-months .flatpickr-next-month:hover svg { fill: var(--brand-2); }
span.flatpickr-weekday { color: var(--muted); font-weight: 600; font-size: 12px; }
.flatpickr-day { border-radius: 8px; color: var(--ink); font-weight: 500; }
.flatpickr-day:hover { background: var(--brand-soft); border-color: var(--brand-soft); }
.flatpickr-day.today { border-color: #8fb8f0; }
.flatpickr-day.selected, .flatpickr-day.selected:hover { background: var(--brand-2); border-color: var(--brand-2); color: #fff; }
.flatpickr-day.prevMonthDay, .flatpickr-day.nextMonthDay { color: #b5bccb; }
.fp-foot { display: flex; justify-content: space-between; padding: 6px 10px 10px; border-top: 1px solid var(--line); }
.fp-foot button { border: 0; background: none; font: inherit; font-size: 13px; font-weight: 600; color: var(--brand-2); padding: 5px 8px; border-radius: 6px; cursor: pointer; }
.fp-foot button:hover { background: var(--brand-soft); }
input.fp-alt { background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7385' stroke-width='2' stroke-linecap='round'%3E%3Crect x='3' y='5' width='18' height='16' rx='2'/%3E%3Cpath d='M3 10h18M8 3v4M16 3v4'/%3E%3C/svg%3E") no-repeat right 10px center / 16px; padding-right: 34px; cursor: pointer; }
.multi-cal { display: flex; gap: 18px; flex-wrap: wrap; align-items: flex-start; }
.multi-cal .flatpickr-calendar.inline { box-shadow: none; border: 1px solid var(--line); }
.multi-cal .picked { flex: 1; min-width: 160px; padding-top: 6px; } .multi-cal .picked .mini { margin-top: 6px; line-height: 1.6; }

/* Excel files made by the assistant */
.ai-files { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 4px; }
.ai-file { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--line-2); border-radius: 10px; background: #fff; color: var(--ink); max-width: 340px; }
.ai-file .ico { width: 22px; height: 22px; color: #1d7a45; flex-shrink: 0; }
.ai-file b { display: block; font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-file small { color: var(--muted); font-size: 12px; } .ai-file span { min-width: 0; }
.ai-file:hover { border-color: #1d7a45; background: #f3faf6; text-decoration: none; }

/* ---- AI Summaries history: one striped row per question, click to read the reply ---- */
.hlist { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.hrow { border-top: 1px solid var(--line); }
.hrow:first-child { border-top: 0; }
.hrow:nth-child(even) > summary { background: #f8fafc; }
.hrow > summary { display: flex; align-items: center; gap: 12px; padding: 13px 18px; cursor: pointer; list-style: none; }
.hrow > summary::-webkit-details-marker { display: none; }
.hrow > summary:hover { background: #eef3fa; }
.hrow[open] > summary { background: var(--brand-soft); }
.hq-ico { width: 30px; height: 30px; border-radius: 8px; background: #eef1f6; color: var(--brand-2); display: grid; place-items: center; flex-shrink: 0; }
.hq-ico .ico { width: 16px; height: 16px; }
.hq-text { flex: 1; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hq-tag { font-size: 11.5px; font-weight: 600; color: #1d7a45; background: #e5f5ec; border-radius: 99px; padding: 2px 8px; }
.hq-time { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.hq-chev { color: var(--muted); transition: transform .15s; } .hrow[open] .hq-chev { transform: rotate(180deg); }
.hbody { padding: 4px 18px 16px 60px; }
.hq-full { margin: 10px 0 0; padding: 10px 14px; background: var(--brand-2); color: #fff; border-radius: 12px 12px 4px 12px; width: fit-content; max-width: 80%; margin-left: auto; white-space: pre-wrap; }
.hbody .ha { margin-top: 12px; padding: 14px 16px; border: 1px solid var(--line); border-top: 1px solid var(--line); border-radius: 12px 12px 12px 4px; background: #f6f8fb; max-width: 92%; }
.hacts { display: flex; gap: 6px; margin-top: 10px; }
.hacts form { margin: 0; }
.hacts .btn.done { color: var(--ok); border-color: var(--ok); }
.btn.danger-t { color: var(--bad); } .btn.danger-t:hover { background: var(--bad-soft); }
@media (max-width: 700px) { .hbody { padding-left: 16px; } .hq-time { display: none; } }
/* ---- backup ---- */
.backup .card { max-width: 760px; }
.bk-list { margin: 6px 0 18px; padding-left: 18px; line-height: 1.75; }
.bk-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.bk-form select { width: 200px; }
.chk { display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; font-weight: 500; color: var(--ink); margin: 0 0 9px; }
/* invoice form: size as CM × Col = Total, custom rate */
.sizebox { display: flex; align-items: center; gap: 4px; }
.sizebox input { width: 62px; padding: 6px 6px; text-align: center; }
.sizebox .s-tot { width: 72px; font-weight: 600; background: #f6f8fb; }
.sizebox span { color: var(--muted); font-weight: 600; }
.custom-rate { display: flex; gap: 12px; grid-column: span 2; }
.custom-rate > div { flex: 1; }
