/* Design tokens: the old system's (mis.brr.gov.mk — the "SB Admin 2" look: a blue sidebar, a
   top bar, tiles with a coloured left edge), as the engineer asked on 2026-12-02 — the staff
   know it. Until then the MIS wore the platform's green.
   ⚠️ --brand is the colour of the application; --green is only "done / paid / good". They were one
   token before; a completed project in brand blue would read as "active".
   On 2026-12-03 the sidebar became more modern at the engineer's request: a floating card in two
   colours, the logo's blue running into its violet (--side-a → --side-b; white text ≥ 6.5:1 on
   both), with the examples' fold toggle and a menu button on phones. The top bar took the page's
   grey, set off by a thin line. */
:root {
  --brand: #4E73DF;
  --brand-d: #224ABE;
  --brand-l: #E8EDFB;
  --green: #1CC88A;
  --green-d: #13855C;
  --green-l: #E3F8F0;
  --ink: #2E2F3A;
  --grey: #6B6D7D;
  --line: #E3E6F0;
  --paper: #F8F9FC;
  --zebra: #F8F9FC;
  --white: #FFFFFF;
  --amber: #A97A06;
  --amber-l: #FEF7E3;
  --blue: #224ABE;
  --blue-l: #E8EDFB;
  --red: #C0392B;
  --red-l: #FCEBE9;
  --radius: 8px;
  --shadow: 0 .15rem 1.75rem 0 rgba(58, 59, 69, .12);
  --side-a: #2B4FD6;
  --side-b: #6A44C2;
  --sidebar: 15.5rem;
  --sidebar-folded: 4.5rem;
  --ease: cubic-bezier(.4, 0, .2, 1);
}

html {
  position: relative;
  min-height: 100%;
}

body {
  font-family: "Segoe UI", -apple-system, "Helvetica Neue", Arial, sans-serif;
  background: var(--paper);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
}

a {
  color: var(--brand);
}

a:hover {
  color: var(--brand-d);
}

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
}

/* Bootstrap's primary, in the brand colour. */
.btn-primary {
  --bs-btn-bg: var(--brand);
  --bs-btn-border-color: var(--brand);
  --bs-btn-hover-bg: var(--brand-d);
  --bs-btn-hover-border-color: var(--brand-d);
  --bs-btn-active-bg: var(--brand-d);
  --bs-btn-active-border-color: var(--brand-d);
}

.btn-outline-primary {
  --bs-btn-color: var(--brand);
  --bs-btn-border-color: var(--brand);
  --bs-btn-hover-bg: var(--brand);
  --bs-btn-hover-border-color: var(--brand);
  --bs-btn-active-bg: var(--brand-d);
}

/* Shell: the sidebar on the left, everything else in the main column. */
.shell {
  display: flex;
  min-height: 100vh;
}

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

/* The sidebar: a floating card in two colours that stays in view while the page scrolls.
   ⚠️ Geometry the fold depends on: the logo and every icon are centred 36px from the card's left
   edge (head padding 11 + disc 25; nav padding 10 + link padding 14 + icon 12), and the folded card
   is 72px (--sidebar-folded) — so folding slides the edge in and the icons never move. */
.sidebar {
  flex-shrink: 0;
  padding: 12px 0 12px 12px;
  z-index: 40;
}

.sidebar-inner {
  position: sticky;
  top: 12px;
  width: var(--sidebar);
  height: calc(100vh - 24px);
  display: flex;
  flex-direction: column;
  border-radius: 18px;
  background-color: var(--side-a);
  background-image:
    radial-gradient(120% 55% at 0% 0%, rgba(255, 255, 255, .16), transparent 60%),
    linear-gradient(165deg, var(--side-a) 0%, var(--side-b) 100%);
  box-shadow: 0 12px 32px rgba(43, 79, 214, .28);
  color: #fff;
  overflow: hidden;
  transition: width .32s var(--ease);
}

.sidebar-head {
  position: relative;
  flex-shrink: 0;
  height: 78px;
  padding: 14px 12px 14px 11px;
  border-bottom: 1px solid rgba(255, 255, 255, .14);
  transition: height .32s var(--ease);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 50px;
  color: #fff;
  text-decoration: none;
  font-weight: 800;
  letter-spacing: .04rem;
  white-space: nowrap;
}

