/* Nodge Farm: shell, shared components and page classes.
   Every colour comes from variables.css (one light palette, no dark mode);
   spacing is in multiples of 4px.
   Two modes: .mode-app (evening administration, 16px base) and .mode-kiosk
   (stal PC and phone: 19px base, touch targets of at least 56px). */

/* ── Base ─────────────────────────────────────────────────────────────── */

:root {
  --sidebar-w: 248px;
  /* Rail: 12px sidebar padding + 12px link padding + a 20px icon + 12px +
     12px, so the nav icons stay where they are when the sidebar folds. */
  --sidebar-rail-w: 68px;
  --bar-h: 64px;
  --page-max: 1240px;
}

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

[hidden] {
  display: none !important;
}

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

html.mode-kiosk {
  font-size: 19px;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-ui);
  font-size: 1rem;
  line-height: 1.5;
}

body.modal-open {
  overflow: hidden;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  line-height: 1.25;
  font-weight: 650;
  letter-spacing: -0.01em;
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.0625rem; }
h4 { font-size: 1rem; }

p {
  margin: 0;
}

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

a:hover {
  text-decoration: underline;
}

strong {
  font-weight: 650;
}

code,
kbd,
pre {
  font-family: var(--font-code);
  font-size: 0.9em;
}

hr {
  border: 0;
  border-top: 1px solid var(--color-border);
  margin: 16px 0;
}

img,
svg {
  vertical-align: middle;
}

::selection {
  background: var(--color-primary-20);
}

:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

main:focus,
main:focus-visible {
  outline: none;
}

.icon {
  flex-shrink: 0;
}

.noscript {
  max-width: 560px;
  margin: 48px auto;
  padding: 24px;
  background: var(--color-surface);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius);
}

.noscript h1 {
  margin-bottom: 8px;
}

/* ── Utilities ────────────────────────────────────────────────────────── */

.muted { color: var(--color-text-muted); }
.small { font-size: 0.875rem; }
.mono { font-family: var(--font-code); }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.spacer { flex: 1; }

.num {
  font-family: var(--font-code);
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 8px;
  top: -64px;
  z-index: 200;
  padding: 8px 16px;
  background: var(--color-primary);
  color: var(--color-on-primary);
  border-radius: var(--radius-sm);
}

.skip-link:focus {
  top: 8px;
}

/* ── Layout helpers ───────────────────────────────────────────────────── */

.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.stack > * {
  min-width: 0;
}

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

.grid-2,
.grid-3 {
  display: grid;
  gap: 20px;
}

.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.grid-2 > *,
.grid-3 > * {
  min-width: 0;
}

@media (max-width: 1023.98px) {
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 759.98px) {
  .grid-2,
  .grid-3 {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }
}

.page {
  max-width: var(--page-max);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

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

.page-head h1 {
  font-size: 1.75rem;
}

.page-head p {
  color: var(--color-text-muted);
  margin-top: 4px;
}

.page-head > .row,
.page-head > .actions {
  margin-left: auto;
}

/* ── App shell (evening administration) ───────────────────────────────── */

.shell-app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 20px 12px 16px;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
}

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

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  background: var(--color-accent);
  color: var(--color-on-primary);
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.3;
}

.brand-name {
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-sub {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.sidebar-brand {
  padding: 0 8px;
}

.sidebar-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

.nav-link > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-link:hover {
  background: var(--color-hover);
  color: var(--color-text);
  text-decoration: none;
}

/* The page you are on: light blue tint, blue text and a blue bar on the
   left edge, so the active item reads at a glance without colour alone. */
.nav-link.is-active {
  background: var(--color-primary-20);
  color: var(--color-primary);
  font-weight: 600;
  box-shadow: inset 4px 0 0 var(--color-primary);
}

.nav-link.is-active .icon {
  color: var(--color-primary);
}

.sidebar-foot {
  margin-top: auto;
}

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

.app-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--bar-h);
  padding: 0 24px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}

.app-bar .search {
  flex: 1;
  max-width: 560px;
}

.app-bar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.main {
  flex: 1;
  padding: 24px;
}

/* The menu button shows at every width: on a phone it slides the menu in,
   on a wider screen it folds the sidebar to an icon rail (.is-collapsed).
   It is an .icon-btn, which already sets display. */

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 35;
  background: var(--color-overlay);
  animation: fade-in 0.2s ease-out;
}

