/*
 * EuroDB - Stylesheet
 *
 * Alle Bedienelemente (Buttons, Felder, Listen, Dialoge) nutzen dieselben
 * Grundwerte (Farben, Radius, Hoehe, Abstaende) aus :root.
 *
 * Farben: alle Text-/Hintergrund-Kombinationen erreichen mindestens
 * WCAG AA (4,5:1 fuer Text, 3:1 fuer Rahmen von Bedienelementen).
 */
:root {
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

    --text: #1f2937;          /* 14.7:1 auf Weiss */
    --text-muted: #4b5563;    /*  7.6:1 auf Weiss */
    --placeholder: #6b7280;   /*  4.8:1 auf Weiss */
    --accent: #1765b3;        /*  5.9:1 auf Weiss */
    --accent-hover: #0f4c8a;
    --accent-soft: #e8f0fa;   /* Hintergrund fuer aktive/markierte Elemente */
    --header: #17324f;        /* Kopfzeile, weisse Schrift 12.9:1 */
    --danger: #b3261e;        /*  6.5:1 auf Weiss */
    --danger-hover: #8c1d17;
    --danger-soft: #fdecea;
    --success: #1e7b34;       /*  5.3:1 (weisse Schrift darauf) */

    --bg: #f3f4f6;            /* Seitenhintergrund */
    --card: #ffffff;
    --surface: #f6f7f9;       /* Listeneintraege, Kopfzeilen */
    --surface-hover: #eceef2;
    --border: #d9dce1;        /* Trennlinien */
    --border-strong: #8a8f98; /* Rahmen von Feldern/Buttons, 3.3:1 */

    --radius: 6px;
    --radius-sm: 4px;
    --control-h: 2.5rem;      /* einheitliche Hoehe fuer Buttons und Felder */
    --gap: .75rem;
    --shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 1px 3px rgba(0, 0, 0, .1);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, .2);
    --focus: 0 0 0 3px rgba(23, 101, 179, .35);
}

*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: var(--font);
    color: var(--text);
    font-size: 1rem;          /* 16px Grundschrift */
    line-height: 1.5;
    background-color: var(--bg);
}

img {
    max-width: 100%;
}

h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: .25rem 0 .75rem;
}
h2 {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text);
    margin: .25rem 0 1rem;
    padding-bottom: .4rem;
    border-bottom: 2px solid var(--accent);
}
small {font-size: .85rem;}
b, strong {font-weight: 600;}

a {
    color: var(--accent);
}
a:hover {
    color: var(--accent-hover);
}

::placeholder {
    color: var(--placeholder);
    opacity: 1;
}

/* Einheitlicher Fokusrahmen fuer alles, was per Tastatur erreichbar ist */
:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
}

.muted {
    color: var(--text-muted);
}

/* Nur fuer Screenreader sichtbar */
.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ICONS (css/icons.svg, Lucide) - Farbe kommt von der Textfarbe */
svg.icon {
    width: 1.15em;
    height: 1.15em;
    flex: none;
    vertical-align: -.2em;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/** FLEX **/
.flex-container {
    display: flex;
    flex-flow: row wrap;
    gap: .5rem;
}

/* =========================================================
   LAYOUT
   ========================================================= */
div.maincontainer {
    width: calc(100% - 32px);
    max-width: 1400px;
    margin: 20px auto;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    grid-template-areas:
        "header header"
        "navi   content"
        "footer footer";
}

div.header {
    grid-area: header;
    background: var(--header);
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .9rem 1.25rem;
}
div.header .site-title {
    font-size: 1.6rem;
    font-weight: 600;
    line-height: 1.2;
}
svg.icon-logo {
    width: 2.2rem;
    height: 2.2rem;
    stroke-width: 1.75;
}

.navi {
    grid-area: navi;
    padding: 1rem .5rem;
    border-right: 1px solid var(--border);
    background: var(--surface);
}
.navi ul + ul {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}
.navi ul li a {
    display: flex;
    align-items: center;
    gap: .6rem;
    min-height: var(--control-h);
    margin: 2px 0;
    padding: .4rem .75rem;
    color: var(--text-muted);
    font-weight: 500;
    text-decoration: none;
    border-radius: var(--radius);
}
.navi ul li a:hover {
    color: var(--text);
    background: var(--surface-hover);
}
.navi ul li a[aria-current="page"] {
    color: var(--accent);
    background: var(--accent-soft);
    font-weight: 600;
}

div.content {
    grid-area: content;
    min-width: 0;             /* breite Tabellen nicht ueber den Rand druecken */
    padding: 1.25rem 1.5rem;
}
div.footer {
    grid-area: footer;
    padding: .6rem 1.25rem;
    border-top: 1px solid var(--border);
    background: var(--surface);
}
div.footer p {
    color: var(--text-muted);
    font-size: .8rem;
    line-height: 1.4;
}

/* Leiste mit Buttons (und Filterfeld) ueber Listen */
.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
    margin: 0 0 1rem;
}
.toolbar .filter-field {
    margin-left: auto;
}

