:root {
  color-scheme: light;
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-muted: #eef2f6;
  --text: #1e293b;
  --muted: #475569;
  --line: #e2e8f0;
  --accent: #043d79;
  --accent-strong: #043d79;
  --danger: #b42318;
  --warning: #a15c07;
  --success: #147a3f;
  --info: #27548a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: var(--accent-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}

.brand__mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

.brand small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.1;
}

.main-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.main-nav a,
.button,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 12px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.main-nav a:hover,
.button:hover,
button:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.button--primary,
button[type="submit"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.button--primary:hover,
button[type="submit"]:hover {
  background: var(--accent-strong);
  color: #fff;
}

.page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 28px auto 42px;
}

.site-footer {
  max-width: 1180px;
  margin: 0 auto;
  padding: 18px 24px 28px;
  color: var(--muted);
  font-size: 13px;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.page-header h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.15;
  letter-spacing: 0;
}

.lede {
  max-width: 780px;
  margin: 8px 0 0;
  color: var(--muted);
}

.breadcrumbs {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 14px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 14px 0;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
}

.card,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.panel {
  margin: 16px 0;
  max-width: 100%;
  overflow: hidden;
}

.card h2,
.panel h2 {
  margin: 0 0 10px;
  font-size: 18px;
}

.card p,
.panel p {
  margin-top: 0;
}

.metric-list {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 7px 14px;
  margin: 12px 0 0;
}

dl {
  display: grid;
  grid-template-columns: minmax(160px, 260px) 1fr;
  gap: 8px 16px;
  margin: 12px 0;
}

dt {
  color: var(--muted);
  font-weight: 600;
}

dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.table-scroll,
.table-wrap,
.table-wrapper {
  max-width: 100%;
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  scrollbar-gutter: stable;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  white-space: normal;
  overflow-wrap: anywhere;
}

th {
  background: var(--surface-muted);
  color: #334155;
  font-size: 13px;
  font-weight: 700;
}

tr:last-child td {
  border-bottom: 0;
}

.table--compact th,
.table--compact td {
  padding: 9px 10px;
}

.cell--reference {
  min-width: 130px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.cell--label {
  min-width: 220px;
}

.cell--amount,
.cell--date,
.cell--status {
  white-space: nowrap;
}

.cell--amount {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.cell--action {
  position: sticky;
  left: 0;
  z-index: 1;
  width: 1%;
  min-width: 82px;
  text-align: left;
  white-space: nowrap;
  background: var(--surface);
  box-shadow: 8px 0 12px -12px rgba(15, 23, 42, 0.55);
}

th.cell--action {
  z-index: 2;
  background: var(--surface-muted);
}

.cell--action .button {
  min-height: 32px;
  padding: 5px 9px;
  white-space: nowrap;
}

.wide-form {
  max-width: none;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 2px 9px;
  background: var(--surface-muted);
  color: #334155;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.badge--success,
.badge--validated,
.badge--generated {
  background: #dcfce7;
  color: var(--success);
}

.badge--warning,
.badge--draft,
.badge--ready_for_review {
  background: #fef3c7;
  color: var(--warning);
}

.badge--danger,
.badge--cancelled,
.badge--archived {
  background: #fee2e2;
  color: var(--danger);
}

.notice,
.alert {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: var(--surface);
}

.notice--warning,
.alert--warning {
  border-color: #f2c36b;
  background: #fff7e6;
  color: #6f3f00;
}

.alert--success {
  border-color: #8bd4aa;
  background: #edfdf4;
  color: var(--success);
}

.alert--error {
  border-color: #f1a4a0;
  background: #fff0ef;
  color: var(--danger);
}

.messages {
  margin-bottom: 16px;
}

form {
  max-width: 840px;
}

label {
  display: block;
  margin-bottom: 5px;
  color: #334155;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  max-width: 680px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

textarea {
  min-height: 110px;
}

pre {
  overflow: auto;
  border-radius: 8px;
  padding: 14px;
  background: #111827;
  color: #f8fafc;
}

@media (max-width: 760px) {
  .site-header__inner,
  .page-header {
    display: block;
  }

  .main-nav {
    justify-content: flex-start;
    margin-top: 14px;
  }

  .page-shell {
    width: min(100% - 20px, 1180px);
    margin-top: 18px;
  }

  dl {
    grid-template-columns: 1fr;
    gap: 3px 0;
  }
}

/* Solunova brand alignment; shared public palette, no remote assets. */
.brand__logo { display:block; width:auto; height:60px; object-fit:contain; padding:20px; box-sizing:content-box; }
.brand { color:#043d79; }
.page-header h1, .card h2, .panel h2 { color:#043d79; }
.card, .panel { border-radius:16px; box-shadow:0 8px 24px rgba(15,23,42,.04); }
.main-nav a, .button, button { border-radius:12px; }
:where(a,button,input,select,textarea,summary):focus-visible { outline:3px solid #0084cb; outline-offset:3px; }
.skip-link { position:absolute; top:8px; left:8px; z-index:100; transform:translateY(-160%); background:#fff; color:#043d79; padding:10px 16px; border:2px solid #043d79; border-radius:12px; }
.skip-link:focus { position:relative; display:block; width:fit-content; max-width:calc(100% - 16px); top:auto; left:auto; margin:8px; transform:none; }
@media (prefers-reduced-motion:reduce) { html { scroll-behavior:auto; } }

/* Primary charter palette p4; decorative accents only. */
.site-header { border-top:3px solid #61c1c3; }
.brand small { color:#043d79; }

/* Original logo viewBox ratio; clear space remains height / 3. */
.brand__logo { aspect-ratio: 1346.7 / 1000.3; }
