:root {
  --ink: #16202a;
  --ink-soft: #5a6874;
  --paper: #ffffff;
  --surface: #eef1f4;
  --line: #d6dce2;
  --go: #12734a;
  --pause: #9a5b00;
  --stop: #9c2f2f;
  --accent: #1b5e8c;
  --radius: 14px;
  --bar: #16202a;
  --bar2: #1f2c38;
  --bar-text: #ffffff;
  --bar-sub: #cfe0ee;
  --bar-on: #6bb3e6;
}

body.theme-hell {
  --bar: #ffffff;
  --bar2: #f7f9fa;
  --bar-text: #16202a;
  --bar-sub: #5a6874;
  --bar-on: #1b5e8c;
}
body.theme-hell .topbar { border-bottom: 1px solid var(--line); }
body.theme-hell .mainnav { border-bottom: 1px solid var(--line); }

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--surface);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--accent); }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: var(--bar);
  color: var(--bar-text);
  padding: 12px 16px;
  padding-top: calc(12px + env(safe-area-inset-top));
}
.topbar .brand { color: var(--bar-text); text-decoration: none; font-weight: 600; font-size: 16px; }
.topbar nav a { color: var(--bar-sub); text-decoration: none; margin-left: 14px; font-size: 15px; }

main { max-width: 820px; margin: 0 auto; padding: 16px 14px 40px; }

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}
.card h1 { font-size: 20px; margin: 0 0 10px; }
.card h2 { font-size: 17px; margin: 0 0 10px; }

.hello { margin: 4px 0 12px; color: var(--ink-soft); }

.status {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--paper);
  border: 1px solid var(--line);
  border-left: 6px solid var(--ink-soft);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.status .dot { width: 14px; height: 14px; border-radius: 50%; background: var(--ink-soft); }
.status-text { font-weight: 600; }
.status-sub { color: var(--ink-soft); font-size: 15px; }
.status-arbeit { border-left-color: var(--go); }
.status-arbeit .dot { background: var(--go); }
.status-pause { border-left-color: var(--pause); }
.status-pause .dot { background: var(--pause); }
.status-aus { border-left-color: var(--ink-soft); }

.now {
  font-size: 60px;
  font-weight: 300;
  letter-spacing: -1px;
  text-align: center;
  margin: 18px 0 0;
  font-variant-numeric: tabular-nums;
}
.nowdate { text-align: center; color: var(--ink-soft); margin-bottom: 18px; }

.actions { display: grid; gap: 12px; margin-bottom: 18px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 64px;
  width: 100%;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  font-size: 19px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(1px); }
