/* ============================================================
   DESIGN SYSTEM — "Ink & Brass" restyle
   Tokens lifted from the designer mockup, expressed as a theme
   layer on top of Bootstrap 5.3. Markup stays Bootstrap; this
   file re-skins it. Dark "Palco" theme lives at the bottom.
   ============================================================ */
:root {
  /* --- Palette --- */
  --ink: #212842; /* blu notte: sidebar e titoli */
  --ink-2: #2b3355;
  --paper: #f7f6f2; /* sfondo carta */
  --card: #ffffff;
  --brass: #b8862b; /* ottone: accento */
  --brass-deep: #8b611a;
  --brass-soft: #f4e8cd;
  --text: #2a2f45;
  /* The foreground tokens below are tuned to clear 4.5:1 against the surfaces
     they actually sit on (--card, --paper, #fbfaf7 and their -soft tints).
     Nudging them lighter will quietly fail WCAG AA — they have no headroom. */
  --muted: #6d738a;
  --line: #e7e4da;
  --ok: #2c785e;
  --ok-soft: #e2f0ea;
  --warn: #a35620;
  --warn-soft: #f8e9dc;
  --bad: #b0433c;
  --bad-soft: #f6e3e1;
  --info: #41528f; /* the av-1 blue, as a token — see the themecolor filter */
  --radius: 14px;
  --shadow: 0 1px 2px rgba(33, 40, 66, 0.06), 0 8px 24px rgba(33, 40, 66, 0.07);
  --font-display: "Bricolage Grotesque", sans-serif;
  --font-body: "Instrument Sans", sans-serif;
  --font-mono: "Spline Sans Mono", monospace;

  /* --- Bootstrap variable overrides --- */
  --bs-body-bg: var(--paper);
  --bs-body-color: var(--text);
  --bs-body-font-family: var(--font-body);
  --bs-secondary-color: var(--muted);
  --bs-tertiary-color: var(--muted);
  --bs-emphasis-color: var(--ink);
  --bs-heading-color: var(--ink);
  --bs-border-color: var(--line);
  --bs-secondary-bg: var(--paper); /* .bg-body-secondary — warm paper, not #e9ecef */
  --bs-border-radius: var(--radius);
  --bs-border-radius-sm: 10px;
  --bs-link-color: var(--brass-deep);
  --bs-link-hover-color: var(--brass);
  /* Bootstrap 5.3 colours <a> from the -rgb pair, not --bs-link-color, so the
     two above are not enough on their own — without these, plain links render
     Bootstrap blue. */
  --bs-link-color-rgb: 139, 97, 26;
  --bs-link-hover-color-rgb: 184, 134, 43;
  --bs-primary: var(--brass);
  --bs-primary-rgb: 184, 134, 43;
  /* Semantic colours, so .text-success/.text-danger/.text-warning and every
     Bootstrap component keyed off them land on the palette instead of
     #198754 / #dc3545 / #ffc107 (the last is 1.6:1 on white). */
  --bs-success: var(--ok);
  --bs-success-rgb: 44, 120, 94;
  --bs-warning: var(--warn);
  --bs-warning-rgb: 163, 86, 32;
  --bs-danger: var(--bad);
  --bs-danger-rgb: 176, 67, 60;
  --bs-focus-ring-color: rgba(184, 134, 43, 0.3);
}

body {
  font-family: var(--font-body);
  color: var(--text);
  background: var(--paper);
}

/* ---------- Typography ---------- */
h1,
h2,
h3,
h4,
h5,
h6,
.h1,
.h2,
.h3,
.h4,
.h5,
.h6 {
  font-family: var(--font-display);
  color: var(--ink);
  letter-spacing: -.01em;
}
.text-body-secondary {
  color: var(--muted) !important;
}
.font-mono,
.mono {
  font-family: var(--font-mono);
}

/* ---------- Buttons ---------- */
.btn {
  --bs-btn-border-radius: 10px;
  --bs-btn-font-weight: 600;
  --bs-btn-padding-y: .55rem;
  --bs-btn-padding-x: 1rem;
}
/* Fills carrying white text use --brass-deep, not --brass: white on --brass is
   3.2:1, and button labels are 16px/600 — not "large text", so AA wants 4.5.
   --brass stays the accent everywhere it isn't behind white text (active nav,
   focus rings, brand mark, borders). */
