:root {
  --font-sans: "Aptos", "Segoe UI Variable", "DIN Alternate", sans-serif;
  --color-bg: #0e1419;
  --color-bg-elevated: rgba(18, 28, 35, 0.86);
  --color-surface: rgba(23, 36, 45, 0.84);
  --color-surface-soft: rgba(255, 255, 255, 0.08);
  --color-text: #f8f4ec;
  --color-text-soft: #c6cdd2;
  --color-border: rgba(255, 255, 255, 0.08);
  --color-accent: #c62828;
  --color-accent-soft: rgba(198, 40, 40, 0.18);
  --color-warning: #f9a825;
  --color-success: #2e7d32;
  --background-stripe-color: rgba(255, 255, 255, 0.012);
  --shadow-panel: 0 24px 60px rgba(0, 0, 0, 0.28);
  color-scheme: dark;
}

:root[data-theme=light] {
  --color-bg: #f1e8dc;
  --color-bg-elevated: rgba(255, 252, 247, 0.96);
  --color-surface: rgba(255, 255, 255, 0.94);
  --color-surface-soft: rgba(23, 33, 42, 0.1);
  --color-text: #111922;
  --color-text-soft: #394754;
  --color-border: rgba(23, 33, 42, 0.14);
  --color-accent-soft: rgba(198, 40, 40, 0.16);
  --background-stripe-color: rgba(23, 33, 42, 0.06);
  color-scheme: light;
  --shadow-panel: 0 18px 48px rgba(38, 34, 29, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: radial-gradient(circle at top left, rgba(198, 40, 40, 0.24), transparent 30%), radial-gradient(circle at top right, rgba(249, 168, 37, 0.18), transparent 28%), linear-gradient(160deg, var(--color-bg) 0%, #111820 48%, var(--color-bg) 100%);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  color: var(--color-text);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: linear-gradient(rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01)), repeating-linear-gradient(135deg, transparent 0, transparent 22px, var(--background-stripe-color) 22px, var(--background-stripe-color) 24px);
  pointer-events: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
.button-link {
  border: 0;
  border-radius: 16px;
  padding: 0.9rem 1.2rem;
  cursor: pointer;
  text-decoration: none;
  transition: transform 160ms ease, opacity 160ms ease, background 160ms ease;
}

button:hover,
.button-link:hover {
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: 0.9rem 1rem;
  color: var(--color-text);
  background: var(--color-surface-soft);
}

select {
  color-scheme: dark;
}

select option {
  color: var(--color-text);
  background: #1b252d;
}

:root[data-theme=light] select {
  color-scheme: light;
}

:root[data-theme=light] select option {
  color: var(--color-text);
  background: #fffaf4;
}

textarea {
  resize: vertical;
}

label {
  display: grid;
  gap: 0.45rem;
  color: var(--color-text-soft);
  font-size: 0.95rem;
}

h1,
h2,
h3,
p {
  margin: 0;
}

#root {
  min-height: 100vh;
}

.centered-shell,
.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem;
}

.redirect-shell {
  padding: 1.5rem;
}

.hero-panel,
.sidebar,
.content,
.panel,
.stat-card {
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.hero-panel,
.sidebar,
.panel,
.stat-card {
  border: 1px solid var(--color-border);
  background: var(--color-bg-elevated);
  box-shadow: var(--shadow-panel);
}

.hero-panel {
  max-width: 760px;
  padding: 3rem;
  border-radius: 32px;
  display: grid;
  gap: 1.4rem;
}

.hero-panel h1 {
  font-size: clamp(2.4rem, 5vw, 4.8rem);
  line-height: 0.95;
  max-width: 11ch;
}

.hero-panel p,
.sidebar-copy {
  color: var(--color-text-soft);
  max-width: 52ch;
}

.hero-actions,
.sidebar-actions,
.tracker-actions,
.panel-actions,
.editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(280px, 320px) 1fr;
  gap: 1.2rem;
  min-height: 100vh;
  padding: 1.2rem;
  align-items: start;
}

.sidebar {
  border-radius: 28px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1.5rem;
  position: sticky;
  top: 1.2rem;
  min-height: calc(100vh - 2.4rem);
}

.content-shell {
  display: flex;
  justify-content: center;
  min-width: 0;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  color: var(--color-warning);
}

.sidebar h1 {
  margin-top: 0.75rem;
  font-size: clamp(1.7rem, 2.4vw, 2.8rem);
  line-height: 0.95;
  word-break: keep-all;
}

.nav {
  display: grid;
  gap: 0.55rem;
}

.nav-item {
  display: block;
  padding: 0.9rem 1.2rem;
  border-radius: 16px;
  text-decoration: none;
  text-align: left;
  color: var(--color-text);
  background: transparent;
  border: 1px solid transparent;
}

.nav-item.active {
  background: linear-gradient(135deg, var(--color-accent), #ff7043);
}

.sidebar-footer {
  display: grid;
  gap: 0.8rem;
}

.sidebar-footer span {
  display: block;
  color: var(--color-text-soft);
}

.content {
  width: min(100%, 1120px);
  border-radius: 28px;
  padding: 1.5rem;
  display: grid;
  align-content: start;
  gap: 1rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--color-border);
}

:root[data-theme=light] .content {
  background: rgba(255, 255, 255, 0.44);
}

.mobile-menu-button,
.sidebar-backdrop {
  display: none;
}

.topbar,
.panel-header,
.history-row,
.legend-item {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
}

.history-row > div:first-child {
  min-width: 0;
  display: grid;
  gap: 0.25rem;
}

.history-row > div:last-child {
  min-width: 0;
  display: grid;
  gap: 0.25rem;
  justify-items: end;
  text-align: right;
}

.history-row > div:first-child span,
.history-row > div:first-child strong {
  overflow-wrap: anywhere;
}

.topbar h2 {
  margin-top: 0.35rem;
  font-size: clamp(1.6rem, 2vw, 2.5rem);
}

.status-pill {
  border-radius: 999px;
  padding: 0.55rem 0.95rem;
  background: var(--color-surface-soft);
  color: var(--color-text);
}

.status-pill.tiny {
  font-size: 0.78rem;
}

.message {
  border-radius: 18px;
  padding: 0.9rem 1rem;
}

.message.error {
  background: rgba(198, 40, 40, 0.16);
  color: #ffcdc8;
}

.message.success {
  background: rgba(46, 125, 50, 0.16);
  color: #cdebd0;
}

:root[data-theme=light] .message.error {
  background: rgba(198, 40, 40, 0.12);
  color: #7d1f1f;
}

:root[data-theme=light] .message.success {
  background: rgba(46, 125, 50, 0.12);
  color: #1f5c26;
}

.panel,
.stat-card {
  border-radius: 24px;
  padding: 1.2rem;
}

.tracker-panel {
  background: linear-gradient(145deg, rgba(198, 40, 40, 0.16), rgba(255, 255, 255, 0.02)), var(--color-bg-elevated);
}

.running-badge {
  color: var(--color-text-soft);
}

:root[data-theme=light] .tracker-panel {
  background: linear-gradient(145deg, rgba(198, 40, 40, 0.12), rgba(255, 255, 255, 0.52)), var(--color-bg-elevated);
}

.tracker-grid,
.form-grid,
.stats-grid,
.charts-grid,
.admin-grid {
  display: grid;
  gap: 1rem;
}

.range-grid {
  grid-template-columns: repeat(2, minmax(0, 220px));
}

.token-form {
  align-items: end;
  margin-bottom: 0.75rem;
}

.token-preview code {
  display: block;
  margin-top: 0.55rem;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.18);
  color: inherit;
  overflow-wrap: anywhere;
}

