:root {
  /* DEPLOY_MARKER: sanitaer-portal-tokenhash-20260917-05 */
  --ink: #152320;
  --muted: #4a5f5f;
  --line: #d5e6e2;
  --panel: #ffffff;
  --wash: #e8f1ed;
  --accent: #08796d;
  --accent-dark: #075e55;
  --warm: #a85b10;
  --water-top: #c4ede6;
  --water-mid: #9fd9e1;
  --water-deep: #64a0d8;
  --glass: rgba(255, 255, 255, 0.82);
  --glass-strong: rgba(255, 255, 255, 0.94);
  --shadow: 0 20px 55px rgba(3, 16, 24, 0.45);
  --radius: 8px;
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: linear-gradient(180deg, #f1f5f7 0%, #e6ecf0 100%);
  overflow-x: hidden;
}

/* Wasserhintergrund nur auf der Anmeldeseite */
.login-shell::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background: url('hintergrund.png') center / cover no-repeat;
}

.login-shell,
.workspace {
  position: relative;
  z-index: 2;
}

button,
input,
select {
  font: inherit;
}

.login-shell {
  width: min(1120px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 40px 0;
}

.auth-card {
  width: 460px;
  max-width: 100%;
}

.auth-card-logo {
  display: flex;
  justify-content: center;
  margin: -12px 0 6px;
}

.login-logo {
  display: block;
  width: 100%;
  max-width: 300px;
  max-height: 84px;
  object-fit: contain;
  object-position: center;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent-dark);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.12;
}

h2 {
  font-size: 1.55rem;
}

.auth-card {
  background: var(--glass);
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 14px;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.55);
  -webkit-backdrop-filter: blur(14px) saturate(1.25);
  backdrop-filter: blur(14px) saturate(1.25);
}

.work-card,
.metric-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(21, 35, 32, 0.05), 0 8px 24px rgba(21, 35, 32, 0.06);
}

.auth-card,
.work-card {
  padding: 28px;
}

.card-heading {
  margin-bottom: 22px;
}

.form-stack,
.create-user-form {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 6px;
  color: #40524d;
  font-size: 0.84rem;
  font-weight: 800;
}

input,
select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 38px;
  border: 1px solid rgba(120, 165, 175, 0.55);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  padding: 8px 11px;
  font-weight: 650;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
  transition: border-color 0.14s ease, box-shadow 0.14s ease, background 0.14s ease;
}

input:focus,
select:focus {
  border-color: var(--accent);
  background: #fff;
  outline: 0;
  box-shadow: 0 0 0 3px rgba(8, 121, 109, 0.13);
}

input:hover,
select:hover {
  border-color: #aebfba;
}

button,
.primary-link,
.text-action {
  border: 0;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  padding: 13px 16px;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

button:hover,
.primary-link:hover,
.text-action:hover {
  background: var(--accent-dark);
}

.secondary {
  background: rgba(255, 255, 255, 0.5);
  color: var(--accent-dark);
  border: 1px solid rgba(120, 165, 175, 0.55);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.secondary:hover {
  background: rgba(255, 255, 255, 0.75);
}

.hint,
.muted {
  color: var(--muted);
}

.auth-alt {
  margin-top: 16px;
  text-align: center;
}

.auth-link {
  border: 0;
  background: transparent;
  color: var(--accent-dark);
  font-weight: 800;
  font-size: 0.9rem;
  padding: 4px 6px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  border-radius: 6px;
}

.auth-link:hover,
.auth-link:focus-visible {
  color: var(--accent);
  background: rgba(8, 121, 109, 0.08);
  outline: none;
}

#resetForm {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid rgba(120, 165, 175, 0.35);
}

.message {
  min-height: 1.4em;
  margin: 16px 0 0;
  color: var(--accent-dark);
  font-weight: 700;
}

.message.error {
  color: #9b2c2c;
}

/* ── Bestätigungsschritt beim Passwort-Reset (Token-Hash-Flow) ───── */
/*
 * Der Nutzer muss den Reset-Link aktiv anklicken, damit das Einmal-Token
 * nicht schon durch einen Link-Scanner des Mailanbieters verbraucht wird.
 */
#confirmForm {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid rgba(120, 165, 175, 0.35);
}

.confirm-note {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.5;
}

/* ── Bestell-/Anfragen-Liste ─────────────────────────────────────── */
.order-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.order-badge.entwurf {
  background: #eef1f4;
  color: #4a5568;
}
.order-badge.bestellt {
  background: #e4f0fd;
  color: #1a4f8b;
}
.order-badge.auftrag {
  background: #e5f5ec;
  color: #1b6b46;
}
.order-badge.abgeschlossen {
  background: #d4ede0;
  color: #14532d;
}
.order-badge.abgelehnt {
  background: #fdecec;
  color: #9b2c2c;
}
.order-badge.geloescht {
  background: #f1f1f1;
  color: #8a8a8a;
  text-decoration: line-through;
}

