/* Meet — Cal.com-Look: dunkelgrau/schwarz mit Weiß, clean, minimal.
   Dunkel ist Default; hell folgt dem Systemtheme oder data-theme="light". */

:root {
    --bg: #0f0f0f;
    --bg-elev: #171717;
    --surface: #1c1c1c;
    --surface-hover: #242424;
    --border: #2b2b2b;
    --border-strong: #3a3a3a;
    --text: #f3f4f6;
    --text-muted: #9ca3af;
    --text-faint: #6b7280;
    --primary: #ffffff;
    --primary-text: #111111;
    --primary-hover: #e5e5e5;
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, .12);
    --success: #22c55e;
    --success-bg: rgba(34, 197, 94, .12);
    --info: #60a5fa;
    --info-bg: rgba(96, 165, 250, .12);
    --warn: #f59e0b;
    --warn-bg: rgba(245, 158, 11, .12);
    --focus: rgba(255, 255, 255, .35);
    --radius: 8px;
    --radius-lg: 12px;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    color-scheme: dark;
}

@media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]) {
        --bg: #f5f5f5;
        --bg-elev: #ffffff;
        --surface: #ffffff;
        --surface-hover: #f5f5f5;
        --border: #e5e5e5;
        --border-strong: #d4d4d4;
        --text: #111111;
        --text-muted: #6b7280;
        --text-faint: #9ca3af;
        --primary: #111111;
        --primary-text: #ffffff;
        --primary-hover: #2a2a2a;
        --focus: rgba(17, 17, 17, .25);
        --shadow: 0 1px 2px rgba(0, 0, 0, .06);
        color-scheme: light;
    }
}

:root[data-theme="light"] {
    --bg: #f5f5f5;
    --bg-elev: #ffffff;
    --surface: #ffffff;
    --surface-hover: #f5f5f5;
    --border: #e5e5e5;
    --border-strong: #d4d4d4;
    --text: #111111;
    --text-muted: #6b7280;
    --text-faint: #9ca3af;
    --primary: #111111;
    --primary-text: #ffffff;
    --primary-hover: #2a2a2a;
    --focus: rgba(17, 17, 17, .25);
    --shadow: 0 1px 2px rgba(0, 0, 0, .06);
    color-scheme: light;
}

/* --- Basis ------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 1.5rem; font-weight: 600; }
h2 { font-size: 1.15rem; font-weight: 600; }
h3 { font-size: 1rem; font-weight: 600; }
p { margin: 0 0 1rem; }
a { color: inherit; }
code, pre { font-family: var(--mono); font-size: .9em; }
pre { white-space: pre-wrap; word-break: break-word; }
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.text-center { text-align: center; }
.link-muted { color: var(--text-muted); text-decoration: none; }
.link-muted:hover { color: var(--text); text-decoration: underline; }
.stack > * + * { margin-top: 1rem; }
.row { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap; }

/* --- Auth-Layout ------------------------------------------------------ */
.auth-wrap {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    gap: 1.5rem;
}
.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow);
}
.auth-card h1 { font-size: 1.25rem; margin-bottom: 1.25rem; }
.brand { display: flex; align-items: center; gap: .6rem; margin-bottom: 1.5rem; font-weight: 600; }
.brand-mark {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: 8px;
    background: var(--primary); color: var(--primary-text); font-weight: 700;
}
.brand-name { font-size: 1.05rem; }

/* --- Formulare -------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: .35rem; }
.field label { font-size: .875rem; font-weight: 500; }
.field .hint { font-size: .8rem; color: var(--text-muted); }
input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="url"], input[type="tel"], select, textarea {
    width: 100%;
    font: inherit;
    color: var(--text);
    background: var(--bg-elev);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    padding: .55rem .75rem;
    transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--text-muted);
    box-shadow: 0 0 0 3px var(--focus);
}
textarea { min-height: 6rem; resize: vertical; }
.code-input { font-family: var(--mono); font-size: 1.25rem; letter-spacing: .3em; text-align: center; }
.checkbox { display: flex; align-items: center; gap: .5rem; font-size: .9rem; }

/* --- Buttons ---------------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    font: inherit; font-weight: 500; font-size: .9rem;
    padding: .55rem 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--border-strong);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--surface-hover); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus); }
.btn-primary { background: var(--primary); color: var(--primary-text); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn-danger:hover { background: var(--danger-bg); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-hover); }
.btn-sm { padding: .35rem .7rem; font-size: .8rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* --- Alerts ----------------------------------------------------------- */
.alert {
    padding: .7rem .9rem;
    border-radius: var(--radius);
    border: 1px solid transparent;
    font-size: .9rem;
    margin-bottom: 1rem;
}
.alert-error { background: var(--danger-bg); border-color: var(--danger); }
.alert-success { background: var(--success-bg); border-color: var(--success); }
.alert-info { background: var(--info-bg); border-color: var(--info); }
.alert-warn { background: var(--warn-bg); border-color: var(--warn); }

