:root {
  --bg: #f6f1ea; --card: #fffdf9; --ink: #2b211b; --muted: #7a6c61; --line: #e5dcd0;
  --accent: #2b211b; --accent-ink: #fff; --gold: #b8853f;
  --green: #2f7d4f; --green-bg: #e3f2e8; --orange: #b7650f; --orange-bg: #fbeedc; --red: #b3261e; --red-bg: #fbe4e2;
  --radius: 14px; --shadow: 0 1px 2px rgba(43,33,27,.06), 0 4px 14px rgba(43,33,27,.06);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--ink); background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); min-height: 100vh; -webkit-tap-highlight-color: transparent; }
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.2; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1rem; }
a { color: inherit; }
.muted { color: var(--muted); } .small { font-size: .85rem; }
.center { display: grid; place-items: center; min-height: 60vh; text-align: center; padding: 16px; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 16px; }
.narrow { max-width: 460px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.stack > * + * { margin-top: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.grow { flex: 1; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }

/* Formulare */
label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 4px; }
input, select, textarea { width: 100%; font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold); outline-offset: 0; border-color: transparent; }
input[type=checkbox] { width: auto; }
.field { min-width: 0; }
button, .btn { font: inherit; border: 0; border-radius: 10px; padding: 10px 16px; cursor: pointer; background: var(--accent); color: var(--accent-ink); font-weight: 600; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; justify-content: center; }
button.ghost, .btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
label.btn { font-size: 1rem; margin: 0; }
button.green { background: var(--green); } button.orange { background: var(--orange); } button.red { background: var(--red); }
button:disabled { opacity: .5; cursor: default; }
button.big { width: 100%; padding: 22px; font-size: 1.25rem; border-radius: 16px; }
button.link { background: none; color: var(--muted); padding: 4px 8px; font-weight: 500; text-decoration: underline; }

