/* Contest-Schichtplaner */
:root {
  --paper: #f1f4f5; --surface: #ffffff; --ink: #16212b; --muted: #586673; --line: #d3dae0;
  --primary: #0b5c8c; --primary-ink: #ffffff; --accent: #e9a200; --danger: #b4261f; --ok: #1f7a47;
  --bar: #16212b; --bar-ink: #eef2f5;
  --cell-l: 88%; --cell-s: 70%; --cell-ink-l: 20%; --cell-edge-l: 48%;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "DejaVu Sans Mono", Menlo, Consolas, monospace;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #10161c; --surface: #18212a; --ink: #e7ecf0; --muted: #9ba8b4; --line: #2b3743;
    --primary: #6fb7e9; --primary-ink: #0c1620; --accent: #f2b93b; --danger: #f08a84; --ok: #6cc892;
    --bar: #0b1015; --bar-ink: #e7ecf0;
    --cell-l: 25%; --cell-s: 38%; --cell-ink-l: 88%; --cell-edge-l: 60%;
  }
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.5 var(--sans); min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--primary); }
h1 { font-size: 1.6rem; line-height: 1.2; margin: 0 0 .5rem; }
h2 { font-size: 1.15rem; margin: 0 0 .5rem; }
h3 { font-size: 1rem; margin: 1.25rem 0 .5rem; }
p { margin: 0 0 .75rem; }
small, .muted { color: var(--muted); }
small { display: block; font-size: .82rem; font-weight: 400; margin-top: .2rem; }
section { margin-top: 2rem; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Kopf, Navigation */
.topbar { background: var(--bar); color: var(--bar-ink); display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.5rem; padding: .6rem 1rem; }
.brand { color: inherit; font-weight: 700; text-decoration: none; letter-spacing: .01em; }
.topnav { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem 1.1rem; margin-left: auto; font-size: .95rem; }
.topnav a, .topnav .linklike { color: var(--bar-ink); text-decoration: none; }
.topnav a:hover, .topnav .linklike:hover { text-decoration: underline; }
.linklike { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; }
form.inline { display: inline; }
.langswitch { display: inline-flex; gap: .4rem; font-size: .85rem; }
.langswitch strong { color: var(--accent); }
.page { width: 100%; max-width: 68rem; margin: 0 auto; padding: 1.25rem 1rem 3rem; flex: 1; }
body.wide .page { max-width: none; }
.narrow, .narrowform { max-width: 30rem; }
.footer { display: flex; flex-wrap: wrap; gap: .25rem 1.5rem; padding: 1rem; color: var(--muted); font-size: .85rem; border-top: 1px solid var(--line); }
.crumbs { font-size: .9rem; margin-bottom: .4rem; }
.crumbs a + a::before { content: "/"; color: var(--muted); margin: 0 .5rem; display: inline-block; }

/* Meldungen */
.flash { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--primary); padding: .6rem .8rem; border-radius: 4px; }
.flash-ok { border-left-color: var(--ok); }
.flash-error { border-left-color: var(--danger); }
.err { color: var(--danger); }
.empty-note { background: var(--surface); border: 1px dashed var(--line); padding: .9rem 1rem; border-radius: 6px; color: var(--muted); }

