:root {
    color-scheme: light;
    font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
    color: #172d3b;
    background: #eaf0f3;
    --text: #172d3b;
    --muted: #4e6270;
    --navy: #213a48;
    --navy-dark: #182e3b;
    --teal: #065a57;
    --teal-dark: #044945;
    --line: #d8e2e8;
    --danger: #9c2636;
    --focus: #006ba4;
    --radius: 15px;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; overflow-x: clip; }
:root:has(dialog[open]) { overflow: hidden; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .53; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

.page-header { background: #f9fcfd; border-bottom: 1px solid #cfdee5; }
.page-header-inner, .page-main { width: min(100% - 56px, 1480px); margin-inline: auto; }
.page-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    min-height: 94px;
    padding-block: 15px;
}
.page-heading, .header-actions { display: flex; align-items: center; gap: 14px; }
.brand-mark {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 48px;
    aspect-ratio: 1;
    color: #fcfffb;
    background: var(--teal);
    border-radius: 12px;
    font-size: 21px;
    font-weight: 800;
    letter-spacing: -.08em;
    box-shadow: inset 0 -3px #003b36a0;
}
h1 { margin: 0; font-size: clamp(1.3rem, 2.4vw, 2.25rem); line-height: 1.13; letter-spacing: -.042em; }
h2 { margin: 0; font-size: 1.33rem; line-height: 1.2; letter-spacing: -.022em; }

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 8px 15px;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: .875rem;
    font-weight: 700;
    white-space: nowrap;
}
.button.primary { color: white; background: var(--teal); border-color: var(--teal); }
.button.primary:hover:not(:disabled) { background: var(--teal-dark); border-color: var(--teal-dark); }
.button.quiet { color: #415865; background: transparent; }
.button.quiet:hover, .button.text-danger:hover { background: #eef3f5; }
.button.secondary { color: var(--text); background: #f5f8fa; border-color: #cbd8df; }
.button.secondary:hover:not(:disabled) { background: #e7eff3; }
.button.danger { color: #fff; background: var(--danger); }
.button.danger:hover { background: #791c29; }
.text-danger { color: var(--danger); }
.button.text-danger { background: transparent; }
.button.small { min-height: 37px; padding: 5px 10px; font-size: .82rem; }
#settings-open { letter-spacing: .04em; }

.page-main { padding-block: 24px 42px; }
.board {
    border: 1px solid #c6d5dd;
    border-radius: var(--radius);
    background: #fff;
    box-shadow: 0 8px 22px #1d3b4912;
}
.board-tools {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px 16px;
    min-height: 53px;
    padding: 10px 17px;
    color: var(--muted);
    border-radius: var(--radius) var(--radius) 0 0;
    font-size: .83rem;
}
#plan-summary { font-weight: 700; }
.status-key { display: flex; flex-wrap: wrap; gap: 8px 15px; margin: 0; padding: 0; list-style: none; }
.status-key li { display: inline-flex; align-items: center; gap: 6px; }
.status-square { display: inline-block; width: 9px; height: 9px; border-radius: 1px; flex: 0 0 9px; }
.status-square.aktiv { background: #137744; }
.status-square.krank { background: #bc2940; }
.status-square.urlaub { background: #1f62af; }
.day-jump { display: none; }

.table-scroll {
    overflow: auto;
    max-height: max(420px, calc(100dvh - 180px));
    scrollbar-color: #91a8b5 #eef4f6;
    border-radius: 0 0 calc(var(--radius) - 1px) calc(var(--radius) - 1px);
    scroll-padding-top: 48px;
    scroll-padding-left: 255px;
}
.table-scroll:focus-visible { outline-offset: -3px; }
.schedule {
    width: 100%;
    min-width: 920px;
    border-spacing: 0;
    table-layout: fixed;
    text-align: left;
}
.object-col { width: 257px; }
.schedule thead th {
    position: sticky;
    z-index: 3;
    top: 0;
    height: 46px;
    padding: 8px 5px;
    background: var(--navy);
    border: 0;
    border-right: 1px solid #ffffff20;
    color: #fff;
    text-align: center;
    font-size: .82rem;
    font-weight: 730;
}
.schedule thead th.weekend { background: var(--navy-dark); }
.schedule .object-column { position: sticky; left: 0; }
.schedule thead .object-column { z-index: 4; padding-left: 16px; text-align: left; }
.schedule tbody .object-column {
    z-index: 2;
    padding: 8px 13px 8px 16px;
    background: #f8fbfc;
    border-right: 1px solid #cbd9e2;
    box-shadow: 2px 0 3px #25434d0b;
}
.object-name { display: block; font-size: .86rem; font-weight: 740; line-height: 1.26; overflow-wrap: anywhere; }
.object-interval {
    display: block;
    margin-top: 4px;
    padding: 3px 6px;
    border: 1px solid #e4d3b4;
    border-radius: 4px;
    background: #f7e8cf;
    color: #56442f;
    font-size: .73rem;
    font-weight: 700;
    line-height: 1.25;
    overflow-wrap: anywhere;
}
.object-status { display: block; margin-top: 3px; font-size: .68rem; font-weight: 780; letter-spacing: .035em; }
.schedule tbody .suspended .object-column { color: var(--danger); background: #fff0f1; }
.schedule td, .schedule tbody th { height: 55px; border-bottom: 1px solid var(--line); }
.schedule td { padding: 5px 6px; background: #f9fcfd; border-right: 1px solid var(--line); }
.schedule td.weekend { background: #f0f5f8; }
.schedule .suspended td { background: #faf2f3; }
.schedule td:last-child, .schedule thead th:last-child { border-right: 0; }
.schedule tr:last-child td, .schedule tr:last-child th { border-bottom: 0; }
.schedule .empty-board { padding: 18px 16px; color: var(--muted); }

.slot {
    position: relative;
    width: 100%;
    min-height: 43px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: left;
    border: 1px solid #d6e0e6;
    border-radius: 6px;
    color: var(--text);
    padding: 4px 6px;
}
.empty-slot {
    background: #e9eff3;
    box-shadow: inset 0 2px 3px #546c7a0d, inset 0 -1px #ffffff9e;
}
.slot-plus { color: #4b6777; font-size: 1rem; font-weight: 650; line-height: 1; }
button.empty-slot:hover { background: #dcebf0; border-color: #9cbac4; }
button.slot:focus-visible { outline-offset: -1px; }
.filled-slot {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
    padding: 0;
    border: 0;
    background: transparent;
}
.staff-card {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 43px;
    padding: 4px 6px;
    border: 1px solid var(--card-border);
    border-radius: 6px;
    background: var(--card-background);
    box-shadow: inset 0 2px #ffffff60, inset 0 -2px #182e3b14;
}
button.filled-slot:hover .staff-card { box-shadow: inset 0 0 0 1px var(--card-border), inset 0 -2px #182e3b20; }
.staff-caption { min-width: 0; }
.staff-name { display: block; font-size: .78rem; line-height: 1.18; font-weight: 810; overflow-wrap: anywhere; }
.staff-status { display: block; margin-top: 2px; font-size: .64rem; font-weight: 760; color: var(--status-text); letter-spacing: .03em; }
.card-orange { --card-background: #ffc497; --card-border: #dd9157; }
.card-tuerkis { --card-background: #a8e8e0; --card-border: #66bfb0; }
.card-magenta { --card-background: #f3b0d8; --card-border: #d881b7; }
.card-gelb { --card-background: #ffe989; --card-border: #d5b653; }
.card-creme { --card-background: #f7e8cf; --card-border: #cdb797; }
.card-krank { --card-background: #ffc4cc; --card-border: #d76576; --status-text: #8f182b; }
.card-urlaub { --card-background: #cbe2ff; --card-border: #72a6e2; --status-text: #184985; }
.staff-card:is(.card-krank, .card-urlaub) {
    background-image: linear-gradient(
        to bottom right,
        transparent calc(50% - .75px),
        rgb(178 36 54 / 46%) calc(50% - .75px) calc(50% + .75px),
        transparent calc(50% + .75px)
    );
}

.login-shell { display: grid; min-height: 100dvh; place-items: center; padding: 20px; }
.login-card {
    width: min(100%, 425px);
    padding: 28px;
    border: 1px solid #c6d5dd;
    border-radius: var(--radius);
    background: #fff;
    box-shadow: 0 8px 22px #1d3b4912;
}
.login-card h1 { margin-block: 14px 22px; font-size: 1.75rem; }
.form-stack { display: grid; gap: 14px; }
.field { display: grid; gap: 5px; color: var(--text); font-size: .87rem; font-weight: 690; }
input[type="password"], input[type="text"], select {
    width: 100%;
    min-width: 0;
    min-height: 43px;
    padding: 7px 10px;
    border: 1px solid #b8c9d3;
    border-radius: 7px;
    color: var(--text);
    background: #fff;
    font-size: 1rem;
    font-weight: 480;
}
.alert {
    margin: 0;
    padding: 10px 12px;
    border: 1px solid #ecb6bf;
    border-radius: 7px;
    color: #812336;
    background: #fff2f3;
    font-size: .9rem;
}
.board-alert { margin: 0 16px 12px; }

.dialog {
    width: min(680px, calc(100% - 28px));
    max-height: calc(100dvh - 28px);
    margin: auto;
    padding: 0;
    overflow: hidden;
    border: 1px solid #b9cad3;
    border-radius: var(--radius);
    background: #fff;
    color: var(--text);
    box-shadow: 0 16px 64px #102b3d45;
}
.dialog[open] { display: flex; flex-direction: column; }
.dialog::backdrop { background: #11293781; }
.editor-dialog { width: min(470px, calc(100% - 28px)); }
.dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 61px;
    gap: 12px;
    padding: 10px 18px;
    border-bottom: 1px solid var(--line);
}
.close-button {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 39px;
    height: 39px;
    padding: 0;
    border: 1px solid #d6e2e8;
    border-radius: 7px;
    background: #f4f8fa;
    color: var(--text);
    font-size: 1.4rem;
    line-height: 1;
}
.close-button:hover { background: #e8f0f4; }
.settings-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 6px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--line);
    background: #f8fafb;
}
.settings-nav button {
    min-height: 42px;
    padding: 4px 10px;
    border: 1px solid transparent;
    border-radius: 7px;
    color: var(--muted);
    background: transparent;
    font-size: .87rem;
    font-weight: 700;
}
.settings-nav button:hover { background: #e9f2f3; }
.settings-nav button[aria-pressed="true"] { color: #034542; background: #dcedeb; border-color: #b8d8d3; }
.settings-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 11px 17px;
    border-bottom: 1px solid var(--line);
}
.settings-toolbar p, .empty-settings, .field-note, .editor-context { margin: 0; color: var(--muted); font-size: .86rem; }
.settings-list { overflow-y: auto; padding: 0 17px; }
.settings-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 7px 12px;
    min-height: 57px;
    padding-block: 8px;
    border-bottom: 1px solid var(--line);
}
.settings-item:last-child { border-bottom: 0; }
.entry-name { display: block; font-size: .91rem; overflow-wrap: anywhere; }
.entry-meta { display: block; margin-top: 3px; color: var(--muted); font-size: .77rem; overflow-wrap: anywhere; }
.entry-meta.text-danger { color: var(--danger); }
.staff-meta, .entry-actions { display: flex; align-items: center; gap: 7px; }
.color-swatch { width: 12px; height: 12px; border-radius: 3px; background: var(--card-background); border: 1px solid var(--card-border); }
.empty-settings { padding-block: 16px; }
.editor-form { display: grid; gap: 14px; padding: 17px; overflow-y: auto; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 3px; }
.editor-context { overflow-wrap: anywhere; }
.interval-fields, .employee-fields { display: grid; gap: 8px; min-width: 0; margin: 0; padding: 0; border: 0; }
.interval-fields legend, .employee-fields legend { padding: 0; margin-bottom: 5px; font-size: .87rem; font-weight: 690; }
.employee-choice {
    display: flex;
    align-items: center;
    min-height: 44px;
    gap: 10px;
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: 7px;
    font-size: .9rem;
    cursor: pointer;
    overflow-wrap: anywhere;
}
.employee-choice:hover { background: #f5f9fa; }
.employee-choice:has(input:checked) { background: #edf7f5; border-color: #9bc7bf; }
.employee-choice input { flex: none; width: 18px; height: 18px; margin: 0; accent-color: var(--teal); }
.interval-fields > button { justify-self: start; }
.interval-rows { display: grid; gap: 7px; }
.interval-row { display: flex; align-items: center; gap: 7px; }
.interval-remove { height: 43px; }
.confirm-copy { margin: 0; line-height: 1.5; overflow-wrap: anywhere; }

@media (max-width: 1000px) {
    .page-header-inner, .page-main { width: calc(100% - 30px); }
    .object-col { width: 222px; }
    .table-scroll { scroll-padding-left: 225px; }
}

@media (max-width: 950px) {
    .day-jump {
        display: grid;
        grid-template-columns: repeat(7, minmax(0, 1fr));
        gap: 5px;
        padding: 0 10px 10px;
    }
    .day-jump button {
        min-height: 38px;
        padding: 4px 2px;
        border: 1px solid #c9d9e0;
        border-radius: 6px;
        color: var(--text);
        background: #f3f7f9;
        font-size: .84rem;
        font-weight: 700;
    }
    .day-jump button:hover, .day-jump button:focus { background: #daeceb; }
    .table-scroll { max-height: max(360px, calc(100dvh - 210px)); }
}

@media (max-width: 600px) {
    .page-header-inner, .page-main { width: calc(100% - 20px); }
    .page-header-inner { display: grid; gap: 10px; padding-block: 12px; }
    .page-heading { gap: 9px; }
    .brand-mark { width: 39px; border-radius: 9px; font-size: 19px; }
    .header-actions { gap: 7px; }
    .header-actions .button { min-height: 38px; padding-block: 6px; }
    .page-main { padding-block: 12px 18px; }
    .board-tools { gap: 5px 11px; min-height: 45px; padding: 8px 9px; font-size: .75rem; }
    .status-key { gap: 5px 9px; }
    .status-key li { gap: 4px; }
    .table-scroll { max-height: max(330px, calc(100dvh - 218px)); scroll-padding-left: 158px; }
    .schedule { min-width: 850px; }
    .object-col { width: 154px; }
    .schedule thead .object-column, .schedule tbody .object-column { padding-inline: 9px; }
    .object-name { font-size: .78rem; }
    .schedule td { padding-inline: 5px; }
    .settings-nav { gap: 3px; padding-inline: 9px; }
    .settings-nav button { padding-inline: 6px; font-size: .81rem; }
    .settings-toolbar, .settings-list { padding-inline: 10px; }
    .settings-toolbar .button { padding-inline: 8px; font-size: .81rem; }
    .settings-item { align-items: flex-start; flex-direction: column; }
    .settings-item .button.small { min-height: 40px; }
}
