/*
 * Kontor design system for server-rendered pages.
 * Ported from reference/design-system/components/bundle.css (React components -> kt-* classes in
 * Thymeleaf fragments). Every color, size and radius comes from tokens.css. Do not edit the ported
 * part by hand; project additions go below "Additions" or into app.css.
 */

/* IBM Plex, self-hosted (SIL OFL 1.1, see fonts/LICENSE-*.txt) - no external font CDN */
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-ext-400-normal.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-ext-500-normal.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-ext-600-normal.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "IBM Plex Sans Condensed"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/ibm-plex-sans-condensed-latin-500-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans Condensed"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/ibm-plex-sans-condensed-latin-ext-500-normal.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "IBM Plex Sans Condensed"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/ibm-plex-sans-condensed-latin-600-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans Condensed"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/ibm-plex-sans-condensed-latin-ext-600-normal.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/ibm-plex-mono-latin-ext-400-normal.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/ibm-plex-mono-latin-ext-500-normal.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }


/* Kontor components. Every color, size and radius comes from tokens.css. */
body { margin: 0; font-family: var(--font-sans); font-size: 13px; line-height: 18px; background: var(--paper); color: var(--ink); -webkit-font-smoothing: antialiased; }
.kt-mono { font-family: var(--font-mono); font-size: 12px; }
.kt-icon { flex: none; display: block; }
.kt-row { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; padding: var(--space-3); }
.kt-stack { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-3); }

/* Logo: tile kontor + paper K in light; tile kontor-soft + ink K in dark. The double rule is always brass. */
.kt-logo { display: inline-flex; align-items: center; gap: var(--space-2); color: var(--ink); }
.kt-mark { display: block; flex: none; }
.kt-mark-tile { fill: var(--kontor); }
.kt-mark-k { stroke: var(--on-kontor); }
.kt-mark-rule { stroke: var(--brass); }
[data-theme="dark"] .kt-mark-tile { fill: var(--kontor-soft); }
[data-theme="dark"] .kt-mark-k { stroke: var(--ink); }
.kt-logo-words { display: inline-flex; flex-direction: column; gap: 3px; }
.kt-wordmark { display: block; }
.kt-wordmark g { stroke: var(--ink); }
.kt-logo-suffix { font-size: 11px; line-height: 12px; color: var(--ink-muted); white-space: nowrap; }

/* Focus: one ring for every control */
.kt-btn:focus-visible, .kt-input:focus-within, .kt-tab:focus-visible, .kt-chip button:focus-visible,
.kt-check input:focus-visible + .kt-check-box, .kt-th-inner:focus-visible, .kt-nav-item:focus-visible { outline: 2px solid transparent; box-shadow: var(--focus-ring); }

/* Button */
.kt-btn { font: inherit; font-weight: 500; display: inline-flex; align-items: center; justify-content: center; gap: var(--space-1); height: var(--control-md); padding: 0 10px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); cursor: pointer; white-space: nowrap; }
.kt-btn:hover { background: var(--surface-hover); }
.kt-btn-sm { height: var(--control-sm); padding: 0 var(--space-2); font-size: 12px; }
.kt-btn-lg { height: var(--control-lg); padding: 0 var(--space-3); }
.kt-btn-icon { width: var(--control-md); padding: 0; }
.kt-btn-sm.kt-btn-icon { width: var(--control-sm); }
.kt-btn-primary { background: var(--kontor); border-color: var(--kontor); color: var(--on-kontor); }
.kt-btn-primary:hover { background: var(--kontor-strong); border-color: var(--kontor-strong); }
.kt-btn-ghost { background: transparent; border-color: transparent; color: var(--ink-muted); }
.kt-btn-ghost:hover { background: var(--surface-hover); color: var(--ink); }
.kt-btn-danger { background: var(--danger); border-color: var(--danger); color: var(--on-danger); }
.kt-btn:disabled { opacity: .45; cursor: not-allowed; }

