/* BattleComms V0.1 – App-Anordnung. Farben, Knöpfe, Rahmen aus tokens.css + components.css (wie Mockups Variante E). */
:root { --mockbar-h: 0px; }
html { background: var(--app-bg); }
.boot-err { padding: 24px; }
.err { color: var(--sig-tx); font-weight: 700; margin: 0; }
.mono { font-family: var(--font-mono); }
.scroll-x { overflow-x: auto; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); }
.wrap { flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field .f-l { font-size: var(--fs-xs); color: var(--text-muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.input { min-height: 40px; padding: 6px 10px; font: inherit; color: var(--text); background: var(--surface-2); border: 1px solid var(--control-border); border-radius: var(--radius-s); min-width: 0; width: 100%; box-sizing: border-box; }
textarea.input { min-height: 72px; resize: vertical; }
.bc-dialog.wide { width: min(860px, 100%); }
.bc-toast.error { border-color: var(--sig-tx); }

/* Anmeldung */
.auth { max-width: 480px; margin: 8vh auto; padding: 0 16px; display: flex; flex-direction: column; gap: var(--gap); }
.auth .card-b { display: flex; flex-direction: column; gap: var(--gap); }
.auth-brand { display: flex; align-items: center; gap: 10px; font-size: var(--fs-xl); font-weight: 800; }
.auth-logo { width: 40px; height: 40px; border-radius: var(--radius-s); background: var(--primary-bg); color: var(--accent-text); display: grid; place-items: center; }

/* Rahmen */
.nav-org { font-weight: 800; text-align: center; padding: 8px 4px; margin-bottom: 6px; border-bottom: 1px solid var(--border); color: var(--accent); overflow: hidden; text-overflow: ellipsis; }
.h-clock { font-family: var(--font-mono); }
.h-me { font-weight: 700; display: inline-flex; align-items: center; gap: 6px; }
.conn { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs); color: var(--text-muted); }
.conn-bad { color: var(--sig-tx); font-weight: 700; }
.tx-target .key { font-family: var(--font-mono); font-size: var(--fs-xs); padding: 1px 6px; border: 1px solid currentColor; border-radius: 4px; opacity: 0.8; }
.btn.active { outline: 3px solid var(--sig-broadcast); }
.bc-main { overflow: auto; padding: var(--gap); box-sizing: border-box; }

/* Funk */
.funk { display: grid; grid-template-columns: minmax(240px, 320px) minmax(0, 1fr); gap: var(--gap); height: 100%; min-height: 0; }
.f-left { min-height: 0; overflow: hidden; display: flex; flex-direction: column; }
.f-left .card-b { overflow: auto; }
.f-center { display: flex; flex-direction: column; gap: var(--gap); min-height: 0; }
.f-node { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 40px; padding: 4px 8px; font: inherit; color: var(--text); background: transparent; border: 1px solid transparent; border-radius: var(--radius-s); cursor: pointer; text-align: left; }
.f-node:hover { background: var(--surface-3); }
.f-node.current { background: var(--accent-soft); border-color: var(--accent); }
.f-node.locked { color: var(--text-faint); cursor: not-allowed; }
.f-node .n { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.f-node .cnt { font-size: var(--fs-xs); font-weight: 700; padding: 0 6px; border-radius: 10px; background: var(--surface-3); }
.f-node .ico { width: 16px; height: 16px; }
.f-names { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 0 6px 28px; }
.f-name { font-size: var(--fs-xs); color: var(--text-muted); }
.f-name.talking { color: var(--text); font-weight: 700; }
.f-people { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 4px; }
.badge.off { opacity: 0.55; text-decoration: line-through; }
.f-chat { flex: 1 1 auto; min-height: 260px; display: flex; }
.f-chatcard { flex: 1 1 auto; display: flex; flex-direction: column; }
.f-chatcard .card-b { flex: 1 1 auto; display: flex; flex-direction: column; gap: var(--gap-s); min-height: 0; }
.f-msgs { list-style: none; margin: 0; padding: 0; flex: 1 1 auto; overflow: auto; min-height: 120px; max-height: 50vh; display: flex; flex-direction: column; gap: 4px; }
.f-msgs li { display: grid; grid-template-columns: 52px auto minmax(0, 1fr); gap: 8px; padding: 4px 6px; border-radius: var(--radius-s); }
.f-msgs li.mine { background: var(--accent-soft); }
.f-msgs .t { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-muted); }
.f-msgs .x { white-space: pre-wrap; overflow-wrap: anywhere; }

/* Einsätze */
.ops { display: flex; flex-direction: column; gap: var(--gap); max-width: 1100px; }
.ops h2 { margin: 0; }
.op-row { display: flex; align-items: center; gap: var(--gap-s); padding: 8px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.op-row.active b { color: var(--accent); }

/* Einstellungen, Messwerte, Hilfe */
.settings, .metrics, .help { display: flex; flex-direction: column; gap: var(--gap); max-width: 1100px; }
.set-row { display: flex; align-items: center; gap: var(--gap); padding: 6px 0; border-bottom: 1px solid var(--border); }
.set-row .vol { width: 220px; }
.meter { width: 220px; height: 12px; background: var(--surface-3); border-radius: 6px; overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: var(--amp-green); }
.m-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: var(--gap-s); }
.m-cell { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-s); background: var(--surface-2); }
.m-cell b { font-size: var(--fs-lg); font-family: var(--font-mono); }

/* Verwaltung */
.adm { display: flex; flex-direction: column; gap: var(--gap); max-width: 1200px; }
.adm-body { display: flex; flex-direction: column; gap: var(--gap); }
.adm .seg { flex-wrap: wrap; }
.adm-tbl select { min-width: 120px; }
.big-code { font-size: var(--fs-xl); letter-spacing: 0.08em; }
.inv-out { display: flex; flex-direction: column; gap: 6px; }
.checks { display: flex; flex-direction: column; gap: 4px; max-height: 260px; overflow: auto; }
.check-row { display: flex; justify-content: space-between; gap: var(--gap); }
.ch-tree { display: flex; flex-direction: column; }
.ch-row { display: flex; align-items: center; gap: 8px; min-height: 40px; border-bottom: 1px solid var(--border); }
.ch-row.d1 { padding-left: 20px; } .ch-row.d2 { padding-left: 40px; } .ch-row.d3 { padding-left: 60px; } .ch-row.d4 { padding-left: 80px; }
.ch-cat { font-weight: 800; text-transform: uppercase; font-size: var(--fs-xs); letter-spacing: 0.08em; color: var(--text-muted); }
.ch-room { font-weight: 600; }
.rules { display: flex; flex-direction: column; gap: 6px; }
.rules .rule-row { display: grid; grid-template-columns: 1fr 1.4fr 1fr 1fr auto; gap: 6px; align-items: center; }
.sim-tbl td.ok { color: var(--amp-green); font-weight: 800; text-align: center; }
.sim-tbl td.no { color: var(--text-faint); text-align: center; }
.tiers { display: flex; flex-direction: column; gap: 6px; max-width: 520px; }

/* Karte */
.page-map { display: flex; }
.mapv { display: flex; flex-direction: column; gap: var(--gap-s); flex: 1 1 auto; min-height: 0; }
.m-top { display: flex; align-items: center; gap: var(--gap-s); flex-wrap: wrap; }
.m-crumb { display: flex; align-items: center; gap: 6px; }
.m-search { position: relative; width: min(360px, 100%); }
.m-results { position: absolute; z-index: 20; left: 0; right: 0; top: 44px; list-style: none; margin: 0; padding: 4px; background: var(--surface-1); border: 1px solid var(--control-border); border-radius: var(--radius-s); max-height: 360px; overflow: auto; }
.m-results li { padding: 8px; border-radius: var(--radius-s); cursor: pointer; }
.m-results li:hover, .m-results li:focus { background: var(--surface-3); }
.m-stage { position: relative; flex: 1 1 auto; min-height: 360px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: radial-gradient(ellipse at 50% 45%, var(--surface-2), var(--bg) 75%); touch-action: none; cursor: grab; }
.m-stage.space { background: #05070d; }
.m-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.m-neb { pointer-events: none; opacity: 0.85; }
.m-orbit { fill: none; stroke: rgba(200, 210, 230, 0.22); stroke-width: 1; }
.m-star { fill: #f6d27a; } .m-star.st-pyro { fill: #ff9a52; } .m-star.st-nyx { fill: #c9d6ff; }
.m-glow { fill: #f6d27a; opacity: 0.2; } .m-glow.st-pyro { fill: #ff9a52; } .m-glow.st-nyx { fill: #c9d6ff; }
.m-disc { fill: #8e9aab; }
.m-hit { fill: transparent; cursor: pointer; }
.m-body { cursor: pointer; }
.m-mk { cursor: pointer; }
.m-mk rect, .m-mk path, .m-mk circle:not(.m-hit) { fill: #0d1118; stroke: #e7ecf3; stroke-width: 1.6; }
.m-mk .ring { fill: none; }
.m-mk.k-lz rect { fill: #e7ecf3; }
.m-mk.minor { opacity: 0.6; transform-box: fill-box; }
.m-mk.minor rect { width: 7px; height: 7px; x: -3.5px; y: -3.5px; }
.m-mk.sel rect, .m-mk.sel path, .m-mk.sel circle:not(.m-hit) { stroke: var(--accent); stroke-width: 3; }
.m-lbl { fill: #e7ecf3; font-size: 13px; paint-order: stroke; stroke: rgba(5, 7, 13, 0.85); stroke-width: 3px; pointer-events: none; }
.m-lbl.big { font-weight: 700; font-size: 14px; }
.m-note { fill: #c6cfdc; font-size: 13px; paint-order: stroke; stroke: rgba(5, 7, 13, 0.85); stroke-width: 3px; }
:root[data-tone="light"] .m-stage:not(.space) .m-lbl, :root[data-tone="light"] .m-stage:not(.space) .m-note { fill: var(--text); stroke: var(--surface-1); }
.m-info { min-height: 24px; }
.m-src { margin: 0; }

@media (max-width: 900px) {
  .funk { grid-template-columns: 1fr; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .rules .rule-row { grid-template-columns: 1fr 1fr; }
}

/* Karte: Infokarte, Achteck */
.m-hover { position: absolute; z-index: 5; max-width: 340px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; pointer-events: none;
  background: var(--surface-1); color: var(--text); border: 1px solid var(--control-border); border-radius: var(--radius-s); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45); font-size: 13px; }
.place-info { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 2px 12px; margin: 0; }
.place-info dt { color: var(--text-muted); } .place-info dd { margin: 0; font-variant-numeric: tabular-nums; }
.m-mk.k-lz .oct { fill: #e7ecf3; }

/* Rang-Abzeichen (Kürzel oben, Stufe unten) */
.rk-badges { display: inline-flex; gap: 3px; align-items: center; flex-wrap: nowrap; }
.rk { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; min-width: 28px; padding: 1px 4px; border: 1px solid var(--control-border); border-radius: 4px; background: var(--surface-2); line-height: 1.05; font-weight: 700; }
.rk .rk-t { font-size: 13px; letter-spacing: 0.04em; color: var(--text-muted); }
.rk .rk-b { font-size: 14px; font-family: var(--font-mono); }
.rk.org { border-color: var(--accent); }
.rk.org .rk-t { color: var(--accent); }
.rk.guest { border-style: dashed; }
.person .rk-badges { margin-left: auto; }
.grp-tree .grp { border-left: 3px solid var(--border); padding-left: 10px; margin: 6px 0; }
.grp-tree .grp.div > .grp-h b { color: var(--accent); }
.grp-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-height: 40px; }
.rank-cells { display: flex; gap: 4px; flex-wrap: wrap; }
.rank-cell { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.rank-cell label { font-size: 13px; color: var(--text-muted); font-weight: 700; }
.rank-cell select { min-width: 64px; padding: 4px; }

/* Anmeldung */
.auth-more > summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 700; }
.auth-more > .col { padding-top: var(--gap-s); }

/* Halteknöpfe (WP-001.1): kein Scrollen/Markieren beim Halten */
.hold-btn { touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
/* Verbindungsband (WP-001.3) */
.conn-band { display: flex; align-items: center; gap: 10px; padding: 10px var(--gap); background: var(--sig-tx); color: var(--sig-tx-text, #fff); font-weight: 700; }
.conn-band .ico { width: 22px; height: 22px; }
.tx-target.offline { opacity: 0.55; border-style: dashed; }
