/*
 * Hotel Touric Portal - Design-System "Clean Dashboard"
 *
 * Wird in jeder Portal-App als ERSTES Stylesheet geladen, danach das
 * App-eigene styles.css (nur noch App-Spezifisches) und app-navigation.css.
 *
 * Bausteine:
 *   .app-shell                Seitenrahmen (max. Breite, Abstaende, vertikales Grid)
 *   .app-topbar               Kopfbereich: Icon, Titel, Untertitel, Aktionen rechts
 *   .kpi-grid > .kpi          Kennzahlen-Kacheln
 *   .box                      Inhalts-Box mit .box__head (Icon, Titel, Beschreibung, Aktionen)
 *                             und .box__body (Inhalt) / .box__body--flush (Tabellen)
 *   .grid .grid--2/3/4        Spaltenraster, .grid--sidebar (320px | 1fr), .grid--main-aside (1fr | 360px)
 *   .toolbar + .field         Filterzeilen mit Label + Eingabe
 *   .btn .btn--primary ...    Buttons (Aliase fuer alte Klassennamen enthalten)
 *   .tabs > .tab              Tab-Leiste
 *   .table                    Datentabellen
 *   .badge, .chip             Status-Marker
 *   .msg .msg--success ...    Hinweise / Meldungen
 *   .empty                    Leerzustand
 *   .modal-backdrop/.modal-card  Dialoge
 */

/* ---------- Tokens ---------- */

:root {
    --bg: #f1f5f9;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --surface-3: #f1f5f9;
    --text: #0f172a;
    --text-2: #334155;
    --muted: #64748b;
    --border: #e2e8f0;
    --border-2: #cbd5e1;

    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-soft: #eef2ff;
    --primary-ring: rgba(79, 70, 229, 0.22);

    --success: #059669;
    --success-soft: #ecfdf5;
    --warning: #d97706;
    --warning-soft: #fffbeb;
    --danger: #dc2626;
    --danger-soft: #fef2f2;
    --info: #0284c7;
    --info-soft: #f0f9ff;
    --violet: #7c3aed;
    --violet-soft: #f5f3ff;
    --pink: #db2777;
    --pink-soft: #fdf2f8;
    --teal: #0d9488;
    --teal-soft: #f0fdfa;
    --slate: #475569;
    --slate-soft: #f1f5f9;

    --radius-lg: 16px;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-pill: 999px;

    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05), 0 1px 3px rgba(15, 23, 42, 0.04);
    --shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
    --shadow-lg: 0 20px 50px rgba(15, 23, 42, 0.16);

    --font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
    --font-mono: "JetBrains Mono", Consolas, "Cascadia Mono", monospace;

    --control-h: 40px;
    --control-h-sm: 34px;

    /* Kompatibilitaet: Variablen aelterer App-Stylesheets */
    --primary-dark: var(--primary-hover);
    --secondary: var(--surface-3);
    --accent: var(--primary);
    --accent-soft: var(--primary-soft);
    --surface-strong: var(--surface);
    --surface-soft: var(--surface-2);
    --border-strong: var(--border-2);
    --shadow-soft: var(--shadow-sm);
    --radius-xs: 6px;
    --primary-berry: var(--primary);
    --secondary-berry: var(--primary-hover);
    --light-berry: #818cf8;
    --accent-green: var(--success);
    --success-green: var(--success);
    --warning-orange: var(--warning);
    --danger-red: var(--danger);
    --dark-gray: var(--text);
    --medium-gray: var(--muted);
    --light-gray: var(--bg);
    --white: var(--surface);
    --border-color: var(--border);
    --shadow-color: rgba(15, 23, 42, 0.08);
}

/* ---------- Basis ---------- */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
    margin: 0;
    color: var(--text);
    letter-spacing: -0.01em;
    line-height: 1.25;
}

h1 { font-size: 1.5rem; font-weight: 700; }
h2 { font-size: 1.05rem; font-weight: 600; }
h3 { font-size: 0.95rem; font-weight: 600; }
h4 { font-size: 0.85rem; font-weight: 600; }

p {
    margin: 0;
}

a {
    color: var(--primary);
}

code, pre, .mono {
    font-family: var(--font-mono);
    font-size: 0.85em;
}

.hidden {
    display: none !important;
}

.muted,
.subtitle,
.helper-note,
.table-hint,
.field-helper,
.save-state,
.card-subtitle {
    color: var(--muted);
    font-size: 0.85rem;
}

