/* mediamoon Zeiterfassung: dunkles Design (Orange / Dunkelblau / Grau / Weiß) */
:root {
  --bg: #0b1020; --bg-deep: #070b17; --card: #121a30; --ink: #f1f4fb; --muted: #aab6d6; --line: #2a3350; --line-strong: #5f6fa0;
  --accent: #ff6600; --accent-ink: #0b1020; --accent-soft: #ff944d; --nav: #070b17;
  --field: #0b1020; --chip: #232d4d; --chip-ink: #dfe5f3;
  --ok: #0b1020; --ok-bg: #7fd9a6; --warn: #ffc9a3; --warn-bg: #2a1405; --warn-line: #ff6600;
  --err: #ffb4ab; --err-bg: #3b1412; --err-line: #ff6b5e; --err-solid: #b42318;
  --info-bg: #121a30;
  --radius: 16px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
main { max-width: 720px; margin: 0 auto; padding: 16px 14px calc(96px + env(safe-area-inset-bottom)); }
h1 { font-size: 1.35rem; margin: 0 0 12px; }
h2 { font-size: 1.1rem; font-weight: 800; margin: 0; }
h3 { font-size: .95rem; margin: 16px 0 6px; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-soft); }
.muted { color: var(--muted); } .small { font-size: .85rem; } .center { text-align: center; }
.sr { position: absolute; left: -9999px; }
code { background: var(--chip); color: var(--chip-ink); padding: 1px 6px; border-radius: 6px; }

