/* TerraGrid Web — Design-Tokens im Erscheinungsbild der Dein BrandSchutz GmbH.
   Farben und Schriften wie UnitPlan (Branch dbs-lager), damit beide Systeme des
   Auftraggebers gleich aussehen (Sergey, 2026-11-02; DECISIONS.md DEC-0002):
   Anthrazit #222222, Signalorange #eb7223 / #c95a12, Lato für Text, Teko für
   Titel. Die Schriften liegen auf dem eigenen Server (fonts/, Lizenz SIL OFL 1.1
   in fonts/OFL.txt), nie bei einem Schriftendienst. Diese Datei gehört der
   Shell; Komponenten bringen ihre Styles selbst mit (injectStyles) und nutzen
   nur die Variablen und die gemeinsamen Primitive aus Abschnitt „Primitive“. */
@font-face { font-family: "Lato"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/lato-400.woff2") format("woff2"); }
@font-face { font-family: "Lato"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/lato-700.woff2") format("woff2"); }
@font-face { font-family: "Teko"; font-style: normal; font-weight: 300 700; font-display: swap; src: url("fonts/teko-variable.woff2") format("woff2"); }
:root {
  --tg-anthracite:      #222222;
  --tg-anthracite-soft: #2e2e2e;
  --tg-anthracite-line: #4a4a4a;
  --tg-signal:          #eb7223;
  --tg-signal-strong:   #c95a12;
  --tg-signal-soft:     rgba(235, 114, 35, .14);

  --tg-page:    #f4f5f7;
  --tg-card:    #ffffff;
  --tg-border:  #e2e5ea;
  --tg-ink:     #1d2127;
  --tg-ink-dim: #6b7280;
  --tg-ink-inv: #e7e9ee;
  --tg-danger:  #b91c1c;
  --tg-ok:      #15803d;

  --tg-radius:  10px;
  --tg-gap:     16px;
  --tg-shadow:  0 2px 10px rgba(20, 24, 31, .08);
  --tg-shadow-pop: 0 10px 30px rgba(20, 24, 31, .22);
  --tg-font:    "Lato", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --tg-font-display: "Teko", "Lato", sans-serif;

  --tg-open:    #eb7223;
  --tg-done:    #22c55e;

  /* Layout metrics: topbar, sidebar width, bottom-nav height, touch target. */
  --tg-topbar:    64px;
  --tg-sidebar:   232px;
  --tg-bottomnav: 60px;
  --tg-touch:     44px;
  --tg-breakpoint: 900px;
}

/* The bundled Lato/Teko files cover basic Latin only (no ą ł ę, no Cyrillic;
   Teko has no Cyrillic at all). Russian and Polish therefore use the device's
   system font throughout, so no page mixes two fonts. The brand name stays Teko. */
:root:lang(ru), :root:lang(pl) {
  --tg-font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --tg-font-display: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
}
:root:lang(ru) .tg-public-card h1, :root:lang(pl) .tg-public-card h1 { font-size: 32px; font-weight: 800; letter-spacing: .3px; }

/* Dark theme (moon in the topbar, lib/theme.js): the anthracite topbar and the
   signal orange stay; page, cards, lines and text turn dark. The plan sheet,
   photos and the signature pad keep their white paper on purpose. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --tg-page:    #15171a;
  --tg-card:    #202328;
  --tg-border:  #363b44;
  --tg-ink:     #e7e9ee;
  --tg-ink-dim: #9aa3af;
  --tg-danger:  #f87171;
  --tg-signal-soft: rgba(235, 114, 35, .22);
  --tg-shadow:  0 2px 10px rgba(0, 0, 0, .45);
  --tg-shadow-pop: 0 10px 30px rgba(0, 0, 0, .6);
}
:root[data-theme="dark"] .tg-public { background: linear-gradient(135deg, #1b1d21 0%, #101113 100%); }
:root[data-theme="dark"] .tg-public-card h1, :root[data-theme="dark"] .tg-title { color: var(--tg-ink); }
:root[data-theme="dark"] .tg-app-link { background: rgba(235, 114, 35, .12); color: var(--tg-ink); }
:root[data-theme="dark"] .tg-app-link:hover { background: rgba(235, 114, 35, .2); }
:root[data-theme="dark"] .tg-app-link small, :root[data-theme="dark"] .tg-public__footer { color: var(--tg-ink-dim); }
:root[data-theme="dark"] .tg-public-card .tg-field input { background: var(--tg-page); border-color: var(--tg-border); }
:root[data-theme="dark"] .tg-pw__eye { color: var(--tg-ink-dim); }

* { box-sizing: border-box; }
/* Form controls do not inherit the font by default; keep Lato everywhere. */
button, input, select, textarea { font-family: inherit; }

html, body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--tg-font);
  color: var(--tg-ink);
  background: var(--tg-page);
}

/* ===========================================================================
   Login (tg-login, login.html) and the public pages (Hilfe, Installieren,
   Impressum, Datenschutz): topbar with the company logo, a card with an
   orange top edge, the product name in Teko.
   =========================================================================== */