.sidebar-brand:hover {
  color: #fff;
}

.sidebar-brand-text {
  font-size: 1.1rem;
  transition: opacity .2s var(--ease) .1s;
}

/* The fold toggle, as in the examples: a white square with a chevron at the top right; folded, it
   slides under the logo. The choice is the cookie brrmis.sidebar (wwwroot/js/sidebar.js), which
   the layout reads, so the next page comes folded from the server. */
.sidebar-toggle {
  position: absolute;
  top: 24px;
  left: calc(100% - 42px);
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: #fff;
  color: var(--side-a);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  transition: top .32s var(--ease), left .32s var(--ease), transform .15s var(--ease);
}

.sidebar-toggle i {
  transition: transform .32s var(--ease);
}

.sidebar-toggle:hover {
  transform: scale(1.08);
}

/* Phones: the menu behind this button (shown by the responsive layer, and only with a script). */
.menu-button {
  display: none;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 10px;
  background: #fff;
  color: var(--side-a);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .18);
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
}

.menu-button .fa-xmark,
.menu-button[aria-expanded="true"] .fa-bars {
  display: none;
}

.menu-button[aria-expanded="true"] .fa-xmark {
  display: inline-block;
}

.sidebar-toggle:focus-visible,
.menu-button:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* Without a script neither button can work: the sidebar simply stays open. */
html:not(.js) .sidebar-toggle {
  display: none;
}

.sidenav-wrap {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
}

.sidenav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px 10px 16px;
}

/* ⚠️ Folded, a heading turns its text transparent (not opacity 0), so its line stays as the
   divider between the groups. */
.side-heading {
  margin: 10px 4px 2px;
  padding: 10px 10px 0;
  border-top: 1px solid rgba(255, 255, 255, .16);
  font-size: .68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06rem;
  color: rgba(255, 255, 255, .62);
  white-space: nowrap;
  overflow: hidden;
  transition: color .2s var(--ease);
}

.side-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 14px;
  border-radius: 12px;
  color: rgba(255, 255, 255, .92);
  text-decoration: none;
  font-size: .92rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  transition: background-color .15s var(--ease), color .15s var(--ease), box-shadow .15s var(--ease);
}

.side-link i {
  flex-shrink: 0;
  width: 24px;
  font-size: 1.2rem;
  text-align: center;
  color: #fff;
}

.side-link span {
  transition: opacity .2s var(--ease) .1s;
}

.side-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, .15);
}

/* The current page: a white pill, the strongest mark on the blue. */
.side-link.active,
.side-link.active:hover {
  background: #fff;
  color: var(--side-a);
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(20, 30, 90, .25);
}

.side-link.active i {
  color: var(--side-a);
}

/* Top bar: the page's own grey, the account on the right, set off by one thin line. It was a white
   band with a shadow, which ran into the sidebar card (the engineer, 2026-12-03). The line keeps to
   the bar's content, so it never touches the card. Opaque, because the bar is sticky and the page
   scrolls under it. */
.topbar {
  --bar-pad: 26px;
  background: var(--paper);
  height: 4.375rem;
  padding: 0 var(--bar-pad);
  display: flex;
  align-items: center;
  gap: 18px;
  position: sticky;
  top: 0;
  z-index: 30;
}

.topbar::after {
  content: "";
  position: absolute;
  left: var(--bar-pad);
  right: var(--bar-pad);
  bottom: 0;
  border-bottom: 1px solid var(--line);
}

.topbar-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--ink);
}

.topbar-title .brand-sub {
  display: inline;
  font-weight: 400;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  text-decoration: none;
  color: var(--ink);
}

.brand:hover {
  color: var(--ink);
}

/* The Bureau's logo (wwwroot/img/logo-brr.png). Its globe is see-through and its arrows are blue,
   so on the blue it sits on a white disc; on the grey top bar it stands alone. */
.logo {
  display: block;
  height: auto;
}

.brand .logo {
  width: 52px;
}

.logo-disc {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .25);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.logo-disc .logo {
  width: 38px;
}

.brand-title {
  display: block;
  font-weight: 700;
  font-size: 15px;
  line-height: 1.2;
}

.brand-sub {
  display: block;
  font-size: 12px;
  color: var(--grey);
}