/* Fields */
.kt-field { display: inline-flex; flex-direction: column; gap: var(--space-1); min-width: 0; }
.kt-field-label { font-size: 12px; line-height: 16px; font-weight: 500; color: var(--ink-muted); }
.kt-field-msg { display: inline-flex; align-items: center; gap: var(--space-1); font-size: 11px; line-height: 14px; color: var(--ink-muted); }
.kt-field-error { color: var(--danger); }
.kt-input { position: relative; display: inline-flex; align-items: center; gap: 6px; height: var(--control-md); padding: 0 var(--space-2); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink-muted); min-width: 0; }
.kt-input-sm { height: var(--control-sm); }
.kt-input input, .kt-input select { font: inherit; color: var(--ink); background: transparent; border: 0; outline: 0; padding: 0; min-width: 0; width: 100%; height: 100%; }
.kt-input input::placeholder { color: var(--ink-faint); }
.kt-input input.kt-mono { font-family: var(--font-mono); font-size: 12px; }
.is-error .kt-input { border-color: var(--danger); }
.kt-select select { appearance: none; -webkit-appearance: none; padding-right: 20px; cursor: pointer; }
.kt-select select option { background: var(--surface); color: var(--ink); }
.kt-select .kt-icon { position: absolute; right: 6px; pointer-events: none; }

/* Checkbox */
.kt-check { display: inline-flex; align-items: center; gap: var(--space-2); cursor: pointer; position: relative; }
.kt-check input { position: absolute; opacity: 0; width: 14px; height: 14px; margin: 0; }
.kt-check-box { width: 14px; height: 14px; border: 1px solid var(--line-strong); border-radius: var(--radius-xs); background: var(--surface); display: inline-flex; align-items: center; justify-content: center; color: transparent; }
.kt-check input:checked + .kt-check-box, .kt-check input:indeterminate + .kt-check-box { background: var(--kontor); border-color: var(--kontor); color: var(--on-kontor); }

/* Badge: always icon + word, never color alone */
.kt-badge { display: inline-flex; align-items: center; gap: var(--space-1); height: 20px; padding: 0 var(--space-2) 0 6px; border-radius: var(--radius-full); font-size: 12px; line-height: 16px; font-weight: 500; white-space: nowrap; background: var(--surface-sunken); color: var(--ink-muted); }
.kt-badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.kt-badge-info { background: var(--kontor-soft); color: var(--kontor); }
.kt-badge-success { background: var(--success-soft); color: var(--success); }
.kt-badge-warning { background: var(--warning-soft); color: var(--warning); }
.kt-badge-danger { background: var(--danger-soft); color: var(--danger); }

/* Tabs */
.kt-tabs { display: flex; gap: var(--space-4); border-bottom: 1px solid var(--line); padding: 0 var(--space-3); }
.kt-tab { font: inherit; font-size: 12px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0; margin-bottom: -1px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--ink-muted); cursor: pointer; }
.kt-tab:hover { color: var(--ink); }
.kt-tab.is-active { color: var(--ink); border-bottom-color: var(--kontor); }
.kt-tab-count { font-size: 11px; line-height: 16px; padding: 0 5px; border-radius: var(--radius-sm); background: var(--surface-sunken); color: var(--ink-muted); font-variant-numeric: tabular-nums; }

/* Toolbar & chips */
.kt-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2); padding: 6px var(--space-3); background: var(--surface); border-bottom: 1px solid var(--line); }
.kt-toolbar-start, .kt-toolbar-end { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); min-width: 0; }
.kt-chip { display: inline-flex; align-items: center; height: var(--control-sm); border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); }
.kt-chip.is-set { border-style: solid; border-color: var(--kontor); background: var(--kontor-soft); }
.kt-chip button { font: inherit; font-size: 12px; display: inline-flex; align-items: center; gap: var(--space-1); height: 100%; padding: 0 var(--space-2); border: 0; background: none; color: var(--ink-muted); cursor: pointer; border-radius: var(--radius-sm); }
.kt-chip.is-set .kt-chip-label { color: var(--ink-muted); }
.kt-chip-value { color: var(--kontor); font-weight: 600; }
.kt-chip .kt-chip-x { padding: 0 6px 0 2px; color: var(--kontor); }

