:root {
  --ink: #1E2A28;
  --paper: #F1F4F1;
  --panel: #FFFFFF;
  --teal: #2F5D57;
  --teal-deep: #1E3E39;
  --amber: #C97B2E;
  --amber-deep: #8F5518;
  --warn: #B3261E;
  --warn-bg: #FBEAE8;
  --ok: #3F7D5C;
  --border: #DDE3DD;
  --muted: #5B6B66;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Public Sans", system-ui, sans-serif;
  background: var(--paper);
  color: var(--ink);
}

h1, h2 {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ---------------- Navigation ---------------- */

.nav-rail {
  width: 220px;
  flex-shrink: 0;
  background: var(--teal);
  color: #EAF2EF;
  padding: 1.6rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0 0.4rem;
}

.brand-mark {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--amber);
  display: inline-block;
}

.brand-name {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.25rem;
  font-weight: 600;
}

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.nav-list a {
  display: block;
  padding: 0.55rem 0.7rem;
  border-radius: 6px;
  color: #CFE1DB;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  transition: background-color 0.15s ease;
}

.nav-list a:hover {
  background: rgba(255, 255, 255, 0.08);
}

.nav-list a.active {
  background: var(--amber);
  color: #241505;
}

.nav-list--upcoming a {
  color: #9FB6AF;
  font-style: italic;
}

.nav-list--upcoming a.active {
  background: rgba(201, 123, 46, 0.35);
  color: #F1E4D4;
  font-style: normal;
}

.nav-divider {
  margin-top: 0.4rem;
  padding: 0 0.7rem;
  font-size: 0.75rem;
  color: #8FA69F;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding-top: 0.8rem;
}

/* ---------------- Content ---------------- */

.content {
  flex: 1;
  padding: 2.2rem 2.6rem 4rem;
  max-width: 980px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.view-header {
  margin-bottom: 1.4rem;
}

.view-header--with-actions {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.header-actions {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
  align-items: center;
  padding-top: 0.3rem;
}

.icon-btn {
  width: 1.8rem;
  height: 1.8rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  line-height: 1;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 6px;
}

.icon-btn:hover {
  border-color: var(--teal);
  color: var(--teal);
  background: transparent;
}

.view-header h1 {
  font-size: 2rem;
}

.view-lede {
  margin: 0.35rem 0 0;
  color: var(--muted);
  max-width: 60ch;
}

.actions {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 0.7rem;
}

button {
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--ink);
  border-radius: 6px;
  padding: 0.5rem 0.95rem;
  font-size: 0.9rem;
  font-family: inherit;
}

button:hover {
  border-color: var(--teal);
}

button.primary {
  background: var(--amber);
  border-color: var(--amber-deep);
  color: #2A1704;
  font-weight: 600;
}

button.primary:hover {
  background: var(--amber-deep);
  color: #FCEFDD;
}

/* ---------------- Tabellen ---------------- */

.col-settings {
  position: relative;
}

.col-settings-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 40;
  min-width: 250px;
  max-height: 340px;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.16);
  padding: 0.6rem 0.7rem;
  display: none;
}

.col-settings-panel.open {
  display: block;
}

.col-settings-title {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
}

.col-settings-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.2rem;
  font-size: 0.85rem;
  color: var(--ink);
  cursor: pointer;
}

.col-settings-item input {
  width: auto;
  margin: 0;
}

.col-settings-fixed {
  color: var(--muted);
  cursor: default;
}

.col-hidden {
  display: none;
}

/* Ansicht-Umschalter im Zahnrad-Menü */
.col-settings-section {
  border-top: 1px solid var(--border);
  margin-top: 0.5rem;
  padding-top: 0.5rem;
}

.col-settings-viewmode {
  display: flex;
  gap: 0.3rem;
  margin-top: 0.3rem;
}

.col-settings-viewmode button {
  flex: 1;
  padding: 0.35rem 0.5rem;
  font-size: 0.82rem;
}

.col-settings-viewmode button.active {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}

/* Sortierbare Spaltenköpfe */
.data-table th[data-col] {
  cursor: pointer;
  user-select: none;
}

