/*!
 * SwimMonitor Style 1.0
 * Gestaltungsregeln: SWIMMONITOR-STYLE.md
 * Ladereihenfolge: bootstrap.min.css -> swimmonitor.css (danach keine weiteren Overrides)
 */

/* ==========================================================================
   0. Schriften (lokal, SIL Open Font License, siehe fonts/ibm-plex/OFL-LICENSE.txt)
   ========================================================================== */

@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 400; font-display: swap; src: url('../fonts/ibm-plex/ibm-plex-sans-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 500; font-display: swap; src: url('../fonts/ibm-plex/ibm-plex-sans-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 600; font-display: swap; src: url('../fonts/ibm-plex/ibm-plex-sans-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 700; font-display: swap; src: url('../fonts/ibm-plex/ibm-plex-sans-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 400; font-display: swap; src: url('../fonts/ibm-plex/ibm-plex-mono-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 500; font-display: swap; src: url('../fonts/ibm-plex/ibm-plex-mono-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 600; font-display: swap; src: url('../fonts/ibm-plex/ibm-plex-mono-latin-600-normal.woff2') format('woff2'); }

/* ==========================================================================
   1. Tokens
   ========================================================================== */

:root,
[data-bs-theme="light"] {
    --sm-font-sans: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --sm-font-mono: 'IBM Plex Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;

    --sm-radius: 4px;
    --sm-radius-sm: 2px;
    --sm-topbar-h: 60px;
    --sm-page-max: 1400px;
    --sm-gap: 16px;

    --sm-bg: #F4F5F2;
    --sm-surface: #FFFFFF;
    --sm-surface-2: #FAFBF9;
    --sm-line: #DFE2DC;
    --sm-line-strong: #BFC4BB;
    --sm-text: #14181F;
    --sm-muted: #5E6673;
    --sm-brand: #0A3D8F;
    --sm-brand-hover: #082F6E;
    --sm-brand-contrast: #FFFFFF;
    --sm-accent: #0093B0;
    --sm-focus: #0A3D8F;

    --sm-nav-bg: #0A3D8F;
    --sm-nav-text: rgba(255, 255, 255, .78);
    --sm-nav-text-active: #FFFFFF;
    --sm-nav-line: rgba(255, 255, 255, .14);
    --sm-nav-control: rgba(255, 255, 255, .25);
    --sm-nav-indicator: #4FD8F5;

    --sm-track: #ECEEEA;
    --sm-band: rgba(10, 61, 143, .16);

    --sm-ok: #1E7F45;
    --sm-warn: #A86A0B;
    --sm-alarm: #BF3129;
    --sm-none: #8A9099;
    --sm-info: #0A3D8F;
    --sm-ok-bg: #E8F3EC;
    --sm-warn-bg: #FBF1E0;
    --sm-alarm-bg: #F9E6E4;
    --sm-info-bg: #E7EDF6;

    --sm-shadow-pop: 0 8px 24px rgba(20, 24, 31, .12);
}

[data-bs-theme="dark"] {
    --sm-bg: #0C1118;
    --sm-surface: #121A24;
    --sm-surface-2: #151E2A;
    --sm-line: #212B38;
    --sm-line-strong: #33404F;
    --sm-text: #E6EAEF;
    --sm-muted: #8C96A4;
    --sm-brand: #6E9BF2;
    --sm-brand-hover: #8FB2F5;
    --sm-brand-contrast: #0C1118;
    --sm-accent: #3CC7E2;
    --sm-focus: #6E9BF2;

    --sm-nav-bg: #0E1724;
    --sm-nav-text: rgba(230, 234, 239, .7);
    --sm-nav-text-active: #FFFFFF;
    --sm-nav-line: #212B38;
    --sm-nav-control: #33404F;

    --sm-track: #1B2430;
    --sm-band: rgba(110, 155, 242, .22);

    --sm-ok: #46B877;
    --sm-warn: #E2A445;
    --sm-alarm: #EE5D52;
    --sm-none: #5F6977;
    --sm-info: #6E9BF2;
    --sm-ok-bg: #14281D;
    --sm-warn-bg: #2B2112;
    --sm-alarm-bg: #2E1716;
    --sm-info-bg: #142036;

    --sm-shadow-pop: 0 8px 24px rgba(0, 0, 0, .45);
}

/* Bootstrap an die Tokens binden, damit bestehende Unterseiten automatisch mitziehen */
:root,
[data-bs-theme="light"],
[data-bs-theme="dark"] {
    --bs-body-font-family: var(--sm-font-sans);
    --bs-body-font-size: .9375rem;
    --bs-body-bg: var(--sm-bg);
    --bs-body-color: var(--sm-text);
    --bs-secondary-color: var(--sm-muted);
    --bs-tertiary-bg: var(--sm-surface-2);
    --bs-border-color: var(--sm-line);
    --bs-border-radius: var(--sm-radius);
    --bs-border-radius-sm: var(--sm-radius-sm);
    --bs-border-radius-lg: var(--sm-radius);
    --bs-border-radius-xl: var(--sm-radius);
    --bs-border-radius-pill: var(--sm-radius);
    --bs-link-color: var(--sm-brand);
    --bs-link-color-rgb: 10, 61, 143;
    --bs-link-hover-color: var(--sm-brand-hover);
    --bs-primary: var(--sm-brand);
    --bs-success: var(--sm-ok);
    --bs-warning: var(--sm-warn);
    --bs-danger: var(--sm-alarm);
    --bs-box-shadow: none;
    --bs-box-shadow-sm: none;
    --bs-focus-ring-color: color-mix(in srgb, var(--sm-focus) 35%, transparent);
}

/* ==========================================================================
   2. Basis
   ========================================================================== */

html { scroll-padding-top: calc(var(--sm-topbar-h) + 16px); }
body {
    font-family: var(--sm-font-sans);
    background: var(--sm-bg);
    color: var(--sm-text);
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { font-weight: 600; letter-spacing: -.2px; color: var(--sm-text); }
h1, .h1 { font-size: 1.75rem; letter-spacing: -.4px; }
h2, .h2 { font-size: 1.25rem; }
h3, .h3 { font-size: 1.0625rem; }
h4, .h4, h5, .h5, h6, .h6 { font-size: .9375rem; }
a { color: var(--sm-brand); text-underline-offset: 3px; }
a:hover { color: var(--sm-brand-hover); }
hr { border-color: var(--sm-line); opacity: 1; }
code, kbd, pre, samp { font-family: var(--sm-font-mono); }
::selection { background: color-mix(in srgb, var(--sm-brand) 25%, transparent); }
:focus-visible { outline: 2px solid var(--sm-focus); outline-offset: 2px; }

.sm-mono, .sm-num { font-family: var(--sm-font-mono); font-variant-numeric: tabular-nums; }
.sm-muted { color: var(--sm-muted) !important; }
.sm-label {
    font-family: var(--sm-font-mono);
    font-size: .6875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--sm-muted);
}

/* ==========================================================================
   3. Top-Leiste und Navigation
   ========================================================================== */

.sm-topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    background: var(--sm-nav-bg);
    border-bottom: 1px solid var(--sm-nav-line);
}
.sm-topbar-inner { height: var(--sm-topbar-h); display: flex; align-items: stretch; padding: 0 24px; }

.sm-brand { display: flex; align-items: center; gap: 10px; margin-right: 36px; color: #FFFFFF; text-decoration: none; flex-shrink: 0; }
.sm-brand:hover { color: #FFFFFF; }
.sm-brand img { width: 30px; height: 30px; }
.sm-brand-name { font-size: 1.125rem; font-weight: 600; letter-spacing: -.2px; }
.sm-brand-name span { font-weight: 400; opacity: .75; }
.sm-brand-version {
    margin-left: -4px;
    padding: 1px 5px;
    border: 1px solid rgba(255, 255, 255, .35);
    border-radius: var(--sm-radius-sm);
    font-family: var(--sm-font-mono);
    font-size: .6875rem;
    font-weight: 500;
    line-height: 1.4;
    letter-spacing: .02em;
    color: rgba(255, 255, 255, .85);
}
.sm-auth-brand .sm-brand-version { border-color: var(--sm-line-strong); color: var(--sm-muted); }

.sm-menu { display: flex; align-items: stretch; gap: 4px; list-style: none; margin: 0; padding: 0; }
.sm-menu > li { position: relative; display: flex; }
.sm-menu > li > a,
.sm-menu > li > button {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 12px;
    margin-bottom: -1px;
    background: none;
    border: 0;
    border-bottom: 2px solid transparent;
    color: var(--sm-nav-text);
    font-weight: 500;
    font-size: .9375rem;
    text-decoration: none;
    white-space: nowrap;
}
.sm-menu > li > a:hover,
.sm-menu > li > button:hover,
.sm-menu > li > .show { color: var(--sm-nav-text-active); }
.sm-menu > li > .active { color: var(--sm-nav-text-active); border-bottom-color: var(--sm-nav-indicator); }
.sm-menu .dropdown-toggle::after { display: none; }
.sm-caret {
    width: 7px;
    height: 7px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg) translate(-2px, -2px);
    opacity: .7;
}

.sm-tools { margin-left: auto; display: flex; align-items: center; gap: 16px; }

.sm-nav-button {
    color: #FFFFFF;
    font-size: .875rem;
    font-weight: 500;
    text-decoration: none;
    padding: 6px 12px;
    border: 1px solid var(--sm-nav-control);
    border-radius: var(--sm-radius);
    white-space: nowrap;
}
.sm-nav-button:hover { color: #FFFFFF; background: rgba(255, 255, 255, .1); }

.sm-theme-switch { display: inline-flex; border: 1px solid var(--sm-nav-control); border-radius: var(--sm-radius); overflow: hidden; }
.sm-theme-switch button { background: transparent; border: 0; color: var(--sm-nav-text); font-size: .75rem; font-weight: 500; padding: 5px 10px; }
.sm-theme-switch button + button { border-left: 1px solid var(--sm-nav-control); }
.sm-theme-switch button:hover { color: #FFFFFF; }
.sm-theme-switch button.active { background: rgba(255, 255, 255, .16); color: #FFFFFF; }

.sm-user { display: flex; align-items: center; gap: 10px; color: #FFFFFF; font-size: .875rem; font-weight: 500; text-decoration: none; }
.sm-user:hover { color: #FFFFFF; }
.sm-user .dropdown-toggle::after, .sm-user.dropdown-toggle::after { display: none; }
.sm-initials {
    width: 30px;
    height: 30px;
    border-radius: var(--sm-radius);
    background: rgba(255, 255, 255, .16);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .75rem;
    font-weight: 600;
    overflow: hidden;
    flex-shrink: 0;
}
.sm-initials img { width: 100%; height: 100%; object-fit: cover; }

.sm-nav-toggle {
    display: none;
    margin-left: auto;
    align-self: center;
    background: none;
    border: 1px solid var(--sm-nav-control);
    border-radius: var(--sm-radius);
    color: #FFFFFF;
    padding: 6px 10px;
    font-size: .875rem;
    font-weight: 500;
}

/* ==========================================================================
   4. Dropdowns (Bootstrap)
   ========================================================================== */

.dropdown-menu {
    --bs-dropdown-bg: var(--sm-surface);
    --bs-dropdown-border-color: var(--sm-line);
    --bs-dropdown-border-radius: var(--sm-radius);
    --bs-dropdown-link-color: var(--sm-text);
    --bs-dropdown-link-hover-color: var(--sm-brand);
    --bs-dropdown-link-hover-bg: var(--sm-surface-2);
    --bs-dropdown-link-active-color: var(--sm-brand);
    --bs-dropdown-link-active-bg: var(--sm-surface-2);
    --bs-dropdown-divider-bg: var(--sm-line);
    --bs-dropdown-header-color: var(--sm-muted);
    --bs-dropdown-item-padding-x: 16px;
    --bs-dropdown-item-padding-y: 7px;
    --bs-dropdown-padding-y: 6px;
    font-size: .875rem;
    min-width: 240px;
    box-shadow: var(--sm-shadow-pop);
}
.sm-menu .dropdown-menu { margin-top: 0 !important; border-top-left-radius: 0; border-top-right-radius: 0; }
.dropdown-item.active, .dropdown-item:active { box-shadow: inset 2px 0 0 var(--sm-brand); font-weight: 500; }
.dropdown-header { font-family: var(--sm-font-mono); font-size: .6875rem; text-transform: uppercase; letter-spacing: .08em; padding: 8px 16px 4px; }
.dropdown-item .sm-hint { float: right; margin-left: 16px; font-family: var(--sm-font-mono); font-size: .6875rem; color: var(--sm-muted); }
.dropdown-item .sm-hint.is-off { color: var(--sm-alarm); }
.sm-dropdown-meta { padding: 8px 16px; font-size: .8125rem; color: var(--sm-muted); }

/* ==========================================================================
   5. Seitenrahmen
   ========================================================================== */

.sm-page { width: 100%; max-width: var(--sm-page-max); margin: 0 auto; padding: 28px 24px 48px; flex: 1 0 auto; }
.sm-page--narrow { max-width: 880px; }
.sm-page--wide { max-width: none; }

.sm-crumbs { font-family: var(--sm-font-mono); font-size: .75rem; color: var(--sm-muted); letter-spacing: .02em; margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; }
.sm-crumbs li + li::before { content: '/'; margin: 0 8px; opacity: .5; }
.sm-crumbs a { color: var(--sm-muted); text-decoration: none; }
.sm-crumbs a:hover { color: var(--sm-brand); }

.sm-page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 24px; margin: 6px 0 22px; }
.sm-page-head h1 { margin: 0; }
.sm-page-head .sm-lead { margin: 6px 0 0; color: var(--sm-muted); max-width: 70ch; }
.sm-page-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.sm-summary { display: flex; flex-wrap: wrap; gap: 28px; margin: 0; }
.sm-summary > div { display: flex; flex-direction: column; }
.sm-summary dt { font-family: var(--sm-font-mono); font-size: .6875rem; font-weight: 500; text-transform: uppercase; letter-spacing: .08em; color: var(--sm-muted); }
.sm-summary dd { margin: 0; font-family: var(--sm-font-mono); font-variant-numeric: tabular-nums; font-size: 1.25rem; font-weight: 500; }

.sm-footer { border-top: 1px solid var(--sm-line); flex-shrink: 0; }
.sm-footer-inner { max-width: var(--sm-page-max); margin: 0 auto; padding: 16px 24px; display: flex; justify-content: space-between; gap: 16px; font-size: .8125rem; color: var(--sm-muted); }
.sm-footer a { color: var(--sm-muted); text-decoration: none; margin-left: 20px; }
.sm-footer a:hover { color: var(--sm-brand); }

.sm-stack { display: flex; flex-direction: column; gap: var(--sm-gap); }
.sm-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sm-gap); }
.sm-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sm-gap); }
.sm-grid-aside { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: var(--sm-gap); }
.sm-grid-aside--left { grid-template-columns: 280px minmax(0, 1fr); }

/* ==========================================================================
   6. Panels (ersetzt .card)
   ========================================================================== */

.sm-panel, .card {
    background: var(--sm-surface);
    border: 1px solid var(--sm-line);
    border-radius: var(--sm-radius);
    box-shadow: none;
}
.sm-panel-head, .card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    background: transparent;
    border-bottom: 1px solid var(--sm-line);
}
.sm-panel-head h2, .sm-panel-head h3, .card-header h2, .card-header h3, .card-header h5, .card-title { font-size: .875rem; font-weight: 600; margin: 0; }
.sm-panel-meta { font-family: var(--sm-font-mono); font-size: .75rem; color: var(--sm-muted); }
.sm-panel-body, .card-body { padding: 16px; }
.sm-panel-foot, .card-footer { padding: 12px 16px; border-top: 1px solid var(--sm-line); background: transparent; display: flex; justify-content: flex-end; gap: 8px; }
.sm-panel--flush .sm-panel-body { padding: 0; }
.sm-section-title { margin: 28px 0 12px; font-size: 1rem; }

/* ==========================================================================
   7. Buttons
   ========================================================================== */

.btn {
    --bs-btn-font-weight: 500;
    --bs-btn-font-size: .875rem;
    --bs-btn-padding-x: 14px;
    --bs-btn-padding-y: 7px;
    --bs-btn-border-radius: var(--sm-radius);
    --bs-btn-box-shadow: none;
    --bs-btn-focus-box-shadow: 0 0 0 3px color-mix(in srgb, var(--sm-focus) 30%, transparent);
}
.btn-sm { --bs-btn-padding-x: 10px; --bs-btn-padding-y: 4px; --bs-btn-font-size: .8125rem; }
.btn-lg { --bs-btn-padding-x: 18px; --bs-btn-padding-y: 10px; --bs-btn-font-size: .9375rem; }

.btn-primary {
    --bs-btn-bg: var(--sm-brand);
    --bs-btn-border-color: var(--sm-brand);
    --bs-btn-color: var(--sm-brand-contrast);
    --bs-btn-hover-bg: var(--sm-brand-hover);
    --bs-btn-hover-border-color: var(--sm-brand-hover);
    --bs-btn-hover-color: var(--sm-brand-contrast);
    --bs-btn-active-bg: var(--sm-brand-hover);
    --bs-btn-active-border-color: var(--sm-brand-hover);
    --bs-btn-active-color: var(--sm-brand-contrast);
    --bs-btn-disabled-bg: var(--sm-brand);
    --bs-btn-disabled-border-color: var(--sm-brand);
}
.btn-secondary, .btn-outline-secondary, .btn-light, .btn-outline-primary {
    --bs-btn-bg: var(--sm-surface);
    --bs-btn-border-color: var(--sm-line-strong);
    --bs-btn-color: var(--sm-text);
    --bs-btn-hover-bg: var(--sm-surface-2);
    --bs-btn-hover-border-color: var(--sm-muted);
    --bs-btn-hover-color: var(--sm-text);
    --bs-btn-active-bg: var(--sm-track);
    --bs-btn-active-border-color: var(--sm-muted);
    --bs-btn-active-color: var(--sm-text);
}
.btn-outline-primary { --bs-btn-color: var(--sm-brand); --bs-btn-hover-color: var(--sm-brand); }
.btn-success {
    --bs-btn-bg: var(--sm-ok); --bs-btn-border-color: var(--sm-ok); --bs-btn-color: #FFFFFF;
    --bs-btn-hover-bg: color-mix(in srgb, var(--sm-ok) 85%, #000); --bs-btn-hover-border-color: color-mix(in srgb, var(--sm-ok) 85%, #000); --bs-btn-hover-color: #FFFFFF;
}
.btn-danger {
    --bs-btn-bg: var(--sm-alarm); --bs-btn-border-color: var(--sm-alarm); --bs-btn-color: #FFFFFF;
    --bs-btn-hover-bg: color-mix(in srgb, var(--sm-alarm) 85%, #000); --bs-btn-hover-border-color: color-mix(in srgb, var(--sm-alarm) 85%, #000); --bs-btn-hover-color: #FFFFFF;
}
.btn-outline-danger {
    --bs-btn-bg: var(--sm-surface); --bs-btn-border-color: var(--sm-line-strong); --bs-btn-color: var(--sm-alarm);
    --bs-btn-hover-bg: var(--sm-alarm-bg); --bs-btn-hover-border-color: var(--sm-alarm); --bs-btn-hover-color: var(--sm-alarm);
}
.btn-warning, .btn-info, .btn-dark, .btn-outline-warning, .btn-outline-info, .btn-outline-success, .btn-outline-dark {
    --bs-btn-bg: var(--sm-surface); --bs-btn-border-color: var(--sm-line-strong); --bs-btn-color: var(--sm-text);
    --bs-btn-hover-bg: var(--sm-surface-2); --bs-btn-hover-border-color: var(--sm-muted); --bs-btn-hover-color: var(--sm-text);
}
.btn-link, .sm-link-action {
    --bs-btn-color: var(--sm-brand);
    --bs-btn-hover-color: var(--sm-brand-hover);
    font-weight: 600;
    text-decoration: none;
}
.sm-link-action { font-size: .875rem; white-space: nowrap; }
.sm-link-action:hover { text-decoration: underline; }
.sm-link-action::after { content: ' \2192'; }
.btn .fa, .btn .fas, .btn .bi { font-size: .875em; }

/* ==========================================================================
   8. Formulare
   ========================================================================== */

.form-label, .col-form-label { font-size: .8125rem; font-weight: 600; color: var(--sm-text); margin-bottom: 4px; }
.form-text { font-size: .8125rem; color: var(--sm-muted); }
.form-control, .form-select {
    background-color: var(--sm-surface);
    border: 1px solid var(--sm-line-strong);
    border-radius: var(--sm-radius);
    color: var(--sm-text);
    font-size: .875rem;
    padding: 7px 12px;
    box-shadow: none;
}
.form-control::placeholder { color: var(--sm-muted); opacity: .8; }
.form-control:focus, .form-select:focus { border-color: var(--sm-focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--sm-focus) 22%, transparent); background-color: var(--sm-surface); color: var(--sm-text); }
.form-control:disabled, .form-select:disabled, .form-control[readonly] { background-color: var(--sm-surface-2); color: var(--sm-muted); }
.form-control.is-invalid, .form-select.is-invalid { border-color: var(--sm-alarm); }
.invalid-feedback, .form-error-message { color: var(--sm-alarm); font-size: .8125rem; }
.form-check-input { border-color: var(--sm-line-strong); border-radius: var(--sm-radius-sm); background-color: var(--sm-surface); }
.form-check-input:checked { background-color: var(--sm-brand); border-color: var(--sm-brand); }
.form-check-input:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--sm-focus) 22%, transparent); border-color: var(--sm-focus); }
.form-switch .form-check-input { border-radius: 2em; }
.input-group-text { background: var(--sm-surface-2); border-color: var(--sm-line-strong); color: var(--sm-muted); font-size: .875rem; }

