/* Global Reset & Base Typography */
* {
  box-sizing: border-box;
}

:root {
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --sidebar-width: 280px;
  --header-height: 70px;
  --radius-lg: 12px;
  --radius-md: 8px;
}

body {
  margin: 0;
  /* Familie und Ersatzschriften wörtlich aus dem WTD Design System (`sans`). */
  font-family: Lato, "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  background: var(--theme-bg);
  color: var(--theme-text);
  height: 100vh;
  overflow: hidden;
}

.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* Layout container */
.container {
  display: flex;
  height: 100vh;
}

/* Sidebar Styling */
.sidebar {
  width: var(--sidebar-width);
  background: var(--theme-sidebar-bg);
  border-right: 1px solid var(--theme-border);
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1.25rem;
  flex-shrink: 0;
  overflow-y: auto;
}

.sidebar-top {
  flex: 1;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

/* `class="logo"` steht seit jeher in base.html, eine Regel dazu gab es nie —
   solange kein Logo hinterlegt war, fiel das niemandem auf. Ein hochgeladenes
   Bild würde ohne diese Zeilen in Originalgröße in der Seitenleiste stehen
   (beim ersten Versuch mit dem WTD-Logo: halbe Spaltenhöhe).
   40px ist die Höhe der `.brand-icon-box` daneben — mit und ohne Logo sieht der
   Kopf der Seitenleiste damit gleich aus. */
.brand .logo {
  max-height: 40px;
  max-width: 100%;
  object-fit: contain;
}

/* Auf der Anmeldemaske darf es größer sein: Dort ist es das einzige Bild und
   das Erste, was jemand von einer Verwaltung sieht. */
.topbar .logo {
  max-height: 3rem;
  max-width: 14rem;
  object-fit: contain;
}

.brand-icon-box {
  width: 40px;
  height: 40px;
  background: var(--theme-primary);
  color: var(--theme-on-primary, white);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-name {
  font-weight: 700;
  font-size: 1rem;
  color: var(--theme-primary-text);
}

.brand-sub {
  font-size: 0.75rem;
  color: var(--theme-muted);
}

.nav-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--theme-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 1.5rem 0 0.75rem;
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  text-decoration: none;
  color: var(--theme-text);
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 500;
  transition: all 0.2s;
  position: relative;
}

.nav-link:hover {
  background: var(--theme-nav-active-bg);
  color: var(--theme-primary-text);
}

.nav-link.active {
  background: var(--theme-nav-active-bg);
  color: var(--theme-primary-text);
  font-weight: 600;
}

.nav-icon {
  font-size: 1.25rem !important;
  color: var(--theme-muted);
}

.nav-link.active .nav-icon,
.nav-link:hover .nav-icon {
  color: var(--theme-primary-text);
}

.nav-badge {
  margin-left: auto;
  background: var(--theme-accent);
  color: var(--theme-on-accent, white);
  font-size: 0.75rem;
  padding: 0.1rem 0.5rem;
  border-radius: 10px;
  font-weight: 700;
}

/* Sidebar User Section */
.sidebar-bottom {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--theme-border);
}

.user-role-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.user-role-icon {
  color: var(--theme-primary-text);
}

.user-role-icon span {
  font-size: 2rem !important;
}

.role-name {
  display: block;
  font-weight: 700;
  font-size: 0.9rem;
}

.role-company {
  display: block;
  font-size: 0.8rem;
  color: var(--theme-muted);
}

.user-profile-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--theme-surface);
  border: 1px solid var(--theme-border);
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
}

.user-avatar-initials {
  width: 32px;
  height: 32px;
  background: var(--theme-primary);
  color: var(--theme-on-primary, white);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
}