/* Kopfzeile */
.topbar { background: var(--ink); color: #fff; padding: 12px 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.topbar .title { font-weight: 700; flex: 1; min-width: 160px; }
.topbar button { background: rgba(255,255,255,.12); color: #fff; padding: 8px 12px; }
.tabs { display: flex; gap: 4px; overflow-x: auto; padding: 8px 16px 0; background: var(--card); border-bottom: 1px solid var(--line); scrollbar-width: none; }
.tabs button { background: none; color: var(--muted); border-radius: 10px 10px 0 0; padding: 10px 14px; white-space: nowrap; border-bottom: 3px solid transparent; }
.tabs button.active { color: var(--ink); border-bottom-color: var(--gold); }
.badge { background: var(--red); color: #fff; border-radius: 99px; font-size: .75rem; padding: 1px 7px; margin-left: 4px; }

/* Status */
.pill { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: .8rem; font-weight: 600; }
.pill.in { background: var(--green-bg); color: var(--green); }
.pill.break { background: var(--orange-bg); color: var(--orange); }
.pill.out { background: #eee7de; color: var(--muted); }
.pill.pending { background: var(--orange-bg); color: var(--orange); }
.pill.approved { background: var(--green-bg); color: var(--green); }
.pill.rejected { background: var(--red-bg); color: var(--red); }
.warn { background: var(--orange-bg); color: var(--orange); border-radius: 8px; padding: 4px 8px; font-size: .8rem; display: inline-block; margin-top: 4px; }

/* Avatare */
.avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; background: #e9dfd2; display: inline-grid; place-items: center; font-weight: 700; color: var(--muted); flex: none; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.xl { width: 96px; height: 96px; font-size: 1.8rem; }

/* Tabellen */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.click { cursor: pointer; } tr.click:hover td { background: #faf5ee; }

/* Terminal */
.terminal { min-height: 100vh; display: flex; flex-direction: column; }
.terminal header { background: var(--ink); color: #fff; padding: 16px 20px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.terminal .clock { font-size: 2rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; padding: 16px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px 8px; text-align: center; cursor: pointer; box-shadow: var(--shadow); position: relative; color: var(--ink); font-weight: 500; display: block; }
.tile .avatar { width: 76px; height: 76px; font-size: 1.5rem; margin: 0 auto 8px; display: grid; }
.tile .dot { position: absolute; top: 10px; right: 10px; width: 14px; height: 14px; border-radius: 50%; background: #d6ccbf; }
.tile .dot.in { background: var(--green); } .tile .dot.break { background: var(--orange); }
.search { margin: 16px 16px 0; }
.pinpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.pinpad button { padding: 20px 0; font-size: 1.5rem; background: #efe7dc; color: var(--ink); border-radius: 14px; }
.pindots { display: flex; gap: 12px; justify-content: center; margin: 12px 0; min-height: 18px; }
.pindots span { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--ink); }
.pindots span.on { background: var(--ink); }

/* Modal & Toast */
.modal { position: fixed; inset: 0; background: rgba(30,22,17,.55); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal .box { background: var(--card); border-radius: 18px; padding: 20px; width: 100%; max-width: 440px; max-height: 92vh; overflow-y: auto; }
.modal .box.wide { max-width: 760px; }
.hidden { display: none !important; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; z-index: 60; max-width: calc(100% - 32px); box-shadow: var(--shadow); }
.toast.err { background: var(--red); }

.bigstatus { text-align: center; padding: 8px 0; }
.bigstatus .time { font-size: 2.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.kpi .v { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi .l { font-size: .8rem; color: var(--muted); }
.section-title { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }

@media (max-width: 600px) {
  .wrap { padding: 12px; }
  .hide-sm { display: none; }
  .terminal .clock { font-size: 1.5rem; }
}

/* Schalter aktiv/inaktiv */
.switch { position: relative; display: inline-block; width: 44px; height: 26px; margin: 0; cursor: pointer; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #d6ccbf; border-radius: 99px; transition: .2s; }
.switch span::before { content: ""; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::before { transform: translateX(18px); }

.tiles .tgroup { grid-column: 1 / -1; margin: 8px 0 0; }

/* Kalender */
.cal-head, .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-head div { font-size: .75rem; color: var(--muted); text-align: center; font-weight: 600; padding-bottom: 4px; }
.cal-cell { min-height: 74px; border: 1px solid var(--line); border-radius: 8px; padding: 4px; background: #fff; overflow: hidden; }
.cal-cell.empty { background: transparent; border-color: transparent; }
.cal-cell.today { outline: 2px solid var(--gold); }
.cal-cell.hol { background: #fbf6ee; }
.cal-d { font-size: .8rem; font-weight: 700; }
.cal-tag { display: block; font-size: .68rem; border-radius: 5px; padding: 1px 4px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .cal-tag { display: inline-block; margin: 0 6px 0 0; }
.cal-tag.work { background: #efe7dc; color: var(--ink); }
.cal-tag.vac { background: var(--green-bg); color: var(--green); }
.cal-tag.sick { background: var(--red-bg); color: var(--red); }
.cal-tag.req { background: transparent; border: 1px dashed var(--orange); color: var(--orange); }
.cal-tag.hol { background: transparent; color: var(--gold); padding-left: 0; }
@media (max-width: 600px) { .cal-cell { min-height: 56px; padding: 2px; } .cal-tag { font-size: .6rem; padding: 0 2px; } }

/* Schichtplan */
table.plan { table-layout: fixed; min-width: 860px; }
table.plan th, table.plan td { border: 1px solid var(--line); padding: 6px; font-size: .85rem; }
table.plan thead th { text-align: center; background: #faf5ee; }
th.plan-slot { width: 170px; text-transform: none; letter-spacing: 0; color: var(--ink); font-weight: 400; font-size: .85rem; background: #fdfaf5; }
.plan-cell { cursor: pointer; height: 46px; text-align: center; }
.plan-cell:hover { background: #fbf3e6; }
.plan-cell.set { background: var(--green-bg); }
.plan-off { background: repeating-linear-gradient(45deg, #f1ebe2, #f1ebe2 6px, #f7f2ea 6px, #f7f2ea 12px); }
.plan-group { background: var(--ink); color: #fff; font-weight: 700; font-size: .8rem; letter-spacing: .04em; text-transform: uppercase; }
.plan-today { outline: 2px solid var(--gold); }
.pick-list { max-height: 50vh; overflow-y: auto; display: grid; gap: 6px; }
.pick { display: flex; gap: 10px; align-items: center; background: #fff; color: var(--ink); border: 1px solid var(--line); font-weight: 400; justify-content: flex-start; }
.pick.sel { border-color: var(--green); background: var(--green-bg); }
.pick .small { display: block; }
.cal-tag.plan { background: transparent; border: 1px solid var(--line); color: var(--muted); }
@media print { .topbar, .tabs, .section-title .row:last-child, .plan-card p, .toast { display: none !important; } .plan-cell.set { background: #fff; } }

.plan-cell.mine { background: var(--ink); color: #fff; font-weight: 700; }

/* Jetzt da */
.now-loc { margin-bottom: 14px; }
.now-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; margin-top: 12px; }
.now-card { display: flex; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: 12px; padding: 10px; background: #fff; border-left: 4px solid var(--green); }
.now-card.break { border-left-color: var(--orange); }
.avatar.lg { width: 56px; height: 56px; font-size: 1.1rem; }
.pos { display: inline-block; font-weight: 600; color: var(--gold); }