/* ── Sidebar as an icon rail (wider screens) ───────────────────────────
   .shell-app.is-collapsed narrows the first grid column to the rail width.
   Labels and the brand text are hidden visually but stay in the DOM, so a
   screen reader still reads every link. The backdrop belongs to the phone
   drawer and never shows here. */

@media (min-width: 760px) {
  .sidebar-backdrop {
    display: none !important;
  }

  .shell-app {
    transition: grid-template-columns 0.2s ease;
  }

  .shell-app.is-collapsed {
    --sidebar-w: var(--sidebar-rail-w);
  }

  .shell-app.is-collapsed .sidebar {
    scrollbar-width: thin;
  }

  .shell-app.is-collapsed .sidebar-brand {
    justify-content: center;
    padding: 0;
  }

  .shell-app.is-collapsed .brand-text,
  .shell-app.is-collapsed .nav-link > span {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .shell-app.is-collapsed .nav-link {
    justify-content: center;
    gap: 0;
    padding: 8px 0;
  }

  /* The stal link holds a bare text node next to its icon: font-size 0
     hides the words, the icon keeps its own size. */
  .shell-app.is-collapsed .sidebar-foot .btn {
    gap: 0;
    padding: 8px 0;
    font-size: 0;
  }
}

@media (max-width: 759.98px) {
  .shell-app {
    grid-template-columns: minmax(0, 1fr);
  }

  /* The drawer sits above the backdrop (35) and the sticky app bar (20). */
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    width: min(300px, 86vw);
    height: 100vh;
    height: 100dvh;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: none;
  }

  .shell-app.is-menu-open .sidebar {
    transform: translateX(0);
    box-shadow: var(--shadow);
  }

  .app-bar {
    padding: 0 12px;
    gap: 8px;
  }

  .app-bar .net-label {
    display: none;
  }

  .main {
    padding: 16px;
  }
}

/* ── Kiosk shell (stal) ───────────────────────────────────────────────── */

.kiosk-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}

.kiosk-bar-inner {
  max-width: 1320px;
  margin: 0 auto;
  padding: 12px 24px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px 24px;
}

.kiosk-bar .brand-mark {
  width: 48px;
  height: 48px;
}

.kiosk-bar .brand-name {
  font-size: 1.05rem;
}

.kiosk-bar .brand-sub {
  font-size: 0.85rem;
}

.kiosk-clock {
  font-family: var(--font-code);
  font-variant-numeric: tabular-nums;
  color: var(--color-text);
}

.kiosk-bar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.kiosk-main {
  max-width: 1320px;
  margin: 0 auto;
  width: 100%;
  padding: 24px;
}