.btn-primary {
  --bs-btn-bg: var(--brass-deep);
  --bs-btn-border-color: var(--brass-deep);
  --bs-btn-color: #fff;
  --bs-btn-hover-bg: #7d5717;
  --bs-btn-hover-border-color: #7d5717;
  --bs-btn-hover-color: #fff;
  --bs-btn-active-bg: #7d5717;
  --bs-btn-active-border-color: #7d5717;
  --bs-btn-active-color: #fff;
  --bs-btn-disabled-bg: var(--brass-deep);
  --bs-btn-disabled-border-color: var(--brass-deep);
  box-shadow: 0 2px 6px rgba(184, 134, 43, 0.35);
}
.btn-outline-primary {
  --bs-btn-color: var(--brass-deep);
  --bs-btn-border-color: var(--brass);
  --bs-btn-hover-bg: var(--brass-deep);
  --bs-btn-hover-border-color: var(--brass-deep);
  --bs-btn-hover-color: #fff;
  --bs-btn-active-bg: #7d5717;
  --bs-btn-active-border-color: #7d5717;
}
/* Bootstrap's default grey — reached via the shim's alert/confirm/prompt
   footers, so it shows up in every confirmation dialog. Make it read as the
   secondary button the vocabulary already has. */
.btn-secondary {
  --bs-btn-bg: var(--card);
  --bs-btn-border-color: var(--line);
  --bs-btn-color: var(--text);
  --bs-btn-hover-bg: var(--card);
  --bs-btn-hover-border-color: var(--brass);
  --bs-btn-hover-color: var(--text);
  --bs-btn-active-bg: var(--card);
  --bs-btn-active-border-color: var(--brass);
  --bs-btn-active-color: var(--text);
}
.btn-ghost {
  --bs-btn-bg: var(--card);
  --bs-btn-border-color: var(--line);
  --bs-btn-color: var(--text);
  --bs-btn-hover-bg: var(--card);
  --bs-btn-hover-border-color: var(--brass);
  --bs-btn-hover-color: var(--text);
  border: 1px solid var(--line);
}
.btn-link {
  --bs-btn-color: var(--brass-deep);
  --bs-btn-hover-color: var(--brass);
}

/* ---------- Cards ---------- */
.card {
  --bs-card-bg: var(--card);
  --bs-card-border-color: var(--line);
  --bs-card-border-radius: var(--radius);
  --bs-card-inner-border-radius: calc(var(--radius) - 1px);
  box-shadow: var(--shadow);
}
.card-header {
  background: #fbfaf7;
  border-bottom-color: var(--line);
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--ink);
}

/* ---------- Tables ---------- */
.table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--text);
  --bs-table-border-color: var(--line);
  --bs-table-hover-bg: #fbf8f1;
  margin-bottom: 0;
}
.table > thead th {
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  background: #fbfaf7;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.table > tbody td {
  vertical-align: middle;
}
.table-card {
  overflow: hidden;
}

/* ---------- Forms ---------- */
.form-control,
.form-select {
  border-color: var(--line);
  border-radius: 10px;
}
.form-control:focus,
.form-select:focus {
  border-color: var(--brass);
  box-shadow: 0 0 0 .2rem var(--bs-focus-ring-color);
}
.form-label {
  color: var(--muted);
  font-weight: 500;
}
/* Checkboxes and switches: Bootstrap hard-codes #0d6efd for :checked (it is not
   a variable, so the --bs-primary bridge can't reach it) and #86b7fe for focus.
   They are the whole interaction on the presenze screens, so they were the most
   visible off-palette element in the app. The resting border also has to be
   --muted, not --line: a 1.2:1 control boundary is not a control boundary. */
.form-check-input {
  border-color: var(--muted);
}
.form-check-input:checked {
  background-color: var(--brass-deep);
  border-color: var(--brass-deep);
}
.form-check-input:focus {
  border-color: var(--brass);
  box-shadow: 0 0 0 .2rem var(--bs-focus-ring-color);
}
.form-switch .form-check-input:focus {
  --bs-form-switch-bg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3E%3Ccircle r='3' fill='%236d738a'/%3E%3C/svg%3E");
}