/* --- Karten & Tabellen ------------------------------------------------ */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
}
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { text-align: left; padding: .6rem .5rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { font-weight: 500; color: var(--text-muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }
.table tr:last-child td { border-bottom: none; }
.badge {
    display: inline-block; padding: .1rem .5rem; border-radius: 999px;
    font-size: .75rem; font-weight: 500; border: 1px solid var(--border-strong); color: var(--text-muted);
}
.badge-success { color: var(--success); border-color: var(--success); }
.badge-danger { color: var(--danger); border-color: var(--danger); }

/* --- Fehlerseite ------------------------------------------------------ */
.error-page { text-align: center; }
.error-code { font-size: 3rem; font-weight: 700; color: var(--text-faint); margin: 0; }
.error-details {
    text-align: left; font-size: .75rem; background: var(--bg-elev);
    border: 1px solid var(--border); border-radius: var(--radius); padding: .75rem; margin-top: 1.5rem;
    max-height: 40vh; overflow: auto;
}

/* --- Footer ----------------------------------------------------------- */
.legal { display: flex; gap: 1rem; font-size: .8rem; }
.legal a { color: var(--text-faint); text-decoration: none; }
.legal a:hover { color: var(--text-muted); }

/* --- App-Layout: Topbar, Subnav, Container ---------------------------- */
.topbar { background: var(--bg-elev); border-bottom: 1px solid var(--border); }
.topbar-inner, .subnav-inner, .container {
    max-width: 1080px; margin: 0 auto; padding: 0 1.25rem;
}
.topbar-inner { display: flex; align-items: center; gap: 1.5rem; height: 56px; }
.topbar .brand { margin: 0; text-decoration: none; }
.nav { display: flex; gap: .25rem; flex: 1; }
.nav-link, .subnav-link {
    padding: .4rem .7rem; border-radius: var(--radius); text-decoration: none;
    color: var(--text-muted); font-size: .9rem; font-weight: 500;
}
.nav-link:hover, .subnav-link:hover { background: var(--surface-hover); color: var(--text); }
.nav-link.is-active, .subnav-link.is-active { color: var(--text); background: var(--surface-hover); }
.topbar-user { display: flex; align-items: center; gap: .75rem; font-size: .9rem; }
.topbar-user form { margin: 0; }
.subnav { background: var(--bg-elev); border-bottom: 1px solid var(--border); }
.subnav-inner { display: flex; gap: .25rem; height: 44px; align-items: center; overflow-x: auto; }
.container { padding-top: 2rem; padding-bottom: 3rem; }
.page-head { margin-bottom: 1.5rem; }
.page-head h1 { margin-bottom: .25rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.stat { display: flex; flex-direction: column; gap: .25rem; }
.stat-value { font-size: 2rem; font-weight: 600; line-height: 1; }
.stat-label { color: var(--text-muted); font-size: .85rem; }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1rem; margin: 0; font-size: .9rem; }
.dl dt { color: var(--text-muted); }
.dl dd { margin: 0; }
ul.plain { margin: 0; padding-left: 1.1rem; }
.layout-app .legal, .layout-admin .legal { justify-content: center; padding-bottom: 1.5rem; }
@media (max-width: 640px) {
    .topbar-inner { gap: .75rem; }
    .topbar-user .muted { display: none; }
}

/* --- 2FA / Profil ----------------------------------------------------- */
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.qr-wrap { display: flex; justify-content: center; padding: 1rem; background: #fff; border-radius: var(--radius); }
.qr-wrap img, .qr-wrap canvas { display: block; }
.secret-key { font-size: .95rem; letter-spacing: .05em; word-break: break-all; }
.code-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; }
.code-list code { font-size: 1rem; }
details > summary { list-style: none; cursor: pointer; width: fit-content; }
details > summary::-webkit-details-marker { display: none; }
select { appearance: auto; }
.text-danger { color: var(--danger); }

/* --- Admin-Tabellen ------------------------------------------------- */
.card-link { text-decoration: none; color: inherit; transition: border-color .15s; }
.card-link:hover { border-color: var(--border-strong); }
.nowrap { white-space: nowrap; }
.lang-table input, .lang-table textarea { font-size: .85rem; padding: .35rem .5rem; }
.lang-table tr.has-override td:first-child { border-left: 3px solid var(--success); }
.audit-details { font-size: .75rem; margin: .4rem 0 0; max-width: 480px; }
input[type="search"] { width: 100%; font: inherit; color: var(--text); background: var(--bg-elev); border: 1px solid var(--border-strong); border-radius: var(--radius); padding: .55rem .75rem; }

/* --- Einstellungen ------------------------------------------------- */
.setting { padding: .9rem 0; border-bottom: 1px solid var(--border); }
.setting:last-of-type { border-bottom: none; }
.setting-head { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: .35rem; }
.setting-head label { font-weight: 500; }
.setting-inherited { font-size: .8rem; color: var(--text-muted); }
.setting.is-overridden .setting-head label::after { content: " ●"; color: var(--success); font-size: .7em; }
.setting .hint { font-size: .8rem; color: var(--text-muted); margin: 0 0 .4rem; }
[data-inherit-disabled] { opacity: .45; pointer-events: none; }
.reminders { display: flex; flex-direction: column; gap: .5rem; align-items: flex-start; }
.reminder-row { gap: .5rem; }
.tabs { display: flex; gap: .25rem; margin-bottom: 1rem; border-bottom: 1px solid var(--border); }
.tab { padding: .5rem .8rem; text-decoration: none; color: var(--text-muted); font-size: .9rem; font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--text); border-bottom-color: var(--text); }

/* --- Kalender / Tagesansicht -------------------------------------- */
.color-dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%; }
.color-picker { gap: .4rem; }
.color-option input { position: absolute; opacity: 0; width: 0; height: 0; }
.color-option span { display: inline-block; width: 26px; height: 26px; border-radius: 50%; background: var(--c); border: 2px solid transparent; cursor: pointer; box-shadow: 0 0 0 1px var(--border-strong); }
.color-option input:checked + span { border-color: var(--text); box-shadow: 0 0 0 2px var(--bg); }
.day-card { padding: 0; overflow: hidden; }
.day-grid { position: relative; height: 1440px; }
.day-hour { position: absolute; left: 0; right: 0; height: 60px; border-top: 1px solid var(--border); }
.day-hour span { position: absolute; left: 8px; top: -.55rem; font-size: .7rem; color: var(--text-faint); background: var(--surface); padding: 0 2px; }
.day-now { position: absolute; left: 56px; right: 0; border-top: 2px solid var(--danger); z-index: 3; }
.day-block { position: absolute; border-radius: 6px; background: color-mix(in srgb, var(--c) 22%, var(--surface)); border-left: 3px solid var(--c); padding: 2px 6px; overflow: hidden; font-size: .75rem; line-height: 1.25; z-index: 2; }
.day-block-time { display: block; color: var(--text-muted); }
.day-block-title { display: block; font-weight: 500; }
.day-allday { display: inline-block; margin: .2rem .4rem .2rem 0; padding: .15rem .5rem; border-radius: 999px; background: color-mix(in srgb, var(--c) 22%, var(--surface)); border-left: 3px solid var(--c); font-size: .8rem; }