.data-table th[data-col]:hover {
  color: var(--ink);
}

.sort-arrow {
  font-size: 0.7rem;
  color: var(--teal);
  margin-left: 0.2rem;
}

/* Gruppen-Zeile (nach Arzt gruppiert) */
.group-row td {
  background: #EAF0EE;
  font-weight: 700;
  color: var(--teal-deep);
  font-family: "Fraunces", Georgia, serif;
  font-size: 0.95rem;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.88rem;
}

.data-table th, .data-table td {
  text-align: left;
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid var(--border);
}

.data-table th {
  background: #F6F8F6;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.8rem;
}

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

.data-table tr.needs-review {
  background: var(--warn-bg);
}

/* Dringlichkeits-Farben der Zeilen in der Uebersicht */
.data-table tr.sev-urgent {
  background: var(--warn-bg);
}

.data-table tr.sev-setup {
  background: #FBF3E6;
}

/* Status-Badge (Zaehler) in der Uebersicht */
.status-cell {
  position: relative;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  height: 1.5rem;
  padding: 0 0.4rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  border: none;
}

.status-badge--ok {
  background: #E4F0EA;
  color: var(--ok);
}

.status-badge--urgent {
  background: var(--warn);
  color: #fff;
  cursor: pointer;
}

.status-badge--setup {
  background: var(--amber);
  color: #2A1704;
  cursor: pointer;
}

.status-badge--urgent:hover,
.status-badge--setup:hover {
  filter: brightness(0.93);
}

.issue-list {
  list-style: none;
  margin: 0;
  padding: 0.6rem 0.8rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.14);
  /* Immer schwebend ueber der Tabelle - Hover UND Klick verschieben das
     Layout nie. Feste, komfortable Breite mit Zeilenumbruch im Text. */
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 30;
  width: 320px;
  max-width: 80vw;
  display: none;
  text-align: left;
}

/* Beim Hovern ueber die Status-Zelle einblenden, oder wenn per Klick fixiert. */
.status-cell:hover .issue-list,
.issue-list.pinned {
  display: block;
}

.issue {
  font-size: 0.82rem;
  line-height: 1.4;
  padding: 0.25rem 0 0.25rem 0.9rem;
  position: relative;
  color: var(--ink);
}

.issue::before {
  content: "•";
  position: absolute;
  left: 0.2rem;
}

.issue--urgent::before {
  color: var(--warn);
}

.issue--setup::before {
  color: var(--amber);
}

.status-ok {
  color: var(--ok);
  font-weight: 600;
}

.status-warn {
  color: var(--warn);
  font-weight: 600;
}

/* ---------------- Formulare ---------------- */

.panel-block {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.2rem 1.4rem;
  margin-top: 1.6rem;
}

.panel-block h2 {
  font-size: 1.15rem;
  margin-bottom: 1rem;
}

form {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.8rem 1rem;
  align-items: end;
}

label {
  display: flex;
  flex-direction: column;
  font-size: 0.83rem;
  color: var(--muted);
  gap: 0.25rem;
}

input, select {
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.9rem;
  font-family: inherit;
}

form button {
  grid-column: 1 / -1;
  justify-self: start;
}

.form-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 0.6rem;
}

.form-hint {
  grid-column: 1 / -1;
  margin: 0.2rem 0 0;
  font-size: 0.83rem;
  color: var(--muted);
  font-style: italic;
}

/* Checkbox-Label (Wochenende) */
.checkbox-label {
  flex-direction: row;
  align-items: center;
}

.checkbox-label .label-row {
  align-items: center;
}

.checkbox-label input[type="checkbox"] {
  width: auto;
  margin: 0 0.2rem 0 0;
}

/* Urlaubsverwaltung im Arzt-Formular */
.vacations-field {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.83rem;
  color: var(--muted);
}

.vacations-list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.vacations-empty {
  margin: 0;
  font-style: italic;
}

.vacation-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: #F6F8F6;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.35rem 0.6rem;
  color: var(--ink);
  font-size: 0.85rem;
  width: fit-content;
}

.vacation-item button {
  padding: 0.2rem 0.5rem;
  font-size: 0.78rem;
  color: var(--warn);
  border-color: var(--border);
}

