/* ============================================================
   flowmatik24 — Zentrale
   Brand: Navy #12305A · Royalblau #2E4BD6 · Cyan #17BEDC
   Public Sans (UI + Display) + Spline Sans Mono (Zahlen)
   Semantische Tokens behalten ihre Namen (--green = Marken-Primär/Royalblau,
   --gold = Warnung/Cyan-Bernstein, --red = Fehler) — daran hängen alle Komponenten.
   ============================================================ */

:root {
  --bg: #f4f6fb;
  --bg-elevated: #ffffff;
  --bg-sidebar: #eef2f9;
  --ink: #0f1c30;
  --ink-dim: #45536b;
  --ink-faint: #8894a8;
  --border: #dde4f0;
  --border-strong: #c4cede;

  /* Marken-Primär (Royalblau) — Buttons, aktive Nav, Balken */
  --brand: #2e4bd6;
  --brand-strong: #1e37a8;
  --brand-tint: #e7ebfb;
  --cyan: #17bedc;
  --cyan-tint: #def6fb;

  --green: var(--brand);
  --green-strong: var(--brand-strong);
  --green-tint: var(--brand-tint);

  --gold: #0e8fb0;          /* „warn"-Akzent in Marken-Cyan/Petrol statt Bernstein */
  --gold-tint: var(--cyan-tint);

  --red: #d33a2c;
  --red-tint: #fbe7e4;

  --shadow-card: 0 1px 2px rgba(15, 28, 48, 0.05), 0 4px 16px rgba(15, 28, 48, 0.07);
  --shadow-lifted: 0 4px 8px rgba(15, 28, 48, 0.08), 0 12px 32px rgba(15, 28, 48, 0.14);

  --font-display: "Public Sans", -apple-system, "Segoe UI", sans-serif;
  --font-ui: "Public Sans", -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Spline Sans Mono", ui-monospace, monospace;

  --radius: 12px;
  --radius-sm: 7px;
}

:root[data-theme="dark"] {
  --bg: #0c1524;
  --bg-elevated: #14203a;
  --bg-sidebar: #0a1220;
  --ink: #e8eefc;
  --ink-dim: #9fb0cc;
  --ink-faint: #67789a;
  --border: #22304d;
  --border-strong: #35476b;

  --brand: #5b78f0;
  --brand-strong: #7d94f6;
  --brand-tint: #17233f;
  --cyan: #35cfe9;
  --cyan-tint: #0e2a38;

  --green: var(--brand);
  --green-strong: var(--brand-strong);
  --green-tint: var(--brand-tint);

  --gold: #3bc4e0;
  --gold-tint: var(--cyan-tint);

  --red: #ef6a5c;
  --red-tint: #34191a;

  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lifted: 0 4px 8px rgba(0, 0, 0, 0.35), 0 16px 40px rgba(0, 0, 0, 0.55);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background 0.2s ease, color 0.2s ease;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
}

/* ---------- Login ---------- */

.center-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 15% 20%, var(--green-tint), transparent 45%),
    radial-gradient(circle at 85% 80%, var(--gold-tint), transparent 45%),
    var(--bg);
}

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 36px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-lifted);
}

.card h1 {
  font-size: 1.6rem;
  margin-bottom: 24px;
}

.card .subtitle {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--ink-faint);
  margin: -18px 0 24px;
}

label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink-dim);
  margin-bottom: 6px;
  text-transform: uppercase;
}

input, select, textarea {
  width: 100%;
  padding: 11px 13px;
  margin: 0 0 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 0.92rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-tint);
}

input::placeholder { color: var(--ink-faint); }

button {
  font-family: var(--font-ui);
  padding: 11px 18px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  transition: filter 0.15s ease, transform 0.1s ease;
}