.tg-topbar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 12px;
  /* Exactly --tg-topbar tall (border-box) so the sticky sidebar and the
     viewer page can be sized against the variable (2026-10-20). */
  height: var(--tg-topbar);
  min-height: var(--tg-topbar);
  padding: 8px 16px;
  color: var(--tg-ink-inv);
  background: var(--tg-anthracite);
  border-bottom: 3px solid var(--tg-signal);
}
.tg-brand {
  display: inline-flex; align-items: center; gap: 12px;
  color: #fff; text-decoration: none; min-width: 0;
}
.tg-brand__logo { height: 44px; width: auto; display: block; }
.tg-brand__name {
  font-family: "Teko", "Lato", sans-serif;   /* Latin only, so Teko in every language */ font-size: 26px; font-weight: 500; line-height: 1;
  letter-spacing: .5px; text-transform: uppercase; white-space: nowrap; padding-top: 4px;
}
@media (max-width: 600px) { .tg-topbar--public .tg-brand__name { display: none; } }
/* The app topbar is crowded (project switcher, search, bell …): name only on wide screens. */
@media (max-width: 1279px) { .tg-topbar:not(.tg-topbar--public) .tg-brand__name { display: none; } }
.tg-topbar:not(.tg-topbar--public) .tg-brand__logo { height: 40px; }

/* Round "?" in the topbar: help for the page (as on the UnitPlan sign-in). */
.tg-help-round {
  display: inline-grid; place-items: center; flex: none;
  width: 36px; height: 36px; margin-left: auto;
  border: 2px solid #fff; border-radius: 50%;
  color: #fff; font-weight: 700; font-size: 18px; text-decoration: none;
}
.tg-help-round:hover, .tg-help-round:focus-visible { background: var(--tg-signal); border-color: var(--tg-signal); outline: none; }

.tg-public {
  min-height: calc(100vh - var(--tg-topbar));
  display: flex; flex-direction: column; align-items: center;
  padding: 48px var(--tg-gap) 16px;
  background: linear-gradient(135deg, #f7f7f7 0%, #e8e8e8 100%);
}
@media (max-width: 600px) { .tg-public { padding-top: 16px; } }

/* Legacy card primitive (the task board's cards build on it); unchanged. */
.tg-card {
  width: min(380px, 100%);
  background: var(--tg-card);
  border: 1px solid var(--tg-border);
  border-radius: var(--tg-radius);
  box-shadow: var(--tg-shadow);
  padding: 24px;
}

.tg-public-card {
  width: min(420px, 100%);
  background: var(--tg-card);
  border-top: 4px solid var(--tg-signal);
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(34, 34, 34, .10), 0 1px 4px rgba(0, 0, 0, .06);
  padding: 32px 40px;
}
.tg-public-card--wide { width: min(760px, 100%); }
@media (max-width: 600px) { .tg-public-card { padding: 24px; } }
.tg-public-card h1, .tg-title {
  margin: 0; font-family: var(--tg-font-display); font-size: 44px; font-weight: 500;
  line-height: 1.05; text-transform: uppercase; text-align: center; color: var(--tg-anthracite);
}
.tg-public-card p.tg-sub { margin: 4px 0 24px; text-align: center; color: var(--tg-ink-dim); font-size: 16px; }
.tg-public-card h2 { margin: 24px 0 8px; font-size: 18px; color: var(--tg-signal); }
.tg-public-card p, .tg-public-card li { line-height: 1.55; }

.tg-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.tg-field label { font-size: 14px; font-weight: 700; color: var(--tg-ink); }
.tg-field input, .tg-field select, .tg-field textarea {
  padding: 10px 12px;
  font: inherit;
  font-size: 15px;
  border: 1px solid var(--tg-border);
  border-radius: 8px;
  background: var(--tg-card);
  color: var(--tg-ink);
}
.tg-public-card .tg-field input { min-height: 48px; font-size: 16px; background: #fafafa; border-color: #d1d5db; }
.tg-field input:focus, .tg-field select:focus, .tg-field textarea:focus {
  outline: none;
  border-color: var(--tg-signal);
  box-shadow: 0 0 0 3px var(--tg-signal-soft);
}

/* Password with the eye and the Caps Lock hint. */
.tg-pw { position: relative; display: flex; }
.tg-pw input { flex: 1 1 auto; width: 100%; padding-right: 52px; }
.tg-pw__eye {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px; display: grid; place-items: center;
  border: none; background: transparent; cursor: pointer; border-radius: 8px; color: #555;
}
.tg-pw__eye svg { width: 22px; height: 22px; fill: currentColor; }
.tg-pw__eye[aria-pressed="true"] { color: var(--tg-signal); }
.tg-pw__eye:focus-visible { outline: 2px solid var(--tg-signal); }
.tg-pw__caps { margin: 2px 0 0; font-size: 13px; font-weight: 700; color: var(--tg-danger); }
.tg-login__forgot { display: block; margin: -10px 0 18px auto; padding: 0; border: none; background: none;
  font: inherit; font-size: 14px; color: var(--tg-ink); cursor: pointer; text-decoration: underline; }
.tg-login__forgot-text { margin: -10px 0 18px; padding: 10px 12px; font-size: 14px; border-radius: 8px;
  background: var(--tg-signal-soft); }

.tg-btn {
  width: 100%;
  min-height: 48px;
  padding: 11px 14px;
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--tg-signal) 0%, var(--tg-signal-strong) 100%);
  border: none;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(235, 114, 35, .3);
  cursor: pointer;
}
.tg-btn:hover { filter: brightness(1.05); box-shadow: 0 4px 12px rgba(235, 114, 35, .4); }
.tg-btn[disabled] { opacity: .6; cursor: wait; }
.tg-btn[hidden] { display: none; }