.sm-form { display: flex; flex-direction: column; gap: 20px; }
.sm-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.sm-form-grid .sm-span-2 { grid-column: 1 / -1; }
.sm-fieldset { border: 1px solid var(--sm-line); border-radius: var(--sm-radius); padding: 16px; margin: 0; }
.sm-fieldset legend { float: none; width: auto; padding: 0 6px; margin-left: -6px; font-size: .6875rem; font-family: var(--sm-font-mono); text-transform: uppercase; letter-spacing: .08em; color: var(--sm-muted); }
.sm-form-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 16px; border-top: 1px solid var(--sm-line); }

.sm-toolbar { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; }
.sm-search {
    flex: 1;
    min-width: 240px;
    border: 1px solid var(--sm-line-strong);
    background: var(--sm-surface);
    color: var(--sm-text);
    border-radius: var(--sm-radius);
    padding: 8px 12px;
    font-size: .875rem;
}
.sm-search:focus { outline: 2px solid var(--sm-focus); outline-offset: -1px; }

.sm-segment { display: inline-flex; border: 1px solid var(--sm-line-strong); border-radius: var(--sm-radius); overflow: hidden; background: var(--sm-surface); }
.sm-segment > button, .sm-segment > a {
    background: transparent;
    border: 0;
    padding: 8px 14px;
    font-size: .8125rem;
    font-weight: 500;
    color: var(--sm-muted);
    text-decoration: none;
    white-space: nowrap;
}
.sm-segment > * + * { border-left: 1px solid var(--sm-line) !important; }
.sm-segment > :hover { color: var(--sm-text); }
.sm-segment > .active { color: var(--sm-text); background: var(--sm-track); }
.sm-segment .sm-count { font-family: var(--sm-font-mono); font-size: .75rem; margin-left: 4px; opacity: .7; }