.eyebrow,
.panel-kicker,
.section-kicker,
.status-label,
.result-label {
    margin: 0 0 4px;
    color: var(--primary);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

/* ---------- Seitenrahmen ---------- */

.app-shell {
    width: min(1480px, 100%);
    margin: 0 auto;
    padding: 24px 28px 56px;
    display: grid;
    gap: 20px;
    align-content: start;
}

.app-shell--narrow {
    width: min(1100px, 100%);
}

/* ---------- Kopfbereich ---------- */

.app-topbar {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    padding: 4px 0 8px;
    border-bottom: 1px solid var(--border);
}

.app-topbar__icon {
    flex: 0 0 48px;
    width: 48px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
    color: #fff;
    font-size: 1.35rem;
    font-weight: 800;
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.28);
}

.app-topbar__text {
    min-width: 0;
    flex: 1 1 320px;
}

.app-topbar__kicker {
    margin: 0 0 2px;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.app-topbar__title {
    font-size: 1.5rem;
    font-weight: 700;
}

.app-topbar__subtitle {
    margin-top: 2px;
    color: var(--muted);
    font-size: 0.9rem;
}

.app-topbar__actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-left: auto;
}

.app-topbar__meta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    background: var(--surface);
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 500;
}

/* ---------- Kennzahlen ---------- */

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
}

.kpi {
    position: relative;
    padding: 16px 18px 16px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.kpi::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: var(--primary);
}

.kpi--success::before { background: var(--success); }
.kpi--warning::before { background: var(--warning); }
.kpi--danger::before { background: var(--danger); }
.kpi--info::before { background: var(--info); }
.kpi--slate::before { background: var(--slate); }
.kpi--teal::before { background: var(--teal); }

.kpi__label {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.kpi__value {
    margin-top: 6px;
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--text);
    word-break: break-word;
}

.kpi__value--text {
    font-size: 1.05rem;
    line-height: 1.3;
}

.kpi__hint {
    margin-top: 6px;
    color: var(--muted);
    font-size: 0.8rem;
}

/* ---------- Boxen ---------- */

.box {
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.box__head {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
}

.box__icon {
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 1rem;
    font-weight: 700;
}

.box__icon--green { background: var(--success-soft); color: var(--success); }
.box__icon--amber { background: var(--warning-soft); color: var(--warning); }
.box__icon--red { background: var(--danger-soft); color: var(--danger); }
.box__icon--sky { background: var(--info-soft); color: var(--info); }
.box__icon--violet { background: var(--violet-soft); color: var(--violet); }
.box__icon--pink { background: var(--pink-soft); color: var(--pink); }
.box__icon--teal { background: var(--teal-soft); color: var(--teal); }
.box__icon--slate { background: var(--slate-soft); color: var(--slate); }

.box__text {
    min-width: 0;
    flex: 1 1 200px;
}

.box__title {
    font-size: 1rem;
    font-weight: 600;
}

.box__desc {
    margin-top: 2px;
    color: var(--muted);
    font-size: 0.82rem;
}

.box__actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-left: auto;
}

.box__body {
    padding: 20px;
    display: grid;
    gap: 16px;
    align-content: start;
}

.box__body > * {
    min-width: 0;
}

.box__body--flush {
    padding: 0;
    gap: 0;
}

.box__body--tight {
    padding: 14px 20px;
    gap: 12px;
}

.box__foot {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    background: var(--surface-2);
    border-radius: 0 0 var(--radius) var(--radius);
}

.box--accent {
    border-color: rgba(79, 70, 229, 0.3);
    background: linear-gradient(180deg, var(--primary-soft) 0%, var(--surface) 60%);
}

.box--soft {
    box-shadow: none;
    background: var(--surface-2);
}

/* Unter-Box innerhalb einer Box (z. B. Detailkarte) */
.subbox {
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
}

.subbox__title {
    margin-bottom: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

/* ---------- Raster ---------- */

.grid {
    display: grid;
    gap: 20px;
    align-items: start;
}

.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid--sidebar { grid-template-columns: 320px minmax(0, 1fr); }
.grid--main-aside { grid-template-columns: minmax(0, 1fr) 380px; }
.grid--auto { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }

.stack {
    display: grid;
    gap: 12px;
}

.row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.row--between {
    justify-content: space-between;
}

.row--end {
    justify-content: flex-end;
}

.divider {
    height: 1px;
    background: var(--border);
}

/* ---------- Formulare ---------- */

.toolbar {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 12px;
}

.toolbar > .btn {
    margin-bottom: 0;
}

.field {
    display: grid;
    gap: 6px;
    min-width: 0;
}

.field > span,
.field > label,
.field-label {
    color: var(--text-2);
    font-size: 0.78rem;
    font-weight: 600;
}

.field--grow {
    flex: 1 1 240px;
}

.field--inline {
    flex: 0 1 200px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}

.form-grid--2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="color"]),
select,
textarea {
    width: 100%;
    min-height: var(--control-h);
    padding: 8px 12px;
    font: inherit;
    font-size: 0.9rem;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border-2);
    border-radius: var(--radius-sm);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 36px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