.header-end {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 14px;
}

.lang {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.lang a {
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  color: var(--grey);
}

.lang a.active {
  background: var(--brand);
  color: #fff;
}

.who {
  font-size: 13px;
  color: var(--grey);
  padding-left: 14px;
  border-left: 1px solid var(--line);
  white-space: nowrap;
}

.logout {
  margin: 0;
}

/* Page */
.page {
  flex: 1;
  width: 100%;
  max-width: 1680px;
  margin: 0 auto;
  padding: 24px 26px 40px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.page-head h1 {
  margin: 0;
}

.yearpick {
  display: flex;
  align-items: center;
  gap: 8px;
}

.yearpick .form-label {
  margin: 0;
  font-size: 13px;
  color: var(--grey);
  white-space: nowrap;
}

.yearpick .form-select {
  width: auto;
}

.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
}

.card + .card {
  margin-top: 16px;
}

.card.narrow {
  max-width: 560px;
  margin: 40px auto 0;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.card-head .ct {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
}

.empty {
  color: var(--grey);
  margin: 0;
}

.note {
  color: var(--grey);
  font-size: 12.5px;
  margin: 10px 0 0;
}

.text-warn {
  color: var(--amber);
}

/* KPI tiles */
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(170px, 100%), 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

/* The old system's tiles: a coloured left edge and a label in the same colour, the colours
   taking turns (blue, green, teal, yellow) as there. */
.kpi {
  --accent: var(--brand);
  --accent-text: var(--brand-d);
  background: var(--white);
  border: 1px solid var(--line);
  border-left: .25rem solid var(--accent);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.kpi:nth-child(4n+2) {
  --accent: var(--green);
  --accent-text: var(--green-d);
}

.kpi:nth-child(4n+3) {
  --accent: #36B9CC;
  --accent-text: #1F7F8C;
}

.kpi:nth-child(4n+4) {
  --accent: #F6C23E;
  --accent-text: #8A6406;
}

/* The edge keeps the old system's colour; the label a darker one of it — yellow and teal text on
   white is hard to read, and the label is what says what the figure is. */
.kpi .kpi-label {
  color: var(--accent-text);
  font-weight: 700;
}

.kpi-label {
  font-size: 12px;
  color: var(--grey);
  text-transform: uppercase;
  letter-spacing: .03em;
}

.kpi-value {
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.kpi-sub {
  font-size: 12px;
  color: var(--grey);
}

.kpi.warn {
  border-color: var(--amber);
  background: var(--amber-l);
}

/* Tables: they scroll inside their card, the page never scrolls sideways. */
.table-scroll {
  overflow-x: auto;
  /* ⚠️ Positioned, so an absolutely placed child — a button's visually-hidden label — is clipped
     by the scroll box instead of stretching the page past the screen. */
  position: relative;
}

.lead-cell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.data-table {
  width: 100%;
  margin-bottom: 0;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table th,
.data-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.data-table thead th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--grey);
  white-space: nowrap;
  border-bottom: 2px solid var(--line);
}

.data-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.data-table tr.measure th,
.data-table tr.measure td {
  font-weight: 600;
  background: var(--zebra);
}

.data-table tr.region td:first-child {
  padding-left: 28px;
  color: var(--grey);
}

/* The name column keeps a readable width; on a phone the table scrolls inside its card instead of
   breaking "Вардарски плански регион" into three lines. */
.data-table tbody th[scope="row"],
.data-table tbody td:first-child {
  min-width: 15rem;
}

.data-table tbody tr:hover td,
.data-table tbody tr:hover th {
  background: var(--brand-l);
}

.data-table tfoot th,
.data-table tfoot td {
  font-weight: 700;
  border-top: 2px solid var(--line);
  border-bottom: 0;
}

.data-table .neg {
  color: var(--red);
}

.kpi.good {
  border-color: var(--green);
  background: var(--green-l);
}

.kpi.bad {
  border-color: var(--red);
  background: var(--red-l);
}

/* Import of the old system's export */
.page-head .back {
  display: inline-block;
  font-size: 13px;
  margin-bottom: 4px;
}

.page-head .sub {
  margin: 4px 0 0;
  color: var(--grey);
  font-size: 14px;
}

.upload {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  margin: 12px 0 0;
}

.upload .form-label {
  flex-basis: 100%;
  margin: 0;
}

.upload .form-control {
  flex: 1 1 18rem;
  width: auto;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.yearpick.undated {
  flex-wrap: wrap;
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--amber-l);
}

.yearpick.undated .form-label {
  white-space: normal;
  color: var(--ink);
}

.ok {
  color: var(--green);
  margin: 0;
}

.issues {
  margin: 0;
  padding-left: 18px;
}

.issues li.error {
  color: var(--red);
}

.issues li.warn {
  color: var(--amber);
}

.issues.compact {
  font-size: 12.5px;
  min-width: 18rem;
}

.tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 12px;
  white-space: nowrap;
  background: var(--zebra);
  color: var(--grey);
  border: 1px solid var(--line);
}

.tag.outcome-new,
.tag.outcome-imported,
.tag.status-applied {
  background: var(--green-l);
  color: var(--green-d);
  border-color: var(--green);
}

.tag.outcome-exists,
.tag.status-pending {
  background: var(--blue-l);
  color: var(--blue);
  border-color: var(--blue);
}

.tag.outcome-rejected {
  background: var(--red-l);
  color: var(--red);
  border-color: var(--red);
}

.filters {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  font-size: 13px;
}

.filters a {
  padding: 3px 10px;
  border-radius: 999px;
  text-decoration: none;
}

.filters a.active {
  background: var(--brand);
  color: var(--white);
}

.small-grey {
  font-size: 12.5px;
  color: var(--grey);
}

.nowrap {
  white-space: nowrap;
}

/* The row number is narrow; the project column carries the reading width instead. */
.data-table.import-rows tbody td:first-child {
  min-width: 0;
}

.data-table.import-rows td.project {
  min-width: 15rem;
}

.data-table.import-rows tr.outcome-rejected td {
  background: var(--red-l);
}

/* Sign-in */
.card.login {
  max-width: 420px;
  margin: 48px auto 0;
  padding: 26px 28px;
}

.lead-sm {
  color: var(--grey);
  font-size: 14px;
}

/* One look for every field error, written once (the platform's rule). */
.field-error {
  display: block;
  color: var(--red);
  font-size: 13px;
  margin-top: 4px;
}

.field-error.summary ul {
  margin: 0 0 12px;
  padding-left: 18px;
}

.field-error.summary:empty,
.field-error.validation-summary-valid {
  display: none;
}

.input-validation-error {
  border-color: var(--red);
}

/* The foot, like the top bar: the page's grey and a thin line kept clear of the sidebar card. */
.site-footer {
  text-align: center;
  font-size: 12px;
  color: var(--grey);
  margin: 0 26px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

/* Callouts: one line of news above a card — saved, proposed, refused, missing. */
.callout {
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: var(--radius);
  background: var(--white);
  padding: 10px 14px;
  margin: 0 0 16px;
}

.callout.good {
  border-color: var(--green);
  background: var(--green-l);
}

.callout.info {
  border-color: var(--blue);
  background: var(--blue-l);
}

.callout.warn {
  border-color: var(--amber);
  background: var(--amber-l);
}

.callout.bad {
  border-color: var(--red);
  background: var(--red-l);
  color: var(--red);
}

/* Amount boxes: whole denars, right-aligned like the figures around them. */
input.amount {
  text-align: right;
  font-variant-numeric: tabular-nums;
  min-width: 11rem;
}

.data-table input.amount {
  margin-left: auto;
  max-width: 14rem;
}

.proposal {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.proposal .form-label {
  flex-basis: 100%;
  margin: 0;
}

.proposal input.amount {
  flex: 0 1 14rem;
  width: auto;
}

.proposal .field-error {
  flex-basis: 100%;
}

/* The budget form's rows are short; its first column need not hold 15rem. */
.data-table.budget-form tbody th[scope="row"],
.data-table.budget-form tbody td:first-child {
  min-width: 13rem;
}

/* Register of projects */
.exports {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.register-filters {
  margin-bottom: 16px;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(11rem, 100%), 1fr));
  gap: 10px 12px;
}

.filter-grid .form-label {
  font-size: 12px;
  color: var(--grey);
  margin-bottom: 2px;
}

.filter-grid .span-2 {
  grid-column: span 2;
}

.register-filters .actions {
  margin-top: 12px;
}

.data-table.register td.project {
  min-width: 16rem;
}

.data-table.register td.measure {
  min-width: 10.5rem;
}

/* The figures under the column names: no wrap, so a row is as tall as its text, not its headers. */
.data-table.register thead th {
  white-space: nowrap;
}

/* The budget form's rows hold an input; everything in them sits on its middle line. */
.data-table.budget-form th,
.data-table.budget-form td {
  vertical-align: middle;
}

.data-table.register td .small-grey,
.data-table.register td.project .small-grey {
  display: block;
}

.data-table.register tbody td:first-child {
  min-width: 0;
}

.tag.pstatus-planned {
  background: var(--zebra);
  color: var(--grey);
}

.tag.pstatus-active,
.tag.paystatus-approved {
  background: var(--blue-l);
  color: var(--blue);
  border-color: var(--blue);
}

.tag.pstatus-completed,
.tag.paystatus-paid {
  background: var(--green-l);
  color: var(--green-d);
  border-color: var(--green);
}

.tag.paystatus-draft {
  background: var(--amber-l);
  color: var(--amber);
  border-color: var(--amber);
}

/* Project page */
.two-col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(26rem, 100%), 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.two-col .card + .card {
  margin-top: 0;
}

.facts {
  display: grid;
  grid-template-columns: minmax(9rem, 40%) 1fr;
  gap: 6px 14px;
  margin: 0;
  font-size: 14px;
}

.facts dt {
  font-weight: 400;
  color: var(--grey);
}

.facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.facts.money dd {
  font-variant-numeric: tabular-nums;
}

.data-table.payouts tbody td:first-child {
  min-width: 10rem;
}

/* Payouts */
.payout-tabs {
  margin-bottom: 12px;
}

.kinds {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(15rem, 100%), 1fr));
  gap: 10px;
  border: 0;
  margin: 0;
  padding: 0;
}

.kind {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  cursor: pointer;
}

.kind:has(input:checked) {
  border-color: var(--brand);
  background: var(--brand-l);
}

.kind input {
  margin-top: 4px;
}

.kind .small-grey {
  display: block;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(15rem, 100%), 1fr));
  gap: 12px 16px;
}