/* ==========================================================================
   9. Tabellen
   ========================================================================== */

.table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--sm-text);
    --bs-table-border-color: var(--sm-line);
    --bs-table-striped-bg: var(--sm-surface-2);
    --bs-table-striped-color: var(--sm-text);
    --bs-table-hover-bg: var(--sm-surface-2);
    --bs-table-hover-color: var(--sm-text);
    --bs-table-active-bg: var(--sm-track);
    margin: 0;
    font-size: .875rem;
}
.table > :not(caption) > * > * { padding: 11px 16px; border-bottom-color: var(--sm-line); }
.table > thead > tr > th, .table > thead > tr > td {
    font-family: var(--sm-font-mono);
    font-size: .6875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--sm-muted);
    white-space: nowrap;
    background: transparent;
    padding-top: 10px;
    padding-bottom: 10px;
}
.table > tbody > tr:last-child > * { border-bottom: 0; }
.table td.sm-num, .table th.sm-num { text-align: right; }
.table td.sm-actions { text-align: right; white-space: nowrap; }
.table-dark, .table-light, .thead-dark, .thead-light { --bs-table-bg: transparent; --bs-table-color: var(--sm-muted); }
.table-responsive { border-radius: var(--sm-radius); }
.sm-panel > .table-responsive, .sm-panel > .table, .card > .table-responsive, .card > .table { border-radius: 0 0 var(--sm-radius) var(--sm-radius); }

