/* BrauZeit – Farben aus dem Logo */
:root {
  --brown-950: #22150A;
  --brown-900: #2B1A0C;
  --brown-800: #4A2D16;
  --brown-700: #5C3A1E;
  --brown-600: #6E4827;
  --amber: #C6924E;
  --amber-light: #E2B573;
  --cream: #EADDC4;
  --foam: #F7F1E6;
  --bg: #F1E9DA;
  --card: #FFFDF8;
  --line: #E0D3BC;
  --text: #2B1A0C;
  --muted: #7A6650;
  --green: #2F8A4F;
  --green-dark: #246E3F;
  --red: #B83A2E;
  --orange: #D98A1E;
  --blue: #3B6E8F;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(43, 26, 12, .08), 0 2px 8px rgba(43, 26, 12, .06);
  font-family: "Segoe UI", Roboto, system-ui, -apple-system, sans-serif;
  color: var(--text);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); min-height: 100%; }
body { font-size: 16px; line-height: 1.4; -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brown-700); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.red { color: var(--red); }
.green { color: var(--green); }

/* Kopfzeile */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px;
  background: var(--brown-900); color: var(--foam);
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  border-bottom: 3px solid var(--amber);
}
.topbar .date { font-size: .95rem; }
.topbar .clock { font-size: 1.35rem; font-weight: 600; letter-spacing: .5px; font-variant-numeric: tabular-nums; }
.brand { display: flex; align-items: center; gap: 10px; justify-self: end; color: var(--foam); text-decoration: none; }
.brand img { height: 36px; width: 36px; }
.brand span { font-weight: 700; font-size: 1.2rem; letter-spacing: .3px; }
.brand span b { color: var(--amber-light); font-weight: 700; }
@media (max-width: 640px) {
  .topbar { grid-template-columns: auto 1fr auto; }
  .topbar .date .long { display: none; }
  .brand span { display: none; }
  .topbar .clock { justify-self: center; }
}

main { max-width: 1240px; margin: 0 auto; padding: 18px 16px 110px; overflow-x: hidden; }

/* Startseite */
.status-card {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px 18px; margin-bottom: 18px; border-left: 6px solid var(--muted);
}
.status-card.in { border-left-color: var(--green); }
.status-card.break { border-left-color: var(--orange); }
.status-card .dot { width: 14px; height: 14px; border-radius: 50%; background: var(--muted); flex: none; }
.status-card.in .dot { background: var(--green); box-shadow: 0 0 0 4px rgba(47, 138, 79, .18); }
.status-card.break .dot { background: var(--orange); box-shadow: 0 0 0 4px rgba(217, 138, 30, .18); }
.status-card .st-title { font-weight: 600; font-size: 1.1rem; }
.status-card .st-worked { margin-left: auto; font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--brown-800); }