.user-profile-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.profile-name {
  font-weight: 600;
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-email {
  font-size: 0.75rem;
  color: var(--theme-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.logout-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem;
  background: var(--theme-surface, white);
  border: 1px solid var(--theme-border);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.logout-btn:hover {
  background: var(--theme-bg);
}

/* Main Content Area */
.content {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--theme-bg);
  overflow: hidden;
}

.content-header {
  height: var(--header-height);
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--theme-surface);
  border-bottom: 1px solid var(--theme-border);
  flex-shrink: 0;
}

.header-branding {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.branding-icon {
  color: var(--theme-primary-text);
  opacity: 0.7;
}

.branding-title {
  display: block;
  font-weight: 700;
  color: var(--theme-primary-text);
}

.branding-subtitle {
  display: block;
  font-size: 0.75rem;
  color: var(--theme-muted);
}

.lang-switch {
  display: flex;
  background: var(--theme-bg);
  border: 1px solid var(--theme-border);
  border-radius: 6px;
  padding: 2px;
}

.lang-link {
  text-decoration: none;
  padding: 0.25rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--theme-primary-text);
  border-radius: 4px;
}

.lang-link.active {
  background: var(--theme-primary);
  color: var(--theme-on-primary, white);
}

.content-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 2rem;
}

/* Dashboard Styles */
.dashboard-container {
  max-width: 1100px;
  margin: 0 auto;
}

.dashboard-greeting {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 2rem;
}

.dashboard-greeting h2 {
  margin: 0 0 0.5rem;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--theme-primary-text);
}

.dashboard-greeting p {
  margin: 0;
  color: var(--theme-muted);
}

/* Filter Styles */
.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.filter-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--theme-muted);
  text-align: right;
}

.filter-input-wrap {
  display: flex;
  gap: 0.5rem;
}

.filter-select {
  padding: 0.5rem 1rem;
  height: 42px;
  border: 1px solid var(--theme-border);
  border-radius: var(--radius-md);
  background: var(--theme-surface, white);
  font-family: inherit;
  font-size: 0.9rem;
  min-width: 200px;
}

.btn-filter {
  background: var(--theme-primary);
  color: var(--theme-on-primary, white);
  border: none;
}

.btn-filter:hover {
  background: var(--theme-primary-dark);
}

/* Summary Statistics */
.summary-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.stat-card-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.stat-card {
  background: var(--theme-surface, white);
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--theme-border);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.stat-card-link:hover .stat-card {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--theme-primary);
}

.stat-main {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--theme-muted);
  font-weight: 500;
  margin-bottom: 0.75rem;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--theme-primary-text);
  line-height: 1;
}

.stat-sub {
  font-size: 0.8rem;
  color: var(--theme-muted);
  margin-top: 0.5rem;
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-icon span {
  font-size: 1.5rem !important;
}

.stat-icon.blue { background: var(--theme-icon-bg-blue); color: var(--theme-icon-blue); }
.stat-icon.red { background: var(--theme-icon-bg-red); color: var(--theme-icon-red); }
.stat-icon.green { background: var(--theme-icon-bg-green); color: var(--theme-icon-green); }
.stat-icon.yellow { background: var(--theme-icon-bg-yellow); color: var(--theme-icon-yellow); }

/* Dashboard Stack */
.dashboard-stack {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.stack-card {
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--theme-border);
  background: var(--theme-surface, white);
  box-shadow: var(--shadow-sm);
}

.stack-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.stack-header h3 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--theme-primary-text);
}

.stack-link {
  font-size: 0.85rem;
  color: var(--theme-muted);
  text-decoration: none;
}

.stack-link:hover {
  text-decoration: underline;
}

/* Property Entry */
.prop-entry {
  display: flex;
  border: 1px solid var(--theme-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 1rem;
}

.prop-entry:last-child {
  margin-bottom: 0;
}

.prop-image {
  width: 240px;
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
}

.prop-image-placeholder {
  width: 240px;
  background: var(--theme-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--theme-muted);
  flex-shrink: 0;
}

.prop-details {
  flex: 1;
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.prop-top-line {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.prop-name {
  display: block;
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 0.25rem;
}

.prop-addr {
  display: block;
  font-size: 0.9rem;
  color: var(--theme-muted);
}

.role-tag {
  background: var(--theme-primary-dark);
  color: var(--theme-on-primary-dark, white);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.75rem;
  border-radius: 12px;
}

.prop-bottom-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.prop-units-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--theme-muted);
}

.prop-units-info span:first-child {
  font-size: 1.25rem !important;
}

/* Row Items (Tickets, Meetings, etc.) */
.item-row {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--theme-border);
}

.item-row:last-child {
  border-bottom: none;
}

