body {
    font-family: Arial, sans-serif;
    background-color: #f4f4f4;
    color: #333;
    margin: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.page-content {
    flex: 1 0 auto;
    padding: 20px;
}

.alarm {
    max-width: 600px;
}

.shortid {
    font-size: 1.25em;
}

h1,h2 {
    color: #A72920;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);
}

th, td {
    border: 1px solid #ddd;
    padding: 10px;
    text-align: left;
}

th {
    background-color: #A72920;
    color: white;
}


a {
    color: #337ab7;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.revision {
    background-color: #f9f9f9;
    border-left: 4px solid #515253;
    padding-left: 10px;
}



form {
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}



input#shortid {
    font-size: 1.2rem;
    padding: 12px 24px;
    border: 2px solid #ccc;
    border-radius: 8px;
    text-align: center;
}

button {
    font-size: 1rem;
    padding: 10px 18px;
    border-radius: 8px;
    background-color: #A72920;
    color: white;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

button:hover:not(:disabled) {
    background-color: #8e211a;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Header */

.site-header {
    background: white;
    border-bottom: 3px solid #A72920;
    box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.08);
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.site-header .logo {
    color: #A72920;
    font-size: 1.5rem;
    font-weight: bold;
    text-decoration: none;
}

.site-header .logo:hover {
    text-decoration: none;
}

/* Bereichszusatz im Logo: "Alarmdruck | manage" bzw. "| admin" */
.site-header .brand {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.site-header .logo-sep {
    color: #000;
    font-size: 1.5rem;
    font-weight: bold;
}

.site-header .logo-section {
    color: #777;
    font-size: 1.5rem;
    font-weight: bold;
    text-decoration: none;
}

.site-header .logo-section:hover {
    text-decoration: none;
    color: #555;
}

.site-nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
}

.site-user {
    color: #777;
}

/* Profil-Icon-Menü */
.profile-menu {
    position: relative;
}


.profile-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    min-width: 180px;
    z-index: 200;
    overflow: hidden;
}
/* display:flex nur wenn sichtbar – sonst überschreibt es [hidden]=display:none */
.profile-dropdown:not([hidden]) {
    display: flex;
    flex-direction: column;
}

.profile-name {
    padding: 10px 16px;
    color: #888;
    font-size: 0.88em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

hr.profile-sep {
    margin: 0;
    border: none;
    border-top: 1px solid #eee;
}

.profile-dropdown a {
    padding: 10px 16px;
    color: #333;
    text-decoration: none;
    display: block;
    font-size: 0.95em;
}

.profile-dropdown a:hover {
    background: #f5f5f5;
    text-decoration: none;
}

/* Meldungen */

.error-box {
    background-color: #fdecea;
    border: 1px solid #A72920;
    color: #A72920;
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 16px;
}

/* Karte zur Koordinaten-Auswahl */

.pick-map {
    height: 320px;
    width: 100%;
    border: 1px solid #ccc;
    border-radius: 4px;
}

/* Roter Einsatz-Pin (Inline-SVG divIcon) – ohne weißen Kasten/Rahmen */
.leaflet-div-icon.einsatz-pin {
    background: transparent;
    border: none;
}

/* Einstellungen */

.settings-form select {
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
}

/* Tabellenfilter */

.table-filter {
    flex: 1 1 auto;
    min-width: 120px;
    max-width: 280px;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 1rem;
    box-sizing: border-box;
}

/* Tabs */

.tabs {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 8px;
    margin: 24px 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

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

button.tab-btn {
    font-size: 1rem;
    padding: 10px 20px;
    border-radius: 8px;
    background-color: white;
    color: #333;
    border: 1px solid #ccc;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: color 0.2s ease;
}

button.tab-btn:hover:not(.active) {
    color: #A72920;
    background-color: rgba(0, 0, 0, 0.08);
}

button.tab-btn.active {
    background-color: #A72920;
    border-color: #A72920;
    color: white;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

/* Verwaltung */

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 40px;
    gap: 10px;
}

.section-head h2 {
    margin: 0;
    font-size: 1.2rem;
}

.map-legend {
    display: flex;
    gap: 16px;
    align-items: center;
    font-size: 0.9rem;
    color: #555;
}

.map-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.map-legend-item i {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1px solid #fff;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .15);
    display: inline-block;
}

/* Modal footer — like header style */
.modal-foot {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    padding: 14px 24px;
    border-top: 3px solid #A72920;
    box-shadow: 0px -2px 4px rgba(0, 0, 0, 0.08);
}

.modal-foot button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Zentrale Modal-Formular-Tabelle (manage + auth) */
.modal-th {
    background: #a52a2a;
    color: white;
    padding: 12px;
    text-align: left;
    font-weight: bold;
}

.modal-td {
    padding: 12px;
    border-bottom: 1px solid #ddd;
}

.modal-input {
    width: 100%;
    box-sizing: border-box;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 3px;
}

.modal-input[readonly],
.modal-input:disabled {
    background: #f5f5f5;
    color: #666;
}

.modal-input--mono {
    font-family: monospace;
}

textarea.modal-input {
    min-height: 100px;
    font-family: monospace;
    font-size: 12px;
}

.btn {
    display: inline-block;
    font-size: 1rem;
    padding: 10px 18px;
    border-radius: 8px;
    background-color: #A72920;
    color: white;
    border: none;
    cursor: pointer;
    text-decoration: none;
}

.btn:hover {
    text-decoration: none;
    opacity: 0.9;
}

.btn-secondary {
    background-color: #515253;
}

/* Kleines Chip-Badge für "+ Neu"-Aktionen in Überschriften und Sektions-Köpfen */
.btn-chip {
    display: inline-flex;
    align-items: center;
    padding: 2px 9px;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.5;
    color: #555;
    background: white;
    border: 1.5px solid #bbb;
    border-radius: 20px;
    cursor: pointer;
    text-decoration: none;
    vertical-align: middle;
    white-space: nowrap;
    transition: border-color 0.12s, color 0.12s, background 0.12s;
}
.btn-chip:hover {
    border-color: #A72920;
    color: #A72920;
    background: #fff5f5;
    text-decoration: none;
}

td.actions,
th.actions {
    width: 120px;
    min-width: 120px;
    white-space: nowrap;
    text-align: center;
}

/* Unified icon styles */
a.icon,
button.icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    padding: 6px;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    line-height: 1;
    border-radius: 4px;
    transition: background 0.2s ease, color 0.2s ease;
}

a.icon:hover,
button.icon:hover {
    background: rgba(0, 0, 0, 0.08);
    color: #A72920;
}

/* Standard icons: 16x16 */
a.icon svg,
button.icon svg {
    width: 16px;
    height: 16px;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Header icons: 22x22 */
.site-header a.icon svg,
.site-header button.icon svg {
    width: 22px;
    height: 22px;
}

/* Abweichender Wert der Basis-Revision unterhalb des Felds */
.prev-value {
    display: block;
    font-size: 0.85em;
    color: #666;
    white-space: nowrap;
}

form.inline {
    display: inline;
    width: auto;
    max-width: none;
}

/* Anlage / Bearbeitung (Look & Feel der View-Seite) */

.alarm form {
    max-width: none;
    gap: 0;
}

/* Bearbeitungsseiten (manage/admin): Überschriften am Header ausrichten
   (Logo: 1.5rem) – die View-/Druckansicht bleibt unverändert */
.edit-page h1 {
    font-size: 1.5rem;
}

.edit-page h2 {
    font-size: 1.2rem;
}

.alarm input[type="text"],
.alarm input[type="number"],
.alarm input[type="password"],
.alarm textarea,
.alarm select {
    width: 100%;
    box-sizing: border-box;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: inherit;
    font-size: 1rem;
}

.alarm th {
    width: 160px;
}

.checkbox-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 300px;
    overflow-y: auto;
}

label.checkline {
    display: flex;
    align-items: center;
    gap: 8px;
}

label.checkline input[type="checkbox"] {
    width: auto;
}

/* Entfernung zum Einsatzort in den Auswahllisten (Einsatzmittel/Hydranten) –
   normale Textformatierung wie die übrigen Tabellenzellen */
.item-dist {
    color: inherit;
    font-size: inherit;
}

/* App-Modal (native <dialog>) */
@keyframes dialog-in {
    from { opacity: 0; transform: translateY(-12px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0)     scale(1); }
}
@keyframes dialog-spinner {
    to { transform: rotate(360deg); }
}

dialog.app-dialog {
    border: none;
    border-radius: 10px;
    padding: 0;
    width: min(720px, 94vw);
    max-height: min(96vh, 1100px);
    margin: 2vh auto;
    box-shadow: 0 12px 40px rgba(0,0,0,0.28);
}

/* display:flex NUR wenn Dialog offen – sonst überschreibt es das UA display:none */
dialog.app-dialog[open] {
    display: flex;
    flex-direction: column;
    animation: dialog-in 0.18s ease-out;
}

dialog.app-dialog.wide {
    width: min(960px, 94vw);
}

dialog.app-dialog::backdrop {
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(2px);
}

.dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 3px solid #A72920;
    background: white;
    flex-shrink: 0;
    border-radius: 10px 10px 0 0;
}

.dialog-title {
    font-size: 1.05rem;
    font-weight: bold;
    color: #A72920;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dialog-body {
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 20px;
    flex: 1;
    min-height: 80px;
    background: #f4f4f4;
    border-radius: 0 0 10px 10px;
}

/* Formular-Tabellen im Modal: Breite/Spaltenbreite siehe weiter unten
   (.dialog-body table / .dialog-body table th) – hier nur die Felder. */
.dialog-body input[type="text"],
.dialog-body input[type="number"],
.dialog-body input[type="email"],
.dialog-body input[type="password"],
.dialog-body input[type="url"],
.dialog-body select,
.dialog-body textarea {
    max-width: 100%;
    box-sizing: border-box;
}
.field input[type="text"],
.field input[type="number"],
.field input[type="email"],
.field input[type="password"],
.field input[type="url"],
.field select,
.field textarea,
.dialog-body table td input[type="text"],
.dialog-body table td input[type="number"],
.dialog-body table td input[type="email"],
.dialog-body table td input[type="password"],
.dialog-body table td input[type="url"],
.dialog-body table td select,
.dialog-body table td textarea {
    width: 100%;
    box-sizing: border-box;
}
/* Globales Input/Select Styling */
input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
input[type="url"],
select,
textarea {
    padding: 6px 8px;
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.4;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: white;
}
select {
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 18px;
    padding-right: 32px;
}

/* Auth-/Start-Modals (Login, Passwort ändern, ShortID): schmaler Dialog,
   Formular nutzt die volle Breite, Eingabefelder einheitlich gestaltet. */
dialog.app-dialog.auth-modal {
    width: min(440px, 94vw);
}
.app-dialog.auth-modal .dialog-body form {
    max-width: none;
}
.app-dialog.auth-modal .dialog-body input[type="text"],
.app-dialog.auth-modal .dialog-body input[type="password"] {
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: inherit;
    font-size: 1rem;
    box-sizing: border-box;
}
/* Schmaler Dialog: lange Feldbeschriftungen umbrechen statt überlaufen */
.app-dialog.auth-modal .dialog-body table th {
    white-space: normal;
    width: 42%;
}

.dialog-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 48px 20px;
    color: #888;
    font-size: 0.95rem;
}

