:root {
  --brand: #8b0000;
  --brand-dark: #650000;
  --bg: #f5f5f5;
  --text: #1d1d1f;
  --muted: #666;
  --card: #fff;
  --border: #ddd;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif; color: var(--text); background: var(--bg); }
.hidden { display: none !important; }
.topbar { height: 56px; display: flex; align-items: center; justify-content: space-between; padding: 0 12px; background: var(--brand); color: white; box-shadow: 0 2px 8px rgba(0,0,0,.25); z-index: 1000; position: relative; }
.topbar nav { display: flex; gap: 8px; align-items: center; }
.topbar a, .topbar button { color: white; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.3); border-radius: 8px; padding: 8px 10px; text-decoration: none; }
#gpsStatus { margin-left: 10px; font-size: 14px; opacity: .9; }
main { height: calc(100% - 56px); position: relative; }
#map { width: 100%; height: 100%; }
.actionbar { position: absolute; left: 8px; right: 8px; bottom: calc(env(safe-area-inset-bottom, 0px) + 8px); z-index: 900; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
button, input, select, textarea { font: inherit; }
button { border: 1px solid var(--border); background: white; border-radius: 10px; padding: 10px 12px; cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,.18); }
button.primary, .primary { background: var(--brand); color: white; border-color: var(--brand-dark); }
.auth-panel { position: fixed; inset: 0; z-index: 2000; background: linear-gradient(145deg, #580000, #222); display: grid; place-items: center; padding: 16px; }
.card { background: var(--card); border-radius: 16px; padding: 18px; box-shadow: 0 8px 30px rgba(0,0,0,.18); border: 1px solid var(--border); }
.auth-card { width: min(480px, 100%); }
.auth-card h1 { margin-top: 0; }
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin: 12px 0; }
.tabs button { box-shadow: none; border-radius: 8px; }
.tabs button.active { background: var(--brand); color: white; }
.tab-content { display: none; }
.tab-content.active { display: grid; gap: 10px; }
label { display: grid; gap: 4px; font-weight: 600; margin: 8px 0; }
input, select, textarea { width: 100%; padding: 10px; border: 1px solid var(--border); border-radius: 8px; background: white; }
textarea { min-height: 80px; resize: vertical; }
.message { margin-top: 12px; color: var(--brand-dark); min-height: 20px; }
.info-panel { position: absolute; top: 12px; right: 12px; z-index: 950; width: min(420px, calc(100% - 24px)); max-height: calc(100% - 110px); overflow: auto; background: rgba(255,255,255,.96); border-radius: 14px; padding: 14px; box-shadow: 0 6px 24px rgba(0,0,0,.25); }
.info-panel h2 { margin: 0 0 8px; }
.hydrant-list { padding-left: 20px; }
.hydrant-list li { margin: 0 0 10px; border-bottom: 1px solid #eee; padding-bottom: 8px; }
.hydrant-list span { float: right; color: var(--muted); }
.direction { display: grid; place-items: center; margin: 8px 0; }
.arrow { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; background: var(--brand); color: white; font-size: 46px; line-height: 1; transform-origin: center; }
dialog { border: none; border-radius: 16px; box-shadow: 0 10px 40px rgba(0,0,0,.35); max-width: 460px; width: calc(100% - 24px); }
dialog menu { display: flex; justify-content: flex-end; gap: 10px; padding: 0; }
.admin-body { height: auto; min-height: 100%; }
.admin-main { height: auto; max-width: 1100px; margin: 20px auto; padding: 0 12px; display: grid; gap: 18px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.inline-form { display: grid; grid-template-columns: 1.4fr 1fr 2fr auto; gap: 8px; align-items: end; margin-top: 14px; }
code { background: #eee; padding: 1px 4px; border-radius: 4px; }
@media (max-width: 760px) {
  .actionbar { grid-template-columns: 1fr 1fr; }
  .actionbar button { padding: 10px 8px; }
  .info-panel { top: auto; bottom: calc(env(safe-area-inset-bottom, 0px) + 122px); right: 8px; left: 8px; width: auto; max-height: 45%; }
  .inline-form { grid-template-columns: 1fr; }
  .topbar { font-size: 14px; }
  #gpsStatus { display: block; margin-left: 0; }
}

/* HydrantPilot Karten-Symbole */
.hydrantpilot-user-icon,
.hydrantpilot-hydrant-icon {
  background: transparent;
  border: none;
}
.user-dot {
  position: absolute;
  left: 9px;
  top: 9px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #1a73e8;
  border: 2px solid #fff;
  box-shadow: 0 0 4px rgba(0,0,0,.55);
}
.user-ring {
  position: absolute;
  left: 2px;
  top: 2px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid rgba(26,115,232,.45);
  background: rgba(26,115,232,.12);
}
.hydrant-symbol {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 8px 8px 8px 0;
  transform: rotate(-45deg);
  background: var(--brand);
  color: #fff;
  border: 2px solid #fff;
  box-shadow: 0 2px 7px rgba(0,0,0,.45);
  font-weight: 800;
  font-size: 15px;
}
.hydrant-symbol::first-letter {
  transform: rotate(45deg);
}
.hydrantpilot-hydrant-icon .hydrant-symbol {
  line-height: 1;
}
.hydrantpilot-hydrant-icon .hydrant-symbol {
  text-align: center;
}
.hydrantpilot-hydrant-icon .hydrant-symbol {
  transform: rotate(-45deg);
}
.hydrantpilot-hydrant-icon .hydrant-symbol::before {
  content: 'H';
  transform: rotate(45deg);
}
.hydrantpilot-hydrant-icon .hydrant-symbol {
  font-size: 0;
}
.hydrantpilot-hydrant-icon .hydrant-symbol::before {
  font-size: 15px;
}
.confirm-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  font-weight: 500;
  background: #fff8e1;
  border: 1px solid #f0d98a;
  border-radius: 10px;
  padding: 10px;
}
.confirm-row input {
  width: auto;
  margin-top: 3px;
}
button.danger {
  background: #7a0000;
  color: #fff;
  border-color: #520000;
}
button.small {
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 14px;
}
.table-wrap {
  overflow-x: auto;
}
small {
  color: var(--muted);
}

/* HydrantPilot Admin v0.3 */
.filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 10px;
  align-items: end;
  margin: 12px 0 14px;
}
.filter-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.checkbox-inline {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
}
.checkbox-inline input {
  width: auto;
}
.muted-block {
  color: var(--muted);
  margin: 8px 0 12px;
}
.hydrant-admin-table th,
.hydrant-admin-table td {
  min-width: 150px;
}
.hydrant-admin-table th:first-child,
.hydrant-admin-table td:first-child {
  min-width: 90px;
}
.compact-dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 2px 8px;
  margin: 0;
}
.compact-dl dt {
  font-weight: 700;
  color: var(--muted);
}
.compact-dl dd {
  margin: 0;
}
.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 700;
}
.badge-active {
  background: #e8f5e9;
  color: #1b5e20;
  border: 1px solid #a5d6a7;
}
.badge-deleted {
  background: #ffebee;
  color: #7a0000;
  border: 1px solid #ef9a9a;
}
tr.is-deleted {
  opacity: .72;
  background: #fafafa;
}
details summary {
  cursor: pointer;
  font-weight: 700;
  margin-top: 6px;
}
pre {
  white-space: pre-wrap;
  overflow-x: auto;
  max-width: 520px;
  background: #f6f6f6;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
}
@media (max-width: 900px) {
  .filter-grid { grid-template-columns: 1fr; }
}