.item-icon-box {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ticket-icon-color { background: var(--theme-icon-bg-yellow); color: var(--theme-icon-yellow); }
.doc-icon-color { background: var(--theme-bg); color: var(--theme-muted); }
.meter-icon-color { background: var(--theme-icon-bg-yellow); color: var(--theme-icon-yellow); }
.notif-icon-color { background: var(--theme-icon-bg-blue); color: var(--theme-icon-blue); }

.item-main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.item-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--theme-text);
}

.item-meta {
  font-size: 0.85rem;
  color: var(--theme-muted);
}

.item-status-col {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
}

.status-tag {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.15rem 0.6rem;
  border-radius: 4px;
}

.tag-recorded { background: var(--theme-icon-bg-yellow); color: var(--theme-icon-yellow); }
.tag-in_progress { background: var(--theme-icon-bg-blue); color: var(--theme-icon-blue); }
.tag-completed { background: var(--theme-icon-bg-green); color: var(--theme-icon-green); }

.item-date {
  font-size: 0.8rem;
  color: var(--theme-muted);
}

.row-arrow {
  color: var(--theme-border);
}

/* Meeting Date Badge */
.meeting-date-badge {
  width: 50px;
  height: 50px;
  background: var(--theme-primary);
  color: var(--theme-on-primary, white);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.m-day {
  font-weight: 700;
  font-size: 1.25rem;
  line-height: 1;
}

.m-month {
  font-size: 0.7rem;
  text-transform: uppercase;
  font-weight: 600;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1.25rem;
  height: 42px;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary {
  background: var(--theme-primary);
  color: var(--theme-on-primary, white);
  border: none;
}

.btn-primary:hover {
  background: var(--theme-primary-dark);
}

.btn-outline {
  background: var(--theme-surface, white);
  color: var(--theme-text);
  border: 1px solid var(--theme-border);
}

.btn-outline:hover {
  background: var(--theme-bg);
  border-color: var(--theme-primary);
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
}

/* Icons */
.download-link {
  color: var(--theme-muted);
  text-decoration: none;
}

.download-link:hover {
  color: var(--theme-primary-text);
}

.check-icon {
  color: var(--theme-icon-green);
}

/* `hidden` schlaegt jedes eigene `display`.

   Das Attribut wirkt nur ueber die Standardregel des Browsers
   (`[hidden] { display: none }`), und die verliert gegen jeden Wert, den ein
   Element selbst mitbringt — ein `style="display: grid"` genuegt. Der Block
   fuer die Anlaufstelle stand deshalb sichtbar und beschreibbar da, obwohl
   `hidden` gesetzt war. Mit `!important` gilt das Verstecken auch gegen einen
   Inline-Stil. */
[hidden] {
  display: none !important;
}

/* Authentication Pages */
.page-auth {
  /* `min-height` statt `height`: bei `height: 100vh` steht die Seite auf genau
     einem Bildschirm fest. Laengerer Inhalt ragt dann oben und unten heraus,
     und weil die Hoehe fest ist, entsteht kein Rollbalken - der ueberstehende
     Teil war nicht erreichbar. Genau das traf die Datenschutzerklaerung, die
     mit Abstand laengste dieser Seiten. */
  /* `body` traegt `height: 100vh` und `overflow: hidden` - gedacht fuer den
     angemeldeten Bereich, wo die Seitenleiste steht und ein innerer Bereich
     rollt. Beides muss hier ausdruecklich zurueckgenommen werden: `min-height`
     ersetzt kein `height`, das sind zwei Eigenschaften, und ein `hidden` am
     Koerper schneidet ab, was ueber den Bildschirm hinausgeht. */
  height: auto;
  overflow: visible;
  min-height: 100vh;
  display: flex;
  /* `align-items: center` zentriert, schneidet aber bei Ueberlauf oben ab, und
     abgeschnittener Inhalt laesst sich nicht heranrollen. `margin: auto` auf
     der Karte zentriert genauso, solange Platz ist, und laesst sie sonst
     einfach nach unten wachsen. */
  align-items: flex-start;
  justify-content: center;
  padding: 2rem 1rem;
  box-sizing: border-box;
  background: linear-gradient(135deg, var(--theme-bg) 0%, var(--theme-surface, #fff) 100%);
}

/* Die Anmeldeseite ist eine Spalte: Farbstreifen, Kopf, Karte, Fußzeile.
   `.page-auth` war ein Flex-Container **ohne** Richtungsangabe und legte sie
   deshalb nebeneinander. Auf portal.wtd-immobilien.de lief der Firmenname
   dadurch unter die Anmeldekarte — am 22.09.2026 am laufenden Portal gesehen,
   nicht nur lokal. Die Regel entstand, als auf dieser Seite nur die Karte
   stand; Kopf und Streifen kamen später dazu. */
.page-auth {
  flex-direction: column;
}

/* Die folgenden Klassen benutzen die Vorlagen seit jeher, definiert waren sie
   nie — der Fund vom 12.09.2026 ("sechs Klassen ohne jede Regel"). Ohne sie
   greift nur die Browser-Vorgabe, was auf der Anmeldemaske und der
   Datenschutzerklärung sichtbar wurde. */

.top-accent {
  /* Aus dem Fluss genommen, damit der Streifen am Fensterrand sitzt und nicht
     im Innenabstand von `.page-auth` hängt. */
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--theme-top-strip);
  z-index: 1;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.5rem 0 1.5rem;
  flex: 0 0 auto;
}

.topbar h1 {
  /* Ohne Angabe gilt die Browser-Vorgabe von 2em — neben einem Logo ist das
     eine Schlagzeile, kein Firmenname. */
  margin: 0;
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--theme-text);
}

/* Als Kind einer Spalte ist die Fußzeile nur so breit wie ihr Inhalt; ihr
   eigenes `justify-content: center` zentriert dann nichts. */
.page-auth .legal-footer {
  width: 100%;
}

.content-wrap {
  display: flex;
  justify-content: center;
  width: 100%;
  flex: 1 1 auto;
}

.auth-lead {
  margin: -1rem 0 1.5rem;
  color: var(--theme-muted);
  font-size: 0.9375rem;
}

.auth-footer-links {
  margin: 1.25rem 0 0;
  font-size: 0.875rem;
}

.card-title-icon {
  font-size: 1.5rem;
  color: var(--theme-primary-text);
}

.text-muted {
  color: var(--theme-muted);
}

.auth-card {
  margin: auto;
  width: 100%;
  max-width: 420px;
  background: var(--theme-surface, white);
  padding: 2.5rem;
  border-radius: 20px;
  border: 1px solid var(--theme-border);
  box-shadow: 0 10px 25px rgba(0,0,0,0.05);
}

.auth-card h2 {
  margin: 0 0 1.5rem;
  font-size: 1.5rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--theme-primary-text);
}

.auth-card form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--theme-muted);
}