/* ==========================================================================
   10. Status, Tags, Badges
   ========================================================================== */

.sm-status { display: inline-flex; align-items: center; gap: 6px; font-size: .8125rem; font-weight: 600; white-space: nowrap; }
.sm-status::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.sm-status--plain::before { display: none; }

.sm-lte {
    display: inline-flex;
    align-items: flex-end;
    gap: 8px;
    margin-top: 8px;
    color: var(--sm-text);
}
.sm-lead .sm-lte { margin: 0 0 0 12px; vertical-align: middle; }
.sm-lte-bars { display: inline-flex; align-items: flex-end; gap: 3px; height: 18px; }
.sm-lte-bars i { display: block; width: 4px; border-radius: 1px; background: var(--sm-line-strong); }
.sm-lte-bars i:nth-child(1) { height: 25%; }
.sm-lte-bars i:nth-child(2) { height: 50%; }
.sm-lte-bars i:nth-child(3) { height: 75%; }
.sm-lte-bars i:nth-child(4) { height: 100%; }
.sm-lte.is-strong .is-on { background: var(--sm-ok); }
.sm-lte.is-mid .is-on { background: var(--sm-warn); }
.sm-lte.is-weak .is-on { background: var(--sm-alarm); }
.sm-lte.is-unknown { color: var(--sm-muted); }
.sm-lte.is-error { color: var(--sm-alarm); }
.sm-lte > span:last-child { font-family: var(--sm-font-mono); font-size: .75rem; line-height: 1; }

.sm-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: var(--sm-none); }
.sm-dot.is-on { background: var(--sm-ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--sm-ok) 20%, transparent); }
.sm-dot.is-off { background: var(--sm-alarm); }
.sm-dot.is-warn { background: var(--sm-warn); }

.is-ok { color: var(--sm-ok) !important; }
.is-warn { color: var(--sm-warn) !important; }
.is-alarm { color: var(--sm-alarm) !important; }
.is-none { color: var(--sm-none) !important; }
.is-info { color: var(--sm-info) !important; }

.sm-tag, .badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 7px;
    border: 1px solid var(--sm-line-strong);
    border-radius: var(--sm-radius-sm);
    background: transparent;
    color: var(--sm-muted);
    font-family: var(--sm-font-mono);
    font-size: .6875rem;
    font-weight: 500;
    letter-spacing: .04em;
    text-transform: uppercase;
    line-height: 1.5;
    white-space: nowrap;
}
.sm-tag--ok, .badge.bg-success, .badge.text-bg-success { color: var(--sm-ok); border-color: color-mix(in srgb, var(--sm-ok) 45%, transparent); background: var(--sm-ok-bg) !important; }
.sm-tag--warn, .badge.bg-warning, .badge.text-bg-warning { color: var(--sm-warn) !important; border-color: color-mix(in srgb, var(--sm-warn) 45%, transparent); background: var(--sm-warn-bg) !important; }
.sm-tag--alarm, .badge.bg-danger, .badge.text-bg-danger { color: var(--sm-alarm); border-color: color-mix(in srgb, var(--sm-alarm) 45%, transparent); background: var(--sm-alarm-bg) !important; }
.sm-tag--info, .badge.bg-primary, .badge.bg-info, .badge.text-bg-primary, .badge.text-bg-info { color: var(--sm-info) !important; border-color: color-mix(in srgb, var(--sm-info) 40%, transparent); background: var(--sm-info-bg) !important; }
.badge.bg-secondary, .badge.bg-light, .badge.bg-dark, .badge.text-bg-secondary { color: var(--sm-muted) !important; background: transparent !important; }

/* ==========================================================================
   11. Messwerte und Skala
   ========================================================================== */

.sm-metric { min-width: 0; }
.sm-metric-label { font-family: var(--sm-font-mono); font-size: .6875rem; text-transform: uppercase; letter-spacing: .08em; color: var(--sm-muted); margin-bottom: 6px; }
.sm-metric-value {
    font-family: var(--sm-font-mono);
    font-variant-numeric: tabular-nums;
    font-size: 1.5rem;
    font-weight: 500;
    line-height: 1;
    letter-spacing: -.5px;
}
.sm-metric-value .sm-unit { font-size: .8125rem; color: var(--sm-muted); margin-left: 4px; letter-spacing: 0; }
.sm-metric-value.is-empty { color: var(--sm-none); }
.sm-metric--lg .sm-metric-value { font-size: 2.25rem; }
.sm-metric-foot { display: flex; justify-content: space-between; gap: 8px; font-size: .75rem; }
.sm-metric-foot .sm-target { font-family: var(--sm-font-mono); color: var(--sm-muted); }
.sm-metric-foot .sm-state { font-weight: 600; }