@media (max-width: 959.98px) {
  .kiosk-bar-inner {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .kiosk-bar .search {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

@media (max-width: 599.98px) {
  .kiosk-bar-inner {
    padding: 8px 16px 12px;
    gap: 8px 12px;
  }

  .kiosk-admin-label,
  .kiosk-bar .net-label {
    display: none;
  }

  .kiosk-admin {
    padding-left: 16px;
    padding-right: 16px;
  }

  .kiosk-main {
    padding: 16px;
  }
}

/* ── Header search and suggestions ────────────────────────────────────── */

.search {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
  width: 100%;
}

.search-icon {
  position: absolute;
  left: 12px;
  display: flex;
  color: var(--color-text-muted);
  pointer-events: none;
}

.search .search-input {
  width: 100%;
  padding-left: 40px;
}

.search-input::-webkit-search-cancel-button {
  cursor: pointer;
}

.mode-kiosk .search .search-input {
  min-height: 56px;
  padding-left: 48px;
  font-size: 1rem;
}

.mode-kiosk .search-icon {
  left: 16px;
}

.suggest {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 60;
  max-height: min(70vh, 560px);
  overflow-y: auto;
  padding: 4px;
  background: var(--color-surface);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.suggest-group {
  padding: 8px 12px 4px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.suggest-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--color-text);
  text-decoration: none;
}

.suggest-item:hover {
  text-decoration: none;
}

.suggest-item.is-active {
  background: var(--color-primary-20);
}

.suggest-item.is-sub {
  min-height: 40px;
  padding-left: 52px;
}

.suggest-icon {
  display: flex;
  color: var(--color-text-muted);
}

.suggest-item.is-answer .suggest-icon {
  color: var(--color-primary);
}

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

.suggest-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.suggest-item.is-answer .suggest-title {
  font-weight: 600;
}

.suggest-sub {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.suggest-aside {
  flex-shrink: 0;
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

.suggest-item.is-answer .suggest-aside {
  font-family: var(--font-code);
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-text);
}

.suggest-empty {
  padding: 12px;
  color: var(--color-text-muted);
}

.suggest-all {
  margin-top: 4px;
  border-top: 1px solid var(--color-border);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  color: var(--color-text-muted);
}

.mode-kiosk .suggest-item {
  min-height: 56px;
}

/* ── Online / offline indicator ───────────────────────────────────────── */

.net-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 4px 12px;
  border: 1px solid var(--color-border-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--color-text-muted);
  font: inherit;
  font-size: 0.8125rem;
  white-space: nowrap;
  cursor: default;
}

.net-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-success);
}

.net-icon {
  display: none;
  color: var(--color-warning);
}

.net-indicator.has-queue {
  color: var(--color-text);
  cursor: pointer;
}

.net-indicator.has-queue .net-dot {
  background: var(--color-info);
}

.net-indicator.is-offline {
  border-color: var(--color-warning);
  background: var(--color-warning-20);
  color: var(--color-text);
  cursor: default;
}

.net-indicator.is-offline .net-dot {
  display: none;
}

.net-indicator.is-offline .net-icon {
  display: flex;
}

.mode-kiosk .net-indicator {
  min-height: 56px;
  padding: 8px 16px;
  font-size: 0.8125rem;
}

/* ── Buttons ──────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 16px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  background: var(--color-surface-2);
  color: var(--color-text);
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn:hover {
  background: var(--color-hover);
  text-decoration: none;
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-on-primary);
}

.btn-primary:hover:not(:disabled) {
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
}

.btn-secondary {
  background: transparent;
}

.btn-secondary:hover:not(:disabled) {
  background: var(--color-hover);
  border-color: var(--color-text-muted);
}

.btn-danger {
  background: var(--color-danger);
  border-color: var(--color-danger);
  color: var(--color-on-primary);
}

.btn-danger:hover:not(:disabled) {
  background: var(--color-danger-hover);
  border-color: var(--color-danger-hover);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--color-text-muted);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--color-hover);
  color: var(--color-text);
}

.btn-xl {
  min-height: 64px;
  padding: 16px 24px;
  font-size: 1.125rem;
  border-radius: var(--radius);
}

.btn-sm {
  min-height: 32px;
  padding: 4px 12px;
  font-size: 0.875rem;
}

.btn-block {
  width: 100%;
}

.btn.is-busy::after {
  content: '';
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
}

.icon-btn:hover {
  background: var(--color-hover);
  color: var(--color-text);
}

.copy-btn {
  width: 32px;
  height: 32px;
}

.copy-btn.is-copied {
  color: var(--color-success);
}

.mode-kiosk .btn {
  min-height: 56px;
  padding: 12px 20px;
}

.mode-kiosk .btn-xl {
  min-height: 64px;
  padding: 16px 28px;
}

.mode-kiosk .icon-btn {
  width: 56px;
  height: 56px;
}

/* Big tiles on the stal screen: icon above label. */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 12px;
}

.tile-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 128px;
  padding: 20px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  box-shadow: var(--shadow);
  color: var(--color-text);
  font: inherit;
  font-size: 1.0625rem;
  font-weight: 650;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.tile-btn .icon {
  width: 44px;
  height: 44px;
  color: var(--color-primary);
}

.tile-btn:hover,
.tile-btn:focus-visible {
  border-color: var(--color-primary);
  background: var(--color-primary-20);
  color: var(--color-primary);
  text-decoration: none;
}

.tile-btn:focus-visible {
  outline-offset: 2px;
}

.tile-btn:active {
  transform: scale(0.98);
}

.tile-btn .tile-sub {
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--color-text-muted);
}

/* ── Cards ────────────────────────────────────────────────────────────── */