.input {
  padding: 0.75rem 1rem;
  border: 1px solid var(--theme-border);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 1rem;
}

.input:focus {
  outline: 2px solid var(--theme-primary);
  outline-offset: -1px;
}

.auth-footer {
  margin-top: 1.5rem;
  text-align: center;
  font-size: 0.9rem;
  color: var(--theme-muted);
}

.auth-footer a {
  color: var(--theme-primary-text);
  font-weight: 600;
  text-decoration: none;
}

.auth-footer a:hover {
  text-decoration: underline;
}

/* Mobile Navigation Controls */
.menu-toggle-btn, .menu-close-btn {
  display: none;
  background: none;
  border: none;
  color: var(--theme-primary-text);
  cursor: pointer;
  padding: 0.5rem;
}

.overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(2px);
  z-index: 99;
}

.overlay.active {
  display: block;
}

/* Mobile Responsiveness */
@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: -var(--sidebar-width);
    bottom: 0;
    z-index: 100;
    transition: left 0.3s ease;
    box-shadow: 10px 0 25px rgba(0,0,0,0.1);
    pointer-events: none;
  }

  .sidebar.open {
    left: 0;
    pointer-events: auto;
  }

  .sidebar-mobile-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1rem;
  }

  .menu-toggle-btn, .menu-close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .content-header {
    padding: 0 1rem;
  }

  .content-scroll {
    padding: 1rem;
  }

  .dashboard-greeting {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .greeting-actions {
    width: 100%;
  }

  .filter-input-wrap {
    width: 100%;
  }

  .filter-select {
    flex: 1;
    min-width: 0;
  }

  .prop-entry {
    flex-direction: column;
  }

  .prop-image, .prop-image-placeholder {
    width: 100%;
    height: 160px;
  }
}

/* Rechtliche Fusszeile. Muss auf jeder Seite erreichbar sein, darf aber den
   Inhalt nicht dominieren. */
