/* =========================================================
   Home-Panel – Web-App (Handy) und Verwaltungsseiten
   Hell „Gerät“ / Dunkel „Aegis“ wie Crew Alert und Admin Panel, folgt der Geräte-Einstellung.
   Signalfarbe nur für Knöpfe.
   ========================================================= */

:root {
    --casing: #c9d1d6;
    --plate: #e4e9ec;
    --plate-edge: #ffffff;
    --plate-shadow: 0 1px 0 #00000022, 0 6px 14px -10px #1d232766;
    --ink: #1d2327;
    --mist: #5d6a72;
    --glass: #0f2a33;
    --glass-edge: #ffffff14;
    --readout: #bff3ff;
    --readlabel: #7fb3c2;
    --signal: #ff8a3d;
    --signal-hover: #ff9a57;
    --signal-ink: #1d1208;
    --rule: #0000001a;
    --field: #f4f7f8;
    --field-line: #9aa7af;
    --ok: #1f8a4c;
    --busy: #a8690f;
    --bad: #c2412d;
    --rust: #d4572a;
    --r: 4px;
    --display: "Big Shoulders Text", "Bahnschrift", "Segoe UI", sans-serif;
    --body: "Instrument Sans", "Segoe UI", system-ui, sans-serif;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        --casing: #1d242b;
        --plate: #262f38;
        --plate-edge: #ffffff0f;
        --plate-shadow: inset 0 0 0 1px #ffffff0f;
        --ink: #e3e8ec;
        --mist: #8796a3;
        --glass: #0d1216;
        --glass-edge: #ffffff12;
        --readout: #f2f5f7;
        --readlabel: #7d8e9b;
        --signal: #d23c32;
        --signal-hover: #e0483d;
        --signal-ink: #ffffff;
        --rule: #ffffff12;
        --field: #1a2128;
        --field-line: #3b4855;
        --ok: #4cc38a;
        --busy: #e0b341;
        --bad: #f0a33c;
        --r: 2px;
        color-scheme: dark;
    }
}

* { box-sizing: border-box; }
html, body { margin: 0; }

body {
    min-height: 100vh;
    background: var(--casing);
    color: var(--ink);
    font-family: var(--body);
    font-size: 16px;
    line-height: 1.45;
    -webkit-tap-highlight-color: transparent;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

a { color: inherit; text-underline-offset: 2px; }
h1, h2, h3 { font-family: var(--display); font-weight: 800; line-height: 1.1; }
h1 { font-size: 34px; margin: 18px 0 6px; }
h2 { font-size: 24px; margin: 0 0 10px; }
.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px 48px; }
.wrap.narrow { max-width: 420px; }
.muted { color: var(--mist); }
.error { color: var(--bad); font-weight: 600; }
.hidden { display: none !important; }

.card {
    position: relative;
    background: var(--plate);
    border-radius: var(--r);
    box-shadow: inset 0 1px 0 var(--plate-edge), var(--plate-shadow);
    padding: 14px 16px;
    margin-bottom: 14px;
}
@media (prefers-color-scheme: dark) {
    .card { clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 0 100%); }
}

.screen {
    padding: 10px 12px;
    border-radius: calc(var(--r) - 1px);
    background: var(--glass);
    color: var(--readout);
    box-shadow: inset 0 0 0 1px var(--glass-edge), inset 0 10px 30px #00000066;
}

/* Kopf */
.top-bar { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding-top: 6px; }
.top-bar form { margin: 0; }

/* Knöpfe und Felder */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    min-height: 44px; padding: 10px 16px; border: 0; border-radius: calc(var(--r) - 1px);
    background: var(--signal); color: var(--signal-ink); font: 600 16px var(--body); cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--signal-hover); }
.btn.secondary { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--field-line); }
.btn.small { min-height: 34px; padding: 6px 10px; font-size: 14px; }
.btn:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

