/* Dienstplan – Stylesheet */

:root {
  --bg:        #f6f7f9;
  --surface:   #ffffff;
  --surface-2: #f0f2f5;
  --text:      #1b1f24;
  --muted:     #62707f;
  --border:    #dfe3e8;
  --accent:    #2f6fed;
  --accent-dk: #1f56c4;
  --free-bg:   #eefbf2;
  --free-bd:   #b6e6c6;
  --free-tx:   #157347;
  --full-bg:   #f2f3f5;
  --full-tx:   #7a8695;
  --warn-bg:   #fff5e0;
  --warn-bd:   #f0d192;
  --warn-tx:   #8a5c00;
  --err-bg:    #fdecec;
  --err-bd:    #f3bcbc;
  --err-tx:    #b02020;
  --ok-bg:     #eaf7ee;
  --ok-bd:     #b7e0c4;
  --ok-tx:     #1a6b3c;
  --radius:    10px;
  --shadow:    0 1px 2px rgba(16, 24, 40, .05), 0 4px 14px rgba(16, 24, 40, .05);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #14171c;
    --surface:   #1c2027;
    --surface-2: #232830;
    --text:      #e8ecf1;
    --muted:     #9aa7b6;
    --border:    #333b46;
    --accent:    #6c9bff;
    --accent-dk: #517fe0;
    --free-bg:   #172c20;
    --free-bd:   #2f5c40;
    --free-tx:   #74d69a;
    --full-bg:   #23272e;
    --full-tx:   #7d8a99;
    --warn-bg:   #2e2716;
    --warn-bd:   #5b4a1f;
    --warn-tx:   #e8c069;
    --err-bg:    #2f1c1c;
    --err-bd:    #5e2b2b;
    --err-tx:    #f19b9b;
    --ok-bg:     #182a1f;
    --ok-bd:     #2f5c40;
    --ok-tx:     #7fd6a0;
    --shadow:    0 1px 2px rgba(0, 0, 0, .3), 0 4px 14px rgba(0, 0, 0, .25);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

.wrap { width: min(1100px, 100% - 2rem); margin-inline: auto; }
.main { padding: 1.75rem 0 4rem; }

h1 { font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.1rem); line-height: 1.2; margin: 0 0 .5rem; letter-spacing: -.01em; }
h2 { font-size: 1.25rem; margin: 2rem 0 .75rem; }
h3 { font-size: 1rem; margin: 1.25rem 0 .5rem; }
p  { margin: .5rem 0; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.75rem 0; }
a  { color: var(--accent); }

.muted { color: var(--muted); }
.small { font-size: .875rem; }
.lead  { font-size: 1.05rem; color: var(--muted); max-width: 62ch; }
.req   { color: var(--err-tx); }

/* --- Kopf- und Fußzeile ------------------------------------------- */

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.site-header .wrap { display: flex; align-items: center; gap: .75rem; height: 56px; }
.brand {
  display: flex; align-items: center; gap: .5rem;
  font-weight: 650; color: var(--text); text-decoration: none; letter-spacing: -.01em;
}
.brand-mark { font-size: 1.2rem; }

.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.25rem 0; color: var(--muted); font-size: .8rem;
}

.badge {
  font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  padding: .2rem .5rem; border-radius: 99px; border: 1px solid var(--border);
}
.badge-admin { background: var(--surface-2); color: var(--muted); }
.badge-warn  { background: var(--warn-bg); border-color: var(--warn-bd); color: var(--warn-tx); }

/* --- Meldungen ----------------------------------------------------- */

.flashes { display: grid; gap: .5rem; margin-bottom: 1.25rem; }
.flash {
  padding: .7rem .9rem; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface-2); font-size: .95rem;
}
.flash-success { background: var(--ok-bg);   border-color: var(--ok-bd);   color: var(--ok-tx); }
.flash-error   { background: var(--err-bg);  border-color: var(--err-bd);  color: var(--err-tx); }
.flash-warn    { background: var(--warn-bg); border-color: var(--warn-bd); color: var(--warn-tx); }

.notice {
  background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: var(--radius); padding: .75rem 1rem; margin: 1rem 0;
}