/* Formulare */
label { display: block; font-weight: 600; font-size: .92rem; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: .5rem .6rem; width: 100%; margin-top: .25rem; min-height: 2.6rem; }
input[type=checkbox] { width: auto; min-height: 0; margin: 0 .4rem 0 0; }
input[type=file] { padding: .35rem; }
textarea { resize: vertical; }
.stack { display: flex; flex-direction: column; gap: .9rem; align-items: stretch; }
.stack > .btn { align-self: flex-start; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; }
.dt { display: flex; gap: .4rem; }
.check { display: flex; align-items: center; font-weight: 400; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.callinput { font-family: var(--mono); text-transform: uppercase; font-variant-numeric: slashed-zero; letter-spacing: .03em; }
.call { font-family: var(--mono); font-variant-numeric: slashed-zero; font-weight: 700; letter-spacing: .02em; }
.rowform { display: flex; flex-wrap: wrap; gap: .5rem .75rem; align-items: flex-end; }
.rowform label { flex: 1 1 9rem; min-width: 0; }
.rowform .wide { flex-basis: 100%; }
.rowform .lbl { display: block; font-size: .78rem; font-weight: 600; color: var(--muted); }
.rowform .check { flex: 0 0 auto; padding-bottom: .6rem; }
.searchform { max-width: 36rem; margin-bottom: 1rem; }
.toolbar { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; justify-content: space-between; margin-bottom: 1rem; }

/* Schaltflächen */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 2.6rem; padding: .45rem .95rem; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.btn:disabled { opacity: .4; cursor: default; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn-danger { color: var(--danger); }
.btn-small { min-height: 2.2rem; padding: .25rem .7rem; font-size: .88rem; }
.actions { display: flex; flex-wrap: wrap; gap: .6rem; }

/* Listen */
.section-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .5rem; }
.cardlist { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.cardlist li { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem 1rem; padding: .7rem .9rem; border-top: 1px solid var(--line); }
.cardlist li:first-child { border-top: 0; }
.card-main { font-weight: 600; text-decoration: none; display: inline-flex; flex-wrap: wrap; gap: .25rem .7rem; flex: 1 1 14rem; }
.card-main:hover { text-decoration: underline; }
.tag { display: inline-block; border: 1px solid var(--line); border-radius: 999px; padding: .05rem .6rem; font-size: .8rem; color: var(--muted); white-space: nowrap; }
.tag-ok { color: var(--ok); border-color: currentColor; }
.rows { display: flex; flex-direction: column; gap: .6rem; }
.rowitem { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: .7rem .9rem; display: flex; flex-wrap: wrap; gap: .6rem 1rem; align-items: flex-end; }
.rowitem > .rowform { flex: 1 1 28rem; }
.rowactions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.rowactions form { display: flex; gap: .3rem; }
.participant { flex-direction: column; align-items: stretch; }
.p-head { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .8rem; }
.p-head form { margin-left: auto; }
.windows { list-style: none; margin: 0; padding: 0; }
.windows li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .4rem; padding: .3rem 0; border-top: 1px solid var(--line); }
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem; padding: 0; margin: 0 0 .8rem; }
.chips li { display: inline-flex; align-items: center; gap: .5rem; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: .2rem .4rem .2rem .8rem; }
.chip-x { border: 0; background: none; color: var(--muted); font: inherit; font-size: 1.2rem; line-height: 1; cursor: pointer; padding: .1rem .4rem; }
.chip-x:hover { color: var(--danger); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: .6rem; margin: 1rem 0; }
.stats div { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: .6rem .8rem; }
.stats dt { color: var(--muted); font-size: .85rem; }
.stats dd { margin: 0; font-size: 1.5rem; font-weight: 700; }
.table-scroll { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
table.data { border-collapse: collapse; width: 100%; font-size: .92rem; }
table.data th, table.data td { text-align: left; padding: .5rem .7rem; border-top: 1px solid var(--line); vertical-align: top; }
table.data thead th { border-top: 0; color: var(--muted); font-size: .8rem; white-space: nowrap; }

/* Tabs */
.tabs { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; border-bottom: 1px solid var(--line); margin: .75rem 0 1.25rem; }
.tabs a { padding: .45rem 0; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs a[aria-current=page] { color: var(--ink); border-bottom-color: var(--primary); }
.entry-head h1 .call { margin-right: .4rem; }

/* Startseite */
.hero { padding: 1.5rem 0 1rem; }
.hero h1 { font-size: clamp(1.9rem, 5vw, 3rem); letter-spacing: -.01em; max-width: 18ch; }
.lead { font-size: 1.1rem; max-width: 58ch; color: var(--muted); }
.demo { margin-top: 1rem; }
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.features p { color: var(--muted); }

/* ---------------------------------------------------------------- Planraster */
.oc-0 { --h: 205; } .oc-1 { --h: 28; } .oc-2 { --h: 140; } .oc-3 { --h: 280; } .oc-4 { --h: 355; } .oc-5 { --h: 178; }
.oc-6 { --h: 52; } .oc-7 { --h: 320; } .oc-8 { --h: 95; } .oc-9 { --h: 240; } .oc-10 { --h: 12; } .oc-11 { --h: 160; }
.plan-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; margin-bottom: .5rem; }
.plan-scroll { overflow: auto; max-height: 78vh; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.demo .plan-scroll { max-height: none; }
table.plan { border-collapse: separate; border-spacing: 0; font-size: .82rem; }
.plan th, .plan td { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 0; }
.plan thead th { line-height: 1.2; position: sticky; top: 0; z-index: 2; background: var(--surface); padding: .3rem .4rem; font-weight: 600; color: var(--muted); white-space: nowrap; }
.plan thead tr:nth-child(2) th { top: 1.75rem; }
.plan thead th.day { text-align: left; color: var(--ink); height: 1.75rem; }
.plan th.corner { left: 0; z-index: 3; text-align: left; }
.plan tbody th { position: sticky; left: 0; z-index: 1; background: var(--surface); text-align: left; padding: .3rem .6rem; white-space: nowrap; font-weight: 600; }
.plan tbody th small { font-weight: 400; margin: 0; }
.plan .cell { height: 2.5rem; min-width: 4.4rem; text-align: center; background: var(--surface); }
.plan .cell[class*="oc-"] { background: hsl(var(--h) var(--cell-s) var(--cell-l)); color: hsl(var(--h) 60% var(--cell-ink-l)); box-shadow: inset 0 3px 0 hsl(var(--h) 55% var(--cell-edge-l)); }
.plan .cell .call { font-size: .8rem; }
.plan .cell.double .call::after { content: " 2×"; font-weight: 400; }
.plan .now { box-shadow: inset 0 -3px 0 var(--accent); }
.plan .cell.now[class*="oc-"] { box-shadow: inset 0 3px 0 hsl(var(--h) 55% var(--cell-edge-l)), inset 0 -3px 0 var(--accent); }
.plan tr.daystart .cell, .plan td.daystart, .plan th.daystart { border-left: 2px solid var(--muted); }
.cellbtn { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; min-height: 2.5rem; background: none; border: 0; color: inherit; font: inherit; cursor: pointer; padding: 0 .2rem; }
.cellbtn:hover { background: color-mix(in srgb, var(--primary) 14%, transparent); }
.cellbtn:focus-visible { outline-offset: -2px; }
.plan-v .cell { min-width: 5.5rem; }
.plan-v tbody th { font-family: var(--mono); font-variant-numeric: slashed-zero; }
.plan-v tr.dayrow th { position: sticky; left: 0; background: var(--paper); color: var(--ink); padding: .35rem .6rem; }
#plan-summary { margin-top: 1rem; max-width: 30rem; }
#plan-summary .hrs { text-align: right; font-variant-numeric: tabular-nums; }
.sharebox { max-width: 44rem; }
.copyrow { display: flex; gap: .5rem; align-items: center; margin-bottom: .6rem; }
.copyrow input { margin: 0; font-family: var(--mono); font-size: .85rem; }

/* Auswahl-Dialog */
.picker { border: 1px solid var(--line); border-radius: 10px; padding: 0; background: var(--surface); color: var(--ink); width: min(26rem, calc(100vw - 2rem)); max-height: 85vh; }
.picker::backdrop { background: rgb(8 14 20 / .55); }
.picker-inner { display: flex; flex-direction: column; gap: .6rem; padding: 1rem; max-height: 85vh; }
.picker h2 { margin: 0; }
.picker p { margin: 0; }
.picker-span { display: flex; align-items: center; gap: .6rem; font-weight: 600; }
.picker-span select { width: auto; margin: 0; }
.picker-list { display: flex; flex-direction: column; gap: .35rem; overflow-y: auto; min-height: 3rem; }
.pick { display: grid; grid-template-columns: auto 1fr auto; gap: .2rem .7rem; align-items: baseline; text-align: left; width: 100%; min-height: 2.9rem; padding: .45rem .7rem; border: 1px solid var(--line); border-left: 5px solid hsl(var(--h, 205) 55% var(--cell-edge-l)); border-radius: 6px; background: var(--surface); color: var(--ink); font: inherit; cursor: pointer; }
.pick:hover { border-color: var(--muted); border-left-color: hsl(var(--h, 205) 55% var(--cell-edge-l)); }
.pick[aria-pressed=true] { background: hsl(var(--h, 205) var(--cell-s) var(--cell-l)); color: hsl(var(--h, 205) 60% var(--cell-ink-l)); }
.pick .hrs { font-variant-numeric: tabular-nums; white-space: nowrap; }
.pick .busy { grid-column: 1 / -1; font-size: .8rem; color: var(--danger); }
.picker-foot { display: flex; justify-content: space-between; gap: .5rem; }

@media (max-width: 700px) {
  .row2, .features { grid-template-columns: 1fr; }
  .topnav { margin-left: 0; width: 100%; }
  .rowform label { flex-basis: 100%; }
  .p-head form { margin-left: 0; }
  .picker { margin: auto 0 0; width: 100vw; max-width: none; border-radius: 14px 14px 0 0; border-bottom: 0; }
  .plan-scroll { max-height: 72vh; }
}
@media print {
  .topbar, .footer, .plan-toolbar, .tabs, .sharebox, .crumbs { display: none; }
  .plan-scroll { max-height: none; overflow: visible; border: 0; }
  .plan thead th, .plan tbody th { position: static; }
}