.tg-error {
  margin-top: 12px;
  min-height: 18px;
  font-size: 14px;
  color: var(--tg-danger);
}

/* Link cards below the form (Tablet-App, as the app cards on the UnitPlan sign-in). */
.tg-app-link {
  display: flex; align-items: center; gap: 12px; margin-top: 20px; padding: 12px 14px;
  border: 1px solid rgba(235, 114, 35, .35); border-radius: 10px; background: #fff7f1;
  color: var(--tg-anthracite); text-decoration: none; line-height: 1.3;
}
.tg-app-link:hover, .tg-app-link:focus-visible { background: #ffeee2; border-color: var(--tg-signal); outline: none; }
.tg-app-link strong { display: block; color: var(--tg-signal); font-size: 16px; }
.tg-app-link small { display: block; color: #666; font-size: 14px; }
.tg-app-link svg { width: 34px; height: 34px; flex: none; fill: var(--tg-signal); }

.tg-public__footer { margin-top: auto; padding: 24px 0 8px; font-size: 13px; color: #666; text-align: center; }
.tg-public__footer a { color: inherit; }
.tg-dev-note { margin: 16px 0; padding: 12px 14px; border-left: 4px solid var(--tg-signal);
  background: var(--tg-signal-soft); border-radius: 8px; font-weight: 700; }
.tg-qr { display: block; width: 220px; height: 220px; margin: 8px auto; }

/* ===========================================================================
   App shell: topbar + navigation + content, full height on every level.
   Mobile-first: bottom navigation by default; the desktop sidebar switches
   on at --tg-breakpoint. Custom elements render into light DOM.
   =========================================================================== */

tg-app { display: flex; flex-direction: column; min-height: 100vh; }
tg-nav { display: contents; }

.tg-topbar .tg-brand { flex: 0 0 auto; }
.tg-topbar .tg-topbar__spacer { flex: 1 1 auto; min-width: 0; }
.tg-topbar .tg-logout {
  min-height: var(--tg-touch);
  padding: 8px 14px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--tg-ink-inv);
  background: var(--tg-anthracite-soft);
  border: 1px solid var(--tg-anthracite-line);
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
}
.tg-topbar .tg-logout:hover { border-color: var(--tg-signal); }
@media (max-width: 899px) {
  .tg-topbar { padding: 8px 10px; gap: 6px; overflow: hidden; }
  .tg-topbar .tg-logout { padding: 8px 8px; font-size: 13px; }
  /* Below the sidebar breakpoint the bottom bar is the navigation (no ☰). */
  .tg-topbar #tg-nav-toggle { display: none; }
  .tg-switcher__btn { max-width: 30vw; padding: 6px 8px; font-size: 14px; }
  .tg-gsearch { flex: 1 1 60px; min-width: 60px; }
  .tg-iconbtn { width: 40px; height: 40px; }
  .tg-nav--bottom { max-width: 100vw; }
}

/* Topbar icon buttons (☰, bell, help, flag), the account link and the name. */
.tg-iconbtn {
  display: inline-flex; align-items: center; justify-content: center;
  width: var(--tg-touch); height: var(--tg-touch); flex: 0 0 auto;
  font: inherit; font-size: 18px; color: var(--tg-ink-inv);
  background: var(--tg-anthracite-soft); border: 1px solid var(--tg-anthracite-line);
  border-radius: 8px; cursor: pointer;
}
.tg-iconbtn:hover, .tg-iconbtn[aria-pressed="true"] { border-color: var(--tg-signal); }
/* Topbar icons flat and white as in UnitPlan: no box, a soft circle on hover. */
.tg-topbar .tg-iconbtn { background: transparent; border: none; border-radius: 50%; color: #fff; }
.tg-topbar .tg-iconbtn:hover, .tg-topbar .tg-iconbtn[aria-pressed="true"] { background: rgba(255, 255, 255, .12); }
.tg-topbar .tg-iconbtn svg { width: 28px; height: 28px; fill: currentColor; }
/* Help "?" as a white ring, like on the sign-in page; hidden only on phones. */
.tg-topbar #tg-help { width: 30px; height: 30px; margin: 0 7px; border: 2px solid #fff; font-weight: 700; font-size: 16px; }
.tg-topbar #tg-help:hover { background: var(--tg-signal); border-color: var(--tg-signal); }
.tg-user { position: relative; flex: 0 0 auto; }
/* Fixed to the window: the topbar clips its overflow on narrow screens. */
.tg-user .tg-user__menu { display: none; position: fixed; right: 8px; top: calc(var(--tg-topbar) + 4px); min-width: 220px; }
.tg-user[open] .tg-user__menu { display: block; }
/* Phones: the topbar keeps brand, project, search, bell, flag and the person; gear and theme
   move into the person menu, the search field shrinks to what is left. */
.tg-user__narrow { display: none; }
@media (max-width: 599px) {
  .tg-topbar #tg-theme, .tg-topbar #tg-gear { display: none; }
  .tg-user__narrow { display: flex; }
  .tg-topbar .tg-brand__logo { height: 34px; }
  /* The search is a magnifier-sized field; tapped, it grows over the project name. */
  .tg-topbar .tg-gsearch { flex: 0 0 44px; min-width: 44px; margin: 0; }
  .tg-topbar .tg-gsearch:focus-within { flex-basis: 150px; }
  .tg-topbar .tg-gsearch .tg-gsearch__input { padding-left: 34px; font-size: 16px; min-width: 0; width: 100%; }
  .tg-topbar .tg-gsearch__icon { left: 11px; }
  .tg-topbar .tg-gsearch .tg-gsearch__input::placeholder { color: transparent; }
  /* The project name takes what is left and ends with "…" instead of overflowing. */
  .tg-topbar .tg-switcher { flex: 1 1 auto; min-width: 0; }
  .tg-topbar .tg-switcher__btn { max-width: 100%; overflow: hidden; }
  .tg-topbar .tg-switcher__btn > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
}
a.tg-menu__item { text-decoration: none; }
/* Same for the language menu: fixed, so the clipping topbar cannot hide it. */
.tg-lang .tg-lang__menu { position: fixed; right: 56px; top: calc(var(--tg-topbar) + 4px); }
.tg-user__name { padding: 8px 14px 4px; font-weight: 700; font-size: 14px; white-space: nowrap; }
@media (max-width: 599px) { .tg-topbar #tg-help { display: none; } }
.tg-topbar__link {
  display: none; color: var(--tg-ink-inv); text-decoration: none; font-size: 14px; white-space: nowrap;
  padding: 8px 10px; border-radius: 8px;
}
.tg-topbar__link:hover { background: var(--tg-anthracite-soft); }
.tg-topbar__who { display: none; font-size: 14px; font-weight: 600; white-space: nowrap; }
@media (min-width: 900px) {
  .tg-topbar__link, .tg-topbar__who { display: inline; }
}
.tg-lang { position: relative; flex: 0 0 auto; }
.tg-lang__btn { font-size: 20px; }
.tg-lang__menu { display: none; right: 0; top: calc(100% + 6px); min-width: 160px; }
.tg-lang[open] .tg-lang__menu { display: block; }
.tg-lang__menu .tg-menu__item[aria-current="true"] { font-weight: 700; color: var(--tg-signal-strong); }

/* Global search with a result dropdown (project level) */
/* Centred search like the UnitPlan topbar: white field, magnifier inside. */
.tg-gsearch { position: relative; flex: 1 1 auto; min-width: 0; max-width: 560px; margin: 0 auto; }
.tg-gsearch .tg-gsearch__input { width: 100%; min-width: 0; padding-left: 44px; min-height: 40px; border-radius: 6px; border: none; }
.tg-gsearch__icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 22px; height: 22px;
  fill: #666; pointer-events: none; }
.tg-gsearch__menu {
  display: none; position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 50;
  max-height: 60vh; overflow: auto; padding: 6px 0;
  color: var(--tg-ink); background: var(--tg-card); border: 1px solid var(--tg-border);
  border-radius: var(--tg-radius); box-shadow: var(--tg-shadow-pop);
}
.tg-gsearch[open] .tg-gsearch__menu { display: block; }
.tg-gsearch__group {
  margin: 6px 12px 2px; font-size: 11px; text-transform: uppercase; letter-spacing: .4px;
  color: var(--tg-ink-dim);
}
.tg-gsearch__sub { color: var(--tg-ink-dim); font-size: 12px; margin-left: 6px; }
.tg-gsearch__hint { margin: 8px 12px; font-size: 13px; color: var(--tg-ink-dim); }

/* Project switcher (SCR-002): the current project's name as a menu button. */
.tg-switcher { position: relative; flex: 0 1 auto; min-width: 0; }
.tg-switcher__btn {
  display: flex; align-items: center; gap: 8px;
  max-width: min(44vw, 360px); min-height: var(--tg-touch);
  padding: 6px 12px; font: inherit; font-size: 15px; font-weight: 600;
  color: var(--tg-ink-inv); background: var(--tg-anthracite-soft);
  border: 1px solid var(--tg-anthracite-line); border-radius: 8px; cursor: pointer;
}
.tg-switcher__btn:hover { border-color: var(--tg-signal); }
.tg-switcher__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tg-switcher__caret { font-size: 11px; opacity: .8; }
.tg-switcher__menu {
  display: none; position: absolute; left: 0; top: calc(100% + 6px); z-index: 50;
  width: min(360px, 92vw); max-height: 70vh; overflow: auto;
  color: var(--tg-ink); background: var(--tg-card);
  border: 1px solid var(--tg-border); border-radius: var(--tg-radius);
  box-shadow: var(--tg-shadow-pop);
}
.tg-switcher[open] .tg-switcher__menu { display: block; }
.tg-switcher__search { margin: 10px; width: calc(100% - 20px); }
.tg-switcher__section {
  margin: 4px 12px; font-size: 11px; text-transform: uppercase; letter-spacing: .4px;
  color: var(--tg-ink-dim);
}
.tg-switcher__item {
  display: flex; width: 100%; align-items: center; gap: 8px;
  min-height: var(--tg-touch); padding: 8px 12px; font: inherit; font-size: 14px;
  text-align: left; color: var(--tg-ink); background: transparent; border: none; cursor: pointer;
}
.tg-switcher__item:hover { background: var(--tg-page); }
.tg-switcher__item[aria-current="true"] { font-weight: 700; color: var(--tg-signal-strong); }
.tg-switcher__item.is-primary { color: var(--tg-signal-strong); font-weight: 600; }
.tg-switcher__sep { height: 1px; margin: 4px 0; background: var(--tg-border); }

/* Account-level tabs (SCR-028/029/031): a horizontal tab strip under the topbar. */
.tg-tabs {
  display: flex; gap: 4px; padding: 0 var(--tg-gap);
  overflow-x: auto; background: var(--tg-card); border-bottom: 1px solid var(--tg-border);
}
.tg-tabs .tg-nav__item {
  color: var(--tg-ink-dim); border-radius: 0; border-bottom: 3px solid transparent;
  padding: 12px 14px; white-space: nowrap;
}
.tg-tabs .tg-nav__item[aria-current="page"] {
  color: var(--tg-ink); background: transparent; border-bottom-color: var(--tg-signal);
}

/* Body: sidebar + content fill the rest of the viewport. */
.tg-body { display: flex; flex: 1 1 auto; min-height: 0; }
.tg-content {
  display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0;
  padding: var(--tg-gap);
  padding-bottom: calc(var(--tg-bottomnav) + var(--tg-gap) + env(safe-area-inset-bottom, 0px));
}
.tg-content > * { min-width: 0; }
/* A view that wants the whole height (plan viewer) sets .tg-content--fill. */
.tg-content--fill { padding: 0; }
.tg-content--fill > * { flex: 1 1 auto; min-height: 0; }

/* --- navigation: shared item look ---------------------------------------- */

.tg-nav__item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--tg-touch);
  min-width: var(--tg-touch);
  padding: 10px 12px;
  font: inherit;
  font-size: 14px;
  color: var(--tg-ink-inv);
  text-decoration: none;
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}
.tg-nav__item .tg-nav__icon { width: 20px; text-align: center; font-size: 17px; line-height: 1; }
.tg-nav__item .tg-nav__badge {
  margin-left: auto; min-width: 20px; padding: 1px 6px; font-size: 11px; font-weight: 700;
  text-align: center; color: #fff; background: var(--tg-signal); border-radius: 999px;
}
.tg-nav__item[aria-current="page"] {
  background: var(--tg-signal);
  color: #fff;
  font-weight: 600;
}
.tg-nav__group {
  margin: 14px 12px 4px; font-size: 11px; font-weight: 300; letter-spacing: .6px; text-transform: uppercase;
  color: rgba(231, 233, 238, .6);
}
.tg-nav__sub { margin: 8px 12px 2px; font-size: 13px; font-weight: 700; color: var(--tg-ink-inv); }
.tg-nav__count {
  margin-left: auto; min-width: 18px; font-size: 12px; text-align: right; color: rgba(231, 233, 238, .7);
}
.tg-nav__item[aria-current="page"] .tg-nav__count { color: #fff; }
.tg-nav__abbrev {
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
  width: 22px; height: 18px; font-size: 10px; font-weight: 700; letter-spacing: .3px;
  color: var(--tg-ink-inv); background: var(--tg-anthracite-line); border-radius: 4px;
}
.tg-nav__item--cat { min-height: 36px; padding: 6px 12px; font-size: 13px; }
/* Fold-out task lists in the sidebar (Projektmanagement / Aufgaben) */
.tg-nav__acc-btn { width: 100%; text-align: left; }
.tg-nav__acc--cat .tg-nav__acc-btn { min-height: 36px; padding: 6px 12px; font-size: 13px; }
.tg-nav__acc--cat .tg-nav__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tg-nav__caret { margin-left: 4px; font-size: 11px; opacity: .7; transition: transform .15s; }
.tg-nav__acc-btn[aria-expanded="true"] .tg-nav__caret { transform: rotate(90deg); }
.tg-nav__tasklist {
  list-style: none; margin: 2px 0 6px; padding: 0 0 0 10px; max-height: 40vh; overflow-y: auto;
  border-left: 2px solid var(--tg-anthracite-line);
}
.tg-nav__tasklist[hidden] { display: none; }
/* Projekt-Schnellwechsler oben in der Seitenleiste (2026-10-20) */
.tg-nav__projects { margin-bottom: 4px; }
.tg-nav__projects-label { margin-top: 2px; }
.tg-nav__project-btn { width: 100%; text-align: left; font-weight: 700; }
.tg-nav__project-btn[aria-expanded="true"] .tg-nav__caret { transform: rotate(90deg); }
.tg-nav__project-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tg-nav__project-list { max-height: 30vh; }
.tg-nav__project-item {
  display: flex; align-items: center; gap: 8px; min-height: 34px; padding: 6px 10px; font-size: 13px;
  color: var(--tg-ink-inv); text-decoration: none; border-radius: 8px;
}
.tg-nav__project-item:hover { background: var(--tg-anthracite-soft); }
.tg-nav__project-item .tg-nav__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tg-nav__project-code { margin-left: auto; font-size: 11px; font-weight: 700; color: rgba(231, 233, 238, .6); }
.tg-nav__task {
  display: flex; align-items: center; gap: 8px; width: 100%; min-height: 34px;
  padding: 6px 8px; font: inherit; font-size: 13px; text-align: left;
  color: var(--tg-ink-inv); background: transparent; border: none; border-radius: 6px; cursor: pointer;
}
.tg-nav__task:hover { background: var(--tg-anthracite-soft); }
.tg-nav__dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.tg-nav__task-no { color: rgba(231, 233, 238, .6); flex: 0 0 auto; }
.tg-nav__task-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tg-nav__task-note { padding: 6px 10px; font-size: 12px; color: rgba(231, 233, 238, .6); }
.tg-nav__item--cat .tg-nav__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tg-nav__cats { display: flex; flex-direction: column; gap: 1px; }
.tg-nav__scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.tg-nav__bottom {
  display: flex; justify-content: space-around; gap: 4px; padding: 8px 4px 0;
  border-top: 1px solid var(--tg-anthracite-line);
}
.tg-nav__iconbtn {
  display: inline-flex; align-items: center; justify-content: center;
  width: var(--tg-touch); height: var(--tg-touch); font-size: 18px; color: var(--tg-ink-inv);
  text-decoration: none; border-radius: 8px;
}
.tg-nav__iconbtn:hover { background: var(--tg-anthracite-soft); }
.tg-nav__iconbtn[aria-current="page"] { background: var(--tg-signal); color: #fff; }
@media (min-width: 900px) {
  tg-app[data-nav-collapsed] .tg-nav--side { display: none; }
}

/* --- desktop sidebar (hidden by default, shown >= breakpoint) ------------ */

.tg-nav--side { display: none; }

/* --- mobile bottom navigation (default) ---------------------------------- */

.tg-nav--bottom {
  display: flex;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  gap: 4px;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
  overflow-x: auto;              /* many entries scroll inside the bar, never the page */
  scrollbar-width: none;
  background: var(--tg-anthracite);
  border-top: 2px solid var(--tg-signal);
}
.tg-nav--bottom::-webkit-scrollbar { display: none; }
.tg-nav--bottom .tg-nav__item {
  flex: 1 0 64px;
  flex-direction: column;
  gap: 2px;
  justify-content: center;
  text-align: center;
  font-size: 11px;
  padding: 4px 2px;
}
.tg-nav--bottom .tg-nav__badge { margin-left: 0; }
.tg-nav--bottom .tg-nav__label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (min-width: 900px) {
  .tg-nav--side {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 0 0 var(--tg-sidebar);
    width: var(--tg-sidebar);
    padding: 12px 10px;
    background: var(--tg-anthracite);
    border-right: 1px solid var(--tg-anthracite-line);
    /* Bounded to the window: a long sidebar (many categories, project group)
       scrolls inside .tg-nav__scroll instead of stretching the row — otherwise
       the plan viewer grew taller than the window (2026-10-20). */
    box-sizing: border-box;
    height: calc(100vh - var(--tg-topbar));
    position: sticky;
    top: var(--tg-topbar);
  }
  .tg-nav--bottom { display: none; }
  .tg-content { padding-bottom: var(--tg-gap); }
  .tg-content--fill { padding: 0; }
}

/* ===========================================================================
   Primitive, die alle Komponenten nutzen dürfen (Toolbar, Knöpfe, Menü,
   Dialog, Tabelle, Leerzustand). Eigene Gestaltung; keine Fremd-Assets.
   =========================================================================== */

.tg-view-title { margin: 4px 0 14px; font-size: 20px; }

.tg-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 14px;
}
.tg-toolbar .tg-toolbar__spacer { flex: 1 1 auto; }
.tg-search-box {
  min-height: 40px; min-width: 160px; padding: 8px 12px; font: inherit; font-size: 14px;
  border: 1px solid var(--tg-border); border-radius: 8px; background: var(--tg-card); color: var(--tg-ink);
}
.tg-search-box:focus { outline: none; border-color: var(--tg-signal); box-shadow: 0 0 0 3px var(--tg-signal-soft); }

.tg-btn-primary, .tg-btn-secondary, .tg-btn-danger, .tg-btn-ghost {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px;
  padding: 8px 14px; font: inherit; font-size: 14px; font-weight: 600;
  border-radius: 8px; cursor: pointer; white-space: nowrap; text-decoration: none;
}
.tg-btn-primary { color: #fff; background: var(--tg-signal); border: 1px solid var(--tg-signal); }
.tg-btn-primary:hover { background: var(--tg-signal-strong); }
.tg-btn-secondary { color: var(--tg-ink); background: var(--tg-card); border: 1px solid var(--tg-border); }
.tg-btn-secondary:hover { border-color: var(--tg-ink-dim); }
.tg-btn-danger { color: #fff; background: var(--tg-danger); border: 1px solid var(--tg-danger); }
.tg-btn-ghost { color: var(--tg-ink-dim); background: transparent; border: 1px solid transparent; }
.tg-btn-ghost:hover { color: var(--tg-ink); background: var(--tg-page); }
button:disabled { opacity: .55; cursor: not-allowed; }

.tg-segment { display: inline-flex; border: 1px solid var(--tg-border); border-radius: 8px; overflow: hidden; }
.tg-segment button {
  min-height: 40px; padding: 8px 14px; font: inherit; font-weight: 600;
  color: var(--tg-ink); background: var(--tg-card); border: none; cursor: pointer;
}
.tg-segment button[aria-pressed="true"] { color: #fff; background: var(--tg-signal); }

.tg-chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 32px;
  padding: 4px 10px; font-size: 13px; color: var(--tg-ink);
  background: var(--tg-card); border: 1px solid var(--tg-border); border-radius: 999px;
}
.tg-chip[data-active], .tg-chip.is-active { border-color: var(--tg-signal); background: var(--tg-signal-soft); }
.tg-chip button { font: inherit; border: none; background: transparent; cursor: pointer; color: var(--tg-ink-dim); }

.tg-menu {
  position: absolute; z-index: 40; min-width: 200px; max-height: 60vh; overflow: auto;
  padding: 6px 0; color: var(--tg-ink); background: var(--tg-card);
  border: 1px solid var(--tg-border); border-radius: var(--tg-radius); box-shadow: var(--tg-shadow-pop);
}
.tg-menu__item {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px;
  padding: 8px 14px; font: inherit; font-size: 14px; text-align: left;
  color: var(--tg-ink); background: transparent; border: none; cursor: pointer;
}
.tg-menu__item:hover { background: var(--tg-page); }
.tg-menu__item.is-danger { color: var(--tg-danger); }
.tg-menu__sep { height: 1px; margin: 6px 0; background: var(--tg-border); }
.tg-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }

.tg-dialog { position: fixed; inset: 0; z-index: 70; display: none; }
.tg-dialog[open] { display: block; }
.tg-dialog__scrim { position: absolute; inset: 0; background: rgba(20, 24, 31, .5); }
.tg-dialog__panel {
  position: absolute; inset: 0; margin: auto; width: min(560px, calc(100% - 24px));
  height: fit-content; max-height: calc(100% - 24px); overflow: auto;
  color: var(--tg-ink); background: var(--tg-card); border: 1px solid var(--tg-border);
  border-radius: var(--tg-radius); box-shadow: var(--tg-shadow-pop);
}
.tg-dialog__head {
  display: flex; align-items: center; gap: 10px; padding: 16px 18px;
  border-bottom: 1px solid var(--tg-border);
}
.tg-dialog__head h3 { margin: 0; font-size: 17px; flex: 1 1 auto; }
.tg-dialog__close {
  width: 36px; height: 36px; font-size: 20px; line-height: 1; cursor: pointer;
  border: 1px solid var(--tg-border); border-radius: 8px; background: var(--tg-page);
}
.tg-dialog__body { padding: 16px 18px; }
.tg-dialog__foot {
  display: flex; justify-content: flex-end; gap: 10px; padding: 12px 18px;
  border-top: 1px solid var(--tg-border);
}

.tg-table { width: 100%; border-collapse: collapse; background: var(--tg-card); font-size: 14px; }
.tg-table th, .tg-table td {
  padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--tg-border); vertical-align: middle;
}
.tg-table th { font-size: 12px; text-transform: uppercase; letter-spacing: .3px; color: var(--tg-ink-dim); }
.tg-table tr[data-clickable]:hover { background: var(--tg-page); cursor: pointer; }
.tg-table-wrap {
  overflow-x: auto; border: 1px solid var(--tg-border); border-radius: var(--tg-radius); background: var(--tg-card);
}

.tg-panel {
  background: var(--tg-card); border: 1px solid var(--tg-border); border-radius: var(--tg-radius);
  padding: 16px; margin: 0 0 16px;
}
.tg-panel h3 { margin: 0 0 12px; font-size: 15px; }

.tg-empty-state {
  display: grid; place-items: center; gap: 8px; padding: 48px 16px; text-align: center;
  color: var(--tg-ink-dim); border: 2px dashed var(--tg-border); border-radius: var(--tg-radius);
  background: var(--tg-card);
}
.tg-empty-state h3 { margin: 0; color: var(--tg-ink); font-size: 16px; }

.tg-alert {
  display: none; margin: 0 0 14px; padding: 10px 12px; font-size: 14px;
  color: #fff; background: var(--tg-danger); border-radius: 8px;
}
.tg-alert[data-show] { display: block; }
.tg-alert--ok { background: var(--tg-ok); }

/* --- project list (SCR-028 tiles) ---------------------------------------- */

.tg-project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--tg-gap);
}
.tg-project-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  background: var(--tg-card);
  border: 1px solid var(--tg-border);
  border-left: 4px solid var(--tg-signal);
  border-radius: var(--tg-radius);
  box-shadow: var(--tg-shadow);
  cursor: pointer;
}
.tg-project-card:hover { border-color: var(--tg-signal); }
.tg-project-card h3 { margin: 0; font-size: 16px; }
.tg-project-card .tg-project-code { color: var(--tg-ink-dim); font-size: 13px; }
.tg-project-card .tg-role-badge {
  align-self: flex-start;
  padding: 2px 8px;
  font-size: 12px;
  color: var(--tg-ink-dim);
  background: var(--tg-page);
  border: 1px solid var(--tg-border);
  border-radius: 999px;
}
.tg-project-card--new {
  justify-content: center; align-items: center; min-height: 120px;
  border: 2px dashed var(--tg-border); border-left: 2px dashed var(--tg-border);
  box-shadow: none; color: var(--tg-ink-dim); font-weight: 600;
}

