/* Bonasea administrative design kit 1.0 (17. 10. 2026, css/bonasea-admin.css of Martin's kit, from the identity of
   www.bonasea.com at 298dfad): the tokens and the base components every Bonasea administration shares. 4.6.2 (Martin
   17. 10.): the console's base, loaded before static/admin.css, which builds the console's own screens on these
   variables and declares no colour, radius or font of its own - this file is the one source of the tokens.

   Taken as the kit has it, except:
   - no @font-face here. The console's Instrument Sans is /static/vendor/instrument-sans-5.3.0/instrument-sans.css, the
     app's: the kit's two Instrument Sans files render the same glyphs at the same advances in every weight 400-700
     (compared in Chrome, Latin and Latin Extended, 17. 10.), so the server keeps one copy and one licence notice.
     Sora is not needed - the wordmark is the kit's logo on curves (bonasea-logo-ink.svg, -compact.svg beside this
     file) - nor Instrument Serif, as the console sets no serif accent; the kit's rules for both are left out, the
     tokens that name them (--font-serif, --font-wordmark) stay, so a later screen that wants them adds the faces.
   - `img, svg { height: auto }` is for images only: the console's charts are inline SVG sized by their own classes
     and attributes (a sparkline's height attribute), which a height: auto on every svg would override.
   - the kit's preview-only rules (swatches, logo samples) and the live wordmark (.bonasea-wordmark, Sora) are out.
   Everything else - the palette, sizes, focus ring, components - is the kit's, value for value. */

:root {
  --sand: #f7f3ea;
  --sand-warm: #fdf6e6;
  --sand-deep: #f4eedf;
  --surface: #ffffff;
  --surface-quiet: #f2f6f7;
  --chip: #edf2f4;
  --ink: #08303f;
  --ink-body: #0c3a4e;
  --ink-muted: #3d6273;
  --ink-faint: #4f6b78;
  --water-pale: #d9e7ec;
  --water-soft: #a9cfdc;
  --water-sky: #bedde8;
  --water-bright: #5fa9c4;
  --water-vivid: #1c7e9c;
  --water-mid: #15586f;
  --water-deep: #124e64;
  --gold: #efa436;
  --gold-light: #f8ce7b;
  --gold-pale: #f4d399;
  --gold-cream: #fdf0d6;
  --gold-sand: #f8d389;
  --gold-ink: #5a3a05;
  --gold-ink-strong: #3d2703;
  --gold-label: #7a5205;
  --comfort-red: #b71824;
  --comfort-gold: #e09a2c;
  --comfort-green: #6abb7b;
  --hairline: rgba(12, 58, 78, 0.1);
  --hairline-strong: rgba(12, 58, 78, 0.2);
  --shadow-card: 0 8px 26px rgba(9, 52, 70, 0.07);
  --shadow-float: 0 24px 60px rgba(9, 52, 70, 0.16), 0 2px 6px rgba(9, 52, 70, 0.06);
  --r-sm: 14px;
  --r-md: 20px;
  --r-lg: 26px;
  --r-pill: 999px;
  --t-fast: 0.15s ease;
  --t-base: 0.18s ease;
  --t-slow: 0.22s ease;
  --font-sans: 'Instrument Sans';
  --font-serif: 'Instrument Serif';
  --font-wordmark: 'Sora';
  --accent-scale: 1;
  /* Admin dimensions: recommended defaults, not marketing hero sizes. */
  --admin-max: 1440px;
  --admin-sidebar: 240px;
  --admin-pad: clamp(16px, 2.5vw, 32px);
  --admin-header: 64px;
  color-scheme: light;
}

