/* BoaVista Dienstplan – Design-System v4 „Planner"
   Kühle, professionelle SaaS-Oberfläche nach Shiftbase-Vorbild:
   weiße Top-Navigation, helles Blaugrau, blauer Akzent,
   farbcodierte Schichtkarten im Wochen-Grid. */

:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --ink: #1f2733;
  --muted: #6b7684;
  --line: #e4e8ee;
  --line-strong: #d3dae3;
  --accent: #2f80e0;
  --accent-dark: #2368ba;
  --accent-soft: #e9f2fc;
  --ok: #27784f;
  --ok-soft: #e2f2e9;
  --warn: #b3402f;
  --warn-soft: #f9e9e6;
  --amber: #8a6210;
  --amber-soft: #f7efdb;
  --shadow: 0 1px 2px rgba(31, 39, 51, .05);
  --radius: 8px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 680px; margin: 0 auto; padding: 0 16px 64px; }
.wrap.wide { max-width: 1280px; }

/* ---- Top-Navigation (weiß, wie eine echte Web-App) ---- */
.topbar {
  background: var(--surface); color: var(--ink); margin: 0 -16px 14px;
  padding: 0 16px; border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1248px; margin: 0 auto; display: flex; align-items: center; gap: 14px;
  min-height: 50px; flex-wrap: wrap; padding: 6px 0;
}
.brand { font-weight: 800; font-size: 16px; letter-spacing: -.2px; color: var(--ink); }
.brand .b-sub { color: var(--muted); font-weight: 500; font-size: 13px; }
.topbar .spacer { flex: 1; }
.topbar .who { color: var(--muted); font-size: 12.5px; }
.hero { padding: 0; }
.hero h1 { margin: 12px 0 2px; font-size: 20px; }
.hero .sub { margin: 0 0 4px; font-size: 13.5px; color: var(--muted); }