.form-grid.two {
  grid-template-columns: repeat(auto-fit, minmax(min(24rem, 100%), 1fr));
}

.form-grid .form-text {
  display: block;
  font-size: 12px;
  color: var(--grey);
}

.doc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(19rem, 100%), 1fr));
  gap: 6px 16px;
  font-size: 14px;
}

.doc {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.doc input {
  margin-top: 4px;
}

.card.calc {
  border-color: var(--blue);
}

.data-table.calc-table {
  max-width: 40rem;
}

.data-table.calc-table th {
  font-weight: 400;
}

.data-table.calc-table tr.strong th,
.data-table.calc-table tr.strong td {
  font-weight: 700;
}

.data-table.calc-table tr.warn-row th,
.data-table.calc-table tr.warn-row td {
  color: var(--amber);
}

.paid-form,
.return-form {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.return-form {
  margin-top: 14px;
}

.return-form .form-label {
  flex-basis: 100%;
  margin: 0;
}

.return-form .form-control {
  flex: 1 1 18rem;
  width: auto;
}

ul.plain {
  margin: 0;
  padding-left: 18px;
}

.pre {
  white-space: pre-wrap;
  margin: 0;
}

.subsec {
  font-size: 14px;
  font-weight: 700;
  margin: 14px 0 6px;
}

.tag.paystatus-cancelled {
  text-decoration: line-through;
}

.data-table.payout-queue td.project .small-grey {
  display: block;
}

.report-links {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.report-links span {
  min-width: 11rem;
}

/* Accounts */
a.who {
  text-decoration: none;
}

a.who:hover {
  text-decoration: underline;
}

.data-table.users tr.inactive td {
  color: var(--grey);
}

.check-field {
  align-self: end;
}

.check-field .form-check-label {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Sign-in, as the old system: a blue panel beside the form. */
.login-split {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(18rem, 100%), 1fr));
  max-width: 820px;
  margin: 48px auto 0;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.login-welcome {
  background-color: var(--side-a);
  background-image:
    radial-gradient(120% 55% at 0% 0%, rgba(255, 255, 255, .16), transparent 60%),
    linear-gradient(165deg, var(--side-a) 0%, var(--side-b) 100%);
  color: #fff;
  padding: 36px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 6px;
}

.login-welcome .logo-disc {
  width: 112px;
  height: 112px;
  margin-bottom: 10px;
}

.login-welcome .logo-disc .logo {
  width: 86px;
}

.login-welcome p {
  margin: 0;
}

.login-hello {
  font-size: 1.5rem;
  font-weight: 700;
}

.login-owner {
  margin-top: 14px !important;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, .25);
  font-size: 13px;
  color: rgba(255, 255, 255, .85);
}

.login-form {
  padding: 32px 30px;
}

/* Reports by category and by indicator */
.data-table.categories tbody th[scope="row"],
.data-table.categories tbody td:first-child {
  min-width: 13rem;
}

.data-table.indicators tbody td:first-child {
  min-width: 0;
}

.data-table.indicators tr.quiet td {
  color: var(--grey);
}

/* Buttons where there were links (the engineer, 2026-12-02), in the old system's colours: yellow
   opens or goes back, blue edits, teal shows in the register. */
.btn-warning {
  --bs-btn-bg: #F6C23E;
  --bs-btn-border-color: #F6C23E;
  --bs-btn-color: #3A2E05;
  --bs-btn-hover-bg: #F4B619;
  --bs-btn-hover-border-color: #F4B619;
  --bs-btn-hover-color: #3A2E05;
  --bs-btn-active-bg: #E0A800;
  --bs-btn-active-border-color: #E0A800;
}

.btn-info {
  --bs-btn-bg: #36B9CC;
  --bs-btn-border-color: #36B9CC;
  --bs-btn-color: #fff;
  --bs-btn-hover-bg: #2C9FAF;
  --bs-btn-hover-border-color: #2C9FAF;
  --bs-btn-hover-color: #fff;
  --bs-btn-active-bg: #258391;
  --bs-btn-active-border-color: #258391;
  --bs-btn-active-color: #fff;
}

.head-actions,
.row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.row-actions {
  flex-wrap: nowrap;
}

.callout-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

strong.title {
  display: block;
  font-weight: 600;
}

/* Budget: the year's status, and the allocation's regions behind a native disclosure. */
.tag.fstatus-active {
  background: var(--green-l);
  color: var(--green-d);
  border-color: var(--green);
}

.tag.fstatus-closed {
  background: var(--zebra);
  color: var(--grey);
}

/* The budget years as a timeline (the engineer's example, 2026-12-03): a thin rail on the left and
   a ring per year — green while the year is active, blue once it is closed, amber while it has no
   budget — beside a card: the year with its status and dates, the four figures, the actions.
   The card follows the list's own width (a container query, so the open or folded sidebar counts):
   one row when there is room, the figures on a row of their own when not, two by two on a phone.
   ⚠️ The ring is centred on the rail at 12px: rail 11–13px, ring 16px (border-box) at left −30px
   of the item, whose edge is the list's 34px padding. Change one, recompute the others (the phone
   block too: centre 8px, padding 26px, ring −26px). */
.timeline {
  container: budget-years / inline-size;
  list-style: none;
  margin: 0;
  padding: 0 0 0 34px;
  position: relative;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 11px;
  top: 0;
  bottom: 0;
  width: 2px;
  border-radius: 2px;
  background: var(--brand-l);
}

.timeline-item {
  position: relative;
}

.timeline-item + .timeline-item {
  margin-top: 12px;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -30px;
  top: 50%;
  width: 16px;
  height: 16px;
  margin-top: -8px;
  border-radius: 50%;
  background: var(--white);
  border: 3px solid var(--brand);
  box-shadow: 0 0 0 3px var(--white);
}

.timeline-item.tl-active::before {
  border-color: var(--green);
}

.timeline-item.tl-missing::before {
  border-color: #E0A800;
}

.timeline-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px 24px;
  padding: 14px 18px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 10px;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}

.timeline-card:hover {
  border-color: #C9D3F5;
  box-shadow: 0 4px 14px rgba(58, 59, 69, .08);
}

.tl-yearline {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 10px;
}

.tl-year {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.15;
  color: var(--ink);
}

.tl-dates {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  color: var(--grey);
  white-space: nowrap;
}

.tl-facts {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px 16px;
  margin: 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.tl-facts dt {
  margin: 0 0 2px;
  font-size: 12px;
  font-weight: 400;
  color: var(--grey);
}

.tl-facts dd {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}

.tl-facts dd.amount {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.tl-facts dd.neg,
.tl-facts dd.missing {
  color: var(--red);
}

.tl-facts dd.missing {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
}

.tl-actions {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* The same width for "edit" and "enter", so every card's figures line up with the next one's. */
.tl-actions .btn.blue {
  min-width: 6.5rem;
}

.tl-note {
  grid-column: 1 / -1;
  margin: 0;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  font-size: 13px;
  color: var(--grey);
}

/* Room for one row: the year | the four figures | the actions. */
@container budget-years (min-width: 1000px) {
  .timeline-card {
    grid-template-columns: 11rem minmax(0, 1fr) auto;
  }

  .tl-when {
    align-self: stretch;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-right: 20px;
    border-right: 1px solid var(--line);
  }

  .tl-facts {
    grid-column: 2;
    grid-row: 1;
    padding-top: 0;
    border-top: 0;
  }

  .tl-actions {
    grid-column: 3;
  }
}

/* A phone: the figures two by two, the actions across the foot. */
@container budget-years (max-width: 520px) {
  .timeline-card {
    grid-template-columns: minmax(0, 1fr);
  }

  .tl-facts {
    grid-template-columns: 1fr 1fr;
  }

  .tl-actions {
    grid-column: 1;
    grid-row: auto;
  }

  .tl-actions .btn {
    flex: 1;
  }
}

/* Soft buttons: a tinted face with the label in the colour's dark (≥ 5:1), solid on hover. */
.btn-soft {
  --bs-btn-font-weight: 600;
  --bs-btn-border-color: transparent;
  --bs-btn-hover-border-color: transparent;
  --bs-btn-active-border-color: transparent;
  --bs-btn-hover-color: #fff;
  --bs-btn-active-color: #fff;
  white-space: nowrap;
}

.btn-soft.blue {
  --bs-btn-bg: var(--brand-l);
  --bs-btn-color: var(--brand-d);
  --bs-btn-hover-bg: var(--brand-d);
  --bs-btn-active-bg: var(--brand-d);
}

.btn-soft.amber {
  --bs-btn-bg: var(--amber-l);
  --bs-btn-color: #8A6304;
  --bs-btn-hover-bg: #8A6304;
  --bs-btn-active-bg: #8A6304;
}

.data-table.allocation tr.subrow > td {
  padding: 0;
  border-bottom: 0;
}

.data-table.allocation tr.subrow:hover > td {
  background: transparent;
}

details.regions > summary {
  list-style: none;
  cursor: pointer;
  background: #36B9CC;
  color: #fff;
  text-align: center;
  font-size: 12.5px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 4px;
  margin: 4px 0;
}

details.regions > summary::-webkit-details-marker {
  display: none;
}

details.regions[open] > summary .fa-chevron-down {
  transform: rotate(180deg);
}

details.regions .data-table.inner {
  margin: 4px 0 10px;
}

details.regions .data-table.inner td:first-child {
  padding-left: 28px;
  min-width: 14rem;
}

/* RESPONSIVE LAYER — one block, at the end, as in the platform. */
/* Below a tablet the sidebar becomes a bar on top — the logo and a menu button; the menu slides
   open below it (grid rows 0fr → 1fr). Without a script it simply stays open. */
@media (max-width: 768px) {
  .shell {
    flex-direction: column;
  }

  .sidebar {
    position: sticky;
    top: 0;
    padding: 10px 12px 0;
  }

  .sidebar-inner {
    position: static;
    width: auto;
    height: auto;
    border-radius: 16px;
    transition: none;
  }

  .sidebar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: auto;
    padding: 10px 12px 10px 14px;
    border-bottom: 0;
  }

  .sidebar-toggle {
    display: none;
  }

  .js .menu-button {
    display: flex;
  }

  .sidenav-wrap {
    overflow: visible;
  }

  html:not(.js) .sidenav-wrap,
  .sidebar.menu-open .sidenav-wrap {
    border-top: 1px solid rgba(255, 255, 255, .14);
  }

  /* ⚠️ The grid trick: the folded row is 0fr, so .sidenav must carry no vertical padding (it would
     still show) — its spacing is the first and last items' margins, which fold with it. */
  .js .sidenav-wrap {
    display: grid;
    grid-template-rows: 0fr;
    visibility: hidden;
    transition: grid-template-rows .3s var(--ease), visibility 0s linear .3s;
  }

  .js .sidebar.menu-open .sidenav-wrap {
    grid-template-rows: 1fr;
    visibility: visible;
    transition: grid-template-rows .3s var(--ease), visibility 0s;
  }

  .sidenav {
    min-height: 0;
    overflow: hidden;
    padding: 0 10px;
  }

  .sidenav > :first-child {
    margin-top: 10px;
  }

  .sidenav > :last-child {
    margin-bottom: 12px;
  }

  /* The budget timeline: a narrower rail (ring centred at 8px — left −26px of the item), the
     ring level with the year. The card itself follows the list's width (its container queries). */
  .timeline {
    padding-left: 26px;
  }

  .timeline::before {
    left: 7px;
  }

  .timeline-item::before {
    left: -26px;
    top: 22px;
    margin-top: 0;
  }

  /* Relative, not static: the line under it is positioned against the bar. */
  .topbar {
    position: relative;
  }
}

@media (max-width: 640px) {
  .topbar {
    --bar-pad: 16px;
  }

  .site-footer {
    margin: 0 16px;
  }

  .topbar-title {
    display: none;
  }

  .page {
    padding: 16px 16px 32px;
  }

  .brand-sub,
  .who {
    display: none;
  }

  .filter-grid .span-2 {
    grid-column: auto;
  }

  /* 16px controls so iOS does not zoom into a focused field. */
  .form-control,
  .form-select {
    font-size: 16px;
  }
}

/* Two-factor sign-in: the QR code, the key to type by hand, the recovery codes. */
.mfa-steps {
  padding-left: 1.3rem;
  margin: 0;
}

.mfa-steps > li {
  margin-bottom: 14px;
}

.mfa-steps .qr {
  margin: 10px 0 6px;
}

.mfa-steps .qr img {
  display: block;
  width: 245px;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

/* On its own line, and wrapped only between the groups of four. */
.mfa-key {
  display: block;
  margin-top: 4px;
  font-size: 15px;
  letter-spacing: .04em;
  word-break: normal;
  overflow-wrap: normal;
  white-space: normal;
  color: var(--ink);
}

.verify-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  max-width: 24rem;
}

.verify-form .code-input {
  flex: 1 1 9rem;
  min-width: 0;
}

.code-input {
  font-size: 1.15rem;
  letter-spacing: .15em;
  font-variant-numeric: tabular-nums;
}

.recovery-codes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 6px 18px;
  padding-left: 1.6rem;
  margin: 0 0 12px;
}

.recovery-codes code {
  font-size: 15px;
  color: var(--ink);
}

.header-end > .btn {
  line-height: 1.2;
}

/* On a narrow screen with the sidebar open, the title wraps — never the account or the sign-out. */
.header-end .btn {
  white-space: nowrap;
}

/* Wide screens only: the sidebar folded to its icons. The edge slides in, the names fade out
   (and, unfolding, fade back in a beat later), the toggle slides under the logo and turns. */
@media (min-width: 769px) {
  .sidebar-collapsed .sidebar-inner {
    width: var(--sidebar-folded);
  }

  .sidebar-collapsed .sidebar-head {
    height: 118px;
  }

  .sidebar-collapsed .sidebar-toggle {
    top: 76px;
    left: calc(50% - 15px);
  }

  .sidebar-collapsed .sidebar-toggle i {
    transform: rotate(180deg);
  }

  .sidebar-collapsed .sidebar-brand-text,
  .sidebar-collapsed .side-link span {
    opacity: 0;
    transition-delay: 0s;
  }

  .sidebar-collapsed .side-heading {
    color: transparent;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar-inner,
  .sidebar-head,
  .sidebar-brand-text,
  .sidebar-toggle,
  .sidebar-toggle i,
  .side-heading,
  .side-link span,
  .sidenav-wrap {
    transition: none !important;
  }
}
