/* R23:Warboard – Styling */
:root {
  --bg: #1c1f24;
  --bg-elev: #262b32;
  --bg-elev-2: #2f353d;
  --border: #3a414a;
  --text: #e6e6e6;
  --text-dim: #9aa0a6;
  --accent: #c0974a;
  --accent-hover: #d4a85a;
  --danger: #d9534f;
  --success: #4caf50;
  --warning: #f1c40f;
  --info: #5a8dee;

  --priority-high:   #d9534f;
  --priority-medium: #f1c40f;
  --priority-low:    #6cbf6c;

  --status-open:    #5a8dee;
  --status-claimed: #c0974a;
  --status-done:    #4caf50;
}

/* ===== Theme-Varianten (Kernfarben aus Weltkriegspalette) ===== */
/* Aktivierung via <html data-theme="..."> Attribut. Default = standard. */

[data-theme="feldgrau"] {
  --bg: #1f2418;
  --bg-elev: #2a3022;
  --bg-elev-2: #3d4a30;
  --border: #4a5d3a;
  --text: #e6e6e0;
  --text-dim: #a8a892;
  --accent: #c9b870;
  --accent-hover: #dccb90;
  --status-claimed: #c9b870;
}

[data-theme="marine"] {
  --bg: #141a2e;
  --bg-elev: #1c2a4a;
  --bg-elev-2: #243358;
  --border: #3a4870;
  --text: #e6e6e6;
  --text-dim: #9aa3b8;
  --accent: #c9b870;
  --accent-hover: #dccb90;
  --status-open: #6c9bea;
  --status-claimed: #c9b870;
}

[data-theme="propaganda"] {
  --bg: #1a1a1a;
  --bg-elev: #232323;
  --bg-elev-2: #2e2828;
  --border: #4a3838;
  --text: #e6d8b0;
  --text-dim: #a89172;
  --accent: #8b1a1a;
  --accent-hover: #a82424;
  --danger: #8b1a1a;
  --status-claimed: #c9b870;
}

[data-theme="afrika"] {
  --bg: #2b2520;
  --bg-elev: #3a3530;
  --bg-elev-2: #5b4a2f;
  --border: #6e5a3d;
  --text: #e8dcc0;
  --text-dim: #b09872;
  --accent: #a89172;
  --accent-hover: #c9b08a;
  --status-claimed: #a89172;
}

[data-theme="atlantik"] {
  --bg: #2a2a28;
  --bg-elev: #3a3a38;
  --bg-elev-2: #4a4a48;
  --border: #6e6b66;
  --text: #e6e6e0;
  --text-dim: #a8a8a2;
  --accent: #8b1a1a;
  --accent-hover: #a82424;
  --status-claimed: #8b1a1a;
}

/* Theme-Switch Button + Panel */
.theme-switch {
  position: relative;
  display: inline-flex;
}
.theme-switch-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  padding: 0; border-radius: 6px;
  background: var(--bg-elev-2); color: var(--text);
  border: 1px solid var(--border);
  cursor: pointer; font-size: 1rem;
  transition: background 0.15s, border-color 0.15s;
}
.theme-switch-btn:hover { background: var(--bg); border-color: var(--accent); }
.theme-switch-btn .theme-icon-swatches {
  display: inline-flex; gap: 2px;
}
.theme-switch-btn .theme-icon-swatches span {
  width: 6px; height: 14px; border-radius: 2px;
  display: inline-block;
}
.theme-panel {
  position: absolute; top: calc(100% + 8px); right: 0;
  display: none; flex-direction: column; gap: 6px;
  min-width: 240px; padding: 10px;
  background: var(--bg-elev); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.45);
  z-index: 200;
}
.theme-switch.open .theme-panel { display: flex; }
.theme-option {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  background: transparent; color: var(--text);
  border: 1px solid transparent; border-radius: 8px;
  cursor: pointer; text-align: left;
  font-size: 0.92rem; width: 100%;
}
.theme-option:hover { background: var(--bg-elev-2); border-color: var(--border); }
.theme-option.active { border-color: var(--accent); background: var(--bg-elev-2); }
.theme-option-swatches {
  display: inline-flex; gap: 3px; flex-shrink: 0;
}
.theme-option-swatches span {
  width: 16px; height: 22px; border-radius: 3px;
  border: 1px solid rgba(0,0,0,0.35);
  display: inline-block;
}
.theme-option-name { flex: 1; }
.theme-option-check {
  color: var(--accent); font-weight: 700; opacity: 0;
}
.theme-option.active .theme-option-check { opacity: 1; }


* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Segoe UI', Tahoma, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.hidden { display: none !important; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 24px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand h1 { margin: 0; font-size: 1.25rem; }
.logo { font-size: 1.6rem; }

.topbar-right { display: flex; align-items: center; gap: 18px; }

/* Sprach-Switch */
.lang-switch {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}
.lang-btn {
  background: var(--bg-elev-2);
  color: var(--text-dim);
  border: none;
  padding: 6px 12px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.8rem;
  transition: background 0.15s, color 0.15s;
}
.lang-btn:hover { background: var(--bg); color: var(--text); }
.lang-btn.active {
  background: var(--accent);
  color: #1c1f24;
}
.lang-btn + .lang-btn { border-left: 1px solid var(--border); }