select[multiple] {
    background-image: none;
    padding-right: 12px;
    min-height: 120px;
}

textarea {
    min-height: 96px;
    resize: vertical;
    line-height: 1.5;
}

input::placeholder,
textarea::placeholder {
    color: #94a3b8;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-ring);
}

input:disabled,
select:disabled,
textarea:disabled,
input[readonly] {
    background: var(--surface-3);
    color: var(--muted);
}

input[type="checkbox"],
input[type="radio"] {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--primary);
    cursor: pointer;
}

.check,
.check-item,
.checkbox-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-2);
    cursor: pointer;
}

.check-tree,
.check-list {
    display: grid;
    gap: 8px;
}

.check-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    background: var(--surface);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.check-chip:hover {
    border-color: var(--border-2);
    background: var(--surface-2);
}

.check-chip:has(input:checked) {
    border-color: var(--primary);
    background: var(--primary-soft);
    color: var(--primary-hover);
}

/* ---------- Buttons ---------- */

.btn,
button,
.button,
.primary-button,
.secondary-button,
.ghost-button,
.link-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 38px;
    padding: 0 14px;
    font: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border-2);
    border-radius: var(--radius-sm);
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.08s ease;
}

.btn:hover,
button:hover,
.secondary-button:hover {
    background: var(--surface-2);
    border-color: #94a3b8;
}

.btn:active,
button:active {
    transform: translateY(1px);
}

.btn:disabled,
button:disabled,
.btn.is-disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.btn--primary,
.btn-primary,
.primary-button,
.btn-submit,
button.primary,
button[type="submit"]:not(.btn--secondary):not(.btn-secondary):not(.secondary-button):not(.btn--ghost):not(.btn--danger):not(.btn-danger) {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 1px 2px rgba(79, 70, 229, 0.3);
}

.btn--primary:hover,
.btn-primary:hover,
.primary-button:hover,
.btn-submit:hover,
button.primary:hover,
button[type="submit"]:not(.btn--secondary):not(.btn-secondary):not(.secondary-button):not(.btn--ghost):not(.btn--danger):not(.btn-danger):hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    color: #fff;
}

.btn--secondary,
.btn-secondary,
.secondary-button,
.btn-cancel,
button.secondary {
    background: var(--surface);
    border-color: var(--border-2);
    color: var(--text);
}

.btn--ghost,
.ghost-button,
.link-button,
.ghost-link {
    background: transparent;
    border-color: transparent;
    color: var(--primary);
}

.btn--ghost:hover,
.ghost-button:hover,
.link-button:hover,
.ghost-link:hover {
    background: var(--primary-soft);
    border-color: transparent;
    color: var(--primary-hover);
}

.btn--danger,
.btn-danger,
button.danger {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
}

.btn--danger:hover,
.btn-danger:hover,
button.danger:hover {
    background: #b91c1c;
    border-color: #b91c1c;
    color: #fff;
}

.btn--danger-soft {
    background: var(--danger-soft);
    border-color: transparent;
    color: var(--danger);
}

.btn--danger-soft:hover {
    background: #fee2e2;
    border-color: transparent;
}

.btn--success,
.btn-success {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}

.btn--success:hover,
.btn-success:hover {
    background: #047857;
    border-color: #047857;
    color: #fff;
}

.btn--sm,
.btn-sm {
    min-height: 32px;
    padding: 0 10px;
    font-size: 0.8rem;
}

.btn--lg {
    min-height: 44px;
    padding: 0 20px;
    font-size: 0.95rem;
}

.btn--icon,
.icon-button {
    width: 36px;
    min-height: 36px;
    padding: 0;
    border-radius: var(--radius-sm);
}

.btn--block,
.btn-block,
.full-width {
    width: 100%;
}

.btn__icon {
    font-size: 1rem;
    line-height: 1;
}

/* ---------- Tabs ---------- */

.tabs,
.tab-bar {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 4px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-3);
}