:root[data-theme=light] .token-preview code {
  background: rgba(23, 33, 42, 0.08);
}

.tracker-grid,
.form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.full-width {
  grid-column: 1/-1;
}

.stats-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stat-card {
  display: grid;
  gap: 0.35rem;
}

.stat-label {
  color: var(--color-text-soft);
}

.stat-value {
  font-size: clamp(1.4rem, 2vw, 2.2rem);
}

.charts-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.bars {
  display: grid;
  gap: 1rem;
}

.bar-row {
  display: grid;
  gap: 0.45rem;
}

.bar-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  color: var(--color-text-soft);
}

.bar-track {
  height: 12px;
  border-radius: 999px;
  background: var(--color-surface-soft);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
}

.donut-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 1rem;
  align-items: center;
}

.donut {
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
}

.donut-inner {
  width: 62%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--color-bg-elevated);
  display: grid;
  place-items: center;
  text-align: center;
}

.legend {
  display: grid;
  gap: 0.75rem;
}

.legend-item {
  align-items: center;
}

.legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 999px;
}

.table-like,
.history-card {
  display: grid;
  gap: 0.9rem;
}

.history-card {
  padding: 1rem;
  border-radius: 20px;
  background: var(--color-surface-soft);
}

.breakdown-card {
  gap: 1rem;
}

