/* ============================================================
   Nikolausmarkt 2026 – Personalplanung (KSV Weissach e.V.)
   Farbschema: KSV-Blau #003087 (kein Hintergrundmuster)
   ============================================================ */

:root {
    --blue-950: #0b1e46;
    --blue-900: #001f5c;
    --blue-800: #003087;   /* KSV-Blau */
    --blue-700: #0a44a8;
    --blue-600: #1e5ac4;
    --blue-500: #3b76e0;
    --blue-200: #bcd3f5;
    --blue-100: #dbe8fc;
    --blue-50:  #eef4fd;

    --pine-800: #14532d;
    --pine-700: #15803d;
    --pine-100: #dcfce7;

    --amber-700: #92400e;
    --amber-500: #f59e0b;
    --amber-100: #fef3c7;

    --bg:       #f4f7fc;
    --card:     #ffffff;
    --ink:      #1f2937;
    --ink-soft: #4b5563;
    --line:     #dde5f0;
    --shadow:   0 10px 30px rgba(0, 30, 80, .10);
    --radius:   16px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg);
    color: var(--ink);
    line-height: 1.5;
}

.hidden { display: none !important; }
.ic { width: 18px; height: 18px; vertical-align: -3px; }
.ic-sm { width: 15px; height: 15px; vertical-align: -2px; }

/* ============================ KOPF ============================ */
.site-header {
    background: linear-gradient(135deg, var(--blue-900) 0%, var(--blue-800) 55%, var(--blue-700) 100%);
    color: #fff;
    border-bottom: 3px solid var(--blue-500);
}
.header-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 16px;
}
.header-logo {
    height: 56px;
    width: auto;
    background: #fff;
    border-radius: 12px;
    padding: 6px 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,.25);
}
.header-text { flex: 1; min-width: 0; }
.header-kicker {
    font-size: .72rem;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--blue-200);
    font-weight: 600;
}
.header-title {
    margin: 2px 0 0;
    font-size: 1.5rem;
    line-height: 1.1;
    font-weight: 800;
    color: #fff;
}
.header-year {
    color: var(--blue-200);
}
.header-sub {
    font-size: .85rem;
    color: rgba(255,255,255,.85);
    margin-top: 2px;
}
.header-deco {
    font-size: 2rem;
    color: var(--blue-200);
    opacity: .9;
}