.sm-scale { position: relative; height: 6px; margin: 12px 0 8px; background: var(--sm-track); border-radius: 1px; }
.sm-scale-band { position: absolute; top: 0; bottom: 0; background: var(--sm-band); }
.sm-scale-mark { position: absolute; top: -4px; width: 3px; height: 14px; margin-left: -1.5px; border-radius: 1px; background: var(--sm-none); }
.sm-scale-mark.is-ok { background: var(--sm-ok); }
.sm-scale-mark.is-warn { background: var(--sm-warn); }
.sm-scale-mark.is-alarm { background: var(--sm-alarm); }

/* Container-Zeilen (Übersicht) */
.sm-crow-grid { display: grid; grid-template-columns: 260px repeat(4, minmax(150px, 1fr)) 110px; }
.sm-crow-head { border-bottom: 1px solid var(--sm-line); }
.sm-crow-head > div { padding: 10px 16px; }
.sm-crow { border-bottom: 1px solid var(--sm-line); }
.sm-crow:last-child { border-bottom: 0; }
.sm-crow:hover { background: var(--sm-surface-2); }
.sm-crow > * { padding: 16px; min-width: 0; }
.sm-crow > * + * { border-left: 1px solid var(--sm-line); }
.sm-crow-name { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.sm-crow-name a { color: var(--sm-text); text-decoration: none; }
.sm-crow-name a:hover { color: var(--sm-brand); }
.sm-crow-loc { font-size: .8125rem; color: var(--sm-muted); margin-top: 2px; }
.sm-crow-conn { font-family: var(--sm-font-mono); font-size: .75rem; color: var(--sm-muted); margin-top: 10px; }
.sm-crow-conn.is-off { color: var(--sm-alarm); }
.sm-crow-action { display: flex; align-items: center; justify-content: flex-end; }

/* Messwert-Kacheln (Detailseite) */
.sm-metric-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--sm-surface); border: 1px solid var(--sm-line); border-radius: var(--sm-radius); }
.sm-metric-strip > .sm-metric { padding: 16px; }
.sm-metric-strip > .sm-metric + .sm-metric { border-left: 1px solid var(--sm-line); }

/* ==========================================================================
   12. Listen: Schlüssel/Wert, Protokoll, Changelog, To-Do
   ========================================================================== */

.sm-kv { display: grid; grid-template-columns: minmax(140px, 40%) 1fr; margin: 0; font-size: .875rem; }
.sm-kv dt, .sm-kv dd { padding: 9px 16px; border-bottom: 1px solid var(--sm-line); margin: 0; }
.sm-kv dt { color: var(--sm-muted); font-weight: 500; }
.sm-kv dd { font-family: var(--sm-font-mono); font-variant-numeric: tabular-nums; }
.sm-kv > :nth-last-child(-n + 2) { border-bottom: 0; }

.sm-log { list-style: none; margin: 0; padding: 0; }
.sm-log li { position: relative; display: grid; grid-template-columns: 52px 1fr; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--sm-line); }
.sm-log li:last-child { border-bottom: 0; }
.sm-log li::before { content: ''; position: absolute; left: 0; top: 12px; bottom: 12px; width: 2px; background: var(--sm-line-strong); }
.sm-log li.sm-log--warn::before { background: var(--sm-warn); }
.sm-log li.sm-log--alarm::before { background: var(--sm-alarm); }
.sm-log li.sm-log--ok::before { background: var(--sm-ok); }
.sm-log-time { font-family: var(--sm-font-mono); font-size: .75rem; color: var(--sm-muted); padding-top: 2px; }
.sm-log-text { font-size: .875rem; }
.sm-log-text b, .sm-log-text strong { font-weight: 600; }
.sm-log-detail { font-family: var(--sm-font-mono); font-size: .75rem; color: var(--sm-muted); margin-top: 2px; }

.sm-changelog { display: flex; flex-direction: column; gap: var(--sm-gap); }
.sm-release { display: grid; grid-template-columns: 180px minmax(0, 1fr); background: var(--sm-surface); border: 1px solid var(--sm-line); border-radius: var(--sm-radius); }
.sm-release-meta { padding: 16px; border-right: 1px solid var(--sm-line); }
.sm-release-version { font-family: var(--sm-font-mono); font-size: 1.125rem; font-weight: 600; }
.sm-release-version a { color: inherit; text-decoration: none; }
.sm-release-version a:hover { color: var(--sm-brand); }
.sm-release-date { font-family: var(--sm-font-mono); font-size: .75rem; color: var(--sm-muted); margin-top: 4px; }
.sm-release-scope { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 4px; }
.sm-release-body { padding: 16px; }
.sm-release-body h3 { margin: 0 0 6px; }
.sm-release-body > p { color: var(--sm-muted); margin-bottom: 12px; }
.sm-change { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 12px; padding: 8px 0; border-top: 1px solid var(--sm-line); font-size: .875rem; }
.sm-change:first-of-type { border-top: 0; }
.sm-change-type { font-family: var(--sm-font-mono); font-size: .6875rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; padding-top: 2px; }
.sm-change-type.is-new { color: var(--sm-ok); }
.sm-change-type.is-improved { color: var(--sm-info); }
.sm-change-type.is-fixed { color: var(--sm-warn); }
.sm-change-type.is-removed { color: var(--sm-alarm); }
.sm-change-type.is-security { color: var(--sm-alarm); }
.sm-change-area { font-family: var(--sm-font-mono); font-size: .75rem; color: var(--sm-muted); margin-left: 6px; }

.sm-todo { list-style: none; margin: 0; padding: 0; }
.sm-todo li { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 12px 16px; border-bottom: 1px solid var(--sm-line); }
.sm-todo li:last-child { border-bottom: 0; }
.sm-todo li.is-done .sm-todo-title { color: var(--sm-muted); text-decoration: line-through; }
.sm-todo .form-check-input { margin-top: 3px; }
.sm-todo-title { font-weight: 500; }
.sm-todo-meta { font-family: var(--sm-font-mono); font-size: .75rem; color: var(--sm-muted); margin-top: 2px; }
.sm-todo-meta .is-overdue { color: var(--sm-alarm); }

/* ==========================================================================
   13. Meldungen, Tabs, Paginierung, Modal, Leerzustand
   ========================================================================== */

.alert {
    --bs-alert-border-radius: var(--sm-radius);
    --bs-alert-padding-x: 16px;
    --bs-alert-padding-y: 12px;
    background: var(--sm-surface);
    border: 1px solid var(--sm-line);
    border-left: 3px solid var(--sm-line-strong);
    color: var(--sm-text);
    font-size: .875rem;
}
.alert-success { border-left-color: var(--sm-ok); background: var(--sm-ok-bg); }
.alert-warning { border-left-color: var(--sm-warn); background: var(--sm-warn-bg); }
.alert-danger, .alert-error { border-left-color: var(--sm-alarm); background: var(--sm-alarm-bg); }
.alert-info, .alert-primary { border-left-color: var(--sm-info); background: var(--sm-info-bg); }
.alert .btn-close { padding: 14px 16px; }
.sm-flash-stack { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }

.nav-tabs {
    --bs-nav-tabs-border-color: var(--sm-line);
    --bs-nav-tabs-border-radius: 0;
    --bs-nav-tabs-link-hover-border-color: transparent;
    --bs-nav-tabs-link-active-color: var(--sm-text);
    --bs-nav-tabs-link-active-bg: transparent;
    --bs-nav-tabs-link-active-border-color: transparent;
    gap: 4px;
    margin-bottom: 20px;
}
.nav-tabs .nav-link { color: var(--sm-muted); font-weight: 500; font-size: .875rem; border: 0; border-bottom: 2px solid transparent; padding: 10px 12px; }
.nav-tabs .nav-link:hover { color: var(--sm-text); }
.nav-tabs .nav-link.active { color: var(--sm-text); border-bottom-color: var(--sm-brand); }
.nav-pills { --bs-nav-pills-border-radius: var(--sm-radius); --bs-nav-pills-link-active-bg: var(--sm-track); --bs-nav-pills-link-active-color: var(--sm-text); }
.nav-pills .nav-link { color: var(--sm-muted); font-size: .875rem; font-weight: 500; }