.table-btn {
  display: inline-block;
  padding: 5px 9px;
  margin: 2px 4px 2px 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--accent-dark);
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
  white-space: nowrap;
}
.table-btn:hover {
  border-color: var(--accent);
  background: #f0faf7;
}
.table-btn-danger {
  color: #9b2c2c;
}
.table-btn-danger:hover {
  border-color: #d8a0a0;
  background: #fdf2f2;
}
.table-actions {
  white-space: nowrap;
}
.table-select {
  padding: 5px 6px;
  margin: 2px 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font-size: 0.8rem;
  color: var(--ink);
  width: auto;
  min-width: 130px;
}

.order-detail-list {
  display: grid;
  grid-template-columns: minmax(130px, auto) 1fr;
  gap: 6px 18px;
  margin: 12px 0;
  max-width: 720px;
}
.order-detail-list div {
  display: contents;
}
.order-detail-list dt {
  font-weight: 700;
  color: var(--muted);
  font-size: 0.85rem;
}
.order-detail-list dd {
  margin: 0;
  font-size: 0.92rem;
}

.hidden {
  display: none !important;
}

/* Kunden-Ansicht: interne Übersichts-Elemente ausblenden & Layout anpassen */
body.customer-mode #overviewMetrics,
body.customer-mode #overviewMetrics.metric-grid {
  display: none;
}

body.customer-mode .content-grid {
  grid-template-columns: 1fr;
}

.workspace {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  grid-template-rows: auto 1fr;
}

.sidebar {
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
  display: flex;
  flex-direction: column;
  gap: 22px;
  border-right: 1px solid var(--line);
  background: #ffffff;
  padding: 22px 18px;
}

.sidebar-brand {
  display: flex;
  justify-content: center;
  padding: 14px 10px;
  margin: -6px -6px 0;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #f6f9f8;
}

.sidebar-logo {
  width: 100%;
  max-width: 220px;
  height: auto;
  object-fit: contain;
}

.side-nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  display: block;
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  padding: 12px 13px;
  text-align: left;
  text-decoration: none;
  font-weight: 800;
}

.nav-item:hover,
.nav-item.active {
  border-color: #d9e9e5;
  background: var(--wash);
  color: var(--accent-dark);
}

/* Topbar (Microsoft-Stil) */
.topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 22px;
  height: 56px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 40;
}

.topbar-title {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
}

.topbar-title strong {
  font-size: 1rem;
  white-space: nowrap;
}

.topbar-title span {
  color: var(--muted);
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-user {
  position: relative;
  display: flex;
  align-items: center;
}

/* Avatar (Microsoft-Stil) */
.avatar-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: transparent;
  padding: 4px 6px;
  border-radius: 999px;
  cursor: pointer;
  color: var(--ink);
}

.avatar-btn:hover,
.avatar-btn[aria-expanded="true"] {
  background: var(--wash);
}

.avatar-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0d5c52 0%, #07433b 100%);
  color: #ffffff;
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  user-select: none;
  text-transform: uppercase;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.avatar-caret {
  font-size: 0.75rem;
  color: var(--muted);
}

/* Dropdown-Menü */
.account-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 300px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(21, 35, 32, 0.12), 0 12px 32px rgba(21, 35, 32, 0.1);
  padding: 8px;
  z-index: 60;
}

.account-menu-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 10px 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 6px;
}

.account-menu-head .avatar-circle {
  width: 46px;
  height: 46px;
  font-size: 1.15rem;
}

.account-menu-head strong,
.account-menu-head div span {
  display: block;
}

.account-menu-head div span {
  color: var(--muted);
  font-size: 0.85rem;
}

.menu-item {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  padding: 11px 12px;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
}

.menu-item:hover,
.menu-item:focus-visible {
  background: var(--wash);
  outline: none;
}

.menu-item-danger {
  color: #9b2c2c;
}

.menu-item-danger:hover {
  background: #fdecec;
}

.menu-divider {
  height: 1px;
  background: var(--line);
  margin: 6px 4px;
}

.dev-view-row {
  padding: 8px 12px 12px;
}

.dev-view-label {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

.segmented {
  display: flex;
  gap: 4px;
  background: #eef2f1;
  border-radius: 9px;
  padding: 3px;
}

.seg-btn {
  flex: 1;
  border: 0;
  background: transparent;
  border-radius: 7px;
  padding: 7px 4px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 800;
  color: #40524d;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease;
}

.seg-btn:hover {
  color: #14532d;
}

.seg-btn.active {
  background: #ffffff;
  color: #14532d;
  box-shadow: 0 1px 3px rgba(21, 35, 32, 0.18);
}

.workarea {
  width: min(1240px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.work-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
  margin-bottom: 24px;
}

.work-header h1 {
  font-size: clamp(2rem, 3vw, 3rem);
}

.metric-grid,
.content-grid {
  display: grid;
  gap: 16px;
}

.metric-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 16px;
}

#ordersStatusTiles.metric-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metric-card {
  padding: 20px;
}

.metric-card span {
  display: block;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 10px;
}

.metric-card strong {
  font-size: 1.8rem;
}