/* ============================ TOOLBAR ============================ */
.toolbar {
    position: sticky;
    top: 0;
    z-index: 40;
    background: rgba(255, 255, 255, .95);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 2px 10px rgba(0,30,80,.08);
}
.toolbar-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 8px 16px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 14px;
}
.toolbar-left, .toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.toolbar-divider {
    width: 1px;
    height: 26px;
    background: var(--line);
    margin: 0 4px;
}
.sync-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: .78rem;
    font-weight: 600;
    background: #eef3fb;
    color: var(--ink-soft);
    border-radius: 999px;
    padding: 5px 12px;
    border: 1px solid var(--line);
}
.sync-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #9ca3af;
    flex: none;
}
.sync-pill.ok   .sync-dot { background: var(--pine-700); }
.sync-pill.err  .sync-dot { background: #dc2626; }
.sync-pill.busy .sync-dot { background: var(--blue-500); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.last-update {
    font-size: .75rem;
    color: var(--ink-soft);
    white-space: nowrap;
}

/* ============================ BUTTONS ============================ */
.btn {
    font: inherit;
    font-size: .85rem;
    font-weight: 600;
    padding: 7px 14px;
    border-radius: 999px;
    border: 1px solid transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background .15s, color .15s, border-color .15s, transform .05s;
    white-space: nowrap;
    background: transparent;
    color: var(--ink);
}
.btn:active { transform: translateY(1px); }
.btn-ghost {
    border-color: var(--line);
    background: #fff;
    color: var(--ink-soft);
}
.btn-ghost:hover { border-color: var(--blue-800); color: var(--blue-800); background: var(--blue-50); }
.btn-icon { padding: 7px 9px; }
.btn-primary {
    background: linear-gradient(135deg, var(--blue-700), var(--blue-800));
    color: #fff;
    box-shadow: 0 3px 10px rgba(0,48,135,.35);
}
.btn-primary:hover { filter: brightness(1.12); }
.btn-admin {
    background: var(--blue-800);
    color: #fff;
}
.btn-admin:hover { filter: brightness(1.15); }
.btn-danger {
    background: #fff;
    color: var(--blue-800);
    border-color: var(--blue-500);
}
.btn-danger:hover { background: var(--blue-800); color: #fff; }
.btn-sm { font-size: .78rem; padding: 4px 10px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.admin-box {
    display: flex;
    align-items: center;
    gap: 8px;
}
.admin-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: .78rem;
    font-weight: 600;
    color: var(--ink-soft);
    background: #eef3fb;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 5px 12px;
}
.admin-label.admin-active {
    background: var(--blue-100);
    border-color: var(--blue-600);
    color: var(--blue-900);
}
.admin-pw {
    font: inherit;
    font-size: .85rem;
    width: 150px;
    padding: 6px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    outline: none;
    background: #fff;
}
.admin-pw:focus { border-color: var(--blue-800); box-shadow: 0 0 0 3px rgba(0,48,135,.12); }

/* Admin-Hinweis */
.admin-hint {
    max-width: 1100px;
    margin: 12px auto 0;
    padding: 10px 16px;
    background: var(--blue-100);
    border: 1px solid var(--blue-600);
    color: var(--blue-900);
    border-radius: 12px;
    font-size: .86rem;
}
.admin-hint-tip {
    display: inline-block;
    margin-left: 8px;
    padding-left: 8px;
    border-left: 2px solid var(--blue-600);
}
@media (max-width: 640px) {
    .admin-hint-tip { display: block; margin: 6px 0 0; padding: 6px 0 0; border-left: none; border-top: 2px solid var(--blue-600); }
}

/* ============================ PANELS / CONTAINER ============================ */
.container { max-width: 1100px; margin: 0 auto; padding: 18px 16px 40px; }
.panel {
    max-width: 1100px;
    margin: 14px auto 0;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px 18px;
    box-shadow: var(--shadow);
}
.panel-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.panel h2 { margin: 0; font-size: 1.05rem; }
.help-list { margin: 10px 0 0; padding-left: 20px; color: var(--ink-soft); font-size: .9rem; }
.help-list li { margin: 6px 0; }

.loading {
    text-align: center;
    color: var(--ink-soft);
    padding: 60px 0;
    font-size: .95rem;
}

/* ============================ SCHICHT-KARTEN ============================ */
.shift-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 22px;
    overflow: hidden;
}
.shift-head {
    background: linear-gradient(120deg, var(--blue-800), var(--blue-600));
    color: #fff;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.shift-title { font-weight: 700; font-size: 1rem; line-height: 1.25; }
.shift-subtitle { font-size: .8rem; opacity: .88; font-weight: 400; margin-top: 1px; }
.shift-badges {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.badge {
    font-size: .74rem;
    font-weight: 700;
    background: rgba(255,255,255,.16);
    border: 1px solid rgba(255,255,255,.35);
    border-radius: 999px;
    padding: 4px 10px;
    white-space: nowrap;
}
.badge-fill {
    background: var(--blue-600);
    border-color: transparent;
}
.badge-fill.full { background: var(--pine-700); color: #fff; }
.shift-note {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .8rem;
    color: var(--blue-900);
    background: var(--blue-50);
    border-bottom: 1px solid var(--blue-200);
    padding: 7px 16px;
}

/* ---------- Tabelle (Desktop) ---------- */
.table-wrap { overflow-x: auto; padding: 6px; }
.plan-table { border-collapse: collapse; width: 100%; }
.plan-table th {
    background: var(--blue-900);
    color: #fff;
    font-weight: 600;
    font-size: .74rem;
    padding: 8px 6px;
    text-align: center;
    border: 1px solid #001a4d;
    white-space: nowrap;
}
.plan-table th.fixed { min-width: 96px; }
.plan-table td {
    padding: 7px 5px;
    border: 1px solid var(--line);
    text-align: center;
    font-size: .84rem;
    vertical-align: middle;
}
.plan-table td.fixed {
    background: #f0f5fc;
    font-weight: 700;
    font-size: .78rem;
    white-space: nowrap;
}
.plan-table td.fixed .time-empty { color: #9ca3af; font-weight: 400; }

.slot-cell { min-width: 108px; cursor: pointer; }
.slot-empty { background: #fbfcfe; }
.slot-filled { background: var(--pine-100); }
.slot-filled:hover { background: #d1fae5; }
.slot-name {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-weight: 600;
    color: var(--pine-800);
    min-height: 26px;
}
.slot-actions { display: flex; gap: 2px; margin-left: auto; }
.slot-action {
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--ink-soft);
    border-radius: 6px;
    padding: 2px 5px;
    font-size: .85rem;
    line-height: 1;
}
.slot-action:hover { background: rgba(0,0,0,.08); color: var(--blue-800); }

.btn-signup {
    width: 100%;
    padding: 6px 8px;
    font: inherit;
    font-size: .78rem;
    font-weight: 600;
    color: var(--blue-800);
    background: #fff;
    border: 1.5px dashed #b9c9e8;
    border-radius: 8px;
    cursor: pointer;
    transition: all .12s;
    min-height: 30px;
}
.btn-signup:hover {
    background: var(--blue-50);
    border-color: var(--blue-800);
    color: var(--blue-800);
}

/* ---------- Liste (mobil) ---------- */
.plan-list { padding: 8px 12px 12px; }
.pl-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 2px;
    border-bottom: 1px dashed var(--line);
}
.pl-row:last-child { border-bottom: none; }
.pl-role { font-size: .85rem; font-weight: 600; color: var(--ink-soft); }
.pl-name { font-size: .9rem; font-weight: 700; color: var(--pine-800); }
.pl-empty-btn {
    font: inherit;
    font-size: .8rem;
    font-weight: 700;
    color: var(--blue-800);
    background: #fff;
    border: 1.5px dashed #b9c9e8;
    border-radius: 999px;
    padding: 5px 14px;
    cursor: pointer;
}
.pl-empty-btn:hover { background: var(--blue-50); border-color: var(--blue-800); }
.pl-admin-actions { display: flex; gap: 6px; }

/* ============================ MODALS ============================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 25, 60, .55);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 60;
}
.modal-card {
    position: relative;
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: 0 24px 60px rgba(0,0,0,.35);
    width: 100%;
    max-width: 440px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 22px;
}
.modal-wide { max-width: 760px; }
.modal-close {
    position: absolute;
    top: 10px;
    right: 12px;
    border: none;
    background: transparent;
    font-size: 1.6rem;
    line-height: 1;
    color: var(--ink-soft);
    cursor: pointer;
    padding: 4px 8px;
}
.modal-close:hover { color: var(--blue-800); }
.modal-title { margin: 0 0 10px; font-size: 1.2rem; }
.modal-sub { margin: 0 0 12px; font-size: .83rem; color: var(--ink-soft); }
.modal-info {
    background: #f0f5fc;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px 14px;
    font-size: .9rem;
    margin-bottom: 12px;
}
.modal-info strong { display: block; }
.modal-info .mi-sub { font-size: .78rem; color: var(--ink-soft); }
.modal-info .mi-role {
    display: inline-block;
    margin-top: 6px;
    font-size: .78rem;
    font-weight: 700;
    color: var(--blue-800);
    background: var(--blue-100);
    border-radius: 999px;
    padding: 3px 10px;
}
.name-input {
    width: 100%;
    font: inherit;
    font-size: 1rem;
    padding: 11px 14px;
    border: 1.5px solid var(--line);
    border-radius: 12px;
    outline: none;
}
.name-input:focus { border-color: var(--blue-800); box-shadow: 0 0 0 3px rgba(0,48,135,.12); }
.suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}
.suggestion {
    font: inherit;
    font-size: .78rem;
    font-weight: 600;
    padding: 4px 11px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: #fff;
    cursor: pointer;
    color: var(--ink-soft);
}
.suggestion:hover { border-color: var(--blue-800); color: var(--blue-800); background: var(--blue-50); }
.suggestions-empty { font-size: .76rem; color: #9ca3af; }
.double-booking {
    margin-top: 10px;
    font-size: .8rem;
    background: var(--amber-100);
    border: 1px solid var(--amber-500);
    color: var(--amber-700);
    border-radius: 10px;
    padding: 8px 12px;
}
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
}
.modal-actions-between { justify-content: space-between; flex-wrap: wrap; }

/* ============================ ÜBERSICHT ============================ */
.ov-section { margin-bottom: 20px; }
.ov-h4 {
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--ink-soft);
    margin: 0 0 10px;
}
.ov-shifts { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.ov-shift {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px 12px;
    background: #f6f9fe;
}
.ov-shift-name { font-size: .8rem; font-weight: 700; margin-bottom: 6px; }
.ov-bar {
    height: 8px;
    border-radius: 999px;
    background: #e4ecf9;
    overflow: hidden;
    margin-bottom: 4px;
}
.ov-bar > div { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--blue-800), var(--blue-500)); }
.ov-shift .ov-count { font-size: .74rem; color: var(--ink-soft); }
.ov-person {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 4px;
    border-bottom: 1px dashed var(--line);
    flex-wrap: wrap;
}
.ov-person:last-child { border-bottom: none; }
.ov-person-name {
    font-weight: 700;
    font-size: .9rem;
    min-width: 130px;
}
.ov-person-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ov-chip {
    font-size: .72rem;
    font-weight: 600;
    background: var(--blue-100);
    color: var(--blue-800);
    border-radius: 999px;
    padding: 3px 9px;
}
.ov-empty { color: var(--ink-soft); font-size: .86rem; padding: 6px 0; }

/* ============================ PLAN-GENERIERUNG (Admin) ============================ */
.gen-section {
    border: 1.5px dashed var(--blue-500);
    border-radius: 12px;
    background: var(--blue-50);
    padding: 12px;
    margin-bottom: 16px;
}
.gen-hint {
    font-size: .8rem;
    color: var(--ink-soft);
    margin: 0 0 10px;
}
.gen-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.gen-label {
    font-size: .8rem;
    font-weight: 700;
    color: var(--blue-900);
}
.gen-date {
    width: auto;
    min-width: 170px;
    padding: 8px 12px;
}
.gen-pv {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 8px;
    margin-top: 10px;
}
.gen-pv-item {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 8px 10px;
    font-size: .78rem;
    line-height: 1.4;
}
.gen-pv-item b { color: var(--blue-900); }
.gen-pv-item em { color: var(--ink-soft); font-style: normal; font-size: .74rem; }
.gen-warn {
    margin-top: 10px;
    font-size: .8rem;
    background: var(--amber-100);
    border: 1px solid var(--amber-500);
    color: var(--amber-700);
    border-radius: 10px;
    padding: 8px 12px;
}

/* ============================ EDITOR (Admin) ============================ */
.editor-shift {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 12px;
    background: #f6f9fe;
}
.editor-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.editor-grid .full { grid-column: 1 / -1; }
.editor-field label {
    display: block;
    font-size: .72rem;
    font-weight: 700;
    color: var(--ink-soft);
    margin-bottom: 3px;
}
.editor-field input {
    width: 100%;
    font: inherit;
    font-size: .85rem;
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    outline: none;
    background: #fff;
}
.editor-field input:focus { border-color: var(--blue-800); }
.editor-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.editor-head .eidx { font-size: .72rem; color: #9ca3af; font-weight: 700; }
.editor-shift.editor-new {
    animation: editorFlash 1.6s ease;
    border: 1.5px solid var(--blue-600);
}
@keyframes editorFlash {
    0%   { background: var(--blue-100); }
    100% { background: #f6f9fe; }
}

/* ============================ FAB ============================ */
.fab {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 50;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--blue-700), var(--blue-800));
    color: #fff;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(0,48,135,.4);
    display: flex;
    align-items: center;
    justify-content: center;
}
.fab:hover { transform: scale(1.06); }

/* ============================ TOASTS ============================ */
.toast-wrap {
    position: fixed;
    top: 74px;
    right: 16px;
    z-index: 80;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 320px;
}
.toast {
    background: #fff;
    border-left: 4px solid var(--pine-700);
    border-radius: 10px;
    box-shadow: 0 10px 26px rgba(0,0,0,.18);
    padding: 11px 14px;
    font-size: .85rem;
    animation: slidein .25s ease;
}
.toast.err { border-left-color: #dc2626; }
.toast.warn { border-left-color: var(--amber-500); }
@keyframes slidein { from { opacity: 0; transform: translateX(20px); } }

/* ============================ FUSS ============================ */
.site-footer {
    border-top: 1px solid var(--line);
    background: #fff;
    padding: 18px 16px 34px;
}
.footer-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: .83rem;
    color: var(--ink-soft);
}
.footer-logo { height: 34px; width: auto; }
.footer-note { font-size: .76rem; color: #9ca3af; }

/* ============================ RESPONSIVE ============================ */
@media (max-width: 640px) {
    .plan-table-wrap { display: none; }
    .header-logo { height: 44px; }
    .header-title { font-size: 1.25rem; }
    .toolbar-inner { gap: 6px; }
    .admin-pw { width: 118px; }
    .modal-actions-between { flex-direction: column; align-items: stretch; }
    .modal-actions-between > div { justify-content: center; }
}
@media (min-width: 641px) {
    .plan-list-wrap { display: none; }
}

/* ============================ DRUCKVERSION ============================ */
@media print {
    body { background: #fff; }
    .toolbar, .admin-hint, .modal-overlay, .toast-wrap, .fab,
    .btn-signup, .slot-actions, .pl-empty-btn, .pl-admin-actions,
    .btn, .header-deco, #help-panel, #btn-help, #btn-overview, #btn-print,
    #btn-install, .admin-box { display: none !important; }
    .site-header { border-bottom: 2px solid #000; background: #fff !important; color: #000; }
    .header-year { color: #000; }
    .header-kicker { color: #555; }
    .plan-list-wrap { display: none !important; }
    .plan-table-wrap { display: block !important; }
    .container { padding: 0; }
    .shift-card { break-inside: avoid; box-shadow: none; border: 1px solid #bbb; margin-bottom: 14px; }
    .shift-head { background: #eee !important; color: #000; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .plan-table th { background: #ddd !important; color: #000; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .slot-filled { background: #e8f7ee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .plan-table td.fixed { background: #f5f5f5 !important; }
    .site-footer { border-top: 1px solid #999; }
}

/* Einzelne Helferplätze im Schicht-Editor */
.ed-role-list{display:flex;flex-direction:column;gap:6px;margin:6px 0 8px}
.ed-role-row{display:flex;gap:8px;align-items:center}
.ed-role-row input.ed-role{flex:1;min-width:0;width:auto}
.ed-role-row .ed-role-del{flex:none;white-space:nowrap}
@media(max-width:480px){.ed-role-row .ed-role-del{font-size:.7rem;padding:6px 8px}}

/* Reihenfolge der Schichten */
.editor-head{gap:8px;flex-wrap:wrap}
.ed-order-actions{display:flex;flex-wrap:wrap;gap:6px;align-items:center}
.ed-order-actions button:disabled{opacity:.4;cursor:not-allowed}

.ed-role-up,.ed-role-down{flex:none;min-width:36px;padding:6px 9px}
.ed-role-up:disabled,.ed-role-down:disabled{opacity:.4;cursor:not-allowed}
@media(max-width:440px){.ed-role-row{flex-wrap:wrap}.ed-role-row input.ed-role{flex:1 1 100%;width:100%}}