/* Base and accessible defaults. No hidden page overflow masking layout bugs. */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 88px; }
body {
  margin: 0; background: var(--sand); color: var(--ink-body);
  font: 400 1rem/1.6 var(--font-sans), system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, p, figure { margin: 0; }
p, li, dd { text-wrap: pretty; }
h1, h2, h3 { color: var(--ink); font-weight: 600; text-wrap: balance; }
h1 { font-size: clamp(1.5rem, 2.3vw, 2rem); line-height: 1.15; letter-spacing: -0.035em; }
h2 { font-size: 1.25rem; line-height: 1.3; letter-spacing: -0.025em; }
h3 { font-size: 1.0625rem; line-height: 1.35; letter-spacing: -0.02em; }
a { color: var(--ink-body); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
/* Solid water-mid is an admin accessibility adaptation of the website ring. */
:focus-visible { outline: 3px solid var(--water-mid); outline-offset: 3px; }
.muted { color: var(--ink-muted); }
.small { font-size: 0.875rem; line-height: 1.5; }
.num { font-variant-numeric: tabular-nums; }
.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.stack--sm { gap: 8px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.row--between { justify-content: space-between; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; inset-inline-start: 16px; top: -100px; z-index: 100;
  padding: 12px 20px; background: var(--ink-body); color: var(--sand);
  border-radius: var(--r-pill);
}
.skip-link:focus { top: 12px; }

/* Brand. The original icon stays unchanged; its container supplies the mask. */
.brand { --brand-mark: 34px; display: inline-flex; gap: calc(var(--brand-mark) / 2); align-items: center; min-height: 44px; flex: none; text-decoration: none; }
.brand__mark { flex: none; width: var(--brand-mark); height: var(--brand-mark); border-radius: calc(var(--brand-mark) * 9 / 34); overflow: hidden; }
.brand__mark img { width: 100%; height: 100%; }
.on-dark { background: var(--water-mid); color: var(--surface); }
.on-dark :focus-visible { outline-color: var(--sand); }

/* Administrative shell: solid surfaces, small header, space for dense content. */
.admin-header {
  position: sticky; top: 0; z-index: 30; display: flex; flex-wrap: wrap;
  align-items: center; justify-content: space-between; gap: 12px;
  min-height: var(--admin-header); padding: 10px var(--admin-pad);
  background: var(--sand); border-bottom: 1px solid var(--hairline);
}
.admin-shell { display: grid; grid-template-columns: minmax(0, 1fr); min-width: 0; }
.admin-sidebar { padding: 16px; border-bottom: 1px solid var(--hairline); }
.admin-nav { display: flex; gap: 8px; overflow-x: auto; }
.admin-nav a {
  display: flex; align-items: center; flex: none; gap: 8px;
  min-height: 44px; padding: 10px 14px; border-radius: var(--r-sm);
  color: var(--ink-muted); text-decoration: none; font-size: 0.9rem;
}
.admin-nav a:hover { background: var(--surface-quiet); color: var(--ink); }
.admin-nav a[aria-current='page'] { background: var(--water-pale); color: var(--ink); font-weight: 600; }
.admin-main { min-width: 0; width: 100%; max-width: var(--admin-max); padding: var(--admin-pad); }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 16px; }
.page-head p { max-width: 72ch; color: var(--ink-muted); }
.breadcrumbs { font-size: 0.8125rem; color: var(--ink-muted); }
@media (min-width: 1024px) {
  .admin-shell { grid-template-columns: var(--admin-sidebar) minmax(0, 1fr); }
  .admin-sidebar { border-bottom: 0; border-inline-end: 1px solid var(--hairline); }
  .admin-nav { flex-direction: column; overflow-x: visible; }
}

/* Panels: one surface for a related task, not one card for every sentence. */
.panel { min-width: 0; background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-md); }
.panel__head, .panel__body { padding: 20px 24px; }
.panel__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--hairline); }
.panel__head p { color: var(--ink-muted); font-size: 0.875rem; }
.prose { max-width: 72ch; }
.prose > * + * { margin-top: 16px; }
.prose ul { padding-inline-start: 1.5em; }
.prose li + li { margin-top: 8px; }