/* =========================================================
   LOGIN
   ========================================================= */
div#login-container {
    width: calc(100% - 32px);
    max-width: 440px;
    margin: 60px auto 0;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}
div#login-container div#login-header {
    background: var(--header);
}
div#login-container h1 {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin: 0;
    padding: 1rem 1.5rem;
    color: #ffffff;
    font-size: 1.4rem;
}
div#login-container p {
    margin: 0 0 .75rem;
}
div.login-form {
    padding: 1.5rem;
}
div#login-container div.login-button {
    margin-top: 1rem;
}

/* =========================================================
   BUTTONS
   .btn ist die Grundform; .jqbutton und .ui-button sind alte
   Namen dafuer und sehen genauso aus.
   ========================================================= */
.btn, .jqbutton, .ui-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    min-height: var(--control-h);
    padding: .4rem 1rem;
    margin: 0;
    font: inherit;
    font-size: .95rem;
    font-weight: 500;
    line-height: 1.2;
    color: var(--text);
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
    background: var(--card);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    cursor: pointer;
    transition: background-color .15s, border-color .15s, color .15s;
}
.btn:hover, .jqbutton:hover, .ui-button:hover {
    color: var(--text);
    background: var(--surface-hover);
}
.btn:disabled {
    opacity: .55;
    cursor: not-allowed;
}
.btn-primary {
    color: #ffffff;
    background: var(--accent);
    border-color: var(--accent);
}
.btn-primary:hover {
    color: #ffffff;
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}
.btn-danger, .jqbutton.danger-button, .ui-button.danger-button {
    color: #ffffff;
    background: var(--danger);
    border-color: var(--danger);
}
.btn-danger:hover, .jqbutton.danger-button:hover, .ui-button.danger-button:hover {
    color: #ffffff;
    background: var(--danger-hover);
    border-color: var(--danger-hover);
}
.btn-small {
    min-height: 2rem;
    padding: .25rem .65rem;
    font-size: .85rem;
}
.btn-block {
    display: flex;
    width: 100%;
    margin-bottom: .5rem;
}

/* Quadratischer Button nur mit Icon (Bearbeiten, Loeschen, ...) */
.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    margin: 0;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    text-decoration: none;
    transition: background-color .15s, color .15s;
}
.icon-button:hover {
    color: var(--text);
    background: var(--surface-hover);
    border-color: var(--border);
}
.icon-button-danger:hover {
    color: var(--danger);
    background: var(--danger-soft);
    border-color: transparent;
}
.icon-button svg.icon {
    width: 1.1rem;
    height: 1.1rem;
    vertical-align: 0;
}

/* =========================================================
   FORMULARFELDER (ueberall gleich, auch ausserhalb von .stdForm)
   ========================================================= */
:where(input:not([type=checkbox]):not([type=radio]):not([type=hidden]):not([type=file]):not([type=submit]):not([type=button]), select, textarea) {
    min-height: var(--control-h);
    padding: .4rem .6rem;
    font: inherit;
    font-size: 1rem;
    color: var(--text);
    background: var(--card);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
}
:where(input, select, textarea):focus {
    border-color: var(--accent);
    box-shadow: var(--focus);
    outline: none;
}
:where(select[multiple]) {
    min-height: 8rem;
}
input[type=checkbox], input[type=radio] {
    width: 1.1rem;
    height: 1.1rem;
    accent-color: var(--accent);
    vertical-align: middle;
}