.pagination {
    --bs-pagination-color: var(--sm-text);
    --bs-pagination-bg: var(--sm-surface);
    --bs-pagination-border-color: var(--sm-line-strong);
    --bs-pagination-hover-color: var(--sm-text);
    --bs-pagination-hover-bg: var(--sm-surface-2);
    --bs-pagination-hover-border-color: var(--sm-line-strong);
    --bs-pagination-active-color: var(--sm-text);
    --bs-pagination-active-bg: var(--sm-track);
    --bs-pagination-active-border-color: var(--sm-line-strong);
    --bs-pagination-disabled-color: var(--sm-muted);
    --bs-pagination-disabled-bg: var(--sm-surface);
    --bs-pagination-disabled-border-color: var(--sm-line);
    --bs-pagination-border-radius: var(--sm-radius);
    --bs-pagination-focus-box-shadow: 0 0 0 3px color-mix(in srgb, var(--sm-focus) 22%, transparent);
    font-family: var(--sm-font-mono);
    font-size: .8125rem;
}

.modal {
    --bs-modal-bg: var(--sm-surface);
    --bs-modal-border-color: var(--sm-line);
    --bs-modal-border-radius: var(--sm-radius);
    --bs-modal-inner-border-radius: var(--sm-radius);
    --bs-modal-header-border-color: var(--sm-line);
    --bs-modal-footer-border-color: var(--sm-line);
    --bs-modal-header-padding: 14px 16px;
    --bs-modal-padding: 16px;
    --bs-modal-box-shadow: var(--sm-shadow-pop);
}
.modal-title { font-size: 1rem; font-weight: 600; }
.modal-backdrop { --bs-backdrop-bg: #0C1118; --bs-backdrop-opacity: .55; }

.tooltip { --bs-tooltip-bg: var(--sm-text); --bs-tooltip-color: var(--sm-surface); --bs-tooltip-border-radius: var(--sm-radius-sm); --bs-tooltip-font-size: .75rem; }
.popover { --bs-popover-bg: var(--sm-surface); --bs-popover-border-color: var(--sm-line); --bs-popover-border-radius: var(--sm-radius); --bs-popover-header-bg: var(--sm-surface-2); }

.sm-empty { padding: 40px 16px; text-align: center; color: var(--sm-muted); }
.sm-empty strong { display: block; color: var(--sm-text); font-weight: 600; margin-bottom: 4px; }

.list-group { --bs-list-group-bg: var(--sm-surface); --bs-list-group-border-color: var(--sm-line); --bs-list-group-border-radius: var(--sm-radius); --bs-list-group-color: var(--sm-text); --bs-list-group-action-hover-bg: var(--sm-surface-2); --bs-list-group-active-bg: var(--sm-track); --bs-list-group-active-color: var(--sm-text); --bs-list-group-active-border-color: var(--sm-line); }

.progress { --bs-progress-bg: var(--sm-track); --bs-progress-bar-bg: var(--sm-brand); --bs-progress-border-radius: 1px; --bs-progress-height: 6px; }

/* Bootstrap-Effekte, die nicht zum Stil passen, neutralisieren */
.shadow, .shadow-sm, .shadow-lg { box-shadow: none !important; }
.rounded-pill { border-radius: var(--sm-radius) !important; }
.bg-light { background-color: var(--sm-surface-2) !important; }
.bg-white { background-color: var(--sm-surface) !important; }
.text-muted { color: var(--sm-muted) !important; }
.border { border-color: var(--sm-line) !important; }

/* ==========================================================================
   14. Fremdbibliotheken: DataTables, FullCalendar, Leaflet
   ========================================================================== */

/* DataTables */
.dataTables_wrapper { font-size: .875rem; }
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select { border: 1px solid var(--sm-line-strong); border-radius: var(--sm-radius); background: var(--sm-surface); color: var(--sm-text); padding: 6px 10px; margin-left: 8px; }
.dataTables_wrapper .dataTables_info { font-family: var(--sm-font-mono); font-size: .75rem; color: var(--sm-muted); padding: 12px 16px; }
.dataTables_wrapper .dataTables_paginate { padding: 8px 16px; }
.dataTables_wrapper .dataTables_filter, .dataTables_wrapper .dataTables_length { padding: 12px 16px; color: var(--sm-muted); }
table.dataTable > thead .sorting::before, table.dataTable > thead .sorting::after,
table.dataTable > thead .sorting_asc::before, table.dataTable > thead .sorting_asc::after,
table.dataTable > thead .sorting_desc::before, table.dataTable > thead .sorting_desc::after { opacity: .35; }
table.dataTable > thead .sorting_asc::before, table.dataTable > thead .sorting_desc::after { opacity: .9; color: var(--sm-brand); }

/* FullCalendar 5 */
.fc {
    --fc-border-color: var(--sm-line);
    --fc-page-bg-color: var(--sm-surface);
    --fc-neutral-bg-color: var(--sm-surface-2);
    --fc-neutral-text-color: var(--sm-muted);
    --fc-today-bg-color: color-mix(in srgb, var(--sm-brand) 7%, transparent);
    --fc-event-bg-color: var(--sm-brand);
    --fc-event-border-color: var(--sm-brand);
    --fc-event-text-color: var(--sm-brand-contrast);
    --fc-button-bg-color: var(--sm-surface);
    --fc-button-border-color: var(--sm-line-strong);
    --fc-button-text-color: var(--sm-text);
    --fc-button-hover-bg-color: var(--sm-surface-2);
    --fc-button-hover-border-color: var(--sm-muted);
    --fc-button-active-bg-color: var(--sm-track);
    --fc-button-active-border-color: var(--sm-muted);
    --fc-now-indicator-color: var(--sm-alarm);
    --fc-highlight-color: color-mix(in srgb, var(--sm-accent) 18%, transparent);
    font-size: .8125rem;
}
.fc .fc-toolbar-title { font-size: 1.125rem; font-weight: 600; }
.fc .fc-button { border-radius: var(--sm-radius); font-size: .8125rem; font-weight: 500; padding: 5px 10px; box-shadow: none !important; text-transform: none; }
.fc .fc-button-primary:not(:disabled).fc-button-active { color: var(--sm-text); }
.fc .fc-col-header-cell-cushion { font-family: var(--sm-font-mono); font-size: .6875rem; font-weight: 500; text-transform: uppercase; letter-spacing: .08em; color: var(--sm-muted); text-decoration: none; padding: 8px 4px; }
.fc .fc-daygrid-day-number { font-family: var(--sm-font-mono); font-size: .75rem; color: var(--sm-muted); text-decoration: none; }
.fc .fc-day-today .fc-daygrid-day-number { color: var(--sm-brand); font-weight: 600; }
.fc .fc-timegrid-slot-label-cushion, .fc .fc-list-event-time { font-family: var(--sm-font-mono); font-size: .75rem; color: var(--sm-muted); }
.fc .fc-event { border-radius: var(--sm-radius-sm); padding: 1px 4px; font-weight: 500; }
.fc .fc-list, .fc-theme-standard .fc-scrollgrid { border-radius: var(--sm-radius); }
.fc .fc-list-day-cushion { background: var(--sm-surface-2); }

/* Leaflet */
.leaflet-container { background: var(--sm-track); font-family: var(--sm-font-sans); }
.sm-map { height: 360px; border-radius: 0 0 var(--sm-radius) var(--sm-radius); }
.sm-map--tall { height: 520px; }
.sm-map-pin { background: none !important; border: none !important; }
.sm-map-model {
    position: relative;
    width: 160px;
    height: 110px;
    background: transparent;
}
.sm-map-model::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 82px;
    width: 10px;
    height: 10px;
    margin: -5px 0 0 -5px;
    border-radius: 50%;
    z-index: 1;
    border: 2px solid var(--sm-brand-contrast);
    background: var(--sm-brand);
    pointer-events: none;
}
.sm-map-model.is-off::after { background: var(--sm-alarm); }
.sm-map-model canvas {
    display: block;
    position: relative;
    width: 160px;
    height: 110px;
    filter: drop-shadow(0 0 1px #fff) drop-shadow(0 0 1px #fff) drop-shadow(0 1px 2px rgba(0, 0, 0, .35));
}
.sm-tiles-light { filter: saturate(.35) contrast(.95); }
.sm-tiles-dark { filter: invert(1) hue-rotate(185deg) brightness(.82) contrast(.9) saturate(.5); }
.leaflet-tooltip { background: var(--sm-surface); color: var(--sm-text); border: 1px solid var(--sm-line-strong); border-radius: 3px; box-shadow: none; font-weight: 600; font-size: .75rem; padding: 2px 6px; }
.leaflet-tooltip-right::before { border-right-color: var(--sm-line-strong); }
.leaflet-tooltip-left::before { border-left-color: var(--sm-line-strong); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--sm-surface); color: var(--sm-text); border-radius: var(--sm-radius); box-shadow: var(--sm-shadow-pop); }
.leaflet-popup-content { font-size: .8125rem; margin: 12px 14px; }
.leaflet-bar { border: 1px solid var(--sm-line-strong) !important; box-shadow: none !important; border-radius: 3px !important; }
.leaflet-bar a { background: var(--sm-surface) !important; color: var(--sm-text) !important; border-color: var(--sm-line) !important; }
.leaflet-control-attribution { background: color-mix(in srgb, var(--sm-surface) 85%, transparent) !important; color: var(--sm-muted) !important; }
.leaflet-control-attribution a { color: var(--sm-muted) !important; }