.user-area { display: flex; align-items: center; gap: 12px; }
.user-area img { width: 32px; height: 32px; border-radius: 50%; }
.user-name { font-weight: 500; }
.user-role {
  font-size: 0.75rem; padding: 2px 8px; border-radius: 10px;
  background: var(--bg-elev-2); color: var(--text-dim);
}
.user-role.admin { background: var(--accent); color: #1c1f24; }

main { max-width: 1100px; margin: 0 auto; padding: 24px; }

.login-hint {
  text-align: center;
  padding: 60px 20px;
  background: var(--bg-elev);
  border-radius: 12px;
  border: 1px solid var(--border);
}
.login-hint h2 { margin-top: 0; color: var(--accent); }

.toolbar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 20px; flex-wrap: wrap; gap: 12px;
}
.filters { display: flex; align-items: center; gap: 14px; }
.filters label { font-size: 0.9rem; color: var(--text-dim); }
.filters .checkbox { display: inline-flex; gap: 6px; align-items: center; }
.filters select {
  margin-left: 6px; padding: 4px 8px;
  background: var(--bg-elev); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px;
}

/* Toolbar-Substruktur (für Mobile-Reflow). Auf Desktop ist alles eine Reihe. */
.toolbar-primary {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
/* (Frueher hier: .filters-toggle / .filters-toggle-count / .filters-toggle-chevron
    fuer den mobile Filter-Klapp-Button. Button wurde entfernt — Filter-Panel
    ist jetzt direkt sichtbar.) */

/* User-Area: immer-sichtbare Identität + Hamburger + Dropdown */
.user-area { position: relative; display: inline-flex; align-items: center; gap: 8px; }
.user-identity { display: inline-flex; align-items: center; gap: 8px; }
.user-identity img { width: 32px; height: 32px; border-radius: 50%; display: block; }
.user-trigger-fallback {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--bg-elev-2); color: var(--text);
  font-weight: 700;
}
/* Hamburger-Button */
.menu-trigger {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 5px 9px; border-radius: 6px;
  background: transparent; border: 1px solid var(--border);
  color: var(--text); font-size: 1.1rem; line-height: 1;
  cursor: pointer; transition: border-color 0.15s, color 0.15s;
}
.menu-trigger:hover { border-color: var(--accent); color: var(--accent); }
/* Dropdown-Menü (Desktop + Mobile gleich) */
.user-menu {
  display: none;
  position: absolute; top: calc(100% + 8px); right: 0;
  flex-direction: column; align-items: stretch; gap: 6px;
  min-width: 200px; padding: 12px;
  background: var(--bg-elev); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.45);
  z-index: 150;
}
.user-area.open .user-menu { display: flex; }
.user-menu .menu-nav-link {
  display: block; padding: 7px 10px;
  color: var(--text); text-decoration: none;
  border-radius: 6px; border: 1px solid var(--border);
  background: var(--bg-elev-2); font-size: 0.9rem;
  transition: border-color 0.15s, background 0.15s;
}
.user-menu .menu-nav-link:hover { background: var(--bg); border-color: var(--accent); }
.user-menu .btn { width: 100%; text-align: left; }

/* Buttons */
.btn {
  display: inline-block;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-elev);
  color: var(--text);
  cursor: pointer;
  font-size: 0.9rem;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}
.btn:hover { background: var(--bg-elev-2); border-color: var(--accent); }
.btn-primary { background: var(--accent); color: #1c1f24; border-color: var(--accent); font-weight: 600; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #1c1f24; }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { filter: brightness(1.1); }
.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover { filter: brightness(1.1); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 4px 10px; font-size: 0.8rem; }

/* Task-Liste */
.task-list { display: grid; gap: 12px; }
.empty { padding: 40px; text-align: center; color: var(--text-dim); }

.task-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-left: 4px solid var(--status-open);
  border-radius: 8px;
  padding: 12px 16px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: center;
  cursor: pointer;
  transition: transform 0.05s, border-color 0.15s;
}
.task-card:hover { border-color: var(--accent); }
.task-card.status-claimed { border-left-color: var(--status-claimed); }
.task-card.status-done { border-left-color: var(--status-done); opacity: 0.75; }

/* Material-Icon */
.task-icon {
  width: 56px; height: 56px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-elev-2);
  border-radius: 8px;
  flex-shrink: 0;
  overflow: hidden;
}
.task-icon img.mat-icon {
  max-width: 48px; max-height: 48px;
  object-fit: contain;
  image-rendering: -webkit-optimize-contrast;
}
.mat-icon-fallback {
  display: inline-block;
  line-height: 1;
}
.task-meta img.mat-icon {
  width: 20px; height: 20px;
  max-width: 20px; max-height: 20px;
  object-fit: contain;
  image-rendering: -webkit-optimize-contrast;
  vertical-align: middle;
}
.ui-icon {
  vertical-align: middle;
  object-fit: contain;
  image-rendering: -webkit-optimize-contrast;
}
.task-actions .btn-icon img {
  display: block;
  width: 18px; height: 18px;
  object-fit: contain;
  image-rendering: -webkit-optimize-contrast;
}