/* --- Schaltflächen ------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .5rem .9rem; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
  font: inherit; font-weight: 550; line-height: 1.2; text-decoration: none;
  cursor: pointer; transition: background .12s, border-color .12s, transform .04s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .35; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dk); border-color: var(--accent-dk); }
.btn-lg { padding: .7rem 1.3rem; font-size: 1.02rem; }
.btn-small { padding: .3rem .6rem; font-size: .84rem; }
.btn-icon { padding: .25rem .45rem; font-size: .8rem; line-height: 1; }
.btn-ghost { background: transparent; }
.btn-danger { background: var(--err-tx); border-color: var(--err-tx); color: #fff; }
.btn-danger-ghost { color: var(--err-tx); border-color: var(--err-bd); background: transparent; }
.btn-danger-ghost:hover { background: var(--err-bg); }

.actions { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-top: 1.25rem; }

/* --- Formulare ----------------------------------------------------- */

.form { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
        padding: 1.25rem; box-shadow: var(--shadow); max-width: 900px; }
.form-narrow { max-width: 520px; }

.field { margin-bottom: 1rem; }
.field > label { display: block; font-weight: 600; margin-bottom: .3rem; font-size: .93rem; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
@media (max-width: 640px) { .field-row { grid-template-columns: 1fr; } }

input[type=text], input[type=number], input[type=date], input[type=time], select, textarea {
  width: 100%; padding: .55rem .7rem; font: inherit; color: var(--text);
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent);
}
textarea { resize: vertical; min-height: 4.5rem; font-family: inherit; }
input.num { width: 4.5rem; text-align: center; }

.hint { color: var(--muted); font-size: .82rem; margin: .3rem 0 0; font-weight: 400; }

.check { display: flex; gap: .6rem; align-items: flex-start; margin: .55rem 0; font-weight: 500; }
.check input { margin-top: .3rem; width: 1.05rem; height: 1.05rem; flex: none; accent-color: var(--accent); }
.check .hint { display: block; }

.generator { margin-top: .9rem; padding: .8rem; background: var(--surface-2);
             border: 1px solid var(--border); border-radius: 8px; font-size: .88rem; }
.generator-row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: end; margin-top: .5rem; }
.generator-row label { display: grid; gap: .2rem; font-size: .8rem; color: var(--muted); }
.generator-row input, .generator-row select { width: auto; }

.inline { display: inline; }
.inline.grow { display: flex; gap: .35rem; flex: 1 1 12rem; }

/* --- Startseite ---------------------------------------------------- */

.hero { padding: 1.5rem 0 1rem; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1rem; margin: 1.5rem 0; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
        padding: 1rem 1.1rem; box-shadow: var(--shadow); }
.card h3 { margin-top: 0; }
.card p { color: var(--muted); font-size: .93rem; margin-bottom: 0; }

.link-list { list-style: none; padding: 0; display: grid; gap: .5rem; }
.link-list li { background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
                padding: .6rem .85rem; display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.link-list .title { font-weight: 600; margin-right: auto; }

/* --- Links kopieren ------------------------------------------------ */

.linkbox { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
           padding: 1rem 1.1rem; margin: 1rem 0; box-shadow: var(--shadow); }
.linkbox h3 { margin-top: 0; }
.linkbox-admin { border-left: 3px solid var(--warn-bd); }
.copyrow { display: flex; gap: .5rem; flex-wrap: wrap; }
.copyrow input { flex: 1 1 18rem; font-size: .9rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* --- Raster -------------------------------------------------------- */

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch;
                border: 1px solid var(--border); border-radius: var(--radius);
                background: var(--surface); box-shadow: var(--shadow); }

table.grid, table.list-table { border-collapse: collapse; width: 100%; min-width: 32rem; }

table.grid th, table.grid td { border-bottom: 1px solid var(--border); border-right: 1px solid var(--border);
                               padding: .55rem .6rem; vertical-align: top; text-align: left; }
table.grid tr:last-child th, table.grid tr:last-child td { border-bottom: 0; }
table.grid th:last-child, table.grid td:last-child { border-right: 0; }

table.grid thead th { background: var(--surface-2); font-size: .86rem; font-weight: 650;
                      position: sticky; top: 0; z-index: 2; white-space: nowrap; }
table.grid .corner, table.grid .rowhead {
  position: sticky; left: 0; z-index: 3; background: var(--surface-2);
  white-space: nowrap; font-size: .88rem; font-weight: 650; min-width: 7.5rem;
}
table.grid thead .corner { z-index: 4; }
table.grid td { min-width: 8.5rem; }

.cell-open { background: var(--free-bg); }
.cell-full { color: var(--full-tx); font-size: .86rem; }
td.cell-full { background: var(--full-bg); }
.cell-off { color: var(--muted); font-size: .86rem; }
.cell-meta { display: block; color: var(--muted); font-size: .76rem; margin-top: .25rem; }

.slot-add {
  display: flex; align-items: center; gap: .35rem; flex-wrap: wrap;
  padding: .35rem .5rem; border-radius: 7px; text-decoration: none;
  border: 1px dashed var(--free-bd); color: var(--free-tx);
  font-size: .88rem; font-weight: 600; background: var(--surface);
}
.slot-add:hover { background: var(--free-bd); color: var(--free-tx); border-style: solid; }
.slot-add .plus { font-size: 1rem; line-height: 1; }
.slot-add .free { color: var(--muted); font-weight: 400; font-size: .76rem; margin-left: auto; }

.chips { list-style: none; margin: 0 0 .4rem; padding: 0; display: grid; gap: .25rem; }
.chip {
  display: inline-flex; align-items: center; gap: .3rem;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 6px; padding: .15rem .4rem; font-size: .85rem;
}
.chip-mine { border-color: var(--accent); background: var(--surface); }
.chip-note { color: var(--muted); cursor: help; }
.chip-x {
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
  font-size: 1rem; line-height: 1; padding: 0 .1rem; margin-left: auto;
}
.chip-x:hover { color: var(--err-tx); }

.scroll-hint { margin-top: .5rem; }
@media (min-width: 800px) { .scroll-hint { display: none; } }

.page-tools { margin-top: 2rem; font-size: .9rem; }

/* --- Eigene Anmeldungen -------------------------------------------- */

.mine { margin: 1.5rem 0; }
.mine-list { list-style: none; padding: 0; display: grid; gap: .4rem; }
.mine-list li { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center;
                background: var(--surface); border: 1px solid var(--border);
                border-left: 3px solid var(--accent); border-radius: 8px; padding: .5rem .8rem; }
.mine-name { color: var(--muted); margin-right: auto; }

/* --- Dialog -------------------------------------------------------- */

dialog.dialog {
  border: 1px solid var(--border); border-radius: 12px; padding: 1.25rem;
  width: min(430px, calc(100% - 2rem)); background: var(--surface); color: var(--text);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .25);
}
dialog.dialog::backdrop { background: rgba(10, 14, 20, .45); }
dialog.dialog h2 { margin-top: 0; }

