/* Blue Bee Billing · single stylesheet, mobile first */
:root {
  --brand: #0071B8; --brand-d: #003A5D; --brand-50: #EAF4FB; --brand-100: #D3E8F6;
  --bg: #F4F6FA; --card: #FFFFFF; --line: #E6E9EF; --line-2: #F0F2F5;
  --text: #1B2433; --muted: #667085; --faint: #98A2B3;
  --ok: #067647; --ok-bg: #ECFDF3; --warn: #B54708; --warn-bg: #FFFAEB; --bad: #B42318; --bad-bg: #FEF3F2; --info-bg: #EFF8FF;
  --c1: #0071B8; --c2: #F59E0B; --c3: #12B76A; --c4: #7A5AF8; --c5: #EE46BC; --c6: #06AED4;
  --r: 12px; --r-sm: 8px; --sh: 0 1px 2px rgba(16,24,40,.05); --sh-lg: 0 12px 32px rgba(16,24,40,.16);
  --side: 244px; --top: 60px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
svg[aria-hidden] { width: 16px; height: 16px; flex: none; vertical-align: -3px; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 14px/1.5 var(--font); color: var(--text); background: var(--bg); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 16px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 650; }
p { margin: 0 0 8px; }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 12.5px; } .tiny { font-size: 11.5px; }
.bold { font-weight: 650; } .num { font-variant-numeric: tabular-nums; white-space: nowrap; } .right { text-align: right; } .center { text-align: center; }
.ok { color: var(--ok); } .bad { color: var(--bad); } .warn { color: var(--warn); }
.hide { display: none !important; }
.nowrap { white-space: nowrap; } .ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* boot / login */
.boot { min-height: 100vh; display: grid; place-items: center; }
.spin { width: 28px; height: 28px; border: 3px solid var(--brand-100); border-top-color: var(--brand); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: linear-gradient(160deg, var(--brand-50), var(--bg) 60%); }
.login .card { width: 100%; max-width: 380px; padding: 28px; }
.login .logo { display: block; margin: 0 auto 18px; max-height: 84px; max-width: 200px; }