/* Table: hairlines, no zebra, numbers right-aligned in tabular figures */
.kt-table-wrap { overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); }
.kt-table { width: 100%; border-collapse: separate; border-spacing: 0; font-variant-numeric: tabular-nums; }
.kt-th { position: sticky; top: 0; z-index: 1; height: var(--row-compact); padding: 0 var(--space-2); background: var(--surface-sunken); border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; font-weight: 600; }
.kt-th-inner { font: inherit; font-family: var(--font-condensed); font-size: 11px; line-height: 14px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-muted); display: inline-flex; align-items: center; gap: var(--space-1); padding: 0; border: 0; background: none; cursor: pointer; border-radius: var(--radius-xs); }
span.kt-th-inner { cursor: default; }
.kt-th-inner .kt-icon { opacity: .45; }
.kt-th.is-sorted .kt-th-inner { color: var(--ink); }
.kt-th.is-sorted .kt-icon { opacity: 1; color: var(--kontor); }
.kt-th-unit { text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--ink-faint); }
.kt-th.is-num { text-align: right; }
.kt-th.is-num .kt-th-inner { justify-content: flex-end; }
.kt-th-check, .kt-td-check { width: 32px; padding-right: 0; }
.kt-td { height: var(--row-compact); padding: 0 var(--space-2); border-bottom: 1px solid var(--line); white-space: nowrap; color: var(--ink); }
.is-comfortable .kt-td { height: var(--row-comfortable); }
.kt-td.is-num { text-align: right; }
.kt-td.is-strong { font-weight: 600; }
.kt-td.is-neg { color: var(--danger); }
.kt-td.kt-mono { color: var(--ink-muted); }
.kt-tr:hover .kt-td { background: var(--surface-hover); }
.kt-tr.is-selected .kt-td { background: var(--kontor-soft); }
.kt-empty { color: var(--ink-faint); }
.kt-td-empty { text-align: center; color: var(--ink-muted); height: 80px; }
/* The Summenstrich: totals sit under a brass double rule */
.kt-tr-total .kt-td { position: sticky; bottom: 0; background: var(--surface-sunken); font-weight: 600; border-bottom: 0; border-top: 3px double var(--brass); }
.kt-total-label { font-family: var(--font-condensed); font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--brass-ink); }

/* Stat */
.kt-stat { display: flex; flex-direction: column; gap: 2px; padding: var(--space-2) var(--space-3); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); min-width: 0; }
.kt-stat-label { font-size: 12px; line-height: 16px; font-weight: 500; color: var(--ink-muted); }
.kt-stat-value { font-family: var(--font-condensed); font-size: 22px; line-height: 28px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink); }
.kt-stat-delta { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; line-height: 14px; font-weight: 500; font-variant-numeric: tabular-nums; }
.kt-stat-delta-label { color: var(--ink-muted); font-weight: 400; margin-left: 3px; }
.kt-success { color: var(--success); }
.kt-danger { color: var(--danger); }

/* Pagination */
.kt-pager { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); padding: var(--space-1) var(--space-3); font-size: 12px; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.kt-pager-nav { display: inline-flex; align-items: center; gap: var(--space-1); }

/* Banner */
.kt-banner { display: flex; align-items: flex-start; gap: var(--space-2); padding: var(--space-2) var(--space-3); border: 1px solid; border-radius: var(--radius-md); }
.kt-banner > .kt-icon { margin-top: 1px; }
.kt-banner-body { display: flex; flex-wrap: wrap; gap: 0 6px; flex: 1; min-width: 0; color: var(--ink); }
.kt-banner-action { flex: none; }
.kt-banner-info { background: var(--kontor-soft); border-color: var(--kontor); color: var(--kontor); }
.kt-banner-success { background: var(--success-soft); border-color: var(--success); color: var(--success); }
.kt-banner-warning { background: var(--warning-soft); border-color: var(--warning); color: var(--warning); }
.kt-banner-danger { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }

/* App shell */
.kt-shell { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); min-height: 100%; background: var(--paper); }
.kt-side { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-3) var(--space-2); border-right: 1px solid var(--line); background: var(--paper); }
.kt-side-brand { padding: 2px var(--space-2) var(--space-1); }
.kt-nav { display: flex; flex-direction: column; gap: 1px; }
.kt-nav-section { padding: var(--space-3) var(--space-2) var(--space-1); font-family: var(--font-condensed); font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-muted); }
.kt-nav-item { display: flex; align-items: center; gap: var(--space-2); height: 28px; padding: 0 var(--space-2); border-radius: var(--radius-sm); color: var(--ink-muted); text-decoration: none; font-weight: 500; }
.kt-nav-item:hover { background: var(--surface-hover); color: var(--ink); }
.kt-nav-item.is-active { background: var(--kontor-soft); color: var(--kontor); }
.kt-nav-item > span:not(.kt-nav-count) { flex: 1; }
.kt-nav-count { font-size: 11px; line-height: 16px; padding: 0 5px; border-radius: var(--radius-sm); background: var(--surface-sunken); color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.kt-nav-count.is-alert { background: var(--warning-soft); color: var(--warning); }
.kt-side-foot { margin-top: auto; padding: 0 var(--space-2); font-size: 11px; color: var(--ink-faint); }
.kt-main { display: flex; flex-direction: column; min-width: 0; }
.kt-top { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); height: var(--topbar-height); padding: 0 var(--space-4); border-bottom: 1px solid var(--line); background: var(--surface); }
.kt-top-title { display: flex; align-items: baseline; gap: var(--space-2); min-width: 0; }
.kt-top-title h1 { margin: 0; font-family: var(--font-condensed); font-size: 20px; line-height: 26px; font-weight: 600; white-space: nowrap; }
.kt-crumb { font-size: 12px; color: var(--ink-muted); white-space: nowrap; }
.kt-top-actions { display: flex; align-items: center; gap: var(--space-2); }
.kt-avatar { width: 24px; height: 24px; border-radius: var(--radius-sm); display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; background: var(--kontor-soft); color: var(--kontor); }
.kt-content { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-3) var(--space-4) var(--space-4); min-width: 0; }
.kt-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--space-2); }
.kt-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; }
.kt-panel > .kt-table-wrap { border: 0; border-radius: 0; }

@media (prefers-reduced-motion: no-preference) { .kt-btn, .kt-tab, .kt-nav-item, .kt-td { transition: background-color .12s, color .12s; } }

/* ---------- Additions for the Thymeleaf port ---------- */

/* Shell fills the viewport; the sidebar stays in place while the content scrolls. */
.kt-shell { min-height: 100vh; }
.kt-side { position: sticky; top: 0; height: 100vh; overflow-y: auto; }
a.kt-nav-item { color: var(--ink-muted); }
a.kt-btn, a.kt-tab { text-decoration: none; }
.kt-panel-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--line); }
.kt-panel-head h2 { margin: 0; font-family: var(--font-condensed); font-size: 15px; line-height: 20px; font-weight: 600; }
.kt-empty-state { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-2); padding: var(--space-4) var(--space-3); color: var(--ink-muted); }
.kt-caption { font-size: 11px; line-height: 14px; color: var(--ink-muted); }