.task-body { min-width: 0; }
.task-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.task-title { font-size: 1.05rem; font-weight: 600; margin: 0; }
.task-meta { color: var(--text-dim); font-size: 0.85rem; display: flex; gap: 12px; flex-wrap: wrap; }
.task-meta span { display: inline-flex; align-items: center; gap: 4px; }

.badge {
  display: inline-block; padding: 2px 10px; border-radius: 12px;
  font-size: 0.75rem; font-weight: 600; text-transform: uppercase;
}
.badge-priority-high   { background: var(--priority-high); color: #fff; }
.badge-priority-medium { background: var(--priority-medium); color: #1c1f24; }
.badge-priority-low    { background: var(--priority-low); color: #1c1f24; }
.badge-status-open    { background: var(--status-open); color: #fff; }
.badge-status-claimed { background: var(--status-claimed); color: #1c1f24; }
.badge-status-done    { background: var(--status-done); color: #fff; }

.task-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.task-actions .btn { white-space: nowrap; }
.task-actions .btn-icon {
  flex: 0 0 38px;
  width: 38px; height: 38px;
  padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1rem;
}

/* Modal */
.modal {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex; justify-content: center; align-items: center;
  z-index: 100;
  padding: 20px;
}
.modal-content {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 20px; border-bottom: 1px solid var(--border);
}
.modal-header h2 {
  margin: 0; font-size: 1.1rem;
  display: flex; align-items: center; gap: 8px;
}
.modal-header h2 img.mat-icon { width: 32px; height: 32px; }
.modal-close {
  background: transparent; color: var(--text-dim);
  border: none; font-size: 1.6rem; cursor: pointer; line-height: 1;
}
.modal-close:hover { color: var(--text); }

#create-form { padding: 20px; display: grid; gap: 12px; }
#create-form label { display: flex; flex-direction: column; gap: 4px; font-size: 0.9rem; color: var(--text-dim); }
#create-form input, #create-form select, #create-form textarea {
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px;
  padding: 8px 10px; font-size: 0.95rem; font-family: inherit;
}
#create-form input:focus, #create-form select:focus, #create-form textarea:focus {
  outline: none; border-color: var(--accent);
}
#create-form small { color: var(--text-dim); font-weight: normal; }

.modal-footer {
  display: flex; justify-content: flex-end; gap: 10px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
  padding-top: 12px;
}

/* Detail Modal */
#d-body { padding: 20px; }
.detail-row { display: flex; gap: 8px; margin-bottom: 8px; }
.detail-row .label { color: var(--text-dim); min-width: 120px; }
.detail-history { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 14px; }
.history-item {
  font-size: 0.85rem; color: var(--text-dim);
  padding: 4px 0; border-bottom: 1px dashed var(--border);
}
.history-item:last-child { border-bottom: none; }

/* Toast (oben rechts, auto-width) */
.toast {
  position: fixed; top: 76px; right: 24px;
  background: var(--bg-elev-2); color: var(--text);
  border: 1px solid var(--border); border-left: 4px solid var(--info);
  padding: 12px 18px; border-radius: 6px;
  z-index: 200; max-width: 480px; width: auto;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  animation: toast-in 0.25s ease-out;
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

@media (max-width: 600px) {
  /* ===== Topbar (Mobile) ===== */
  .topbar {
    padding: 10px 14px;
    flex-wrap: nowrap;       /* eine Zeile reicht jetzt, weil User-Menü kollabiert */
    gap: 8px;
  }
  .brand h1 { font-size: 1.05rem; }
  .topbar-right { gap: 8px; flex-shrink: 0; }
  /* Regiment-Info auf Mobile ausblenden; Topbar bleibt schlank. */
  #regiment-info { display: none !important; }

  /* Theme-Panel auf Mobile: am rechten Topbar-Rand */
  .theme-panel { right: -8px; min-width: 220px; }

  /* ===== Main / Toolbar (Mobile) ===== */
  main { padding: 14px; }

  .toolbar { flex-direction: column; align-items: stretch; gap: 10px; }
  .toolbar-primary {
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    gap: 8px; align-items: center;
  }
  .toolbar-primary #open-create { grid-column: 1 / -1; }     /* Vollbreite oben */
  .toolbar-primary #refresh,
  .toolbar-primary #export-csv { white-space: nowrap; }

  /* Filter-Panel: auch auf Mobile immer sichtbar (vertikal gestapelt). */
  .filters {
    display: flex;
    flex-direction: column; align-items: stretch; gap: 12px;
    padding: 14px;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 10px;
  }
  .filter-status-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 12px;
  }
  .filter-status-group legend { grid-column: 1 / -1; }
  .filters label { font-size: 0.95rem; color: var(--text); }
  .filters select { width: 100%; padding: 8px; margin-left: 0; }
  .filters > label { display: flex; flex-direction: column; gap: 6px; }
  .filters > label.checkbox { flex-direction: row; align-items: center; gap: 8px; }

  /* ===== Task-Cards (Mobile) ===== */
  .task-card {
    grid-template-columns: auto 1fr;
    grid-template-areas:
      "icon body"
      "actions actions";
    padding: 12px;
  }
  .task-icon { grid-area: icon; }
  .task-body { grid-area: body; }
  .task-actions { grid-area: actions; gap: 6px; }
  /* Text-Buttons: gleichmaeßig breit, eine Zeile pro Button */
  .task-actions .btn:not(.btn-icon) {
    flex: 1 1 0;
    min-width: 88px;
    padding: 9px 8px;
    font-size: 0.88rem;
    white-space: nowrap;
  }
  /* Icon-Buttons: fixe Quadrate, kein flex-grow */
  .task-actions .btn-icon {
    flex: 0 0 40px;
    width: 40px; height: 40px;
    padding: 0;
    font-size: 1.05rem;
  }

  /* ===== Stats-Bar (Mobile): 2x2 statt 4er-Reihe ===== */
  .stats-bar { gap: 10px; margin-bottom: 12px; }
  .my-stats, .war-top3 { min-width: 0; padding: 10px 12px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 6px; }

  /* ===== Login-Hint + Local-Login-Box (Mobile) ===== */
  .login-hint { padding: 32px 16px; }
  .local-login-box { padding: 14px; max-width: none; }
  .local-login-box .form-actions { flex-direction: column-reverse; gap: 8px; }
  .local-login-box .form-actions .btn { width: 100%; }

  /* ===== Modals (Mobile): vom oberen Rand statt zentriert, mehr Platz ===== */
  .modal {
    padding: 12px;
    align-items: flex-start;
  }
  .modal-content {
    max-height: calc(100vh - 24px);
    border-radius: 12px;
  }
  .modal-header { padding: 12px 16px; }
  .modal-header h2 { font-size: 1.05rem; line-height: 1.25; word-break: break-word; }
  .modal-close { font-size: 1.8rem; padding: 0 4px; line-height: 1; }

  /* Create/Edit-Form auf Mobile: weniger Padding, größere Touch-Targets */
  #create-form { padding: 16px; gap: 14px; }
  #create-form label { font-size: 0.92rem; }
  /* 16px Mindestschrift bei Inputs verhindert iOS-Auto-Zoom beim Fokus */
  #create-form input,
  #create-form select,
  #create-form textarea { font-size: 16px; padding: 10px 12px; }
  /* allow_partial: zur Sicherheit auf Mobile sauber gestapelt */
  #create-form label.checkbox { flex-direction: row; flex-wrap: wrap; align-items: center; }
  #create-form label.checkbox small { width: 100%; }

  /* Quantity-Row: 3 Elemente stacken statt Overflow zu verursachen */
  .qty-row { flex-direction: column; gap: 8px; }
  .qty-row input[type="number"],
  .qty-row select { width: 100%; min-width: 0; flex: none; }

  /* Modal-Footer: Buttons in voller Breite, gleich groß, Reihenfolge so dass primary unten */
  .modal-footer {
    flex-direction: column-reverse;
    gap: 8px;
    padding: 12px 16px 16px;
  }
  .modal-footer .btn { width: 100%; padding: 12px; font-size: 1rem; }

  /* Detail-Modal: Label oben, Wert drunter (kein flex-row mit langen Werten) */
  #d-body { padding: 16px; }
  .detail-row { flex-direction: column; gap: 2px; padding: 6px 0; border-bottom: 1px dashed var(--border); }
  .detail-row:last-of-type { border-bottom: none; }
  .detail-row .label { min-width: 0; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; }

  /* Custom-Material-Dropdown (Bitte wählen): Panel passt sich an, Suche groß */
  .cd-trigger { padding: 10px 12px; font-size: 1rem; }
  .cd-panel { max-height: 280px; }
  .cd-search { padding: 10px 12px; font-size: 16px; }

  /* Toast nicht über die ganze Breite, aber näher am Rand */
  .toast { top: 64px; right: 12px; left: 12px; max-width: none; }
}

/* ===== Phase A: Aufgaben-Kategorie LOG/IND/TRS/WAR ===== */
:root {
  --cat-LOG: #f1c40f;   /* Logistik = gelb */
  --cat-IND: #4caf50;   /* Industrie = grün */
  --cat-TRS: #9aa0a6;   /* Transport = grau */
  --cat-WAR: #d9534f;   /* Krieg = rot */
  --cat-LEAD: #5a8dee;  /* Führung = blau */
  --status-needs-help: #f1c40f; /* gelb */
}

/* Linker Streifen pro Kategorie (zusätzlich zum Status-Streifen subtil) */
.task-card.cat-LOG { box-shadow: inset 4px 0 0 var(--cat-LOG); }
.task-card.cat-IND { box-shadow: inset 4px 0 0 var(--cat-IND); }
.task-card.cat-TRS { box-shadow: inset 4px 0 0 var(--cat-TRS); }
.task-card.cat-WAR { box-shadow: inset 4px 0 0 var(--cat-WAR); }
.task-card.cat-LEAD { box-shadow: inset 4px 0 0 var(--cat-LEAD); }

/* Kategorie-Badges */
.badge-cat-LOG { background: var(--cat-LOG); color: #fff; }
.badge-cat-IND { background: var(--cat-IND); color: #1c1f24; }
.badge-cat-TRS { background: var(--cat-TRS); color: #1c1f24; }
.badge-cat-WAR { background: var(--cat-WAR); color: #fff; }
.badge-cat-LEAD { background: var(--cat-LEAD); color: #fff; }

/* Status: needs_help */
.task-card.status-needs_help { border-left-color: var(--status-needs-help); }
.badge-status-needs_help { background: var(--status-needs-help); color: #1c1f24; }

/* allow_partial Checkbox-Layout im Form */
#create-form label.checkbox {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}
#create-form label.checkbox input { width: auto; }

/* Phase B: Rollen-Badge-Farben */
.user-role.head_admin { background: #d9534f; color: #fff; }
.user-role.moderator  { background: #5a8dee; color: #fff; }

/* Local Login Box */
.local-login-box {
    margin-top: 24px;
    padding: 16px 18px;
    background: #262b32;
    border: 1px solid #3a414a;
    border-radius: 8px;
    max-width: 420px;
}
.local-login-box h3 { margin: 0 0 6px; color: #c0974a; }
.local-login-box p.hint { margin: 0 0 14px; color: #9aa0a6; font-size: 0.9em; }
.local-login-box label { display: block; margin-bottom: 10px; font-size: 0.9em; }
.local-login-box input[type="text"],
.local-login-box input[type="password"] {
    width: 100%; box-sizing: border-box;
    padding: 8px 10px; margin-top: 4px;
    background: #1c1f24; border: 1px solid #3a414a; border-radius: 4px;
    color: #e6e6e6;
}
.local-login-box .form-error {
    background: #d9534f22; border: 1px solid #d9534f;
    color: #ff8a8a; padding: 8px; border-radius: 4px;
    margin: 8px 0; font-size: 0.9em;
}
.local-login-box .form-actions {
    display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px;
}

/* ========== NEW: Stats-Bar, Multi-Filter, Task-Verfeinerungen ========== */

/* Stats-Bar oben in der App-Section */
.stats-bar {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.my-stats, .war-top3 {
    background: #262b32;
    border: 1px solid #3a414a;
    border-radius: 8px;
    padding: 12px 16px;
    flex: 1;
    min-width: 280px;
}
.my-stats-title, .war-top3-title {
    color: #c0974a;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 0.95em;
}
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    text-align: center;
}
.stats-grid .stat {
    background: #1c1f24;
    border: 1px solid #3a414a;
    border-radius: 6px;
    padding: 8px 4px;
    display: flex; flex-direction: column;
    gap: 2px;
}
.stats-grid .stat .num { font-size: 1.4em; font-weight: 700; color: #e6e6e6; }
.stats-grid .stat .label { font-size: 0.75em; color: #9aa0a6; }

ol.top3 {
    list-style: none; padding: 0; margin: 0;
}
ol.top3 li {
    display: flex; align-items: center; gap: 10px;
    padding: 4px 0;
    border-bottom: 1px solid #2a2f36;
}
ol.top3 li:last-child { border-bottom: none; }
ol.top3 li .rank { color: #c0974a; font-weight: 700; min-width: 22px; }
ol.top3 li .name { flex: 1; }
ol.top3 li .num { font-weight: 600; color: #4caf50; }
ol.top3 li.empty { color: #9aa0a6; font-style: italic; padding: 6px 0; }
.prev-war { margin-top: 10px; }
.prev-war > summary {
    cursor: pointer; color: #9aa0a6;
    font-size: 0.9em; padding: 4px 0;
}
.prev-war[open] > summary { margin-bottom: 6px; }

/* Multi-Filter Status (Checkbox-Gruppe) */
.filter-status-group {
    border: 1px solid #3a414a; border-radius: 6px; padding: 4px 10px;
    background: #1c1f24;
    margin-right: 8px;
}
.filter-status-group legend {
    padding: 0 4px; color: #9aa0a6; font-size: 0.85em;
}
.filter-status-group .cb {
    display: inline-flex; align-items: center; gap: 4px;
    margin-right: 8px; font-size: 0.9em;
}
.officer-only.hidden { display: none !important; }

/* Quantity-Row im Erstell-Form */
.qty-row { display: flex; gap: 8px; margin-top: 4px; }
.qty-row input[type="number"] { flex: 1; min-width: 100px; }
.qty-row select { flex: 1; min-width: 110px; }
small.hint { display: block; color: #9aa0a6; font-size: 0.8em; margin-top: 4px; }

/* TRS-Multi-Material-Sektion (Sammel-Transport-Aufgabe) */
#multi-material-section {
    margin-top: 8px;
    padding: 12px;
    border: 1px solid var(--border-color, #34384a);
    border-radius: 8px;
    background: var(--surface-2, rgba(255,255,255,0.02));
}
.multi-mat-header { margin-bottom: 8px; }
.multi-mat-title { display: block; font-weight: 600; color: var(--text-primary, #e6e6e6); }
.multi-mat-header small.hint { margin-top: 2px; }

.trs-materials-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 8px 0;
}
.trs-material-row {
    display: grid;
    grid-template-columns: 1.2fr 1.6fr 90px 110px auto;
    gap: 6px;
    align-items: center;
}
.trs-material-row select,
.trs-material-row input[type="number"] {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    padding: 6px 8px;
    font-size: 0.92rem;
}
.trs-mat-remove {
    padding: 4px 10px;
    line-height: 1;
    color: #c44;
    border-color: rgba(196,68,68,0.35);
}
.trs-mat-remove:hover { background: rgba(196,68,68,0.12); }
.trs-materials-actions {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 6px;
}

@media (max-width: 720px) {
    .trs-material-row {
        grid-template-columns: 1fr 1fr;
        grid-template-areas:
            "cat cat"
            "mat mat"
            "qty unit"
            "rem rem";
    }
    .trs-material-row .trs-mat-cat { grid-area: cat; }
    .trs-material-row .trs-mat-key { grid-area: mat; }
    .trs-material-row .trs-mat-qty { grid-area: qty; }
    .trs-material-row .trs-mat-unit { grid-area: unit; }
    .trs-material-row .trs-mat-remove { grid-area: rem; justify-self: end; }
}

/* Task-Card: #ID-Prefix, Notes, Mode-Badge */
.task-id-prefix {
    color: #c0974a; font-weight: 700;
    margin-right: 6px;
}
.task-notes {
    margin-top: 8px;
    padding: 8px 12px;
    background: #1c1f24;
    border-left: 3px solid #c0974a;
    border-radius: 4px;
    color: #c8cbcf;
    font-size: 0.9em;
    white-space: pre-line;  /* Newlines bewahren */
}
.badge-mode-min {
    background: #5a8dee22; color: #5a8dee; border: 1px solid #5a8dee44;
    padding: 2px 8px; border-radius: 10px;
    font-size: 0.75em;
}
.claimers {
    color: #4A8FC0;
    font-weight: 500;
}


/* R23 Warboard Logo (im Header) */
img.logo {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    display: block;
    object-fit: contain;
    background: transparent;
}
.brand .logo {  /* Falls noch span.logo Regeln aktiv: */
    display: inline-block;
    vertical-align: middle;
}
.brand-link img.logo {
    cursor: pointer;
}

/* ========== Aufgaben-Board UX-Polish ========== */

/* Status-Gruppen-Trenner */
.status-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 12px 8px;
    margin-top: 16px;
    border-bottom: 2px solid #3a414a;
    font-weight: 700;
    font-size: 1.1em;
    color: #c0974a;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.status-divider:first-of-type { margin-top: 0; }
.status-divider .status-name { flex: 1; }
.status-divider .status-count {
    background: #1c1f24;
    border: 1px solid #3a414a;
    color: #e6e6e6;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 0.75em;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
}
.status-divider-open { color: #c0974a; }
.status-divider-claimed { color: #5a8dee; }
.status-divider-needs_help { color: #d9534f; }
.status-divider-done { color: #4caf50; }

/* Single Category-Bar (3x breiter, ersetzt status-bar + cat-bar) */
.task-card {
    position: relative;
    border-left: none !important; /* Override aller alten status-Borders */
}
.task-card .task-cat-bar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 12px;        /* 3x breiter als der frühere ~4px Border */
    border-radius: 8px 0 0 8px;
    background: #6c757d; /* default fallback */
}
.task-card.cat-LOG  .task-cat-bar { background: var(--cat-LOG);  }
.task-card.cat-IND  .task-cat-bar { background: var(--cat-IND);  }
.task-card.cat-TRS  .task-cat-bar { background: var(--cat-TRS);  }
.task-card.cat-WAR  .task-cat-bar { background: var(--cat-WAR);  }
.task-card.cat-LEAD .task-cat-bar { background: var(--cat-LEAD); }
.task-card.cat-NONE .task-cat-bar { background: #6c757d; }
/* Padding links etwas erhöhen damit Inhalt nicht hinter dem Bar liegt */
.task-card { padding-left: 22px !important; }

/* Status-Badge im Card AUSBLENDEN (Status steht jetzt im Trenner) */
.task-head .badge-status-open,
.task-head .badge-status-claimed,
.task-head .badge-status-needs_help,
.task-head .badge-status-done {
    display: none;
}

/* Claimers/Completed-Footer am Ende der Card */
.task-claimers-footer {
    margin-top: 10px;
    padding: 8px 12px;
    background: #1c1f24;
    border-top: 1px solid #3a414a;
    border-radius: 0 0 6px 6px;
    font-size: 0.88em;
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}
.task-claimers-footer .claimers-label {
    font-weight: 700;
    letter-spacing: 0.05em;
    color: #5a8dee;
    font-size: 0.85em;
}
.task-claimers-footer.done .claimers-label { color: #4caf50; }
.task-claimers-footer .claimers-names {
    color: #e6e6e6;
    font-weight: 500;
}

/* Datetime-Picker: Calendar-Icon in Akzentfarbe einfaerben (war schwarz, kaum sichtbar im Dark-Theme).
   color-scheme: dark sorgt fuer den dunklen Native-Picker. Das Icon selbst wird komplett ausgeblendet
   und durch einen sichtbaren Hintergrund mit Akzent-Farbton ersetzt, damit es in jedem Theme sticht. */
input[type="datetime-local"], input[type="date"], input[type="time"] {
    color-scheme: dark;
    /* Etwas mehr rechtes Padding lassen damit das Icon-Feld Platz hat. */
    padding-right: 36px;
    position: relative;
}
input[type="datetime-local"]::-webkit-calendar-picker-indicator,
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
    /* Native Icon weiss faerben (Filter invertiert + saturated weiss) und vergroessern. */
    filter: invert(1) brightness(2);
    opacity: 0.95;
    cursor: pointer;
    width: 22px;
    height: 22px;
    padding: 2px;
    margin-right: 2px;
    border-radius: 4px;
    background-color: var(--accent, #c0974a);
    background-blend-mode: multiply;
    transition: background-color 0.15s ease, opacity 0.15s ease, transform 0.1s ease;
}
input[type="datetime-local"]::-webkit-calendar-picker-indicator:hover,
input[type="date"]::-webkit-calendar-picker-indicator:hover,
input[type="time"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
    transform: scale(1.05);
    background-color: var(--accent-strong, var(--accent, #c0974a));
}
/* Firefox: nutzt kein ::-webkit-calendar-picker-indicator, aber color-scheme: dark
   reicht meist. Sicherheits-Override fuer die Border-/Background-Farbe. */
@-moz-document url-prefix() {
    input[type="datetime-local"],
    input[type="date"],
    input[type="time"] {
        color: var(--text, #e6e6e6);
        background-color: var(--bg-elev-2, #2a2f37);
    }
}

/* Material-Dropdown: bisschen Padding-Luft, damit Emoji + Label gut aussieht */
#f-material option { padding: 4px 8px; }

/* ========== Custom Material-Dropdown ========== */
.custom-dropdown {
    position: relative;
    width: 100%;
}
.cd-trigger {
    width: 100%;
    background: #1c1f24;
    color: #e6e6e6;
    border: 1px solid #3a414a;
    border-radius: 4px;
    padding: 6px 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    text-align: left;
    font-size: 0.95em;
    transition: border-color 0.15s;
}
.cd-trigger:hover { border-color: #5a8dee; }
.cd-trigger:focus { outline: none; border-color: #c0974a; }
.cd-trigger .cd-icon {
    width: 28px; height: 28px;
    display: flex; align-items: center; justify-content: center;
    background: #2f353d;
    border-radius: 4px;
    flex-shrink: 0;
}
.cd-trigger .cd-icon img { width: 24px; height: 24px; object-fit: contain; }
.cd-trigger .cd-label { flex: 1; color: #e6e6e6; }
.cd-trigger .cd-arrow { color: #9aa0a6; font-size: 0.8em; }

.cd-panel {
    position: absolute;
    top: calc(100% + 4px);
    left: 0; right: 0;
    background: #262b32;
    border: 1px solid #3a414a;
    border-radius: 6px;
    max-height: 320px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}
.cd-panel.hidden { display: none; }

.cd-search {
    width: 100%;
    padding: 8px 12px;
    background: #1c1f24;
    color: #e6e6e6;
    border: none;
    border-bottom: 1px solid #3a414a;
    box-sizing: border-box;
    font-size: 0.9em;
}
.cd-search:focus { outline: none; background: #1a1d22; }

.cd-list {
    overflow-y: auto;
    flex: 1;
    padding: 4px 0;
}

.cd-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    cursor: pointer;
    transition: background-color 0.1s;
}
.cd-item:hover { background: rgba(192, 151, 74, 0.12); }
.cd-item.active { background: rgba(192, 151, 74, 0.2); }
.cd-item .cd-icon {
    width: 28px; height: 28px;
    background: #2f353d;
    border-radius: 4px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.cd-item .cd-icon img { width: 24px; height: 24px; object-fit: contain; }
.cd-item .cd-meta { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.cd-item .cd-name { font-size: 0.92em; color: #e6e6e6; }
.cd-item .cd-key { font-size: 0.7em; color: #9aa0a6; font-family: monospace; }

/* Scrollbar etwas dezenter */
.cd-list::-webkit-scrollbar { width: 8px; }
.cd-list::-webkit-scrollbar-thumb { background: #3a414a; border-radius: 4px; }
.cd-list::-webkit-scrollbar-track { background: transparent; }

/* ========== Auto-Refresh-Bar ==========
   Schmaler Balken zwischen Toolbar und Task-Liste: laeuft in 30s auf 100%,
   visualisiert wann der naechste Auto-Refresh kommt. Waehrend der API-Call
   laeuft, ersetzt eine Shimmer-Animation den Fill. */
.auto-refresh-bar {
  height: 3px;
  width: 100%;
  background: var(--bg-elev, #2a2f37);
  border-radius: 2px;
  overflow: hidden;
  margin: 6px 0 12px;
  position: relative;
}
.auto-refresh-bar.is-hidden { display: none; }

.auto-refresh-bar-inner {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--accent, #c0974a);
  border-radius: 2px;
  animation: auto-refresh-fill 30s linear infinite;
  transform-origin: left;
}
.auto-refresh-bar.is-paused .auto-refresh-bar-inner {
  animation-play-state: paused;
}

@keyframes auto-refresh-fill {
  from { width: 0%; opacity: 0.55; }
  to   { width: 100%; opacity: 1; }
}

/* Waehrend des laufenden Fetches: Shimmer ueber volle Breite. */
.auto-refresh-bar.is-refreshing .auto-refresh-bar-inner {
  width: 100% !important;
  animation: auto-refresh-shimmer 0.9s linear infinite;
  background: linear-gradient(
    90deg,
    var(--accent, #c0974a) 0%,
    rgba(255, 255, 255, 0.45) 50%,
    var(--accent, #c0974a) 100%
  );
  background-size: 200% 100%;
  opacity: 1;
}
@keyframes auto-refresh-shimmer {
  from { background-position: 100% 0; }
  to   { background-position: -100% 0; }
}

/* Reduced-Motion: Animationen aus, statischer Strich in Akzentfarbe. */
@media (prefers-reduced-motion: reduce) {
  .auto-refresh-bar-inner {
    animation: none;
    width: 100%;
    opacity: 0.6;
  }
  .auto-refresh-bar.is-refreshing .auto-refresh-bar-inner {
    animation: none;
    background: var(--accent, #c0974a);
  }
}

/* ===== Landing-Page ===== */
.landing-section { padding: 18px 0 40px; }
.landing-header {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  margin-bottom: 18px; flex-wrap: wrap;
}
.landing-header h2 { margin: 0; color: var(--accent); }
.landing-subtitle { margin: 4px 0 0; color: var(--text-dim); }

.my-request-card {
  background: var(--bg-elev);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 14px 18px;
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.my-request-card h3 { margin: 0; color: var(--accent); font-size: 1rem; }
.my-request-card p { margin: 0; color: var(--text); }
.my-request-card button { align-self: flex-start; }

.regiments-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.regiment-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.15s, transform 0.1s;
}
.regiment-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.regiment-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.regiment-card-head h3 { margin: 0; color: var(--text); }
.regiment-card .clan-tag {
  font-family: ui-monospace, Consolas, monospace;
  background: var(--bg-elev-2);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
  white-space: nowrap;
}
.regiment-desc {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.9rem;
  line-height: 1.45;
  max-height: 7em;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
}
.regiment-card-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-top: auto; padding-top: 8px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.regiment-card-foot .meta { font-size: 0.8rem; color: var(--text-dim); }
.regiment-card-foot .meta[href]:hover { color: var(--accent); }

/* Regiment-Karte: Logo-Bereich */
.regiment-card-top {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.regiment-logo {
  width: 60px;
  height: 60px;
  object-fit: contain;
  border-radius: 6px;
  background: var(--bg-elev-2);
  flex-shrink: 0;
  padding: 4px;
}
.regiment-card-info { flex: 1; min-width: 0; }
.regiment-card-info .regiment-card-head { flex-wrap: wrap; }

/* Aktionen in der Footer-Zeile */
.regiment-card-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  margin-left: auto;
}

/* Discord-Button */
.btn-discord {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #5865F2;
  color: #fff;
  border: none;
  text-decoration: none;
}
.btn-discord:hover { background: #4752C4; color: #fff; }
.discord-icon {
  width: 14px;
  height: 14px;
  fill: currentColor;
  flex-shrink: 0;
}

/* Datei-Upload-Feld */
.file-input {
  padding: 6px 0;
  background: transparent;
  border: none;
  color: var(--text);
  cursor: pointer;
  width: 100%;
}
.file-input::file-selector-button {
  background: var(--bg-elev-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 10px;
  margin-right: 8px;
  cursor: pointer;
  font-size: 0.85rem;
}
.file-input::file-selector-button:hover { border-color: var(--accent); color: var(--accent); }

/* Optional-Hinweis in Label */
.optional-hint { font-size: 0.8rem; color: var(--text-dim); font-weight: normal; }

.user-menu-static {
  display: inline-flex; align-items: center; gap: 10px;
}
.user-menu-static img { width: 28px; height: 28px; border-radius: 50%; }

textarea {
  width: 100%;
  background: var(--bg-elev);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 0.95rem;
  resize: vertical;
}
textarea:focus { outline: none; border-color: var(--accent); }


/* Label-Zeile: Text + Required-Marker (*) auf einer Zeile bleiben,
   auch wenn das umschliessende <label> flex-direction: column ist. */
.label-row {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
}
.required-marker {
  color: var(--danger, #d9534f);
  font-weight: 700;
}