/* --- Verfügbarkeit --------------------------------------------------- */
.week { display: flex; flex-direction: column; gap: .4rem; }
.weekday { display: grid; grid-template-columns: 110px 1fr auto; gap: .5rem; align-items: start; padding: .5rem 0; border-bottom: 1px solid var(--border); }
.weekday:last-child { border-bottom: none; }
.weekday-name { font-weight: 500; padding-top: .45rem; }
.weekday-windows { display: flex; flex-direction: column; gap: .4rem; }
.window-row { gap: .4rem; }
.window-row input[type="time"] { max-width: 120px; }
input[type="time"], input[type="date"] { font: inherit; color: var(--text); background: var(--bg-elev); border: 1px solid var(--border-strong); border-radius: var(--radius); padding: .45rem .6rem; }
@media (max-width: 640px) { .weekday { grid-template-columns: 1fr; } }

/* --- Meeting-Typen --------------------------------------------------- */
.et-card { border-left: 4px solid var(--c); }
.et-card.is-muted { opacity: .6; }
.card-inline { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); padding: .6rem; display: flex; flex-direction: column; gap: .4rem; }
input[type="color"] { width: 42px; height: 38px; padding: 2px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--bg-elev); }
[hidden] { display: none !important; }
.card-inline.is-linked { border-color: var(--success); }
.card-inline input[readonly] { opacity: .75; }
.card-inline .row > input[type="text"] { flex: 1 1 180px; min-width: 180px; }
.card-inline textarea, .card-inline .row > textarea { width: 100%; min-height: 4.5rem; font-size: .85rem; }
.day-block.is-booking { border-left-width: 5px; background: color-mix(in srgb, var(--c) 32%, var(--surface)); text-decoration: none; color: inherit; }

/* Buchungen (Cockpit) */
.dot { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; vertical-align: middle; }
.slot-grid { display: grid; gap: .5rem; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
.slot-pick { display: flex; align-items: center; justify-content: center; padding: .5rem; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; font-weight: 500; }
.slot-pick:hover { border-color: var(--border-strong); }
.slot-pick:has(input:checked) { border-color: var(--primary); background: var(--surface-hover); }
.divider { border: 0; border-top: 1px solid var(--border); margin: .5rem 0; }
.pub-status { font-weight: 600; margin: .2rem 0 .8rem; }
.pub-status-confirmed { color: var(--success); }
.pub-status-cancelled, .pub-status-rescheduled { color: var(--danger); }
.pub-status-pending_guest, .pub-status-pending_host { color: var(--warn); }
.avatar-preview { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; flex: 0 0 72px; display: inline-flex; align-items: center; justify-content: center; }
.avatar-initial { background: var(--surface-hover); border: 1px solid var(--border); font-weight: 600; font-size: 1.6rem; }
