/* Hinck-Digital App – Farben und Schriften wie auf hinck-digital.de (Schriften lokal, kein Google) */
@font-face { font-family: "Bricolage Grotesque"; src: url("/schriften/bricolage-grotesque-latin-wght-normal.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }
@font-face { font-family: "Instrument Sans"; src: url("/schriften/instrument-sans-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Instrument Sans"; src: url("/schriften/instrument-sans-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Instrument Sans"; src: url("/schriften/instrument-sans-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }

:root {
  --navy: #15213a;
  --navy-tief: #0e1729;
  --akzent: #19b3b8;
  --akzent-dunkel: #0f8a8e;
  --grund: #f6f8fa;
  --flaeche: #ffffff;
  --kreide: #eef1f4;
  --text: #15213a;
  --gedaempft: #4c5a6b;
  --linie: #d3dae1;
  --gut: #1f7a4d;
  --gut-bg: #e3f3ea;
  --warn: #9a5b00;
  --warn-bg: #fbefd9;
  --rot: #b4362a;
  --rot-bg: #fbe9e7;
  --lauf: #c0392b;
  --display: "Bricolage Grotesque", system-ui, sans-serif;
  --sans: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --rand: max(16px, env(safe-area-inset-left, 0px));
  --rand-r: max(16px, env(safe-area-inset-right, 0px));
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --grund: #0e1729;
    --flaeche: #15213a;
    --kreide: #1d2a45;
    --text: #e9eef4;
    --gedaempft: #a3b0bf;
    --linie: #2b3a57;
    --akzent: #4cc9cd;
    --akzent-dunkel: #4cc9cd;
    --gut: #7fd3a3;
    --gut-bg: #183528;
    --warn: #f0bd6a;
    --warn-bg: #3a2c14;
    --rot: #f0897d;
    --rot-bg: #3d1d1a;
    --lauf: #e8665a;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--grund); color: var(--text);
  font: 16px/1.5 var(--sans);
  padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
}
@media (min-width: 900px) { body { padding-bottom: 0; } }
h1, h2, h3 { font-family: var(--display); line-height: 1.2; margin: 0; text-wrap: balance; }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--gedaempft); font-family: var(--sans); font-weight: 600; }
a { color: var(--akzent-dunkel); }
:focus-visible { outline: 2px solid var(--akzent); outline-offset: 2px; }

/* Kopfzeile */
.kopf {
  position: sticky; top: 0; z-index: 20; background: var(--navy); color: #fff;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: calc(8px + env(safe-area-inset-top, 0px)) var(--rand-r) 8px var(--rand);
}
.kopf-logo img { display: block; height: 40px; width: auto; }
.hauptnav { display: none; gap: 4px; }
@media (min-width: 900px) { .hauptnav { display: flex; } }
.hauptnav a {
  color: #dfe6ee; text-decoration: none; padding: 8px 12px; border-radius: 6px; font-weight: 500;
}
.hauptnav a:hover { background: var(--navy-tief); color: #fff; }
.hauptnav a[aria-current="page"] { background: var(--akzent); color: var(--navy-tief); }

/* Untere Leiste auf dem Handy */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; background: var(--flaeche);
  border-top: 1px solid var(--linie); display: flex; justify-content: space-around;
  padding: 6px var(--rand-r) calc(6px + env(safe-area-inset-bottom, 0px)) var(--rand);
}
@media (min-width: 900px) { .tabbar { display: none !important; } }
.tabbar a {
  flex: 1; text-align: center; text-decoration: none; color: var(--gedaempft); font-size: .75rem;
  font-weight: 600; padding: 6px 4px; border-radius: 8px; display: grid; justify-items: center; gap: 2px;
}
.tabbar a svg { width: 24px; height: 24px; }
.tabbar a[aria-current="page"] { color: var(--akzent-dunkel); background: var(--kreide); }

/* Laufende Zeit */
.laufleiste {
  position: sticky; top: calc(56px + env(safe-area-inset-top, 0px)); z-index: 15;
  background: var(--lauf); color: #fff; display: flex; align-items: center; gap: 12px;
  padding: 8px var(--rand-r) 8px var(--rand); flex-wrap: wrap;
}
.laufleiste .was { flex: 1 1 180px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.laufleiste .uhr { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 1.1rem; }
.punkt { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: currentColor; margin-right: 8px; animation: puls 1.6s ease-in-out infinite; }
@keyframes puls { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .punkt { animation: none; } }

/* Inhalt */
.inhalt { max-width: 1100px; margin: 0 auto; padding: 20px var(--rand-r) 32px var(--rand); display: grid; gap: 18px; outline: none; }
.laden { color: var(--gedaempft); }
.zeile { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.zeile.zwischen { justify-content: space-between; }
.karte { background: var(--flaeche); border: 1px solid var(--linie); border-radius: 10px; padding: 16px; display: grid; gap: 14px; min-width: 0; }
.raster { display: grid; gap: 18px; }
@media (min-width: 900px) { .raster.zwei { grid-template-columns: 1fr 1fr; align-items: start; } }
.gedaempft { color: var(--gedaempft); }
.klein { font-size: .85rem; }
.nr { font-variant-numeric: tabular-nums; color: var(--gedaempft); font-size: .85rem; }

/* Knöpfe */
.knopf {
  font: inherit; font-weight: 600; border: 1px solid var(--navy); background: var(--navy); color: #fff;
  padding: 10px 16px; border-radius: 8px; cursor: pointer; text-decoration: none; display: inline-flex;
  align-items: center; justify-content: center; gap: 6px; min-height: 44px;
}
@media (prefers-color-scheme: dark) { .knopf { background: var(--akzent); border-color: var(--akzent); color: var(--navy-tief); } }
.knopf.zweit { background: transparent; color: var(--text); border-color: var(--linie); }
.knopf.start { background: var(--gut); border-color: var(--gut); color: #fff; font-size: 1.05rem; padding: 12px 24px; }
.knopf.stopp { background: #fff; color: var(--lauf); border-color: #fff; }
.knopf.gefahr { background: transparent; color: var(--rot); border-color: var(--linie); }
.knopf.klein { min-height: 34px; padding: 4px 10px; font-size: .85rem; }
.knopf:disabled { opacity: .5; cursor: not-allowed; }
.x { all: unset; cursor: pointer; color: var(--gedaempft); padding: 6px 8px; border-radius: 6px; line-height: 1; }
.x:hover { background: var(--kreide); color: var(--text); }
.x:focus-visible { outline: 2px solid var(--akzent); }

/* Formulare */
form { display: grid; gap: 12px; }
.felder { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.breit { grid-column: 1 / -1; }
label { display: grid; gap: 4px; font-size: .85rem; color: var(--gedaempft); font-weight: 500; }
label.haken { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: .95rem; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--grund); border: 1px solid var(--linie);
  border-radius: 8px; padding: 10px 12px; min-width: 0; width: 100%; min-height: 44px;
}
input[type="checkbox"] { width: 20px; height: 20px; min-height: 0; accent-color: var(--akzent-dunkel); }
textarea { resize: vertical; min-height: 70px; }
.fehlerbox { background: var(--rot-bg); color: var(--rot); padding: 10px 12px; border-radius: 8px; }
.hinweis { background: var(--kreide); padding: 10px 12px; border-radius: 8px; font-size: .9rem; }

/* Tabellen */
.tabelle { overflow-x: auto; margin: 0 -4px; }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--gedaempft); font-weight: 600; padding: 8px 6px; border-bottom: 1px solid var(--linie); white-space: nowrap; }
td { padding: 10px 6px; border-bottom: 1px solid var(--linie); vertical-align: middle; }
tfoot td { border-bottom: 0; font-weight: 600; }
.zahl { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pille { display: inline-block; font-size: .75rem; font-weight: 600; padding: 2px 9px; border-radius: 99px; white-space: nowrap; }
.pille.offen { background: var(--warn-bg); color: var(--warn); }
.pille.gut { background: var(--gut-bg); color: var(--gut); }
.pille.neutral { background: var(--kreide); color: var(--gedaempft); }

/* Kundenliste */
.liste { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.liste a {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; text-decoration: none; color: var(--text);
  background: var(--flaeche); border: 1px solid var(--linie); border-radius: 10px; padding: 12px 14px;
}
.liste a:hover { border-color: var(--akzent); }
.liste .name { font-weight: 600; }
.info { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; }
.info dt { color: var(--gedaempft); }
.info dd { margin: 0; min-width: 0; overflow-wrap: anywhere; white-space: pre-wrap; }

/* Stoppuhr groß */
.stoppuhr { background: var(--lauf); color: #fff; border-radius: 12px; padding: 20px; display: grid; gap: 10px; }
.stoppuhr .gross { font-size: clamp(2.6rem, 11vw, 4rem); font-variant-numeric: tabular-nums; font-weight: 600; line-height: 1; font-family: var(--display); }
details summary { cursor: pointer; color: var(--akzent-dunkel); font-weight: 600; }

/* Anmeldung */
.anmeldung { max-width: 420px; margin: 8vh auto 0; display: grid; gap: 20px; }
.anmeldung .logo-gross { width: 220px; height: auto; justify-self: center; }

/* Meldung unten */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(84px + env(safe-area-inset-bottom, 0px));
  background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 8px; z-index: 30;
  max-width: calc(100% - 32px); box-shadow: 0 6px 20px rgba(0, 0, 0, .2);
}
@media (min-width: 900px) { .toast { bottom: 24px; } }
.toast.fehler { background: var(--rot); }

/* Handy: Tabellen als Karten, laufende Zeit einzeilig */
@media (max-width: 640px) {
  .laufleiste { flex-wrap: nowrap; gap: 10px; }
  .laufleiste .was { flex: 1 1 auto; }
  .tabelle { margin: 0; overflow: visible; }
  .tabelle table, .tabelle tbody, .tabelle tr, .tabelle td { display: block; }
  .tabelle thead { display: none; }
  .tabelle tbody tr { border: 1px solid var(--linie); border-radius: 10px; padding: 8px 12px; margin-bottom: 8px; }
  .tabelle td { border: 0; padding: 4px 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; text-align: right; white-space: normal; }
  .tabelle td::before { content: attr(data-label); color: var(--gedaempft); font-size: .8rem; text-align: left; flex: none; }
  .tabelle td[data-label=""]::before { content: none; }
  .tabelle td[data-label=""] { justify-content: flex-end; }
  .tabelle td:empty { display: none; }
  .tabelle td select { width: auto; }
  .tabelle tfoot tr { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding: 4px 12px; }
  .tabelle tfoot td { padding: 0; }
}

/* Zähler für neue Anfragen */
.marke { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--lauf); color: #fff; font-size: .72rem; font-weight: 700; line-height: 1; }
.tabbar .symbol { position: relative; display: inline-block; }
.tabbar .symbol .marke { position: absolute; top: -6px; right: -12px; }
.anfrage-hinweis { display: block; text-decoration: none; color: var(--text); border-left: 4px solid var(--akzent); }