button:active { transform: translateY(1px); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button:disabled:active { transform: none; }

.card button[type="submit"] {
  width: 100%;
  background: var(--green);
  color: #fdfbf7;
  padding: 12px;
  margin-top: 4px;
}

.card button[type="submit"]:hover { filter: brightness(1.08); }

.error { color: var(--red); font-size: 0.85rem; min-height: 1.2em; margin: -8px 0 4px; }

/* ---------- App shell ---------- */

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

/* ---------- Topbar (ersetzt die linke Sidebar) ---------- */
.appbar {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 16px 32px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: var(--shadow-card);
}
.appbar-brand { display: flex; align-items: center; flex-shrink: 0; }
.appbar-brand .brand-logo { width: 210px; }
.appbar-spacer { flex: 1; }

/* Animierte Bildmarke: Raute steht, Kreispfeil dreht („läuft rund um die uhr") */
.brandmark { display: flex; align-items: center; gap: 14px; text-decoration: none; flex-shrink: 0; }
.brandmark .fm-mark { width: 58px; height: 58px; flex-shrink: 0; }
.fm-ring { transform-box: view-box; transform-origin: 24px 24px; animation: fm-spin 5s linear infinite; }
@keyframes fm-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .fm-ring { animation: none; } }
.fm-word { font-size: 1.9rem; font-weight: 700; letter-spacing: -0.5px; color: var(--ink); }
.fm-word b { color: var(--cyan); font-weight: 700; }
.appbar .theme-toggle { width: auto; gap: 8px; }
.appbar .logout-link { padding: 8px 12px; }

.sidebar {
  width: 236px;
  flex-shrink: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar .brand {
  display: flex;
  align-items: baseline;
  padding: 0 8px;
  margin-bottom: 32px;
}

.sidebar .brand h1 {
  font-size: 1.15rem;
}

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  text-decoration: none;
  padding: 10px 12px;
  border: none;
  background: transparent;
  color: var(--ink-dim);
  font-family: var(--font-ui);
  font-size: 0.88rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  position: relative;
  transition: background 0.15s ease, color 0.15s ease;
  box-sizing: border-box;
}

.nav-item:hover {
  background: var(--bg-elevated);
  color: var(--ink);
}

.nav-item .num {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-faint);
  width: 16px;
}

.nav-item[aria-current="true"] {
  background: var(--bg-elevated);
  color: var(--green-strong);
  font-weight: 600;
  box-shadow: var(--shadow-card);
}

.nav-item[aria-current="true"] .num { color: var(--green); }

.nav-item[aria-current="true"]::before {
  content: "";
  position: absolute;
  left: -16px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  background: var(--green);
  border-radius: 0 3px 3px 0;
}

.nav-badge {
  margin-left: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 100px;
  background: var(--gold);
  color: #fdfbf7;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-badge[hidden] { display: none; }

.sidebar-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--ink-dim);
  font-size: 0.8rem;
  cursor: pointer;
  font-family: var(--font-ui);
}

.theme-toggle .icon { font-family: var(--font-mono); }

.logout-link {
  background: none;
  border: none;
  color: var(--ink-faint);
  font-family: var(--font-ui);
  font-size: 0.8rem;
  text-align: left;
  padding: 6px 10px;
  cursor: pointer;
}

.logout-link:hover { color: var(--red); }

/* ---------- Main content ---------- */

.main {
  flex: 1;
  min-width: 0;
  width: 100%;
  padding: 36px 28px 64px;
  max-width: 1180px;
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 6px;
}

.topbar .eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.section { display: none; }
.section.active { display: block; }

.section h2 {
  font-size: 1.9rem;
  margin-bottom: 4px;
}

.section .lede {
  font-size: 0.88rem;
  color: var(--ink-faint);
  margin: 0 0 28px;
}

.panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-card);
  margin-bottom: 24px;
  /* Wide tables (7-8 columns) scroll within the panel on narrow screens instead of
     stretching .section/.main/.app-shell and pushing the whole page sideways. */
  overflow-x: auto;
}

.panel-title {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 16px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0 16px;
}

.field-grid label { margin-top: 2px; }

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

.btn-primary {
  background: var(--green);
  color: #fdfbf7;
}
.btn-primary:hover { filter: brightness(1.08); }

.btn-secondary {
  background: var(--bg-sidebar);
  color: var(--ink);
  border: 1px solid var(--border-strong);
}
.btn-secondary:hover { background: var(--border); }

/* ---------- Dashboard ---------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-tile {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow-card);
}

.stat-tile .stat-label {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 10px;
}

.stat-tile .stat-value {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--ink);
}

.stat-tile.accent .stat-value { color: var(--green-strong); }
.stat-tile.warn .stat-value { color: var(--gold); }

/* ---------- Bar chart ---------- */

.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 200px;
  padding: 0 4px;
  border-bottom: 1px solid var(--border-strong);
  position: relative;
}

.bar-chart-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  min-width: 0;
  position: relative;
}

.bar-chart-bar {
  width: 100%;
  max-width: 24px;
  background: var(--green);
  border-radius: 4px 4px 0 0;
  transition: filter 0.15s ease;
  cursor: default;
}