.compact-bars {
  gap: 0.7rem;
}

.history-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  color: var(--color-text-soft);
  font-size: 0.9rem;
}

.compact .history-row {
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--color-border);
}

.compact .history-row:last-child {
  border-bottom: 0;
}

.settings-row > div:last-child,
.settings-row > div:first-child {
  justify-items: start;
  text-align: left;
}

.editor {
  display: grid;
  gap: 1rem;
  margin-top: 0.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
}

.manual-entry-form {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.admin-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

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

.toggle input {
  width: auto;
}

.notification-matrix {
  display: grid;
  grid-template-columns: minmax(0, 1fr) repeat(var(--transport-count), minmax(4rem, auto));
  gap: 0.75rem 1rem;
  align-items: center;
  margin-top: 1rem;
}

.notification-matrix .matrix-row {
  display: contents;
}

.notification-matrix .matrix-head {
  color: var(--color-text-soft);
  font-size: 0.85rem;
  text-align: center;
}

.notification-matrix .matrix-label {
  display: grid;
  gap: 0.2rem;
  text-align: left;
}

.notification-matrix .matrix-label span {
  color: var(--color-text-soft);
  font-size: 0.9rem;
}

.notification-matrix .matrix-cell {
  display: flex;
  justify-content: center;
  cursor: pointer;
}

.notification-matrix input {
  width: 1.25rem;
  height: 1.25rem;
}

.push-devices {
  display: grid;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.primary,
.button-link.primary {
  background: linear-gradient(135deg, var(--color-accent), #ff7043);
  color: #fff7f2;
}

.danger {
  background: rgba(198, 40, 40, 0.18);
  color: #ffd6d2;
}

.ghost {
  background: var(--color-surface-soft);
  color: var(--color-text);
}

:root[data-theme=light] .danger {
  background: rgba(198, 40, 40, 0.14);
  color: #8d2323;
}

:root[data-theme=light] .ghost,
:root[data-theme=light] .theme-toggle,
:root[data-theme=light] .status-pill {
  background: rgba(23, 33, 42, 0.08);
  color: var(--color-text);
}

:root[data-theme=light] .nav-item {
  color: #1c2630;
}

:root[data-theme=light] .history-card,
:root[data-theme=light] .bar-track {
  background: rgba(23, 33, 42, 0.08);
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.6rem;
}

.pagination-pill {
  min-width: 8.5rem;
  justify-self: center;
  text-align: center;
}

.history-pagination {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
}

.history-pagination > :first-child {
  justify-self: start;
}

.history-pagination > :last-child {
  justify-self: end;
}

.token-list {
  margin-top: 0.35rem;
}

.function-list-item {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
}

.function-list-item > div {
  min-width: 0;
  display: grid;
  gap: 0.25rem;
}

.function-color-dot {
  width: 0.8rem;
  height: 0.8rem;
  margin-top: 0.25rem;
  border-radius: 999px;
  flex: 0 0 auto;
  box-shadow: 0 0 0 1px var(--color-border);
}

.color-input {
  min-height: 3.2rem;
  padding: 0.35rem;
}

.theme-toggle {
  min-width: 3rem;
  padding: 0.8rem 0.95rem;
  background: var(--color-surface-soft);
  color: var(--color-text);
  font-size: 1.15rem;
  line-height: 1;
}

.empty {
  color: var(--color-text-soft);
}

@media (max-width: 1080px) {
  .charts-grid,
  .admin-grid,
  .stats-grid,
  .donut-layout {
    grid-template-columns: 1fr;
  }
  .app-shell {
    grid-template-columns: 1fr;
    padding: 0.8rem;
  }
  .sidebar,
  .content,
  .hero-panel {
    border-radius: 22px;
    padding: 1.2rem;
  }
  .mobile-menu-button {
    display: inline-flex;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 40;
    width: 3.2rem;
    height: 3.2rem;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: var(--color-bg-elevated);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-panel);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
  }
  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 20;
    border: 0;
    padding: 0;
    background: rgba(7, 10, 14, 0.42);
  }
  .sidebar {
    position: fixed;
    top: 0.8rem;
    left: 0.8rem;
    bottom: 0.8rem;
    width: min(84vw, 320px);
    min-height: auto;
    z-index: 30;
    transform: translateX(calc(-100% - 1.2rem));
    transition: transform 180ms ease;
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  .content-shell {
    width: 100%;
    padding-top: 3.8rem;
  }
}
@media (max-width: 720px) {
  .tracker-grid,
  .form-grid,
  .range-grid {
    grid-template-columns: 1fr;
  }
  .topbar {
    align-items: start;
    flex-direction: column;
  }
  .history-row,
  .panel-header {
    flex-direction: column;
  }
  .history-row > div:last-child {
    width: 100%;
    justify-items: start;
    text-align: left;
  }
  .history-row > div:last-child .ghost,
  .history-row > div:last-child .danger,
  .history-row > div:last-child .primary {
    width: fit-content;
  }
  .history-meta {
    flex-direction: column;
    gap: 0.35rem;
  }
  .row-actions {
    width: 100%;
    justify-content: flex-start;
  }
}
/* ---------------------------------------------------------------------------
 * Schadensmeldung specific components
 * ------------------------------------------------------------------------- */
a {
  color: var(--color-warning);
}

code {
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 0.9em;
}

.panel {
  display: grid;
  gap: 1rem;
  align-content: start;
}

.panel-header {
  align-items: center;
}

.panel-copy {
  color: var(--color-text-soft);
}

.sidebar h1 {
  font-size: clamp(1.5rem, 2vw, 2.1rem);
  overflow-wrap: anywhere;
  hyphens: auto;
}

.admin-grid > div {
  display: grid;
  gap: 1rem;
  align-content: start;
  min-width: 0;
}

.admin-grid .history-row {
  flex-wrap: wrap;
}

.history-row > div:first-child {
  flex: 1 1 240px;
}

.history-row > div.function-list-item {
  display: flex;
}

.history-row > div.row-actions {
  display: flex;
  flex: 0 1 auto;
  max-width: 100%;
  flex-wrap: wrap;
  justify-items: initial;
}
.history-row > div.row-actions button {
  white-space: nowrap;
}

.field-label {
  display: block;
  color: var(--color-text-soft);
  font-size: 0.95rem;
  margin-bottom: 0.45rem;
}

.form-grid.single {
  grid-template-columns: 1fr;
}

.stats-grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.icon-button {
  padding: 0.6rem 0.8rem;
  line-height: 1;
}

.success-button {
  background: linear-gradient(135deg, #2e7d32, #43a047);
  color: #f1fff2;
}

.definition-grid {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.5rem 1.5rem;
  color: var(--color-text-soft);
}
.definition-grid strong {
  color: var(--color-text);
  overflow-wrap: anywhere;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-surface-soft);
  font-size: 0.8rem;
  white-space: nowrap;
}

.badge-dot {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 999px;
  flex: 0 0 auto;
}

.badge.priority-high {
  background: rgba(198, 40, 40, 0.28);
  border-color: rgba(239, 83, 80, 0.6);
}

.badge.priority-medium {
  background: rgba(249, 168, 37, 0.16);
  border-color: rgba(249, 168, 37, 0.4);
}

.badge.status-in_progress {
  background: rgba(21, 101, 192, 0.22);
  border-color: rgba(66, 165, 245, 0.5);
}

.badge.status-resolved {
  background: rgba(46, 125, 50, 0.22);
  border-color: rgba(102, 187, 106, 0.5);
}

/* Fault cards */
.fault-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1rem;
}

.fault-card {
  display: grid;
  gap: 0.65rem;
  align-content: start;
  padding: 1rem 1.1rem;
  border-radius: 20px;
  border: 1px solid var(--color-border);
  border-left: 6px solid var(--color-accent);
  background: var(--color-surface-soft);
  min-width: 0;
}
.fault-card h4 {
  margin: 0;
  font-size: 1.15rem;
  overflow-wrap: anywhere;
}
.fault-card.priority-border-high {
  box-shadow: 0 0 0 1px rgba(239, 83, 80, 0.45), 0 10px 30px rgba(198, 40, 40, 0.18);
}

.fault-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
}