.vacations-add {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.vacations-add input {
  width: auto;
}

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

/* E-Mail-Vorlage im Arzt-Formular (aufklappbar) */
.email-template-field {
  grid-column: 1 / -1;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #F6F8F6;
  padding: 0;
}

.email-template-field > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink);
  user-select: none;
}

.email-template-field > summary::-webkit-details-marker {
  display: none;
}

/* Dreieck-Symbol vor dem Titel, dreht sich beim Aufklappen. */
.email-template-field > summary::before {
  content: "▶";
  font-size: 0.7rem;
  color: var(--muted);
  transition: transform 0.15s ease;
}

.email-template-field[open] > summary::before {
  transform: rotate(90deg);
}

.email-summary-title {
  flex-shrink: 0;
}

.email-summary-hint {
  font-weight: 400;
  font-size: 0.8rem;
  color: var(--muted);
}

.email-template-field[open] .email-summary-hint {
  display: none;
}

.email-template-body {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 0 1rem 1rem;
}

.email-template-field label.stacked {
  color: var(--muted);
}

.email-template-field textarea {
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: "Public Sans", system-ui, sans-serif;
  font-size: 0.9rem;
  color: var(--ink);
  resize: vertical;
  line-height: 1.5;
  background: var(--panel);
}

.email-template-field input[type="text"] {
  background: var(--panel);
}

.template-hint {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.template-hint code {
  background: var(--panel);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.82rem;
  color: var(--teal-deep);
}

.form-actions button {
  grid-column: auto;
}

/* ---------------- Status & Aktionen (Medikamente) ---------------- */

.badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}

.badge-active {
  background: #E4F0EA;
  color: var(--ok);
}

.badge-inactive {
  background: #EFEFEF;
  color: var(--muted);
}

.row-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.row-actions button {
  padding: 0.3rem 0.6rem;
  font-size: 0.8rem;
}

/* ---------------- Aktionen-Dropdown ---------------- */

.action-menu {
  position: relative;
  display: inline-block;
}

.action-menu-trigger {
  padding: 0.3rem 0.6rem;
  font-size: 0.95rem;
  line-height: 1;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.action-menu-list {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 30;
  min-width: 190px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.16);
  padding: 0.3rem;
  display: none;
  flex-direction: column;
  gap: 0.1rem;
}

.action-menu.open .action-menu-list {
  display: flex;
}

.action-menu-list button {
  all: unset;
  cursor: pointer;
  padding: 0.5rem 0.7rem;
  border-radius: 5px;
  font-size: 0.85rem;
  color: var(--ink);
  white-space: nowrap;
}

.action-menu-list button:hover {
  background: #F1F4F1;
}

.action-menu-list button.danger {
  color: var(--warn);
}

.action-menu-list button.danger:hover {
  background: var(--warn-bg);
}

.masked {
  color: #A7B3AE;
}

.revealed {
  display: none;
}

tr.show-details .revealed {
  display: inline;
}

tr.show-details .masked {
  display: none;
}

/* ---------------- Dialog (Reaktivieren) ---------------- */

dialog {
  border: none;
  border-radius: 10px;
  padding: 1.5rem 1.7rem;
  max-width: 26rem;
  width: 90vw;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
}

dialog::backdrop {
  background: rgba(30, 42, 40, 0.45);
}

dialog h2 {
  font-size: 1.2rem;
  margin-bottom: 0.4rem;
}

#reactivate-form {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

#reactivate-form .form-actions {
  display: flex;
  gap: 0.6rem;
}

/* ---------------- Hilfe-Tooltips ---------------- */

.label-row {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.th-help {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.help-icon {
  all: unset;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--border);
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  font-family: inherit;
  cursor: help;
  position: relative;
  flex-shrink: 0;
}

.help-icon:hover,
.help-icon:focus-visible {
  background: var(--teal);
  color: #fff;
}

.help-icon:hover::after,
.help-icon:focus-visible::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 0;
  bottom: 135%;
  width: 230px;
  background: var(--ink);
  color: #F1F4F1;
  padding: 0.55rem 0.7rem;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 400;
  line-height: 1.45;
  white-space: normal;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
  z-index: 20;
}