/* ---- Karten & Grundelemente ---- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; margin-top: 12px; box-shadow: var(--shadow);
}
.card h2 { margin: 0 0 10px; font-size: 15px; }
label.field { display: block; margin-bottom: 12px; }
label.field span { display: block; font-weight: 600; font-size: 12.5px; margin-bottom: 4px; color: #3c4654; }
input[type=text], input[type=password], input[type=time], input[type=date], input[type=number], select {
  width: 100%; padding: 8px 10px; font-size: 14px; border: 1px solid var(--line-strong);
  border-radius: 6px; background: #fff; color: var(--ink); font-family: inherit;
}
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(47,128,224,.15); }

.btn {
  display: inline-block; border: none; border-radius: 6px; padding: 9px 15px; font-size: 13.5px;
  font-weight: 600; cursor: pointer; color: #fff; background: var(--accent); font-family: inherit;
}
.btn:hover { background: var(--accent-dark); }
.btn:active { transform: translateY(1px); }
.btn.block { display: block; width: 100%; }
.btn.sea { background: var(--accent); }
.btn-ghost {
  display: inline-block; background: #fff; color: var(--ink); border: 1px solid var(--line-strong);
  border-radius: 6px; padding: 8px 13px; font-weight: 600; font-size: 13px; cursor: pointer; font-family: inherit;
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent-dark); }
.btn-ghost.danger { color: var(--warn); }
.btn-ghost.danger:hover { border-color: var(--warn); }
.btn-ghost.subtle { color: var(--muted); }
.btn-mini {
  background: #fff; border: 1px solid var(--line-strong); border-radius: 6px; padding: 4px 10px;
  font-size: 12px; font-weight: 600; cursor: pointer; color: var(--ink); font-family: inherit;
}
.btn-mini:hover { border-color: var(--accent); color: var(--accent-dark); }

.err { color: var(--warn); font-size: 13px; margin-top: 8px; display: none; }
.err.show { display: block; }
.hint { font-size: 12px; color: var(--muted); }
footer { text-align: center; color: #9aa4b0; font-size: 11.5px; margin-top: 26px; }

/* ---- Bereichs-Navigation ---- */
.tabs {
  display: flex; gap: 2px; flex-wrap: wrap; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 4px;
  box-shadow: var(--shadow);
}
.tab {
  border: none; background: transparent; color: var(--muted); border-radius: 6px;
  padding: 7px 13px; font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit;
}
.tab:hover { color: var(--ink); background: #f1f4f8; }
.tab.on { background: var(--accent-soft); color: var(--accent-dark); }

/* ---- Werkzeugleiste (Ansicht + Navigation) ---- */
.monthbar { display: flex; align-items: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.viewswitch { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 6px; overflow: hidden; }
.viewswitch button {
  border: none; background: #fff; color: var(--muted); padding: 7px 14px; font-size: 13px;
  font-weight: 600; cursor: pointer; font-family: inherit; border-right: 1px solid var(--line);
}
.viewswitch button:last-child { border-right: none; }
.viewswitch button.on { background: var(--accent-soft); color: var(--accent-dark); }
.monthbar .mname { font-size: 14.5px; font-weight: 700; min-width: 150px; text-align: center; }
.mnav {
  width: 30px; height: 30px; border-radius: 6px; border: 1px solid var(--line-strong); background: #fff;
  font-size: 14px; cursor: pointer; color: var(--ink);
}
.mnav:hover { border-color: var(--accent); color: var(--accent-dark); }
.spacer { flex: 1; }

.pill {
  display: inline-flex; align-items: center; gap: 6px; border-radius: 5px; padding: 3px 9px;
  font-size: 11.5px; font-weight: 700;
}
.pill.pub { background: var(--ok-soft); color: var(--ok); }
.pill.draft { background: var(--amber-soft); color: var(--amber); }

/* ---- Wochen-Grid (Planer) ---- */
.wk-wrap { overflow-x: auto; margin-top: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
table.wk { border-collapse: collapse; width: 100%; min-width: 940px; table-layout: fixed; }
table.wk th, table.wk td { border: 1px solid var(--line); vertical-align: top; }
table.wk th {
  background: #f0f4f9; font-size: 12px; font-weight: 600; color: #3c4654; padding: 7px 8px;
  text-align: center;
}
table.wk th.emp-col, table.wk td.emp-cell { width: 170px; text-align: left; }
table.wk th.sum-col, table.wk td.sum-cell { width: 62px; text-align: center; }
table.wk th.today { background: var(--accent); color: #fff; border-radius: 0; }
table.wk td { background: #fff; padding: 3px; height: 52px; }
table.wk td.today { background: #f4f9ff; }
table.wk td.closed-day { background: #f3f4f6; }
td.emp-cell { padding: 6px 8px !important; background: #fbfcfd !important; }
.emp-cell .ename { font-weight: 600; font-size: 13px; display: flex; align-items: center; gap: 7px; }
.avatar {
  width: 24px; height: 24px; border-radius: 50%; color: #fff; font-size: 10px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
}
.sum-cell { font-size: 12.5px; font-weight: 700; color: var(--muted); text-align: center; vertical-align: middle !important; font-variant-numeric: tabular-nums; }

.wk-card {
  border: 1px solid var(--line-strong); border-left: 4px solid var(--accent); border-radius: 5px;
  background: #fff; padding: 3px 7px; margin-bottom: 3px; cursor: pointer; box-shadow: var(--shadow);
}
.wk-card:hover { border-color: var(--accent); border-left-width: 4px; }
.wk-card .wc-label { font-size: 11.5px; font-weight: 700; line-height: 1.25; }
.wk-card .wc-time { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.wk-card.c-yellow { border-left-color: #e2b93b; background: #fefbf0; }
.wk-card.c-green { border-left-color: #3d9e6f; background: #f2faf5; }
.wk-card.c-purple { border-left-color: #8d6bc6; background: #f7f4fc; }
.wk-card.c-blue { border-left-color: var(--accent); background: #f3f8fe; }
.wk-card.c-open { border-left-color: #98a4b3; background: #f7f8fa; border-style: dashed; }
.wk-card.warnflag { border-color: #dba99f; background: var(--warn-soft); }
.wk-add {
  display: block; width: 100%; border: none; background: transparent; color: transparent;
  font-size: 12px; font-weight: 700; cursor: pointer; border-radius: 5px; padding: 2px 0;
  font-family: inherit; min-height: 18px;
}
td:hover > .wk-add, .wk-add:focus { color: var(--accent); background: var(--accent-soft); }
.wk-avail { float: right; font-size: 9.5px; font-weight: 800; border-radius: 3px; padding: 0 4px; margin: 2px 0 0 3px; }
.wk-abs {
  font-size: 11px; font-weight: 600; color: #55616b; background: #eef0f3;
  border: 1px dashed var(--line-strong); border-radius: 5px; padding: 3px 7px; margin-bottom: 3px;
}

/* ---- Monatsliste ---- */
.day {
  border: 1px solid var(--line); border-radius: 6px; padding: 8px 12px; margin-bottom: 6px;
  background: #fff;
}
.day.weekend { background: #f8fafc; }
.day.closed { background: #f3f4f6; opacity: .75; }
.day.today { border-left: 3px solid var(--accent); }
.day.holiday { border-left: 3px solid #d3a94e; }
.day-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.day-head .dow { font-weight: 700; font-size: 13px; min-width: 24px; }
.day-head .date { color: var(--muted); font-size: 12.5px; }
.day-head .closed-note { font-size: 12px; color: var(--muted); font-style: italic; }
.holidaytag {
  font-size: 11px; font-weight: 700; background: var(--amber-soft); color: var(--amber);
  border-radius: 4px; padding: 1px 7px;
}
.abschip {
  font-size: 11px; font-weight: 600; background: #eef0f3; color: #55616b;
  border: 1px solid var(--line); border-radius: 4px; padding: 1px 7px;
}
.avail-dots { display: flex; gap: 3px; flex-wrap: wrap; margin-left: auto; }
.adot {
  width: 19px; height: 19px; border-radius: 50%; font-size: 9px; font-weight: 800; color: #fff;
  display: inline-flex; align-items: center; justify-content: center; cursor: default;
}
.shift-rows { margin-top: 6px; display: flex; flex-direction: column; gap: 4px; }
.slotline { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.slotname { font-size: 10.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; min-width: 48px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-strong);
  border-radius: 5px; padding: 3px 9px 3px 6px; font-size: 12.5px; font-weight: 600;
  background: #fff; cursor: pointer;
}
.chip:hover { border-color: var(--accent); }
.chip .cdot { width: 11px; height: 11px; border-radius: 50%; }
.chip .ctime { color: var(--muted); font-weight: 500; font-size: 12px; font-variant-numeric: tabular-nums; }
.chip.warnflag { border-color: #dba99f; background: var(--warn-soft); }
.chip.open { border-style: dashed; color: var(--muted); }
.addbtn {
  border: 1px dashed var(--line-strong); background: transparent; border-radius: 5px;
  padding: 3px 10px; font-size: 12px; font-weight: 600; color: var(--muted); cursor: pointer; font-family: inherit;
}
.addbtn:hover { border-color: var(--accent); color: var(--accent-dark); }

/* ---- Verfügbarkeits-Matrix ---- */
.tablewrap { overflow-x: auto; margin-top: 10px; }
table.matrix { border-collapse: collapse; font-size: 12.5px; min-width: 100%; }
table.matrix th, table.matrix td { border: 1px solid var(--line); padding: 4px 8px; text-align: center; white-space: nowrap; }
table.matrix th { background: #f0f4f9; font-weight: 600; position: sticky; top: 0; }
table.matrix td.dayname { text-align: left; font-weight: 600; background: #fafbfc; }
table.matrix tr.weekend td.dayname { background: #f2f6fa; }
.av { display: inline-block; min-width: 27px; border-radius: 4px; padding: 1px 6px; font-weight: 700; font-size: 11px; }
.av.mittag { background: #f7efdb; color: #7a5a1e; }
.av.abend { background: #dfeaf6; color: #2b567f; }
.av.flexibel { background: var(--ok-soft); color: var(--ok); }
.av.nein { background: #f2e4e1; color: #93473a; }
.av.none { color: #c3cbd4; }

/* ---- Tabellen (Auswertung / Stunden) ---- */
table.report { border-collapse: collapse; width: 100%; font-size: 13px; margin-top: 10px; }
table.report th, table.report td { border-bottom: 1px solid var(--line); padding: 7px 9px; text-align: left; }
table.report th { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
table.report tr:hover td { background: #fafbfc; }
table.report td.num, table.report th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.detailrow td { background: #fafbfc !important; font-size: 12px; color: var(--muted); }
tr.daterow td { background: #f0f4f9 !important; font-size: 12px; padding-top: 9px; }
.src-tag { font-size: 10.5px; font-weight: 700; color: var(--muted); border: 1px solid var(--line-strong); border-radius: 4px; padding: 1px 6px; }

/* ---- Team-Liste ---- */
.emp {
  display: flex; align-items: center; gap: 10px; border: 1px solid var(--line);
  border-radius: 6px; padding: 8px 12px; margin-bottom: 6px; flex-wrap: wrap; background: #fff;
}
.emp .cdot { width: 18px; height: 18px; border-radius: 50%; flex: 0 0 auto; border: none; padding: 0; cursor: pointer; }
.emp .name { font-weight: 600; }
.emp.inactive { opacity: .55; }
.emp .meta { color: var(--muted); font-size: 12px; }
.emp .grow { flex: 1; }
.statusdot { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); display: inline-block; }

/* ---- Mitarbeiterinnen-Seite (m.php) ---- */
.mselect { display: flex; gap: 6px; margin-top: 12px; flex-wrap: wrap; }
.mselect button {
  border: 1px solid var(--line-strong); background: #fff; border-radius: 6px; padding: 7px 13px;
  font-weight: 600; font-size: 13px; cursor: pointer; font-family: inherit; color: var(--muted);
}
.mselect button.on { background: var(--accent-soft); color: var(--accent-dark); border-color: var(--accent); }
.dayrow { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 8px; background: #fff; }
.dayrow.weekend { background: #f8fafc; }
.dayrow.has-pick { border-left: 3px solid var(--accent); }
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 8px; }
.opt {
  display: flex; align-items: center; gap: 8px; border: 1px solid var(--line-strong); border-radius: 6px;
  padding: 10px 11px; font-size: 13px; cursor: pointer; background: #fff; user-select: none; min-height: 42px;
}
.opt .dot { width: 15px; height: 15px; border-radius: 50%; border: 2px solid var(--line-strong); flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center; }
.opt.sel { border-color: var(--accent); background: var(--accent-soft); font-weight: 600; color: var(--accent-dark); }
.opt.sel .dot { border-color: var(--accent); background: var(--accent); }
.opt.sel .dot::after { content: ""; width: 5px; height: 5px; background: #fff; border-radius: 50%; }
.opt.none { color: var(--muted); }
.opt.none.sel { border-color: #aab4bf; background: #eef1f4; color: #4c5865; }
.opt.none.sel .dot { border-color: #8a97a4; background: #8a97a4; }
.savestate { font-size: 11px; color: var(--ok); margin-left: auto; opacity: 0; transition: opacity .3s; }
.savestate.show { opacity: 1; }
.shiftblock { border-bottom: 1px solid var(--line); padding-bottom: 7px; margin-bottom: 2px; }
.shiftblock:last-of-type { border-bottom: none; }
.teamline { font-size: 12px; color: var(--muted); padding: 0 2px 2px; }
.myshift { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 2px; border-bottom: 1px solid var(--line); font-size: 13.5px; flex-wrap: wrap; }
.myshift:last-child { border-bottom: none; }
.myshift .when { font-weight: 600; }
.myshift .time { color: var(--muted); font-variant-numeric: tabular-nums; }
.myshift .btn-mini { flex: 0 0 auto; }
.myshift .pill { font-size: 11px; padding: 2px 8px; }
.note {
  background: var(--amber-soft); border: 1px solid #e7d6a8; border-radius: 6px;
  padding: 10px 13px; font-size: 12.5px; color: #6e5619; margin-top: 10px;
}
.clockcard { border-left: 3px solid var(--accent); }

/* ---- Modal ---- */
.overlay {
  position: fixed; inset: 0; background: rgba(24, 30, 39, .5); display: none;
  align-items: flex-end; justify-content: center; z-index: 50; padding: 16px;
}
.overlay.show { display: flex; }
.modal {
  background: #fff; border-radius: 10px; padding: 18px; width: 100%; max-width: 460px;
  max-height: 85vh; overflow-y: auto; box-shadow: 0 16px 48px rgba(24, 30, 39, .28);
}
@media (min-width: 640px) { .overlay { align-items: center; } }
.modal h3 { margin: 0 0 12px; font-size: 15px; }
.modal .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.modal .row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.modal .actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.pickgroup { margin-bottom: 12px; }
.pickgroup .glabel { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin-bottom: 5px; }
.pickrow {
  display: flex; align-items: center; gap: 9px; border: 1px solid var(--line); border-radius: 6px;
  padding: 8px 11px; margin-bottom: 5px; cursor: pointer; background: #fff;
}
.pickrow:hover { border-color: var(--accent); background: var(--accent-soft); }
.pickrow .cdot { width: 12px; height: 12px; border-radius: 50%; }
.pickrow .pname { font-weight: 600; }
.pickrow .phours { margin-left: auto; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pickrow.na { opacity: .55; }

/* ---- Toast ---- */
#toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%) translateY(80px);
  background: var(--ink); color: #fff; border-radius: 6px; padding: 10px 18px; font-size: 13px;
  font-weight: 600; z-index: 99; transition: transform .22s; box-shadow: 0 8px 24px rgba(0,0,0,.28);
  max-width: 90vw; text-align: center;
}
#toast.show { transform: translateX(-50%) translateY(0); }

/* ---- Abfrage-Zentrale (Monatskarten) ---- */
.mcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.mcard {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px;
  background: #fbfcfd;
}
.mcard.open { border-color: #bcd8c8; background: #f7fbf9; }
.mc-meter { height: 6px; border-radius: 3px; background: #e8ebef; margin: 9px 0 5px; overflow: hidden; }
.mc-fill { height: 100%; border-radius: 3px; background: var(--accent); transition: width .3s; }

/* ---- Verfügbarkeits-Kalender ---- */
.avgroup { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; margin-bottom: 4px; }
.avg-label {
  font-size: 10.5px; font-weight: 700; color: var(--muted); text-transform: uppercase;
  letter-spacing: .4px; min-width: 118px;
}
.avchip {
  display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line-strong);
  border-radius: 5px; padding: 2px 8px 2px 5px; font-size: 12.5px; font-weight: 600;
  background: #fff; cursor: pointer;
}
.avchip:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-dark); }
.avchip .cdot { width: 10px; height: 10px; border-radius: 50%; }

/* ---- Besetzungs-Soll ---- */
.staff-badge {
  display: inline-block; font-size: 10px; font-weight: 800; border-radius: 4px;
  padding: 0 5px; margin: 1px 2px 0 0; letter-spacing: .2px;
}
.staff-badge.ok { background: var(--ok-soft); color: var(--ok); }
.staff-badge.low { background: #f6dbd6; color: var(--warn); }
table.wk th .staff-badge { font-weight: 700; }
table.wk th.today .staff-badge.ok { background: rgba(255,255,255,.25); color: #fff; }
table.wk th.today .staff-badge.low { background: #fff; color: var(--warn); }

@media (max-width: 480px) {
  .opts { grid-template-columns: 1fr; }
  .monthbar .mname { min-width: 120px; font-size: 14px; }
}

/* ---- Druckansicht (Dienstplan-Aushang) ---- */
@media print {
  body { background: #fff; font-size: 11px; }
  .topbar, .tabs, .monthbar .viewswitch, .monthbar .mnav, .monthbar .btn-mini,
  #pubState, .card:first-of-type, .wk-add, .wk-avail, footer, #toast, .overlay,
  .content-hint, p.hint { display: none !important; }
  .wrap.wide { max-width: none; padding: 0; }
  .monthbar { margin: 0 0 6px; }
  .monthbar .mname { font-size: 15px; text-align: left; min-width: 0; }
  .wk-wrap { border: none; box-shadow: none; overflow: visible; margin-top: 0; }
  table.wk { min-width: 0; }
  table.wk th, table.wk td { border-color: #999; }
  table.wk td { height: auto; }
  .wk-card { box-shadow: none; break-inside: avoid; }
  .day, .card { box-shadow: none; break-inside: avoid; }
}
