/* ===================================================================
   Taubenhilfe · Mitgliederbereich — Designsystem 2.0
   Dark-first, ruhig, hochwertig. Ein Akzent (Indigo), feine Borders.
   =================================================================== */

/* ---------- Tokens: Dark (Default) ---------- */
:root {
    /* Flächen */
    --bg:            #08080b;
    --bg-soft:       #0c0c10;
    --surface:       #131318;
    --surface-2:     #191920;
    --surface-3:     #21212a;
    --surface-hover: #1d1d25;

    /* Linien & Text */
    --border:        rgba(255,255,255,.07);
    --border-strong: rgba(255,255,255,.13);
    --text:          #f4f4f6;
    --text-dim:      #a0a0ab;
    --text-faint:    #888891;  /* war #6a6a76 – 3,5:1, jetzt ≥ 4,5:1 */

    /* Akzent (Indigo) */
    --accent:        #6f5bff;
    --accent-hover:  #7d6cff;
    --accent-press:  #5d49e6;
    --accent-soft:   rgba(111,91,255,.16);
    --accent-text:   #b6abff;

    /* Sekundär (Teal) – für Manager-Kompatibilität & Akzente */
    --teal:          #2dd4bf;
    --teal-soft:     rgba(45,212,191,.14);

    /* Semantik */
    --success:       #34d399;  --success-soft: rgba(52,211,153,.14);
    --danger:        #fb6f74;  --danger-soft:  rgba(251,111,116,.14);
    --warning:       #fbbf24;  --warning-soft: rgba(251,191,36,.14);

    /* Schatten */
    --shadow-sm: 0 1px 2px rgba(0,0,0,.45);
    --shadow-md: 0 12px 34px rgba(0,0,0,.5);
    --shadow-lg: 0 30px 70px rgba(0,0,0,.62);
    --ring: 0 0 0 4px var(--accent-soft);

    --radius:    16px;
    --radius-sm: 11px;
    --radius-xs: 8px;
    --radius-pill: 999px;

    color-scheme: dark;
}

/* ---------- Tokens: Light (Override) ---------- */
[data-theme="light"] {
    --bg:            #f6f7f9;
    --bg-soft:       #ffffff;
    --surface:       #ffffff;
    --surface-2:     #f4f5f7;
    --surface-3:     #eceef1;
    --surface-hover: #f4f5f7;

    --border:        rgba(9,9,11,.09);
    --border-strong: rgba(9,9,11,.16);
    --text:          #17171b;
    --text-dim:      #5a5a66;
    --text-faint:    #6a6a73;  /* war #9a9aa6 – 2,8:1, jetzt ≥ 4,5:1 */

    --accent:        #5b46f0;
    --accent-hover:  #4d3ae0;
    --accent-press:  #4231cc;
    --accent-soft:   rgba(91,70,240,.10);
    --accent-text:   #4d3ae0;

    --teal:          #0d9488;  --teal-soft: rgba(13,148,136,.12);
    --success:       #04825b;  --success-soft: rgba(5,150,105,.12);
    --danger:        #e11d48;  --danger-soft:  rgba(225,29,72,.10);
    --warning:       #ab5e05;  --warning-soft: rgba(217,119,6,.12);

    --shadow-sm: 0 1px 2px rgba(15,23,42,.06);
    --shadow-md: 0 12px 30px rgba(15,23,42,.10);
    --shadow-lg: 0 28px 60px rgba(15,23,42,.16);

    color-scheme: light;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    background-image:
        radial-gradient(900px 500px at 88% -8%, rgba(111,91,255,.10), transparent 60%),
        radial-gradient(800px 500px at 0% 0%, rgba(45,212,191,.06), transparent 55%);
    background-attachment: fixed;
    color: var(--text);
    line-height: 1.55;
    letter-spacing: -0.011em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    padding: 22px 22px 72px;
    min-height: 100vh;
    transition: background-color .3s ease, color .3s ease;
}
.container { max-width: 1060px; margin: 0 auto; }
.container.narrow { max-width: 760px; }
a { color: var(--accent-text); text-decoration: none; }
::selection { background: var(--accent-soft); }