/* --- Verwaltung ---------------------------------------------------- */

.admin-nav { display: flex; flex-wrap: wrap; gap: .5rem 1rem; margin: 1rem 0 0;
             padding-top: .75rem; border-top: 1px solid var(--border); font-size: .92rem; }
.admin-section { margin-top: 2.75rem; }
.admin-section > h2 { padding-bottom: .4rem; border-bottom: 2px solid var(--border); }

table.list-table th, table.list-table td { padding: .5rem .7rem; border-bottom: 1px solid var(--border); text-align: left; }
table.list-table thead th { background: var(--surface-2); font-size: .85rem; }

.grid-capacity td { text-align: center; }
.set-all { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: 1rem; }
.set-all label { display: flex; gap: .4rem; align-items: center; font-size: .92rem; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }
@media (max-width: 760px) { .two-col { grid-template-columns: 1fr; } }

.edit-list { list-style: none; padding: 0; display: grid; gap: .4rem; }
.edit-list li { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center;
                background: var(--surface); border: 1px solid var(--border);
                border-radius: 8px; padding: .4rem .5rem; }
.move { display: inline-flex; gap: .2rem; }

.add-form { margin-top: .9rem; display: grid; gap: .4rem; justify-items: start; }
.add-form label { font-size: .88rem; font-weight: 600; }
.add-form textarea { width: 100%; }

.danger-zone { margin-top: 2rem; padding: 1rem 1.1rem; border: 1px solid var(--err-bd);
               border-radius: var(--radius); background: var(--err-bg); }
.danger-zone h3 { margin-top: 0; color: var(--err-tx); }
.danger-zone input[type=text] { width: auto; min-width: 14rem; background: var(--surface); }

.back { margin-bottom: 1rem; font-size: .92rem; }

/* --- Druck --------------------------------------------------------- */

.print-page { background: #fff; color: #000; }
.print-head { margin-bottom: 1.5rem; }
.print-stamp { color: var(--muted); font-size: .85rem; margin-left: .5rem; }
.print-block { break-inside: avoid; margin-bottom: 1.75rem; }
.print-table { width: 100%; border-collapse: collapse; }
.print-table th, .print-table td { border: 1px solid #999; padding: .45rem .6rem; text-align: left; font-size: .95rem; }
.print-table thead th { background: #eee; }
.print-open { color: #666; letter-spacing: .02em; }

@media print {
  .no-print, .site-header, .site-footer { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .wrap { width: 100%; }
  .main { padding: 0; }
  .print-table th, .print-table td { border-color: #333; }
}