.dialog-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 3px solid #ddd;
    border-top-color: #A72920;
    border-radius: 50%;
    animation: dialog-spinner 0.7s linear infinite;
    flex-shrink: 0;
}

/* Mobil: Dialog nutzt fast den gesamten Bildschirm, bleibt vertikal zentriert */
@media (max-width: 600px) {
    dialog.app-dialog,
    dialog.app-dialog.wide {
        width: 98vw;
        max-height: 92vh;
        border-radius: 10px;
        margin: auto;
    }
    .dialog-body {
        padding: 14px;
    }

    /* Formular-Tabellen (Label | Feld) → Label über dem Feld stapeln,
       damit nichts überläuft. Datentabellen (mit <thead>) ausgenommen. */
    .dialog-body table:not(:has(thead)),
    .dialog-body table:not(:has(thead)) tbody,
    .dialog-body table:not(:has(thead)) tr,
    .dialog-body table:not(:has(thead)) th,
    .dialog-body table:not(:has(thead)) td {
        display: block;
        width: 100%;
        box-sizing: border-box;
    }
    .dialog-body table:not(:has(thead)) th {
        white-space: normal;
        border-bottom: none;
        padding-bottom: 2px;
    }
    .dialog-body table:not(:has(thead)) td {
        padding-top: 2px;
    }

    /* Datentabellen (Hydranten/EM-Auswahl, mit <thead>) → innerhalb des
       Dialogs horizontal scrollen statt den ganzen Dialog zu sprengen. */
    .dialog-body table:has(thead) {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
    }
    .dialog-body table:has(thead) th {
        width: auto;
    }
}