h1, h2, h3 { letter-spacing: -0.02em; line-height: 1.2; }

/* Sichtbarer Fokus (Tastatur) */
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--radius-xs); }

/* ---------- Header ---------- */
.app-header {
    display: flex; align-items: center; justify-content: space-between;
    gap: 14px; margin-bottom: 30px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
    width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
    font-size: 1.25rem; background: linear-gradient(150deg, var(--surface-3), var(--surface-2));
    border: 1px solid var(--border-strong); box-shadow: var(--shadow-sm); flex-shrink: 0;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text .b-title { font-size: 1.02rem; font-weight: 700; }
.brand-text .b-sub { font-size: .76rem; color: var(--text-faint); font-weight: 500; }

.header-actions { display: flex; align-items: center; gap: 8px; }

.icon-btn {
    width: 40px; height: 40px; border-radius: 11px; border: 1px solid var(--border);
    background: var(--surface); color: var(--text-dim); font-size: 1.05rem; cursor: pointer;
    display: grid; place-items: center; transition: .18s; flex-shrink: 0;
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); background: var(--surface-hover); }

.user-chip {
    display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 14px;
    border-radius: var(--radius-pill); background: var(--surface); border: 1px solid var(--border);
    font-weight: 600; font-size: .88rem; color: var(--text); cursor: pointer; transition: .18s;
}
.user-chip:hover { border-color: var(--border-strong); background: var(--surface-hover); }
.user-chip .avatar {
    width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
    font-size: .76rem; font-weight: 700; color: #fff; flex-shrink: 0;
    background: linear-gradient(150deg, var(--accent), var(--accent-press));
}
.user-chip .uname { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Buttons ---------- */
.btn {
    appearance: none; border: 1px solid transparent; cursor: pointer; font-family: inherit;
    font-weight: 600; font-size: .92rem; border-radius: var(--radius-xs); padding: 10px 16px;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    transition: .16s ease; line-height: 1; white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 1px 0 rgba(255,255,255,.08) inset, var(--shadow-sm); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--border-strong); background: var(--surface-hover); }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--border); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn-lg { padding: 13px 20px; font-size: .98rem; border-radius: var(--radius-sm); }
.btn-block { width: 100%; }

.btn-mini {
    padding: 7px 11px; border-radius: var(--radius-xs); border: 1px solid var(--border);
    background: var(--surface); color: var(--text-dim); font-weight: 600; font-size: .82rem;
    cursor: pointer; transition: .15s; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px;
}
.btn-mini:hover { border-color: var(--border-strong); color: var(--text); background: var(--surface-hover); }
.btn-mini.danger:hover { border-color: var(--danger); color: var(--danger); background: var(--danger-soft); }

/* ---------- Cards / surfaces ---------- */
.card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.card-pad { padding: 24px; }