.legal-footer {
  padding: 1.25rem 1rem 2rem;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--theme-muted, #6b7280);
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}
.legal-footer a {
  color: inherit;
  text-decoration: underline;
}
.legal-footer a:hover,
.legal-footer a:focus-visible {
  color: var(--theme-primary-text);
}

/* ---------------------------------------------------------------------------
   Barrierefreiheit, Zielniveau WCAG 2.2 AA (offener Punkt O15).
   Vorher gab es genau zwei Fokusregeln in dieser Datei; mit der Tastatur war
   nicht zu erkennen, wo man steht.
   --------------------------------------------------------------------------- */

/* Sprunglink: erste Station beim Tabben, sonst unsichtbar. */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 1000;
  padding: 0.75rem 1.25rem;
  background: var(--theme-primary, #1d4ed8);
  color: var(--theme-on-primary, #fff);
  border-radius: 0 0 8px 0;
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus {
  left: 0;
}

/* Sichtbarer Fokus auf allem, was bedienbar ist. :focus-visible statt :focus,
   damit ein Mausklick keinen Rahmen hinterlässt. */
/* Links ohne eigene Regel standen im Browser-Standardblau — auch „Passwort
   vergessen“ auf der Anmeldemaske. Der WTD-Styleguide schließt Blau aus (das
   ist die Farbe von Ascurion), und eine fremde Verwaltung bekäme so einen Ton,
   den sie nie gewählt hat. Elementregel mit niedrigster Spezifität: Sie greift
   nur, wo keine Klasse etwas anderes sagt. Die Unterstreichung bleibt, damit
   ein Link nicht allein an der Farbe erkennbar ist (WCAG 1.4.1). */
a {
  color: var(--theme-primary-text);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--theme-primary, #1d4ed8);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Zweiter Ring in Hell, damit der Fokus auch auf dunklen Flächen sichtbar
   bleibt (SC 1.4.11 Kontrast von Bedienelementen). */
.btn:focus-visible,
.nav-link:focus-visible {
  outline: 3px solid var(--theme-primary, #1d4ed8);
  outline-offset: 2px;
  box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.9);
}

/* Ältere Browser ohne :focus-visible bekommen wenigstens :focus. */
@supports not selector(:focus-visible) {
  a:focus, button:focus, input:focus, select:focus, textarea:focus {
    outline: 3px solid var(--theme-primary, #1d4ed8);
    outline-offset: 2px;
  }
}

/* Der Hauptbereich bekommt nach dem Sprunglink den Fokus, soll aber keinen
   Rahmen zeigen – er ist kein Bedienelement. */
main:focus {
  outline: none;
}

/* SC 2.5.8: Zielgröße mindestens 24x24 CSS-Pixel. Betrifft vor allem die
   Icon-Links in den Listen. */
.download-link,
.btn-sm,
.menu-toggle-btn,
.menu-close-btn {
  min-width: 24px;
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Aktueller Navigationseintrag auch ohne Farbe erkennbar (SC 1.4.1). */
.nav-link[aria-current="page"] {
  font-weight: 700;
}
.nav-link[aria-current="page"]::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.35rem;
  bottom: 0.35rem;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--theme-primary, #1d4ed8);
}
.nav-link {
  position: relative;
}

/* Nur für Hilfsmittel sichtbar. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* SC 2.3.3: Wer Bewegung reduziert haben will, bekommt keine. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Blätterung unter langen Listen. */
.blaettern {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  justify-content: center;
  padding: 1rem 0 0;
}

/* Brotkrumen ueber der Dokumentenliste. */
.brotkrumen {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  font-size: 0.85rem;
  color: var(--theme-muted, #6b7280);
  margin-bottom: 0.5rem;
}
.brotkrumen a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.brotkrumen a:hover,
.brotkrumen a:focus-visible {
  color: var(--theme-primary-text);
  border-bottom-color: currentColor;
}
.brotkrumen [aria-current="page"] {
  font-weight: 600;
  color: var(--theme-text, #111827);
}

/* Nur fuer Screenreader. Wird gebraucht, wo ein Symbol die Aussage traegt und
   daneben kein sichtbarer Text stehen soll (WCAG 2.2 AA, offener Punkt O15).
   Bewusst nicht display:none - das nehmen Screenreader ebenfalls nicht vor. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