/* Forms: fields in a responsive grid inside a panel; actions below. */
.kt-form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--space-3); padding: var(--space-3); }
.kt-form-grid .kt-field { display: flex; width: 100%; }
.kt-form-grid .is-wide { grid-column: span 2; }
.kt-field-check { justify-content: flex-end; min-height: 48px; }
.kt-form-section { padding: var(--space-2) var(--space-3) 0; font-family: var(--font-condensed); font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-muted); }
.kt-form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.kt-form-actions .kt-spacer { flex: 1; }
.kt-field.is-error .kt-input { border-color: var(--danger); }
.kt-input.kt-textarea { height: auto; padding: var(--space-1) var(--space-2); align-items: stretch; }
.kt-input.kt-textarea textarea { font: inherit; color: var(--ink); background: transparent; border: 0; outline: 0; padding: 0; width: 100%; resize: vertical; }
/* th:field adds a hidden "_field" input right after a checkbox, so the ported "input + .kt-check-box" rules need "~" */
.kt-check input:checked ~ .kt-check-box { background: var(--kontor); border-color: var(--kontor); color: var(--on-kontor); }
.kt-check input:focus-visible ~ .kt-check-box { outline: 2px solid transparent; box-shadow: var(--focus-ring); }

/* Bootstrap Icons as fallback for glyphs the Kontor set doesn't have; same box as kt-icon */
.kt-bi { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; font-size: 15px; line-height: 1; }

/* Table cells: links in tables look like text until hovered; wrapping text cells */
.kt-td a.kt-link { color: var(--ink); text-decoration: none; font-weight: 600; }
.kt-td a.kt-link:hover { color: var(--link); text-decoration: underline; }
.kt-td.is-wrap { white-space: normal; min-width: 200px; }
.kt-td.is-actions { width: 1%; text-align: right; }
/* Inline forms (e.g. delete buttons) sit in a row */
.kt-inline { display: inline; margin: 0; }

/* Login: large type is allowed here only (brand book: Typography) */
.kt-login { display: flex; flex-direction: column; gap: var(--space-3); width: 100%; max-width: 340px; margin: 12vh auto 0; padding: 0 var(--space-4); }
.kt-login-brand { padding-bottom: var(--space-3); }
.kt-login-form { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-6) var(--space-4); }
.kt-login-form h1 { margin: 0; font-family: var(--font-condensed); font-size: 22px; line-height: 28px; font-weight: 600; }
.kt-login-form .kt-field { display: flex; }
.kt-input-lg { height: var(--control-lg); }

/* Below 1024px the sidebar collapses to icons (brand book: Layout). */
@media (max-width: 1023.98px) {
	.kt-shell { grid-template-columns: 48px minmax(0, 1fr); }
	.kt-side { padding: var(--space-3) var(--space-1); align-items: center; }
	.kt-side-brand { padding: 2px 0 var(--space-1); }
	.kt-logo-words, .kt-nav-section, .kt-nav-count, .kt-side-foot, .kt-nav-item > span { display: none; }
	.kt-nav-item { justify-content: center; width: 32px; padding: 0; }
}

/* ---------- Bootstrap bridge: Bootstrap components and utilities use the Kontor tokens ---------- */
:root, [data-bs-theme] {
	--bs-body-font-family: var(--font-sans);
	--bs-body-font-size: 13px;
	--bs-body-line-height: 18px;
	--bs-body-bg: var(--paper);
	--bs-body-color: var(--ink);
	--bs-secondary-color: var(--ink-muted);
	--bs-tertiary-bg: var(--surface-sunken);
	--bs-border-color: var(--line);
	--bs-border-radius: var(--radius-md);
	--bs-border-radius-sm: var(--radius-sm);
	--bs-link-color: var(--link);
	--bs-link-hover-color: var(--kontor-strong);
	--bs-font-monospace: var(--font-mono);
	--bs-emphasis-color: var(--ink);
	--bs-focus-ring-color: var(--kontor);
}
.dropdown-menu { --bs-dropdown-bg: var(--surface); --bs-dropdown-border-color: var(--line); --bs-dropdown-link-hover-bg: var(--surface-hover); --bs-dropdown-link-active-bg: var(--kontor-soft); --bs-dropdown-link-active-color: var(--kontor); box-shadow: var(--shadow-float); font-size: 13px; }
