/* Styling follows www.bgm.uk.com (bgmcustoms.com): Rubik, BGM blue, yellow accent, white header */
:root {
  --blue: #307fe2; --blue-dark: #1863dc; --navy: #293c5b; --yellow: #ffb319;
  --ink: #0a0a07; --text: #212121; --muted: #6f6f6f; --grey: #878787;
  --bg: #f4f4f4; --card: #fff; --line: #dadada; --line-soft: #ededed;
  --ok: #1e7d4f; --err: #b3261e; --info: #1863dc;
  --radius: 4px;
  /* kept for older rules */
  --navy-2: var(--blue); --accent: var(--yellow);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; font: 15px/1.55 Rubik, "Segoe UI", system-ui, -apple-system, Arial, sans-serif; color: var(--text); background: var(--bg); }
a { color: var(--blue); }
a:hover { color: var(--blue-dark); }
h1, h2, h3 { color: var(--ink); font-weight: 500; }
h1 { font-size: 1.75rem; margin: .2rem 0 1rem; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
main { flex: 1; width: 100%; max-width: 1200px; margin: 0 auto; padding: 1.75rem 1.25rem 3rem; }

.topbar { display: flex; align-items: center; gap: 1.25rem; background: #fff; color: var(--ink); padding: 0 1.5rem; min-height: 72px; flex-wrap: wrap; border-bottom: 1px solid var(--line); box-shadow: 0 1px 6px rgba(0,0,0,.04); }
.brand { display: flex; align-items: center; gap: .9rem; color: var(--ink); text-decoration: none; white-space: nowrap; }
.brand .logo { height: 46px; width: auto; display: block; }
.brand .product { border-left: 1px solid var(--line); padding-left: .9rem; font-size: .8rem; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: var(--grey); }
.mainnav { display: flex; gap: .15rem; flex: 1; flex-wrap: wrap; align-self: stretch; }
.mainnav a { display: flex; align-items: center; color: var(--ink); text-decoration: none; padding: 0 .6rem; font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; border-bottom: 3px solid transparent; border-top: 3px solid transparent; }
.mainnav a:hover { color: var(--blue); }
.mainnav a.active { color: var(--blue); border-bottom-color: var(--blue); font-weight: 500; }
.who { display: flex; gap: .8rem; align-items: center; font-size: .82rem; white-space: nowrap; color: var(--grey); }
.who a, .linkbtn { color: var(--ink); }
.linkbtn { background: none; border: 0; cursor: pointer; font: inherit; text-decoration: underline; padding: 0; }
.linkbtn:hover, .who a:hover { color: var(--blue); }
.inline { display: inline; margin: 0; }
.foot { text-align: center; color: var(--grey); font-size: .8rem; padding: 1.25rem; border-top: 1px solid var(--line); background: #fff; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.25rem; margin-bottom: 1rem; }
.narrow { max-width: 560px; margin: 2rem auto; }
.pagehead { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: .5rem; }
.pagehead h1, .pagehead h2 { margin-bottom: .5rem; }
.back { font-size: .85rem; text-decoration: none; }
.count { background: var(--bg); border: 1px solid var(--line); color: var(--muted); font-size: .78rem; border-radius: 10px; padding: 0 8px; font-weight: 500; vertical-align: middle; }
.tag { background: #eee; color: var(--muted); font-size: .75rem; border-radius: 4px; padding: 2px 8px; vertical-align: middle; font-weight: 500; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }

.btn { display: inline-block; background: var(--blue); color: #fff; border: 1px solid var(--blue); border-radius: var(--radius); padding: .7rem 1.6rem .6rem; font: inherit; font-size: .8rem; font-weight: 500; text-transform: uppercase; letter-spacing: .06em; cursor: pointer; text-decoration: none; transition: background .15s; }
.btn:hover { background: var(--blue-dark); border-color: var(--blue-dark); color: #fff; }
.btn.secondary { background: var(--line); border-color: var(--line); color: var(--ink); }
.btn.secondary:hover { background: #c8c8c8; border-color: #c8c8c8; color: var(--ink); }
.btn.accent { background: var(--yellow); border-color: var(--yellow); color: var(--ink); }
.btn.accent:hover { background: #f0a400; }
.btn.small { padding: .35rem .9rem .3rem; font-size: .72rem; }
.btn.full { width: 100%; }
.btn.ms { display: flex; gap: .6rem; justify-content: center; align-items: center; background: #fff; color: var(--ink); border-color: #8c8c8c; width: 100%; text-transform: none; letter-spacing: 0; font-size: .95rem; }
.btn.ms:hover { background: #f3f3f3; color: var(--ink); }

.flash { padding: .7rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; border: 1px solid; }
.flash.ok { background: #e8f5ee; border-color: #b5dcc5; color: var(--ok); }
.flash.error { background: #fdecea; border-color: #f2b8b5; color: var(--err); }
.flash.info { background: #eaf2fd; border-color: #b9d3f5; color: var(--info); }

input:not([type]), input[type=text], input[type=date], input[type=file], input[type=email], input[type=password], input[type=search], select, textarea {
  width: 100%; padding: .5rem .6rem; border: 1px solid #c8c8c8; border-radius: var(--radius); font: inherit; background: #fff; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(48,127,226,.35); border-color: var(--blue); }
input.upper { text-transform: uppercase; }
label { display: block; font-weight: 500; font-size: .9rem; margin-bottom: .25rem; }
label.check { display: flex; gap: .5rem; align-items: center; font-weight: 400; }
label.check input { width: auto; }

.login { max-width: 400px; margin: 3.5rem auto; background: #fff; border: 1px solid var(--line); border-top: 4px solid var(--blue); border-radius: var(--radius); padding: 2.25rem 2rem; box-shadow: 0 4px 18px rgba(0,0,0,.05); }
.login h1 { text-align: center; }
.login form label { margin-bottom: 1rem; }
.login form input { margin-top: .25rem; }
.divider { display: flex; align-items: center; gap: .75rem; color: var(--muted); margin: 1rem 0; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.card form label, .narrow form label { margin-bottom: .9rem; }

.bigsearch { display: flex; gap: .5rem; margin-bottom: 1.5rem; }
.bigsearch input { font-size: 1.05rem; padding: .7rem .9rem; }
.filters { display: flex; gap: .75rem; align-items: center; margin-bottom: 1rem; flex-wrap: wrap; }
.filters input[type=search] { max-width: 360px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.tile { background: #fff; border: 1px solid var(--line); border-top: 3px solid var(--yellow); border-radius: var(--radius); padding: 1rem 1.2rem; text-decoration: none; color: var(--text); display: flex; flex-direction: column; }
a.tile:hover { border-color: var(--navy-2); }
.tile b { font-size: 1.9rem; font-weight: 500; color: var(--blue); }
.tile span { color: var(--muted); font-size: .9rem; }
.results { list-style: none; padding: 0; margin: 0 0 .5rem; }
.results li { padding: .3rem 0; border-bottom: 1px solid var(--bg); }

table.grid { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.card table.grid { border: 0; }
.grid th { text-align: left; font-size: .72rem; font-weight: 500; text-transform: uppercase; letter-spacing: .08em; color: var(--grey); background: #fafafa; padding: .55rem .75rem; border-bottom: 1px solid var(--line); }
.grid td { padding: .55rem .75rem; border-bottom: 1px solid #eef1f5; vertical-align: top; }
.grid tr:last-child td { border-bottom: 0; }
.grid tbody tr:hover { background: #f3f8fe; }
.grid tr.inactive td { color: #9aa4ae; }
.grid tr.inactive td a { color: #8aa0b6; }

.detail { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 0 1rem; }
dl { display: grid; grid-template-columns: 11rem 1fr; gap: .35rem 1rem; margin: 0; }
dt { color: var(--muted); font-size: .9rem; }
dd { margin: 0; overflow-wrap: anywhere; }
dd.pre { white-space: pre-wrap; }

fieldset.card { margin: 0 0 1rem; }
legend { font-weight: 500; color: var(--ink); padding: 0 .4rem; }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .9rem 1.25rem; }
.field.wide { grid-column: 1 / -1; }
.field .fixed { padding: .5rem 0; font-weight: 500; }
.field .help { color: var(--muted); font-size: .8rem; margin-top: .2rem; }
.field .err { color: var(--err); font-size: .85rem; margin-top: .2rem; }
.field.has-error input, .field.has-error select { border-color: var(--err); }
.actions { display: flex; gap: .6rem; }
.temp { font: 600 1.4rem/1.4 Consolas, monospace; background: var(--bg); border: 1px dashed var(--line); padding: .6rem 1rem; border-radius: 6px; text-align: center; }

@media (max-width: 700px) {
  dl { grid-template-columns: 1fr; }
  dt { margin-top: .4rem; }
  .grid { font-size: .88rem; }
  .who span { display: none; }
}

.scroll { overflow-x: auto; }
table.compact td, table.compact th { padding: .3rem .6rem; }
tr.imp-error td { background: #fdf3f2; }
tr.imp-exists td { color: #8a949e; }
.pagehead .actions { display: flex; gap: .5rem; }
.pagehead .actions .btn { white-space: nowrap; }
.standing { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.standing a.card { text-decoration: none; color: var(--text); display: block; }
.standing a.card:hover { border-color: var(--navy-2); }
.standing b { font-size: 1.5rem; font-weight: 500; color: var(--blue); }

@media (max-width: 1180px) { .who span { display: none; } }
@media (max-width: 1000px) {
  .topbar { padding: .6rem 1rem; gap: .75rem; }
  .mainnav { align-self: auto; order: 3; flex-basis: 100%; }
  .mainnav a { padding: .45rem .6rem; }
  .brand .logo { height: 38px; }
}
@media (max-width: 700px) {
  .card { overflow-x: auto; }
  h1 { font-size: 1.4rem; }
}

/* ---------- Invoices (stage 2) ---------- */
.num, td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
input.num { text-align: right; max-width: 9rem; }
input.warn { border-color: var(--yellow); background: #fff8e6; }
.tag.warn { background: #fff1d0; color: #7a5200; }
.tag + .tag { margin-left: .25rem; }
.status { display: inline-block; font-size: .75rem; font-weight: 500; border-radius: var(--radius); padding: 1px 8px; background: #eaf2fd; color: var(--blue-dark); white-space: nowrap; }
.status.big { font-size: .85rem; padding: 2px 10px; vertical-align: middle; margin-left: .4rem; }
.status.s-passed { background: #e8f5ee; color: var(--ok); }
.status.s-under-query, .status.s-waiting-for-credit { background: #fdecea; color: var(--err); }
.status.s-waiting-for-information, .status.s-waiting-for-confirmation, .status.s-waiting-for-loa, .status.s-loa-sent, .status.s-waiting-for-rates { background: #fff1d0; color: #7a5200; }
.statusbar { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .8rem; }
.statusbar a { text-decoration: none; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: .3rem .7rem; font-size: .85rem; }
.statusbar a.on { border-color: var(--blue); color: var(--blue); font-weight: 500; }
.filters select { max-width: 220px; }
table.lines td { padding: .35rem .5rem; }
table.lines select { min-width: 14rem; }
table.lines tfoot th { font-size: .85rem; color: var(--ink); }
fieldset.has-error { border-color: var(--err); }
.card > .err, fieldset > .err { color: var(--err); font-size: .9rem; margin-top: .5rem; }
.statusform, .queryform { margin-top: 1rem; border-top: 1px solid var(--line-soft); padding-top: 1rem; }
.statusform .fields, .queryform .fields { margin-bottom: .6rem; }
.inlineform { display: flex; gap: .4rem; align-items: center; }
.inlineform input { flex: 1; min-width: 8rem; }
td.pre, span.pre { white-space: pre-wrap; }
details.card summary { cursor: pointer; color: var(--muted); }
details.card[open] summary { margin-bottom: .6rem; }
.help { color: var(--muted); font-size: .8rem; }
table.history td { font-size: .85rem; }
code { font-size: .85em; background: var(--bg); padding: 0 .3em; border-radius: 3px; }
.grid.invoices td:nth-child(2), .grid.invoices td:nth-child(1), .grid.invoices td:nth-child(6) { white-space: nowrap; }
.statusform .fields { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.statusform label, .queryform label { margin-bottom: .25rem !important; }

/* invoice list: one line per row, notes clipped with a hover pop-up, quick pass */
.grid.invoices td { white-space: nowrap; }
.grid.invoices td.client { max-width: 13rem; overflow: hidden; text-overflow: ellipsis; }
.grid.invoices td.carrier { max-width: 10rem; overflow: hidden; text-overflow: ellipsis; }
.grid.invoices td.note { max-width: 13rem; }
.grid.invoices td:last-child { white-space: nowrap; }
.grid.invoices td.note .clip { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: default; }
.grid.invoices td.note .pop { display: none; position: fixed; z-index: 20; width: max-content; max-width: 26rem; white-space: normal;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 6px 18px rgba(0,0,0,.12); padding: .55rem .75rem; color: var(--text); font-size: .85rem; }
.grid.invoices td.note.clipped:hover .pop, .grid.invoices td.note.clipped:focus-within .pop { display: block; }
.grid.invoices td.note.clipped .clip { cursor: help; }
.quickpass { cursor: pointer; user-select: none; }
.quickpass.busy { opacity: .5; }
.toast { position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%); z-index: 50; background: var(--ink); color: #fff; padding: .7rem 1.1rem; border-radius: var(--radius);
  box-shadow: 0 6px 24px rgba(0,0,0,.25); font-size: .9rem; display: flex; gap: 1rem; align-items: center; max-width: 90vw; }
.toast[hidden] { display: none; }
.toast.error { background: var(--err); }
.toast .linkbtn { color: var(--yellow); font-weight: 500; text-transform: uppercase; letter-spacing: .05em; }
main:has(.grid.invoices) { max-width: 1400px; }
@media (max-width: 1180px) { .grid.invoices .opt { display: none; } }
@media (max-width: 900px) {
  .statusbar a { font-size: .8rem; padding: .25rem .5rem; }
}
.grid.invoices .tag { white-space: nowrap; }
.grid.invoices th { white-space: nowrap; }
.grid.invoices th, .grid.invoices td { padding-left: .5rem; padding-right: .5rem; }
.flag { display: inline-block; font-size: .68rem; font-weight: 600; line-height: 1.4; border-radius: 8px; padding: 0 .4rem; vertical-align: middle; cursor: help; }
.flag.warn { background: #fff1d0; color: #7a5200; }
.flag.old { background: #eee; color: var(--muted); font-weight: 500; }
.flag.cf { background: #eaf2fd; color: var(--info); font-weight: 500; }
.cf-target { display: flex; gap: 1rem; flex-wrap: wrap; align-items: center; margin: .4rem 0 .6rem; }
.card .cf-target label.period { display: flex; align-items: center; gap: .35rem; margin: 0; white-space: nowrap; }
.cf-target label.period input { width: 3.6rem; text-align: center; }
.cf-target label.period input.year { width: 5rem; }
.filters label.period { display: flex; align-items: center; gap: .35rem; white-space: nowrap; font-size: .9rem; color: var(--muted); margin: 0; }
.filters label.period input { width: 3.2rem; padding: .45rem .4rem; text-align: center; }
.filters label.period input.year { width: 4.4rem; }
.grid th.sortable a { color: inherit; text-decoration: none; }
.grid th.sortable a:hover { color: var(--blue); }
.grid th.sorted a { color: var(--blue); }
/* statement pack: report preview */
.preview h2 { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.preview h2 a { font-weight: 400; }
.pdfpreview { width: 100%; height: 70vh; min-height: 420px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }

/* ---------- Shipments page ---------- */
.shiphead dl { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .6rem 1.25rem; margin: 0; }
.shiphead dt { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--grey); }
.shiphead dd { margin: .15rem 0 0; font-weight: 500; }
.shiphead dd.bad { color: var(--err); }
.shiphead dd.good { color: var(--ok); }
table.shipments { font-size: .8rem; }
table.shipments td, table.shipments th { padding: .45rem .4rem; white-space: nowrap; }
table.shipments th { letter-spacing: .04em; }
main:has(.shiphead) { max-width: 1760px; }
table.shipments td.clipcell { max-width: 8rem; overflow: hidden; text-overflow: ellipsis; }
table.shipments tr.sel td { background: #e6f0fc; }
table.shipments tfoot td { font-weight: 500; border-top: 1px solid var(--line); }
.shipwin { max-height: 40vh; overflow: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 1rem; }
.shipwin table.shipments { border: 0; margin: 0; overflow: visible; border-collapse: separate; border-spacing: 0; }
.shipwin thead th { position: sticky; top: 0; z-index: 2; }
.shipwin tfoot td { position: sticky; bottom: 0; background: #fafafa; z-index: 2; }
table.shipments tr.editrow td { background: #fff8e1; padding: .3rem .2rem; vertical-align: middle; }
table.shipments tr.editrow input, table.shipments tr.editrow select { font-size: .8rem; padding: .25rem .3rem; height: auto; min-height: 0; border-radius: 3px; }
table.shipments tr.editrow input.num { text-align: right; }
.editrow .w-no { width: 9rem; } .editrow .w-date { width: 6.3rem; } .editrow .w-name { width: 7.5rem; } .editrow .w-detail { width: 5.3rem; } .editrow .w-ctry { width: 2.7rem; }
.editrow .w-serv { width: 7.5rem; } .editrow .w-terms { width: 5.8rem; } .editrow .w-dir { width: 5.6rem; } .editrow .w-item { width: 5rem; } .editrow .w-int { width: 2.6rem; } .editrow .w-dec { width: 3.8rem; } .editrow .w-notes { width: 6rem; }
/* the shipment number and the value stay in view when the grid scrolls sideways */
.shipwin table.shipments th:first-child, .shipwin table.shipments td:first-child { position: sticky; left: 0; z-index: 1; background: var(--card); box-shadow: 1px 0 0 var(--line); }
.shipwin table.shipments th:last-child, .shipwin table.shipments td:last-child { position: sticky; right: 0; z-index: 1; background: var(--card); box-shadow: -1px 0 0 var(--line); }
.shipwin table.shipments thead th:first-child, .shipwin table.shipments thead th:last-child { z-index: 3; background: #fafafa; }
.shipwin table.shipments tfoot td:first-child, .shipwin table.shipments tfoot td:last-child { z-index: 3; background: #fafafa; }
.shipwin table.shipments tr.editrow td:first-child, .shipwin table.shipments tr.editrow td:last-child { background: #fff8e1; }
table.shipments td.clipcell { max-width: 7rem; }
.shiphead { padding: .7rem 1.1rem; }
.shiphead dd { font-size: .9rem; }
.chargecard { padding: .8rem 1.1rem; }
table.charges td { padding: .25rem .5rem; }
table.charges input, table.charges select { font-size: .85rem; padding: .3rem .45rem; min-height: 0; height: auto; }
table.charges th { padding: .4rem .5rem; }
.chargecard .buttons { margin: .6rem 0 0; }
.chargecard h2 { font-size: 1.05rem; }
table.charges { max-width: 52rem; }
table.charges input, table.charges select { width: 100%; }
table.charges td { vertical-align: middle; }
table.charges input:disabled { background: #f5f5f5; color: #aaa; }
table.charges input.num { text-align: right; }
table.charges tfoot td { border-top: 1px solid var(--line); }
details.remove { margin-top: .5rem; }
details.remove summary { cursor: pointer; color: var(--muted); font-size: .85rem; }
.shipwin table.shipments tfoot td:first-child { left: auto; box-shadow: none; }

table.charges td.good { color: var(--ok); font-weight: 500; }
table.charges td.bad { color: var(--err); font-weight: 500; }

/* ---------- Invoice page, compact ---------- */
main:has(.invpage) { max-width: 1500px; }
.invpage .card { padding: .8rem 1rem; margin-bottom: .75rem; }
.invpage .card h2, .invpage .fold summary { font-size: 1rem; margin: 0 0 .5rem; }
.invtop { display: grid; grid-template-columns: 1.15fr 1fr 1fr; gap: .75rem; align-items: stretch; margin-bottom: .75rem; }
.invtop .card { margin-bottom: 0; height: 100%; }
@media (max-width: 1100px) { .invtop { grid-template-columns: 1fr 1fr; } .invtop .card:first-child { grid-column: 1 / -1; } }
@media (max-width: 700px) { .invtop { grid-template-columns: 1fr; } }
.invpage dl { grid-template-columns: 8.5rem 1fr; gap: .2rem .75rem; font-size: .9rem; }
.invpage dl.cols { grid-template-columns: max-content 1fr max-content 1fr; }
.invpage dl.cols dd.span3 { grid-column: span 3; }
.invpage dt { font-size: .82rem; }
table.grid.compact th { padding: .35rem .5rem; }
table.grid.compact td { padding: .35rem .5rem; font-size: .9rem; }
.invpage .shipline { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .7rem; padding-top: .6rem; border-top: 1px solid var(--line-soft, #eef1f5); font-size: .9rem; }
.invpage .shipline .btn { margin-left: auto; }
.compactform { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem .75rem; }
.compactform label { display: flex; flex-direction: column; gap: .2rem; font-size: .8rem; color: var(--muted); margin: 0; }
.compactform label.full, .compactform .full { grid-column: 1 / -1; margin: 0; }
.compactform input, .compactform select, .compactform textarea { font-size: .9rem; padding: .35rem .5rem; }
.compactform textarea { resize: vertical; min-height: 2.4rem; }
.compactform .end { display: flex; align-items: flex-end; justify-content: flex-end; }
.addquery { margin-top: .6rem; }
.addquery input.with { flex: 0 0 18rem; }
.invpage .fold summary { cursor: pointer; margin: 0; }
.invpage .fold[open] summary { margin-bottom: .5rem; }
td.nowrap { white-space: nowrap; }
.invpage .folds { display: grid; grid-template-columns: 2fr 1fr; gap: .75rem; align-items: start; }
.invpage .folds .fold { margin-bottom: 0; }
.invpage .folds .fold[open]:first-child { grid-column: 1 / -1; }
@media (max-width: 900px) { .invpage .folds { grid-template-columns: 1fr; } }

/* ---------- Invoice add / edit, compact ---------- */
main:has(.invform) { max-width: 1500px; }
.invform-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; align-items: start; }
@media (max-width: 1100px) { .invform-grid { grid-template-columns: 1fr; } }
.invform fieldset.card { padding: .5rem 1rem .8rem; margin-bottom: .75rem; }
.invform legend { font-size: .95rem; }
.invform .fields { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .5rem .75rem; }
.invform .field label { font-size: .8rem; color: var(--muted); margin-bottom: .15rem; }
.invform .field label.check { color: var(--ink); font-size: .85rem; margin-top: 1.3rem; }
.invform .field input, .invform .field select, .invform .field textarea { font-size: .9rem; padding: .35rem .5rem; }
.invform .field .fixed { padding: .3rem 0; font-size: .9rem; }
.invform .field .help, .invform > .help, .invform fieldset > .help { font-size: .75rem; margin: .15rem 0 0; }
.invform fieldset > .help { margin: 0 0 .4rem; }
.invform .field.wide textarea { min-height: 2.3rem; }
.invform table.lines th { padding: .35rem .5rem; }
.invform table.lines td { padding: .25rem .4rem; }
.invform table.lines input, .invform table.lines select { font-size: .9rem; padding: .3rem .45rem; }
.invform table.lines input.num { max-width: 7rem; }
.invform .actions { margin-top: .25rem; }
.invform .field input[type=file] { font-size: .8rem; padding: .25rem; }
.invform .field.span2 { grid-column: span 2; }

[hidden] { display: none !important; }

/* Users: client access */
.inlinerow { display: flex; gap: .5rem; align-items: center; }
.perms label.check, .scopetree label.check { display: block; margin: .3rem 0; }
.scopetree { border: 1px solid var(--line); border-radius: var(--radius); padding: .5rem .9rem; max-height: 26rem; overflow: auto; background: #fff; }
.scopeclients { margin-left: 1.4rem; }
.scopesites { margin-left: 1.4rem; }
.scopegroup, .scopetree > .scopeclient { padding: .3rem 0; border-bottom: 1px solid #eef1f5; }
#clientaccess h3 { margin: 1rem 0 .3rem; font-size: 1rem; }
.inlinerow select { max-width: 24rem; }
table.charges td.err { color: var(--err); font-weight: 500; }