form.stdForm label {
    display: block;
    font-size: .9rem;
    font-weight: 500;
    margin: .6rem 0 .25rem;
    color: var(--text-muted);
}
form.stdForm label:first-child {
    margin-top: 0;
}
form.stdForm input:not([type=checkbox]):not([type=radio]):not([type=hidden]), form.stdForm select {
    display: block;
    width: 100%;
    max-width: 100%;
    margin-bottom: .25rem;
}
form.stdForm input[aria-invalid="true"] {
    border-color: var(--danger);
}
form.stdForm input[type=file], form.stdForm input[type=submit] {
    width: auto;
}
form.stdForm input[type=checkbox] {
    margin: 0 .4rem 0 0;
}
form.stdForm label.remember-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    margin: 1rem 0 0;
}
form.stdForm button[type=submit] {
    margin-top: .75rem;
}
form.stdForm.settings-form {
    max-width: 400px;
}

/* Filterfeld mit Icon */
.filter-field {
    position: relative;
    display: inline-flex;
    align-items: center;
}
.filter-field label {
    position: absolute;
    left: .6rem;
    color: var(--text-muted);
    display: flex;
}
.filter-field input {
    padding-left: 2.1rem;
    width: 16rem;
    max-width: 100%;
}

/* =========================================================
   MELDUNGEN
   ========================================================= */
p.error {
    color: var(--danger);
    background: var(--danger-soft);
    border-left: 4px solid var(--danger);
    padding: .5rem .75rem;
    margin: 0 0 1rem !important;
    font-weight: 600;
    border-radius: var(--radius-sm);
}
p.message {
    background-color: var(--accent-soft);
    border-left: 4px solid var(--accent);
    border-radius: var(--radius-sm);
    padding: .5rem .75rem;
    margin: 0 0 1rem;
}
.error-heading {
    color: var(--danger);
    border-color: var(--danger);
}

/* Schwebende Meldungen unten rechts (werden von Screenreadern vorgelesen) */
#MessageArea {
    position: fixed;
    right: 16px;
    bottom: 16px;
    left: 16px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    z-index: 2000;
    pointer-events: none;
}
#MessageArea .message {
    max-width: 420px;
    width: 100%;
    padding: .75rem 1rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    color: #ffffff;
    font-weight: 600;
    pointer-events: auto;
}
#MessageArea .message-success {
    background-color: var(--success);
}
#MessageArea .message-error {
    background-color: var(--danger);
}

/* =========================================================
   LISTEN, KARTEN, CHIPS, BADGES
   ========================================================= */
/* Liste aus Zeilen mit Titel, Zahl und Aktionen (Gruppen, Keywords, ...) */
.card-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: .4rem;
}
.card-list-item {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .5rem .5rem .5rem .9rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.card-list-item:hover {
    background: var(--surface);
}
.card-list-title {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
    overflow-wrap: anywhere;
}
.card-list-title:hover {
    color: var(--accent);
    text-decoration: underline;
}
.card-list-actions {
    margin-left: auto;
    display: flex;
    gap: .25rem;
}

.badge {
    display: inline-block;
    min-width: 1.6rem;
    padding: .05rem .5rem;
    font-size: .8rem;
    font-weight: 600;
    text-align: center;
    color: var(--text-muted);
    background: var(--surface-hover);
    border-radius: 999px;
}

/* Chips: Gruppen und Keywords einer Person, Untergruppen */
.chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    margin-bottom: .75rem;
}
.chip {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    min-height: 2rem;
    padding: .2rem .35rem .2rem .7rem;
    font-size: .9rem;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    text-decoration: none;
}
a.chip {
    padding-right: .8rem;
}
.chip a {
    color: inherit;
    text-decoration: none;
}
.chip a:hover, a.chip:hover {
    color: var(--accent);
    text-decoration: underline;
}
.chip-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    padding: 0;
    color: var(--text-muted);
    background: transparent;
    border: 0;
    border-radius: 999px;
    cursor: pointer;
}
.chip-remove:hover {
    color: var(--danger);
    background: var(--danger-soft);
}
.chip-remove svg.icon {
    width: 1rem;
    height: 1rem;
    vertical-align: 0;
}