/* Controls. All actual interactive targets retain at least 44px height. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 12px 20px; border-radius: var(--r-pill);
  font-size: 0.9375rem; line-height: 1.2; font-weight: 600;
  border: 1.5px solid transparent; cursor: pointer; text-decoration: none;
  transition: background var(--t-base), border-color var(--t-base);
}
.btn-primary { background: var(--ink-body); color: var(--sand); }
.btn-primary:hover { background: var(--ink); color: var(--sand); }
.btn-secondary { background: var(--surface); color: var(--ink-body); border-color: var(--ink-muted); }
.btn-secondary:hover { border-color: var(--ink-body); }
.btn-danger { background: var(--comfort-red); color: var(--surface); }
.btn:disabled { cursor: default; background: var(--chip); color: var(--ink-muted); border-color: var(--hairline); }
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field > label, .field > span:first-child { color: var(--ink-body); font-size: 0.8125rem; font-weight: 600; }
.field input, .field select, .field textarea {
  width: 100%; min-width: 0; min-height: 48px; padding: 12px 16px;
  border: 1px solid var(--ink-faint); border-radius: var(--r-sm);
  background: var(--surface-quiet); color: var(--ink-body); font-size: 0.9375rem;
}
.field input::placeholder, .field textarea::placeholder { color: var(--ink-muted); opacity: 1; }
.field textarea { min-height: 160px; line-height: 1.6; resize: vertical; }
.field [aria-invalid='true'] { border: 2px solid var(--comfort-red); }
.field__hint { color: var(--ink-muted); font-size: 0.8125rem; }
.field__error { color: var(--comfort-red); font-size: 0.8125rem; }
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
.form-grid__wide { grid-column: 1 / -1; }
@media (min-width: 720px) { .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; padding: 16px 24px; }
.toolbar .field { flex: 1 1 180px; }
.toolbar .field:first-child { flex-grow: 2; }

/* Tables: horizontal scroll stays inside a keyboard-focusable named wrapper. */
.table-wrap { max-width: 100%; overflow: auto; }
.table-wrap.is-scrollable { max-height: 70vh; }
.data-table { border-collapse: collapse; width: 100%; font-size: 0.875rem; line-height: 1.45; }
.data-table th, .data-table td { padding: 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--hairline); }
.data-table th { background: var(--surface-quiet); color: var(--ink); font-weight: 600; }
.table-wrap.is-scrollable th { position: sticky; top: 0; z-index: 1; }
.data-table td { color: var(--ink-body); overflow-wrap: anywhere; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: var(--surface-quiet); }
.data-table tr[aria-selected='true'] { background: var(--water-pale); }
.data-table .num { text-align: right; white-space: nowrap; }
.data-table .cell-title { min-width: 160px; max-width: 52ch; }
.data-table .cell-action { min-width: 100px; }
.data-table .cell-action a { display: inline-flex; align-items: center; min-height: 44px; }
.pagination { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; padding: 16px 24px; align-items: center; }
.pagination p { color: var(--ink-muted); font-size: 0.875rem; }

/* Status always includes a label; these business states are not comfort scores. */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: var(--r-pill); background: var(--chip); color: var(--ink-muted); font-size: 0.8125rem; font-weight: 600; white-space: nowrap; }
.badge--info { background: var(--water-pale); color: var(--ink-body); }
.badge--warning { background: var(--gold-cream); color: var(--gold-ink); }
.badge--success { background: var(--comfort-green); color: var(--ink); }
.badge--error { background: var(--comfort-red); color: var(--surface); }
.notice { padding: 16px 20px; border-radius: var(--r-sm); background: var(--water-pale); color: var(--ink-body); font-size: 0.9375rem; }
.notice strong { display: block; margin-bottom: 4px; font-weight: 600; }
.notice--warning, .notice--success { background: var(--gold-cream); color: var(--gold-ink); }
.notice--error { background: var(--surface); border: 1.5px solid var(--comfort-red); }
.notice--error strong { color: var(--comfort-red); }

@media (max-width: 480px) {
  .panel__head, .panel__body, .toolbar, .pagination { padding: 16px; }
  .admin-header .environment { max-width: 140px; text-align: right; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
