/* Schichtplan Bäcker Mattheisen – Braun/Gold-Markenlook */
:root {
  --braun: #47301c;
  --braun-dunkel: #2f1f10;
  --gold: #c9a227;
  --gold-hell: #e6c65c;
  --creme: #f6efe3;
  --creme-dunkel: #ece1cc;
  --karte: #fffdf8;
  --linie: #d9c9a8;
  --rot: #b3372b;
  --rot-hell: #fbe9e6;
  --gruen: #3d7a3d;
  --text: #2b2118;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--creme);
  color: var(--text);
  min-height: 100vh;
}
.hidden { display: none !important; }
h1, h2, h3, .brand-name { font-family: Georgia, "Times New Roman", serif; }

/* ---------- Login ---------- */
.login {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, var(--braun) 0%, var(--braun-dunkel) 100%);
  padding: 20px;
}
.login-card {
  background: var(--karte); border-radius: 16px; padding: 32px 28px;
  width: 100%; max-width: 380px; box-shadow: 0 18px 50px rgba(0,0,0,.35);
}
.login-brand { text-align: center; margin-bottom: 22px; }
.login-brand h1 { color: var(--braun); font-size: 30px; margin-top: 8px; }
.login-brand p { color: #8a7357; font-size: 14px; }
.login label { display: block; font-size: 14px; font-weight: 600; color: var(--braun); margin-bottom: 14px; }
.login input {
  display: block; width: 100%; margin-top: 5px; padding: 11px 12px; font-size: 16px;
  border: 1.5px solid var(--linie); border-radius: 10px; background: #fff;
}
.login input:focus { outline: none; border-color: var(--gold); }
.login-error { background: var(--rot-hell); color: var(--rot); border-radius: 8px; padding: 9px 12px; font-size: 14px; margin-bottom: 12px; }

/* ---------- Buttons ---------- */
.btn {
  border: none; border-radius: 10px; padding: 9px 14px; font-size: 14.5px; font-weight: 600;
  cursor: pointer; background: var(--creme-dunkel); color: var(--braun);
}
.btn:active { transform: scale(.97); }
.btn-gold { background: var(--gold); color: var(--braun-dunkel); }
.btn-gold:hover { background: var(--gold-hell); }
.btn-braun { background: var(--braun); color: #fff; }
.btn-ghost { background: transparent; }
.btn-rot { background: var(--rot); color: #fff; }
.btn-block { display: block; width: 100%; padding: 12px; font-size: 16px; }
.btn-sm { padding: 5px 9px; font-size: 13px; border-radius: 8px; }

/* ---------- Topbar / Nav ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: var(--braun); color: #fff;
  display: flex; align-items: center; gap: 14px; padding: 10px 16px;
  box-shadow: 0 2px 10px rgba(0,0,0,.25);
}
.brand { display: flex; align-items: center; gap: 9px; }
.brand-name { font-size: 19px; color: var(--gold-hell); }
.nav { display: flex; gap: 2px; flex: 1; flex-wrap: wrap; }
.nav a {
  color: #f0e6d2; text-decoration: none; font-size: 14.5px; padding: 7px 11px; border-radius: 8px;
}
.nav a.active { background: rgba(255,255,255,.16); color: #fff; font-weight: 600; }
.nav a:hover { background: rgba(255,255,255,.10); }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.user-badge { font-size: 13px; color: #e8dcc4; }
.nav-toggle { display: none; color: #fff; font-size: 20px; }

@media (max-width: 860px) {
  .nav {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    background: var(--braun-dunkel); flex-direction: column; padding: 8px;
  }
  .nav.open { display: flex; }
  .nav a { padding: 12px 14px; font-size: 16px; }
  .nav-toggle { display: block; }
  .user-badge { display: none; }
  .brand-name { font-size: 17px; }
}

/* ---------- Layout ---------- */
main { padding: 14px; max-width: 1500px; margin: 0 auto; }
.card {
  background: var(--karte); border: 1px solid var(--linie); border-radius: 14px;
  padding: 14px; margin-bottom: 14px;
}
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar select, .toolbar input[type="month"], select, input[type="date"], input[type="time"], input[type="text"], input[type="number"], input[type="password"], textarea {
  padding: 8px 10px; font-size: 14.5px; border: 1.5px solid var(--linie); border-radius: 9px; background: #fff; color: var(--text);
}
.toolbar .spacer { flex: 1; }
.week-label { font-weight: 700; color: var(--braun); font-size: 15.5px; white-space: nowrap; }
h2 { color: var(--braun); font-size: 21px; margin-bottom: 10px; }

/* ---------- Wochenraster ---------- */
.grid-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.plan { border-collapse: collapse; width: 100%; min-width: 980px; background: var(--karte); }
table.plan th, table.plan td { border: 1px solid var(--linie); vertical-align: top; }
table.plan thead th {
  background: var(--braun); color: #fff; padding: 7px 6px; font-size: 13.5px; font-weight: 600;
}
table.plan thead th .datum { display: block; font-weight: 400; font-size: 12px; color: var(--gold-hell); }
table.plan thead th.today { background: var(--gold); color: var(--braun-dunkel); }
table.plan thead th.today .datum { color: var(--braun); }
th.shiftcol {
  background: var(--creme-dunkel) !important; color: var(--braun) !important;
  width: 128px; min-width: 128px; text-align: left; padding: 8px; font-size: 13.5px;
}
th.shiftcol .zeiten { display: block; font-weight: 400; font-size: 11.5px; color: #7a6547; margin-top: 3px; line-height: 1.45; }
td.cell { padding: 5px; min-height: 52px; background: #fff; }
td.cell.closed { background: var(--creme-dunkel); }
td.cell.short { background: var(--rot-hell); }
td.cell.clickable { cursor: pointer; }
td.cell.clickable:hover { outline: 2px solid var(--gold); outline-offset: -2px; }
.cell-min { font-size: 11px; color: var(--rot); font-weight: 700; }
.cell-time { font-size: 11px; color: #7a6547; margin-bottom: 2px; }
.chip {
  display: block; background: var(--creme); border: 1px solid var(--linie);
  border-radius: 7px; padding: 3px 6px; margin: 2px 0; font-size: 13px; line-height: 1.35;
}
.chip .sub { display: block; font-size: 11px; color: #7a6547; }
.chip.warn { border-color: var(--rot); background: #fff3f1; }
.chip.warn .sub { color: var(--rot); font-weight: 600; }
.chip.click { cursor: pointer; }
.chip.click:hover { border-color: var(--gold); background: #fdf6e2; }
.chip[draggable="true"] { cursor: grab; }
.chip[draggable="true"]:active { cursor: grabbing; }
td.cell.dropover {
  outline: 2px dashed var(--gold); outline-offset: -3px; background: #fdf6e2 !important;
}
/* Heute-Spalte leuchtet golden */
td.todaycol { background: #fbf0cf; box-shadow: inset 3px 0 0 var(--gold), inset -3px 0 0 var(--gold); }
td.cell.todaycol { background: #fbf0cf; }
td.cell.todaycol.closed { background: #efe3c4; }
td.cell.todaycol.short { background: #f9e2d2; }
tr.absrow td.todaycol { background: #f5e9c9; }
tr.absrow th { font-size: 12.5px; }
tr.absrow td { padding: 5px 6px; font-size: 12px; background: var(--creme); color: #6a5638; }
tr.absrow .u { color: #2b6cb0; }
tr.absrow .k { color: var(--rot); }

/* ---------- Stunden-Panel ---------- */
details.hours { margin-top: 12px; }
details.hours summary { cursor: pointer; font-weight: 700; color: var(--braun); padding: 6px 0; }
table.data { border-collapse: collapse; width: 100%; background: var(--karte); }
table.data th, table.data td { border: 1px solid var(--linie); padding: 7px 9px; font-size: 13.5px; text-align: left; }
table.data thead th { background: var(--creme-dunkel); color: var(--braun); }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
.diff-plus { color: var(--gruen); font-weight: 600; }
.diff-minus { color: var(--rot); font-weight: 600; }
.muted { color: #8a7357; }
.tag { display: inline-block; font-size: 11.5px; border-radius: 6px; padding: 1px 7px; background: var(--creme-dunkel); color: var(--braun); }
.tag.fest { background: var(--gold-hell); }
.tag.inaktiv { background: #ddd; color: #666; }
.tag.urlaub { background: #dbeafe; color: #1d4ed8; }
.tag.krank { background: var(--rot-hell); color: var(--rot); }

/* ---------- Modal ---------- */
.modal-wrap {
  position: fixed; inset: 0; background: rgba(30,20,10,.5); z-index: 100;
  display: flex; align-items: flex-end; justify-content: center;
}
@media (min-width: 700px) { .modal-wrap { align-items: center; } }
.modal {
  background: var(--karte); border-radius: 16px 16px 0 0; width: 100%; max-width: 560px;
  max-height: 88vh; overflow-y: auto; padding: 18px;
}
@media (min-width: 700px) { .modal { border-radius: 16px; } }
.modal h3 { color: var(--braun); font-size: 18px; margin-bottom: 4px; }
.modal .sub-line { color: #8a7357; font-size: 13.5px; margin-bottom: 12px; }
.modal label { display: block; font-size: 13.5px; font-weight: 600; color: var(--braun); margin: 10px 0 3px; }
.modal input, .modal select, .modal textarea { width: 100%; }
.modal .row { display: flex; gap: 10px; }
.modal .row > * { flex: 1; }
.modal .btnrow { display: flex; gap: 8px; margin-top: 16px; }
.modal .btnrow .btn { flex: 1; padding: 11px; }
.emp-search { width: 100%; margin-bottom: 8px; }
.emp-list { max-height: 46vh; overflow-y: auto; border: 1px solid var(--linie); border-radius: 10px; }
.emp-list .group { background: var(--creme-dunkel); color: var(--braun); font-size: 12px; font-weight: 700; padding: 5px 10px; }
.emp-item {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 9px 10px; border-top: 1px solid var(--creme-dunkel); cursor: pointer; font-size: 14.5px;
}
.emp-item:hover { background: #fdf6e2; }
.emp-item .mini { font-size: 12px; color: #8a7357; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--braun-dunkel); color: #fff; padding: 11px 18px; border-radius: 12px;
  font-size: 14.5px; z-index: 200; box-shadow: 0 8px 24px rgba(0,0,0,.3); max-width: 90vw;
}
.toast.err { background: var(--rot); }

/* ---------- Formulare / Listen ---------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; align-items: end; }
.form-grid label { display: block; font-size: 13px; font-weight: 600; color: var(--braun); }
.form-grid label > * { display: block; width: 100%; margin-top: 3px; }
.table-scroll { overflow-x: auto; }
input.cell-input { width: 74px; padding: 5px 6px; font-size: 13px; }
input.time-input { width: 92px; padding: 5px 4px; font-size: 13px; }

/* ---------- Druck (PDF-Aushang) ---------- */
#printArea { display: none; }
@media print {
  body * { visibility: hidden; }
  #app, .topbar, .toast, .modal-wrap { display: none !important; }
  #printArea { display: block !important; visibility: visible; position: absolute; top: 0; left: 0; width: 100%; }
  #printArea * { visibility: visible; }
  @page { size: A4 landscape; margin: 10mm; }
  .p-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6mm; font-family: Arial, sans-serif; }
  .p-head h1 { font-size: 20pt; font-family: Arial, sans-serif; color: #000; }
  .p-head .wk { font-size: 13pt; font-weight: 700; }
  table.p-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-family: Arial, sans-serif; }
  .p-table th, .p-table td { border: 1.2px solid #111; padding: 5px 6px; vertical-align: top; font-size: 10.5pt; color: #000; }
  .p-table thead th { background: #eee !important; -webkit-print-color-adjust: exact; }
  .p-table thead .datum { font-weight: 400; font-size: 9pt; display: block; }
  .p-table .shift { width: 32mm; background: #eee !important; -webkit-print-color-adjust: exact; text-align: left; }
  .p-table .shift .zeit { font-weight: 400; font-size: 9pt; display: block; margin-top: 2px; }
  .p-table td .p { display: block; line-height: 1.5; }
  .p-table td .pz { font-size: 8.5pt; }
  .p-foot { margin-top: 5mm; font-size: 8.5pt; color: #333; font-family: Arial, sans-serif; }
}