/* layout */
.layout { min-height: 100vh; }
.side { position: fixed; inset: 0 auto 0 0; width: var(--side); background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
.side.open { transform: none; box-shadow: var(--sh-lg); }
.side .brand { display: flex; align-items: center; gap: 10px; padding: 14px 18px; height: var(--top); border-bottom: 1px solid var(--line-2); }
.side .brand img { max-height: 38px; max-width: 150px; }
.side nav { overflow-y: auto; padding: 10px 10px 20px; flex: 1; }
.side .grp { font-size: 11px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); padding: 14px 10px 6px; }
.side a.nav { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: #344054; font-weight: 520; }
.side a.nav:hover { background: var(--line-2); text-decoration: none; }
.side a.nav.on { background: var(--brand-50); color: var(--brand); }
.side a.nav svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.side .me { border-top: 1px solid var(--line-2); padding: 12px 14px; display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand-50); color: var(--brand); display: grid; place-items: center; font-weight: 700; flex: none; }
.scrim { position: fixed; inset: 0; background: rgba(16,24,40,.35); z-index: 35; }
.top { position: sticky; top: 0; z-index: 30; height: var(--top); background: rgba(255,255,255,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; padding: 0 16px; }
.top .title { font-weight: 650; font-size: 16px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top .search { position: relative; display: none; }
.top .search input { width: 280px; padding-left: 34px; }
.top .search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; color: var(--faint); }
.main { padding: 16px 16px 96px; max-width: 1440px; margin: 0 auto; }
.bottom { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: #fff; border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(5, 1fr); padding-bottom: env(safe-area-inset-bottom); }
.bottom a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 7px; font-size: 11px; color: var(--muted); }
.bottom a.on { color: var(--brand); } .bottom a:hover { text-decoration: none; }
.bottom svg { width: 22px; height: 22px; }
.bottom .plus span { width: 44px; height: 44px; margin-top: -18px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; box-shadow: 0 6px 16px rgba(0,113,184,.35); }
@media (min-width: 1000px) {
  .side { transform: none; } .scrim { display: none; }
  .shell { margin-left: var(--side); }
  .top .menu-btn { display: none; }
  .top .search { display: block; }
  .bottom { display: none; }
  .main { padding: 24px 28px 48px; }
}

/* page head */
.ph { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; margin-bottom: 16px; }
.ph .grow { flex: 1; min-width: 200px; }
.ph .sub { color: var(--muted); margin-top: 2px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* cards & grid */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh); padding: 16px; min-width: 0; }
.card + .card { margin-top: 16px; }
.card-h { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; min-height: 28px; }
.card-h h2 { flex: 1; }
.card.flush { padding: 0; } .card.flush .card-h { padding: 14px 16px 0; }
.grid { display: grid; gap: 16px; }
.grid > .card + .card { margin-top: 0; }
.g2, .g3, .g4 { grid-template-columns: 1fr; }
@media (min-width: 720px) { .g2 { grid-template-columns: repeat(2, minmax(0,1fr)); } .g3, .g4 { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (min-width: 1200px) { .g3 { grid-template-columns: repeat(3, minmax(0,1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0,1fr)); } .span2 { grid-column: span 2; } }
.mt { margin-top: 16px; } .mt-s { margin-top: 8px; } .mb { margin-bottom: 16px; } .mb-s { margin-bottom: 8px; }
.flex { display: flex; align-items: center; gap: 8px; } .flex.wrap { flex-wrap: wrap; } .spacer { flex: 1; }
.sep { height: 1px; background: var(--line); margin: 14px 0; border: 0; }

/* KPI */
.kpis { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0,1fr)); }
@media (min-width: 1000px) { .kpis { grid-template-columns: repeat(4, minmax(0,1fr)); } }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 14px; position: relative; overflow: hidden; }
.kpi .l { color: var(--muted); font-size: 12.5px; font-weight: 550; display: flex; align-items: center; gap: 6px; }
.kpi .v { font-size: 21px; font-weight: 700; margin: 4px 0 2px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.kpi .d { font-size: 12px; color: var(--muted); }
.kpi .ic { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); }
.kpi .ic svg { width: 16px; height: 16px; }
.delta { font-weight: 650; } .delta.up { color: var(--ok); } .delta.down { color: var(--bad); }
.wallet { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0,1fr)); }
@media (min-width: 720px) { .wallet { grid-template-columns: repeat(3, minmax(0,1fr)); } }
@media (min-width: 1200px) { .wallet { grid-template-columns: repeat(6, minmax(0,1fr)); } }
.wallet .kpi .v { font-size: 18px; }
.kpi.hero { background: linear-gradient(135deg, var(--brand-d), var(--brand)); color: #fff; border: 0; }
.kpi.hero .l, .kpi.hero .d { color: rgba(255,255,255,.8); }
.acc-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.acc-list span { background: rgba(255,255,255,.14); padding: 2px 8px; border-radius: 99px; font-size: 11.5px; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 9px; border: 1px solid var(--line); background: #fff; color: #344054; font-weight: 600; cursor: pointer; white-space: nowrap; min-height: 38px; line-height: 1.2; }
.btn:hover { background: var(--line-2); text-decoration: none; }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; } .btn.primary:hover { background: #00609D; }
.btn.soft { background: var(--brand-50); border-color: var(--brand-50); color: var(--brand); } .btn.soft:hover { background: var(--brand-100); }
.btn.danger { color: var(--bad); } .btn.danger:hover { background: var(--bad-bg); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { padding: 5px 10px; min-height: 30px; font-size: 13px; border-radius: 7px; }
.btn.icon { padding: 0; width: 38px; } .btn.sm.icon { width: 30px; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.block { width: 100%; }
.linkbtn { background: none; border: 0; color: var(--brand); padding: 0; cursor: pointer; font-weight: 600; }

/* forms */
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > label, .lbl { font-size: 12.5px; font-weight: 600; color: #344054; }
.field .hint { font-size: 12px; color: var(--muted); }
.req::after { content: " *"; color: var(--bad); }
input:not([type]), input[type=text], input[type=search], input[type=email], input[type=tel], input[type=number], input[type=password], input[type=date], input[type=datetime-local], input[type=color], select, textarea, .input {
  width: 100%; min-height: 40px; padding: 8px 11px; border: 1px solid #D0D5DD; border-radius: 9px; background: #fff; outline: none; transition: border-color .15s, box-shadow .15s; }
input[type=color] { padding: 3px; width: 64px; }
textarea { min-height: 72px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-100); }
input[readonly] { background: var(--line-2); }
.fgrid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.fgrid .wide { grid-column: 1 / -1; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 520; }
.check input { width: 17px; height: 17px; accent-color: var(--brand); }
.seg { display: inline-flex; background: var(--line-2); border-radius: 9px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 7px; font-weight: 600; color: var(--muted); cursor: pointer; font-size: 13px; }
.seg button.on { background: #fff; color: var(--text); box-shadow: var(--sh); }
.err-msg { color: var(--bad); font-size: 13px; min-height: 18px; }
.inline-note { background: var(--info-bg); border: 1px solid #D1E9FF; color: #175CD3; border-radius: 9px; padding: 9px 12px; font-size: 13px; }
.inline-note.warn { background: var(--warn-bg); border-color: #FEDF89; color: var(--warn); }
.internal { border: 1px dashed #F5C26B; background: #FFFCF5; border-radius: 10px; padding: 12px; }
.internal > .t { font-size: 11.5px; font-weight: 700; color: var(--warn); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 8px; display: flex; gap: 6px; align-items: center; }
.internal > .t svg { width: 14px; height: 14px; }

/* filters bar */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.filters input[type=search] { flex: 1 1 220px; }
.filters input[type=date] { width: auto; flex: 0 1 150px; }
.filters select { width: auto; flex: 0 1 170px; }

/* tags */
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 650; padding: 2px 8px; border-radius: 99px; background: var(--line-2); color: #475467; white-space: nowrap; }
.tag.ok { background: var(--ok-bg); color: var(--ok); } .tag.bad { background: var(--bad-bg); color: var(--bad); } .tag.warn { background: var(--warn-bg); color: var(--warn); } .tag.info { background: var(--info-bg); color: #175CD3; }

/* tables (become cards on phones) */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12px; font-weight: 650; color: var(--muted); padding: 9px 12px; border-bottom: 1px solid var(--line); background: #FAFBFC; white-space: nowrap; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr.click { cursor: pointer; } .tbl tbody tr.click:hover td { background: #F9FAFB; }
.tbl tfoot td { font-weight: 700; border-top: 1px solid var(--line); background: #FAFBFC; }
.tbl .r { text-align: right; }
@media (max-width: 719px) {
  table.tbl.stack thead { display: none; }
  table.tbl.stack, .tbl.stack tbody, .tbl.stack tr, .tbl.stack td, .tbl.stack tfoot { display: block; }
  .tbl.stack tr { border-bottom: 1px solid var(--line); padding: 10px 14px; }
  .tbl.stack td { border: 0; padding: 2px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .tbl.stack td::before { content: attr(data-l); color: var(--muted); font-size: 12.5px; text-align: left; flex: none; }
  .tbl.stack td.r { text-align: right; }
  .tbl.stack td[data-l=""]::before { content: none; }
  .tbl.stack td.main-cell { font-weight: 650; justify-content: flex-start; text-align: left; }
  .tbl.stack td.main-cell::before { content: none; }
}
.pager { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.sumbar { display: flex; flex-wrap: wrap; gap: 8px 22px; padding: 10px 14px; background: #FAFBFC; border-bottom: 1px solid var(--line); font-size: 13px; }
.sumbar b { font-variant-numeric: tabular-nums; }
.empty { text-align: center; padding: 34px 16px; color: var(--muted); }
.empty svg { width: 36px; height: 36px; color: var(--faint); margin-bottom: 6px; }

/* lists */
.list { display: flex; flex-direction: column; }
.li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line-2); min-width: 0; }
.li:last-child { border-bottom: 0; }
.li .grow { flex: 1; min-width: 0; }
.li .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li .s { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.ic-badge { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; flex: none; background: var(--brand-50); color: var(--brand); }
.ic-badge svg { width: 17px; height: 17px; }
.ic-badge.vendor { background: #FEF6EE; color: #C4320A; } .ic-badge.agent { background: #F4F3FF; color: #5925DC; } .ic-badge.customer { background: var(--brand-50); color: var(--brand); }

/* reminder cards */
.rem { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: flex; gap: 10px; align-items: center; }
.rem + .rem { margin-top: 8px; }
.rem.late { border-color: #FECDCA; background: #FFFBFA; }
.rem .grow { flex: 1; min-width: 0; }
.rem .btns { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.scroll { max-height: 420px; overflow-y: auto; margin-right: -6px; padding-right: 6px; }

/* bars & charts */
.hbar { display: grid; grid-template-columns: minmax(90px, 34%) 1fr auto; gap: 8px; align-items: center; padding: 5px 0; font-size: 13px; }
.hbar .track { height: 8px; background: var(--line-2); border-radius: 99px; overflow: hidden; }
.hbar .fill { height: 100%; background: var(--brand); border-radius: 99px; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .ax { font-size: 10.5px; fill: var(--faint); }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12.5px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.cmp { display: grid; gap: 12px; }
.cmp .row { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: end; }
.cmp .bars { grid-column: 1 / -1; display: grid; gap: 3px; }
.cmp .bar { height: 8px; border-radius: 99px; background: var(--brand); min-width: 2px; }
.cmp .bar.prev { background: var(--brand-100); }
.donut-wrap { display: flex; align-items: center; gap: 16px; }
.donut-wrap svg { width: 120px; height: 120px; flex: none; }

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 9px 12px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; }
.tabs button.on { color: var(--brand); border-bottom-color: var(--brand); }

/* modal */
.ov { position: fixed; inset: 0; z-index: 60; background: rgba(16,24,40,.45); display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.modal { background: #fff; width: 100%; max-height: 94vh; border-radius: 16px 16px 0 0; display: flex; flex-direction: column; box-shadow: var(--sh-lg); animation: up .18s ease-out; }
.modal .mh { display: flex; align-items: center; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.modal .mh h2 { flex: 1; }
.modal .mb { padding: 16px; overflow-y: auto; flex: 1; }
.modal .mf { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 16px; border-top: 1px solid var(--line); padding-bottom: calc(12px + env(safe-area-inset-bottom)); flex-wrap: wrap; }
@media (min-width: 720px) {
  .ov { align-items: center; padding: 24px; }
  .modal { width: min(560px, 100%); border-radius: 16px; max-height: 90vh; }
  .modal.lg { width: min(860px, 100%); } .modal.xl { width: min(1000px, 100%); }
}
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(24px); opacity: .6; } }

/* toast */
.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: 84px; z-index: 80; display: flex; flex-direction: column; gap: 8px; width: min(420px, calc(100% - 24px)); pointer-events: none; }
@media (min-width: 1000px) { .toasts { bottom: 24px; } }
.toast { background: #101828; color: #fff; padding: 11px 14px; border-radius: 10px; box-shadow: var(--sh-lg); font-weight: 520; animation: up .18s; pointer-events: auto; }
.toast.bad { background: var(--bad); }

/* autocomplete */
.ac { position: relative; }
.ac-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--sh-lg); z-index: 20; max-height: 280px; overflow-y: auto; }
.ac-list button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 9px 12px; cursor: pointer; border-bottom: 1px solid var(--line-2); }
.ac-list button:hover, .ac-list button:focus { background: var(--brand-50); outline: none; }

/* invoice editor */
.item-card { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: #FCFCFD; }
.item-card + .item-card { margin-top: 12px; }
.item-card .ih { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.item-card .ih .n { width: 26px; height: 26px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; }
.totals { margin-left: auto; width: 100%; max-width: 360px; }
.totals .tr { display: flex; justify-content: space-between; padding: 5px 0; gap: 12px; }
.totals .tr.big { font-size: 17px; font-weight: 700; border-top: 1px solid var(--line); margin-top: 4px; padding-top: 9px; }
.stick-bar { position: sticky; bottom: 64px; z-index: 20; background: rgba(255,255,255,.96); backdrop-filter: blur(6px); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-top: 16px; display: flex; gap: 8px; align-items: center; box-shadow: var(--sh-lg); flex-wrap: wrap; }
@media (min-width: 1000px) { .stick-bar { bottom: 12px; } }

/* detail */
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; font-size: 13.5px; }
.dl dt { color: var(--muted); } .dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.money3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; }
.money3 .kpi .v { font-size: 18px; }
.item-row { padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.item-row:last-child { border-bottom: 0; }
.kv { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.kv b { color: var(--text); font-weight: 600; }

/* upload */
.upl { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.upl .thumb { width: 120px; height: 60px; border: 1px dashed #D0D5DD; border-radius: 8px; display: grid; place-items: center; overflow: hidden; background: #fff; color: var(--faint); font-size: 12px; }
.upl .thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.perm-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.perm-grid fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 0; }
.perm-grid legend { font-weight: 650; font-size: 13px; padding: 0 4px; }
.perm-grid label { display: flex; gap: 8px; padding: 3px 0; font-size: 13px; cursor: pointer; }

/* print preview */
.pv-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.pv-stage { background: #E4E7EC; border-radius: 10px; padding: 16px; overflow: auto; }
.pv-page { background: #fff; width: 210mm; min-height: 297mm; margin: 0 auto; box-shadow: 0 4px 18px rgba(16,24,40,.18); transform-origin: top left; }
.share-wrap { max-width: 900px; margin: 0 auto; padding: 16px; }

/* ---------- printable documents ---------- */
.pdoc { font: 12.5px/1.45 Arial, "Helvetica Neue", Helvetica, sans-serif; color: #111; }
.pdoc .ph-area, .pdoc .pf-area { box-sizing: border-box; }
.pdoc .ph-area img, .pdoc .pf-area img { width: 100%; height: 100%; object-fit: contain; display: block; }
.pdoc .ph-area.pad { border-bottom: 1px dashed #c7cdd6; color: #98A2B3; display: grid; place-items: center; font-size: 11px; }
.pdoc .pf-area.pad { border-top: 1px dashed #c7cdd6; color: #98A2B3; display: grid; place-items: center; font-size: 11px; }
.pdoc .co { display: flex; align-items: center; gap: 14px; padding: 14px 0 10px; border-bottom: 2px solid var(--brand); }
.pdoc .co img { max-height: 60px; max-width: 160px; }
.pdoc .co .n { font-size: 18px; font-weight: 700; color: var(--brand-d); }
.pdoc .co .a { font-size: 11px; color: #555; }
.pdoc .body { padding: 0 0 6mm; }
.pdoc .ttl { text-align: center; margin: 12px 0 10px; }
.pdoc .ttl span { display: inline-block; border: 1.5px solid #111; padding: 3px 18px; font-weight: 700; letter-spacing: .12em; font-size: 14px; }
.pdoc .meta { display: flex; justify-content: space-between; gap: 18px; margin-bottom: 12px; }
.pdoc .meta table td { padding: 1px 8px 1px 0; vertical-align: top; }
.pdoc .meta .lab { color: #555; white-space: nowrap; }
.pdoc table.items { width: 100%; border-collapse: collapse; margin-top: 4px; }
.pdoc table.items th { background: #f1f4f8; border: 1px solid #c9d0da; padding: 6px 7px; font-size: 11.5px; text-align: left; }
.pdoc table.items td { border: 1px solid #d5dbe3; padding: 6px 7px; vertical-align: top; }
.pdoc table.items .r { text-align: right; white-space: nowrap; }
.pdoc .det { font-size: 11px; color: #444; margin-top: 2px; }
.pdoc .det span { display: inline-block; margin-right: 10px; }
.pdoc .sumt { margin-left: auto; width: 46%; min-width: 240px; border-collapse: collapse; margin-top: 8px; }
.pdoc .sumt td { padding: 3px 7px; }
.pdoc .sumt .r { text-align: right; white-space: nowrap; }
.pdoc .sumt tr.b td { font-weight: 700; border-top: 1.5px solid #111; }
.pdoc .words { margin-top: 8px; padding: 6px 8px; background: #f6f8fb; border-left: 3px solid var(--brand); font-size: 12px; }
.pdoc .terms { margin-top: 12px; font-size: 11px; color: #333; white-space: pre-line; }
.pdoc .sigs { display: flex; justify-content: space-between; gap: 30px; margin-top: 46px; break-inside: avoid; }
.pdoc .sigs > div { flex: 1; max-width: 220px; text-align: center; font-size: 11.5px; }
.pdoc .sigs .line { border-top: 1px solid #111; padding-top: 4px; }
.pdoc .sigs img { max-height: 46px; display: block; margin: 0 auto 2px; }
.pdoc .box { border: 1px solid #c9d0da; border-radius: 4px; padding: 10px 12px; margin-top: 8px; }
.pdoc .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 18px; }
.pdoc .amt { font-size: 18px; font-weight: 700; }
.pdoc .stamp { display: inline-block; border: 2px solid; padding: 2px 10px; font-weight: 700; letter-spacing: .1em; transform: rotate(-6deg); }
.pdoc .stamp.paid { color: #067647; } .pdoc .stamp.due { color: #B42318; }
.pdoc .rep th, .pdoc .rep td { font-size: 11px; }

#print-root { display: none; }
@media print {
  @page { size: A4; margin: 0; }
  html, body { background: #fff !important; }
  body > *:not(#print-root) { display: none !important; }
  #print-root { display: block !important; }
  .pdoc { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .pdoc .fixed-h { position: fixed; top: 0; left: 0; right: 0; }
  .pdoc .fixed-f { position: fixed; bottom: 0; left: 0; right: 0; }
  .pdoc .ph-area.pad, .pdoc .pf-area.pad { border: 0; color: transparent; }
  .pdoc table.frame { width: 100%; border-collapse: collapse; }
  .pdoc table.items tr, .pdoc .box, .pdoc .sumt, .pdoc .words { break-inside: avoid; }
}
.pdoc .pspace { display: none; }
.pv-page .pdoc { min-height: 297mm; display: flex; flex-direction: column; }
.pv-page .pdoc .frame { flex: 1; width: 100%; border-collapse: collapse; }
.pv-page .pdoc .frame > * > tr > td { padding: 0; vertical-align: top; }
@media print { .pdoc .pspace { display: block; } .pdoc .frame > * > tr > td { padding: 0; vertical-align: top; } }
/* logos: give SVGs without a set size a real height */
.side .brand img { height: 38px; width: auto; object-fit: contain; }
.login .logo { height: 76px; width: auto; object-fit: contain; }
.pdoc .co img { height: 56px; width: auto; object-fit: contain; }