/* HydrantPilot Admin v0.5 Tabsheets */
.admin-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin: 0 0 2px;
}
.admin-tabs .tab-button {
  box-shadow: none;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--border);
  font-weight: 700;
}
.admin-tabs .tab-button.active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand-dark);
}
.tab-panel[hidden] {
  display: none !important;
}
.tab-panel.active {
  display: block;
}
.export-grid {
  align-items: end;
}
.table-wrap {
  overflow-x: auto;
}
@media (max-width: 760px) {
  .admin-tabs { display: grid; grid-template-columns: 1fr; }
  .admin-tabs .tab-button { border-radius: 10px; }
}

/* HydrantPilot v0.7 Branding, iPhone-Button-Fix und Wartung */
button,
input[type="button"],
input[type="submit"] {
  -webkit-appearance: none;
  appearance: none;
  color: var(--text);
}
button.primary,
.primary,
.tabs button.active,
.admin-tabs .tab-button.active,
.topbar a,
.topbar button,
button.danger {
  color: #fff;
}
.actionbar {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}
.login-branding {
  text-align: center;
  margin-bottom: 12px;
}
.brand-logo-link {
  display: inline-block;
  background: #fff;
  border-radius: 14px;
  border: 1px solid #e6e6e6;
  padding: 8px 10px;
  box-shadow: 0 3px 12px rgba(0,0,0,.13);
}
.brand-logo {
  display: block;
  width: min(280px, 100%);
  height: auto;
  max-height: 84px;
  object-fit: contain;
}
.login-branding h1 {
  margin: 12px 0 4px;
}
.app-subtitle {
  margin: 0 0 8px;
  color: var(--muted);
}
.productline,
.legal-links {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--muted);
}
.productline a,
.legal-links a {
  color: var(--brand-dark);
  font-weight: 700;
  text-decoration: none;
}
.productline a:hover,
.legal-links a:hover {
  text-decoration: underline;
}
.legal-links {
  display: flex;
  justify-content: center;
  gap: 8px;
  align-items: center;
}
.maintenance-list .small {
  margin-top: 8px;
}
.maintenance-item {
  border-left: 4px solid #ddd;
  padding-left: 8px;
}
.maintenance-never,
.maintenance-due {
  border-left-color: #b00020;
  background: #fff7f7;
}
.maintenance-ok {
  border-left-color: #2e7d32;
}
.badge-warning {
  background: #fff8e1;
  color: #8a5a00;
  border: 1px solid #f0d98a;
}
.badge-danger {
  background: #ffebee;
  color: #7a0000;
  border: 1px solid #ef9a9a;
}
@media (max-width: 900px) {
  .actionbar { grid-template-columns: 1fr 1fr 1fr; }
}
@media (max-width: 760px) {
  .actionbar { grid-template-columns: 1fr 1fr; }
  .brand-logo { max-height: 70px; }
}