.card {
  min-width: 0;
  padding: 20px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* A card inside a card is a section, not a second layer: no shadow. */
.card .card {
  box-shadow: none;
}

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

.card-titles {
  min-width: 0;
}

.card-title,
.card-head h2,
.card-head h3 {
  font-size: 1.0625rem;
  font-weight: 650;
}

.card-subtitle {
  margin-top: 4px;
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

.card-body {
  min-width: 0;
}

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

/* ── Badges, chips, notices ───────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 650;
  line-height: 20px;
  white-space: nowrap;
  vertical-align: middle;
}

.badge-ok { background: var(--color-success-20); color: var(--color-success); }
.badge-warning { background: var(--color-warning-20); color: var(--color-warning); }
.badge-danger { background: var(--color-danger-20); color: var(--color-danger); }
.badge-info { background: var(--color-info-20); color: var(--color-info); }
.badge-muted { background: var(--color-muted-20); color: var(--color-text-muted); }

.mode-kiosk .badge {
  padding: 4px 12px;
  font-size: 0.8rem;
  line-height: 1.25;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 4px 12px;
  border: 1px solid var(--color-border-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--color-text);
  font: inherit;
  font-size: 0.875rem;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.chip:hover {
  background: var(--color-hover);
  text-decoration: none;
}

.chip.is-active,
.chip.is-selected,
.chip[aria-pressed="true"] {
  border-color: var(--color-primary);
  background: var(--color-primary-20);
}

.chip .count {
  font-family: var(--font-code);
  color: var(--color-text-muted);
}

.mode-kiosk .chip {
  min-height: 56px;
  padding: 8px 20px;
}

.notice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid var(--color-border-strong);
  border-left-width: 4px;
  border-radius: var(--radius-sm);
  background: var(--color-surface-2);
  color: var(--color-text);
}

.notice-info { border-color: var(--color-info); background: var(--color-info-20); }
.notice-info > .icon { color: var(--color-info); }
.notice-warning { border-color: var(--color-warning); background: var(--color-warning-20); }
.notice-warning > .icon { color: var(--color-warning); }
.notice-danger { border-color: var(--color-danger); background: var(--color-danger-20); }
.notice-danger > .icon { color: var(--color-danger); }
.notice-success { border-color: var(--color-success); background: var(--color-success-20); }
.notice-success > .icon { color: var(--color-success); }

/* ── Tables ───────────────────────────────────────────────────────────── */

.table-wrap {
  overflow-x: auto;
  min-width: 0;
}

.table-wrap.table-scroll {
  max-height: 640px;
  overflow-y: auto;
}

.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.9375rem;
}

.table th,
.table td {
  padding: 12px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--color-border);
}

.table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding-top: 8px;
  padding-bottom: 8px;
  background: var(--color-surface);
  border-bottom-color: var(--color-border-strong);
  color: var(--color-text-muted);
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
}

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

.table tbody tr:hover td {
  background: var(--color-hover);
}

.table tr.is-clickable {
  cursor: pointer;
}

.table tr.is-clickable:focus-visible {
  outline-offset: -2px;
}

.table th.num,
.table td.num {
  text-align: right;
}

.table th.center,
.table td.center {
  text-align: center;
}

.table td.num {
  font-family: var(--font-code);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.table td .btn {
  min-height: 32px;
  padding: 4px 12px;
  font-size: 0.875rem;
}

.table tr.table-empty td,
.table tr.table-empty:hover td {
  padding: 24px 12px;
  text-align: center;
  color: var(--color-text-muted);
  background: transparent;
}

.sort-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.sort-btn:hover {
  color: var(--color-text);
}

.sort-indicator {
  display: inline-flex;
  opacity: 0;
}

th.is-sortable:hover .sort-indicator,
th.is-sorted .sort-indicator {
  opacity: 1;
}

th.is-sorted {
  color: var(--color-text);
}

th.num .sort-btn {
  flex-direction: row-reverse;
}

.table tr.highlight-row > td {
  background: var(--color-primary-20);
  font-weight: 650;
}

.table tr.highlight-row > td:first-child {
  box-shadow: inset 4px 0 0 var(--color-primary);
}

.mode-kiosk .table td,
.mode-kiosk .table th {
  padding: 16px 12px;
}

/* ── Forms ────────────────────────────────────────────────────────────── */

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.field-label,
.field > label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text);
}