/* ---------- Login ---------- */
.login-wrap { min-height: calc(100vh - 120px); display: grid; place-items: center; }
.login-card {
    width: 100%; max-width: 410px; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 38px 34px; box-shadow: var(--shadow-lg);
    animation: rise .4s cubic-bezier(.2,.8,.2,1);
}
.login-logo {
    width: 56px; height: 56px; border-radius: 16px; margin: 0 auto 18px; display: grid; place-items: center;
    font-size: 1.7rem; background: linear-gradient(150deg, var(--surface-3), var(--surface-2));
    border: 1px solid var(--border-strong); box-shadow: var(--shadow-md);
}
.login-card h1 { text-align: center; font-size: 1.5rem; margin-bottom: 6px; }
.login-card .sub { text-align: center; color: var(--text-dim); font-size: .92rem; margin-bottom: 26px; }
.login-error, .form-error {
    display: none; align-items: center; gap: 9px; background: var(--danger-soft); color: var(--danger);
    border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent);
    padding: 11px 14px; border-radius: var(--radius-xs); font-size: .88rem; font-weight: 600; margin-bottom: 16px;
}
.login-error.show, .form-error.show { display: flex; animation: rise .25s ease; }
.form-ok {
    display: none; align-items: center; gap: 9px; background: var(--success-soft); color: var(--success);
    border: 1px solid color-mix(in srgb, var(--success) 40%, transparent);
    padding: 11px 14px; border-radius: var(--radius-xs); font-size: .88rem; font-weight: 600; margin-bottom: 16px;
}
.form-ok.show { display: flex; animation: rise .25s ease; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.input-group { margin-bottom: 16px; }
label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 7px; color: var(--text-dim); }
input, select, textarea {
    width: 100%; padding: 12px 13px; border: 1px solid var(--border); border-radius: var(--radius-xs);
    font-family: inherit; font-size: .94rem; background: var(--surface-2); color: var(--text);
    transition: .15s; line-height: 1.4;
}
input::placeholder, textarea::placeholder { color: var(--text-faint); }
input:hover, select:hover, textarea:hover { border-color: var(--border-strong); }
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--accent); background: var(--surface); box-shadow: var(--ring);
}
textarea { resize: vertical; }
/* Vereinslogo in Kopfzeile und Login (ersetzt das 🕊️-Kästchen) */
.brand-logo { height: 42px; width: auto; display: block; flex-shrink: 0; }
.login-logo-bild { display: block; width: 170px; max-width: 55%; height: auto; margin: -8px auto 14px; }
/* Handy: unter 16px zoomt iOS beim Antippen ins Feld; Knöpfe fingergerecht */
@media (max-width: 600px) { input, select, textarea { font-size: 16px; } }
@media (pointer: coarse), (max-width: 600px) { .btn, .btn-mini { min-height: 44px; } .btn-mini { min-width: 44px; } }
select { appearance: none; background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='none' stroke='%23a0a0ab' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m3 5 4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 13px center; padding-right: 36px; }
.hint { font-size: .8rem; color: var(--text-faint); margin-top: 7px; }