.fault-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.fault-id {
  color: var(--color-text-soft);
  font-size: 0.85rem;
}

a.fault-id {
  text-decoration: none;
}
a.fault-id:hover {
  color: var(--color-text);
  text-decoration: underline;
}

.fault-device {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  color: var(--color-text);
  font-weight: 600;
}

.update-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.update-banner button {
  padding: 0.55rem 1rem;
}

.fault-assignees {
  margin: 0;
  color: var(--color-warning);
  font-size: 0.9rem;
  font-weight: 600;
}

.assignee-picker {
  display: grid;
  gap: 0.5rem;
}
.assignee-picker .assignee-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  color: var(--color-text-soft);
  font-size: 0.95rem;
}
.assignee-picker .small-button {
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
}
.assignee-picker .assignee-field {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  background: var(--color-surface-soft);
}
.assignee-picker .assignee-field:focus-within {
  border-color: var(--color-accent);
}
.assignee-picker .assignee-field input {
  flex: 1 1 12rem;
  width: auto;
  min-width: 8rem;
  border: 0;
  padding: 0.45rem 0.4rem;
  background: transparent;
  outline: none;
}
.assignee-picker .assignee-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.35rem 0.25rem 0.7rem;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-accent-soft);
  font-size: 0.9rem;
  white-space: nowrap;
}
.assignee-picker .assignee-chip button {
  display: inline-grid;
  place-items: center;
  width: 1.4rem;
  height: 1.4rem;
  padding: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--color-text-soft);
  font-size: 0.75rem;
}
.assignee-picker .assignee-chip button:hover {
  transform: none;
  background: var(--color-surface-soft);
  color: var(--color-text);
}
.assignee-picker .assignee-suggestions {
  margin: 0;
  padding: 0.3rem;
  list-style: none;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  background: var(--color-bg-elevated);
  box-shadow: var(--shadow-panel);
}
.assignee-picker .assignee-suggestions li {
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  cursor: pointer;
}
.assignee-picker .assignee-suggestions li.active {
  background: var(--color-accent-soft);
}
.assignee-picker .assignee-suggestions .assignee-hint {
  color: var(--color-text-soft);
  font-size: 0.85rem;
  cursor: default;
}
.assignee-picker .assignee-note {
  color: var(--color-text-soft);
}