.field-hint {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

.field-error {
  font-size: 0.8125rem;
  color: var(--color-danger);
}

.field-error:empty {
  display: none;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px 20px;
}

.form-grid .field-wide,
.form-grid .span-all {
  grid-column: 1 / -1;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.input,
input:not([type]),
input[type="text"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
input[type="month"],
input[type="search"],
input[type="email"],
input[type="tel"],
input[type="url"],
input[type="password"],
select,
textarea {
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
  line-height: 1.4;
}

textarea {
  min-height: 96px;
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: var(--color-text-muted);
  opacity: 1;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 0;
  border-color: var(--color-primary);
}

input:disabled,
select:disabled,
textarea:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

[aria-invalid="true"] {
  border-color: var(--color-danger) !important;
}

input.num,
input[type="number"] {
  font-family: var(--font-code);
  font-variant-numeric: tabular-nums;
}

input.num {
  text-align: right;
}

input[type="checkbox"],
input[type="radio"] {
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--color-primary);
  cursor: pointer;
}

input[type="file"] {
  max-width: 100%;
  color: var(--color-text-muted);
  font: inherit;
}

input[type="file"]::file-selector-button {
  margin-right: 12px;
  padding: 8px 16px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  background: var(--color-surface-2);
  color: var(--color-text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.mode-kiosk .input,
.mode-kiosk input:not([type]),
.mode-kiosk input[type="text"],
.mode-kiosk input[type="number"],
.mode-kiosk input[type="date"],
.mode-kiosk input[type="time"],
.mode-kiosk input[type="search"],
.mode-kiosk input[type="email"],
.mode-kiosk input[type="tel"],
.mode-kiosk select,
.mode-kiosk textarea {
  min-height: 56px;
  padding: 12px 16px;
}

.mode-kiosk input[type="checkbox"],
.mode-kiosk input[type="radio"] {
  width: 28px;
  height: 28px;
}

.mode-kiosk .check {
  min-height: 56px;
  gap: 12px;
}

/* ── Wizard (registrations) ───────────────────────────────────────────── */

.wizard {
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.wizard-steps {
  display: flex;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: wizard-step;
}

.wizard-steps > * {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 12px;
  border-top: 4px solid var(--color-border-strong);
  color: var(--color-text-muted);
  font-size: 0.875rem;
  counter-increment: wizard-step;
}

.wizard-steps > *::before {
  content: counter(wizard-step);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border: 1px solid var(--color-border-strong);
  border-radius: 50%;
  font-family: var(--font-code);
  font-size: 0.8125rem;
}

.wizard-steps > .is-done {
  border-top-color: var(--color-primary);
  color: var(--color-text);
}

.wizard-steps > .is-done::before {
  content: '✓';
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.wizard-steps > .is-active,
.wizard-steps > [aria-current="step"] {
  border-top-color: var(--color-primary);
  color: var(--color-text);
  font-weight: 650;
}

.wizard-steps > .is-active::before,
.wizard-steps > [aria-current="step"]::before {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-on-primary);
}

@media (max-width: 599.98px) {
  .wizard-steps > * {
    font-size: 0;
    gap: 0;
  }

  .wizard-steps > .is-active,
  .wizard-steps > [aria-current="step"] {
    font-size: 0.8125rem;
    gap: 8px;
  }

  .wizard-steps > *::before {
    font-size: 0.8125rem;
  }
}

.wizard-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.choice {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 4px;
  min-height: 88px;
  padding: 16px 48px 16px 20px;
  border: 2px solid var(--color-border-strong);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
  font-size: 1.0625rem;
  font-weight: 650;
  line-height: 1.3;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.choice:hover {
  border-color: var(--color-primary);
  text-decoration: none;
}

.choice .icon {
  color: var(--color-primary);
}

.choice small,
.choice .muted,
.choice .choice-sub {
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--color-text-muted);
}

.choice.is-selected {
  border-color: var(--color-primary);
  background: var(--color-primary-20);
}

.choice.is-selected::before {
  content: '';
  position: absolute;
  top: 12px;
  right: 12px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--color-primary);
}

.choice.is-selected::after {
  content: '';
  position: absolute;
  top: 16px;
  right: 21px;
  width: 6px;
  height: 12px;
  border: solid var(--color-on-primary);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.choice:disabled,
.choice[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
}

.card .choice {
  background: var(--color-surface);
}

.card .choice.is-selected {
  background: var(--color-primary-20);
}

.mode-kiosk .choice {
  min-height: 104px;
  font-size: 1.1rem;
}

/* ── KPI and meter ────────────────────────────────────────────────────── */

.kpi {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  padding: 16px 20px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
  text-decoration: none;
}

.card .kpi {
  background: var(--color-surface-2);
  border-color: var(--color-border);
}

.kpi-icon {
  display: flex;
  color: var(--color-primary);
  margin-bottom: 4px;
}

.kpi-label {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

.kpi-value {
  font-family: var(--font-code);
  font-size: 1.75rem;
  font-weight: 650;
  line-height: 1.2;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

.kpi-sub {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

a.kpi:hover {
  border-color: var(--color-border-strong);
  text-decoration: none;
}

.meter {
  --meter-fill: var(--color-success);
  --meter-track: var(--color-success-20);
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  padding: 16px 20px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
  text-decoration: none;
}

.card .meter {
  background: var(--color-surface-2);
  border-color: var(--color-border);
}

.meter-warning {
  --meter-fill: var(--color-warning);
  --meter-track: var(--color-warning-20);
}

.meter-over {
  --meter-fill: var(--color-danger);
  --meter-track: var(--color-danger-20);
}

a.meter:hover {
  border-color: var(--color-border-strong);
  text-decoration: none;
}

.meter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.meter-label {
  font-weight: 650;
}

.meter-figures {
  font-family: var(--font-code);
  font-variant-numeric: tabular-nums;
}

.meter-value {
  font-size: 1.5rem;
  font-weight: 650;
}

.meter-limit {
  color: var(--color-text-muted);
}

.meter-track {
  position: relative;
  height: 12px;
  margin: 4px 0;
  border-radius: 999px;
  background: var(--meter-track);
}

.meter-fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 999px;
  background: var(--meter-fill);
  transition: width 0.4s ease;
}

.meter-mark {
  position: absolute;
  top: -4px;
  bottom: -4px;
  width: 2px;
  margin-left: -1px;
  border-radius: 1px;
  background: var(--color-text);
}

.meter-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 12px;
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.meter-balance {
  font-family: var(--font-code);
  color: var(--color-text);
}

/* ── Charts ───────────────────────────────────────────────────────────── */

.chart {
  display: block;
  width: 100%;
  overflow: visible;
  font-family: var(--font-ui);
  user-select: none;
}

.chart text {
  fill: var(--color-text-muted);
  font-size: 12px;
}

.chart .chart-tick {
  font-family: var(--font-code);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.chart .chart-ylabel {
  fill: var(--color-text-muted);
}

.chart-grid {
  stroke: var(--color-border);
  stroke-width: 1;
  shape-rendering: crispEdges;
}

.chart-axis {
  stroke: var(--color-border-strong);
  stroke-width: 1;
  shape-rendering: crispEdges;
}

.series-chart-1 { --series: var(--color-chart-1); }
.series-chart-2 { --series: var(--color-chart-2); }
.series-chart-3 { --series: var(--color-chart-3); }
.series-chart-4 { --series: var(--color-chart-4); }
.series-primary { --series: var(--color-primary); }
.series-secondary { --series: var(--color-secondary); }
.series-accent { --series: var(--color-accent); }
.series-success { --series: var(--color-success); }
.series-warning { --series: var(--color-warning); }
.series-danger { --series: var(--color-danger); }
.series-info { --series: var(--color-info); }
.series-muted { --series: var(--color-text-muted); }

.chart-line {
  fill: none;
  stroke: var(--series, var(--color-chart-1));
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.chart-area {
  fill: var(--series, var(--color-chart-1));
  opacity: 0.1;
}

.chart-dot {
  fill: var(--series, var(--color-chart-1));
  stroke: var(--color-surface);
  stroke-width: 2;
}

.chart-bar {
  fill: var(--series, var(--color-chart-1));
  transition: opacity 0.15s ease;
}

.chart-bar.is-dim {
  opacity: 0.4;
}

.chart-bar-group:hover .chart-bar {
  opacity: 0.85;
}

.chart .chart-value {
  fill: var(--color-text);
  font-family: var(--font-code);
  font-size: 11px;
}

.chart .chart-value.on-hover {
  visibility: hidden;
}

.chart-bar-group:hover .chart-value.on-hover {
  visibility: visible;
}

.chart-hit {
  fill: transparent;
  touch-action: pan-y;
}

.chart-lines .chart-hit {
  cursor: crosshair;
}

.chart-marker {
  stroke: var(--color-text-muted);
  stroke-width: 1;
  stroke-dasharray: 4 4;
}

.chart .chart-marker-label {
  fill: var(--color-text);
  font-size: 11px;
  paint-order: stroke;
  stroke: var(--color-surface);
  stroke-width: 4px;
  stroke-linejoin: round;
}

.chart-guide {
  stroke: var(--color-text-muted);
  stroke-width: 1;
  pointer-events: none;
}

.chart-hover,
.chart-readout {
  pointer-events: none;
}

.chart-readout rect {
  fill: var(--color-surface-2);
  stroke: var(--color-border-strong);
  stroke-width: 1;
}

.chart .chart-readout text {
  fill: var(--color-text);
  font-family: var(--font-code);
  font-size: 12px;
}

.chart .chart-readout .readout-title {
  font-family: var(--font-ui);
  font-weight: 650;
}

.chart-swatch {
  stroke: var(--series, var(--color-chart-1));
  stroke-width: 3;
  stroke-linecap: round;
}

.chart .chart-legend text {
  fill: var(--color-text);
}

.chart .chart-empty {
  fill: var(--color-text-muted);
  font-size: 14px;
}

/* ── Timeline ─────────────────────────────────────────────────────────── */

.timeline {
  position: relative;
  margin: 0;
  padding: 0;
  list-style: none;
}

.timeline > * {
  position: relative;
  padding: 0 0 20px 32px;
}

.timeline > *::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--color-primary);
  outline: 4px solid var(--color-surface);
}

.timeline > *::after {
  content: '';
  position: absolute;
  left: 9px;
  top: 24px;
  bottom: 0;
  width: 2px;
  background: var(--color-border-strong);
}

.timeline > :last-child {
  padding-bottom: 0;
}

.timeline > :last-child::after {
  display: none;
}

.timeline > .is-ok::before { background: var(--color-success); }
.timeline > .is-warning::before { background: var(--color-warning); }
.timeline > .is-danger::before { background: var(--color-danger); }
.timeline > .is-info::before { background: var(--color-info); }
.timeline > .is-muted::before { background: var(--color-text-muted); }

.timeline-date {
  display: block;
  font-family: var(--font-code);
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

.timeline-title {
  font-weight: 650;
}

.timeline-body {
  margin-top: 4px;
  font-size: 0.9375rem;
  color: var(--color-text-muted);
}

/* ── Tabs ─────────────────────────────────────────────────────────────── */

/* A horizontal tab bar: one row, the active tab underlined in the primary
   blue. On a narrow screen the row scrolls sideways on its own, without a
   visible scrollbar and without widening the page. Markup: .tabs with
   role=tablist, .tab buttons with role=tab (optional icon, .tab-label and a
   .tab-count pill), then one .tab-panel with role=tabpanel per tab. */

.tabs {
  display: flex;
  align-items: stretch;
  gap: 4px;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  border-bottom: 1px solid var(--color-border);
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 12px 16px;
  border: 0;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: none;
  color: var(--color-text-muted);
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.15s ease, background-color 0.15s ease;
}

/* The underline is drawn inside the tab, so the scrolling row never clips
   it and the bottom border of .tabs stays one clean line. */
.tab::after {
  content: '';
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 0;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: transparent;
  transition: background-color 0.15s ease;
}

.tab:hover {
  background: var(--color-hover);
  color: var(--color-text);
  text-decoration: none;
}

.tab:focus-visible {
  outline-offset: -2px;
}

.tab.is-active,
.tab[aria-selected="true"] {
  color: var(--color-primary);
}

.tab.is-active::after,
.tab[aria-selected="true"]::after {
  background: var(--color-primary);
}

.tab .icon {
  flex-shrink: 0;
}

.tab-label {
  min-width: 0;
}

.tab-count-wrap {
  display: inline-flex;
  align-items: center;
}

/* A count next to a tab label: grey by default, coloured by tone. */
.tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--color-muted-20);
  color: var(--color-text-muted);
  font-family: var(--font-code);
  font-size: 0.75rem;
  font-weight: 650;
  line-height: 20px;
  font-variant-numeric: tabular-nums;
}

/* In the active tab a plain count turns blue with it. :where keeps this at
   one class, so a toned count below still keeps its own colour. */
:where(.tab.is-active, .tab[aria-selected="true"]) .tab-count {
  background: var(--color-primary-20);
  color: var(--color-primary);
}

.tab-count-info { background: var(--color-info-20); color: var(--color-info); }
.tab-count-warning { background: var(--color-warning-20); color: var(--color-warning); }
.tab-count-danger { background: var(--color-danger-20); color: var(--color-danger); }

.tab-panel:focus-visible {
  outline-offset: 4px;
  border-radius: var(--radius-sm);
}

.mode-kiosk .tab {
  min-height: 56px;
  padding: 12px 20px;
}

/* ── Empty, message, loading, error ───────────────────────────────────── */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 40px 16px;
  text-align: center;
  color: var(--color-text-muted);
}

.empty > .icon {
  color: var(--color-text-muted);
}

.empty-title {
  font-size: 1.125rem;
  color: var(--color-text);
}

.error-state > .icon {
  color: var(--color-danger);
}

.error-detail {
  max-width: 560px;
  font-size: 0.8125rem;
  text-align: left;
}

.error-detail summary {
  cursor: pointer;
}

.error-detail code {
  display: block;
  margin-top: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--color-surface-2);
  overflow-wrap: anywhere;
}

.message {
  width: 100%;
  max-width: 520px;
  margin: 48px auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 40px 32px;
  text-align: center;
}

.message .btn {
  width: 100%;
}

.message-icon {
  display: flex;
  color: var(--color-primary);
}

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 48px 16px;
  color: var(--color-text-muted);
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--color-border-strong);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Modal ────────────────────────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: var(--color-overlay);
  animation: fade-in 0.15s ease-out;
}

.modal {
  display: flex;
  flex-direction: column;
  width: min(560px, 100%);
  max-height: calc(100vh - 32px);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: modal-in 0.18s ease-out;
}

.modal-sm { width: min(440px, 100%); }
.modal-lg { width: min(760px, 100%); }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
}

.modal-head h2 {
  font-size: 1.125rem;
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
  overflow-y: auto;
}

.modal-error {
  color: var(--color-danger);
  font-size: 0.875rem;
}

.modal-error:empty {
  display: none;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 20px;
  border-top: 1px solid var(--color-border);
}

.confirm-message {
  color: var(--color-text);
}

@media (max-width: 559.98px) {
  .modal-actions {
    flex-direction: column-reverse;
  }

  .modal-actions .btn {
    width: 100%;
  }
}

.mode-kiosk .modal {
  width: min(640px, 100%);
}

@keyframes fade-in {
  from { opacity: 0; }
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(8px); }
}