.bar-chart-bar:hover { filter: brightness(1.15); }

.bar-chart-label {
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--ink-faint);
  white-space: nowrap;
}

.bar-chart-tooltip {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 6px;
  background: var(--ink);
  color: var(--bg-elevated);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 4px 8px;
  border-radius: 5px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.1s ease;
  z-index: 5;
}

.bar-chart-col:hover .bar-chart-tooltip { opacity: 1; }

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.mini-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.mini-list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.86rem;
}

.mini-list li:last-child { border-bottom: none; }

.mini-list .mini-title { color: var(--ink); }

.mini-list .mini-meta {
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  white-space: nowrap;
}

@media (max-width: 860px) {
  .two-col { grid-template-columns: 1fr; }
}

/* ---------- Search ---------- */

.panel-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}

.panel-title-row .panel-title { margin-bottom: 0; }

.search-input {
  width: 220px;
  margin: 0;
  padding: 7px 12px;
  font-size: 0.82rem;
}

/* ---------- Modal ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 18, 14, 0.45);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 64px 20px;
  z-index: 100;
}

.modal-backdrop[hidden] { display: none; }

.modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 560px;
  width: 100%;
  padding: 28px;
  box-shadow: var(--shadow-lifted);
  max-height: 80vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.modal-header h2 { font-size: 1.4rem; }

.modal-close {
  width: auto;
  background: none;
  border: none;
  font-size: 1.1rem;
  color: var(--ink-faint);
  cursor: pointer;
  padding: 4px 8px;
}

.modal-close:hover { color: var(--red); }

.customer-meta {
  color: var(--ink-dim);
  font-size: 0.85rem;
  line-height: 1.7;
  margin: 4px 0 24px;
}

#customers-table tbody tr, #anfragen-table tbody tr[data-id] { cursor: pointer; }

/* ---------- Tables ---------- */

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

th {
  text-align: left;
  padding: 10px 12px;
  font-family: var(--font-ui);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 600;
  border-bottom: 1px solid var(--border-strong);
}

td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tbody tr:hover { background: var(--bg-sidebar); }
tbody tr:last-child td { border-bottom: none; }

.num-cell, .mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.num-cell { text-align: right; }

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 600;
  font-family: var(--font-ui);
}

.badge-neu { background: var(--gold-tint); color: var(--gold); }
.badge-bearbeitet { background: var(--green-tint); color: var(--green-strong); }
.badge-erledigt { background: var(--border); color: var(--ink-dim); }
.badge-yes { background: var(--green-tint); color: var(--green-strong); }
.badge-no { background: var(--red-tint); color: var(--red); }
.badge-storno { background: var(--border); color: var(--ink-dim); }
.badge-new { background: var(--gold-tint); color: var(--gold); }

td select.anfrage-status {
  width: auto;
  margin: 0;
  padding: 5px 8px;
  font-size: 0.8rem;
}

.btn-icon, .send-btn, .anfrage-to-customer, #add-item-btn {
  display: inline-block;
  width: auto;
  padding: 7px 12px;
  font-size: 0.8rem;
  background: var(--bg-sidebar);
  color: var(--ink);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  margin: 0;
  text-decoration: none;
  vertical-align: middle;
}
.btn-icon:hover, .send-btn:hover, .anfrage-to-customer:hover, #add-item-btn:hover {
  background: var(--border);
}

.btn-danger {
  color: var(--red);
  border-color: var(--red);
  background: var(--red-tint);
}
.btn-danger:hover { filter: brightness(0.95); background: var(--red-tint); }

.empty-state {
  padding: 32px 12px;
  text-align: center;
  color: var(--ink-faint);
  font-size: 0.88rem;
}

/* ---------- Invoice item rows ---------- */

#invoice-items { display: flex; flex-direction: column; gap: 12px; margin: 16px 0; }

#invoice-items > div {
  display: grid;
  grid-template-columns: 1.3fr 1.6fr 0.7fr 0.9fr;
  gap: 12px;
  align-items: start;
}

#invoice-items input, #invoice-items select { margin: 0; }

