@font-face { font-family: 'Outfit'; src: url('../fonts/Outfit-Regular.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Outfit'; src: url('../fonts/Outfit-Medium.ttf') format('truetype'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Outfit'; src: url('../fonts/Outfit-SemiBold.ttf') format('truetype'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Outfit'; src: url('../fonts/Outfit-Bold.ttf') format('truetype'); font-weight: 700; font-display: swap; }

/* Brand values are written into :root by the layout, so an admin colour
   change takes effect everywhere without touching this file. */
:root {
  --primary: #030d4e;
  --accent:  #12a17a;
  --ink:     #151a26;

  --paper:   #ffffff;
  --surface: #f4f6fa;
  --surface-2: #eef2f8;
  --line:    #dde3ee;
  --line-strong: #c6cfe0;
  --muted:   #5c6885;
  --muted-2: #808ca8;

  --danger:  #b3261e;
  --danger-bg: #fdf2f1;
  --warn:    #a16207;
  --warn-bg: #fdf8ec;
  --ok:      #12a17a;
  --ok-bg:   #eefaf5;

  --r-control: 6px;
  --r-panel: 10px;
  --rail: 236px;
  --rail-collapsed: 72px;

  --shadow-panel: 0 1px 2px rgba(3, 13, 78, .05);
  --shadow-pop: 0 12px 32px rgba(3, 13, 78, .16);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: 'Outfit', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0; font-weight: 600; color: var(--primary); line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }

p { margin: 0 0 .75rem; }
p:last-child { margin-bottom: 0; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ------------------------------------------------------------------ shell */
.shell { display: flex; min-height: 100vh; }

.rail {
  width: var(--rail);
  flex: 0 0 var(--rail);
  background: var(--primary);
  color: #cdd5ea;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  transition: width .18s ease, flex-basis .18s ease, transform .18s ease;
}
body.rail-collapsed .rail { width: var(--rail-collapsed); flex-basis: var(--rail-collapsed); }
body.rail-collapsed .rail-brand { justify-content: center; padding-left: .7rem; padding-right: .7rem; }
body.rail-collapsed .rail-brand > div { opacity: 0; width: 0; overflow: hidden; }
body.rail-collapsed .rail-group > span { opacity: 0; max-height: 0; overflow: hidden; padding-bottom: 0; }
body.rail-collapsed .rail-nav a { justify-content: center; gap: 0; }
body.rail-collapsed .rail-nav a > span { opacity: 0; max-width: 0; overflow: hidden; }
body.rail-collapsed .rail-nav a .ic { width: 19px; height: 19px; }
body.rail-collapsed .rail-nav { padding-left: .55rem; padding-right: .55rem; }
body.rail-collapsed .rail-foot { padding-left: .55rem; padding-right: .55rem; }
body.rail-collapsed .rail-user { justify-content: center; }
body.rail-collapsed .rail-user .who,
body.rail-collapsed .rail-foot form { opacity: 0; max-height: 0; overflow: hidden; }

.rail-brand {
  padding: 1.15rem 1.25rem 1rem;
  display: flex;
  align-items: center;
  gap: .65rem;
  border-bottom: 1px solid rgba(255, 255, 255, .09);
}
.rail-brand > div,
.rail-group > span,
.rail-nav a > span,
.rail-user .who,
.rail-foot form { transition: opacity .14s ease, max-width .18s ease, max-height .18s ease, width .18s ease; }
.rail-brand img { width: 30px; height: 30px; border-radius: 7px; background: #fff; object-fit: contain; padding: 2px; }
.rail-brand .name { color: #fff; font-weight: 600; font-size: .95rem; line-height: 1.2; }
.rail-brand .sub { color: var(--accent); font-size: .68rem; letter-spacing: .16em; }

.rail-nav { padding: .85rem .7rem; flex: 1; }
.rail-group { margin-bottom: 1.1rem; }
.rail-group > span {
  display: block;
  padding: 0 .55rem .35rem;
  font-size: .68rem;
  letter-spacing: .11em;
  color: #7683a8;
  text-transform: uppercase;
}
.rail-nav a {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .48rem .55rem;
  border-radius: var(--r-control);
  color: #cdd5ea;
  font-size: .9rem;
  font-weight: 500;
}
.rail-nav a > span { min-width: 0; white-space: nowrap; }
.rail-nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; text-decoration: none; }
.rail-nav a.on { background: rgba(18, 161, 122, .16); color: #fff; box-shadow: inset 2px 0 0 var(--accent); }
.rail-nav a .ic { width: 17px; height: 17px; flex: none; opacity: .85; }
.rail-nav a .count {
  margin-left: auto;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  font-size: .7rem;
  padding: .05rem .38rem;
  border-radius: 20px;
}

.rail-foot { padding: .85rem; border-top: 1px solid rgba(255, 255, 255, .09); }
.rail-user { display: flex; align-items: center; gap: .6rem; margin-bottom: .55rem; }
.rail-user .av {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: grid; place-items: center;
  font-size: .74rem; font-weight: 600; flex: none;
}
.rail-user .who { min-width: 0; }
.rail-user .who b { display: block; color: #fff; font-size: .84rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-user .who span { font-size: .7rem; color: #7683a8; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  padding: .85rem 1.6rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar h1 { font-size: 1.22rem; }
.topbar .sub { color: var(--muted); font-size: .84rem; margin-top: .1rem; }
.topbar .acts { margin-left: auto; display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }

.page { padding: 1.6rem; width: 100%; }
.page.narrow { max-width: 880px; }

.rail-toggle { display: inline-flex; }

/* ------------------------------------------------------------------ panels */
.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
  box-shadow: var(--shadow-panel);
}
.panel + .panel { margin-top: 1.1rem; }
.panel-head {
  padding: .85rem 1.1rem;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: .75rem;
}
.panel-head h2 { font-size: .98rem; }
.panel-head .acts { margin-left: auto; display: flex; gap: .45rem; }
.panel-body { padding: 1.1rem; }
.panel-body.tight { padding: .75rem 1.1rem; }
.panel-foot { padding: .75rem 1.1rem; border-top: 1px solid var(--line); background: var(--surface); border-radius: 0 0 var(--r-panel) var(--r-panel); }

.grid { display: grid; gap: 1.1rem; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.side { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }

/* ------------------------------------------------------------------ metrics */
.metric { padding: 1rem 1.1rem; }
.metric .label { font-size: .8rem; color: var(--muted); }
.metric .value {
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  margin-top: .15rem;
  line-height: 1.15;
}
.metric .value small { font-size: .85rem; color: var(--muted); font-weight: 500; letter-spacing: 0; }
.metric .foot { font-size: .78rem; color: var(--muted); margin-top: .3rem; }
.metric .foot b { color: var(--ink); font-weight: 500; }

/* split bar showing export vs domestic revenue */
.split { display: flex; height: 7px; border-radius: 4px; overflow: hidden; background: var(--surface-2); margin-top: .6rem; }
.split i { display: block; height: 100%; }
.split i.a { background: var(--accent); }
.split i.b { background: var(--primary); }
.split-key { display: flex; gap: 1rem; margin-top: .5rem; font-size: .78rem; color: var(--muted); }
.split-key span { display: inline-flex; align-items: center; gap: .35rem; }
.split-key i { width: 8px; height: 8px; border-radius: 2px; }

/* ------------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .88rem; }
table.data th {
  text-align: left;
  font-weight: 500;
  color: var(--muted);
  font-size: .76rem;
  letter-spacing: .04em;
  padding: .55rem 1.1rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  white-space: nowrap;
}
table.data td {
  padding: .7rem 1.1rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: #fafbfe; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data td.tight { width: 1%; white-space: nowrap; }
table.data .strong { font-weight: 600; color: var(--primary); }
table.data .dim { color: var(--muted); font-size: .82rem; }

.empty { padding: 2.6rem 1.1rem; text-align: center; color: var(--muted); }
.empty h3 { color: var(--ink); font-size: 1rem; margin-bottom: .3rem; }
.empty p { max-width: 30rem; margin: 0 auto .9rem; font-size: .9rem; }

/* -------------------------------------------------------------------- status */
.status { display: inline-flex; align-items: center; gap: .4rem; font-size: .82rem; white-space: nowrap; }
.status i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted-2); flex: none; }
.status.draft i     { background: #9aa5bf; }
.status.sent i      { background: #3b6fd4; }
.status.viewed i    { background: #7b5cd6; }
.status.part_paid i, .status.partially_signed i { background: var(--warn); }
.status.paid i, .status.completed i, .status.signed i { background: var(--ok); }
.status.overdue i, .status.declined i, .status.failed i { background: var(--danger); }
.status.void i, .status.expired i { background: #b9c1d4; }

.tag {
  display: inline-block;
  font-size: .72rem;
  padding: .1rem .42rem;
  border-radius: 4px;
  border: 1px solid var(--line-strong);
  color: var(--muted);
  background: var(--surface);
  white-space: nowrap;
}
.tag.export { border-color: rgba(18, 161, 122, .35); color: #0d7a5c; background: var(--ok-bg); }
.tag.domestic { border-color: rgba(3, 13, 78, .2); color: var(--primary); background: var(--surface-2); }
.tag.related { border-color: rgba(161, 98, 7, .3); color: var(--warn); background: var(--warn-bg); }

/* ------------------------------------------------------------------ buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .48rem .85rem;
  border-radius: var(--r-control);
  border: 1px solid var(--line-strong);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: .87rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background .12s ease, border-color .12s ease;
}
.btn:hover { background: var(--surface); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: #071566; }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.accent:hover { background: #0f8c69; }
.btn.danger { color: var(--danger); border-color: rgba(179, 38, 30, .35); }
.btn.danger:hover { background: var(--danger-bg); }
.btn.sm { padding: .3rem .58rem; font-size: .8rem; }
.btn.block { width: 100%; }
.btn .ic { width: 15px; height: 15px; }

.link-quiet { color: var(--muted); font-size: .84rem; }

/* -------------------------------------------------------------------- forms */
.field { margin-bottom: .95rem; }
.field:last-child { margin-bottom: 0; }
.field > label, .label {
  display: block;
  font-size: .82rem;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: .28rem;
}
.field .hint { font-size: .78rem; color: var(--muted); margin-top: .28rem; }

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=url], input[type=search], select, textarea {
  width: 100%;
  padding: .48rem .62rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-control);
  font: inherit;
  font-size: .9rem;
  color: var(--ink);
  background: var(--paper);
}
input[type=number] { appearance: textfield; -moz-appearance: textfield; }
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button { margin: 0; appearance: none; -webkit-appearance: none; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px rgba(18, 161, 122, .14); }
input[disabled], input[readonly] { background: var(--surface); color: var(--muted); }
textarea { resize: vertical; min-height: 5rem; line-height: 1.5; }
select { appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%235c6885' d='M1 1l5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .55rem center; padding-right: 2rem !important; }
select::-ms-expand { display: none; }

/* Keep the browser's accessible date control, but give it the dashboard's
   calendar treatment instead of the browser-default chrome. */
input[type=date] {
  color-scheme: light;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235c6885' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4.5' width='18' height='16' rx='2'/%3E%3Cpath d='M16 2.5v4M8 2.5v4M3 9h18'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .65rem center;
  padding-right: 2.5rem;
}
input[type=date]::-webkit-calendar-picker-indicator { opacity: .01; width: 1.4rem; cursor: pointer; }

.field-error { color: var(--danger); font-size: .8rem; margin: .28rem 0 0; }
.has-error input, .has-error select, .has-error textarea { border-color: var(--danger); }

.check { display: flex; align-items: flex-start; gap: .55rem; font-size: .88rem; cursor: pointer; }
.check input { width: 16px; height: 16px; margin: .18rem 0 0; accent-color: var(--accent); flex: none; }
.check span small { display: block; color: var(--muted); font-size: .78rem; }

.row { display: grid; gap: .95rem; }
.row.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.row.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.row.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--r-control); overflow: hidden; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: .4rem .8rem; font-size: .85rem; cursor: pointer; background: var(--paper); border-right: 1px solid var(--line-strong); }
.seg label:last-child span { border-right: 0; }
.seg input:checked + span { background: var(--primary); color: #fff; }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -2px; }

.filters { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.filters input[type=search], .filters select { width: auto; min-width: 9rem; }

/* colour picker pairs a swatch with a text field so the hex stays editable */
.colour { display: flex; gap: .5rem; align-items: center; }
.colour input[type=color] { width: 42px; height: 38px; padding: 2px; border: 1px solid var(--line-strong); border-radius: var(--r-control); background: var(--paper); cursor: pointer; }
.colour input[type=text] { font-variant-numeric: tabular-nums; }

/* ----------------------------------------------------------------- messages */
.flash { padding: .7rem 1rem; border-radius: var(--r-control); font-size: .88rem; margin-bottom: 1rem; border: 1px solid; display: flex; gap: .6rem; align-items: flex-start; }
.flash.success { background: var(--ok-bg); border-color: rgba(18, 161, 122, .3); color: #0b6e52; }
.flash.error { background: var(--danger-bg); border-color: rgba(179, 38, 30, .28); color: #8f1d17; }
.flash.info { background: var(--surface-2); border-color: var(--line-strong); color: var(--ink); }

.notice { padding: .8rem 1rem; border-radius: var(--r-control); font-size: .86rem; border: 1px solid var(--line); background: var(--surface); }
.notice.warn { background: var(--warn-bg); border-color: rgba(161, 98, 7, .28); color: #7c4a06; }
.notice strong { color: inherit; }

/* --------------------------------------------------------------- line items */
table.items { width: 100%; border-collapse: collapse; }
table.items th { font-size: .76rem; color: var(--muted); font-weight: 500; text-align: left; padding: 0 .5rem .35rem 0; }
table.items th.num { text-align: right; }
table.items td { padding: .25rem .5rem .25rem 0; vertical-align: top; }
table.items td:last-child, table.items th:last-child { padding-right: 0; }
table.items textarea { min-height: 2.4rem; }
table.items input.num { text-align: right; font-variant-numeric: tabular-nums; }
.line-total { padding-top: .55rem; font-variant-numeric: tabular-nums; font-size: .9rem; text-align: right; color: var(--muted); }
.row-drop { background: none; border: 0; color: var(--muted); cursor: pointer; padding: .45rem .3rem; font-size: 1.1rem; line-height: 1; }
.row-drop:hover { color: var(--danger); }

.totals { margin-left: auto; width: min(22rem, 100%); }
.totals div { display: flex; justify-content: space-between; padding: .32rem 0; font-size: .9rem; }
.totals div.grand {
  border-top: 1px solid var(--line-strong);
  margin-top: .35rem;
  padding-top: .6rem;
  font-size: 1.12rem;
  font-weight: 600;
  color: var(--primary);
}
.totals span.n { font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ tabs */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: 1.2rem; overflow-x: auto; }
.tabs a {
  padding: .5rem .8rem;
  font-size: .89rem;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
}
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.on { color: var(--primary); border-bottom-color: var(--accent); font-weight: 500; }

/* --------------------------------------------------------------- timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 .95rem 1.3rem; font-size: .86rem; }
.timeline li::before {
  content: ''; position: absolute; left: 0; top: .42rem;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--paper); border: 2px solid var(--line-strong);
}
.timeline li.done::before { border-color: var(--accent); background: var(--accent); }
.timeline li::after { content: ''; position: absolute; left: 3.5px; top: 1.1rem; bottom: 0; width: 1px; background: var(--line); }
.timeline li:last-child { padding-bottom: 0; }
.timeline li:last-child::after { display: none; }
.timeline time { display: block; color: var(--muted); font-size: .78rem; }

/* --------------------------------------------------------------- key/value */
.kv { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr); gap: .4rem .9rem; font-size: .88rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }

/* ------------------------------------------------------- signature capture */
.sigpad {
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-panel);
  background: #fcfdff;
  position: relative;
  touch-action: none;
}
.sigpad canvas { display: block; width: 100%; height: 190px; border-radius: var(--r-panel); cursor: crosshair; }
.sigpad .baseline { position: absolute; left: 1.6rem; right: 1.6rem; bottom: 3.2rem; border-bottom: 1px solid var(--line-strong); pointer-events: none; }
.sigpad .ph { position: absolute; left: 1.6rem; bottom: 1.7rem; color: var(--muted-2); font-size: .82rem; pointer-events: none; }
.sig-typed {
  font-size: 2rem;
  padding: 1.4rem 1rem .8rem;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-panel);
  background: #fcfdff;
  width: 100%;
  font-family: 'Outfit', cursive;
  color: var(--primary);
}

/* ----------------------------------------------------- client-facing pages */
.pub { background: var(--surface); min-height: 100vh; }
.pub-bar { background: var(--primary); color: #fff; padding: 1.05rem 0; }
.pub-bar .in { max-width: 940px; margin: 0 auto; padding: 0 1.4rem; display: flex; align-items: center; gap: 1rem; }
.pub-bar img { height: 30px; width: auto; background: #fff; padding: .25rem .4rem; border-radius: 6px; }
.pub-bar .who { font-size: .84rem; color: #b9c3e0; margin-left: auto; text-align: right; }
.pub-bar .who b { display: block; color: #fff; font-weight: 500; font-size: .92rem; }

.pub-wrap { max-width: 940px; margin: 0 auto; padding: 1.6rem 1.4rem 3.5rem; }

.pub-hero { display: flex; gap: 1.4rem; align-items: flex-end; flex-wrap: wrap; margin-bottom: 1.2rem; }
.pub-hero .amount {
  font-size: 2.4rem;
  font-weight: 600;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.025em;
  line-height: 1.1;
}
.pub-hero .amount small { display: block; font-size: .82rem; font-weight: 400; color: var(--muted); letter-spacing: 0; margin-bottom: .1rem; }
.pub-hero .acts { margin-left: auto; display: flex; gap: .5rem; }

.doc-body { font-size: .95rem; line-height: 1.7; }
.doc-body h1, .doc-body h2, .doc-body h3 { margin: 1.4rem 0 .5rem; }
.doc-body h1:first-child, .doc-body h2:first-child { margin-top: 0; }
.doc-body ul, .doc-body ol { padding-left: 1.3rem; }
.doc-body li { margin-bottom: .3rem; }
.doc-body table { width: 100%; border-collapse: collapse; margin: .8rem 0; font-size: .9rem; }
.doc-body th, .doc-body td { border: 1px solid var(--line); padding: .45rem .6rem; text-align: left; }
.doc-body blockquote { border-left: 3px solid var(--accent); margin: .9rem 0; padding-left: .9rem; color: var(--muted); }

.pub-foot { text-align: center; color: var(--muted); font-size: .8rem; margin-top: 1.8rem; }

/* ------------------------------------------------------------ login screen */
.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  background: var(--paper);
}
.auth-side { background: var(--primary); color: #fff; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between; }
.auth-side .mark { display: flex; align-items: center; gap: .7rem; }
.auth-side .mark img { width: 40px; height: 40px; background: #fff; border-radius: 9px; padding: 4px; }
.auth-side .mark b { font-size: 1.05rem; font-weight: 600; }
.auth-side .mark span { display: block; font-size: .68rem; letter-spacing: .2em; color: var(--accent); }
.auth-side .pitch { max-width: 26rem; }
.auth-side .pitch h2 { color: #fff; font-size: 1.75rem; line-height: 1.25; margin-bottom: .8rem; }
.auth-side .pitch p { color: #b9c3e0; font-size: .95rem; }
.auth-side .legal { color: #7683a8; font-size: .76rem; }
.auth-form { display: grid; place-items: center; padding: 3rem 2rem; }
.auth-form .box { width: min(23rem, 100%); }
.auth-form h1 { margin-bottom: .3rem; }
.auth-form .lede { color: var(--muted); font-size: .9rem; margin-bottom: 1.5rem; }

/* --------------------------------------------------------------- utilities */
.stack { display: flex; flex-direction: column; gap: .5rem; }
.inline { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.spread { display: flex; gap: .75rem; align-items: center; justify-content: space-between; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.num { font-variant-numeric: tabular-nums; }
.mt { margin-top: 1rem; }
.mt-2 { margin-top: 1.6rem; }
.mb { margin-bottom: 1rem; }
.hidden { display: none !important; }
.sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.bar { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); }

/* twelve-month cash chart, drawn with plain divs */
.chart { display: flex; align-items: flex-end; gap: 5px; height: 118px; padding-top: .5rem; }
.chart .col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; }
.chart .col i { display: block; background: var(--primary); border-radius: 3px 3px 0 0; min-height: 2px; opacity: .82; }
.chart .col:last-child i { background: var(--accent); opacity: 1; }
.chart-x { display: flex; gap: 5px; margin-top: .35rem; }
.chart-x span { flex: 1; text-align: center; font-size: .64rem; color: var(--muted-2); overflow: hidden; }

/* ------------------------------------------------------------- responsive */
@media (max-width: 1024px) {
  .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.side { grid-template-columns: minmax(0, 1fr); }
  .auth-page { grid-template-columns: 1fr; }
  .auth-side { display: none; }
}

@media (max-width: 820px) {
  .rail {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    z-index: 60;
    transform: translateX(-100%);
    box-shadow: var(--shadow-pop);
  }
  body.rail-collapsed .rail { width: var(--rail); flex-basis: var(--rail); }
  body.rail-collapsed .rail-brand { justify-content: flex-start; padding-left: 1.25rem; padding-right: 1.25rem; }
  body.rail-collapsed .rail-brand > div { opacity: 1; width: auto; overflow: visible; }
  body.rail-collapsed .rail-group > span { opacity: 1; max-height: none; overflow: visible; padding-bottom: .35rem; }
  body.rail-collapsed .rail-nav a > span { opacity: 1; max-width: none; overflow: visible; }
  body.rail-collapsed .rail-nav a { justify-content: flex-start; gap: .6rem; }
  body.rail-collapsed .rail-nav a .ic { width: 17px; height: 17px; }
  body.rail-collapsed .rail-nav { padding-left: .7rem; padding-right: .7rem; }
  body.rail-collapsed .rail-foot { padding-left: .85rem; padding-right: .85rem; }
  body.rail-collapsed .rail-user { justify-content: flex-start; }
  body.rail-collapsed .rail-user .who,
  body.rail-collapsed .rail-foot form { opacity: 1; max-height: none; overflow: visible; }
  body.rail-open .rail { transform: translateX(0); }
  body.rail-open::after {
    content: ''; position: fixed; inset: 0; background: rgba(3, 13, 78, .4); z-index: 50;
  }
  .rail-toggle { display: inline-flex; }
  .page { padding: 1.1rem; }
  .topbar { padding: .75rem 1.1rem; }
  .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: minmax(0, 1fr); }
  .row.c2, .row.c3, .row.c4 { grid-template-columns: minmax(0, 1fr); }
  .kv { grid-template-columns: minmax(0, 1fr); gap: .1rem .9rem; }
  .kv dt { margin-top: .5rem; }
  .pub-hero .acts { margin-left: 0; width: 100%; }
}

@media print {
  .rail, .topbar, .btn, .pub-bar { display: none !important; }
  body { background: #fff; }
  .panel { border: 0; box-shadow: none; }
}

/* ------------------------------------------------------- rich text editor */
.editor { border: 1px solid var(--line-strong); border-radius: var(--r-control); overflow: hidden; }
.editor-bar { display: flex; gap: 2px; padding: .3rem; background: var(--surface); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.editor-bar button {
  border: 0; background: none; padding: .22rem .5rem; border-radius: 4px;
  font: inherit; font-size: .82rem; color: var(--muted); cursor: pointer; min-width: 1.9rem;
}
.editor-bar button:hover { background: var(--surface-2); color: var(--ink); }
.editor-area { padding: .7rem .75rem; min-height: 7rem; font-size: .9rem; line-height: 1.6; background: var(--paper); }
.editor-area:focus { outline: none; box-shadow: inset 0 0 0 2px rgba(18, 161, 122, .16); }
.editor-area p { margin: 0 0 .5rem; }
.editor-area ul, .editor-area ol { padding-left: 1.2rem; margin: 0 0 .5rem; }
.editor-area.tall { min-height: 20rem; }

.signer-row { display: grid; grid-template-columns: 1.1fr 1.3fr 1fr auto auto; gap: .5rem; align-items: start; margin-bottom: .5rem; }
@media (max-width: 820px) { .signer-row { grid-template-columns: 1fr; padding-bottom: .6rem; border-bottom: 1px solid var(--line); } }