/* Brotkrumen (uebergeordnete Gruppen) */
.group-block {
    margin-bottom: 1rem;
}
.breadcrumb {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .25rem;
    margin-top: .25rem;
}
.breadcrumb li + li::before {
    content: "\203A";         /* einfacher Pfeil › */
    color: var(--text-muted);
    margin: 0 .35rem 0 .1rem;
}
.breadcrumb a {
    font-weight: 600;
    text-decoration: none;
}
.breadcrumb a:hover {
    text-decoration: underline;
}

/* =========================================================
   PERSON: Rufnummern, E-Mail, Anschriften
   ========================================================= */
div.attrib-box {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 1rem;
    padding: 1rem;
}
/* Rufnummern und E-Mail nebeneinander, auf schmalen Bildschirmen untereinander */
div.attrib-box#rufnummern-box,
div.attrib-box#email-box {
    float: left;
    width: calc(50% - .5rem);
}
div.attrib-box#email-box {
    margin-left: 1rem;
}
div.attrib-box h3 {
    color: var(--text-muted);
    font-size: .8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-bottom: .75rem;
}

h2.PersonName {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
}
h2.PersonName small {
    color: var(--text-muted);
    font-weight: 400;
}
h2.PersonName small.birthdate {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    font-size: .95rem;
}

/* Datumsfeld mit Leeren-Button */
.date-field {
    display: flex;
    align-items: center;
    gap: .35rem;
}
form.stdForm .date-field input[type=date] {
    flex: 1 1 auto;
    margin-bottom: 0;
}
input[type=date] {
    font-variant-numeric: tabular-nums;
}

span.Typbeschreibung {
    display: inline-block;
    padding: 0 .45rem;
    font-size: .75rem;
    font-weight: 600;
    color: var(--accent);
    background: var(--accent-soft);
    border-radius: 999px;
    vertical-align: middle;
}

div.ActionBox {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
    margin-top: .5rem;
}
.sort-hint {
    color: var(--text-muted);
    font-size: .8rem;
}

ul.emailList, ul.rufnummernList {
    list-style: none;
}
ul.emailList li,
ul.rufnummernList li {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .35rem .35rem .35rem .4rem;
    margin-bottom: .4rem;
    background: var(--surface);
    border: 1px solid transparent;
    border-radius: var(--radius);
    cursor: move;             /* Eintraege lassen sich per Ziehen sortieren */
}
ul.emailList li:hover,
ul.rufnummernList li:hover {
    border-color: var(--border);
    background: var(--surface-hover);
}
ul.emailList li p,
ul.rufnummernList li p {
    flex: 1 1 auto;
    min-width: 0;
    font-weight: 600;
    color: var(--text);
    overflow-wrap: anywhere;
}
ul.emailList li a {
    color: var(--text);
}
ul.emailList li a:hover {
    color: var(--accent);
}
svg.drag-handle {
    color: var(--placeholder);
}
div.deleter {
    display: flex;
    gap: .15rem;
    flex: none;
}

.AdressList {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: .75rem;
}
.AdressList li {
    position: relative;
    padding: .75rem;
    padding-right: 5rem;
    background: var(--surface);
    border: 1px solid transparent;
    border-radius: var(--radius);
    cursor: move;
}
.AdressList li:hover {
    border-color: var(--border);
}
.AdressList li p {
    font-weight: 600;
    line-height: 1.4;
}
.AdressList li span.Typbeschreibung {
    margin-bottom: .4rem;
}
.AdressList li div.deleter {
    position: absolute;
    top: .5rem;
    right: .5rem;
}
.AdressList li .watchInMaps {
    margin-top: .6rem;
}

textarea#PersonKommentarText {
    display: block;
    height: 200px;
    width: 100%;
}