@media (max-width: 860px) {
  .app-shell { flex-direction: column; }
  .sidebar {
    width: 100%;
    height: auto;
    position: sticky;
    top: 0;
    z-index: 10;
    flex-direction: column;
    padding: 12px 16px 0;
    gap: 10px;
  }
  .sidebar .brand {
    margin-bottom: 0;
    width: 100%;
  }
  .nav-list {
    flex-direction: row;
    overflow-x: auto;
    gap: 4px;
    padding-bottom: 10px;
    -webkit-overflow-scrolling: touch;
  }
  .nav-item {
    flex-shrink: 0;
    white-space: nowrap;
  }
  .nav-item[aria-current="true"]::before { display: none; }
  .sidebar-footer {
    flex-direction: row;
    margin-top: 0;
    padding: 10px 0;
    justify-content: space-between;
  }
  .theme-toggle { flex: 1; }
  .main { padding: 24px 20px 48px; }
  #invoice-items > div { grid-template-columns: 1fr; }
}

/* ---------- Toasts ---------- */

#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
}

.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--ink-faint);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-family: var(--font-ui);
  font-size: 0.86rem;
  color: var(--ink);
  box-shadow: var(--shadow-lifted);
  max-width: 360px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast-visible { opacity: 1; transform: translateY(0); }

.toast-success { border-left-color: var(--green); }
.toast-error { border-left-color: var(--red); }
.toast-info { border-left-color: var(--gold); }

/* ---------- Bulk action bar ---------- */

.bulk-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  margin-bottom: 12px;
  background: var(--green-tint);
  border: 1px solid var(--green);
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
}

.bulk-bar select { width: auto; margin: 0; padding: 6px 10px; font-size: 0.82rem; }

/* ---------- Loading skeleton rows ---------- */

.skeleton-row td {
  padding: 12px;
}

.skeleton-bar {
  height: 14px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--border) 25%, var(--border-strong) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: skeleton-pulse 1.4s ease-in-out infinite;
}

@keyframes skeleton-pulse {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---------- Kanban board ---------- */

.kanban-board {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.kanban-column {
  flex: 0 0 260px;
  background: var(--bg-sidebar);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  min-height: 120px;
}

.kanban-column-title {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
}

.kanban-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 10px;
  cursor: pointer;
  box-shadow: var(--shadow-card);
}

.kanban-card:hover { border-color: var(--border-strong); }

.kanban-card .num { font-family: var(--font-mono); font-size: 0.68rem; color: var(--ink-faint); }
.kanban-card .titel { font-weight: 600; margin: 4px 0; }
.kanban-card .kunde { font-size: 0.8rem; color: var(--ink-dim); }
.kanban-card .budget-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin-top: 8px;
  overflow: hidden;
}
.kanban-card .budget-bar-fill { height: 100%; background: var(--green); }

.kanban-column.drag-over { background: var(--green-tint); }
.kanban-card.dragging { opacity: 0.4; }

/* ============================================================
   flowmatik24 — Marken-Logo (Wortbild, hell/dunkel umschaltend)
   ============================================================ */

.brand-logo { display: block; height: auto; }
.brand-logo.on-light { display: block; }
.brand-logo.on-dark { display: none; }
:root[data-theme="dark"] .brand-logo.on-light { display: none; }
:root[data-theme="dark"] .brand-logo.on-dark { display: block; }

/* Sidebar-Brand: Logo statt reinem Text */
.sidebar .brand { align-items: center; }
.sidebar .brand .brand-logo { width: 150px; }

/* Login-Brand */
.login-brand { text-align: center; margin-bottom: 22px; }
.login-brand .brand-logo { width: 210px; margin: 0 auto 6px; }

/* ============================================================
   Launchpad (Start) — Themengebiet-Kacheln
   ============================================================ */

.lp-banner {
  width: 100%;
  max-width: 1180px;
  border-radius: 16px;
  overflow: hidden;
  margin: 0 0 22px;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border);
  line-height: 0;
}
.lp-banner img { display: block; width: 100%; height: auto; }

.lp-head { margin: 4px 0 22px; }
.lp-head .lp-hello { font-size: 1.7rem; font-weight: 700; letter-spacing: -0.02em; }
.lp-head .lp-sub { color: var(--ink-faint); font-size: 0.9rem; margin-top: 2px; }

/* Launchpad-Kacheln — übernommen aus dem EF-Portal (rotierendes Randlicht + Glow) */
.lp-groups { display: flex; flex-direction: column; gap: 26px; margin: 0 0 38px; }
.lp-group-title {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 14px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--border);
}
.lp-grid { display: flex; flex-wrap: wrap; gap: 20px; margin: 0; }