/* ── Toast ────────────────────────────────────────────────────────────── */

.toast-region {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: min(480px, calc(100vw - 32px));
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  --toast-color: var(--color-info);
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px 16px;
  overflow: hidden;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: var(--shadow);
  cursor: pointer;
  pointer-events: auto;
  animation: toast-in 0.18s ease-out;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast-ok { --toast-color: var(--color-success); }
.toast-info { --toast-color: var(--color-info); }
.toast-error { --toast-color: var(--color-danger); }

.toast-icon {
  display: flex;
  color: var(--toast-color);
}

.toast-text {
  flex: 1;
  min-width: 0;
}

.toast-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: var(--toast-color);
  transform-origin: left center;
  animation-name: toast-countdown;
  animation-duration: var(--toast-duration, 4s);
  animation-timing-function: linear;
  animation-fill-mode: forwards;
}

.toast:hover .toast-bar {
  animation-play-state: paused;
}

.toast.is-leaving {
  opacity: 0;
  transform: translateY(4px);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
}

@keyframes toast-countdown {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

/* ── Reduced motion, print ────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  /* The countdown is information, not decoration: it keeps running. */
  .toast-bar {
    animation-duration: var(--toast-duration, 4s) !important;
  }

  .tile-btn:active {
    transform: none;
  }
}

@page {
  margin: 16mm;
}

@media print {
  html,
  html.mode-kiosk {
    font-size: 11pt;
  }

  body {
    background: var(--color-bg);
  }

  .sidebar,
  .sidebar-backdrop,
  .app-bar,
  .kiosk-bar,
  .toast-region,
  .modal-overlay,
  .skip-link,
  .menu-toggle,
  .net-indicator,
  .no-print,
  .btn,
  .icon-btn,
  .tabs,
  .search {
    display: none !important;
  }

  .shell-app {
    display: block;
  }

  .main,
  .kiosk-main {
    padding: 0;
    max-width: none;
  }

  .page {
    max-width: none;
    gap: 16px;
  }

  .card,
  .kpi,
  .meter {
    break-inside: avoid;
    border-color: var(--color-border-strong);
  }

  .table-wrap,
  .table-wrap.table-scroll {
    max-height: none;
    overflow: visible;
  }

  .table thead {
    display: table-header-group;
  }

  .table thead th {
    position: static;
  }

  .table tr {
    break-inside: avoid;
  }

  a {
    color: inherit;
  }
}