/* ---------- Search field (mockup pill) ---------- */
.search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 12px;
  min-width: 220px;
}
.search:focus-within {
  border-color: var(--brass);
  box-shadow: 0 0 0 .2rem var(--bs-focus-ring-color);
}
.search > .bi {
  font-size: 15px;
  color: var(--muted);
  flex-shrink: 0;
}
.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  padding: 9px 0;
  color: var(--text);
  font: inherit;
}
.search input::placeholder {
  color: var(--muted);
}
.search input::-webkit-search-cancel-button {
  -webkit-appearance: none;
}
.search .search-clear {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  padding: 0 2px;
  flex-shrink: 0;
}
.search .search-clear:hover {
  color: var(--text);
}

/* ---------- Filter select (pill matching .search) ---------- */
.select-pill {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid var(--line);
  border-radius: 10px;
  background-color: var(--card);
  color: var(--text);
  padding: 9px 34px 9px 12px;
  font: inherit;
  line-height: 1.4;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%236d738a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  background-size: 15px;
}
.select-pill:focus {
  outline: 0;
  border-color: var(--brass);
  box-shadow: 0 0 0 .2rem var(--bs-focus-ring-color);
}

/* ---------- Pills / badges (custom vocabulary from mockup) ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 99px;
  white-space: nowrap;
}
.pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.pill-ok {
  background: var(--ok-soft);
  color: var(--ok);
}
.pill-warn {
  background: var(--warn-soft);
  color: var(--warn);
}
.pill-bad {
  background: var(--bad-soft);
  color: var(--bad);
}
.pill-neutral {
  background: #eef0f6;
  color: var(--ink-2);
}
.tag-sm {
  background: #eef0f6;
  color: var(--ink-2);
  font-size: 11.5px;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 99px;
}
.code {
  font-family: var(--font-mono);
  font-size: 11.5px;
  background: #eef0f6;
  color: var(--ink-2);
  padding: 2px 6px;
  border-radius: 6px;
  margin-right: 6px;
}

/* ---------- Avatars ---------- */
.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  font-weight: 600;
  font-size: 13px;
  flex-shrink: 0;
}
.av-1 {
  background: #e7ecf9;
  color: #41528f;
}
.av-2 {
  background: var(--brass-soft);
  color: var(--brass-deep);
}
.av-3 {
  background: var(--ok-soft);
  color: var(--ok);
}
.av-4 {
  background: var(--bad-soft);
  color: var(--bad);
}
.cell-who {
  display: flex;
  align-items: center;
  gap: 11px;
}
.cell-who b {
  display: block;
  color: var(--ink);
  font-weight: 600;
}
.cell-who small {
  color: var(--muted);
  font-size: 12px;
}

/* ---------- KPI cards ---------- */
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}
.kpi {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.kpi .k-label {
  font-size: 13px;
  color: var(--muted);
}
.kpi .k-value {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 26px;
  color: var(--ink);
  margin-top: 4px;
}
.kpi .k-trend {
  font-size: 12px;
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 99px;
}
.trend-up {
  background: var(--ok-soft);
  color: var(--ok);
}
.trend-warn {
  background: var(--warn-soft);
  color: var(--warn);
}
.trend-flat {
  background: #eef0f6;
  color: var(--muted);
}

/* ---------- Quick action row (cash movements) ---------- */
.quick3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}
@media (max-width: 600px) {
  .quick3 {
    grid-template-columns: 1fr;
  }
}
.btn-in {
  --bs-btn-bg: var(--ok);
  --bs-btn-border-color: var(--ok);
  --bs-btn-color: #fff;
  --bs-btn-hover-bg: #256a52;
  --bs-btn-hover-border-color: #256a52;
  --bs-btn-hover-color: #fff;
  --bs-btn-active-bg: #256a52;
  --bs-btn-active-border-color: #256a52;
  box-shadow: 0 2px 6px rgba(46, 125, 98, 0.3);
}
.btn-out {
  --bs-btn-bg: var(--bad);
  --bs-btn-border-color: var(--bad);
  --bs-btn-color: #fff;
  --bs-btn-hover-bg: #963731;
  --bs-btn-hover-border-color: #963731;
  --bs-btn-hover-color: #fff;
  --bs-btn-active-bg: #963731;
  --bs-btn-active-border-color: #963731;
  box-shadow: 0 2px 6px rgba(176, 67, 60, 0.3);
}
.btn-giro {
  --bs-btn-bg: var(--ink);
  --bs-btn-border-color: var(--ink);
  --bs-btn-color: #fff;
  --bs-btn-hover-bg: var(--ink-2);
  --bs-btn-hover-border-color: var(--ink-2);
  --bs-btn-hover-color: #fff;
  --bs-btn-active-bg: var(--ink-2);
  --bs-btn-active-border-color: var(--ink-2);
}