.tab,
.tab-button {
    min-height: 34px;
    padding: 0 14px;
    border: none;
    border-radius: 7px;
    background: transparent;
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 600;
    box-shadow: none;
}

.tab:hover,
.tab-button:hover {
    background: rgba(255, 255, 255, 0.7);
    color: var(--text);
    border-color: transparent;
}

.tab.is-active,
.tab-button.is-active,
.tab.active,
.tab-button.active {
    background: var(--surface);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.tab__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: var(--radius-pill);
    background: var(--surface-3);
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 700;
}

.tab.is-active .tab__count {
    background: var(--primary-soft);
    color: var(--primary);
}

/* ---------- Tabellen ---------- */

.table-wrap,
.table-container,
.table-scroll {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

table thead th {
    padding: 10px 16px;
    text-align: left;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

table tbody td {
    padding: 11px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    color: var(--text-2);
}

table tbody tr:last-child td {
    border-bottom: none;
}

table tbody tr:hover > td {
    background: var(--surface-2);
}

table tbody tr.is-selected > td,
table tbody tr.selected > td {
    background: var(--primary-soft);
}

td.num,
th.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.table--compact thead th,
.table--compact tbody td {
    padding: 7px 10px;
}

/* ---------- Badges / Chips ---------- */

.badge,
.pill,
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 22px;
    padding: 2px 9px;
    border-radius: var(--radius-pill);
    background: var(--surface-3);
    color: var(--text-2);
    font-size: 0.74rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
}

.badge--primary { background: var(--primary-soft); color: var(--primary); }
.badge--success, .badge.success, .badge-success { background: var(--success-soft); color: var(--success); }
.badge--warning, .badge.warning, .badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge--danger, .badge.danger, .badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge--info, .badge.info, .badge-info { background: var(--info-soft); color: var(--info); }
.badge--violet { background: var(--violet-soft); color: var(--violet); }

.badge__dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 11px;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    background: var(--surface);
    color: var(--text-2);
    font-size: 0.8rem;
    font-weight: 500;
}

.chip.is-active,
.chip--active {
    border-color: var(--primary);
    background: var(--primary-soft);
    color: var(--primary-hover);
}

.count-bubble {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    border-radius: var(--radius-pill);
    background: var(--primary);
    color: #fff;
    font-size: 0.74rem;
    font-weight: 700;
}

/* ---------- Meldungen ---------- */

.msg,
.message,
.feedback,
.alert {
    display: block;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-left-width: 4px;
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text-2);
    font-size: 0.875rem;
}

.msg--success, .message-success, .message.success, .feedback-success, .alert-success, .is-success {
    border-color: rgba(5, 150, 105, 0.35);
    border-left-color: var(--success);
    background: var(--success-soft);
    color: #065f46;
}

.msg--error, .msg--danger, .message-error, .message.error, .feedback-error, .alert-error, .alert-danger, .is-error {
    border-color: rgba(220, 38, 38, 0.35);
    border-left-color: var(--danger);
    background: var(--danger-soft);
    color: #991b1b;
}

.msg--warning, .message-warning, .message.warning, .alert-warning {
    border-color: rgba(217, 119, 6, 0.35);
    border-left-color: var(--warning);
    background: var(--warning-soft);
    color: #92400e;
}

.msg--info, .message-info, .message.info, .alert-info {
    border-color: rgba(2, 132, 199, 0.35);
    border-left-color: var(--info);
    background: var(--info-soft);
    color: #075985;
}

/* ---------- Leerzustand ---------- */

.empty,
.empty-state {
    display: grid;
    justify-items: center;
    gap: 6px;
    padding: 36px 20px;
    text-align: center;
    color: var(--muted);
    font-size: 0.9rem;
    border: 1px dashed var(--border-2);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
}

.empty__icon {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: var(--surface-3);
    color: var(--muted);
    font-size: 1.3rem;
}

.empty__title {
    font-weight: 600;
    color: var(--text-2);
}

/* ---------- Listen-Karten ---------- */

.list {
    display: grid;
    gap: 10px;
}

.list-item,
.result-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.list-item:hover,
.result-item:hover {
    border-color: var(--border-2);
    box-shadow: var(--shadow-sm);
}

.list-item.is-active,
.result-item.is-active,
.result-item.active {
    border-color: var(--primary);
    background: var(--primary-soft);
}

.list-item__body {
    min-width: 0;
    flex: 1 1 auto;
}

.list-item__title {
    font-weight: 600;
    color: var(--text);
}

