:root {
  --bg: #f3f5f7; --card: #fff; --line: #dfe4ea; --text: #1d2730; --muted: #66727f;
  --primary: #2b6cb0; --primary-d: #245a93; --danger: #c53030; --ok: #2f855a; --warn: #b7791f;
  --radius: 8px; --shadow: 0 1px 3px rgba(20,30,40,.08), 0 4px 14px rgba(20,30,40,.06);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.45 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; color: var(--text); background: var(--bg); }
a { color: var(--primary); }
h1 { font-size: 20px; margin: 0 0 14px; } h2 { font-size: 16px; margin: 22px 0 8px; } h3 { font-size: 14px; margin: 14px 0 6px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
.muted { color: var(--muted); } .small { font-size: 12px; } .right { text-align: right; } .nowrap { white-space: nowrap; }
.loading { padding: 40px; text-align: center; color: var(--muted); }

/* Kopfzeile */
.topbar { display: flex; align-items: center; gap: 24px; padding: 0 18px; height: 52px; background: #1f2d3a; color: #fff; position: sticky; top: 0; z-index: 20; }
.brand { font-weight: 600; font-size: 15px; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.brand .logo { color: #d8b65c; }
.nav { display: flex; gap: 2px; }
.nav button { background: transparent; border: 0; color: #c6d0da; padding: 8px 14px; border-radius: 6px; font-size: 14px; cursor: pointer; }
.nav button:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav button.active { background: rgba(255,255,255,.14); color: #fff; font-weight: 600; }

.userbox { margin-left: auto; display: flex; align-items: center; gap: 8px; color: #c6d0da; font-size: 13px; white-space: nowrap; }
.userbox b { color: #fff; font-weight: 600; }
.userbox button { background: rgba(255,255,255,.1); border: 0; color: #fff; padding: 6px 10px; border-radius: 6px; cursor: pointer; font-size: 12.5px; }
.userbox button:hover { background: rgba(255,255,255,.2); }
.loginbody { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: #1f2d3a; }
.loginbox { background: #fff; border-radius: 12px; padding: 28px 30px; width: 100%; max-width: 380px; box-shadow: 0 20px 60px rgba(0,0,0,.35); margin: 16px; }
main { padding: 14px 18px 40px; }
.page { max-width: 1100px; }

/* Buttons & Formulare */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 6px; border: 1px solid var(--line); background: #fff; color: var(--text); font-size: 13.5px; cursor: pointer; text-decoration: none; line-height: 1.2; white-space: nowrap; }
.btn:hover { background: #f5f7fa; border-color: #c9d1da; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-d); }
.btn.danger { color: var(--danger); border-color: #f1c4c4; } .btn.danger:hover { background: #fff3f3; }
.btn.ghost { border-color: transparent; background: transparent; } .btn.ghost:hover { background: #e9edf2; }
.btn.sm { padding: 4px 9px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: default; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); font-weight: 500; }
input, select, textarea { font: inherit; color: var(--text); padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; background: #fff; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid #bcd3ee; border-color: var(--primary); }
input[type=color] { padding: 2px; height: 34px; width: 48px; }
input[type=checkbox] { width: auto; }
textarea { resize: vertical; }
.form { display: flex; flex-direction: column; gap: 12px; }
.row2, .row3, .row4 { display: grid; gap: 12px; } .row2 { grid-template-columns: 1fr 1fr; } .row3 { grid-template-columns: 1fr 1fr 1fr; } .row4 { grid-template-columns: repeat(4, 1fr); }
.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); }
.field-help { font-size: 12px; color: var(--muted); margin-top: -6px; }

/* Toolbar Tagesplan */
.toolbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 10px; }
.datenav { display: flex; align-items: center; gap: 6px; }
.datenav input[type=date] { width: 150px; padding: 6px 8px; }
.daylabel { font-weight: 600; font-size: 15px; margin-left: 6px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: #fff; }
.seg button { border: 0; background: transparent; padding: 7px 14px; cursor: pointer; font-size: 13.5px; color: var(--muted); }
.seg button.active { background: #e4edf8; color: var(--primary); font-weight: 600; }
.actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.summary { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; align-items: stretch; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 14px; min-width: 110px; }
.kpi span { display: block; font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.kpi b { font-size: 18px; }
.chip { display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--line); border-left-width: 4px; border-radius: var(--radius); padding: 6px 12px; font-size: 13px; }
.chip b { font-size: 13px; } .chip .muted { font-size: 12px; }

/* Zeitraster */
.gridwrap { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: auto; max-height: calc(100vh - 215px); }
.grid { display: grid; min-width: 600px; }
.ghead { position: sticky; top: 0; z-index: 5; background: #fff; border-bottom: 1px solid var(--line); border-left: 1px solid var(--line); padding: 8px 10px; font-weight: 600; text-align: center; border-top: 3px solid #999; }
.ghead.corner { border-top-color: transparent; border-left: 0; }
.timecol { position: relative; border-right: 1px solid var(--line); background: #fafbfc; }
.timecol .hour { position: absolute; right: 6px; font-size: 11.5px; color: var(--muted); transform: translateY(-7px); }
.col { position: relative; border-left: 1px solid var(--line); background-image: linear-gradient(to bottom, #e6eaef 1px, transparent 1px); cursor: cell; }
.col:hover { background-color: #fafcff; }
.nowline { position: absolute; left: 0; right: 0; height: 0; border-top: 2px solid #e53e3e; z-index: 4; pointer-events: none; }
.nowline::before { content: ""; position: absolute; left: -4px; top: -5px; width: 8px; height: 8px; background: #e53e3e; border-radius: 50%; }
.appt { position: absolute; left: 3px; right: 3px; border-left: 4px solid #888; border-radius: 5px; padding: 3px 7px; overflow: hidden; cursor: grab; box-shadow: 0 1px 2px rgba(0,0,0,.12); background: #eef; font-size: 12px; line-height: 1.3; z-index: 2; user-select: none; }
.appt:hover { box-shadow: 0 2px 8px rgba(0,0,0,.2); z-index: 3; }
.appt.dragging { opacity: .75; z-index: 10; cursor: grabbing; box-shadow: 0 6px 18px rgba(0,0,0,.3); }
.appt-time { font-size: 11px; color: #334; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appt-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appt-sub { color: #445; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appt.st-erledigt { opacity: .7; } .appt.st-erledigt .appt-name::after { content: " ✓"; color: var(--ok); }
.appt.st-noshow { opacity: .55; text-decoration: line-through; }
.appt.st-bestaetigt .appt-time::before { content: "● "; color: var(--ok); }
.appt.st-geplant .appt-time::before { content: "○ "; color: var(--warn); }
.buffer { position: absolute; left: 3px; right: 3px; background: repeating-linear-gradient(135deg, #e5e9ef 0 4px, #f6f8fa 4px 8px); border-radius: 0 0 4px 4px; z-index: 1; pointer-events: none; }
.block { position: absolute; left: 2px; right: 2px; background: repeating-linear-gradient(135deg, #e9e9e9 0 6px, #f4f4f4 6px 12px); border: 1px dashed #b8bec6; border-radius: 4px; padding: 3px 7px; font-size: 11.5px; color: #555; z-index: 1; cursor: pointer; overflow: hidden; }
.block.k-abwesend { background: repeating-linear-gradient(135deg, #f7e2e2 0 6px, #fbeeee 6px 12px); border-color: #e3b3b3; }
.block.k-gesperrt { background: repeating-linear-gradient(135deg, #e3e8f0 0 6px, #eef1f6 6px 12px); border-color: #a9b6c8; }

/* Tabellen */
.tbl { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.tbl th, .tbl td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.tbl th { background: #f7f9fb; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); font-weight: 600; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.click { cursor: pointer; } .tbl tr.click:hover td { background: #f5f8fc; }
.tbl tr.active td { background: #e4edf8; }
.tbl td.num, .tbl th.num { text-align: right; white-space: nowrap; }
.tbl tfoot td { font-weight: 600; background: #f7f9fb; }
.tbl input, .tbl select { padding: 5px 7px; }
.tbl .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: #e8ecf1; color: #44505c; }
.badge.geplant { background: #fdf3dc; color: #8a5a00; } .badge.bestaetigt { background: #ddf3e6; color: #1e6b41; }
.badge.erledigt { background: #e3e8ee; color: #3c4a58; } .badge.storniert { background: #fbe0e0; color: #9b2c2c; } .badge.noshow { background: #efe0f7; color: #6b2c91; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px; box-shadow: var(--shadow); }
.filters { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 12px; }
.filters label { min-width: 140px; }
.filters .grow { flex: 1; min-width: 200px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 16px; }
.stats2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .stats2 { grid-template-columns: 1fr; } .row3, .row4 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) { .row2, .row3, .row4 { grid-template-columns: 1fr; } .topbar { gap: 10px; } .nav button { padding: 8px 9px; } }

/* Modal */
.overlay { position: fixed; inset: 0; background: rgba(15,25,35,.45); display: flex; align-items: flex-start; justify-content: center; padding: 40px 12px; z-index: 50; overflow: auto; }
.modal { background: #fff; border-radius: 10px; width: 100%; max-width: 820px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal.narrow { max-width: 560px; }
.mhead { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.mhead h2 { margin: 0; font-size: 17px; }
.mhead .x { border: 0; background: transparent; font-size: 22px; cursor: pointer; color: var(--muted); line-height: 1; }
.mbody { padding: 18px 20px; }
.mfoot { display: flex; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--line); background: #fafbfc; border-radius: 0 0 10px 10px; flex-wrap: wrap; }
.mfoot .spacer { flex: 1; }
pre.mail { white-space: pre-wrap; background: #f7f9fb; border: 1px solid var(--line); border-radius: 6px; padding: 12px; font: 13px/1.5 Consolas, monospace; max-height: 50vh; overflow: auto; }
.conflicts { background: #fff6f6; border: 1px solid #f1c4c4; border-radius: 6px; padding: 10px 14px; color: #8a2a2a; }
.conflicts ul { margin: 6px 0 0; padding-left: 18px; }

/* Gäste-Autovervollständigung */
.ac-wrap { position: relative; }
.ac-list { display: none; position: absolute; top: 100%; left: 0; right: 0; background: #fff; border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 8px 24px rgba(0,0,0,.15); z-index: 60; max-height: 240px; overflow: auto; }
.ac-item { padding: 7px 10px; cursor: pointer; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; font-weight: normal; color: var(--text); font-size: 13px; }
.ac-item:hover, .ac-item.active { background: #eef3fa; }
.ac-item .ac-right { margin-left: auto; color: var(--muted); font-size: 12px; }
.guest-info { background: #f3f7ee; border: 1px solid #cfe0bd; border-radius: 6px; padding: 8px 12px; font-size: 13px; }
.guest-info:empty { display: none; }
.guest-info .pref { color: #6b4d00; margin-top: 3px; }

/* Markierungen im Terminblock */
.tagpay { display: inline-block; padding: 0 5px; border-radius: 3px; font-size: 10.5px; font-weight: 600; background: #e8ecf1; color: #44505c; vertical-align: 1px; }
.tagpay.pay-zimmer { background: #dbe9f9; color: #1f4e8c; } .tagpay.pay-inklusive { background: #ddf3e6; color: #1e6b41; } .tagpay.pay-extern { background: #fde8d6; color: #8a4200; }
.tagco { font-size: 12px; }
.waitchip { cursor: pointer; border-left-color: #d69e2e; } .waitchip:hover { background: #fffaf0; }

/* Wochenansicht */
.weekwrap { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: auto; }
table.week { width: 100%; border-collapse: collapse; table-layout: fixed; min-width: 900px; }
table.week th, table.week td { border-bottom: 1px solid var(--line); border-left: 1px solid var(--line); vertical-align: top; }
table.week th { background: #f7f9fb; padding: 8px 6px; font-size: 13px; text-align: left; position: sticky; top: 0; z-index: 2; }
table.week th.wday { cursor: pointer; } table.week th.wday:hover { background: #eef3fa; }
table.week th.today { background: #e4edf8; color: var(--primary); }
table.week .wname { width: 150px; padding: 8px 10px; font-weight: 600; background: #fafbfc; border-left: 0; }
td.wcell { padding: 4px; min-height: 60px; cursor: cell; }
td.wcell:hover { background: #fafcff; }
td.wcell.absent { background: repeating-linear-gradient(135deg, #f7e2e2 0 6px, #fbeeee 6px 12px); }
.wlocked { opacity: .65; }
.wchip { border-left: 3px solid #888; background: #f3f5f8; border-radius: 4px; padding: 2px 6px; margin: 2px 0; font-size: 11.5px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wchip:hover { background: #e8eef7; }
.wchip.st-erledigt { opacity: .7; } .wchip.st-noshow { opacity: .55; text-decoration: line-through; }
.wabs { font-size: 11px; color: #8a3b3b; font-style: italic; padding: 2px 4px; }
.wblock { font-size: 10.5px; color: #777; font-style: italic; padding: 1px 6px; }
.wfree { font-size: 11px; color: #b5bec8; padding: 6px; text-align: center; }
.wutil { height: 3px; background: #e6eaef; border-radius: 2px; margin: 4px 2px 0; } .wutil i { display: block; height: 100%; background: #7fa7d8; border-radius: 2px; }

/* Bestätigungsstatus */
.cmark { display: inline-block; min-width: 16px; height: 16px; line-height: 16px; text-align: center; border-radius: 50%; font-size: 11px; font-weight: 700; vertical-align: 1px; }
.cmark.open { background: #f6ad55; color: #fff; }
.cmark.changed { background: #e53e3e; color: #fff; }
.cmark.ok { color: #2f855a; }
.kpi.kpi-open { border-color: #f6ad55; background: #fff8ec; } .kpi.kpi-warn { border-color: #e53e3e; background: #fff3f3; } .kpi.kpi-ok { border-color: #9ae6b4; }
.kpi small { font-size: 12px; font-weight: 600; color: #c53030; }
.legend span:not(.cmark)::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 5px; vertical-align: middle; border-radius: 2px; background: var(--c); }
.legend span.cmark::before { content: none; }

/* Tagessperre & Warnungen */
.lockbanner { display: inline-flex; align-items: center; gap: 6px; background: #fff4e0; border: 1px solid #f0c98a; color: #7a4b00; border-radius: 6px; padding: 7px 12px; font-size: 13px; }
.warnmark { color: #c05621; font-weight: 700; }

/* Toasts */
#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: #1f2d3a; color: #fff; padding: 10px 16px; border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.25); max-width: 420px; font-size: 13.5px; animation: pop .15s ease-out; }
.toast.error { background: #a32020; } .toast.ok { background: #276749; } .toast.warn { background: #8a4b00; }
.toast-actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.toast-actions .btn.ghost { color: #fff; }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 8px; }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 5px; vertical-align: middle; border-radius: 2px; background: var(--c); }
