/* =====================================================================================
   Umweltbüro – Prototyp · Gestaltung nach den Mockups vom 01.10.2026
   Schrift: Inter (selbst gehostet unter /saas/fonts) · keine externen Bibliotheken
   ===================================================================================== */

@font-face {
  font-family: "Inter";
  src: local("Inter Variable"), local("InterVariable"), local("Inter"),
       url("../fonts/InterVariable.woff2") format("woff2-variations"),
       url("../fonts/InterVariable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;

  /* Flächen und Text */
  --bg: #e8ebea;             /* Seitenhintergrund (hellgrau-grün) */
  --surface: #ffffff;
  --text: #22302e;
  --text-muted: #5b6866;
  --line: #d6dddb;
  --line-soft: #e8ecec;
  --hover-soft: #eef2f1;

  /* Farbdesign laut Mockup */
  --petrol: #2e6b63;         /* aktiver Haupt-/Untermenüpunkt, Primärbuttons: dunkler Hintergrund */
  --petrol-hover: #295f58;
  --petrol-deep: #1f5049;    /* Rahmen des Kontext-Hauptmenüpunkts, Produktname */
  --petrol-text: #1c4e48;    /* dunkle Schrift auf befüllten Untermenüpunkten */
  --sage: #7aa09a;           /* inaktive Hauptmenüpunkte */
  --sage-hover: #6f968f;
  --sage-ctx: #6a938c;       /* Hauptmenüpunkt, dessen Unterseite geöffnet ist */
  --lime: #c9e24e;           /* helle Schrift auf aktiven (dunklen) Flächen */
  --lime-soft: #e4efd9;      /* ausgewählte Tabellenzeile */
  --cream: #fdf2df;          /* leere Untermenüpunkte: helle Akzentfarbe */
  --green: #2f9e4a;          /* Verbindungslinie, Nummern-Kennzeichen */
  --green-line: #a9d6b1;     /* Rahmen des Displays */
  --bar-track: #d8dedc;
  --bar-petrol: #2e6b63;
  --bar-olive: #8fae3a;
  --bar-gray: #8c9896;

  --shadow-sm: 0 1px 2px rgba(20, 40, 38, .10), 0 1px 1px rgba(20, 40, 38, .04);
  --shadow-md: 0 3px 8px rgba(20, 40, 38, .14), 0 1px 2px rgba(20, 40, 38, .06);
  --shadow-lg: 0 12px 32px rgba(20, 40, 38, .20);
  --radius: 8px;
  --ease: cubic-bezier(.2, .7, .3, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.4;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "ss01";
}
body.no-scroll { overflow: hidden; }
button { font-family: inherit; }
svg { display: block; }
:focus-visible { outline: 2px solid var(--petrol); outline-offset: 2px; }

.icon-btn svg, .btn svg, .drawer-nav svg, .pop-menu svg, .menu svg {
  width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

/* ---------------- Kopfleiste ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: 56px;
  display: flex; align-items: center; gap: 4px;
  padding: 0 12px 0 10px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 3px rgba(20, 40, 38, .05);
}
.icon-btn {
  position: relative;
  width: 40px; height: 40px;
  border: 0; border-radius: 8px;
  background: transparent; color: var(--text);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--hover-soft); }
.icon-btn.hamburger svg { width: 26px; height: 26px; stroke-width: 2.6; }
.icon-btn.muted { color: #6b7876; }
.icon-btn.muted:hover { color: var(--petrol-text); }
.icon-btn.user { width: auto; padding: 0 6px 0 8px; gap: 1px; }
.icon-btn .chev { width: 16px; height: 16px; }
.icon-btn .dot {
  position: absolute; top: 9px; right: 10px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--green); box-shadow: 0 0 0 2px #fff;
}
.brand {
  display: inline-flex; align-items: center; gap: 8px;
  margin-left: 2px; padding: 6px 8px 6px 6px; border-radius: 8px;
  text-decoration: none; color: var(--petrol-deep);
  font-weight: 800; font-size: 15px; letter-spacing: .035em;
  transition: background .15s;
}
.brand:hover { background: var(--hover-soft); }
.logo { width: 24px; height: 24px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 2px; }

/* Popups in der Kopfleiste */
.popover {
  position: absolute; top: 50px; right: 12px;
  width: 320px;
  background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow-lg);
  z-index: 45;
  opacity: 0; transform: translateY(-6px) scale(.98); pointer-events: none;
  transition: opacity .16s var(--ease), transform .16s var(--ease);
}
.popover.show { opacity: 1; transform: none; pointer-events: auto; }
.pop-head {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px 8px; font-weight: 700; font-size: 13px;
}
.pop-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--green); color: #fff; font-size: 10.5px; font-weight: 700;
}
.notes { list-style: none; margin: 0; padding: 0 6px; }
.notes li {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 9px 8px; border-radius: 8px;
}
.notes li:hover { background: var(--hover-soft); }
.notes b { display: block; font-size: 12.5px; font-weight: 600; }
.notes span:not(.note-dot) { display: block; font-size: 11.5px; color: var(--text-muted); margin-top: 1px; }
.note-dot { flex: 0 0 8px; width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: var(--green); }
.pop-link {
  display: block; width: 100%;
  margin: 4px 0 0; padding: 10px 14px;
  border: 0; border-top: 1px solid var(--line-soft); border-radius: 0 0 10px 10px;
  background: none; color: var(--petrol); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.pop-link:hover { background: var(--hover-soft); }
.pop-user { display: flex; align-items: center; gap: 12px; padding: 14px 14px 12px; border-bottom: 1px solid var(--line-soft); }
.pop-user b { display: block; font-size: 13px; }
.pop-user span:not(.avatar) { display: block; font-size: 11.5px; color: var(--text-muted); }
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--petrol); color: var(--lime); font-weight: 700; font-size: 13px;
}
.pop-menu { list-style: none; margin: 0; padding: 6px; }
.pop-menu button {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 10px; border: 0; border-radius: 8px;
  background: none; color: var(--text); font: inherit; font-size: 12.5px; font-weight: 500; cursor: pointer; text-align: left;
}
.pop-menu button:hover { background: var(--hover-soft); }
.pop-menu svg { width: 18px; height: 18px; color: #6b7876; }

/* ---------------- Hamburger-Menü ---------------- */
.overlay {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(20, 40, 38, .38);
  opacity: 0; pointer-events: none;
  transition: opacity .2s;
}
.overlay.show { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 50;
  width: 284px; max-width: 86vw;
  display: flex; flex-direction: column;
  background: var(--surface);
  box-shadow: 0 0 40px rgba(20, 40, 38, .25);
  transform: translateX(-100%);
  transition: transform .22s var(--ease);
}
.drawer.open { transform: none; }
.drawer-head {
  height: 56px; flex: 0 0 56px;
  display: flex; align-items: center; gap: 8px;
  padding: 0 8px 0 16px;
  border-bottom: 1px solid var(--line);
}
.drawer-head .brand-text { font-weight: 800; font-size: 15px; letter-spacing: .035em; color: var(--petrol-deep); flex: 1; }
.drawer-nav { list-style: none; margin: 0; padding: 10px 8px; flex: 1; }
.drawer-nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; margin-bottom: 2px; border-radius: 8px;
  color: var(--text); text-decoration: none; font-size: 13.5px; font-weight: 500;
  transition: background .15s, color .15s;
}
.drawer-nav a:hover { background: var(--hover-soft); }
.drawer-nav a.current { background: var(--petrol); color: var(--lime); }
.drawer-nav a.current svg { color: var(--lime); }
.drawer-nav svg { width: 20px; height: 20px; color: #6b7876; }
.drawer-foot { padding: 12px 20px; border-top: 1px solid var(--line-soft); font-size: 11px; color: var(--text-muted); }

/* ---------------- Seite ---------------- */
.page { max-width: 1360px; margin: 0 auto; padding: 14px 20px 48px; }

/* Navigationsbereich: links Hauptmenü, rechts Display über Untermenü */
.nav-area {
  position: sticky; top: 56px; z-index: 25; background: var(--bg); padding-bottom: 8px; /* bleibt beim Scrollen stehen – nur der Inhalt darunter scrollt */
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 16px;
  row-gap: 12px;
  padding-top: 2px;
}
.connector {
  position: absolute; inset: 0; z-index: 3;
  width: 100%; height: 100%;
  overflow: visible; pointer-events: none;
}
.connector path { fill: none; stroke: var(--green); stroke-width: 1.5; stroke-linejoin: round; }
.connector path.head { fill: var(--green); stroke: none; transition: opacity .2s; }
.display { grid-column: 2; grid-row: 1; }
.main-menu { grid-column: 1; grid-row: 2; display: flex; gap: 8px; align-items: stretch; }
.sub-menu { grid-column: 2; grid-row: 2; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }

/* Hauptmenüpunkt: Hintergrund · Rahmen · Schriftfarbe je Zustand */
.main-item {
  position: relative;
  width: 96px; height: 68px; min-height: 0; overflow: hidden; /* feste Höhe: die nav-area ist auf allen Seiten 00–03 gleich groß (Rückmeldung 08.10.2026) */
  padding: 8px 10px;
  border: 2px solid transparent; border-radius: var(--radius);
  background: var(--sage); color: #fff;
  text-align: left; cursor: pointer;
  display: flex; flex-direction: column; gap: 3px;
  box-shadow: var(--shadow-sm);
  transition: background .18s var(--ease), box-shadow .18s, transform .18s var(--ease), border-color .18s, color .18s;
}
.main-item .num { font-size: 21px; font-weight: 700; line-height: 1; letter-spacing: -.02em; }
.main-item .lbl { font-size: 11px; font-weight: 600; line-height: 1.15; }
.main-item:hover { background: var(--sage-hover); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.main-item.active { background: var(--petrol); color: var(--lime); box-shadow: var(--shadow-md); }
.main-item.active:hover { background: var(--petrol-hover); }
.main-item.context { background: var(--sage-ctx); border-color: var(--petrol-deep); color: #fff; box-shadow: var(--shadow-md); }
.main-item.context:hover { background: #628b84; }

/* Untermenüpunkt: aktiv = dunkel/hell · befüllt = weiß/dunkel · leer = helle Akzentfarbe/dunkel */
.sub-item {
  position: relative;
  height: 68px; min-height: 0; overflow: hidden;
  padding: 8px 10px;
  border: 0; border-radius: var(--radius);
  background: var(--surface); color: var(--petrol-text);
  text-align: left; cursor: pointer;
  display: flex; flex-direction: column; gap: 3px;
  box-shadow: var(--shadow-sm);
  transition: background .18s var(--ease), box-shadow .18s, transform .18s var(--ease), color .18s;
}
.sub-item .ltr { font-size: 17px; font-weight: 700; line-height: 1; }
.sub-item .lbl { font-size: 10.5px; font-weight: 700; line-height: 1.2; hyphens: manual; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sub-item.empty { background: var(--cream); }
.sub-item.filled:hover { background: #f7faf9; }
.sub-item.empty:hover { background: #fbeccf; }
.sub-item:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.sub-item.active { background: var(--petrol); color: var(--lime); box-shadow: var(--shadow-md); }
.sub-item.active:hover { background: var(--petrol-hover); }

/* Display: Informationen zum gewählten Hauptmenüpunkt bzw. Datensatz */
.display {
  height: 56px; min-height: 0; /* feste Höhe – Titel und Kennzeilen werden gekürzt statt umbrochen */
  padding: 6px 12px;
  border: 1px solid var(--green-line); border-radius: 6px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; justify-content: center; gap: 1px;
  min-width: 0;
}
.display .d-title { font-weight: 700; font-size: 13px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.display .d-meta { display: flex; flex-wrap: nowrap; gap: 2px 28px; font-size: 12px; line-height: 1.3; min-width: 0; overflow: hidden; white-space: nowrap; }
.display .d-meta span { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.display.placeholder .d-title, .display.placeholder .d-meta { color: #6a7775; }
.display.flash { animation: flash .7s var(--ease); }
@keyframes flash { 0% { background: var(--lime-soft); border-color: var(--green); } 100% { background: var(--surface); border-color: var(--green-line); } }

/* Seitenüberschrift */
.page-head { margin: 14px 0 0; }
.crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; min-height: 24px; }
.badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 24px; height: 17px; padding: 0 5px; border-radius: 3px;
  background: var(--green); color: #fff;
  font-size: 10.5px; font-weight: 700; letter-spacing: .02em;
}
.badge.sub { background: var(--petrol); }
.crumbs .sep { color: #7a8785; font-size: 14px; }
.crumbs h1 { margin: 0 0 0 6px; font-size: 19px; font-weight: 700; line-height: 1.2; letter-spacing: -.01em; }
.hint { margin: 3px 0 0; font-size: 11px; color: var(--text-muted); max-width: 860px; }

/* Seiteninhalt */
.content { margin-top: 10px; }
.content.enter { animation: rise .25s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
.search { position: relative; flex: 0 1 260px; min-width: 180px; }
.search svg {
  position: absolute; left: 9px; top: 50%; width: 15px; height: 15px; transform: translateY(-50%);
  color: #7a8785; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; pointer-events: none;
}
.search input {
  width: 100%; height: 30px;
  padding: 0 10px 0 30px;
  border: 1px solid #c3cdcb; border-radius: 6px;
  background: var(--surface); color: var(--text);
  font: inherit; font-size: 12px;
  transition: border-color .15s, box-shadow .15s;
}
.search input::placeholder { color: #8a9694; }
.search input:focus { outline: none; border-color: var(--petrol); box-shadow: 0 0 0 3px rgba(46, 107, 99, .15); }
.btn {
  height: 30px; padding: 0 14px;
  border: 1px solid #c3cdcb; border-radius: 6px;
  background: var(--surface); color: var(--text);
  font: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .15s;
}
.btn:hover { background: #f4f7f6; border-color: #a9b6b3; }
.btn:active { transform: translateY(1px); }
.btn svg { width: 15px; height: 15px; }
.btn.primary { background: var(--petrol); border-color: var(--petrol); color: #fff; box-shadow: var(--shadow-sm); }
.btn.primary:hover { background: var(--petrol-hover); border-color: var(--petrol-hover); }
.btn.icon { width: 30px; padding: 0; justify-content: center; }
.btn.icon svg { width: 18px; height: 18px; }
.btn.has-filter { border-color: var(--petrol); color: var(--petrol-text); background: #eef4f3; }
.spacer { flex: 1 1 auto; }
.count { font-size: 11px; color: var(--text-muted); white-space: nowrap; }

.menu-wrap { position: relative; }
.menu {
  position: absolute; top: 36px; left: 0; z-index: 20;
  min-width: 210px; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(-4px); pointer-events: none;
  transition: opacity .14s var(--ease), transform .14s var(--ease);
}
.menu.right { left: auto; right: 0; }
.menu.show { opacity: 1; transform: none; pointer-events: auto; }
.menu .menu-title { padding: 6px 8px 4px; font-size: 10.5px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; }
.menu label, .menu button {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 7px 8px; border: 0; border-radius: 6px;
  background: none; color: var(--text); font: inherit; font-size: 12px; cursor: pointer; text-align: left; white-space: nowrap;
}
.menu label:hover, .menu button:hover { background: var(--hover-soft); }
.menu svg { width: 16px; height: 16px; color: #6b7876; }
.menu hr { border: 0; border-top: 1px solid var(--line-soft); margin: 4px 0; }

.table-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; min-width: 700px; border-collapse: collapse; font-size: 12px; }
thead th {
  background: #e9edec; color: #3a4644;
  font-weight: 500; font-size: 11.5px; text-align: left;
  padding: 9px 12px; white-space: nowrap;
}
thead th:first-child, tbody td:first-child { width: 40px; padding-right: 0; }
tbody td { padding: 11px 12px; border-top: 1px solid var(--line-soft); vertical-align: middle; }
tbody tr { cursor: pointer; transition: background .12s; }
tbody tr:hover { background: #f3f6f5; }
tbody tr.selected { background: var(--lime-soft); }
tbody tr.selected td { font-weight: 700; }
tbody tr:focus-visible { outline: 2px solid var(--petrol); outline-offset: -2px; }
td.name { max-width: 340px; }
input[type="checkbox"] { width: 15px; height: 15px; margin: 0; accent-color: var(--petrol); cursor: pointer; vertical-align: middle; }
.bar { width: 92px; height: 7px; border-radius: 4px; background: var(--bar-track); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 4px; background: var(--bar-petrol); width: 0; transition: width .5s var(--ease); }
.bar.olive i { background: var(--bar-olive); }
.bar.gray i { background: var(--bar-gray); }
.bar-cell { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.bar-cell small { color: var(--text-muted); font-size: 10.5px; font-weight: 500; min-width: 30px; }
tr.selected .bar-cell small { font-weight: 700; }
.empty-row td { text-align: center; color: var(--text-muted); padding: 28px 12px; cursor: default; }

.placeholder-area {
  min-height: 280px;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px dashed #c3cdcb; border-radius: var(--radius);
  background: rgba(255, 255, 255, .4);
  color: #8a9694; font-size: 12px; text-align: center; padding: 20px;
}

/* Hinweis */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 60;
  max-width: calc(100vw - 32px);
  padding: 10px 16px; border-radius: 8px;
  background: #22302e; color: #fff; font-size: 12.5px;
  box-shadow: var(--shadow-lg);
  opacity: 0; transform: translate(-50%, 12px); pointer-events: none;
  transition: opacity .2s var(--ease), transform .2s var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------------- Responsiv ---------------- */
@media (max-width: 1023px) {
  .nav-area { position: relative; top: auto; }
  .page { padding: 12px 16px 36px; }
  .nav-area { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto auto; }
  .display { grid-column: 1; grid-row: 1; margin-bottom: 10px; }
  .main-menu { grid-column: 1; grid-row: 2; }
  .sub-menu { grid-column: 1; grid-row: 3; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .main-item { width: auto; flex: 0 1 124px; }
  .display { height: 56px; }
}
@media (max-width: 599px) {
  .page { padding: 10px 16px 28px; }
  .topbar { padding: 0 8px 0 4px; }
  .brand { font-size: 14px; }
  .main-menu { gap: 6px; }
  .main-item { flex: 1 1 0; height: 60px; padding: 7px 8px; }
  .main-item .num { font-size: 19px; }
  .sub-menu { gap: 6px; }
  .sub-item { height: 60px; padding: 7px 8px; }
  .sub-item .ltr { font-size: 16px; }
  .search { flex: 1 1 100%; }
  .popover { left: 8px; right: 8px; width: auto; }
  .crumbs h1 { font-size: 17px; }
  table { min-width: 600px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