/* Toggle / Switch */
.switch { display: inline-flex; align-items: center; gap: 11px; cursor: pointer; user-select: none; font-weight: 600; font-size: .9rem; color: var(--text); }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track {
    width: 42px; height: 24px; border-radius: 999px; background: var(--surface-3);
    border: 1px solid var(--border-strong); position: relative; transition: .2s; flex-shrink: 0;
}
.switch .track::after {
    content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%;
    background: var(--text-dim); transition: .2s;
}
.switch input:checked + .track { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .track::after { transform: translateX(18px); background: #fff; }

/* ---------- Page intro ---------- */
.page-intro { margin-bottom: 26px; }
.page-intro h2 { font-size: 1.55rem; }
.page-intro p { color: var(--text-dim); margin-top: 6px; font-size: .95rem; }

/* ---------- Hub (Modulauswahl) ---------- */
.hub-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.module-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 24px; position: relative; overflow: hidden; isolation: isolate;
    transition: transform .2s cubic-bezier(.2,.8,.2,1), border-color .2s, box-shadow .2s;
    display: flex; flex-direction: column; min-height: 184px; text-decoration: none; color: inherit;
}
.module-card .m-icon {
    width: 48px; height: 48px; border-radius: 13px; display: grid; place-items: center; font-size: 1.55rem;
    background: var(--surface-2); border: 1px solid var(--border); margin-bottom: 16px;
    transition: .2s;
}
.module-card .m-name { font-size: 1.18rem; font-weight: 700; }
.module-card .m-desc { font-size: .9rem; color: var(--text-dim); margin-top: 5px; }
.module-card .m-foot { margin-top: auto; padding-top: 16px; display: flex; align-items: center; }
.module-card .go { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; font-size: .9rem; color: var(--accent-text); }
.module-card .go svg { transition: transform .2s; }

.module-card.is-open { cursor: pointer; }
.module-card.is-open:hover { transform: translateY(-4px); border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.module-card.is-open:hover .m-icon { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.module-card.is-open:hover .go svg { transform: translateX(3px); }
.module-card.is-locked, .module-card.is-soon { opacity: .72; }
.module-card.is-locked .m-icon, .module-card.is-soon .m-icon { filter: grayscale(.5); opacity: .8; }

.module-card.is-admin .m-icon { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.module-card.is-admin .go { color: var(--accent-text); }

/* Statusanzeigen */
.state {
    display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 600;
    padding: 4px 10px; border-radius: var(--radius-pill); border: 1px solid var(--border);
}
.state .dot { width: 7px; height: 7px; border-radius: 50%; }
.state-soon   { color: var(--warning); background: var(--warning-soft); border-color: transparent; }
.state-soon .dot { background: var(--warning); }
.state-locked { color: var(--text-faint); background: var(--surface-2); }
.state-locked .dot { background: var(--text-faint); }

/* ---------- Account / Konto ---------- */
.account-head { display: flex; align-items: center; gap: 18px; margin-bottom: 4px; }
.account-avatar {
    width: 66px; height: 66px; border-radius: 20px; display: grid; place-items: center; flex-shrink: 0;
    font-size: 1.5rem; font-weight: 700; color: #fff;
    background: linear-gradient(150deg, var(--accent), var(--accent-press)); box-shadow: var(--shadow-md);
}
.account-head .a-name { font-size: 1.3rem; font-weight: 700; }
.account-head .a-meta { color: var(--text-dim); font-size: .9rem; margin-top: 3px; }
.detail-row { display: flex; justify-content: space-between; gap: 16px; padding: 13px 0; border-top: 1px solid var(--border); font-size: .92rem; }
.detail-row:first-of-type { border-top: 0; }
.detail-row .k { color: var(--text-dim); }
.detail-row .v { font-weight: 600; text-align: right; }
.section-label { font-size: .78rem; text-transform: uppercase; letter-spacing: .07em; color: var(--text-faint); font-weight: 700; margin: 26px 0 14px; }

/* ---------- Table (Verwaltung) ---------- */
.table-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.table-toolbar { display: flex; gap: 12px; align-items: center; padding: 16px; flex-wrap: wrap; border-bottom: 1px solid var(--border); }
.search-field { position: relative; flex: 1; min-width: 200px; }
.search-field svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-faint); pointer-events: none; }
.search-field input { padding-left: 38px; }
.table-scroll { overflow-x: auto; }
table.members { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.members th, table.members td { padding: 14px 18px; text-align: left; white-space: nowrap; }
table.members thead th {
    font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint);
    font-weight: 700; background: var(--surface-2); border-bottom: 1px solid var(--border);
}
table.members tbody tr { border-bottom: 1px solid var(--border); transition: background .12s; }
table.members tbody tr:last-child { border-bottom: 0; }
table.members tbody tr:hover { background: var(--surface-hover); }
table.members .name-cell { font-weight: 600; }
table.members .sub { color: var(--text-faint); font-weight: 400; font-size: .82rem; margin-top: 2px; }
.row-actions { display: flex; gap: 7px; justify-content: flex-end; }
.cell-id { display: flex; align-items: center; gap: 11px; }
.mini-avatar {
    width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0;
    font-size: .78rem; font-weight: 700; color: #fff; background: linear-gradient(150deg, var(--accent), var(--accent-press));
}

/* ---------- Badges / chips ---------- */
.badge {
    display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: var(--radius-pill);
    font-size: .74rem; font-weight: 700; line-height: 1.6; border: 1px solid transparent;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; }
.badge-admin  { background: var(--accent-soft); color: var(--accent-text); }
.badge-member { background: var(--surface-3); color: var(--text-dim); }
.badge-on     { background: var(--success-soft); color: var(--success); }
.badge-on .dot { background: var(--success); }
.badge-off    { background: var(--danger-soft); color: var(--danger); }
.badge-off .dot { background: var(--danger); }
.badge-muted  { background: var(--surface-2); color: var(--text-dim); border-color: var(--border); }
.mod-chips { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- Berechtigungs-Liste ---------- */
.perm-list { display: flex; flex-direction: column; gap: 9px; }
.perm-item {
    display: flex; align-items: center; gap: 13px; padding: 13px 15px; border-radius: var(--radius-sm);
    border: 1px solid var(--border); background: var(--surface-2); cursor: pointer; transition: .15s;
}
.perm-item:hover { border-color: var(--border-strong); }
.perm-item:has(input:checked) { border-color: color-mix(in srgb, var(--accent) 55%, transparent); background: var(--accent-soft); }
.perm-item input { position: absolute; opacity: 0; }
.perm-item .check {
    width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--border-strong);
    display: grid; place-items: center; flex-shrink: 0; transition: .15s; color: transparent;
}
.perm-item:has(input:checked) .check { background: var(--accent); border-color: var(--accent); color: #fff; }
.perm-item .p-icon { font-size: 1.1rem; }
.perm-item .p-name { font-weight: 600; }
.perm-item .p-soon { font-size: .75rem; color: var(--warning); font-weight: 700; margin-left: auto; text-transform: uppercase; letter-spacing: .04em; }

/* ---------- Modal ---------- */
.modal {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,.6);
    backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); z-index: 100; padding: 20px;
}
.modal.open { display: block; animation: fade .2s ease; }
.modal-content {
    background: var(--surface); width: 100%; max-width: 540px; margin: 5vh auto; padding: 28px;
    border-radius: var(--radius); position: relative; max-height: 88vh; overflow-y: auto;
    box-shadow: var(--shadow-lg); border: 1px solid var(--border-strong);
    animation: rise .28s cubic-bezier(.2,.8,.2,1);
}
.modal-content h2 { font-size: 1.35rem; margin-bottom: 6px; padding-right: 40px; }
.modal-content .modal-sub { color: var(--text-dim); font-size: .9rem; margin-bottom: 22px; }
.close-btn {
    position: absolute; top: 18px; right: 18px; width: 34px; height: 34px; border-radius: 9px;
    display: grid; place-items: center; font-size: 20px; cursor: pointer; color: var(--text-dim);
    background: var(--surface-2); border: 1px solid var(--border); transition: .15s;
}
.close-btn:hover { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.modal-section-title { font-size: .76rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); font-weight: 700; margin: 22px 0 12px; }

/* ---------- Toasts ---------- */
.toast-wrap { position: fixed; bottom: 22px; right: 22px; z-index: 9999; display: flex; flex-direction: column; gap: 11px; }
.toast {
    min-width: 250px; max-width: 380px; padding: 14px 16px; border-radius: var(--radius-sm);
    background: var(--surface-2); color: var(--text); box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-strong); border-left: 3px solid var(--accent);
    display: flex; align-items: center; gap: 11px; font-weight: 600; font-size: .9rem;
    animation: slideIn .3s cubic-bezier(.2,.8,.2,1);
}
.toast.leaving { animation: slideOut .3s forwards ease; }
.toast-success { border-left-color: var(--success); }
.toast-error { border-left-color: var(--danger); }
.toast-icon { font-size: 1.1rem; }

/* ---------- Empty state ---------- */
.empty-state { text-align: center; padding: 54px 20px; color: var(--text-dim); }
.empty-state .emoji { font-size: 2.4rem; display: block; margin-bottom: 12px; opacity: .6; }

/* ---------- Animations ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideIn { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: none; } }
@keyframes slideOut { to { opacity: 0; transform: translateX(40px); } }

/* ---------- Responsive ---------- */
@media (max-width: 620px) {
    body { padding: 16px 15px 80px; }
    .form-grid { grid-template-columns: 1fr; }
    .user-chip .uname { display: none; }
    .user-chip { padding: 5px; }
    .brand-text .b-sub { display: none; }
    .modal-content { padding: 22px; margin: 3vh auto; }
    .page-intro h2 { font-size: 1.35rem; }
    .toast-wrap { left: 15px; right: 15px; bottom: 15px; }
    .toast { max-width: none; }
}

/* Schließen-Knopf ist jetzt ein echter <button> (Tastatur, Screenreader) –
   Browser-Standardstil zurücksetzen, damit er aussieht wie vorher. */
button.close-btn { font-family: inherit; line-height: 1; padding: 0; -webkit-appearance: none; appearance: none; }