/* Kartensuche (Geocoding) im Ortsteil-Formular */
.geo-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.geo-row input[type="text"] {
    flex: 1;
}

.geo-row .btn {
    flex: 0 0 auto;
}

.form-actions {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Meldebild-Vorschläge unterhalb des Textfelds */
#meldebild-vorschlaege {
    margin-top: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.suggestion-item {
    padding: 3px 10px;
    font-size: 0.85em;
    background: var(--color-bg-alt, #f0f0f0);
    border: 1px solid var(--color-border, #ccc);
    border-radius: 12px;
    cursor: pointer;
    white-space: nowrap;
}

.suggestion-item:hover {
    background: var(--color-accent, #3d7fc1);
    color: #fff;
    border-color: transparent;
}

/* Audit-Informationen (Erstellt/Geändert) unterhalb des Formulars – nur für Admins */
.audit-info {
    margin-top: 12px;
    font-size: 0.82em;
    color: #888;
}

th .req {
    margin-left: 2px;
}

.alarm td small {
    display: block;
    margin-top: 4px;
    color: #777;
}

.alarm input:disabled {
    background-color: #eee;
    color: #777;
}

/* Responsive */

.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 700px) {
    .section-head {
        flex-wrap: wrap;
    }

    .page-content {
        padding: 12px;
    }

    .site-header {
        padding: 12px 16px;
    }


    th,
    td {
        padding: 6px;
        font-size: 13px;
    }

    /* Verwaltungstabellen: auf kleinen Screens dynamisch skaliert */
    .table-scroll table {
        min-width: 100%;
        table-layout: auto;
    }

    .table-scroll th,
    .table-scroll td {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 120px;
    }

    /* Formulare: Label über dem Eingabefeld stapeln.
       Nur auf direkte Kind-Tabellen anwenden – innere Tabellen
       (EM-Auswahl, Hydranten) bleiben normale Tabellen. */
    .alarm form > table,
    .alarm form > table > tbody,
    .alarm form > table > tbody > tr,
    .alarm form > table > tbody > tr > th,
    .alarm form > table > tbody > tr > td {
        display: block;
        width: 100%;
        box-sizing: border-box;
    }

    .alarm form > table > tbody > tr > th,
    .alarm form > table > tbody > tr > td {
        border: none;
        text-align: left;
    }

    .alarm form > table > tbody > tr > th {
        padding: 8px 10px 2px 10px;
    }

    .alarm form > table > tbody > tr > td {
        padding: 2px 10px 10px 10px;
    }

    .alarm form > table > tbody > tr {
        border-bottom: 1px solid #ddd;
    }

    .alarm form > table > tbody > tr:last-child {
        border-bottom: none;
    }

    .alarm form > table {
        border: 1px solid #ddd;
    }

}

/* Login / auth card */
.auth-page {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 16px;
}
.auth-card {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 16px rgba(0,0,0,0.10);
    padding: 40px 36px 32px;
    width: 100%;
    max-width: 360px;
}
.auth-card-logo {
    text-align: center;
    margin-bottom: 24px;
}
.auth-card-logo .auth-appname {
    font-size: 1.4rem;
    font-weight: bold;
    color: #A72920;
    display: block;
}
.auth-card-logo .auth-subtitle {
    font-size: 0.82rem;
    color: #888;
    margin-top: 2px;
    display: block;
}
.auth-card .field { margin-bottom: 16px; }
.auth-card .field label { font-size: 13px; font-weight: 600; color: #444; margin-bottom: 5px; display: block; }
.auth-card .field input {
    width: 100%; box-sizing: border-box;
    border: 1px solid #d1d5db; border-radius: 6px;
    padding: 9px 12px; font-size: 14px; color: #333;
    outline: none; transition: border-color .15s;
}
.auth-card .field input:focus { border-color: #A72920; }
.auth-card .form-actions { margin-top: 20px; }
.auth-card .form-actions button {
    width: 100%; padding: 10px;
    background: #A72920; color: #fff;
    border: none; border-radius: 6px;
    font-size: 15px; font-weight: 600;
    cursor: pointer;
}
.auth-card .form-actions button:hover { background: #8e211a; }
.auth-card .flash { margin-bottom: 14px; }

/* Form layout helpers for manage/admin modals */
.field { margin-bottom: 13px; }
.field label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 4px; color: #555; }
.field input[type="text"], .field input[type="password"], .field input[type="email"] { width: 100%; box-sizing: border-box; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid.mt { margin-top: 10px; }
.modal-section-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #888; margin: 18px 0 8px; border-bottom: 1px solid #ddd; padding-bottom: 4px; }
.modal-section-label:first-child { margin-top: 0; }
@media (max-width: 600px) { .form-grid { grid-template-columns: 1fr; } }

.field input.field-has-error, .field select.field-has-error, .field textarea.field-has-error {
    border: 2px solid #dc2626 !important;
    background-color: #fff5f5;
}
.field-error {
    font-size: 12px;
    color: #991b1b;
    font-weight: 600;
    margin-top: 4px;
    display: block;
}

/* firedata modal form tables (alarmdruck-style) */
.dialog-body form {
    display: block;
    max-width: none;
    gap: 0;
}

.dialog-body h2 {
    font-size: 1rem;
    margin: 20px 0 10px 0;
}

.dialog-body table {
    margin-bottom: 16px;
    max-width: 100%;
    box-shadow: none;
}

.dialog-body table th {
    width: 160px;
    white-space: nowrap;
}

.dialog-body table td {
    word-break: break-word;
}

/* Preset sub-tabs — smaller styling */
#preset-tabs .tab-btn {
    padding: 8px 12px;
    font-size: 0.9em;
}

/* Settings Card Layout */
.settings-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.settings-card:hover {
    border-color: #d0d0d0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    transition: all 0.2s ease;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
    cursor: pointer;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    border-radius: 24px;
    transition: 0.3s;
}

.toggle-slider:before {
    position: absolute;
    content: '';
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: 0.3s;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background-color: #A72920;
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(24px);
}


/* Refs Modal — styled to match dialog-modal */
.refs-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fade-in 0.18s ease-out;
}

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

.refs-modal-box {
    background: #f4f4f4;
    width: min(720px, 94vw);
    max-height: min(96vh, 1100px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.28);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.refs-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 3px solid #A72920;
    background: white;
    flex-shrink: 0;
    border-radius: 10px 10px 0 0;
}

.refs-modal-header h2 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: bold;
    color: #A72920;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}


.refs-modal-content {
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 20px;
    flex: 1;
    min-height: 80px;
    background: #f4f4f4;
    border-radius: 0 0 10px 10px;
}

.refs-modal-group {
    margin: 0 0 24px;
}

.refs-modal-group-title {
    margin: 0;
    padding: 16px 0 8px;
    color: #A72920;
    font-size: 1rem;
    font-weight: 600;
}

.refs-modal-table {
    width: 100%;
    border-collapse: collapse;
}

.refs-modal-table th {
    background-color: #A72920;
    color: white;
    padding: 10px 16px;
    text-align: left;
    border: 1px solid #ddd;
}

.refs-modal-table td {
    padding: 10px 16px;
    border-bottom: 1px solid #e8e8e8;
}

.refs-modal-table tr:last-child td {
    border-bottom: none;
}

.refs-modal-empty {
    padding: 20px;
    text-align: center;
    color: #666;
    background: white;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.refs-modal-error {
    padding: 20px;
    color: #c0392b;
    background: #fee2e2;
    border-left: 4px solid #ef4444;
    border-radius: 6px;
}

/* Loading Spinner */
@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #f0f0f0;
    border-top: 2px solid #333;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 8px;
}

.loading-text {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: #666;
    font-style: italic;
}

/* Button Loading State */
button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Flash Messages */
.flash {
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 12px;
    font-size: 0.9rem;
}

.flash.success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.flash.error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.flash.info {
    background: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
}

/* Skeleton Loading */
@keyframes shimmer {
    0% { background-position: -1000px 0; }
    100% { background-position: 1000px 0; }
}

.skeleton-row td {
    padding: 12px !important;
}

.skeleton-cell {
    display: block;
    height: 16px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
    border-radius: 4px;
}