/* ---------- Section title ---------- */
.sec-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 18px;
  color: var(--ink);
  margin: 4px 0 12px;
}

/* ---------- Detail page (profile) ---------- */
.profile-head {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.avatar-xl {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  font-size: 22px;
}
.p-info {
  flex: 1;
  min-width: 0;
}
.p-info h1 {
  font-size: 27px;
}
.p-info .p-sub {
  color: var(--muted);
  margin: 2px 0 8px;
}
.p-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.tag {
  background: var(--brass-soft);
  color: var(--brass-deep);
  font-size: 12.5px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 99px;
}
.grid-allievo {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 16px;
}
@media (max-width: 860px) {
  .grid-allievo {
    grid-template-columns: 1fr;
  }
}
/* Named .stack, not .col: Bootstrap's grid already owns `.col`, and a global
   redefinition of it turns every future `<div class="row"><div class="col">`
   into a gapped vertical stack. */
.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.dl {
  display: grid;
  grid-template-columns: 132px 1fr;
  row-gap: 10px;
  column-gap: 10px;
  font-size: 14px;
  margin: 0;
}
.dl dt {
  color: var(--muted);
  font-weight: 400;
}
.dl dd {
  color: var(--ink);
  font-weight: 500;
  overflow-wrap: anywhere;
  margin: 0;
}
.stat3 {
  /* auto-fit rather than a hard repeat(3): the mono values are 19px and three
     fixed columns overflow a narrow phone. Same trick as .kpis. */
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.stat3 .st {
  background: #fbfaf7;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}
.stat3 .st small {
  display: block;
  font-size: 12px;
  color: var(--muted);
}
.stat3 .st b {
  font-family: var(--font-mono);
  font-size: 19px;
  color: var(--ink);
}
.stat3 .st.neg b {
  color: var(--bad);
}
.rate {
  display: grid;
  grid-template-columns: 68px 1fr 150px 116px;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.rate:last-child {
  border-bottom: none;
}
.rate time {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}
.rate .bar-mini {
  height: 6px;
  background: #eef0f6;
  border-radius: 99px;
  overflow: hidden;
}
.rate .bar-mini i {
  display: block;
  height: 100%;
  background: var(--ok);
}
.rate.open .bar-mini i {
  background: var(--bad);
}
.rate .mono {
  text-align: right;
  white-space: nowrap;
}
.rate > :last-child {
  text-align: right;
  justify-self: end; /* the trailing status is a .pill (inline-flex) */
}
@media (max-width: 600px) {
  .rate {
    grid-template-columns: 68px 1fr auto;
  }
  .rate .bar-mini {
    display: none;
  }
}
.list-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  text-align: left;
  padding: 12px 4px;
  border: 0;
  border-bottom: 1px solid var(--line);
  font-weight: 500;
  color: var(--ink);
  background: none;
}
.list-btn:last-child {
  border-bottom: none;
}
.list-btn:hover {
  color: var(--brass-deep);
}
.list-btn > span {
  display: inline-flex;
  align-items: center;
  gap: 11px;
}
.list-btn .lead {
  color: var(--brass-deep);
  width: 18px;
  text-align: center;
  font-size: 15px;
}
.list-btn.text-danger .lead {
  color: inherit;
}
.list-btn .chev {
  color: var(--muted);
  font-size: 13px;
}

/* ---------- Card header text link (mockup) ---------- */
.card-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 0;
  background: none;
  padding: 0;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  color: var(--brass-deep);
}
.card-link:hover {
  color: var(--brass);
}

/* ---------- Page header ---------- */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.page-head h1 {
  font-size: 30px;
  font-weight: 700;
}
.page-head .subtitle {
  color: var(--muted);
  margin-top: 2px;
}
.page-head .head-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* ============================================================
   TOP NAVBAR (mobile / content bar)
   ============================================================ */
.navbar-dark,
.navbar[data-bs-theme="dark"] {
  --bs-navbar-brand-color: #fff;
  --bs-navbar-color: rgba(255, 255, 255, 0.75);
  background-color: var(--ink);
}
.navbar-brand {
  font-family: var(--font-display);
  font-weight: 600;
}

/* ============================================================
   SIDEBAR — ink background, grouped nav, brass active state
   ============================================================ */
#sidebar {
  background-color: var(--ink) !important;
  color: #d8dbea;
}
#sidebar .offcanvas-header {
  color: #fff;
  border-bottom: 1px solid var(--ink-2);
}
#sidebar .btn-close {
  filter: invert(1) grayscale(100%) brightness(200%);
}
#sidebar .list-group {
  --bs-list-group-bg: transparent;
  padding: 8px 10px;
}