/* GEFAEHRLICHE AKTIONEN */
.danger-zone {
    margin-top: 2rem;
    padding: 1rem;
    border: 1px solid var(--danger);
    border-radius: var(--radius);
    background: var(--danger-soft);
}
.danger-zone p {
    color: var(--text);
    font-size: .9rem;
    margin-bottom: .75rem;
}

/* =========================================================
   RICH-TEXT-EDITOR (Quill)
   ========================================================= */
.ql-toolbar.ql-snow, .ql-container.ql-snow {
    border-color: var(--border-strong);
}
.ql-toolbar.ql-snow {
    border-radius: var(--radius) var(--radius) 0 0;
    background: var(--surface);
    font-family: var(--font);
}
.ql-container.ql-snow {
    border-radius: 0 0 var(--radius) var(--radius);
    font: inherit;
    margin-bottom: .75rem;
}
.richtext-editor .ql-editor {
    min-height: 180px;
    font-size: 1rem;
    line-height: 1.5;
}
.ql-snow .ql-toolbar button:focus-visible, .ql-toolbar.ql-snow button:focus-visible,
.ql-editor:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 1px;
}

/* =========================================================
   TABELLEN (Suchergebnisse, Personenlisten)
   ========================================================= */
table.SearchResultTable {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 .4rem;
}
table.SearchResultTable tr td {
    background: var(--surface);
    padding: .5rem .9rem;
    vertical-align: middle;
    border-top: 1px solid transparent;
    border-bottom: 1px solid transparent;
}
table.SearchResultTable tr td:first-child {
    border-radius: var(--radius) 0 0 var(--radius);
    font-weight: 600;
}
table.SearchResultTable tr td:last-child {
    border-radius: 0 var(--radius) var(--radius) 0;
    text-align: right;
}
table.SearchResultTable tr td a {
    color: var(--text);
}
table.SearchResultTable tr td a:hover {
    color: var(--accent);
}
table.SearchResultTable tr td a.btn {
    color: var(--text);
}
table.SearchResultTable tr:hover td {
    background: var(--surface-hover);
}
td.row-actions {
    white-space: nowrap;
}
td.row-actions .btn + .btn {
    margin-left: .35rem;
}

/* =========================================================
   STARTSEITE
   ========================================================= */
.frontpage-birthday-item {
    display: flex;
    align-items: flex-start;
    gap: .6rem;
    flex: 1 0 14rem;
    padding: .75rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.frontpage-birthday-item a {
    font-weight: 600;
    text-decoration: none;
}
.frontpage-birthday-item a:hover {
    text-decoration: underline;
}
svg.birthday-icon {
    width: 1.5rem;
    height: 1.5rem;
    color: var(--accent);
}

/* =========================================================
   SUCHE
   ========================================================= */
div.search-start {
    max-width: 500px;
    margin: 3rem auto 0;
}
input.search-input {
    font-size: 1.1rem !important;
}
form.search-inline {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    align-items: center;
    margin-bottom: 1rem;
}
form.search-inline input.search-input {
    flex: 1 1 250px;
    max-width: 450px;
    margin: 0;
}
form.search-inline button[type=submit] {
    margin-top: 0;
}

/* Erweiterte Suche: Sortieroptionen im Export */
li.sort-option {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .3rem .3rem .3rem .75rem;
    margin-bottom: .3rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: move;
}
li.sort-option .deletesortopt {
    margin-left: auto;
}
.ui-state-default {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

/* =========================================================
   DIALOGE (natives <dialog>, siehe js/ui.js)
   ========================================================= */
dialog.ui-dlg {
    width: min(600px, calc(100vw - 32px));
    max-height: calc(100vh - 32px);
    padding: 0;
    color: var(--text);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    display: none;
    flex-direction: column;
}
dialog.ui-dlg[open] {
    display: flex;
}
dialog.ui-dlg::backdrop {
    background: rgba(17, 24, 39, .45);
}
.ui-dlg-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    padding: .6rem .6rem .6rem 1rem;
    border-bottom: 1px solid var(--border);
}
.ui-dlg-title {
    margin: 0;
    padding: 0;
    border: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
}
.ui-dlg-body {
    padding: 1rem;
    overflow: auto;
    flex: 1 1 auto;
}
.ui-dlg-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: .5rem;
    padding: .75rem 1rem;
    border-top: 1px solid var(--border);
    background: var(--surface);
}
.ui-dlg .confirm-name {
    font-weight: 600;
}