.tg-kpi { display: flex; align-items: baseline; gap: 8px; }
.tg-kpi .tg-kpi-value { font-size: 24px; font-weight: 700; color: var(--tg-open); }
.tg-kpi .tg-kpi-label { font-size: 13px; color: var(--tg-ink-dim); }

.tg-empty { color: var(--tg-ink-dim); }
.tg-placeholder { color: var(--tg-ink-dim); max-width: 60ch; }

/* ===========================================================================
   Tutorial (lib/help-tour.js): explained areas glow, the bar at the bottom
   explains the tapped one. Above the bottom navigation, below dialogs.
   =========================================================================== */
.tg-tour .tg-tour-spot {
  outline: 2px solid var(--tg-signal) !important; outline-offset: 2px;
  box-shadow: 0 0 0 6px rgba(235, 114, 35, .25);
  animation: tg-tour-glow 1.6s ease-in-out infinite;
}
@keyframes tg-tour-glow { 50% { box-shadow: 0 0 0 10px rgba(235, 114, 35, .08); } }
@media (prefers-reduced-motion: reduce) { .tg-tour .tg-tour-spot { animation: none; } }
.tg-tour-bar {
  position: fixed; left: 12px; right: 12px; z-index: 60;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px;
  padding: 12px 16px; border-radius: 10px;
  color: #fff; background: var(--tg-anthracite); border: 2px solid var(--tg-signal);
  box-shadow: var(--tg-shadow-pop); font-size: 15px; line-height: 1.4;
}
@media (max-width: 899px) { .tg-tour-bar { bottom: calc(var(--tg-bottomnav) + 12px + env(safe-area-inset-bottom, 0px)); } }
.tg-tour-bar__text { flex: 1 1 320px; }
.tg-tour-bar__hint { flex: 1 1 100%; order: 3; font-size: 13px; color: #c9ccd2; }
.tg-tour-bar__end {
  flex: 0 0 auto; min-height: 40px; padding: 0 16px; border: none; border-radius: 8px; cursor: pointer;
  font: inherit; font-weight: 700; color: #fff; background: var(--tg-signal);
}

/* ===========================================================================
   Always-visible header (2026-11-02, like Mobile Mitarbeiter): the topbar, the
   account tabs and a view's page head (.tg-page-head) stay at the top while
   the content scrolls under them. Above the content's own popups (≤ 50),
   below toasts (60) and dialogs (70).
   =========================================================================== */
tg-app > .tg-topbar { position: sticky; top: 0; z-index: 55; }
tg-app > tg-nav[level="account"] { display: block; position: sticky; top: var(--tg-topbar); z-index: 54; }
.tg-page-head {
  position: sticky; top: var(--tg-topbar); z-index: 45;
  /* Reaches over the content padding so nothing shows beside it while scrolling. */
  margin: calc(-1 * var(--tg-gap)) calc(-1 * var(--tg-gap)) 14px;
  padding: var(--tg-gap) var(--tg-gap) 0;
  background: var(--tg-page);
  box-shadow: 0 6px 8px -8px rgba(0, 0, 0, .25);
}
.tg-page-head__row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.tg-page-head__row .tg-view-title { margin: 4px 0 10px; flex: 1 1 auto; }
.tg-page-head__actions { display: flex; gap: 8px; margin: 0 0 10px; }
