/* Brenter Montage – one stylesheet, phone first. Colours and sizes are set once here. */
:root {
  --orange: #ef7f1b;
  --orange-dark: #c9640c;
  --ink: #1f2328;
  --muted: #667085;
  --line: #d9dee5;
  --bg: #f4f5f7;
  --card: #ffffff;
  --ok: #1a7f37;
  --warn: #b54708;
  --bad: #b42318;
  --radius: 12px;
  --tap: 52px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink); background: var(--bg);
  padding-bottom: env(safe-area-inset-bottom);
}
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 20px; }
h2 { font-size: 18px; margin: 20px 0 8px; }
h3 { font-size: 16px; }
p { margin: 6px 0; }
a { color: var(--orange-dark); }
.boot { padding: 40px 16px; text-align: center; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.bad { color: var(--bad); }
.ok { color: var(--ok); }
.right { text-align: right; }
.grow { flex: 1; }
.nowrap { white-space: nowrap; }

/* ---- frame */
.top {
  position: sticky; top: 0; z-index: 5; background: var(--orange); color: #fff;
  padding: calc(8px + env(safe-area-inset-top)) 16px 8px;
  display: flex; align-items: center; gap: 12px;
}
.top h1 { flex: 1; font-size: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top button { background: rgba(255,255,255,.18); color: #fff; border: 0; min-height: 40px; }
.syncstate { font-size: 13px; text-align: right; line-height: 1.2; }
.nav { display: flex; gap: 4px; background: var(--card); border-bottom: 1px solid var(--line); padding: 6px 12px; overflow-x: auto; }
.nav a {
  padding: 10px 14px; border-radius: 999px; text-decoration: none; color: var(--ink); white-space: nowrap; font-weight: 600;
}
.nav a.active { background: var(--orange); color: #fff; }
main { max-width: 1100px; margin: 0 auto; padding: 12px 16px 80px; }
.banner { padding: 10px 16px; font-size: 14px; }
.banner.warn { background: #fff4e5; color: var(--warn); }
.banner.bad { background: #fee4e2; color: var(--bad); }
.banner.ansicht { background: #1d4ed8; color: #fff; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.banner.ansicht span { flex: 1; min-width: 200px; }

/* ---- pieces */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 10px 0; }
.card.link { cursor: pointer; }
.card.link:active { background: #fafafa; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.top-align { align-items: flex-start; }
.chip { display: inline-block; padding: 3px 10px; border-radius: 999px; background: #eef0f3; font-size: 13px; font-weight: 600; }
.chip.orange { background: #fdebd8; color: var(--orange-dark); }
.chip.green { background: #dcfce7; color: var(--ok); }
.chip.red { background: #fee4e2; color: var(--bad); }

button, .btn {
  font: inherit; font-weight: 600; min-height: var(--tap); padding: 0 18px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer;
}
button.primary { background: var(--orange); border-color: var(--orange); color: #fff; }
button.danger { color: var(--bad); border-color: #f3b8b3; }
button.small { min-height: 38px; padding: 0 12px; font-size: 14px; }
button:disabled { opacity: .5; cursor: default; }
button.on { background: var(--orange); border-color: var(--orange); color: #fff; }

label.field { display: block; font-size: 13px; color: var(--muted); margin: 8px 0; }
label.field > input, label.field > select, label.field > textarea { display: block; width: 100%; margin-top: 3px; }
input, select, textarea {
  font: inherit; color: var(--ink); background: #fff; border: 1px solid #b8c0cc; border-radius: 8px;
  min-height: 44px; padding: 8px 10px; max-width: 100%;
}
textarea { min-height: 90px; width: 100%; }
input[type=checkbox] { min-height: 0; width: 22px; height: 22px; accent-color: var(--orange); }
label.check { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; margin-right: 14px; }
.grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.grid.wide { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }

/* ---- Monteur: activity tiles */
.tiles { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.tile {
  min-height: 84px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 4px;
  font-size: 17px; text-align: center; padding: 8px;
}
.tile.running { background: var(--orange); border-color: var(--orange); color: #fff; }
.tile .clock { font-size: 14px; font-weight: 400; font-variant-numeric: tabular-nums; }
.tabs { display: flex; gap: 6px; margin: 10px 0; overflow-x: auto; }
.tabs button { min-height: 44px; border-radius: 999px; white-space: nowrap; padding: 0 13px; flex: 1; }

/* ---- Zeitraster: the day like the paper Montageschein.
   --boxen and --pro-stunde come from the component (¼ h view: 56 boxes, ½ h view: 28). */
.rasterwrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.rasterwrap.gesperrt { opacity: .7; }
.raster {
  --zelle: 16px; --label: 78px; --hoehe: 40px;
  display: grid; grid-template-columns: var(--label) repeat(var(--boxen), var(--zelle));
  width: max-content; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.raster.schritt-2 { --zelle: 32px; }
.r-kopf { font-size: 13px; color: var(--muted); padding: 6px 0 4px; border-bottom: 1px solid var(--ink); }
.r-stunde { grid-column: span var(--pro-stunde); padding-left: 3px; border-left: 1px solid var(--ink); }
.r-label {
  position: sticky; left: 0; z-index: 1; background: var(--card); padding: 0 6px; height: var(--hoehe);
  display: flex; flex-direction: column; justify-content: center; line-height: 1.15;
  font-size: 13px; font-weight: 600; border-bottom: 1px solid var(--line); border-right: 1px solid var(--ink);
  white-space: nowrap; overflow: hidden;
}
.r-kopf.r-label { height: auto; border-bottom: 1px solid var(--ink); }
.r-summe { font-size: 11px; font-weight: 400; color: var(--muted); font-variant-numeric: tabular-nums; min-height: 13px; }
.r-zelle { position: relative; height: var(--hoehe); border-bottom: 1px solid var(--line); border-left: 1px solid #e3e7ed; cursor: crosshair; }
.r-zelle.halb { border-left-color: #c9d0da; }
.r-zelle.stunde { border-left-color: var(--ink); }
.r-zelle.person::after {
  content: ""; position: absolute; inset: 0;
  background-image: repeating-linear-gradient(135deg, rgba(255,255,255,.55) 0 3px, transparent 3px 7px);
}
.r-zelle.zug { box-shadow: inset 0 0 0 2px #1d4ed8; }
.r-zelle.anker { box-shadow: inset 0 0 0 3px #1d4ed8; }
.rasterwrap.gesperrt .r-zelle { cursor: default; }
.muster { display: inline-block; width: 14px; height: 14px; border-radius: 3px; vertical-align: -2px; background: #475467; }
.muster.regie { background: var(--orange); }
.muster.person { background-image: repeating-linear-gradient(135deg, rgba(255,255,255,.55) 0 3px, transparent 3px 7px); }
button.on .muster { outline: 2px solid #fff; }
.umschalter { display: inline-flex; }
.umschalter button { border-radius: 0; margin-left: -1px; }
.umschalter button:first-child { border-radius: var(--radius) 0 0 var(--radius); margin-left: 0; }
.umschalter button:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
/* fingers: taller rows; box widths chosen so a phone shows about 7 h upright and the whole day sideways (½ h view) */
@media (pointer: coarse) {
  .raster { --zelle: 17px; --hoehe: 44px; }
  .raster.schritt-2 { --zelle: 19px; }
}
/* ---- Übergabe */
.dokument h4 { margin: 26px 0 6px; font-size: 14px; color: var(--orange-dark); text-transform: uppercase; letter-spacing: .04em; }
.dokument .haken { display: flex; gap: 10px; margin: 3px 0; border-bottom: 1px dotted var(--line); }
.dokument .haken b { width: 18px; text-align: center; flex: none; }
.dokument .zeile { display: flex; justify-content: space-between; gap: 12px; margin: 3px 0; border-bottom: 1px dotted var(--line); }
.unterschrift { display: block; width: 100%; aspect-ratio: 3 / 1; background: #fff; border: 1px solid #b8c0cc; border-radius: 8px; touch-action: none; margin: 8px 0; }
.smiley { font-size: 30px; min-width: 72px; min-height: 64px; }
.smiley.on { background: #fdebd8; border-color: var(--orange); }

/* ---- suggestions under a search field */
.vorschlag { position: relative; }
.vorschlag > input { width: 100%; }
.vorschlag-liste {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 4; background: var(--card); border: 1px solid #b8c0cc;
  border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.14); max-height: 320px; overflow-y: auto; margin-top: 2px;
}
.vorschlag-liste button {
  display: block; width: 100%; text-align: left; border: 0; border-radius: 0; border-bottom: 1px solid var(--line);
  min-height: 44px; padding: 8px 10px; font-weight: 400; background: transparent;
}
.vorschlag-liste button:hover, .vorschlag-liste button:first-child { background: #fdf3e8; }

/* ---- tables (office) */
.tablewrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 13px; color: var(--muted); font-weight: 600; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; }
tr.click:hover { background: #fafafa; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---- login */
.login { max-width: 420px; margin: 8vh auto; padding: 0 16px; text-align: center; }
.code { font-size: 34px; font-weight: 700; letter-spacing: 4px; margin: 16px 0; font-variant-numeric: tabular-nums; }

@media (min-width: 700px) {
  main { padding-top: 18px; }
  h1 { font-size: 22px; }
}

/* photos */
.fotos { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.fotos figure { margin: 0; display: flex; flex-direction: column; gap: 4px; }
.fotos img, .foto-leer { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; background: #eef0f3; cursor: zoom-in; }
.foto-leer { display: flex; align-items: center; justify-content: center; text-align: center; font-size: 12px; color: #667085; cursor: default; padding: 6px; }
.fotos figcaption { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.fotos figcaption input { width: 100%; }
.warn-text { color: var(--warn); }
.foto-gross { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .88); display: flex; align-items: center; justify-content: center; cursor: zoom-out; }
.foto-gross img { max-width: 100%; max-height: 100%; }
.fussnote { margin: -4px 0 8px; }

/* ---- Wochentafel (office) */
.umschalter { display: inline-flex; }
.umschalter button { border-radius: 0; }
.umschalter button:first-child { border-radius: 8px 0 0 8px; }
.umschalter button:last-child { border-radius: 0 8px 8px 0; margin-left: -1px; }
.tafelwrap { overflow-x: auto; }
.tafel { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; min-width: 760px; }
.tafel > div { background: var(--card); }
.tafel-kopf { padding: 8px; font-weight: 600; font-size: 14px; text-align: center; }
.tafel-kopf.heute { background: #fdebd8; color: var(--orange-dark); }
.tafel-team { padding: 8px; font-weight: 600; font-size: 14px; }
.tafel-zelle { padding: 4px; min-height: 76px; display: flex; flex-direction: column; gap: 4px; position: relative; }
.tafel-zelle.heute { background: #fffaf4; }
.tafel-zelle.ziel { outline: 2px dashed var(--orange); outline-offset: -3px; background: #fdebd8; }
.karte { border: 1px solid var(--line); border-left: 4px solid #98a2b3; border-radius: 6px; padding: 4px 6px; font-size: 13px; line-height: 1.3; background: #fff; cursor: grab; }
.karte:hover { box-shadow: 0 1px 4px rgba(0, 0, 0, .15); }
.karte.laufend { border-left-color: var(--orange); }
.karte.abgeschlossen, .karte.abgenommen, .karte.abgerechnet { border-left-color: var(--ok); }
.karte.fest { cursor: pointer; background: #f6f8f6; }
.karte-zeit { font-size: 12px; font-weight: 600; color: var(--muted); display: flex; justify-content: space-between; gap: 6px; }
.karte .fix { color: #fff; background: var(--bad); border-radius: 4px; padding: 0 5px; font-size: 11px; }
.tafel-zelle .plus { min-height: 0; height: 22px; padding: 0; border: 1px dashed var(--line); background: transparent; color: var(--muted); font-size: 13px; opacity: 0; margin-top: auto; }
.tafel-zelle:hover .plus, .tafel-zelle .plus:focus { opacity: 1; }

/* ---- Kalender (Monteur, phone first) */
.kal-streifen { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin: 8px 0 12px; }
.kal-streifen button { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 0; min-height: 58px; }
.kal-streifen button.heute { border-color: var(--orange); background: #fdebd8; }
.kal-streifen button.leer b { color: var(--muted); font-weight: 400; }
.kal-streifen .punkte { display: flex; gap: 3px; height: 6px; }
.kal-streifen .punkte i { width: 6px; height: 6px; border-radius: 50%; background: #98a2b3; }
.kal-streifen .punkte i.laufend { background: var(--orange); }
.kal-streifen .punkte i.abgeschlossen, .kal-streifen .punkte i.abgenommen, .kal-streifen .punkte i.abgerechnet { background: var(--ok); }
.kal-tag { scroll-margin-top: 64px; margin-bottom: 10px; }
.kal-tag h3 { margin: 10px 0 4px; }
.kal-tag.heute h3 { color: var(--orange-dark); }
.kal-einsatz { border-left: 4px solid #98a2b3; margin: 6px 0; }
.kal-einsatz.laufend { border-left-color: var(--orange); }
.kal-einsatz.abgeschlossen, .kal-einsatz.abgenommen, .kal-einsatz.abgerechnet { border-left-color: var(--ok); }
.kal-zeit { font-size: 15px; }

/* Office: QR code of a new Briefkasten device */
.qr { overflow-x: auto; }
.qr svg { display: block; }          /* natural size: the SVG has no viewBox, scaling it would cut it off */