.tile {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
  justify-content: center;
  text-align: center;
  width: 250px;
  min-height: 188px;
  border-radius: 18px;
  padding: 26px 20px;
  color: var(--ink);
  text-decoration: none;
  box-shadow: 0 0 16px -5px color-mix(in srgb, var(--a, var(--brand)) 50%, transparent), var(--shadow-card);
  transition: transform 0.16s ease, box-shadow 0.2s ease;
}

.tile:hover {
  transform: translateY(-4px);
  box-shadow: 0 0 26px -3px color-mix(in srgb, var(--a, var(--brand)) 65%, transparent), var(--shadow-lifted);
}

/* Laufendes Randlicht: rotierender conic-gradient, innen von der Karte maskiert */
.tile::before {
  content: "";
  position: absolute;
  z-index: 0;
  inset: -55%;
  background: conic-gradient(from 0deg, transparent 0 70%, var(--a, var(--brand)) 82%, #fff 90%, var(--a, var(--brand)) 96%, transparent 100%);
  animation: tile-spin 4s linear infinite;
}
.tile::after {
  content: "";
  position: absolute;
  z-index: 1;
  inset: 2px;
  border-radius: inherit;
  background: var(--bg-elevated);
}
.tile:hover::after { background: var(--bg-sidebar); }
.tile > * { position: relative; z-index: 2; }

@keyframes tile-spin { to { transform: rotate(1turn); } }

.tile-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--a, var(--brand));
  background: color-mix(in srgb, var(--a, var(--brand)) 16%, var(--bg-elevated));
  border: 1px solid color-mix(in srgb, var(--a, var(--brand)) 45%, var(--border));
  box-shadow: 0 0 12px -4px color-mix(in srgb, var(--a, var(--brand)) 55%, transparent);
}
.tile-icon svg { width: 36px; height: 36px; }

@media (prefers-reduced-motion: reduce) {
  .tile::before { animation: none; }
}

.tile-name { font-size: 1.12rem; font-weight: 700; letter-spacing: 0.2px; }
.tile-sub { font-size: 0.78rem; color: var(--ink-faint); line-height: 1.4; max-width: 200px; }

.tile-badge {
  position: absolute;
  top: 16px; right: 16px;
  min-width: 20px; height: 20px;
  padding: 0 6px;
  border-radius: 100px;
  background: var(--gold);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}
.tile-badge[hidden] { display: none; }

.lp-section-title {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 14px;
}

@media (prefers-reduced-motion: reduce) {
  .tile { transition: none; }
  .tile:hover { transform: none; }
}

/* ---------- Postfach ---------- */
.pf-grid { display: grid; grid-template-columns: 330px 1fr; gap: 20px; align-items: start; }
.pf-list { padding: 16px; max-height: 72vh; overflow-y: auto; }
.pf-threads { list-style: none; margin: 0; padding: 0; }
.pf-thread { padding: 12px 12px; border-radius: var(--radius-sm); cursor: pointer; border: 1px solid transparent; }
.pf-thread:hover { background: var(--bg-sidebar); }
.pf-thread.active { background: var(--bg-sidebar); border-color: var(--border-strong); }
.pf-thread-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.pf-thread-who { font-weight: 600; font-size: 0.9rem; }
.pf-thread-date { font-family: var(--font-mono); font-size: 0.72rem; color: var(--ink-faint); white-space: nowrap; }
.pf-thread-subj { font-size: 0.82rem; color: var(--ink-dim); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-thread-subj .nav-badge { margin-left: 6px; position: static; display: inline-flex; }

.pf-detail { padding: 20px; min-height: 40vh; }
.pf-msgs { display: flex; flex-direction: column; gap: 14px; margin-bottom: 20px; }
.pf-msg { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; background: var(--bg); }
.pf-msg.out { background: var(--green-tint); border-color: color-mix(in srgb, var(--brand) 30%, var(--border)); }
.pf-msg-head { display: flex; justify-content: space-between; gap: 10px; font-size: 0.8rem; color: var(--ink-dim); margin-bottom: 8px; }
.pf-msg-head span { font-family: var(--font-mono); font-size: 0.72rem; color: var(--ink-faint); }
.pf-msg-body { font-size: 0.9rem; line-height: 1.55; word-break: break-word; }

.pf-reply { border-top: 1px solid var(--border); padding-top: 16px; }
.pf-reply-actions { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.pf-draft-status { font-size: 0.8rem; color: var(--ink-faint); }
.pf-reply textarea { font-family: var(--font-ui); resize: vertical; }

@media (max-width: 820px) { .pf-grid { grid-template-columns: 1fr; } .pf-list { max-height: none; } }