/* HydrantPilot v0.8 Labitzke Original-Branding / iOS-Button-Fix */
.login-branding {
  text-align: center;
  margin-bottom: 10px;
}
.brand-logo-link {
  display: inline-block;
  text-decoration: none;
}
.brand-logo {
  display: block;
  width: min(260px, 82vw);
  height: auto;
  margin: 0 auto 10px;
  object-fit: contain;
}
.productline {
  margin: 8px 0 2px;
  font-size: 14px;
  color: var(--muted);
}
.productline a,
.legal-links a {
  color: var(--brand);
  text-decoration: none;
  font-weight: 700;
}
.productline a:hover,
.legal-links a:hover {
  text-decoration: underline;
}
.legal-links {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--muted);
}
.legal-links span {
  padding: 0 4px;
}
button,
input[type="button"],
input[type="submit"],
input[type="reset"] {
  -webkit-appearance: none;
  appearance: none;
  color: var(--text);
  text-align: center;
}
button.primary,
.primary,
.tabs button.active {
  -webkit-appearance: none;
  appearance: none;
  background-color: var(--brand) !important;
  color: #fff !important;
  border-color: var(--brand-dark) !important;
  -webkit-text-fill-color: #fff;
}
button:disabled {
  opacity: .55;
}
.startup-splash {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: grid;
  place-items: center;
  background: #fff;
  transition: opacity .4s ease;
}
.startup-splash.startup-fade {
  opacity: 0;
  pointer-events: none;
}
.startup-video {
  width: min(900px, 100vw);
  height: min(620px, 100vh);
  object-fit: contain;
  background: #fff;
}
.startup-skip {
  position: absolute;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 5001;
  background: rgba(255,255,255,.92);
  color: var(--text);
  border: 1px solid var(--border);
}
@media (prefers-reduced-motion: reduce) {
  .startup-splash { display: none !important; }
}
@media (max-width: 520px) {
  .brand-logo { width: min(230px, 86vw); }
  .auth-card { padding: 16px; }
}


/* HydrantPilot v0.9: Startvideo nur vor Login und schließbare Infofenster */
.info-panel {
  padding-top: 10px;
}
.info-close {
  position: sticky;
  top: 0;
  z-index: 2;
  float: right;
  margin: 0 0 8px 10px;
  background: var(--brand) !important;
  color: #fff !important;
  -webkit-text-fill-color: #fff;
  border-color: var(--brand-dark) !important;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(0,0,0,.20);
}
.info-content {
  clear: none;
}
.info-content::after {
  content: '';
  display: block;
  clear: both;
}
@media (max-width: 760px) {
  .info-panel {
    max-height: 58%;
    padding: 10px;
  }
  .info-close {
    width: auto;
    min-width: 116px;
  }
}

/* HydrantPilot v1.0: Produktname, internes Impressum und Datenschutz */
.legal-body {
  background: linear-gradient(135deg, #f7f7f7, #e9edf2);
  color: var(--text);
  min-height: 100vh;
  padding: 28px 14px;
}
.legal-card {
  max-width: 920px;
  margin: 0 auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 18px 45px rgba(0,0,0,.12);
  padding: 30px;
  line-height: 1.55;
}
.legal-card h1 { margin-top: 16px; }
.legal-card h2 { margin-top: 24px; font-size: 20px; }
.legal-card a { color: var(--brand); font-weight: 700; text-decoration: none; }
.legal-card a:hover { text-decoration: underline; }
.legal-back { display: inline-block; margin-bottom: 18px; }
.legal-brand { display: flex; gap: 16px; align-items: center; margin-bottom: 12px; }
.legal-brand img { width: 160px; height: auto; object-fit: contain; }
.legal-brand strong { font-size: 26px; color: var(--brand-dark); }
.legal-brand span { color: var(--muted); }
.legal-meta { margin-top: 32px; color: var(--muted); font-size: 13px; }
@media (max-width: 620px) {
  .legal-card { padding: 20px; border-radius: 14px; }
  .legal-brand { align-items: flex-start; flex-direction: column; }
  .legal-brand img { width: 190px; max-width: 100%; }
}
