@font-face { font-family: "Heebo"; font-weight: 300; src: url(vendor/fonts/heebo-latin-300-normal.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "Heebo"; font-weight: 400; src: url(vendor/fonts/heebo-latin-400-normal.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "Heebo"; font-weight: 500; src: url(vendor/fonts/heebo-latin-500-normal.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "Heebo"; font-weight: 700; src: url(vendor/fonts/heebo-latin-700-normal.woff2) format("woff2"); font-display: swap; }

/* Neulandhum-Look (neulandhum.de): hell, Anthrazit-Schrift, graue Menüleiste, Rot aus dem Logo, Heebo.
   Aufteilung: links Karte, rechts Kennzahlen – je die halbe Breite. */
:root {
  --bg: #f5f5f5; --panel: #fff; --panel2: #f1f1f1; --line: #e3e3e3;
  --fg: #333; --muted: #6b6b6b; --nav: #666;
  --brand: #e30613; --accent: #40a8a8;
  --ok: #2e8540; --idle: #c77d00; --off: #8a8a8a;
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 2px 8px rgba(0,0,0,.05);
  --font: "Heebo", Helvetica, Arial, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--fg); font: 15px/1.45 var(--font); display: flex; flex-direction: column; }
button, select, input { font: inherit; }

/* Kopf + Zeitraum-Leiste */
.top { display: flex; align-items: center; gap: 18px; padding: 10px 20px; background: var(--panel); border-bottom: 1px solid var(--line); }
.logo { height: 42px; width: auto; display: block; }
.title { display: grid; padding-left: 18px; border-left: 1px solid var(--line); }
.title h1 { margin: 0; font-size: 22px; font-weight: 300; letter-spacing: .06em; text-transform: uppercase; line-height: 1.1; }
.title .sub { font-size: 13px; color: var(--muted); }
.conn { font-size: 12px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; padding: 4px 10px; border-radius: 999px; background: var(--panel2); color: var(--muted); }
.conn::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: currentColor; margin-right: 6px; vertical-align: 1px; }
.conn.live { color: var(--ok); background: #eaf4ec; }
.conn.off { color: var(--brand); background: #fdecec; }
.clock { margin-left: auto; text-align: right; }
.clock b { display: block; font-size: 26px; font-weight: 300; line-height: 1; font-variant-numeric: tabular-nums; }
.clock span { font-size: 12px; color: var(--muted); }
.ranges { display: flex; background: var(--nav); padding: 0 20px; overflow-x: auto; }
.ranges button { background: none; border: 0; border-radius: 0; color: #f2f2f2; padding: 11px 18px; font-size: 14px; font-weight: 500; letter-spacing: .05em; text-transform: uppercase; cursor: pointer; white-space: nowrap; border-bottom: 3px solid transparent; }
.ranges button:hover { color: #fff; background: rgba(255,255,255,.06); }
.ranges button[aria-pressed="true"] { color: #fff; border-bottom-color: var(--brand); }

/* Hauptbereich 50 / 50 */
.app { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; padding: 16px 20px 20px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.panel { min-height: 0; overflow: auto; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-content: start; gap: 16px; padding-right: 2px; }
.panel > .card { padding: 16px 18px; grid-column: 1 / -1; }
.machines { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.machines > .card { padding: 16px 18px; }
h2 { margin: 0 0 12px; font-size: 13px; font-weight: 500; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.note { color: var(--muted); font-size: 13px; margin: 0; }

/* Karte */
.map { position: relative; min-height: 0; overflow: hidden; }
.map canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.lbl { position: absolute; transform: translate(-50%, -100%); white-space: nowrap; font-size: 12px; font-weight: 500; padding: 2px 8px; border-radius: 4px; background: rgba(255,255,255,.92); color: var(--fg); box-shadow: 0 1px 3px rgba(0,0,0,.18); }
.lbl.machine { transform: translate(-50%, calc(-100% - 16px)); font-weight: 700; color: #fff; }
.lbl.zone { font-size: 11.5px; border-left: 3px solid var(--muted); }
.layers, .mapctl { position: absolute; top: 12px; display: flex; gap: 6px; z-index: 2; }
.layers { left: 12px; flex-wrap: wrap; max-width: calc(100% - 80px); }
.mapctl { right: 12px; flex-direction: column; }
.layers button, .mapctl button { background: rgba(255,255,255,.95); border: 1px solid var(--line); border-radius: 999px; color: var(--fg); padding: 5px 12px; font-size: 13px; font-weight: 500; cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.layers button[aria-pressed="true"] { background: var(--fg); border-color: var(--fg); color: #fff; }
.mapctl button { width: 36px; height: 36px; padding: 0; border-radius: 8px; font-size: 17px; }
.mapctl #c3d { font-size: 12px; font-weight: 700; }
.mapctl button[aria-pressed="true"] { background: var(--fg); color: #fff; }
.follow, .drawhint { position: absolute; left: 50%; bottom: 40px; transform: translateX(-50%); z-index: 2; background: var(--fg); color: #fff; border-radius: 999px; padding: 6px 8px 6px 16px; font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 10px; box-shadow: var(--shadow); white-space: nowrap; }
.drawhint { padding: 8px 16px; }
.follow[hidden], .drawhint[hidden] { display: none; }
.follow button { background: rgba(255,255,255,.15); border: 0; color: #fff; border-radius: 50%; width: 24px; height: 24px; cursor: pointer; }
.hint, .attr { position: absolute; bottom: 8px; font-size: 11px; color: var(--muted); background: rgba(255,255,255,.88); padding: 2px 7px; border-radius: 4px; z-index: 1; }
.hint { left: 12px; bottom: auto; top: 54px; } .attr { right: 10px; left: 10px; text-align: right; background: none; }
.attr span { background: rgba(255,255,255,.88); padding: 2px 7px; border-radius: 4px; }
.map.editing canvas { cursor: crosshair; }
.handle { position: absolute; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 4px; background: #fff; border: 2px solid var(--fg); box-shadow: 0 1px 4px rgba(0,0,0,.3); pointer-events: auto; cursor: nwse-resize; touch-action: none; z-index: 3; }
.handle.c1, .handle.c3 { cursor: nesw-resize; }
.handle.move { width: 26px; height: 26px; margin: -13px 0 0 -13px; border-radius: 50%; cursor: move; background: var(--fg); border-color: #fff; }
.handle.move::after { content: "✥"; color: #fff; font-size: 15px; display: grid; place-items: center; height: 100%; line-height: 1; }

/* Radlader-Karten */
.mhead { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.dot { width: 12px; height: 12px; border-radius: 50%; flex: none; display: inline-block; }
.mname { font-size: 18px; font-weight: 700; }
.chip { margin-left: auto; font-size: 12px; font-weight: 500; padding: 3px 10px; border-radius: 999px; background: var(--panel2); color: var(--muted); white-space: nowrap; }
.chip.drive { color: #fff; background: var(--ok); }
.chip.idle { color: #fff; background: var(--idle); }
.chip.off { color: var(--fg); background: #e6e6e6; }
.chip.offline { color: #fff; background: var(--off); }
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; margin-bottom: 12px; }
.kpi span { display: block; font-size: 12px; color: var(--muted); }
.kpi b { font-size: 22px; font-weight: 500; font-variant-numeric: tabular-nums; }
.meta { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 10px; }
.meta b { color: var(--fg); font-weight: 500; }
.acts { display: flex; gap: 8px; margin-top: 12px; }
.acts button, .btn { flex: 1; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; font-size: 13px; font-weight: 500; color: var(--fg); cursor: pointer; }
.acts button:hover, .btn:hover { border-color: #bbb; }
.acts button[aria-pressed="true"] { background: var(--fg); color: #fff; border-color: var(--fg); }
button.primary, .btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Tabellen, Legenden */
.tbl { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 14px; }
.tbl th { text-align: right; font-weight: 400; color: var(--muted); font-size: 12px; padding: 0 0 6px; }
.tbl td { padding: 7px 0; border-top: 1px solid var(--line); text-align: right; white-space: nowrap; }
.tbl th:first-child, .tbl td:first-child { text-align: left; white-space: normal; }
.tbl th + th, .tbl td + td { padding-left: 14px; }
.tbl .dot { width: 10px; height: 10px; vertical-align: -1px; margin-right: 6px; }
.tbl tr.lade td:first-child { font-weight: 700; }
.tbl tr.lade td:first-child::after { content: "Ladespiel"; margin-left: 8px; font-size: 11px; font-weight: 500; color: #fff; background: var(--brand); padding: 1px 6px; border-radius: 999px; vertical-align: 1px; }
.sum { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 14px 0 8px; }
.sum div { background: var(--panel2); border-radius: 8px; padding: 10px 12px; }
.sum span { display: block; font-size: 12px; color: var(--muted); }
.sum b { font-size: 22px; font-weight: 500; }
.legend { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 8px; margin-top: 12px; font-size: 12px; color: var(--muted); }
.legend > span:first-child { grid-column: 1 / -1; }
.legend i { grid-column: 1 / -1; height: 8px; border-radius: 4px; background: linear-gradient(90deg, #2f6bd6, #34c28a 35%, #f2d43a 65%, #e8452c); }
.legend > span:last-child { text-align: right; }

/* Tagesablauf */
.tl-name { display: flex; align-items: center; gap: 6px; margin: 10px 0 5px; font-weight: 500; }
.tl { position: relative; height: 16px; border-radius: 4px; background: var(--panel2); overflow: hidden; }
.tl i { position: absolute; top: 0; bottom: 0; }
.tl i.fahrt, .tl-key i.fahrt { background: var(--ok); }
.tl i.stand, .tl-key i.stand { background: var(--idle); }
.tl i.aus, .tl-key i.aus { background: #c9c9c9; }
.tl-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 4px; font-variant-numeric: tabular-nums; }
.tl-key { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--muted); margin-top: 8px; }
.tl-key span { display: inline-flex; align-items: center; gap: 5px; }
.tl-key i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }
.stops { margin: 5px 0 0; padding-left: 18px; font-size: 13px; color: var(--muted); }

/* Zonen-Karte und Editor */
.zhead { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.zhead h2 { margin: 0; }
.zadd { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--brand); color: #fff; font-size: 22px; line-height: 1; cursor: pointer; box-shadow: var(--shadow); }
.zlist { list-style: none; padding: 0; margin: 0; display: grid; gap: 2px; }
.zlist li { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); font-size: 14px; }
.zlist li:first-child { border-top: 0; }
.zlist small { color: var(--muted); }
.zlist .sw { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.zlist button { padding: 3px 10px; font-size: 12px; background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; cursor: pointer; color: var(--fg); }
.zlist button:first-of-type { margin-left: auto; }
.zlist button.sure { color: #fff; background: var(--brand); border-color: var(--brand); }
.zform { display: grid; gap: 10px; margin-top: 6px; }
.zform label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.zform input[type=text], .zform input[type=number], .login input { font-size: 15px; color: var(--fg); background: #fff; border: 1px solid #cfcfcf; border-radius: 8px; padding: 8px 10px; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button { flex: 1; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel2); cursor: pointer; font-size: 13px; font-weight: 500; color: var(--fg); display: flex; align-items: center; justify-content: center; gap: 6px; }
.seg button[aria-pressed="true"] { border-color: var(--fg); background: #fff; box-shadow: inset 0 0 0 1px var(--fg); }
.row { display: flex; gap: 8px; }
.costs { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.costs h3 { grid-column: 1 / -1; margin: 0; font-size: 13px; font-weight: 500; color: var(--muted); }
.costs .row, .costs .note { grid-column: 1 / -1; }

/* Anmeldung */
.login { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 16px; background: rgba(245,245,245,.92); backdrop-filter: blur(4px); }
.login[hidden] { display: none; }
.login form { width: min(380px, 100%); display: grid; gap: 14px; padding: 28px; }
.login img { justify-self: start; }
.login h1 { margin: 0; font-size: 22px; font-weight: 300; letter-spacing: .06em; text-transform: uppercase; }
.login label { display: grid; gap: 4px; color: var(--muted); font-size: 13px; }
.login button { padding: 10px; border-radius: 8px; border: 0; font-weight: 500; cursor: pointer; }
.err { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; text-align: center; color: var(--muted); }

/* Schmale Bildschirme: Karte oben, Kennzahlen darunter */
@media (max-width: 1100px) {
  body { display: block; }
  .app { grid-template-columns: minmax(0, 1fr); }
  .map { height: 68vh; min-height: 340px; }
  .panel { overflow: visible; }
}
@media (max-width: 640px) {
  .top { flex-wrap: wrap; gap: 8px 12px; padding: 10px 14px; }
  .logo { height: 34px; }
  .title { padding-left: 12px; }
  .title h1 { font-size: 17px; }
  .clock { display: none; }
  .ranges { padding: 0 8px; }
  .ranges button { padding: 10px 12px; font-size: 12.5px; }
  .app { padding: 12px; gap: 12px; }
  .panel, .machines { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .hint { display: none; }
  .meta { flex-wrap: wrap; }
  .costs { grid-template-columns: minmax(0, 1fr); }
  .tbl { font-size: 13px; }
  .tbl th + th, .tbl td + td { padding-left: 8px; }
  .attr { left: 8px; font-size: 10px; }
  .layers button { padding: 4px 10px; font-size: 12px; }
}
.zform input { width: 100%; min-width: 0; }
.ranges { scrollbar-width: none; }
.ranges::-webkit-scrollbar { display: none; }

/* Hilfe: „i“-Knöpfe, Erklärblase, Kurzanleitung */
h2 { display: flex; align-items: center; gap: 8px; }
.info { width: 20px; height: 20px; flex: none; border-radius: 50%; border: 1.5px solid #9a9a9a; background: #fff; color: var(--muted); font: italic 700 12px/1 Georgia, "Times New Roman", serif; cursor: pointer; display: inline-grid; place-items: center; padding: 0; text-transform: none; letter-spacing: 0; }
.info:hover, .info[aria-expanded="true"] { border-color: var(--fg); color: #fff; background: var(--fg); }
.mapctl .info, .layers .info { width: 36px; height: 36px; border-radius: 8px; font-size: 15px; border: 1px solid var(--line); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.layers .info { width: 30px; height: 30px; border-radius: 50%; }
.ranges .info.on-dark { align-self: center; margin-right: 8px; width: 22px; height: 22px; padding: 0; border-radius: 50%; border: 1.5px solid rgba(255,255,255,.7); background: transparent; color: #fff; font: italic 700 12px/1 Georgia, "Times New Roman", serif; text-transform: none; letter-spacing: 0; }
.ranges .info.on-dark:hover, .ranges .info.on-dark[aria-expanded="true"] { background: #fff; color: var(--nav); }
.mhead .info { margin-left: -2px; }
.bubble { position: fixed; z-index: 20; background: #fff; color: var(--fg); border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,.18), 0 0 0 1px var(--line); padding: 14px 16px; font-size: 14px; line-height: 1.5; max-height: 70vh; overflow: auto; }
.bubble[hidden] { display: none; }
.bubble .bhead { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; font-size: 15px; }
.bubble p, .bubble ul { margin: 6px 0; }
.bubble ul { padding-left: 18px; }
.bubble li { margin: 3px 0; }
.bx, .hclose { border: 0; background: var(--panel2); width: 28px; height: 28px; border-radius: 50%; cursor: pointer; color: var(--fg); flex: none; }
.blink { margin-top: 8px; background: none; border: 0; padding: 0; color: var(--accent); font-weight: 500; cursor: pointer; text-decoration: underline; }
.helpbtn { border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 6px 14px 6px 8px; font-weight: 500; color: var(--fg); cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
.helpbtn span { width: 22px; height: 22px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.helpbtn:hover { border-color: #bbb; }
dialog.help { width: min(720px, calc(100vw - 24px)); max-height: calc(100vh - 48px); padding: 0; border: 0; border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.25); color: var(--fg); }
dialog.help[open] { display: flex; flex-direction: column; }
dialog.help::backdrop { background: rgba(51,51,51,.45); }
.hhead { display: flex; align-items: center; gap: 14px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.hhead h2 { margin: 0; font-size: 15px; color: var(--fg); flex: 1; }
.hbody { overflow: auto; padding: 4px 22px 20px; font-size: 15px; line-height: 1.55; }
.hbody .lead { font-size: 16px; margin: 16px 0 4px; }
.hbody section { padding: 12px 12px; margin: 0 -12px; border-radius: 8px; transition: background .4s; }
.hbody section.hl { background: #fdf3d8; }
.hbody h3 { margin: 6px 0 6px; font-size: 13px; font-weight: 500; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.hbody p, .hbody ul { margin: 6px 0; }
.hbody ul { padding-left: 20px; }
.hbody a { color: var(--accent); }
@media (max-width: 640px) { .helpbtn { padding: 6px; } .helpbtn { font-size: 0; gap: 0; } .helpbtn span { font-size: 13px; } }
.mname { white-space: nowrap; }
.mhead { flex-wrap: wrap; row-gap: 6px; }
.machines > .card { min-width: 0; }