.metric-tile {
  appearance: none;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.metric-tile:hover {
  border-color: var(--accent, #1b7a4b);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(21, 35, 32, 0.1);
}
.metric-tile.active {
  border-color: var(--accent, #1b7a4b);
  background: #f0faf4;
}
.metric-tile.active strong,
.metric-tile.active span {
  color: #14532d;
}

.content-grid {
  grid-template-columns: 1fr 1fr;
}

.work-card p {
  color: var(--muted);
}

.text-action {
  display: inline-block;
  margin-top: 8px;
}

.create-user-form {
  gap: 16px;
}

.form-section {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcfc;
  margin: 0;
  padding: 18px;
}

.form-section:first-of-type {
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.form-section legend {
  width: auto;
  margin: 0;
  padding: 0 8px;
  background: transparent;
  color: var(--accent-dark);
  font-size: 0.8rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.form-section legend + * {
  margin-top: 8px;
}

.field-note {
  grid-column: 1 / -1;
  margin: 4px 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.admin-grid,
.address-grid {
  display: grid;
  gap: 16px 20px;
  align-items: start;
}

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

.address-grid {
  grid-template-columns: minmax(0, 1fr) 150px;
  gap: 16px 20px;
}

.address-grid label {
  min-width: 0;
}

.street-field {
  grid-column: 1 / 2;
}

.house-field {
  grid-column: 2 / 3;
}

.postal-field {
  grid-column: 1 / 2;
  max-width: 190px;
}

.city-field {
  grid-column: 2 / 3;
}

.admin-grid .wide,
.form-actions {
  grid-column: 1 / -1;
}

.toggle-line {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 8px 11px;
  color: var(--ink);
}

.toggle-line input {
  min-height: auto;
  width: 18px;
  height: 18px;
  padding: 0;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  padding-top: 20px;
}

.form-actions button {
  min-width: 240px;
}

/* Kalkulations-Panel im Portal – nahtlos integriert */
.calc-frame {
  display: block;
  width: 100%;
  height: auto;
  min-height: 0;
  border: 0;
  background: transparent;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.calc-frame.loaded {
  opacity: 1;
}

/* Listen: Kopf, Werkzeuge, Tabellen */
.list-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}

.list-heading h2 {
  font-size: 1.4rem;
}

.list-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.list-tools input[type="search"] {
  min-width: 260px;
}

.list-tools select {
  width: auto;
  min-width: 150px;
}

.list-tools button {
  white-space: nowrap;
  padding: 10px 14px;
  min-height: 38px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  margin-top: 4px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table th,
.data-table td {
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid #e7efec;
}

.data-table thead th {
  background: #f4f9f7;
  color: var(--accent-dark);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr:hover td {
  background: #f8fcfa;
}

.data-table td.num,
.data-table th.num {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.data-table .table-empty {
  text-align: center;
  color: var(--muted);
  padding: 26px 12px;
}

.data-table .cell-main {
  font-weight: 800;
  color: var(--ink);
}

.data-table .cell-sub {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.role-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.role-badge.kunde {
  background: #e4f0fd;
  color: #1a4f8b;
}

.role-badge.mitarbeiter {
  background: #e5f5ec;
  color: #1b6b46;
}

.role-badge.admin {
  background: #f3ead9;
  color: #7a5410;
}

.muted-note {
  color: var(--muted);
  font-size: 0.85rem;
}

/* Dialog: Passwort direkt setzen (Admin) */
.dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(3, 16, 24, 0.45);
}

.dialog-card {
  width: 440px;
  max-width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

.dialog-card h2 {
  margin: 4px 0 0;
  font-size: 1.3rem;
}

.dialog-card .field-note {
  margin: 10px 0 4px;
}

.dialog-field {
  display: block;
  margin: 12px 0;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
}

.dialog-field input {
  display: block;
  width: 100%;
  margin-top: 5px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 400;
}

.dialog-card .form-actions {
  margin-top: 16px;
  gap: 10px;
}

.dialog-card .form-actions button {
  min-width: 0;
}

@media (max-width: 920px) {
  .login-shell {
    justify-content: center;
    align-items: start;
    padding-top: 24px;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .account-menu {
    position: absolute;
    right: 0;
    width: 300px;
    box-shadow: 0 4px 16px rgba(21, 35, 32, 0.12), 0 12px 32px rgba(21, 35, 32, 0.1);
  }

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

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

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

  .street-field,
  .city-field {
    grid-column: 1 / -1;
  }

  .house-field {
    grid-column: 1 / span 3;
  }

  .postal-field {
    grid-column: 4 / span 3;
  }
}

@media (max-width: 680px) {
  .login-shell,
  .workarea {
    width: min(100% - 20px, 1120px);
    padding-top: 20px;
  }

  .auth-card,
  .work-card {
    padding: 20px;
  }

  .work-header,
  .metric-grid,
  .content-grid,
  .side-nav {
    grid-template-columns: 1fr;
  }

  #ordersStatusTiles.metric-grid {
    grid-template-columns: 1fr;
  }

  .admin-grid {
    grid-template-columns: 1fr;
  }

  .address-grid {
    grid-template-columns: 1fr;
  }

  .form-actions button {
    width: 100%;
  }

  .work-header {
    display: grid;
  }
}