.list-item__meta {
    margin-top: 2px;
    color: var(--muted);
    font-size: 0.8rem;
}

/* ---------- Definitionen (Label: Wert) ---------- */

.dl {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: 6px 16px;
    margin: 0;
    font-size: 0.875rem;
}

.dl dt {
    color: var(--muted);
    font-weight: 500;
}

.dl dd {
    margin: 0;
    color: var(--text);
    font-weight: 500;
    word-break: break-word;
}

/* ---------- Dialoge ---------- */

.modal-backdrop,
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 6000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(3px);
}

.modal-card {
    width: min(720px, 100%);
    max-height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.modal-card--sm { width: min(480px, 100%); }
.modal-card--lg { width: min(960px, 100%); }

.modal-card__head,
.modal-head,
.modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.modal-card__head h3,
.modal-head h3,
.modal-header h3 {
    font-size: 1.05rem;
    font-weight: 600;
}

.modal-card__head .btn--icon,
.modal-head .ghost-button,
.modal-header .close-btn {
    margin-left: auto;
}

.modal-card__body,
.modal-body {
    padding: 20px;
    overflow-y: auto;
    display: grid;
    gap: 16px;
    align-content: start;
}

.modal-card__foot,
.modal-actions,
.modal-footer {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    background: var(--surface-2);
}

dialog.modal {
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: min(560px, calc(100% - 40px));
}

dialog.modal::backdrop {
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(3px);
}

/* ---------- Ladeanzeige ---------- */

.spinner,
.loading-spinner {
    width: 22px;
    height: 22px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-row {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--muted);
    font-size: 0.875rem;
}

/* ---------- Sonstiges ---------- */

::selection {
    background: var(--primary-soft);
}

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

img,
iframe {
    max-width: 100%;
}

pre.code,
.code-block {
    margin: 0;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    background: #0f172a;
    color: #e2e8f0;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    line-height: 1.55;
    overflow-x: auto;
}

kbd {
    padding: 2px 6px;
    border: 1px solid var(--border-2);
    border-bottom-width: 2px;
    border-radius: 5px;
    background: var(--surface-2);
    font-family: var(--font-mono);
    font-size: 0.75rem;
}

.progress {
    height: 8px;
    border-radius: var(--radius-pill);
    background: var(--surface-3);
    overflow: hidden;
}

.progress > span {
    display: block;
    height: 100%;
    background: var(--primary);
    border-radius: inherit;
}

/* ---------- Responsive ---------- */

@media (max-width: 1100px) {
    .grid--3,
    .grid--4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .grid--sidebar,
    .grid--main-aside {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 768px) {
    .app-shell {
        padding: 16px 14px 48px;
        gap: 14px;
    }

    .app-topbar {
        align-items: flex-start;
    }

    .app-topbar__actions {
        width: 100%;
        margin-left: 0;
    }

    .app-topbar__actions .btn,
    .app-topbar__actions button {
        flex: 1 1 auto;
    }

    .grid--2,
    .grid--3,
    .grid--4,
    .grid--auto,
    .form-grid,
    .form-grid--2 {
        grid-template-columns: minmax(0, 1fr);
    }

    .kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .box__head {
        padding: 12px 16px;
    }

    .box__body {
        padding: 16px;
    }

    .box__actions {
        width: 100%;
        margin-left: 0;
    }

    .toolbar {
        flex-direction: column;
        flex-wrap: nowrap;
        align-items: stretch;
    }

    .toolbar .field,
    .toolbar .btn,
    .toolbar button {
        width: 100%;
        flex: 0 0 auto;
    }

    .tabs,
    .tab-bar {
        width: 100%;
    }

    .tab,
    .tab-button {
        flex: 1 1 auto;
        text-align: center;
    }

    .modal-backdrop,
    .modal-overlay {
        padding: 0;
        align-items: flex-end;
    }

    .modal-card {
        width: 100%;
        max-height: 94vh;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    }

    .modal-card__foot,
    .modal-footer,
    .modal-actions {
        position: sticky;
        bottom: 0;
    }

    .modal-card__foot .btn,
    .modal-footer .btn,
    .modal-actions .btn {
        flex: 1 1 45%;
    }

    .dl {
        grid-template-columns: minmax(0, 1fr);
        gap: 2px;
    }

    .dl dt {
        margin-top: 8px;
    }
}

@media (max-width: 480px) {
    .kpi-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .app-topbar__title {
        font-size: 1.3rem;
    }
}