/* ==========================================================================
   15. Signage-Verwaltung: eigene Datei css/admin/signage.css (.sg-*), Farben und Radien aus diesen Tokens
   ========================================================================== */

/* ==========================================================================
   16. Login / Gastseiten (Datenschutz, Impressum)
   ========================================================================== */

.sm-auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.sm-auth-box { width: 100%; max-width: 380px; }
.sm-auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 24px; color: var(--sm-text); text-decoration: none; }
.sm-auth-brand img { width: 36px; height: 36px; }
.sm-auth-brand .sm-brand-name span { color: var(--sm-muted); opacity: 1; }

.sm-prose { max-width: 72ch; line-height: 1.65; }
.sm-prose h2 { margin: 32px 0 8px; font-size: 1.125rem; }
.sm-prose h3 { margin: 24px 0 6px; }
.sm-prose p, .sm-prose ul, .sm-prose ol { margin-bottom: 12px; }
.sm-prose address { font-style: normal; }

/* Rechtstexte; privacy_content.html.twig wird auch von den Buchungsseiten genutzt und bringt eigene Klassen mit */
.sm-legal { max-width: none; }
.sm-legal > *, .sm-legal .privacy-content > section { max-width: 80ch; }
.sm-legal .mb-5 { margin-bottom: 0 !important; }
.sm-legal h2:first-child, .sm-legal section:first-child h2 { margin-top: 0; }
.sm-legal h2 i, .sm-legal h3 i, .sm-legal li i, .sm-legal .contact-info i { display: none; }
.sm-legal .section-title { padding-top: 20px; border-top: 1px solid var(--sm-line); }
.sm-legal section:first-child .section-title, .sm-legal > h2:first-child { padding-top: 0; border-top: 0; }
.sm-legal > h2 { padding-top: 20px; border-top: 1px solid var(--sm-line); }
.sm-legal .data-list, .sm-legal .rights-list { padding-left: 1.25rem; }
.sm-legal .data-list li, .sm-legal .rights-list li { margin-bottom: 4px; }
.sm-legal .contact-info { padding: 12px 16px; border-left: 3px solid var(--sm-line-strong); background: var(--sm-surface-2); }
.sm-legal .contact-info p:last-child { margin-bottom: 0; }
.sm-legal .sm-kv { max-width: 480px; }

/* ==========================================================================
   17. Responsiv und Druck
   ========================================================================== */

