/* Zeiterfassung – Gestaltung
   Leitmotiv: die Stechuhr. Ein großes, ruhiges Ziffernblatt und das „Tagesband",
   ein Streifen von 06:00 bis 20:00, auf dem Arbeit und Pausen sichtbar werden. */

:root {
  --ink: #14202a;
  --ink-soft: #2c3b47;
  --paper: #e7ebe9;
  --panel: #ffffff;
  --line: #d2d9d6;
  --muted: #5c6a72;
  --work: #0b6e4f;
  --work-soft: #d6ebe1;
  --pause: #b0700a;
  --pause-soft: #f6e7cd;
  --done: #3d5a73;
  --alert: #a03232;
  --alert-soft: #f6dede;
  --brass: #8a6e2f;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow: 0 1px 2px rgba(20, 32, 42, .08), 0 8px 24px -16px rgba(20, 32, 42, .35);
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body { font-variant-numeric: tabular-nums; }

h1, h2, h3 { margin: 0 0 .4em; line-height: 1.2; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 1em; max-width: 68ch; }
a { color: var(--done); }

:focus-visible {
  outline: 3px solid var(--brass);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ------------------------------------------------------------------ Anmeldung */

.login-page {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1fr;
  place-items: center;
  background:
    radial-gradient(120% 90% at 15% 0%, #f2f5f3 0%, var(--paper) 55%),
    var(--paper);
  padding: 24px;
}

.login-card {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 32px;
}

.brandmark {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.brandmark .dial {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid var(--ink);
  position: relative;
  flex: none;
}

.brandmark .dial::before,
.brandmark .dial::after {
  content: "";
  position: absolute;
  background: var(--ink);
  border-radius: 2px;
  transform-origin: bottom center;
}

.brandmark .dial::before { width: 3px; height: 12px; left: 15px; top: 5px; }
.brandmark .dial::after { width: 3px; height: 9px; left: 15px; top: 8px; transform: rotate(115deg); }

.brandmark strong { font-size: 1.1rem; letter-spacing: -.01em; }
.brandmark span { display: block; font-size: .82rem; color: var(--muted); }

/* ------------------------------------------------------------------ Formulare */

.field { margin-bottom: 16px; }

label {
  display: block;
  font-size: .85rem;
  color: var(--muted);
  margin-bottom: 6px;
}

input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  font: inherit;
  color: var(--ink);
  background: #fbfcfc;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

input:focus, select:focus, textarea:focus {
  border-color: var(--ink-soft);
  background: #fff;
}

input[type="checkbox"] { width: auto; margin-right: 8px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  cursor: pointer;
}

.btn:hover { background: var(--ink-soft); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn.wide { width: 100%; }

.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { background: #f1f4f3; }
.btn.small { padding: 6px 11px; font-size: .85rem; }
.btn.danger { background: var(--alert); border-color: var(--alert); }
.btn.work { background: var(--work); border-color: var(--work); }
.btn.pause { background: var(--pause); border-color: var(--pause); }

.btn-huge {
  width: 100%;
  padding: 22px;
  font-size: 1.25rem;
  letter-spacing: .01em;
  border-radius: var(--radius-lg);
}

.hint { font-size: .85rem; color: var(--muted); }

.notice {
  padding: 11px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #f4f6f5;
  font-size: .9rem;
  margin-bottom: 16px;
}

.notice.error { background: var(--alert-soft); border-color: #e3b7b7; color: #6d1f1f; }
.notice.ok { background: var(--work-soft); border-color: #b6dbc9; color: #0b4c37; }
.notice[hidden] { display: none; }

/* ------------------------------------------------------------------ Grundgerüst */

.shell {
  display: grid;
  grid-template-columns: 232px 1fr;
  min-height: 100dvh;
}

.sidebar {
  background: var(--ink);
  color: #dfe6e4;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: sticky;
  top: 0;
  height: 100dvh;
}

.sidebar .brandmark .dial { border-color: #fff; width: 32px; height: 32px; }
.sidebar .brandmark .dial::before { background: #fff; height: 9px; left: 12px; top: 4px; }
.sidebar .brandmark .dial::after { background: #fff; height: 7px; left: 12px; top: 6px; }
.sidebar .brandmark strong { color: #fff; }
.sidebar .brandmark span { color: #9fb0ad; }

.nav { display: flex; flex-direction: column; gap: 2px; }

.nav a {
  color: #cfdad7;
  text-decoration: none;
  padding: 9px 12px;
  border-radius: var(--radius);
  font-size: .95rem;
}

.nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; }

.nav a.active {
  background: #fff;
  color: var(--ink);
  font-weight: 600;
}

.sidebar footer { margin-top: auto; font-size: .82rem; color: #9fb0ad; }
.sidebar footer strong { display: block; color: #fff; font-size: .95rem; }
.sidebar footer .btn { margin-top: 10px; width: 100%; background: transparent; border-color: #3b4c57; color: #dfe6e4; }

.main { padding: 28px 32px 64px; min-width: 0; }

.page-head {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 20px;
}

.page-head .sub { color: var(--muted); font-size: .92rem; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 18px;
}

.toolbar .field { margin: 0; }
.toolbar input, .toolbar select { min-width: 150px; }

/* ------------------------------------------------------------------ Karten */

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
}

.grid { display: grid; gap: 18px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); }

.stat { display: flex; flex-direction: column; gap: 2px; }
.stat .value { font-size: 1.7rem; font-weight: 660; letter-spacing: -.02em; }
.stat .label { font-size: .85rem; color: var(--muted); }

/* Ziffernblatt: die laufende Arbeitszeit */
.clock-card { display: grid; gap: 18px; }

.clock {
  font-size: clamp(2.9rem, 9vw, 4.6rem);
  font-weight: 680;
  letter-spacing: -.04em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.clock.paused { color: var(--pause); }
.clock.stopped { color: var(--done); }
.clock.running { color: var(--work); }

.status-line {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 600;
  font-size: .95rem;
  padding: 5px 12px 5px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #f6f8f7;
}

.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.working { background: var(--work); }
.dot.on_break { background: var(--pause); }
.dot.closed { background: var(--done); }
.dot.not_started { background: #98a5a1; }

.pulse { animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } }

.action-stack { display: grid; gap: 10px; }
.action-row { display: flex; gap: 10px; flex-wrap: wrap; }

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 14px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.facts div span { display: block; font-size: .82rem; color: var(--muted); }
.facts div strong { font-size: 1.05rem; }

/* ------------------------------------------------------------------ Tagesband */

.band {
  position: relative;
  height: 26px;
  border-radius: 6px;
  background: repeating-linear-gradient(
    90deg, #eef1f0 0 1px, #f7f9f8 1px calc(100% / 14)
  );
  border: 1px solid var(--line);
  overflow: hidden;
}

.band .seg { position: absolute; top: 0; bottom: 0; }
.band .seg.work { background: var(--work); }
.band .seg.break { background: var(--pause); }
.band .seg.live { background: repeating-linear-gradient(45deg, var(--work) 0 6px, #0d825d 6px 12px); }
.band.mini { height: 12px; border-radius: 4px; min-width: 90px; }

.band-scale {
  display: flex;
  justify-content: space-between;
  font-size: .72rem;
  color: var(--muted);
  margin-top: 4px;
}

.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: .84rem; color: var(--muted); }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* ------------------------------------------------------------------ Tabellen */

.table-wrap { overflow-x: auto; border-radius: var(--radius); }

table { width: 100%; border-collapse: collapse; font-size: .92rem; }

thead th {
  text-align: left;
  font-weight: 600;
  color: var(--muted);
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

tbody td { padding: 10px 12px; border-bottom: 1px solid #edf0ef; vertical-align: middle; }
tbody tr:hover { background: #f7f9f8; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.actions { white-space: nowrap; text-align: right; }
tfoot td { padding: 12px; font-weight: 650; border-top: 2px solid var(--ink); }

.tag {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 600;
  border: 1px solid var(--line);
  background: #f2f5f4;
  color: var(--ink-soft);
}

.tag.work { background: var(--work-soft); border-color: #b6dbc9; color: #0b4c37; }
.tag.pause { background: var(--pause-soft); border-color: #e6cfa2; color: #77500a; }
.tag.alert { background: var(--alert-soft); border-color: #e3b7b7; color: #6d1f1f; }
.tag.manual { background: #eae7f4; border-color: #cfc7e6; color: #4a3d78; }

.empty {
  padding: 36px 20px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: #fbfcfc;
}

/* ------------------------------------------------------------------ Kalender */

.calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

.calendar .weekday { font-size: .8rem; color: var(--muted); text-align: center; padding-bottom: 4px; }

.day-cell {
  min-height: 104px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px;
  background: var(--panel);
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: .8rem;
}

.day-cell.blank { background: transparent; border: none; }
.day-cell.weekend { background: #f2f4f3; }
.day-cell.today { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.day-cell .d { font-weight: 650; font-size: .9rem; display: flex; justify-content: space-between; align-items: center; }
.day-cell .times { color: var(--muted); }
.day-cell .earn { margin-top: auto; font-weight: 600; }
.day-cell.state-complete { border-left: 4px solid var(--work); }
.day-cell.state-incomplete { border-left: 4px solid var(--pause); }
.day-cell.state-missing { border-left: 4px solid var(--alert); }

/* ------------------------------------------------------------------ Modal */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 32, 42, .55);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 50;
}

.modal {
  background: var(--panel);
  border-radius: var(--radius-lg);
  width: min(620px, 100%);
  max-height: 88dvh;
  overflow-y: auto;
  padding: 24px;
  box-shadow: 0 24px 60px -20px rgba(20, 32, 42, .6);
}

.modal h2 { margin-bottom: 4px; }
.modal .modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

.break-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: end; margin-bottom: 8px; }

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: var(--ink);
  color: #fff;
  padding: 13px 18px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 60;
  max-width: 340px;
}

.toast.error { background: var(--alert); }

.loading { color: var(--muted); padding: 20px 0; }

/* ------------------------------------------------------------------ Mobil */

.menu-toggle { display: none; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }

  .sidebar {
    position: static;
    height: auto;
    flex-direction: column;
    padding: 14px 16px;
  }

  .nav {
    flex-direction: row;
    overflow-x: auto;
    gap: 6px;
    padding-bottom: 4px;
  }

  .nav a { white-space: nowrap; }
  .sidebar footer { margin-top: 4px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
  .sidebar footer .btn { margin-top: 0; width: auto; }
  .main { padding: 20px 16px 56px; }
  .calendar { gap: 5px; }
  .day-cell { min-height: 82px; font-size: .72rem; padding: 6px; }
  .facts { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 520px) {
  .calendar { grid-template-columns: repeat(2, 1fr); }
  .calendar .weekday { display: none; }
  .day-cell.blank { display: none; }
}

@media print {
  .sidebar, .toolbar, .btn { display: none !important; }
  .shell { display: block; }
  .card { box-shadow: none; }
}
