/* Zeiterfassung – Oberfläche. Farben und Maße aus README/mockup.html. */
@font-face { font-family: 'IBM Plex Sans'; font-weight: 400; font-display: swap; src: url(fonts/ibm-plex-sans-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-weight: 500; font-display: swap; src: url(fonts/ibm-plex-sans-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-weight: 600; font-display: swap; src: url(fonts/ibm-plex-sans-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-weight: 700; font-display: swap; src: url(fonts/ibm-plex-sans-latin-700-normal.woff2) format('woff2'); }

:root {
  --bg: #F4F3EF; --card: #FFFFFF; --line: #E2E0DA; --line-soft: #EEECE7; --grid: #E6E4DE;
  --text: #1D1F23; --muted: #5F6368; --label: #4A4E55; --accent: #2E64C8; --now: #C2410C;
  --danger: #A3241A; --overlap: #B42318; --field: #DAD8D1; --weekend: #FAF9F6; --today: #EDF2FB;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: 'IBM Plex Sans', system-ui, sans-serif; font-variant-numeric: tabular-nums; }
button, input, select { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
.page { max-width: 1400px; margin: 0 auto; padding: 24px 16px 40px; display: flex; flex-direction: column; gap: 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Kopf */
.top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.title-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.eyebrow { display: flex; align-items: center; gap: 10px; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.save-state { font-weight: 500; letter-spacing: 0; text-transform: none; }
.save-state.fehler { color: var(--danger); }
h1 { margin: 2px 0 0; font-size: 26px; font-weight: 600; letter-spacing: -.01em; }
.nav { display: flex; gap: 6px; flex-wrap: wrap; }
.icon-btn { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--field); border-radius: 10px; background: var(--card); color: var(--text); cursor: pointer; }
.progress { display: flex; flex-direction: column; gap: 6px; min-width: 280px; }
.progress-text { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 13px; flex-wrap: wrap; }
.progress-text strong { font-size: 16px; }
.bar { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; display: flex; }
.bar > div { height: 100%; }
.primary { min-height: 44px; padding: 0 18px; border: 0; border-radius: 10px; background: var(--text); color: #fff; font-size: 14px; font-weight: 600; cursor: pointer; }
.primary:disabled { opacity: .45; cursor: default; }
.top-right { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }

/* Layout */
.row { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.board { flex: 999 1 720px; min-width: 0; background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow-x: auto; }
.board-inner { min-width: 780px; padding-right: 12px; }
.side { flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.card h2 { margin: 0; font-size: 15px; font-weight: 600; }

/* Raster */
.grid { display: grid; grid-template-columns: 56px repeat(7, minmax(0, 1fr)); }
.grid.head { border-bottom: 1px solid var(--line); }
.grid.body { padding: 10px 0 14px; }
.dayhead { padding: 12px 8px 10px 10px; border-left: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.dayhead.today { background: var(--today); }
.dayhead.weekend, .dayhead.feiertag { background: var(--weekend); }
.dh-top { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.dh-name { flex: 0 1 auto; min-width: 0; min-height: 28px; margin: -4px 0 -4px -6px; padding: 0 6px; border: 0; border-radius: 7px; background: transparent; color: var(--text); font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; text-align: left; }
.dh-name:hover, .dh-name[aria-pressed="true"] { background: rgba(29, 31, 35, .07); }
.dh-name span { font-weight: 400; color: var(--muted); }
.add-btn { width: 28px; height: 28px; flex: none; display: flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 7px; background: var(--card); color: var(--muted); cursor: pointer; }
.dh-meta { display: flex; align-items: center; gap: 6px; font-size: 12px; flex-wrap: wrap; }
.dh-meta b { font-weight: 600; }
.dh-ft { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip { padding: 1px 7px; border-radius: 999px; font-size: 11px; font-weight: 500; white-space: nowrap; }
.chip.erfasst { background: #DDEFD3; color: #2C561A; }
.chip.plan { background: #EEECE7; color: var(--label); }
.chip.frei { background: #F1F0EC; color: var(--muted); }
.chip.ueberschneidung { background: #FDE3E1; color: #8A1C12; }
.chip.uebertragen { background: #DCE6F8; color: #173A7A; }
.axis { position: relative; }
.axis span { position: absolute; right: 8px; font-size: 11px; line-height: 14px; color: var(--muted); }
.col { position: relative; border-left: 1px solid var(--line-soft); background-color: #fff; }
.col.weekend, .col.feiertag { background-color: var(--weekend); }
.hint { margin: 0; padding: 10px 16px 14px; border-top: 1px solid var(--line-soft); font-size: 12px; color: var(--muted); }

/* Tagesreiter (nur schmale Bildschirme) */
.daytabs { display: none; }

/* Blöcke */
.blk { position: absolute; left: 3px; right: 3px; margin: 0; border-radius: 6px; border-width: 1px; text-align: left; overflow: hidden; cursor: grab; touch-action: manipulation; display: flex; flex-direction: column; gap: 1px; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.blk.is-sel { touch-action: none; }
.blk:focus-visible { outline: 2px solid var(--text); outline-offset: 1px; }
.blk.is-drag { cursor: grabbing; }
.blk .l { font-size: 12px; font-weight: 600; line-height: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.blk .t { font-size: 11px; line-height: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.blk .ok { position: absolute; right: 4px; top: 3px; width: 14px; height: 14px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; }
.blk.has-ok .l { padding-right: 14px; }
.hdl { position: absolute; left: 0; right: 0; cursor: ns-resize; display: flex; justify-content: center; opacity: 0; transition: opacity .12s; }
.hdl.top { top: 0; }
.hdl.bottom { bottom: 0; align-items: flex-end; }
.hdl i { width: 22px; height: 3px; margin: 1px 0; border-radius: 2px; }
.blk:hover .hdl, .blk.is-sel .hdl { opacity: 1; }
.nowline { position: absolute; left: 0; right: 0; height: 2px; background: var(--now); z-index: 6; pointer-events: none; }
.nowline::before { content: ''; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--now); }

/* Seitenleiste */
.sub { font-size: 13px; color: var(--muted); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 12px; font-weight: 600; color: var(--label); }
.input { min-height: 44px; padding: 0 12px; border: 1px solid var(--field); border-radius: 8px; background: #fff; color: var(--text); font-size: 14px; width: 100%; }
select.input { padding: 0 10px; }
.chips { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.pick { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--text); text-align: left; font-size: 13px; line-height: 1.25; cursor: pointer; }
.pick[aria-pressed="true"] { font-weight: 600; }
.dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.small { font-size: 12px; line-height: 1.4; color: var(--muted); }
.note { margin: 0; padding: 10px 12px; border-radius: 8px; background: #F1F0EC; color: var(--label); font-size: 13px; line-height: 1.45; }
.note.warn { background: #FDE3E1; color: #8A1C12; }
.note.info { background: var(--today); color: #173A7A; }
.link-btn { align-self: flex-start; min-height: 44px; padding: 0 2px; border: 0; background: transparent; color: var(--accent); font-size: 13px; font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: 6px; }
.link-btn[aria-expanded="true"] svg { transform: rotate(180deg); }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 6px; font-size: 12px; font-weight: 600; color: var(--label); }
.steppers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.stepper { display: flex; align-items: center; gap: 4px; }
.stepper button { width: 44px; height: 44px; flex: none; border: 1px solid var(--field); border-radius: 8px; background: #fff; color: var(--text); font-size: 18px; cursor: pointer; }
.stepper span { flex: 1; text-align: center; font-size: 15px; font-weight: 600; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.secondary { min-height: 44px; padding: 0 16px; border: 1px solid var(--field); border-radius: 8px; background: #fff; color: var(--text); font-size: 14px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; }
.secondary:disabled { opacity: .45; cursor: default; }
.secondary.danger { border-color: #F1C5C0; color: var(--danger); }
.secondary.strong { background: var(--text); border-color: var(--text); color: #fff; font-weight: 600; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.stack .secondary { justify-content: flex-start; text-align: left; }
.catrow { display: flex; flex-direction: column; gap: 5px; }
.catrow-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; }
.catrow-top span:first-child { display: flex; align-items: center; gap: 8px; min-width: 0; }
.catrow-top b { font-weight: 600; white-space: nowrap; }
.catbar { height: 6px; background: var(--line-soft); border-radius: 3px; overflow: hidden; }
.catbar div { height: 100%; }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.sheet-head > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sheet-close { display: none; }

/* Dialoge */
dialog { width: min(760px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); padding: 0; border: 0; border-radius: 14px; background: var(--card); color: var(--text); box-shadow: 0 20px 50px rgba(20, 20, 19, .25); }
dialog::backdrop { background: rgba(20, 20, 19, .35); }
dialog.schmal { width: min(480px, calc(100vw - 32px)); }
.dlg { display: flex; flex-direction: column; max-height: calc(100dvh - 48px); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.dlg-head h2 { margin: 0; font-size: 17px; font-weight: 600; }
.dlg-body { padding: 16px 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
.dlg-body > * { flex-shrink: 0; }
.dlg-foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.dlg-section { display: flex; flex-direction: column; gap: 10px; }
.dlg-section + .dlg-section { padding-top: 16px; border-top: 1px solid var(--line-soft); }
.dlg-section h3 { margin: 0; font-size: 14px; font-weight: 600; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 0; }
.inline { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.inline .field { flex: 1 1 160px; }

/* Untis-Übertragung */
.u-day { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.u-dayhead { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 12px; background: #FAF9F6; border-bottom: 1px solid var(--line-soft); }
.u-dayhead .u-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; }
.u-dayhead .actions .secondary { padding: 0 12px; font-size: 13px; }
.u-day .note { margin: 10px 12px 0; }
.u-list { list-style: none; margin: 0; padding: 4px 0; }
.u-entry { display: grid; grid-template-columns: 150px 1fr; gap: 4px 14px; padding: 8px 12px; }
.u-entry + .u-entry { border-top: 1px solid var(--line-soft); }
.u-entry.done { color: var(--muted); }
.u-time { font-weight: 600; font-size: 14px; }
.u-time span { display: block; font-weight: 400; font-size: 12px; color: var(--muted); }
.u-acts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; font-size: 13px; }
.u-acts li { display: flex; align-items: center; gap: 8px; }
.u-acts b { margin-left: auto; font-weight: 600; white-space: nowrap; }
.u-labels { grid-column: 2; }

/* Anmeldung */
.login { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.login form { width: min(380px, 100%); }
.login .err { margin: 0; color: var(--danger); font-size: 13px; }

/* Hinweis unten */
.toast { position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 100; display: flex; align-items: center; gap: 12px; max-width: calc(100vw - 32px); padding: 10px 12px 10px 16px; border-radius: 10px; background: var(--text); color: #fff; font-size: 14px; box-shadow: 0 8px 24px rgba(20, 20, 19, .25); }
.toast button { min-height: 40px; padding: 0 12px; border: 1px solid rgba(255, 255, 255, .35); border-radius: 8px; background: transparent; color: #fff; font-weight: 600; cursor: pointer; }

/* Feine Zeiger (Maus) brauchen größere Griffe nicht; Finger schon */
@media (pointer: coarse) {
  .blk.is-sel .hdl { height: 14px !important; }
  .blk.is-sel .hdl i { width: 28px; height: 4px; margin: 3px 0; }
}

/* Schmale Bildschirme: Tagesansicht und Bearbeiten als Blatt von unten */
@media (max-width: 759px) {
  .page { padding: 14px 12px 32px; gap: 12px; }
  h1 { font-size: 20px; }
  .top { gap: 12px; }
  .top-right { width: 100%; gap: 12px; }
  .progress { min-width: 0; flex: 1 1 100%; }
  .top-right .primary { flex: 1 1 100%; }
  .board-inner { min-width: 0; padding-right: 8px; }
  .grid { grid-template-columns: 48px minmax(0, 1fr); }
  .daytabs { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
  .tab { min-height: 52px; padding: 4px 0; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--text); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; font-size: 12px; cursor: pointer; }
  .tab b { font-size: 14px; font-weight: 600; }
  .tab i { width: 6px; height: 6px; border-radius: 50%; background: transparent; }
  .tab i.plan { background: #9AA0A8; } .tab i.erfasst { background: #4F9330; } .tab i.ueberschneidung { background: var(--overlap); } .tab i.uebertragen { background: var(--accent); }
  .tab.today { background: var(--today); }
  .tab.weekend { background: var(--weekend); }
  .tab[aria-selected="true"] { border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); }
  .side { flex-basis: 100%; }
  #editor.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; max-height: 62dvh; overflow-y: auto; border-radius: 16px 16px 0 0; padding-bottom: max(18px, env(safe-area-inset-bottom)); box-shadow: 0 -10px 30px rgba(20, 20, 19, .18); overscroll-behavior: contain; }
  #editor.sheet .sheet-close { display: inline-flex; flex: none; width: 40px; height: 40px; }
  #editor:not(.sheet) { display: none; }
  body.has-sheet .page { padding-bottom: 62dvh; }
  .u-entry { grid-template-columns: 1fr; }
  .u-labels { grid-column: 1; }
  dialog { width: 100vw; max-width: 100vw; max-height: 100dvh; height: 100dvh; margin: 0; border-radius: 0; }
  dialog.schmal { width: 100vw; }
  .dlg { max-height: 100dvh; height: 100%; }
  .dlg-body { flex: 1; }
}
