/* ====================================================================
   Helfer-Anmeldung Rettichfest – Styles
   ==================================================================== */

:root {
    --green:   #2f7d3a;
    --green-d: #245f2d;
    --red:     #c0392b;
    --amber:   #e08a00;
    --bg:      #f4f6f3;
    --card:    #ffffff;
    --ink:     #233027;
    --muted:   #6b776e;
    --line:    #dfe5df;
    --accent:  #2f7d3a;
    --radius:  12px;
    --shadow:  0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.04);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--ink);
    line-height: 1.45;
}

h1, h2, h3 { margin: 0 0 .4em; line-height: 1.2; }
p { margin: 0 0 .6em; }
.muted { color: var(--muted); font-size: .9rem; }
.error { color: var(--red); font-size: .9rem; }

/* ---------- Topbar ---------- */
.topbar {
    background: var(--green);
    color: #fff;
    box-shadow: var(--shadow);
    position: sticky; top: 0; z-index: 50;
}
.topbar-inner {
    max-width: none; margin: 0; padding: .7rem 1.5rem;
    display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
}
.brand h1 { font-size: 1.15rem; margin: 0; }
.brand p  { font-size: .8rem; margin: 0; opacity: .9; }

.tabs { display: flex; gap: .35rem; margin-left: auto; }
.tabs button {
    background: rgba(255,255,255,.15); color: #fff; border: 0;
    padding: .5rem .9rem; border-radius: 999px; cursor: pointer;
    font-size: .9rem; font-weight: 600;
}
.tabs button.active { background: #fff; color: var(--green-d); }

.editor-box { display: flex; align-items: center; gap: .5rem; }
.editor-badge { font-size: .8rem; background: #ffd54a; color: #5a4500; padding: .25rem .6rem; border-radius: 999px; font-weight: 700; }

/* ---------- Buttons & Felder ---------- */
button {
    font: inherit; cursor: pointer; border-radius: 8px; border: 1px solid transparent;
    padding: .5rem .9rem;
}
button.primary { background: var(--green); color: #fff; border-color: var(--green-d); font-weight: 600; }
button.primary:hover { background: var(--green-d); }
button.ghost { background: rgba(255,255,255,.15); color: #fff; border: 1px solid rgba(255,255,255,.4); }
.toolbar button.ghost, .editor-box button.ghost { color: #fff; }
button.big { padding: .7rem 1.6rem; font-size: 1rem; }

main { max-width: none; margin: 0; padding: 1rem 1.5rem; }

.card {
    background: var(--card); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 1rem 1.1rem; margin-bottom: 1rem;
    box-shadow: var(--shadow);
}
.intro p { margin: 0; }

.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .8rem; }
.field { display: flex; flex-direction: column; gap: .25rem; font-size: .9rem; }
.field > span { font-weight: 600; }
.field input {
    padding: .55rem .65rem; border: 1px solid var(--line); border-radius: 8px;
    font: inherit; background: #fff;
}
.field.inline { flex-direction: row; align-items: center; gap: .4rem; }
.field input.tiny { width: 70px; }

.extras { display: flex; flex-wrap: wrap; gap: .9rem 1.4rem; margin: 1rem 0; padding: .8rem 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.check { display: flex; align-items: center; gap: .45rem; font-size: .92rem; }
.check input { width: 18px; height: 18px; }

.submit-bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.dup-warning { width: 100%; background: #fff3cd; border: 1px solid #ffe19a; color: #6b4e00; border-radius: 8px; padding: .6rem .8rem; font-size: .9rem; line-height: 1.4; }

/* ---------- Schicht-Tabellen ---------- */
.day-block { margin-bottom: 1.2rem; }
.day-title {
    background: var(--green); color: #fff; padding: .5rem .8rem;
    border-radius: var(--radius) var(--radius) 0 0; font-size: 1rem; font-weight: 700;
}
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 var(--radius) var(--radius); background: #fff; }
table.shift { border-collapse: collapse; width: 100%; min-width: 720px; font-size: .82rem; }
table.shift th, table.shift td { border: 1px solid var(--line); padding: .3rem .35rem; vertical-align: top; }
table.shift thead th { background: #eef3ee; font-weight: 700; text-align: center; position: sticky; top: 0; }
table.shift th.time-col { background: #e7efe7; text-align: left; white-space: nowrap; min-width: 92px; font-weight: 700; }

td.cell { min-width: 86px; height: 46px; position: relative; transition: background .12s; }
td.cell .count { font-size: .68rem; color: var(--muted); display: block; text-align: right; }
td.cell.empty   { background: #fdeceb; }
td.cell.partial { background: #fff6e0; }
td.cell.full    { background: #e7f5e9; }
td.cell.blocked { background: #1e1e1e; cursor: default; -webkit-print-color-adjust: exact; print-color-adjust: exact; }

/* Auswahlmodus (Anmelden) */
td.cell.selectable { cursor: pointer; }
td.cell.selectable:hover { outline: 2px solid var(--green); outline-offset: -2px; }
td.cell.selected { background: var(--green) !important; }
td.cell.selected .count, td.cell.selected .chip { color: #fff; }
td.cell.selected::after { content: "✓ ich"; position: absolute; bottom: 2px; left: 4px; font-size: .68rem; color: #fff; font-weight: 700; }

.chip {
    display: inline-block; background: #eef3ee; border: 1px solid var(--line);
    border-radius: 6px; padding: 1px 5px; margin: 1px; font-size: .74rem; max-width: 100%;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chip.drag { cursor: grab; }
.chip.dragging { opacity: .4; }
td.cell.dropok { outline: 2px dashed var(--green); outline-offset: -2px; }
.cell-add { position: absolute; top: 1px; right: 2px; font-size: .7rem; background: var(--green); color:#fff; border-radius: 4px; padding: 0 4px; line-height: 1.3; display: none; }
body.editor td.cell:hover .cell-add { display: inline-block; }
.cap-edit { cursor: pointer; text-decoration: underline dotted; }

/* Unterstation am Chip (nur Editor) */
.subtag { display: inline-block; margin-left: 4px; background: var(--green); color: #fff;
          border-radius: 4px; padding: 0 4px; font-size: .66rem; font-weight: 700; vertical-align: 1px; }
.cell-subsum { font-size: .66rem; color: var(--green-d); margin-top: 2px; line-height: 1.3; }

/* Klick-Menü am Chip */
.chip-menu { position: fixed; z-index: 200; background: #fff; border: 1px solid var(--line);
             border-radius: 10px; box-shadow: var(--shadow); padding: .5rem; min-width: 160px; max-width: 240px; }
.chip-menu .cm-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .4rem; }
.chip-menu .cm-name { font-weight: 700; font-size: .85rem; }
.chip-menu .cm-x { border: 0; background: none; color: var(--muted); font-size: .9rem; line-height: 1; padding: .1rem .3rem; cursor: pointer; }
.chip-menu .cm-x:hover { color: var(--ink); }
.chip-menu .cm-input { width: 100%; padding: .4rem .5rem; border: 1px solid var(--line); border-radius: 7px; font: inherit; font-size: .85rem; margin-bottom: .5rem; }
.chip-menu .cm-go { width: 100%; font-size: .8rem; padding: .4rem; border: 1px solid var(--green-d); background: var(--green); color: #fff; border-radius: 6px; font-weight: 600; }
.chip-menu .cm-suggest { display: flex; flex-direction: column; gap: 2px; margin-bottom: .5rem; max-height: 160px; overflow: auto; }
.chip-menu .cm-suggest:empty { margin: 0; }
.chip-menu .cm-sug { text-align: left; font-size: .8rem; padding: .3rem .5rem; border: 1px solid var(--line); background: #fff; border-radius: 6px; cursor: pointer; }
.chip-menu .cm-sug:hover { background: #eef3ee; }
.chip-menu .cm-label { font-size: .7rem; color: var(--muted); margin-bottom: .25rem; }
.chip-menu .cm-subs { display: flex; flex-wrap: wrap; gap: .25rem; margin-bottom: .5rem; }
.chip-menu .cm-subs button { font-size: .75rem; padding: .2rem .5rem; border: 1px solid var(--line);
             background: #f4f6f3; border-radius: 6px; color: var(--ink); }
.chip-menu .cm-subs button.active { background: var(--green); color: #fff; border-color: var(--green-d); }
.chip-menu .cm-edit { width: 100%; font-size: .8rem; padding: .35rem; margin-bottom: .35rem;
             border: 1px solid var(--line); background: #f4f6f3; color: var(--ink); border-radius: 6px; }
.chip-menu .cm-del { width: 100%; font-size: .8rem; padding: .35rem; border: 1px solid #f0c9c4;
             background: #fdeceb; color: var(--red); border-radius: 6px; }

/* ---------- Kuchen ---------- */
.cake-card { background: #fffaf0; border-color: #f0e3c8; }
.cake-card h3 { color: #9a6b00; }
.cake-day { background: #fff; border: 1px solid #f0e3c8; border-radius: 10px; padding: .8rem; }
.cake-day-label { font-weight: 700; color: #9a6b00; display: block; margin-bottom: .5rem; }
.cake-fields { display: flex; flex-direction: column; gap: .6rem; }

.cake-col { background: #fff; border: 1px solid #f0e3c8; border-radius: 10px; padding: .8rem 1rem; }
.cake-col h4 { margin: 0 0 .5rem; color: #9a6b00; border-bottom: 1px solid #f0e3c8; padding-bottom: .35rem; }
.cake-ul { list-style: none; margin: 0; padding: 0; }
.cake-ul li { display: flex; align-items: baseline; gap: .5rem; padding: .25rem 0; border-bottom: 1px dotted #eadfc6; font-size: .9rem; }
.ck-name { font-weight: 600; flex: 1; }
.ck-qty { background: #ffe9b8; color: #6b4e00; border-radius: 5px; padding: 0 .45rem; font-weight: 700; font-size: .82rem; min-width: 1.4rem; text-align: center; }
.ck-kind { color: var(--muted); font-size: .85rem; }
.cake-total { margin: .6rem 0 0; font-size: .95rem; }
.cake-total strong { color: #9a6b00; font-size: 1.1rem; }

/* ---------- Helferliste ---------- */
.helper-row { display: flex; gap: .6rem; align-items: baseline; padding: .35rem 0; border-bottom: 1px solid var(--line); font-size: .9rem; flex-wrap: wrap; }
.helper-row .hname { font-weight: 600; min-width: 140px; }
.helper-row .tags { color: var(--muted); font-size: .82rem; }
.helper-row .tag { background: #eef3ee; border-radius: 5px; padding: 1px 6px; margin-right: 4px; }
.helper-row .tag-warn { background: #fdeceb; color: var(--red); border: 1px solid #f0c9c4; font-weight: 600; }
.helper-row .edit { margin-left: auto; color: var(--green-d); background: none; border: 0; cursor: pointer; font-size: .82rem; }
.helper-row .del { margin-left: .6rem; color: var(--red); background: none; border: 0; cursor: pointer; font-size: .82rem; }
.add-helper { margin-bottom: .8rem; font-size: .85rem; padding: .45rem .8rem; }

/* ---------- Hinweis: neue Anmeldungen ---------- */
.newsignups { background: #fff8e1; border-color: #ffe19a; }
.ns-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin-bottom: .4rem; flex-wrap: wrap; }
.ns-head h3 { margin: 0; color: #8a6100; font-size: 1rem; }
.ns-allseen { font-size: .8rem; color: var(--ink); border-color: var(--line); background: #fff; }
.ns-row { display: flex; align-items: center; justify-content: space-between; gap: .8rem; padding: .5rem 0; border-top: 1px solid #ffe19a; flex-wrap: wrap; }
.ns-info { display: flex; flex-direction: column; gap: .3rem; flex: 1; min-width: 200px; }
.ns-name { font-weight: 700; }
.ns-what { display: flex; flex-wrap: wrap; gap: .3rem; }
.ns-tag { background: #fff; border: 1px solid #ffe19a; border-radius: 5px; padding: 1px 6px; font-size: .8rem; }
.ns-seen { font-size: .85rem; padding: .4rem .9rem; white-space: nowrap; }

/* ---------- Toolbar / Legende ---------- */
.toolbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .6rem; }
.legend { font-size: .85rem; color: var(--muted); display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.toolbar-actions { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; }
.toolbar .ghost { color: var(--ink); border-color: var(--line); background: #fff; }
.dot { width: 14px; height: 14px; border-radius: 4px; display: inline-block; vertical-align: -2px; margin-left: .5rem; border: 1px solid var(--line); }
.dot.empty { background: #fdeceb; } .dot.partial { background: #fff6e0; } .dot.full { background: #e7f5e9; } .dot.blocked { background: #1e1e1e; }

/* ---------- Dialog / Toast ---------- */
dialog { border: 0; border-radius: var(--radius); padding: 1.3rem; box-shadow: var(--shadow); max-width: 360px; }
dialog.form-dialog { max-width: 560px; width: 92vw; }
dialog.form-dialog h3 { margin-bottom: .8rem; }
dialog.form-dialog .grid2 { margin-bottom: .3rem; }
dialog::backdrop { background: rgba(0,0,0,.35); }
dialog input { width: 100%; padding: .55rem; border: 1px solid var(--line); border-radius: 8px; font: inherit; margin: .5rem 0; }
dialog menu { display: flex; gap: .5rem; justify-content: flex-end; padding: 0; margin: .8rem 0 0; }
dialog .ghost { background: #eee; color: var(--ink); border: 1px solid var(--line); }

.loading { text-align: center; color: var(--muted); padding: 3rem; }
.toast {
    position: fixed; bottom: 1.2rem; left: 50%; transform: translateX(-50%);
    background: var(--ink); color: #fff; padding: .7rem 1.2rem; border-radius: 999px;
    box-shadow: var(--shadow); z-index: 100; font-size: .9rem; max-width: 90vw;
}
.toast.err { background: var(--red); }

.print-header { text-align: center; margin-bottom: 1rem; }

/* ---------- Druck / PDF ---------- */
@media print {
    @page { size: A4 landscape; margin: 10mm; }
    .topbar, .no-print, .tabs, .editor-box, #helperListCard .del, .cell-add { display: none !important; }
    body { background: #fff; }
    main { max-width: none; padding: 0; }
    .card { box-shadow: none; border: none; padding: 0; margin: 0 0 .5rem; }
    .print-header { display: block !important; }
    .table-wrap { overflow: visible; border: 1px solid #999; }
    table.shift { min-width: 0; font-size: .7rem; page-break-inside: auto; }
    table.shift th, table.shift td { border: 1px solid #999; }
    td.cell.empty, td.cell.partial, td.cell.full { background: #fff !important; -webkit-print-color-adjust: exact; }
    td.cell.blocked { background: #1e1e1e !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .day-block { page-break-inside: avoid; }
    #view-signup { display: none !important; }
}

@media (max-width: 600px) {
    .brand { width: 100%; }
    .tabs { margin-left: 0; }
}