.fault-description {
  color: var(--color-text-soft);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.resolution {
  display: grid;
  gap: 0.35rem;
  padding: 0.75rem 0.9rem;
  border-radius: 14px;
  background: rgba(46, 125, 50, 0.14);
}
.resolution p {
  white-space: pre-wrap;
  color: var(--color-text-soft);
}

.fault-actions {
  justify-content: flex-start;
}

.empty-state {
  display: grid;
  gap: 0.35rem;
  justify-items: center;
  padding: 2.5rem 1rem;
  border-radius: 20px;
  border: 1px dashed var(--color-border);
  color: var(--color-text-soft);
  text-align: center;
}
.empty-state strong {
  color: var(--color-text);
  font-size: 1.2rem;
}
.empty-state.large strong {
  font-size: 1.8rem;
}

.pagination-summary {
  text-align: center;
}

/* Filters, chips and tabs */
.filter-bar {
  display: grid;
  grid-template-columns: minmax(200px, 2fr) repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem;
  align-items: end;
}

.filter-reset {
  white-space: nowrap;
  justify-self: start;
  align-self: end;
}

.type-chips,
.tab-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.type-chip,
.tab {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.6rem 1rem;
  border-radius: 999px;
  background: var(--color-surface-soft);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}
.type-chip.active,
.tab.active {
  background: linear-gradient(135deg, var(--color-accent), #ff7043);
  color: #fff7f2;
  border-color: transparent;
}

.type-chip.active[style] {
  background: var(--choice-color);
}

.chip-count {
  min-width: 1.6rem;
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.22);
  font-size: 0.85rem;
  text-align: center;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.6rem;
}

.choice {
  display: grid;
  gap: 0.25rem;
  text-align: left;
  color: var(--color-text);
  background: var(--color-surface-soft);
  border: 2px solid var(--color-border);
  border-left: 6px solid var(--choice-color, var(--color-accent));
}
.choice span {
  color: var(--color-text-soft);
  font-size: 0.85rem;
}
.choice.active {
  border-color: var(--choice-color, var(--color-accent));
  background: color-mix(in srgb, var(--choice-color, var(--color-accent)) 22%, transparent);
}

/* Modal */
body.modal-open {
  overflow: hidden;
}

.modal-layer {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: rgba(7, 10, 14, 0.6);
  cursor: default;
}
.modal-backdrop:hover {
  transform: none;
}

.modal {
  position: relative;
  width: min(100%, 560px);
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  background: var(--color-bg);
  background-image: linear-gradient(var(--color-bg-elevated), var(--color-bg-elevated));
}
.modal.wide {
  width: min(100%, 820px);
}

/* Public dashboard (kiosk) */
.kiosk-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto auto auto auto 1fr auto;
  gap: 1rem;
  padding: 1.2rem;
}