/* =========================================================
   ACCORDION (siehe js/ui.js)
   ========================================================= */
.ui-acc {
    margin: 1rem 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.ui-acc > h3 {
    margin: 0;
}
.ui-acc > h3 + .ui-acc-panel + h3 .ui-acc-head,
.ui-acc > .ui-acc-panel + h3 .ui-acc-head {
    border-top: 1px solid var(--border);
}
.ui-acc-head {
    display: flex;
    align-items: center;
    gap: .5rem;
    width: 100%;
    min-height: var(--control-h);
    padding: .6rem 1rem;
    font: inherit;
    font-weight: 600;
    text-align: left;
    color: var(--text);
    background: var(--surface);
    border: 0;
    cursor: pointer;
}
.ui-acc-head:hover {
    background: var(--surface-hover);
}
.ui-acc-head svg.icon {
    color: var(--text-muted);
    transition: transform .15s;
}
.ui-acc-head[aria-expanded="true"] svg.icon {
    transform: rotate(90deg);
}
.ui-acc-panel {
    padding: 1rem;
    border-top: 1px solid var(--border);
}

/* =========================================================
   AUTOCOMPLETE (siehe js/ui.js)
   ========================================================= */
.ui-ac-wrap {
    position: relative;
    display: block;
}
.ui-ac-list {
    position: absolute;
    left: 0;
    right: 0;
    z-index: 10;
    max-height: 220px;
    overflow: auto;
    margin: 2px 0 0;
    padding: .25rem;
    list-style: none;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}
.ui-ac-list li {
    padding: .4rem .6rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
}
.ui-ac-list li:hover, .ui-ac-list li[aria-selected="true"] {
    background: var(--accent);
    color: #ffffff;
}

/* SORTIEREN (SortableJS) */
.sortable-ghost, .ui-state-highlight {
    opacity: .5;
    background: var(--accent-soft) !important;
    border: 1px dashed var(--accent) !important;
}

/* =========================================================
   SCHMALE BILDSCHIRME (Tablet hochkant, Smartphone)
   ========================================================= */
@media (max-width: 800px) {
    div.maincontainer {
        width: 100%;
        margin: 0;
        border: none;
        border-radius: 0;
        box-shadow: none;
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            "header"
            "navi"
            "content"
            "footer";
    }
    div.header {
        padding: .6rem 1rem;
    }
    div.header .site-title {
        font-size: 1.3rem;
    }
    svg.icon-logo {
        width: 1.8rem;
        height: 1.8rem;
    }
    /* Navigation als umbrechende Leiste */
    .navi {
        border-right: 0;
        border-bottom: 1px solid var(--border);
        padding: .4rem;
        display: flex;
        flex-wrap: wrap;
    }
    .navi ul {
        display: flex;
        flex-wrap: wrap;
    }
    .navi ul + ul {
        margin: 0;
        padding: 0;
        border: 0;
    }
    .navi ul li a {
        margin: 2px;
        padding: .35rem .6rem;
    }
    div.content {
        padding: 1rem;
    }
    div.attrib-box#rufnummern-box,
    div.attrib-box#email-box {
        float: none;
        width: auto;
        margin-left: 0;
    }
    .toolbar .filter-field {
        margin-left: 0;
        width: 100%;
    }
    .filter-field input {
        width: 100%;
    }
    table.SearchResultTable tr td {
        display: block;
        text-align: left !important;
        border-radius: 0 !important;
    }
    table.SearchResultTable tr td:first-child {
        border-radius: var(--radius) var(--radius) 0 0 !important;
    }
    table.SearchResultTable tr td:last-child {
        border-radius: 0 0 var(--radius) var(--radius) !important;
        padding-top: 0;
    }
    div#login-container {
        margin-top: 16px;
    }
}