.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.tiles + .section-title { margin-top: 26px; }
@media (max-width: 900px) { .tiles { grid-template-columns: repeat(2, 1fr); gap: 12px; } }
.tile {
  position: relative; display: flex; align-items: center; gap: 16px;
  min-height: 72px; padding: 14px 18px; border: 0; border-radius: var(--radius);
  background: var(--brown-800); color: var(--foam); text-decoration: none; cursor: pointer;
  box-shadow: var(--shadow); text-align: left; font-size: 1.1rem; transition: background .15s, transform .05s;
}
.tile:hover { background: var(--brown-700); }
.tile:active { transform: scale(.98); }
.tile svg { width: 30px; height: 30px; flex: none; color: var(--amber); }
.tile .label { flex: 1; }
.tile.big { flex-direction: column; justify-content: center; text-align: center; min-height: 150px; gap: 10px; font-size: 1.2rem; }
.tile.big svg { width: 54px; height: 54px; }
.tile.stamp-in { background: var(--green); }
.tile.stamp-in svg, .tile.stamp-out svg, .tile.stamp-break svg { color: #fff; }
.tile.stamp-in:hover { background: var(--green-dark); }
.tile.stamp-break { background: var(--orange); }
.tile.stamp-break:hover { background: #C07816; }
.tile.stamp-out { background: var(--red); }
.tile.stamp-out:hover { background: #9C2F25; }
.tile:disabled, .tile:disabled:hover { background: #CFC3AE; color: #8E7E68; cursor: not-allowed; box-shadow: none; }
.tile:disabled svg { color: #A79478; }
.tile .badge {
  position: absolute; top: 8px; right: 10px; min-width: 24px; height: 24px; padding: 0 7px; border-radius: 12px;
  background: var(--red); color: #fff; font-size: .8rem; font-weight: 700; display: grid; place-items: center;
}
@media (max-width: 640px) {
  .tile { min-height: 64px; padding: 12px; gap: 10px; font-size: 1rem; }
  .tile svg { width: 26px; height: 26px; }
  .tile.big { min-height: 118px; }
  .tile.big svg { width: 42px; height: 42px; }
  .tiles.stamp { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .tiles.stamp .tile { font-size: .95rem; padding: 10px 6px; }
}
.section-title { font-size: .85rem; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin: 0 0 10px; font-weight: 600; }

.footer {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 15;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  background: var(--brown-900); color: var(--foam); padding: 8px 16px; padding-bottom: max(8px, env(safe-area-inset-bottom));
  font-size: .9rem;
}
.footer .k { font-size: .72rem; color: var(--amber-light); text-transform: uppercase; letter-spacing: .5px; }
.footer .last { display: flex; align-items: center; gap: 8px; }
.footer .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--muted); flex: none; }
.footer .dot.in { background: #4CC27A; }
.footer .dot.break { background: var(--orange); }
.footer .who { text-align: right; }
.footer button { background: transparent; border: 1px solid var(--brown-600); color: var(--foam); border-radius: 6px; padding: 4px 10px; cursor: pointer; margin-left: 8px; }

/* Unterseiten */
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 1.45rem; margin: 0; color: var(--brown-800); }
.back {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px 8px 10px; border-radius: 8px;
  background: var(--brown-800); color: var(--foam); text-decoration: none; font-size: .95rem;
}
.back svg { width: 18px; height: 18px; color: var(--amber); }
.page-head .spacer { flex: 1; }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 16px; }
.card h2 { font-size: 1.1rem; margin: 0 0 12px; color: var(--brown-800); }
.card.flush { padding: 0; overflow: hidden; }
.card-head { background: var(--cream); padding: 10px 16px; display: flex; align-items: center; gap: 10px; font-weight: 600; }
.card-head svg { width: 22px; height: 22px; color: var(--brown-800); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.grid-side { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
@media (max-width: 900px) { .grid-2, .grid-side { grid-template-columns: minmax(0, 1fr); } }

/* Formulare */
label.f { display: block; margin-bottom: 12px; }
label.f > span { display: block; font-size: .85rem; color: var(--brown-700); margin-bottom: 4px; font-weight: 600; }
label.f > span em { color: var(--red); font-style: normal; }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=date], input[type=time],
input[type=datetime-local], input[type=month], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; min-height: 44px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--amber); outline-offset: 0; border-color: var(--amber); }
textarea { min-height: 70px; resize: vertical; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 140px; }
.check { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--brown-800); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; min-height: 44px; border-radius: 8px; border: 0; cursor: pointer;
  background: var(--brown-800); color: var(--foam); font-weight: 600; text-decoration: none;
}
.btn:hover { background: var(--brown-700); }
.btn svg { width: 18px; height: 18px; }
.btn.green { background: var(--green); color: #fff; }
.btn.green:hover { background: var(--green-dark); }
.btn.red { background: var(--red); color: #fff; }
.btn.red:hover { background: #9C2F25; }
.btn.light { background: var(--cream); color: var(--brown-900); }
.btn.light:hover { background: #E0CFAF; }
.btn.small { padding: 6px 12px; min-height: 34px; font-size: .88rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-icon { background: transparent; border: 0; padding: 6px; border-radius: 6px; cursor: pointer; color: var(--brown-700); display: inline-grid; place-items: center; }
.btn-icon:hover { background: var(--cream); }
.btn-icon svg { width: 20px; height: 20px; }
.btn-icon.red { color: var(--red); }
.actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 8px; }

/* Navigation (Tag/Monat/Jahr) */
.nav { display: flex; align-items: stretch; background: #fff; border-radius: 8px; border: 1px solid var(--line); overflow: hidden; }
.nav button { border: 0; background: var(--brown-800); color: var(--amber); width: 48px; cursor: pointer; display: grid; place-items: center; }
.nav button:hover { background: var(--brown-700); }
.nav button svg { width: 22px; height: 22px; }
.nav .cur { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 600; padding: 8px; font-size: 1.05rem; position: relative; }
.nav .cur input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* Tabellen */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.t th { background: var(--cream); text-align: left; padding: 8px 10px; font-weight: 600; white-space: nowrap; color: var(--brown-900); }
table.t td { padding: 7px 10px; border-bottom: 1px solid #F0E7D8; vertical-align: top; }
table.t td.num, table.t th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.t tr.muted td { color: #9A8A74; background: #FAF6EE; }
table.t tr.sum td { font-weight: 700; background: #F6EEDF; border-bottom: 2px solid var(--line); }
table.t tr.total td { font-weight: 700; background: var(--cream); }
table.t tr.today td:first-child { box-shadow: inset 4px 0 0 var(--amber); }
table.t tr.clickable { cursor: pointer; }
table.t tr.clickable:hover td { background: #FBF4E6; }
.kv { width: 100%; border-collapse: collapse; }
.kv td { padding: 5px 0; }
.kv td.sign { width: 18px; color: var(--muted); }
.kv td.v { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kv tr.res td { border-top: 2px solid var(--line); font-weight: 700; padding-top: 8px; }

/* Listen */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid #F0E7D8; }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .time { font-weight: 700; font-variant-numeric: tabular-nums; width: 64px; }
.list .type-ic { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--cream); color: var(--brown-800); }
.list .type-ic svg { width: 18px; height: 18px; }
.list .type-ic.in { background: #DCEFE2; color: var(--green); }
.list .type-ic.out { background: #F5DEDB; color: var(--red); }
.list .type-ic.break_start, .list .type-ic.break_end { background: #F8E8CF; color: #A86410; }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); }

.tag { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 20px; font-size: .78rem; font-weight: 600; background: var(--cream); color: var(--brown-800); white-space: nowrap; }
.tag.green { background: #DCEFE2; color: var(--green-dark); }
.tag.red { background: #F5DEDB; color: var(--red); }
.tag.orange { background: #F8E8CF; color: #9A5A0C; }
.tag.grey { background: #E9E4DB; color: #6B5F50; }
.tag.blue { background: #DCE8F0; color: var(--blue); }

.req { padding: 14px 16px; border-bottom: 1px solid #F0E7D8; }
.req:last-child { border-bottom: 0; }
.req .title { font-weight: 700; font-size: 1.02rem; margin-bottom: 6px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.req dl { display: grid; grid-template-columns: 120px 1fr; gap: 3px 10px; margin: 0; font-size: .92rem; }
.req dt { color: var(--muted); }
.req dd { margin: 0; font-weight: 500; }
@media (max-width: 520px) { .req dl { grid-template-columns: 1fr; } .req dt { margin-top: 4px; } }
.req .actions { margin-top: 10px; }

/* Tagesauswahl Urlaub/Abwesenheit */
.daypick { border: 1px solid var(--line); border-radius: 8px; max-height: 420px; overflow-y: auto; background: #fff; }
.daypick .d { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-bottom: 1px solid #F3ECDF; }
.daypick .d:last-child { border-bottom: 0; }
.daypick .d.we { background: #FAF6EE; }
.daypick .d .lbl { width: 92px; font-weight: 600; font-variant-numeric: tabular-nums; }
.daypick .d .info { flex: 1; font-size: .85rem; color: var(--muted); }
.daypick .d .info .red { font-weight: 600; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; flex: none; }
.seg button { border: 0; background: #fff; padding: 6px 11px; cursor: pointer; font-size: .85rem; min-width: 42px; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--brown-800); color: var(--foam); }
.seg button:disabled { color: #C9BBA5; cursor: not-allowed; }
.pick-sum { display: flex; justify-content: space-between; align-items: center; margin: 10px 0; font-weight: 600; flex-wrap: wrap; gap: 6px; }
.quick { display: flex; gap: 6px; flex-wrap: wrap; }

.banner { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-radius: var(--radius); margin-bottom: 14px; background: #FFF6E3; border: 1px solid #F0D9A8; }
.banner svg { width: 22px; height: 22px; color: var(--orange); flex: none; margin-top: 1px; }
.banner.info { background: #EEF4F8; border-color: #C9DCE8; }
.banner.info svg { color: var(--blue); }
.banner .grow { flex: 1; }

/* Tabs */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 14px; border-bottom: 2px solid var(--line); }
.tabs a { padding: 9px 14px; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 3px solid transparent; margin-bottom: -2px; }
.tabs a.on { color: var(--brown-800); border-bottom-color: var(--amber); }

/* Dialog */
dialog { border: 0; border-radius: 12px; padding: 0; width: min(560px, calc(100vw - 32px)); box-shadow: 0 10px 40px rgba(0,0,0,.3); background: var(--card); }
dialog::backdrop { background: rgba(34, 21, 10, .55); }
dialog .dh { background: var(--brown-800); color: var(--foam); padding: 12px 16px; font-weight: 600; font-size: 1.05rem; }
dialog .db { padding: 16px; max-height: 70vh; overflow-y: auto; }
dialog .df { padding: 12px 16px; display: flex; justify-content: flex-end; gap: 10px; background: #F8F2E7; }

/* Toasts */
#toasts { position: fixed; z-index: 100; left: 50%; transform: translateX(-50%); bottom: 72px; display: flex; flex-direction: column; gap: 8px; width: min(480px, calc(100vw - 32px)); pointer-events: none; }
.toast { background: var(--brown-900); color: var(--foam); padding: 12px 16px; border-radius: 10px; box-shadow: 0 6px 20px rgba(0,0,0,.25); border-left: 5px solid var(--green); animation: tin .2s ease-out; }
.toast.err { border-left-color: var(--red); }
@keyframes tin { from { opacity: 0; transform: translateY(8px); } }

/* Anmeldung */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: radial-gradient(circle at 50% 20%, #FFFDF8, var(--bg) 70%); }
.login { width: min(400px, 100%); background: var(--card); border-radius: 14px; box-shadow: 0 8px 30px rgba(43, 26, 12, .15); padding: 28px 24px; text-align: center; }
.login img.logo { width: 170px; margin-bottom: 6px; }
.login form { text-align: left; margin-top: 16px; }
.login .btn { width: 100%; margin-top: 6px; font-size: 1.05rem; }
.login .err { color: var(--red); min-height: 1.4em; margin: 6px 0 0; font-size: .92rem; }

.userpick { display: flex; align-items: center; gap: 8px; background: var(--card); border-radius: 8px; padding: 6px 6px 6px 12px; box-shadow: var(--shadow); }
.userpick svg { width: 18px; height: 18px; color: var(--brown-700); flex: none; }
.userpick select { min-height: 38px; padding: 6px 10px; border: 0; background: var(--foam); min-width: 200px; }
.presence-dot { width: 12px; height: 12px; border-radius: 50%; background: #C9BBA5; flex: none; }
.presence-dot.in { background: var(--green); }
.presence-dot.break { background: var(--orange); }