/* Brand */
#sidebar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 14px;
}
#sidebar .brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--brass), #d8ab52);
  color: var(--ink);
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
}
#sidebar .brand-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 19px;
  color: #fff;
  letter-spacing: .2px;
}

/* User chip */
#sidebar .user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--ink-2);
  border-radius: 12px;
  padding: 10px 12px;
  margin: 0 2px 12px;
}
#sidebar .user-chip .avatar {
  width: 32px;
  height: 32px;
  background: var(--brass-soft);
  color: var(--brass-deep);
  font-size: 13px;
}
#sidebar .user-chip strong {
  font-size: 13.5px;
  color: #fff;
  display: block;
}
#sidebar .user-chip small {
  color: #9aa1bd;
  font-size: 12px;
}

/* Section labels */
#sidebar .nav-label {
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #8b92b0;
  padding: 12px 12px 4px;
  font-weight: 600;
}

/* Nav items (Bootstrap list-group links, re-skinned) */
#sidebar .list-group-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: none;
  color: #d8dbea;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 14px;
  transition: background .15s, color .15s;
}
#sidebar .list-group-item > i {
  width: 18px;
  flex-shrink: 0;
  text-align: center;
  font-size: 15px;
}
#sidebar .list-group-item-action:hover,
#sidebar .list-group-item-action:focus {
  background: var(--ink-2);
  color: #fff;
}
#sidebar .list-group-item.active {
  background: var(--brass);
  color: #16192b; /* a shade under --ink: on brass that is 5.4:1, --ink only 4.5 */
  font-weight: 600;
  border: none;
}
#sidebar hr {
  border-color: var(--ink-2);
  opacity: 0.5;
  margin: 8px 12px;
}

/* Theme toggle sits at the bottom */
#sidebar .sidebar-tools {
  margin-top: auto;
  padding-top: 8px;
}

@media (min-width: 992px) {
  #sidebar {
    border-right: none;
    display: flex;
    flex-direction: column;
  }
  #sidebar .offcanvas-body {
    display: flex;
    flex-direction: column;
    flex: 1;
  }
  #sidebar .list-group {
    flex: 1;
    display: flex;
    flex-direction: column;
  }
}

/* ============================================================
   DARK "PALCO" THEME — toggled by adding .theme-dark on <html>
   ============================================================ */