/* Kopfzeile */
.appbar { background: var(--bg-deep); border-bottom: 1px solid var(--line); padding: calc(18px + env(safe-area-inset-top)) 18px 16px; }
.appbar-in { max-width: 720px; margin: 0 auto; display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.appbar .eyebrow { display: block; font-size: .75rem; font-weight: 700; color: var(--muted); letter-spacing: .05em; text-transform: uppercase; }
.appbar .title { display: block; font-size: 1.5rem; font-weight: 800; color: #fff; line-height: 1.2; }
.appbar .side { text-align: right; }
.appbar .side small { display: block; font-size: .75rem; font-weight: 600; color: var(--muted); }
.appbar .side strong { font-size: 1.35rem; font-weight: 800; color: #fff; font-variant-numeric: tabular-nums; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 0 0 14px; box-shadow: 0 1px 2px rgba(0, 0, 0, .35); }
.card.alert { background: var(--warn-bg); border: 2px solid var(--warn-line); }
.card.alert h2 { color: #ffa366; }
.card.alert .muted { color: #ffc9a3; }
.card.inactive { opacity: .7; }
.cardhead { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.cardhead h2 { font-size: 1.15rem; }
.sum { font-weight: 800; font-size: 1.25rem; color: var(--accent); font-variant-numeric: tabular-nums; white-space: nowrap; }
details > summary { cursor: pointer; list-style: none; min-height: 28px; }
details > summary::-webkit-details-marker { display: none; }
details[open] > summary { margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
details.cust > summary { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; padding-right: 28px; position: relative; font-size: 1.05rem; }
details.cust > summary::after { content: "⌄"; position: absolute; right: 2px; top: 0; color: var(--muted); font-size: 1.4rem; line-height: 1.2; }
details.cust[open] > summary::after { content: "⌃"; color: var(--accent); }

.flash { border-radius: 12px; padding: 12px 14px; margin: 0 0 12px; white-space: pre-line; background: var(--ok-bg); color: var(--ok); font-weight: 600; }
.flash.warn { background: var(--warn-bg); color: var(--warn); border: 2px solid var(--warn-line); }
.flash.err { background: var(--err-bg); color: var(--err); border: 2px solid var(--err-line); }
.token { display: block; margin: 8px 0; padding: 8px; background: var(--field); color: var(--ink); border-radius: 8px; word-break: break-all; user-select: all; }

label { display: block; font-size: .85rem; font-weight: 700; color: #c9d3ee; margin: 0 0 10px; }
input, select, textarea { width: 100%; margin-top: 4px; padding: 11px 12px; min-height: 44px; font: inherit; font-weight: 400; color: var(--ink); background: var(--field); border: 2px solid var(--line-strong); border-radius: 12px; }
input::placeholder, textarea::placeholder { color: #8895b8; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(255, 102, 0, .45); outline-offset: 1px; border-color: var(--accent); }
textarea { resize: vertical; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: end; }
.row3 { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 10px; }
label.check { display: flex; gap: 10px; align-items: center; color: var(--ink); min-height: 44px; font-weight: 600; }
label.check input { width: 22px; height: 22px; min-height: 0; margin: 0; accent-color: var(--accent); }
@media (max-width: 480px) { .row3 { grid-template-columns: 1fr 1fr; } .row3 > :first-child { grid-column: 1 / -1; } }

.btn { display: inline-flex; align-items: center; justify-content: center; padding: 10px 16px; min-height: 44px; font: inherit; font-weight: 700; color: var(--ink); background: transparent; border: 2px solid var(--line-strong); border-radius: 12px; cursor: pointer; text-align: center; }
.btn:hover { border-color: var(--accent); color: var(--ink); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-soft); border-color: var(--accent-soft); color: var(--accent-ink); }
.btn.danger { color: var(--err); border-color: var(--err-line); }
.btn.danger.solid, .btn.primary.danger { background: var(--err-solid); border-color: var(--err-solid); color: #fff; }
.btn.small { padding: 6px 14px; font-size: .9rem; min-height: 44px; }
.btn.wide { display: flex; width: 100%; margin-top: 6px; min-height: 48px; font-size: 1.05rem; }
.btn[disabled] { opacity: .5; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.actions form, .inlineform { display: inline; margin: 0; }
.inline-delete { margin-top: 12px; }

.capture textarea { margin: 0 0 8px; font-size: 1.05rem; }
.capture .btn { width: 100%; min-height: 48px; font-size: 1.05rem; }
.hint { margin: 10px 0 0; font-size: .82rem; color: var(--muted); }
.hint a { font-weight: 700; }

.daynav { display: flex; align-items: center; justify-content: center; gap: 20px; margin: 18px 0 12px; }
.daynav a { font-size: 1.8rem; font-weight: 700; line-height: 1; padding: 6px 14px; color: var(--accent); }
.daynav a.today { font-size: .85rem; border: 2px solid var(--line-strong); border-radius: 999px; padding: 4px 12px; color: var(--ink); }
.daytotal { text-align: center; padding: 12px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); margin: 4px 0 14px; }
.daytotal strong { color: var(--accent); }

ul.entries, ul.history { list-style: none; margin: 8px 0 0; padding: 0; }
.entry { display: grid; grid-template-columns: 72px 1fr auto 18px; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); align-items: start; }
.entry:first-child { border-top: 0; }
.entry .time { color: #c9d3ee; font-size: .82rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.entry .cust { font-weight: 800; font-size: .9rem; color: #ffc9a3; }
.entry .desc { overflow-wrap: anywhere; font-weight: 600; }
.entry .mins { font-variant-numeric: tabular-nums; font-weight: 800; white-space: nowrap; }
.entry .edit { color: var(--muted); font-size: 1.4rem; line-height: 1; }
.entry.proposal { grid-template-columns: 72px 1fr; }
.card.alert .entry { border-top-color: #6b3410; }
.meta, .chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chips { margin: 0 0 4px; }
ul.history li { padding: 8px 0; border-top: 1px solid var(--line); font-size: .88rem; }
ul.history li:first-child { border-top: 0; }

.badge, .flag { display: inline-block; font-size: .75rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--chip); color: var(--chip-ink); }
.badge.proposal { background: #3a1d08; color: #ffb27a; border: 1px solid var(--warn-line); }
.badge.reviewed { background: var(--ok-bg); color: var(--ok); }
.badge.billed { background: #c9b8f5; color: #0b1020; }
.flag.warn, .badge.warn { background: var(--accent); color: var(--accent-ink); }
.flag.err { background: var(--err-solid); color: #fff; }

/* Navigation unten */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-around; background: var(--nav); border-top: 1px solid var(--line); padding: 8px 4px calc(8px + env(safe-area-inset-bottom)); z-index: 10; }
.tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--muted); font-size: .75rem; font-weight: 600; padding: 2px 0; }
.tabs a .ico { display: flex; align-items: center; justify-content: center; width: 52px; height: 30px; border-radius: 999px; }
.tabs a svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tabs a.on { color: #fff; font-weight: 800; }
.tabs a.on .ico { background: var(--accent); color: var(--accent-ink); }

.login { max-width: 380px; margin: 12vh auto 0; }
.login h1 { color: #fff; }

/* Kunden: Filter aktiv/inaktiv */
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; margin: 0 0 14px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
.seg a { text-align: center; padding: 10px 4px; border-radius: 10px; font-weight: 700; color: var(--muted); min-height: 44px; display: flex; align-items: center; justify-content: center; }
.seg a span { font-weight: 600; opacity: .85; margin-left: 5px; }
.seg a.on { background: var(--accent); color: var(--accent-ink); font-weight: 800; }

/* Monat */
.flash.stale { margin: 10px 0 0; font-size: .9rem; font-weight: 500; }
.billrow { display: flex; gap: 8px; margin-top: 10px; align-items: center; }

/* Eintrag bearbeiten: Kontext auf einen Blick */
.ctx { background: var(--card); border: 2px solid var(--accent); border-radius: 14px; padding: 12px 14px; margin: 0 0 14px; }
.ctx-top { display: flex; justify-content: space-between; gap: 10px; font-size: .8rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.ctx-text { font-size: 1.15rem; font-weight: 800; margin: 6px 0 4px; overflow-wrap: anywhere; }
.ctx-raw, .ctx-note { font-size: .85rem; color: var(--muted); overflow-wrap: anywhere; }
.ctx-missing { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; font-weight: 700; font-size: .85rem; }
label.missing { color: #ffb27a; }
label.missing select, label.missing input { border: 2px solid var(--accent); background: var(--warn-bg); color: var(--ink); }

/* Bericht: weißes Papier, auch im dunklen Design */
.reportpage main { display: none; }
.reportpage { background: var(--bg); }
.reportbar { max-width: 820px; margin: 0 auto; padding: 14px 16px 0; display: flex; justify-content: space-between; align-items: center; }
.report { max-width: 820px; margin: 14px auto 40px; background: #fff; color: #1c2230; padding: 36px 40px; border-radius: var(--radius); position: relative; }
.report header { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 3px solid #ff6600; padding-bottom: 14px; margin-bottom: 18px; }
.report img.brand { display: block; height: 50px; width: auto; max-width: 100%; margin: 0 0 14px; }
.report h1 { margin: 0; font-size: 1.6rem; color: #0b1020; }
.report .period { margin: 2px 0 0; color: #3b4356; font-size: 1.05rem; }
.report .issuer { font-weight: 700; color: #0b1020; text-align: right; }
.report dl.meta { display: grid; grid-template-columns: 110px 1fr; gap: 4px 12px; margin: 0 0 22px; }
.report dt { color: #3b4356; } .report dd { margin: 0; }
.report table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.report th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: #3b4356; border-bottom: 1px solid #cfd4e0; padding: 6px 8px; }
.report td { padding: 6px 8px; vertical-align: top; border-bottom: 1px solid #eef0f5; }
.report .num { text-align: right; font-variant-numeric: tabular-nums; }
.report .nowrap { white-space: nowrap; }
.report tr.daysum td { background: #f5f7fa; font-size: .85rem; color: #3b4356; border-bottom: 1px solid #cfd4e0; }
.report tfoot td { font-weight: 700; font-size: 1rem; padding-top: 12px; border-top: 2px solid #ff6600; border-bottom: 0; }
.report .foot { margin-top: 18px; font-size: .8rem; color: #3b4356; }
.report .muted { color: #3b4356; }
.watermark { background: #fff3dc; color: #7a4a00; text-align: center; padding: 8px; border-radius: 8px; margin-bottom: 16px; font-weight: 700; }
.reportwarn { max-width: 820px; margin: 12px auto 0; }
@media (max-width: 600px) { .report { padding: 20px 14px; } .report .nowrap { white-space: normal; } }
@media print {
  .noprint { display: none !important; }
  body, .reportpage { background: #fff; }
  .report { border: 0; margin: 0; padding: 0; max-width: none; border-radius: 0; box-shadow: none; }
  .report tbody { break-inside: avoid; }
  .report img.brand { height: 46px; }
  .report header, .report tr.daysum td { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  @page { margin: 18mm 15mm; }
}

/* Monat: Kunde aufklappen, Einträge direkt bearbeiten */
.mcust details > summary { list-style: none; cursor: pointer; }
.mcust details > summary::-webkit-details-marker { display: none; }
.mcust > details > summary.cardhead { align-items: center; min-height: 44px; }
.mcust .who { flex: 1; min-width: 0; }
.mcust .who h2 { margin: 0; }
.mcust .who p { margin: 2px 0 0; }
.mcust .sum { color: var(--accent); font-weight: 800; font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.chev { width: 11px; height: 11px; border-right: 3px solid var(--muted); border-bottom: 3px solid var(--muted); transform: rotate(45deg); margin: 0 6px 4px 4px; flex: none; }
details[open] > summary > .chev { transform: rotate(-135deg); margin-bottom: -4px; border-color: var(--accent); }
.chev.small { width: 8px; height: 8px; border-width: 2px; }
.mcust > details[open] { }
.mcust:has(> details[open]) { border: 2px solid var(--accent); }
.mcust .chips { margin: 8px 0 0; }
.mentries { margin-top: 12px; border-top: 1px solid var(--line); }
.mday { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 12px 0 6px; font-size: .8rem; }
.mday-d { font-weight: 800; font-size: .95rem; color: #ffc9a3; }
.mday-s { color: var(--muted); font-weight: 600; }
.mday-s strong { color: var(--ink); }
.ment { border-top: 1px solid #2c3759; }
.ment > summary { display: grid; grid-template-columns: 48px 1fr auto 14px; gap: 10px; align-items: start; padding: 10px 0; min-height: 44px; }
.ment-t { font-weight: 700; color: #c9d3ee; font-size: .85rem; }
.ment-b { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; min-width: 0; }
.ment-d { font-weight: 600; overflow-wrap: anywhere; }
.ment-m { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ment[open] { background: var(--bg); border: 2px solid var(--accent); border-radius: 14px; padding: 0 12px 12px; margin: 4px 0 8px; }
.ment[open] > summary { padding-bottom: 8px; }
.medit { display: flex; flex-direction: column; gap: 10px; }
.medit-actions { display: flex; gap: 8px; }
.medit-actions .btn.primary { flex: 1; min-height: 48px; }
.medit-actions .btn { min-height: 48px; }
.medit-del { margin-top: 6px; }
.linkdanger { background: none; border: 0; padding: 6px 0; min-height: 36px; font: inherit; font-size: .85rem; font-weight: 700; color: #ff8a8a; cursor: pointer; text-decoration: underline; }
.mhint { background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: 10px; padding: 8px 10px; margin: 0 0 10px; font-size: .8rem; font-weight: 600; color: #ffc9a3; }
.addentry { display: flex; align-items: center; justify-content: center; margin-top: 10px; min-height: 44px; font-weight: 700; color: var(--accent); border: 2px dashed var(--line-strong); border-radius: 12px; }
.addentry:hover { border-color: var(--accent); color: var(--accent-soft); }
.mcust .actions { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }

/* Token-Formular: Feld und Button auf einer Linie */
.row2 .btn { margin: 0; height: 48px; min-height: 48px; }
.row2 label input { margin-bottom: 0; height: 48px; box-sizing: border-box; }
.row2 > label { margin-bottom: 0; }

/* Formulare auf dem iPhone: Datum/Zeit-Felder haben eine feste Eigenbreite und sprengen sonst das Raster */
.row2 > *, .row3 > * { min-width: 0; }
input[type=date], input[type=time], input[type=number], select {
  -webkit-appearance: none; appearance: none; min-width: 0; max-width: 100%; height: 48px; line-height: 1.2; text-align: left;
}
input[type=date]::-webkit-date-and-time-value, input[type=time]::-webkit-date-and-time-value { text-align: left; min-height: 1.2em; }
select { padding-right: 36px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px, 6px 6px; background-repeat: no-repeat; }
.row3 { grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
@media (max-width: 480px) {
  .row3 { grid-template-columns: 1fr 1fr; }
  .row3 > :first-child { grid-column: 1 / -1; }
}
.card form label { margin-bottom: 14px; }
.card form .row3 label { margin-bottom: 14px; }
textarea { min-height: 96px; }