.btn-work_start { background: var(--go); border-color: var(--go); color: #fff; }
.btn-break_start { background: var(--pause); border-color: var(--pause); color: #fff; }
.btn-break_end { background: var(--go); border-color: var(--go); color: #fff; }
.btn-work_end { background: var(--stop); border-color: var(--stop); color: #fff; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-danger { background: var(--paper); color: var(--stop); border-color: var(--line); }
.btn-small { min-height: 40px; width: auto; font-size: 15px; padding: 8px 14px; font-weight: 500; }

.totals { display: flex; flex-wrap: wrap; gap: 16px; margin: 6px 0 12px; }
.totals strong { font-size: 19px; font-variant-numeric: tabular-nums; }

.punchlist { list-style: none; margin: 0; padding: 0; }
.punchlist li {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0; border-top: 1px solid var(--line);
}
.punchlist .time { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 52px; }

.tag { font-size: 12px; background: var(--surface); border-radius: 20px; padding: 2px 8px; color: var(--ink-soft); }
.tag-warn { background: #fdeaea; color: var(--stop); }

.muted { color: var(--ink-soft); }
.warn { color: var(--pause); font-weight: 500; }
.error { color: var(--stop); font-weight: 500; }
.ok { color: var(--go); font-weight: 500; }
.hint { color: var(--pause); font-size: 14px; }

.flash { padding: 12px 14px; border-radius: var(--radius); margin-bottom: 14px; border: 1px solid var(--line); background: var(--paper); }
.flash-ok { border-left: 6px solid var(--go); }
.flash-error { border-left: 6px solid var(--stop); }

form.stack { display: grid; gap: 12px; }
form.stack label, .login label { display: block; font-size: 15px; color: var(--ink-soft); }
input[type=text], input[type=password], input[type=time], select {
  width: 100%;
  min-height: 52px;
  padding: 10px 12px;
  font-size: 17px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
}
.check { display: flex; align-items: center; gap: 8px; margin: 8px 0; }
.check input { width: 22px; height: 22px; }

.login { max-width: 420px; margin: 24px auto; }
.login form { display: grid; gap: 10px; }

.monthnav { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.linkrow { display: flex; flex-wrap: wrap; gap: 8px; }
.inline { display: flex; gap: 8px; margin-bottom: 12px; }

.tablewrap { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; font-size: 15px; }
table.grid th, table.grid td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.grid th { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); }
table.grid td { font-variant-numeric: tabular-nums; }
.row-warn { background: #fff9ef; }

.userrow { border-top: 1px solid var(--line); padding: 14px 0; }
.userhead { display: flex; flex-wrap: wrap; gap: 10px; align-items: baseline; margin-bottom: 8px; }
.fields { display: grid; gap: 10px; grid-template-columns: 1fr; margin-bottom: 10px; }

.foot { text-align: center; color: var(--ink-soft); font-size: 13px; padding: 0 14px 30px; }

@media (min-width: 620px) {
  .actions { grid-template-columns: 1fr 1fr; }
  .fields { grid-template-columns: repeat(3, 1fr); }
  .btn { font-size: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .btn:active { transform: none; }
}

/* Kopf, Navigation, Logo */
.topbar .brand { display: flex; align-items: center; gap: 10px; }
.topbar .brand img { height: 34px; width: auto; max-width: 210px; display: block; }
.whoami { font-size: 14px; color: var(--bar-sub); white-space: nowrap; }
.whoami a { color: var(--bar-sub); margin-left: 8px; }

.mainnav {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  background: var(--bar2);
  padding: 0 6px;
  -webkit-overflow-scrolling: touch;
}
.mainnav a {
  color: var(--bar-sub);
  text-decoration: none;
  padding: 12px 12px;
  font-size: 15px;
  white-space: nowrap;
  border-bottom: 3px solid transparent;
}
.mainnav a.on { color: var(--bar-text); border-bottom-color: var(--bar-on); }
.badge {
  display: inline-block;
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 20px;
  background: #c8452f;
  color: #fff;
  font-size: 12px;
  text-align: center;
}

.loginlogo { background: var(--bar); border-radius: 10px; padding: 14px; text-align: center; margin: 0 0 14px; }
body.theme-hell .loginlogo { background: transparent; padding: 4px 0 10px; }
.loginlogo img { max-height: 90px; max-width: 100%; }
.logopreview { max-height: 70px; max-width: 100%; background: var(--bar); padding: 10px; border-radius: 10px; }
body.theme-hell .logopreview { background: var(--surface); }
.center { text-align: center; }

/* Live-Übersicht */
.livegrid { display: grid; gap: 8px; grid-template-columns: 1fr 1fr; }
.livecard { border: 1px solid var(--line); border-left: 5px solid var(--ink-soft); border-radius: 10px; padding: 10px 12px; }
.livecard .livename { display: block; font-weight: 600; }
.livecard .livestate { font-size: 14px; color: var(--ink-soft); }
.live-arbeit { border-left-color: var(--go); background: #f2faf6; }
.live-pause { border-left-color: var(--pause); background: #fff8ef; }

/* Team */
.card-alert { border-left: 6px solid var(--pause); }
.reqrow { border-top: 1px solid var(--line); padding: 12px 0; }
.reqrow:first-of-type { border-top: none; }
.subactions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.subactions .inline { margin: 0; }
.subactions input[type=text] { min-height: 40px; width: auto; max-width: 190px; font-size: 15px; }
.pill { font-size: 12px; border-radius: 20px; padding: 2px 10px; background: var(--surface); color: var(--ink-soft); }
.pill-arbeit { background: #dff0e7; color: var(--go); }
.pill-pause { background: #fdeed8; color: var(--pause); }

input[type=file] { font-size: 15px; padding: 8px 0; }

@media (min-width: 620px) {
  .livegrid { grid-template-columns: repeat(3, 1fr); }
}

/* Kalender */
.calwrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.cal { border-collapse: collapse; font-size: 12px; }
table.cal th, table.cal td { border: 1px solid var(--line); padding: 0; text-align: center; }
table.cal th { padding: 3px 0; min-width: 24px; color: var(--ink-soft); font-weight: 500; }
table.cal .cald { display: block; font-size: 12px; color: var(--ink); }
table.cal .calw { display: block; font-size: 9px; text-transform: uppercase; }
table.cal .we { background: #e7ebef; }
table.cal .hol { background: #f6e9d8; }
.calname { text-align: left !important; padding: 4px 8px !important; white-space: nowrap; font-weight: 500; position: sticky; left: 0; background: var(--paper); z-index: 1; }
table.cal .cell { display: block; min-width: 22px; height: 24px; line-height: 24px; font-size: 11px; font-weight: 600; }
table.cal .cell-abs { background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.3) 0 3px, rgba(255,255,255,0) 3px 7px); }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 13px; color: var(--ink-soft); margin-top: 10px; }
.legend .swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.legend .swatch-hol { background: #f6e9d8; border: 1px solid var(--line); }

/* Schichtplan */
table.plan td { vertical-align: top; }
table.plan select { min-height: 40px; font-size: 14px; min-width: 96px; padding: 6px 8px; }
table.plan th.we, table.plan th.hol { background: #e7ebef; }
table.plan th.hol { background: #f6e9d8; }
table.plan .pill { display: inline-block; margin-bottom: 4px; }

.live-abwesend { border-left-color: #9c2f2f; background: #fdf2f2; }
input[type=date], input[type=color] { min-height: 52px; padding: 8px 10px; font-size: 16px; border: 1px solid var(--line); border-radius: 10px; width: 100%; background: #fff; color: var(--ink); }
input[type=color] { padding: 4px; height: 52px; }

/* Planansicht und Druck */
table.planview td, table.planview th { min-width: 124px; }
table.planview td { text-align: center; vertical-align: middle; padding: 6px 5px; }
table.planview .pill { white-space: nowrap; display: inline-block; }
table.planview .calname { min-width: 112px; }
table.planview tr.me .calname { background: #eef6fc; }
table.planview .planhours { display: block; font-size: 11px; color: var(--ink-soft); margin-top: 2px; }
table.planview .we { background: #f2f4f6; }
table.planview .hol { background: #fbf3e6; }
table.planview tr.me td { background: #eef6fc; }
table.planview tr.me .calname { font-weight: 700; }
.printhead { display: none; }

@media print {
  .topbar, .mainnav, .foot, .noprint, .flash { display: none !important; }
  /* Feste Spaltenbreiten, damit im Druck nichts verrutscht */
  table.planview { table-layout: fixed; }
  table.planview th, table.planview td { overflow: hidden; word-break: break-word; }
  table.planview .calname { width: 22mm; }
  table.planview .pill { display: block; padding: 2px 3px; font-size: 8pt; border-radius: 3px; }
  table.planview .planhours { font-size: 7.5pt; }
  /* Mehr als eine Woche: Uhrzeiten weglassen, sonst wird es zu eng */
  body.compactprint table.planview .planhours { display: none; }
  body.compactprint table.planview { font-size: 8pt; }
  body { background: #fff; font-size: 11pt; }
  main { max-width: none; padding: 0; }
  .card { border: none; border-radius: 0; padding: 0; margin: 0; }
  .card h1 { display: none; }
  .printhead { display: block; font-size: 13pt; font-weight: 600; margin: 0 0 10px; }
  .tablewrap { overflow: visible; }
  table.planview { width: 100%; font-size: 10pt; }
  table.planview td, table.planview th { min-width: 0; }
  table.planview .calname { min-width: 0; position: static; }
  table.planview .pill { white-space: normal; }
  table.planview td, table.planview th { border: 1px solid #999; }
  table.planview tr.me td { background: transparent; }
  .pill, table.planview .we, table.planview .hol {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  a[href]:after { content: ""; }
}

/* Teamkalender auf grossen Bildschirmen besser lesbar */
@media (min-width: 900px) {
  table.cal { font-size: 13px; width: 100%; }
  table.cal th { min-width: 30px; padding: 5px 0; }
  table.cal .cald { font-size: 13px; font-weight: 600; }
  table.cal .calw { font-size: 10px; }
  table.cal .cell { min-width: 30px; height: 32px; line-height: 32px; font-size: 13px; }
  .calname { padding: 6px 12px !important; font-size: 14px; }
  .legend { font-size: 14px; }
}
@media (min-width: 1200px) {
  main { max-width: 1180px; }
  table.cal .cell { height: 36px; line-height: 36px; }
}

/* Abwesenheiten immer schraffiert, damit sie nie mit einer Schichtfarbe verwechselt werden */
.cell-abs, .pill-abs {
  background-image: repeating-linear-gradient(
    135deg,
    rgba(255,255,255,0) 0 5px,
    rgba(255,255,255,.38) 5px 10px
  );
}
.swatch-abs {
  background-image: repeating-linear-gradient(
    135deg,
    rgba(255,255,255,0) 0 3px,
    rgba(255,255,255,.45) 3px 6px
  );
}
@media print {
  .cell-abs, .pill-abs { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