/* In Tabellenüberschriften klappt der Tooltip nach UNTEN auf, sonst wird er
   vom overflow:hidden der Tabelle (abgerundete Ecken) oben abgeschnitten. */
.th-help .help-icon:hover::after,
.th-help .help-icon:focus-visible::after {
  bottom: auto;
  top: 135%;
}

::placeholder {
  color: #A7B3AE;
}

.status-line {
  min-height: 1.2rem;
  margin: 0.5rem 0 0.8rem;
  font-size: 0.88rem;
}

.status-line.error {
  color: var(--warn);
}

.status-line.success {
  color: var(--ok);
}

/* ---------------- Einstellungen ---------------- */
.settings-block {
  max-width: 620px;
}

.settings-block h2 {
  font-size: 1.15rem;
  margin-bottom: 0.7rem;
}

.settings-hint {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0 0 0.7rem;
}

.settings-time-label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  max-width: 12rem;
  font-size: 0.9rem;
}

/* ---------------- Zaehler-Badge (Nav / Tab) ---------------- */
.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.15rem;
  height: 1.15rem;
  padding: 0 0.35rem;
  margin-left: 0.35rem;
  border-radius: 999px;
  background: var(--warn);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  vertical-align: middle;
}

/* Wichtig: ein Element mit CSS-'display' ignoriert das HTML-Attribut 'hidden'.
   Deshalb verstecken wir das Badge ueber eine eigene Klasse, die staerker ist. */
.nav-badge[hidden] {
  display: none;
}

/* ---------------- Mail-Seite ---------------- */

.mail-tabs {
  display: flex;
  gap: 0.3rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}

.mail-tab {
  border: none;
  background: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 0.5rem 0.9rem;
  font-size: 0.92rem;
  color: var(--muted);
  margin-bottom: -1px;
}

.mail-tab:hover {
  color: var(--ink);
  border-color: var(--border);
}

.mail-tab.active {
  color: var(--teal);
  border-color: var(--teal);
  font-weight: 600;
}

.mail-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 720px;
}

.mail-empty {
  color: var(--muted);
  font-style: italic;
}

.mail-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.mail-card-summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.9rem 1.2rem;
  user-select: none;
}

.mail-card-summary::-webkit-details-marker {
  display: none;
}

.mail-card-summary::before {
  content: "▶";
  position: absolute;
  margin-left: -1rem;
  font-size: 0.7rem;
  color: var(--muted);
  transition: transform 0.15s ease;
}

.mail-card[open] .mail-card-summary::before {
  transform: rotate(90deg);
}

.mail-card-summary:hover {
  background: #F6F8F6;
}

.mail-summary-subject {
  font-weight: 600;
  color: var(--ink);
  font-size: 0.95rem;
}

.mail-summary-meta {
  font-size: 0.8rem;
  color: var(--muted);
}

.mail-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  padding: 0 1.2rem 1.1rem;
}

.mail-card-meta {
  font-size: 0.82rem;
  color: var(--muted);
}

.mail-card .mail-subject,
.mail-card .mail-body {
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: "Public Sans", system-ui, sans-serif;
  font-size: 0.9rem;
  color: var(--ink);
}

.mail-card .mail-body {
  resize: vertical;
  line-height: 1.5;
}

.mail-card-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.mail-card-actions .danger {
  color: var(--warn);
  border-color: var(--border);
}

.mail-card--readonly {
  background: #F6F8F6;
}

.mail-readonly-subject {
  font-weight: 600;
  color: var(--ink);
}

.mail-readonly-body {
  margin: 0;
  font-family: "Public Sans", system-ui, sans-serif;
  font-size: 0.88rem;
  color: var(--ink);
  white-space: pre-wrap;
  line-height: 1.5;
}

/* ---------------- Demnächst-Karten ---------------- */
.upcoming-card {
  background: var(--panel);
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 1.4rem 1.6rem;
  max-width: 60ch;
  color: var(--muted);
}

.upcoming-card p {
  margin: 0;
  line-height: 1.6;
}