@media (max-width: 1199.98px) {
    .sm-crow-grid { grid-template-columns: 220px repeat(4, minmax(120px, 1fr)) 90px; }
    .sm-grid-aside { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 991.98px) {
    .sm-topbar-inner { flex-wrap: wrap; height: auto; min-height: var(--sm-topbar-h); }
    .sm-brand { height: var(--sm-topbar-h); }
    .sm-nav-toggle { display: inline-block; }
    .sm-menu, .sm-tools { display: none; width: 100%; }
    .sm-topbar.is-open .sm-menu { display: flex; flex-direction: column; padding: 8px 0; border-top: 1px solid var(--sm-nav-line); }
    .sm-topbar.is-open .sm-tools { display: flex; flex-wrap: wrap; padding: 12px 0 16px; border-top: 1px solid var(--sm-nav-line); }
    .sm-menu > li { flex-direction: column; }
    .sm-menu > li > a, .sm-menu > li > button { padding: 10px 0; border-bottom: 0; }
    .sm-menu > li > .active { color: var(--sm-nav-indicator); }
    .sm-menu .dropdown-menu { position: static !important; transform: none !important; box-shadow: none; margin-bottom: 8px !important; border-radius: var(--sm-radius); }

    .sm-crow-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .sm-crow-head { display: none; }
    .sm-crow > :first-child, .sm-crow > .sm-crow-action { grid-column: 1 / -1; }
    .sm-crow > * + * { border-left: 0; border-top: 1px solid var(--sm-line); }
    .sm-crow > :nth-child(odd):not(:first-child):not(.sm-crow-action) { border-left: 1px solid var(--sm-line); }
    .sm-crow-action { justify-content: flex-start; }

    .sm-metric-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .sm-metric-strip > .sm-metric:nth-child(3) { border-left: 0; }
    .sm-metric-strip > .sm-metric:nth-child(n + 3) { border-top: 1px solid var(--sm-line); }
    .sm-grid-2, .sm-grid-3, .sm-grid-aside--left { grid-template-columns: minmax(0, 1fr); }
    .sm-release { grid-template-columns: minmax(0, 1fr); }
    .sm-release-meta { border-right: 0; border-bottom: 1px solid var(--sm-line); }
}

@media (max-width: 575.98px) {
    .sm-page { padding: 20px 16px 40px; }
    .sm-topbar-inner { padding: 0 16px; }
    .sm-form-grid { grid-template-columns: minmax(0, 1fr); }
    .sm-summary { gap: 18px; }
    .sm-change { grid-template-columns: minmax(0, 1fr); gap: 2px; }
    .sm-footer-inner { flex-direction: column; }
    .sm-footer a { margin: 0 20px 0 0; }
}

@media print {
    .sm-topbar, .sm-footer, .sm-toolbar, .sm-page-actions, .sm-nav-toggle { display: none !important; }
    body { background: #FFFFFF; }
    .sm-panel, .card { break-inside: avoid; }
}

/* ==========================================================================
   18. Ergänzungen für die Projektseiten
   ========================================================================== */

/* Messwert als Schaltfläche (öffnet Details) */
.sm-metric--button {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: 0;
    color: inherit;
    font: inherit;
    cursor: pointer;
}
.sm-metric--button > span { display: block; }
.sm-metric--button > .sm-metric-foot { display: flex; }
.sm-metric--button:hover .sm-metric-value { color: var(--sm-brand); }
.sm-metric--button:hover .sm-metric-value .sm-unit { color: var(--sm-muted); }
.sm-metric--button:focus-visible { outline-offset: -2px; }

/* Kurzmeldung oben rechts (per JS erzeugt) */
.sm-toast { position: fixed; top: calc(var(--sm-topbar-h) + 12px); right: 16px; z-index: 1090; min-width: 260px; max-width: 420px; box-shadow: var(--sm-shadow-pop); }

/* Auswahlfeld in Werkzeugleisten nur so breit wie nötig */
.sm-select-auto { width: auto; }

/* Benutzer: Kürzel/Avatar auf hellen Flächen */
.sm-initials--light { background: var(--sm-track); color: var(--sm-muted); }
.sm-initials--xl { width: 88px; height: 88px; font-size: 1.5rem; }
.sm-user-cell { display: inline-flex; align-items: center; gap: 10px; font-weight: 500; }
.sm-avatar-row { display: flex; align-items: center; gap: 20px; }
.sm-tag-list { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.sm-input-narrow { max-width: 240px; }

/* Farb-Chips: Farbe kommt aus data-sm-color (swimmonitor.js setzt --sm-color) */
.sm-chip {
    --sm-color: var(--sm-muted);
    display: inline-flex; align-items: center; gap: 6px;
    padding: 1px 8px; border-radius: var(--sm-radius);
    border: 1px solid color-mix(in srgb, var(--sm-color) 55%, transparent);
    background: color-mix(in srgb, var(--sm-color) 12%, transparent);
    color: var(--sm-text); font-family: var(--sm-font-sans); font-size: .75rem; font-weight: 500; line-height: 1.6; white-space: nowrap;
}
.sm-chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--sm-color); flex: none; }
.sm-chip-row { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.sm-chip--check { position: relative; cursor: pointer; opacity: .65; user-select: none; }
.sm-chip--check input { position: absolute; opacity: 0; pointer-events: none; }
.sm-chip--check:has(input:checked) { opacity: 1; background: color-mix(in srgb, var(--sm-color) 26%, transparent); border-color: var(--sm-color); }
.sm-chip--check:has(input:checked)::before { box-shadow: 0 0 0 2px var(--sm-surface), 0 0 0 3px var(--sm-color); }
.sm-chip--check:has(input:focus-visible) { outline: 2px solid var(--sm-brand); outline-offset: 2px; }

/* Aktion mit Erklärung links und Knopf rechts */
.sm-action-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.sm-action-row + .sm-action-row { padding-top: 12px; border-top: 1px solid var(--sm-line); }
.sm-code-input { font-family: var(--sm-font-mono); font-size: .8125rem; }
a.sm-chip { text-decoration: none; }
a.sm-chip:hover { border-color: var(--sm-color); color: var(--sm-text); }

/* Wasservergleich: Diagramme */
.sm-wc-chart { position: relative; height: 320px; }
.sm-wc-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--sm-surface) 75%, transparent); color: var(--sm-brand); }
.sm-wc-loading[hidden] { display: none; }
.sm-wc-empty { color: var(--sm-muted); font-size: .875rem; }
.sm-wc-legend { display: inline-flex; gap: 16px; font-size: .8125rem; color: var(--sm-muted); }
.sm-wc-key { display: inline-flex; align-items: center; gap: 6px; }
.sm-wc-key::before { content: ""; width: 18px; height: 0; border-top: 2px solid var(--sm-brand); }
.sm-wc-key--auto::before { border-top: 2px dashed var(--sm-muted); }
.sm-delta { font-family: var(--sm-font-mono); font-variant-numeric: tabular-nums; }

/* Kalender-Einträge */
.sm-cal-event { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sm-cal-event-meta { margin-left: 6px; opacity: .8; font-size: .6875rem; font-family: var(--sm-font-mono); }
/* Terminarten */
.sm-type-preview {
    --sm-color: var(--sm-muted);
    display: inline-flex; align-items: center; gap: 8px;
    padding: 2px 10px 2px 2px; border-radius: var(--sm-radius);
    border: 1px solid color-mix(in srgb, var(--sm-color) 55%, transparent);
    background: color-mix(in srgb, var(--sm-color) 12%, transparent);
    font-size: .8125rem; font-weight: 500; white-space: nowrap;
}
.sm-type-preview > i {
    display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: calc(var(--sm-radius) - 1px);
    background: var(--sm-color); color: #fff; font-size: .75rem;
}
.sm-type-preview-row { display: flex; align-items: center; gap: 12px; }
.sm-color-input { width: 5rem; height: calc(1.5em + .75rem + 2px); padding: 2px; }
.sm-icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.sm-icon-option {
    display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px;
    border: 1px solid var(--sm-line); border-radius: var(--sm-radius); background: var(--sm-surface); color: var(--sm-text);
    font-family: var(--sm-font-mono); font-size: .6875rem; cursor: pointer;
}
.sm-icon-option i { font-size: 1.25rem; }
.sm-icon-option span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sm-icon-option:hover { border-color: var(--sm-brand); }
.sm-icon-option:focus-visible { outline: 2px solid var(--sm-brand); outline-offset: 2px; }
.sm-icon-option.is-active { border-color: var(--sm-brand); background: color-mix(in srgb, var(--sm-brand) 12%, transparent); }
.sm-icon-option[hidden] { display: none; }
/* To-Do */
.sm-todo-add { display: flex; flex-direction: column; gap: 10px; border-bottom: 1px solid var(--sm-line); }
.sm-toolbar--panel { margin: 0; padding: 10px 16px; border-bottom: 1px solid var(--sm-line); }
.sm-todo li { grid-template-columns: 20px minmax(0, 1fr) auto; align-items: center; }
.sm-todo li.sm-todo-empty { display: block; padding: 0; }
.sm-todo li[hidden] { display: none; }
.sm-todo .sm-todo-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 4px; }
.sm-todo-actions { display: flex; gap: 4px; }
.sm-todo-tagedit { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 8px; padding: 8px; border: 1px dashed var(--sm-line-strong); border-radius: var(--sm-radius); }
.sm-todo-tagedit[hidden] { display: none; }
.sm-tag-add { display: grid; grid-template-columns: minmax(0, 1fr) 40px auto; gap: 6px; border-bottom: 1px solid var(--sm-line); }
.sm-tag-manage { list-style: none; margin: 0; padding: 0; }
.sm-tag-manage li { display: flex; align-items: center; gap: 6px; padding: 8px 16px; border-bottom: 1px solid var(--sm-line); }
.sm-tag-manage li:last-child { border-bottom: 0; }
.sm-tag-manage li > input[type="text"] { flex: 1; }
.sm-tag-manage li > input[type="color"] { width: 40px; flex: none; }
.sm-tag-manage-actions { margin-left: auto; display: flex; gap: 4px; }
.sm-tag-manage-empty { color: var(--sm-muted); font-size: .875rem; }

/* Formular-Theme bootstrap_5_layout: Abstände im SwimMonitor-Raster */
.sm-form .mb-3 { margin-bottom: 0 !important; }
.sm-fieldset .form-check { margin-bottom: 4px; }

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}
