/* Layout: eine schmale Arbeitsspalte wie ein Stempelkarten-Stapel, unten feste Tab-Leiste. */
:root {
  --bg: #EDF0F3;
  --surface: #FFFFFF;
  --surface-2: #F6F8FA;
  --ink: #17212B;
  --muted: #5B6672;
  --line: #D3DAE1;
  --accent: #1F4E79;
  --accent-ink: #FFFFFF;
  --accent-soft: #DCE7F2;
  --plus: #1D7344;
  --minus: #B02A20;
  --weekend: #E3E8EE;
  --c-A: #1F4E79;
  --c-U: #2C76B8;
  --c-K: #B8561A;
  --c-F: #6A4C9C;
  --c-G: #8F6D00;
  --t-A: #E3ECF5;
  --t-U: #DDEBF8;
  --t-K: #F8E6DA;
  --t-F: #ECE5F6;
  --t-G: #F6EDCF;
  --warn-bg: #FFF3D1;
  --warn: #6E4F00;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --r: 10px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11161C; --surface: #1A2129; --surface-2: #212A33; --ink: #E7ECF1; --muted: #9AA6B2; --line: #313C47;
    --accent: #7FB2E5; --accent-ink: #0E1A26; --accent-soft: #233548; --plus: #5CC98A; --minus: #FF8A80; --weekend: #161C22;
    --c-A: #9CC4EC; --c-U: #8CC2F2; --c-K: #F2A271; --c-F: #C3A8EE; --c-G: #E3C25A;
    --t-A: #20303F; --t-U: #1E3245; --t-K: #3A2A1F; --t-F: #2E2640; --t-G: #352E17;
    --warn-bg: #3A3016; --warn: #F2D27A; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #11161C; --surface: #1A2129; --surface-2: #212A33; --ink: #E7ECF1; --muted: #9AA6B2; --line: #313C47;
  --accent: #7FB2E5; --accent-ink: #0E1A26; --accent-soft: #233548; --plus: #5CC98A; --minus: #FF8A80; --weekend: #161C22;
  --c-A: #9CC4EC; --c-U: #8CC2F2; --c-K: #F2A271; --c-F: #C3A8EE; --c-G: #E3C25A;
  --t-A: #20303F; --t-U: #1E3245; --t-K: #3A2A1F; --t-F: #2E2640; --t-G: #352E17;
  --warn-bg: #3A3016; --warn: #F2D27A; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.4; }
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.num, .summary, .dsum, table.konto td { font-variant-numeric: tabular-nums; }

body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 30; background: var(--surface); }
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: var(--surface); border-bottom: 1px solid var(--line); }
.top-inner { max-width: 680px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 10px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.brand { display: flex; flex-direction: column; min-width: 0; }
.brand-name { font-weight: 700; letter-spacing: .01em; font-size: 17px; }
.brand-who { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

main { max-width: 680px; margin: 0 auto; padding-top: 12px; padding-bottom: calc(150px + env(safe-area-inset-bottom, 0px)); padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.tab { display: flex; flex-direction: column; gap: 12px; }

.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.seg button { border: 0; background: transparent; padding: 6px 16px; border-radius: 999px; color: var(--muted); font-weight: 600; }
.seg button.on { background: var(--accent); color: var(--accent-ink); }
.ghost { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 14px; font-weight: 600; }

.period { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 8px; }
.navbtn { height: 44px; border: 1px solid var(--line); background: var(--surface); border-radius: var(--r); font-size: 24px; line-height: 1; }
.period-label { text-align: center; font-weight: 700; font-size: 19px; }
.sub { color: var(--muted); font-size: 13px; font-weight: 400; }

.summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.summary > div { padding: 8px 10px; border-right: 1px solid var(--line); min-width: 0; }
.summary > div:last-child { border-right: 0; }
.summary .k { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.summary .v { font-size: 17px; font-weight: 700; }
.plus { color: var(--plus); }
.minus { color: var(--minus); }

.banner { background: var(--warn-bg); color: var(--warn); border-radius: var(--r); padding: 10px 12px; font-size: 14px; display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.banner button { border: 1px solid currentColor; background: transparent; color: inherit; border-radius: 999px; padding: 4px 12px; font-size: 13px; font-weight: 600; }

.actrow { display: flex; gap: 8px; }
.absbtn { flex: 1 1 0; min-width: 0; padding-inline: 8px; }
.listhead, .day { display: grid; grid-template-columns: 64px minmax(0, 1fr) minmax(0, 1fr) minmax(0, 0.75fr) 58px; gap: 6px; align-items: center; }
.listhead { padding: 0 10px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.listhead span:last-child { text-align: right; }
.daylist { display: flex; flex-direction: column; gap: 5px; }
.weekhead { margin-top: 8px; font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; display: flex; justify-content: space-between; padding: 0 2px; }
.day { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 6px 10px; }
.day.off { background: var(--weekend); }
.day.today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.ddate { line-height: 1.1; }
.ddate b { display: block; font-size: 15px; }
.ddate span { font-size: 12px; color: var(--muted); }
.day input { width: 100%; min-width: 0; border: 1px solid var(--line); border-radius: 8px; padding: 8px 4px; background: var(--surface-2); font-size: 17px; text-align: center; color: var(--ink); min-height: 42px; font-variant-numeric: tabular-nums; }
.day input::placeholder { color: var(--muted); opacity: .55; }
.day input.fixed { background: transparent; border-style: dashed; color: var(--muted); }
.day input.bad { border-color: var(--minus); }
.dsum { text-align: right; line-height: 1.15; }
.dsum b { display: block; font-size: 15px; }
.dsum span { font-size: 12px; }
.chip { grid-column: 2 / 5; display: flex; align-items: center; justify-content: space-between; gap: 8px; border-radius: 8px; padding: 0 4px 0 12px; min-height: 42px; font-weight: 700; }
.listhead.np, .day.np { grid-template-columns: 64px minmax(0, 1fr) minmax(0, 1fr) 58px; }
.day.np .chip { grid-column: 2 / 4; }
.chip.sun { background: transparent; color: var(--muted); font-weight: 600; padding-right: 12px; }
.mailto { display: flex; gap: 10px; align-items: baseline; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.mailto span { color: var(--muted); font-size: 13px; }
.mailto b { word-break: break-all; }
.chip.hol { background: var(--t-F); color: var(--c-F); padding-right: 12px; font-weight: 600; }
.chip.a-U { background: var(--t-U); color: var(--c-U); }
.chip.a-K { background: var(--t-K); color: var(--c-K); }
.chip.a-G { background: var(--t-G); color: var(--c-G); }
.chip small { font-weight: 500; opacity: .85; }
.chip button { border: 0; background: transparent; color: inherit; font-size: 22px; line-height: 1; width: 40px; height: 40px; border-radius: 8px; }
.dinfo { grid-column: 2 / 6; font-size: 12px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; }
.dinfo .night { color: var(--c-A); font-weight: 600; }
.dinfo .lw { color: var(--warn); }
.zlist { display: flex; flex-direction: column; }
.zrow { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.zrow:first-child { border-top: 0; }
.zrow .zm b { display: block; }
.zrow .zm span { font-size: 13px; color: var(--muted); }
.zrow .zb { display: flex; gap: 6px; }
.zrow .zb button { min-height: 38px; padding: 6px 12px; }
.field input[type="date"], .field select { -webkit-appearance: none; appearance: none; }
@media (max-width: 370px) {
  .listhead.np, .day.np { grid-template-columns: 54px minmax(0, 1fr) minmax(0, 1fr) 50px; gap: 4px; }
  .listhead, .day { grid-template-columns: 54px minmax(0, 1fr) minmax(0, 1fr) minmax(0, 0.7fr) 50px; gap: 4px; }
  .day input { font-size: 16px; }
}

.pdfbar { position: fixed; left: 0; right: 0; bottom: calc(58px + env(safe-area-inset-bottom, 0px)); z-index: 15; background: var(--surface); border-top: 1px solid var(--line); }
.pdfbar > * { max-width: 680px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.pdfbar-info { font-size: 12px; color: var(--muted); padding-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pdfbar-btns { display: grid; grid-template-columns: 1fr 1.6fr; gap: 8px; padding-block: 6px 8px; }

.primary, .secondary, .danger { border-radius: var(--r); padding: 10px 14px; font-weight: 700; border: 1px solid transparent; min-height: 44px; }
.primary { background: var(--accent); color: var(--accent-ink); }
.secondary { background: var(--surface-2); border-color: var(--line); color: var(--ink); }
.danger { background: transparent; border-color: var(--minus); color: var(--minus); }
.filebtn { display: inline-flex; align-items: center; justify-content: center; position: relative; overflow: hidden; cursor: pointer; }
.filebtn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--surface); border-top: 1px solid var(--line); display: flex; justify-content: center; padding-bottom: env(safe-area-inset-bottom, 0px); padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); }
.tabs button { flex: 1; max-width: 220px; border: 0; background: transparent; padding: 6px 4px 8px; display: flex; flex-direction: column; align-items: center; gap: 1px; font-size: 12px; color: var(--muted); font-weight: 600; height: 58px; justify-content: center; }
.tabs .ti { font-size: 19px; line-height: 1; }
.tabs button.active { color: var(--accent); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.card h2 { margin: 0; font-size: 16px; }
.welcome { border-color: var(--accent); background: var(--accent-soft); }
.welcome p { margin: 0; }
.hint { margin: 0; color: var(--muted); font-size: 13px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); min-width: 0; }
.field input, .field select { border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; background: var(--surface-2); font-size: 16px; color: var(--ink); width: 100%; min-width: 0; min-height: 42px; }
.field.narrow { max-width: 220px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.inline { display: flex; gap: 8px; align-items: flex-end; }
.inline .grow { flex: 1; }
.sollgrid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.sollgrid label { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 12px; font-weight: 700; color: var(--muted); }
.sollgrid input { width: 100%; text-align: center; border: 1px solid var(--line); border-radius: 8px; padding: 8px 2px; background: var(--surface-2); font-size: 15px; color: var(--ink); }
.switch { display: flex; align-items: center; gap: 10px; font-size: 15px; }
.switch input { width: 22px; height: 22px; accent-color: var(--accent); flex: none; }
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; }
.btnrow > * { flex: 1 1 160px; }
details.more summary { cursor: pointer; font-weight: 600; color: var(--accent); padding: 4px 0; }
details.more[open] { display: flex; flex-direction: column; gap: 10px; }
.backup-status { font-size: 14px; background: var(--surface-2); border-radius: 8px; padding: 8px 10px; }

.konto-head { background: var(--accent); color: var(--accent-ink); border-radius: var(--r); padding: 16px; }
.konto-head .label { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; opacity: .85; }
.konto-head .big { font-size: 38px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }
.konto-head .sub { color: inherit; opacity: .85; }
.table-wrap { overflow-x: auto; }
table.konto { width: 100%; border-collapse: collapse; font-size: 14px; }
table.konto th { text-align: right; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; padding: 6px 6px; border-bottom: 1px solid var(--line); }
table.konto th:first-child, table.konto td:first-child { text-align: left; }
table.konto td { text-align: right; padding: 7px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.konto input { width: 72px; text-align: right; border: 1px solid var(--line); border-radius: 6px; padding: 5px 6px; background: var(--surface-2); font-size: 15px; color: var(--ink); }
table.konto tr.cur td { font-weight: 700; }

.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(10, 16, 22, .55); display: flex; align-items: flex-end; justify-content: center; padding: 16px; padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
.dialog { background: var(--surface); color: var(--ink); border-radius: 14px; width: 100%; max-width: 480px; padding: 18px; display: flex; flex-direction: column; gap: 12px; max-height: 90vh; overflow: auto; }
.dialog h3 { margin: 0; font-size: 18px; }
.dialog p { margin: 0; }
.dialog .btnrow > * { flex: 1 1 120px; }
.dialog.pdf { max-width: 900px; height: 90vh; }
.dialog.pdf { overflow: hidden; }
.dialog.pdf .pdfpages { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.dialog.pdf .pdfpages canvas { cursor: zoom-in; display: block; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.25); flex: none; }
.dialog.pdf .pdfpages.zoom { align-items: stretch; }
.dialog.pdf .pdfpages.zoom canvas { cursor: zoom-out; }
.dialog.pdf iframe { flex: 1; width: 100%; height: 100%; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(140px + env(safe-area-inset-bottom, 0px)); z-index: 60; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-size: 14px; max-width: calc(100% - 32px); text-align: center; box-shadow: 0 6px 20px rgba(0,0,0,.2); }

@media (max-width: 380px) {
  .summary .v { font-size: 15px; }
  .grid2 { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: no-preference) {
  .toast { transition: opacity .2s; }
}
@media print { .tabs, .pdfbar, .top { display: none; } }

.zwarn { color: var(--warn); font-weight: 600; }
.linkbtn { border: 0; background: transparent; color: var(--accent); font-weight: 600; text-decoration: underline; padding: 6px; align-self: center; }

/* Start/Stopp */
.stampcard { align-items: center; text-align: center; gap: 8px; padding-block: 22px; }
.stamp-date { font-weight: 700; font-size: 16px; }
.stamp-state { color: var(--muted); font-size: 14px; min-height: 20px; }
.stamp-clock { font-size: 48px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: .02em; line-height: 1.1; }
.stampbtn { width: 190px; height: 190px; max-width: 70vw; max-height: 70vw; border-radius: 50%; border: 0; font-size: 30px; font-weight: 800; letter-spacing: .04em; color: #fff; margin: 10px 0 4px; box-shadow: 0 8px 22px rgba(0,0,0,.18); }
.stampbtn.start { background: var(--plus); }
.stampbtn.stop { background: var(--minus); }
.stampbtn:active { transform: scale(.97); }
.stamp-sum { font-size: 16px; font-weight: 700; }
.head2 { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.stamplist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.stamplist li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.stamplist li:first-child { border-top: 0; }
.stamplist li.cur { font-weight: 700; color: var(--plus); }
.lw { color: var(--warn); }
.day .ro { text-align: center; font-size: 16px; font-variant-numeric: tabular-nums; min-height: 42px; display: flex; align-items: center; justify-content: center; border-radius: 8px; background: var(--surface-2); }
.day.off .ro { background: transparent; }
.day .ro em { font-style: normal; color: var(--plus); font-weight: 700; font-size: 13px; }
.day.editable { cursor: pointer; border-style: dashed; border-color: var(--accent); }
.chip.locked { padding-right: 12px; }
.chip .lock { width: 10px; height: 12px; border: 2px solid currentColor; border-radius: 2px; position: relative; opacity: .7; margin-top: 4px; flex: none; }
.chip .lock::before { content: ""; position: absolute; left: 0; top: -7px; width: 6px; height: 6px; border: 2px solid currentColor; border-bottom: 0; border-radius: 4px 4px 0 0; }
.banner.ok { background: var(--accent-soft); color: var(--accent); }
.segrow { display: grid; grid-template-columns: 1fr auto 1fr 40px; gap: 8px; align-items: center; margin-bottom: 8px; }
.segrow input { width: 100%; min-width: 0; border: 1px solid var(--line); border-radius: 8px; padding: 9px 6px; background: var(--surface-2); font-size: 17px; text-align: center; color: var(--ink); }
.segdel { border: 0; background: transparent; font-size: 22px; color: var(--muted); height: 40px; }
.previewbar { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.previewbar button { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 4px 10px; font-size: 13px; font-weight: 600; }
.previewbar button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