.theme-dark {
  --paper: #12151f;
  --card: #1b2030;
  --ink: #eceef8;
  --ink-2: #39415f;
  --text: #d5d8e6;
  --muted: #8d93ab;
  --line: #2a3045;
  --brass: #d3a44a;
  --brass-deep: #e0b45e;
  --brass-soft: #3a3320;
  --ok: #5fbf9a;
  --ok-soft: #1d3a30;
  --warn: #e0a05f;
  --warn-soft: #3d2e1c;
  --bad: #e07a72;
  --bad-soft: #3f2422;
  --info: #9db1e8;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 28px rgba(0, 0, 0, 0.35);

  --bs-body-bg: var(--paper);
  --bs-body-color: var(--text);
  --bs-heading-color: var(--ink);
  --bs-emphasis-color: var(--ink);
  --bs-border-color: var(--line);
  --bs-secondary-color: var(--muted);
  /* Bootstrap's own dark values for these are cool greys; pin them to the
     palette so `data-bs-theme="dark"` doesn't drag stock surfaces off-system.
     .theme-dark and [data-bs-theme=dark] tie on specificity and this file
     loads last, so these win. */
  --bs-secondary-bg: var(--card);
  --bs-tertiary-bg: #161a28;
  /* The -rgb pairs are literals, so they don't follow the tokens — restate them
     with the dark values or links and .text-* utilities keep the light ones. */
  --bs-link-color-rgb: 224, 180, 94;
  --bs-link-hover-color-rgb: 211, 164, 74;
  --bs-primary-rgb: 211, 164, 74;
  --bs-success-rgb: 95, 191, 154;
  --bs-warning-rgb: 224, 160, 95;
  --bs-danger-rgb: 224, 122, 114;
  color-scheme: dark;
}
.theme-dark body {
  background: var(--paper);
  color: var(--text);
}
.theme-dark .card-header {
  background: #161a28;
}
.theme-dark .table > thead th {
  background: #161a28;
}
.theme-dark .table {
  --bs-table-hover-bg: #20263a;
}
.theme-dark .btn-ghost {
  --bs-btn-bg: var(--card);
  --bs-btn-color: var(--text);
}
.theme-dark .btn-primary,
.theme-dark .btn-outline-primary:hover {
  --bs-btn-color: #1a1405;
}
/* In dark, --brass-deep is the *lighter* brass, so the light-mode hover (a
   darker fill under white text) would swallow the now-dark label. */
.theme-dark .btn-primary {
  --bs-btn-hover-bg: var(--brass);
  --bs-btn-hover-border-color: var(--brass);
  --bs-btn-hover-color: #1a1405;
  --bs-btn-active-bg: var(--brass);
  --bs-btn-active-border-color: var(--brass);
  --bs-btn-active-color: #1a1405;
}
/* --ok/--bad/--ink all lighten in dark, so the white label these buttons carry
   in light mode stops working — worst case .btn-giro (bg = --ink = #eceef8)
   went white-on-white at 1.16:1. Flip the label dark and keep the hover states
   light too, or the text disappears again on hover. */
.theme-dark .btn-in {
  --bs-btn-color: #1a1405;
  --bs-btn-hover-bg: #4fb18c;
  --bs-btn-hover-border-color: #4fb18c;
  --bs-btn-hover-color: #1a1405;
  --bs-btn-active-bg: #4fb18c;
  --bs-btn-active-border-color: #4fb18c;
  --bs-btn-active-color: #1a1405;
}
.theme-dark .btn-out {
  --bs-btn-color: #1a1405;
  --bs-btn-hover-bg: #d3665e;
  --bs-btn-hover-border-color: #d3665e;
  --bs-btn-hover-color: #1a1405;
  --bs-btn-active-bg: #d3665e;
  --bs-btn-active-border-color: #d3665e;
  --bs-btn-active-color: #1a1405;
}
.theme-dark .btn-giro {
  --bs-btn-color: #1a1405;
  --bs-btn-hover-bg: #d8dbea;
  --bs-btn-hover-border-color: #d8dbea;
  --bs-btn-hover-color: #1a1405;
  --bs-btn-active-bg: #d8dbea;
  --bs-btn-active-border-color: #d8dbea;
  --bs-btn-active-color: #1a1405;
}
.theme-dark #sidebar,
.theme-dark .navbar-dark {
  background-color: #141829 !important;
}
.theme-dark #sidebar .list-group-item.active {
  color: #1a1405;
}
.theme-dark #sidebar .brand-mark {
  color: #1a1405;
}
.theme-dark .tag-sm,
.theme-dark .pill-neutral,
.theme-dark .code {
  background: #252b42;
  color: #b9bed6;
}
.theme-dark .av-1 {
  background: #28324f;
  color: #9db1e8;
}
.theme-dark .av-2 {
  background: #3a3320;
  color: #e0b45e;
}
.theme-dark .av-3 {
  background: #1d3a30;
  color: #5fbf9a;
}
.theme-dark .av-4 {
  background: #3f2422;
  color: #e07a72;
}
.theme-dark .form-control,
.theme-dark .form-select {
  background-color: #161a28;
  color: var(--text);
  border-color: var(--line);
}
.theme-dark .stat3 .st {
  background: #161a28;
}
.theme-dark .rate .bar-mini {
  background: #252b42;
}
.theme-dark .trend-flat {
  background: #252b42;
  color: var(--muted);
}
