:root {
  color-scheme: light;
  font: 100% system-ui, sans-serif;
  color: #241d21;
  background: #f4f3f5;
  --blue: #244c73;
  --gold: #ffda80;
  --silver: #d9d9e0;
  --muted: #625b64;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
#workspace { min-height: 100vh; }
.company-appbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: .75rem;
  margin: 0;
  padding: .65rem clamp(.75rem, 2vw, 1.5rem);
  background: #102744;
  color: white;
  border-bottom: 1px solid var(--silver);
}
.company-appbar nav { min-width: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: .3rem; }
.brand { display: flex; align-items: center; gap: .5rem; white-space: nowrap; font-size: .875rem; }
.brand img { display: block; width: clamp(6rem, 16vw, 8rem); height: auto; }
.brand-divider { color: var(--silver); }
.company-appbar nav a, .company-appbar #logout {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  min-height: 2.65rem;
  padding: .4rem .55rem;
  color: white;
  font-size: .875rem;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: .45rem;
  white-space: nowrap;
}
.company-appbar nav a:hover, .company-appbar nav a[aria-current="page"], .company-appbar #logout:hover {
  background: var(--blue);
  border-color: #ffda80;
}
.company-appbar #logout { justify-self: end; margin: 0; background: transparent; }
.company-appbar svg { width: 1.2rem; height: 1.2rem; flex: none; fill: none; stroke: var(--silver); stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 66rem) {
  .company-appbar { grid-template-columns: 1fr auto; }
  .company-appbar nav { grid-row: 2; grid-column: 1 / -1; justify-content: flex-start; }
}
@media (max-width: 30rem) {
  .company-appbar #logout span { display: none; }
}
:focus-visible { outline: 3px solid #935e00; outline-offset: 2px; }
main { padding: clamp(1rem, 4vw, 3.5rem); }
header { margin-bottom: 1.5rem; }
h1 { margin: 0; font-size: clamp(1.75rem, 4vw, 2.8rem); }
h2 { margin: 0; font-size: 1.1rem; }
.connection, .overview p { color: var(--muted); }
.overview { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); gap: 1rem; }
.overview a, .panel { background: #fff; border: 1px solid var(--silver); border-radius: .875rem; }
.overview a { display: block; padding: 1.25rem; color: var(--blue); text-decoration: none; }
.overview a:hover { border-color: var(--blue); }
.overview p { margin-bottom: 0; }
.toolbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; padding: 1rem; }
.toolbar label { display: flex; align-items: center; gap: .5rem; font-size: .9rem; }
select { font: inherit; color: inherit; padding: .4rem; border: 1px solid #aaa7b0; border-radius: .35rem; background: #fff; }
.table-scroll { overflow-x: auto; border-radius: 0 0 .875rem .875rem; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .9rem 1rem; text-align: left; white-space: nowrap; border-top: 1px solid var(--silver); }
th { background: #eeedf0; }
td { color: var(--muted); white-space: normal; }
button { font: inherit; padding: .65rem; border-radius: .4rem; border: 1px solid var(--silver); }
button { background: var(--blue); color: white; cursor: pointer; }
button:disabled { opacity: .65; cursor: wait; }
#factor-qr { max-width: 12rem; }
#metrics { margin-bottom: 1rem; }
#metrics article { padding: 1.25rem; background: white; border: 1px solid var(--silver); border-radius: .875rem; }
#search { width: 100%; padding: .65rem; color: #241d21; background: #fff; border: 1px solid var(--silver); border-radius: .4rem; font: inherit; }
#ledger .users-table { width: 100%; color: #241d21; }
#ledger .users-table th { background: #eeedf0; color: #142f51; }
#ledger .users-table td { color: #241d21; background: white; }
dialog { width: min(52rem, 95vw); max-height: 85vh; border: 1px solid var(--silver); border-radius: .9rem; padding: 1.5rem; }
dialog::backdrop { background: #241d21a8; }
dialog button { margin: .25rem .25rem .25rem 0; }
.detail-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); gap: .7rem; padding: .75rem 0; }
.detail-fields label { display: grid; gap: .3rem; }
.detail-fields input { min-width: 0; font: inherit; padding: .4rem; }
.finance-controls { display: flex; flex-wrap: wrap; gap: .65rem; margin-bottom: 1rem; }
.finance-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr)); }
.finance-controls button { background: white; color: #142f51; }
.finance-controls button[aria-pressed="true"] { background: var(--blue); color: white; }
.finance-controls strong { display: block; margin-top: .4rem; font-size: 1.15rem; }
.finance-status:not(:empty) { margin: 1rem; }
.finance-status:empty { display: none; }
#workspace .panel .users-table th {
  color: #142f51;
  background: #eeedf0;
  border-bottom-color: #d9d9e0;
}
#workspace .panel .users-table td {
  color: #241d21;
  background: #fff;
  border-bottom-color: #e5e3e7;
}
#workspace .panel .users-table tbody tr:hover td {
  background: #eff5fb;
}
#records-tables { display: grid; gap: .8rem; }
.contribution-settings { width: min(100%, 42rem); }
.contribution-settings .table-toolbar { padding-inline: 0; border: 0; }
.contribution-settings fieldset { min-width: 0; margin: 1.1rem 0 0; padding: 0; border: 0; }
.contribution-settings legend { padding: 0; color: #142f51; font-weight: 700; }
.contribution-settings p { margin: .55rem 0; color: var(--muted); }
.contribution-settings label {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 9rem;
  align-items: center;
  gap: .5rem 1rem;
  margin: .55rem 0;
}
.contribution-settings input {
  min-width: 0;
  width: 100%;
  font: inherit;
  color: inherit;
  padding: .5rem .6rem;
  background: #eaf0f6;
  border: 0;
  border-radius: .25rem;
}
@media (max-width: 30rem) {
  .contribution-settings label { grid-template-columns: minmax(0, 1fr); }
  .contribution-settings input { max-width: 12rem; }
}
.sales-overview, .sales-overview > div:last-child { display: grid; gap: .75rem; }
.sales-overview meter { width: min(18rem, 35vw); }
.invoice-export-host { position: fixed; left: -10000px; top: 0; width: 794px; }
.invoice-paper { width: 794px; height: 1123px; padding: 50px 20mm 0 25mm; overflow: hidden; display: flex; flex-direction: column; color: #111; background: white; border: 1px solid #d7dbe3; border-radius: 10px; }
.invoice-logo { display: flex; justify-content: center; margin-bottom: 64px; }
.invoice-logo img { max-width: 240px; max-height: 96px; object-fit: contain; }
.invoice-sender { font-size: 12px; margin-bottom: 18px; }
.invoice-addresses, .invoice-meta, .invoice-totals > div { display: flex; justify-content: space-between; gap: 32px; }
.invoice-addresses { margin-bottom: 32px; }
.invoice-addresses > div:last-child { text-align: right; }
.invoice-meta { margin-bottom: 34px; }
.invoice-content { flex: 1; display: flex; flex-direction: column; font-size: 16px; line-height: 20px; }
.invoice-content h2 { font-size: 18px; margin: 0 0 18px; }
.invoice-content p { margin: 14px 0 20px; }
.invoice-paper .invoice-items { margin-top: 20px; }
.invoice-paper .invoice-items :is(th, td) { border: 0; padding: 3px 0; background: white; color: #111; }
.invoice-paper .invoice-items th { padding-block: 7px; }
.invoice-width-10 { width: 10%; } .invoice-width-32 { width: 32%; } .invoice-width-16 { width: 16%; }
.invoice-width-20 { width: 20%; } .invoice-width-22 { width: 22%; }
.invoice-items :is(th, td):nth-child(3) { text-align: center; }
.invoice-items :is(th, td):nth-child(n+4) { text-align: right; }
.invoice-totals { border-top: 1px solid #111; padding-top: 8px; margin-top: 8px; }
.invoice-totals > div { padding: 3px 0; }
.invoice-totals > div:first-child, .invoice-totals > div:last-child { font-weight: 700; }
.invoice-totals > div:last-child { border-top: 1px solid #111; margin-top: 6px; padding-top: 7px; }
.invoice-closing { margin-top: auto; padding-top: 18px; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.invoice-closing img { max-width: 220px; max-height: 72px; object-fit: contain; }
.invoice-signature-space { min-height: 44px; }
.invoice-footer { margin-top: 10px; padding: 18px 0 42px; border-top: 1px solid #111; display: grid; gap: 6px; font-size: 14px; }
#records dialog label { display: flex; align-items: center; gap: .5rem; padding: .35rem 0; }
#finance-columns label { display: flex; align-items: center; gap: .5rem; padding: .4rem 0; }

.record-split { display: grid; grid-template-rows: minmax(0, var(--first-table-height)) 1rem minmax(0, var(--second-table-height)); height: max(34rem, calc(100dvh - 16rem)); min-width: 0; }
.record-split .record-split { height: auto; }
.record-split > .panel { min-height: 0; overflow: auto; }
.record-split-handle { cursor: row-resize; touch-action: none; display: grid; place-items: center; }
.record-split-handle::after { content: ''; display: block; width: 2.65rem; height: .25rem; border-radius: 1rem; background: #5289c1; }
#workspace .panel .users-table th > button { min-height: 2.25rem; padding: 0 .25rem; }
#workspace .panel .users-table th[aria-sort=ascending] > button::after { content: '▲'; }
#workspace .panel .users-table th[aria-sort=descending] > button::after { content: '▼'; }
#document-preview { width: min(70rem, 95vw); height: min(57rem, 90dvh); padding: 0; }
#document-preview[open] { display: grid; grid-template-rows: auto minmax(0, 1fr); }
#document-preview header { margin: 0; }
#document-content { min-height: 0; background: #eeedf0; }
#document-content iframe { display: block; width: 100%; height: 100%; border: 0; }
#document-content img { display: block; margin: auto; max-width: 100%; max-height: 100%; object-fit: contain; }


.page-heading { margin-bottom: 1rem; }
#dashboard-tabs { display: flex; flex-wrap: wrap; gap: .2rem .55rem; margin-top: .65rem; border-bottom: 1px solid #c3d3e3; }
#dashboard-tabs a { padding: .6rem .65rem; color: #244c73; text-decoration: none; border-bottom: 2px solid transparent; }
#dashboard-tabs a:hover { background: #e9f2fb; }
#dashboard-tabs a[aria-current="page"] { border-bottom-color: #a47311; font-weight: 700; color: #142f51; }
.company-appbar nav a[aria-current="page"] { color: var(--gold); }
.company-appbar nav a[aria-current="page"] svg { stroke: var(--gold); }
button { background: linear-gradient(#2a5784, #183458); border: 1px solid #5289c1; border-radius: 7px; }
button.primary { background: linear-gradient(#ffe8a2, #efa62c); color: #35230b; border-color: #fff0b2; font-weight: 700; }
.table-toolbar { justify-content: flex-start; gap: .15rem; padding: .45rem .65rem; border-bottom: 1px solid #dbe3eb; }
.table-toolbar > h2 { margin-right: auto; padding: .35rem .45rem; color: #142f51; }
.table-toolbar > label { margin-inline: .45rem; }
.table-toolbar > button {
  color: #204971; background: transparent; border-color: transparent; min-height: 2.2rem;
  font-size: .875rem; padding: .28rem .55rem; white-space: nowrap; box-shadow: none;
}
.table-toolbar > button + button { position: relative; }
.table-toolbar > button + button::before { content: ''; position: absolute; inset: .45rem auto .45rem -.12rem; width: 1px; background: #cddbe8; }
.table-toolbar > button:hover:not(:disabled) { color: #142f51; background: #eaf2fb; border-color: #b38837; }
.table-toolbar > button:disabled { opacity: .45; cursor: default; }
.has-action-icon { display: inline-flex; align-items: center; justify-content: center; gap: .35rem; }
.has-action-icon svg { width: 1rem; height: 1rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
#workspace .users-table td button, .table-cell-control {
  min-height: 0; display: inline-flex; padding: .15rem .25rem; background: transparent;
  border: 0; outline-offset: 2px; color: #245b87; border-radius: .2rem; font-size: inherit; box-shadow: none;
}
#workspace .users-table td button:hover { color: #142f51; text-decoration: underline; background: #e5eff9; }
#workspace .panel .users-table td { height: 2.45rem; padding: .35rem .75rem; }
.finance-controls button[aria-pressed="true"] { border-color: var(--gold); color: var(--gold); }
.table-toolbar { flex-wrap: nowrap; overflow-x: auto; }
.table-toolbar > * { flex: none; }
.selectable-row { cursor: pointer; }
.selectable-row:focus-visible { outline-offset: -3px; }

#workspace .users-table :is(input:not([type=checkbox]), select) {
  width: 100%;
  min-width: 7rem;
  padding: .35rem .2rem;
  font: inherit;
  color: inherit;
  background: transparent;
  border: 0;
  border-radius: 0;
}
#workspace .users-table td :is(input:not([type=checkbox]), select) { max-width: 14rem; }
#workspace .users-table :is(input:not([type=checkbox]), select):focus-visible {
  background: #eaf2fb;
  outline: 2px solid #5289c1;
  outline-offset: -2px;
}
.sales-metrics, .sales-charts { display: grid; gap: .65rem; }
.sales-metrics { grid-template-columns: repeat(auto-fit, minmax(min(100%, 8rem), 1fr)); }
.sales-charts { grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr)); }
.sales-metric, .sales-card { min-width: 0; padding: .75rem; }
.sales-metric { display: grid; gap: .35rem; }
.sales-metric strong { color: #244c73; font-size: 1.5rem; }
.sales-card h3 { margin: 0 0 .65rem; color: #142f51; }
.sales-ring-layout { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.sales-ring { width: 7.5rem; height: 7.5rem; }
.sales-legend { display: grid; grid-template-columns: 1fr auto; column-gap: .55rem; margin: 0; font-size: .9rem; }
.sales-legend dd { margin: 0; font-variant-numeric: tabular-nums; }
.sales-ring-layout p { font-size: .8rem; color: var(--muted); }
.sales-bars { display: flex; gap: .18rem; overflow: auto; margin-top: .65rem; }
.sales-bar-day { flex: 1 0 .7rem; min-width: 0; }
.sales-bar-columns { display: flex; align-items: flex-end; gap: 2px; height: 7rem; border-bottom: 1px solid #b6c9db; }
.sales-bar-columns span { flex: 1; height: var(--height); background: #397ac4; }
.sales-bar-columns span:nth-child(2) { background: #23896c; }
.sales-bar-day small { white-space: nowrap; }
.sales-split { height: max(30rem, calc(100dvh - 13rem)); }
.sales-analysis { min-width: 0; min-height: 0; overflow: auto; display: grid; align-content: start; gap: .65rem; }