label { display: block; font-size: 14px; font-weight: 600; color: var(--mist); margin: 8px 0 4px; }
input, select {
    width: 100%; min-height: 44px; padding: 8px 10px; font: 16px var(--body); color: var(--ink);
    background: var(--field); border: 1.5px solid var(--field-line); border-radius: calc(var(--r) - 1px);
}
input[type="checkbox"] { width: 22px; min-height: 22px; height: 22px; accent-color: var(--rust); }
.check { display: flex; align-items: center; gap: 10px; margin: 10px 0; font-size: 16px; color: var(--ink); font-weight: 500; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.twitch {
    display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 10px 18px; border-radius: calc(var(--r) - 1px);
    background: #9146ff; color: #fff; font-weight: 600; text-decoration: none;
}

/* Gästemodus und Geschirrspüler */
.status-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .status-grid { grid-template-columns: 1fr; } }
.guest-state { font-family: var(--display); font-size: 22px; font-weight: 600; }
.guest-state.on { color: var(--busy); }
.guest-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.guest-actions input { width: 110px; }

.dish-switch { display: flex; align-items: center; gap: 14px; width: 100%; background: none; border: 0; padding: 0; color: inherit; font: inherit; cursor: pointer; text-align: left; }
.sw { width: 76px; height: 36px; border-radius: 18px; background: var(--glass); box-shadow: inset 0 0 0 1px var(--glass-edge), inset 0 3px 8px #00000066; position: relative; flex: none; }
.sw .knob { position: absolute; top: 4px; left: 4px; width: 34px; height: 28px; border-radius: 14px; background: #5d6a72; transition: transform .2s, background .2s; }
.dish-switch.clean .sw .knob { transform: translateX(34px); background: var(--ok); }
.dish-state { font-family: var(--display); font-size: 22px; font-weight: 800; line-height: 1; }
.dish-switch.clean .dish-state { color: var(--ok); }
.dish-job { color: var(--mist); font-size: 14px; }

/* Aufgaben */
.lists { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 620px) { .lists { grid-template-columns: 1fr; } }
.todo-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--rule); }
.todo-item:first-of-type { border-top: 0; }
.todo-item .done { flex: none; width: 28px; height: 28px; border-radius: 3px; border: 2px solid var(--field-line); background: transparent; cursor: pointer; margin-top: 1px; }
.todo-item .done:active { background: var(--ok); }
.todo-item .body { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.todo-item .meta { font-size: 13px; color: var(--mist); }
.todo-item .meta .soon { color: var(--busy); font-weight: 600; }
.todo-item .tools { display: flex; gap: 4px; }
.icon-btn { background: none; border: 0; color: var(--mist); font-size: 18px; min-width: 36px; min-height: 36px; cursor: pointer; }
.lock { font-size: 12px; margin-left: 4px; }
.empty { color: var(--mist); padding: 6px 0; }

.pair-code { font-family: var(--display); font-size: 40px; letter-spacing: .12em; }
.toast { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: var(--casing);
         padding: 10px 16px; border-radius: 4px; font-weight: 600; max-width: 90vw; }

/* Tabellen (Archiv) */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 6px; border-top: 1px solid var(--rule); vertical-align: top; }
th { color: var(--mist); font-weight: 600; }
.filters { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.filters a { padding: 6px 12px; border-radius: 999px; text-decoration: none; box-shadow: inset 0 0 0 1.5px var(--field-line); }
.filters a.on { background: var(--ink); color: var(--casing); box-shadow: none; }

/* Einstellungen */
.small { font-size: 13px; }
.stack { margin-top: 10px; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.inline-form input, .inline-form select { width: auto; flex: 1 1 140px; }
.small-form input, .small-form select { min-height: 36px; font-size: 14px; }
.setting-row { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--rule); }
.setting-row:first-child { border-top: 0; }
.grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.av-small { width: 32px; height: 32px; border-radius: 50%; flex: none; object-fit: cover; }
.streamer { border-top: 1px solid var(--rule); padding: 4px 0 10px; }
.streamer:first-child { border-top: 0; }
.slots { padding-left: 42px; }
.slot-row { display: flex; align-items: center; justify-content: space-between; font-size: 14px; color: var(--mist); }
.place-hit { margin: 6px 6px 0 0; }
.settings code { overflow-wrap: anywhere; }
.stack .btn { margin-top: 12px; }