.kiosk-header {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  align-items: center;
  gap: 1.5rem;
}
.kiosk-header h1 {
  margin-top: 0.4rem;
  font-size: clamp(1.8rem, 3vw, 2.8rem);
  line-height: 1;
}

.kiosk-subtitle {
  display: block;
  margin-top: 0.35rem;
  color: var(--color-text-soft);
}

.kiosk-header-stats {
  display: flex;
  gap: 1rem;
}

.kiosk-counter {
  display: grid;
  justify-items: center;
  min-width: 6.5rem;
  padding: 0.6rem 1rem;
  border-radius: 18px;
  background: var(--color-surface-soft);
}
.kiosk-counter strong {
  font-size: 2.4rem;
  line-height: 1;
}
.kiosk-counter span {
  color: var(--color-text-soft);
  font-size: 0.85rem;
}
.kiosk-counter.accent strong {
  color: #ef5350;
}
.kiosk-counter.warning strong {
  color: var(--color-warning);
}

.kiosk-clock {
  display: grid;
  justify-items: end;
}
.kiosk-clock strong {
  font-size: 2.4rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.kiosk-clock span {
  color: var(--color-text-soft);
}

.kiosk-create {
  font-size: 1.2rem;
  padding: 1.1rem 1.6rem;
}

.kiosk-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.kiosk-toolbar .tab {
  font-size: 1.05rem;
  padding: 0.8rem 1.3rem;
}

.kiosk-search {
  width: min(100%, 360px);
}

.kiosk-content {
  display: grid;
  gap: 1rem;
  align-content: start;
}

.kiosk-grid {
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
}

.fault-card.large h4 {
  font-size: 1.35rem;
}
.fault-card.large .fault-actions button {
  font-size: 1.1rem;
  padding: 1rem 1.6rem;
}

.kiosk-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  color: var(--color-text-soft);
  font-size: 0.9rem;
}

.kiosk-message {
  font-size: 1.1rem;
}

@media (max-width: 1080px) {
  .stats-grid.four {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .kiosk-header {
    grid-template-columns: 1fr auto;
  }
  .kiosk-create {
    grid-column: 1/-1;
  }
  .kiosk-header-stats {
    grid-column: 1/-1;
    order: 3;
  }
}
@media (max-width: 720px) {
  .filter-bar {
    grid-template-columns: 1fr;
  }
  .fault-grid,
  .kiosk-grid {
    grid-template-columns: 1fr;
  }
  .kiosk-shell {
    padding: 0.8rem;
  }
  .kiosk-clock {
    display: none;
  }
  .kiosk-header {
    grid-template-columns: 1fr;
  }
  .definition-grid {
    grid-template-columns: 1fr;
    gap: 0.15rem;
  }
  .definition-grid strong {
    margin-bottom: 0.5rem;
  }
}
.group-list {
  font-size: 0.85rem;
  overflow-wrap: anywhere;
}

.checkbox-group {
  display: grid;
  gap: 0.6rem;
  margin: 0;
  padding: 0.9rem 1rem;
  border: 1px solid var(--color-border);
  border-radius: 14px;
}
.checkbox-group legend {
  padding: 0 0.4rem;
  color: var(--color-text-soft);
  font-size: 0.95rem;
}
.checkbox-group small {
  color: var(--color-text-soft);
}

.membership-list {
  display: grid;
  gap: 0.45rem;
}
.membership-list > div {
  display: grid;
  gap: 0.1rem;
}
.membership-list span {
  font-size: 0.9rem;
}

.barcode {
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.mpfeuer-transfer {
  display: grid;
  gap: 0.5rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--color-border);
  border-radius: 14px;
}

.mpfeuer-device,
.mpfeuer-reference {
  color: var(--color-text-soft);
  font-size: 0.9rem;
}

.lookup-hint {
  color: var(--color-text-soft);
  font-size: 0.85rem;
}
.lookup-hint.success {
  color: #81c784;
}

:root[data-theme=light] .lookup-hint.success {
  color: #2e7d32;
}

.form-grid > label {
  align-content: start;
}

.mapping-section {
  display: grid;
  gap: 0.6rem;
}

.mapping-results {
  max-height: 320px;
  overflow-y: auto;
}