/* ---------------- Responsive ---------------- */

@media (max-width: 720px) {
  .app-shell {
    flex-direction: column;
  }
  .nav-rail {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }
  .nav-list, .nav-list--upcoming {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .nav-divider {
    display: none;
  }
  .content {
    padding: 1.4rem;
  }
}

/* ---------------- Hilfeseite ---------------- */

.help-block {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.3rem 1.6rem;
  margin-bottom: 1.2rem;
  max-width: 75ch;
  line-height: 1.6;
}

.help-block h2 {
  font-size: 1.25rem;
  margin-bottom: 0.7rem;
}

.help-block p {
  margin: 0.5rem 0;
}

.help-terms {
  margin: 0.5rem 0 0;
}

.help-terms dt {
  font-weight: 600;
  color: var(--teal);
  margin-top: 0.9rem;
}

.help-terms dd {
  margin: 0.2rem 0 0;
  padding-left: 0;
}

.help-list {
  margin: 0.5rem 0;
  padding-left: 1.3rem;
}

.help-list li {
  margin: 0.4rem 0;
}

.help-example {
  border-left: 3px solid var(--amber);
  padding: 0.3rem 0 0.3rem 1rem;
  margin: 1rem 0;
}

.help-example h3 {
  font-family: "Public Sans", sans-serif;
  font-size: 1rem;
  margin: 0 0 0.3rem;
  color: var(--amber-deep);
}

.help-subhead {
  font-family: "Public Sans", sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--teal);
  margin: 1.2rem 0 0.2rem;
}

.help-note {
  background: #F6F8F6;
  border-style: dashed;
  color: var(--muted);
}

/* ---------------- Auth-Bildschirm (Login etc.) ---------------- */

/* Wichtig: Elemente mit CSS-'display' (die App-Shell hat display:flex, der
   Auth-Screen display:flex) ignorieren sonst das HTML-Attribut 'hidden'.
   Diese Regel sorgt dafuer, dass 'hidden' immer gewinnt - so schaltet das
   JavaScript zuverlaessig zwischen Login und App um. */
[hidden] {
  display: none !important;
}

.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: var(--teal);
}

.auth-box {
  background: var(--panel);
  border-radius: 12px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.25);
  padding: 2rem 2.2rem 2.3rem;
  width: 100%;
  max-width: 400px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1.6rem;
}

.auth-brand .brand-name {
  font-size: 1.4rem;
  color: var(--ink);
}

.auth-panel h1 {
  font-size: 1.6rem;
  margin-bottom: 1.2rem;
}

.auth-panel form {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  align-items: stretch;
}

.auth-panel label {
  gap: 0.35rem;
  font-size: 0.9rem;
}

.auth-panel input {
  width: 100%;
  padding: 0.6rem 0.7rem;
  font-size: 0.95rem;
}

.auth-submit {
  width: 100%;
  padding: 0.7rem;
  font-size: 1rem;
  margin-top: 0.4rem;
}

.auth-links {
  margin-top: 1.2rem;
  font-size: 0.85rem;
  color: var(--muted);
  text-align: center;
  line-height: 1.7;
}

.auth-links a {
  color: var(--teal);
  cursor: pointer;
  text-decoration: underline;
}

.auth-note {
  margin-top: 0.4rem;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.5;
}

/* Nutzer-Anzeige + Logout unten in der Navigation */
.nav-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.nav-user {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.5rem 0.7rem;
  border-radius: 6px;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.06);
}

.nav-user:hover {
  background: rgba(255, 255, 255, 0.12);
}

.nav-user-name {
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-user-hint {
  color: #9FBAB2;
  font-size: 0.72rem;
}

.logout-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #CFE1DB;
  font-size: 0.88rem;
}

.logout-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.4);
  color: #fff;
}

/* ---------------- Verwaltung (Admin) ---------------- */
.invite-create-row {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 0.4rem;
}

.invite-create-row input {
  flex: 1;
  min-width: 200px;
}

#invites-table td button,
#users-table td button {
  padding: 0.3rem 0.6rem;
  font-size: 0.8rem;
  margin-right: 0.3rem;
}
