/* ======================================================
   TaskMgr - Global Layout (App + Auth) & Components
   ====================================================== */

/* --- Global Reset-ish bits we need --- */
*, *::before, *::after {
  box-sizing: border-box;
}

:root {
  --accent: #696cff;
  --error: #d9534f;
  --success: #28a745;
  --radius: 12px;
  --radius-card: 10px;
  --transition: 0.25s ease;
  --panel-max-width: 360px;

  /* Layout dimensions */
  --sidebar-width: 240px;
  --sidebar-width-collapsed: 64px;
  --topbar-height: 56px;

  /* Surfaces / shadows */
  --card-shadow-dark: 0 24px 48px rgba(0,0,0,0.4);
  --card-shadow-light: 0 24px 48px rgba(0,0,0,0.08);

  --border-color-light: rgba(0,0,0,0.08);
  --border-color-dark: rgba(255,255,255,0.08);
}

[data-theme="light"] {
  --bg: #f6f6f6;
  --text: #222;
  --card: #ffffff;
  --muted: #666;
  --input-bg: #eef1ff; /* sanftes sehr helles Lila/Blau */
  --input-border: #c7cdfd;
  --input-text: #000;
  --toast-bg: rgba(0, 0, 0, 0.8);

  --visual-bg-from: #696cff;
  --visual-bg-to: #4c4fff;
  --visual-card-bg: rgba(255,255,255,0.15);
  --visual-card-text: #fff;
  --visual-card-muted: rgba(255,255,255,0.8);
  --visual-border: rgba(255,255,255,0.2);

  --surface-blur: rgba(255,255,255,0.6);
  --surface-solid: #fff;
  --surface-border: var(--border-color-light);
  --topbar-bg: rgba(255,255,255,0.6);
  --sidebar-bg: #ffffffcc; /* leicht transparent weiß */
  --sidebar-border: var(--border-color-light);
  --page-scrollbar: rgba(0,0,0,0.3);
}

[data-theme="dark"] {
  --bg: #0f1117;
  --text: #eee;
  --card: #1a1c23;
  --muted: #aaa;
  --input-bg: #2a2d3a;
  --input-border: #444966;
  --input-text: #fff;
  --toast-bg: rgba(255, 255, 255, 0.1);

  --visual-bg-from: #2a2c73;
  --visual-bg-to: #4c4fff;
  --visual-card-bg: rgba(0,0,0,0.25);
  --visual-card-text: #fff;
  --visual-card-muted: rgba(255,255,255,0.8);
  --visual-border: rgba(255,255,255,0.2);

  --surface-blur: rgba(17,19,27,0.6);
  --surface-solid: #1a1c23;
  --surface-border: var(--border-color-dark);
  --topbar-bg: rgba(17,19,27,0.6);
  --sidebar-bg: rgba(26,28,35,0.8);
  --sidebar-border: var(--border-color-dark);
  --page-scrollbar: rgba(255,255,255,0.4);
}

/* ========== Base ========== */
body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Inter", Roboto, "Segoe UI", sans-serif;
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  transition: background var(--transition), color var(--transition);
  min-height: 100vh;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: opacity var(--transition);
}
a:hover {
  opacity: 0.8;
}

button {
  font-family: inherit;
  background: none;
  border: none;
  padding: 0;
  line-height: 1;
  cursor: pointer;
  color: inherit;
}

/* Custom scrollbar for content area */
.page-content::-webkit-scrollbar {
  width: 8px;
}
.page-content::-webkit-scrollbar-track {
  background: transparent;
}
.page-content::-webkit-scrollbar-thumb {
  background-color: var(--page-scrollbar);
  border-radius: 4px;
}

/* ======================================================
   APP-SHELL (nach Login)
   ====================================================== */

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  transition: grid-template-columns var(--transition), background var(--transition), color var(--transition);
}

/* collapsed state: sidebar narrow */
#appSidebar[data-collapsed="true"] ~ .app-main .topbar {
  padding-left: 1rem;
}
#appSidebar[data-collapsed="true"] {
  width: var(--sidebar-width-collapsed);
}
body[data-sidebar-collapsed="true"] .app-shell {
  grid-template-columns: var(--sidebar-width-collapsed) 1fr;
}

/* ======================================================
   SIDEBAR
   ====================================================== */
.sidebar {
  position: relative;
  background: var(--sidebar-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  padding: 0.75rem 0;
  transition: width var(--transition), background var(--transition), border-color var(--transition);
  width: var(--sidebar-width);
  min-width: 0;
  overflow: hidden;
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 .75rem 1rem .75rem;
}

.sidebar-logo .sidebar-brand {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-weight: 600;
  font-size: .95rem;
  color: var(--text);
}
.brand-icon {
  font-size: 1.1rem;
  line-height: 1;
}
.brand-text {
  line-height: 1.2;
  white-space: nowrap;
}

.sidebar-toggle {
  background: var(--surface-solid);
  border: 1px solid var(--surface-border);
  border-radius: 999px;
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  box-shadow: 0 8px 16px rgba(0,0,0,0.18);
  transition: all var(--transition);
}
.sidebar-toggle .chevron {
  display: block;
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 6px solid var(--text); /* ">" */
  transition: transform var(--transition);
}
#appSidebar[data-collapsed="true"] .sidebar-toggle .chevron {
  transform: rotate(180deg);
}

.sidebar-nav {
  flex: 1 1 auto;
  padding: 0 .5rem;
  overflow-y: auto;
}
.sidebar-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.sidebar-nav li {
  margin: .25rem 0;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: .75rem;
  font-size: .9rem;
  padding: .6rem .75rem;
  line-height: 1.3;
  border-radius: 8px;
  color: var(--text);
  transition: background var(--transition), color var(--transition), box-shadow var(--transition);
}
.nav-link:hover {
  background: rgba(105,108,255,0.4);
}
.nav-ico {
  width: 1.25rem;
  min-width: 1.25rem;
  text-align: center;
  font-size: 1rem;
  line-height: 1.2;
}
.nav-label {
  white-space: nowrap;
}

.sidebar-sep {
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--muted);
  padding: .75rem .75rem .5rem;
  opacity: .8;
  letter-spacing: .05em;
}

/* collapsed styles: hide labels, show only icons */
button#sidebarToggle {
    margin-right: 15px;
    font-size: 1.1em;
    color: gray;
}

#appSidebar[data-collapsed="true"] .brand-text,
#appSidebar[data-collapsed="true"] .nav-label,
#appSidebar[data-collapsed="true"] .sidebar-sep {
  display: none;
}
#appSidebar[data-collapsed="true"] .sidebar-head {
  justify-content: center;
}
#appSidebar[data-collapsed="true"] .sidebar-toggle {
  position: absolute;
  right: -14px;
  top: 12px;
  transform: translateX(100%);
  border-radius: 999px;
  width: 28px;
  height: 28px;
}
#appSidebar[data-collapsed="true"] .sidebar-logo {
  width: 100%;
  display: flex;
  justify-content: center;
}

/* ======================================================
   MAIN COLUMN
   ====================================================== */
.app-main {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg);
  transition: background var(--transition), color var(--transition);
}

/* ======================================================
   TOPBAR
   ====================================================== */
.topbar {
  height: var(--topbar-height);
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--topbar-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--surface-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem 0 1rem;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.topbar-left {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
}

.topbar-search {
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 320px;
  background: var(--surface-solid);
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  padding: 0 .5rem 0 .75rem;
  height: 36px;
  transition: box-shadow var(--transition), border var(--transition), background var(--transition);
}
.search-input {
  flex: 1 1 auto;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: .9rem;
  line-height: 1.3;
  outline: none;
}
.search-input::placeholder {
  color: var(--muted);
  opacity: .8;
}

.topbar-right {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: .75rem;
}

.topbar-btn {
  background: var(--surface-solid);
  color: var(--text);
  border: 1px solid var(--surface-border);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: .8rem;
  line-height: 0;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  transition: all var(--transition);
}
.topbar-btn:hover {
  /*box-shadow: 0 16px 32px rgba(105,108,255,0.4);*/
  border-color: var(--accent);
  color: var(--accent);
}

/* notification badge */
.badge {
  display: inline-block;
  min-width: 6px;
  min-height: 6px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(105,108,255,0.8);
  margin-left: 2px;
  align-self: flex-start;
  line-height: 0;
}
.badge[data-has="0"] {
  display: none;
}

/* Theme toggle icons: we already have .icon-sun/.icon-moon logic in HTML */
.icon-sun,
.icon-moon {
  font-size: 1rem;
  line-height: 1;
}
[data-theme="light"] .icon-sun { display: none; }
[data-theme="dark"]  .icon-moon { display: none; }

/* ======================================================
   USER MENU (Avatar + Dropdown)
   ====================================================== */
.user-menu {
  position: relative;
}

.user-trigger {
  background: var(--surface-solid);
  border: 1px solid var(--surface-border);
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-size: .8rem;
  line-height: 1.2;
  font-weight: 500;
  color: var(--text);
  padding: .4rem .6rem .4rem .4rem;
  transition: box-shadow var(--transition), border var(--transition), color var(--transition);
}
.user-trigger:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 16px 32px rgba(105,108,255,0.4);
}
.avatar-circle {
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: .8rem;
  font-weight: 600;
  line-height: 28px;
  text-align: center;
}
.user-name {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.2;
}

/* Dropdown panel */
.user-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + .5rem);
  min-width: 200px;
  background: var(--surface-solid);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  box-shadow: 0 24px 48px rgba(0,0,0,0.4);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: .75rem 0;
  z-index: 500;
  color: var(--text);
}
.user-dropdown-head {
  padding: 0 .75rem .75rem .75rem;
  border-bottom: 1px solid var(--surface-border);
  margin-bottom: .5rem;
}
.ud-name {
  font-size: .9rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
}
.ud-role {
  font-size: .75rem;
  color: var(--muted);
  line-height: 1.2;
  margin-top: .25rem;
}
.user-dropdown-links {
  list-style: none;
  margin: 0;
  padding: 0;
}
.user-dropdown-links li {
  margin: 0;
  padding: 0;
}
.user-dropdown-links a {
  display: block;
  font-size: .85rem;
  line-height: 1.4;
  color: var(--text);
  padding: .5rem .75rem;
  text-decoration: none;
  transition: background var(--transition), color var(--transition);
}
.user-dropdown-links a:hover {
  background: rgba(105,108,255,0.08);
  color: var(--accent);
}

/* ======================================================
   PAGE CONTENT WRAPPER
   ====================================================== */
.page-content {
  flex: 1 1 auto;
  min-height: 0; /* wichtig für flex overflow */
  overflow-y: auto;
  padding: 1rem 1rem 2rem;
  background: radial-gradient(circle at 20% 20%, rgba(105,108,255,0.12) 0%, transparent 60%), var(--bg);
  transition: background var(--transition), color var(--transition);
  display: block;
}

/* typische Card auf dem Dashboard */
.dashboard-card {
  background: var(--surface-solid);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  box-shadow: 0 5px 5px rgba(0,0,0,0.1);
  padding: 1rem 1rem 1rem;
  min-width: 0;
  transition: box-shadow var(--transition), background var(--transition), border var(--transition);
}
.dashboard-card h3 {
  margin: 0 0 .5rem 0;
  font-size: .9rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}
.dashboard-card .metric {
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
}
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(min(220px,100%),1fr));
  gap: 1rem;
  width: 100%;
  margin-bottom: 2rem;
}

/* ======================================================
   AUTH SHELL (Login / Register / Forgot ...)
   ====================================================== */

.auth-shell {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  position: relative;
}

/* ======================= */
/* Linke Seite / Visual BG */
/* ======================= */
.auth-visual {
  background: radial-gradient(circle at 20% 20%, var(--visual-bg-to) 0%, var(--visual-bg-from) 60%);
  color: var(--visual-card-text);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem 3rem;
  position: relative;
  overflow: hidden;
}
.auth-visual, .auth-panel {
  flex: 0 0 50%;
  max-width: 50%;
}

/* Deko: schwebende animierte Punkte */
.viz-dot {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255,255,255,0.35);
  animation: vizPulse 3s infinite;
}
.viz-dot.slow { animation-duration: 4.5s; }
.viz-dot.fast { animation-duration: 2s; }

@keyframes vizPulse {
  0%   { transform: scale(1) translateY(0); opacity: 0.6; }
  50%  { transform: scale(1.25) translateY(-2px); opacity: 1; }
  100% { transform: scale(1) translateY(0); opacity: 0.6; }
}

/* Inhalt links */
.auth-visual-inner {
  max-width: 480px;
  width: 100%;
  text-align: center;
  color: var(--visual-card-text);
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Headline + Claim */
.auth-visual-head {
  max-width: 360px;
  margin: 0 auto 2rem;
}
.auth-visual-head h2 {
  margin: 0 0 .5rem;
  font-size: 1.25rem;
  font-weight: 600;
  color: #fff;
}
.auth-visual-head p {
  margin: 0;
  font-size: .95rem;
  line-height: 1.5;
  color: var(--visual-card-muted);
}

/* "Widget"-Bereich */
.auth-visual-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 1rem;
  width: 100%;
  max-width: 460px;
}

/* Die Karten / Boxen in der Illustration */
.auth-visual-card {
  background: var(--visual-card-bg);
  border: 1px solid var(--visual-border);
  border-radius: var(--radius-card);
  color: var(--visual-card-text);
  padding: 1rem;
  text-align: left;
  font-size: 0.9rem;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  min-height: 110px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.auth-visual-card-title {
  color: #fff;
  font-weight: 600;
  margin-bottom: .5rem;
  font-size: 0.9rem;
}
.auth-visual-list {
  margin: 0;
  padding-left: 1rem;
  color: var(--visual-card-muted);
  line-height: 1.4;
  font-size: .9rem;
}
.auth-visual-list li {
  margin-bottom: .4rem;
}

.auth-visual-card.stat {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 110px;
  text-align: left;
}
.auth-visual-stat-num {
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}
.auth-visual-stat-label {
  font-size: 0.85rem;
  color: var(--visual-card-muted);
  line-height: 1.4;
}

/* ======================== */
/* Rechte Seite / Login Card*/
/* ======================== */
.auth-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  padding: 2rem 1.5rem 3rem;
  background: var(--bg);
}

/* Theme Toggle oben rechts */
.auth-panel-top {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
}
.theme-toggle-btn {
  background: var(--card);
  border: 2px solid var(--text);
  color: var(--text);
  border-radius: 8px;
  padding: 0.5rem;
  line-height: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}
.theme-toggle-btn:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  transform: scale(1.05);
}
.icon-24 {
  width: 24px;
  height: 24px;
}
.icon-20 {
  width: 20px;
  height: 20px;
}

/* Sonne/Mond Sichtbarkeit:
   - in LIGHT Theme soll der Mond erscheinen (d.h. "klick mich um dark zu bekommen")
   - in DARK Theme soll die Sonne erscheinen (klick = light)
*/
[data-theme="light"] .icon-sun { display: none; }
[data-theme="dark"]  .icon-moon { display: none; }

/* Card mit Formular */
.auth-card {
  background: var(--card);
  color: var(--text);
  padding: 2rem;
  border-radius: var(--radius);
  width: 100%;
  max-width: var(--panel-max-width);
  margin: 0 auto;
  box-shadow: var(--card-shadow-dark);
  transition: background var(--transition), color var(--transition), box-shadow var(--transition);
}
[data-theme="light"] .auth-card {
  box-shadow: var(--card-shadow-light);
}

.auth-title {
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text);
}
.auth-sub {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0 0 2rem;
  line-height: 1.4;
}

/* Formularfelder */
.auth-field {
  margin-bottom: 1.25rem;
}

.auth-label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
  color: var(--text);
  font-weight: 500;
}

.auth-label-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.auth-link-small {
  font-size: 0.85rem;
  color: var(--accent);
  white-space: nowrap;
  font-weight: 500;
  line-height: 1.2;
}

.auth-input-wrap {
  position: relative;
}

.auth-input-icon {
  position: absolute;
  top: 50%;
  left: 0.65rem;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
  line-height: 0;
}

.auth-input {
  width: 100%;
  display: block;
  font-size: 0.95rem;
  line-height: 1.4;
  border-radius: 6px;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--input-text);
  padding: 0.7rem 0.75rem 0.7rem 2.35rem;
  outline: none;
  transition: border var(--transition), box-shadow var(--transition), background var(--transition), color var(--transition);
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.auth-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(105,108,255,0.25);
}

/* Remember me */
.auth-remember {
  margin-top: 0.5rem;
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
  color: var(--text);
}
.auth-remember-check {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
}
.auth-remember-check input[type="checkbox"] {
  margin: 0 0.4rem 0 0;
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* Submit Button */
.auth-submit-btn {
  width: 100%;
  background: var(--accent);
  border: none;
  color: #fff;
  font-weight: 600;
  padding: 0.8rem;
  border-radius: 6px;
  cursor: pointer;
  text-align: center;
  font-size: 0.95rem;
  transition: opacity var(--transition), box-shadow var(--transition), transform var(--transition);
  box-shadow: 0 10px 24px rgba(105,108,255,0.4);
}
.auth-submit-btn:hover {
  opacity: 0.9;
  box-shadow: 0 16px 32px rgba(105,108,255,0.4);
  transform: translateY(-1px);
}

/* Registrierung */
.auth-register-hint {
  margin-top: 1.25rem;
  font-size: 0.9rem;
  text-align: center;
  color: var(--text);
}
.auth-link {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}
.auth-link:hover {
  opacity: 0.8;
}

/* ========== Toast / Growl ========== */
.toast-area {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  z-index: 9999;
  pointer-events: none;
}

.toast {
  min-width: 220px;
  max-width: 300px;
  background: var(--toast-bg);
  color: #fff;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  opacity: 0;
  transform: translateX(120%);
  animation: toast-slide-in 0.4s forwards;
  font-size: 0.9rem;
  line-height: 1.4;
  pointer-events: auto;
  cursor: pointer;
}
.toast.show {
  opacity: 1;
  transform: translateX(0);
}
.toast.hide {
  animation: toast-slide-out 0.4s forwards;
}

.toast-error {
  background: #d9534f;
  color: #fff;
}
.toast-success {
  background: #28a745;
  color: #fff;
}
.toast-info {
  background: var(--accent);
  color: #fff;
}

@keyframes toast-slide-in {
  from { opacity: 0; transform: translateX(120%); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes toast-slide-out {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(120%); }
}

/* ========== Responsive ========== */
@media (max-width: 1024px) {
  /* Sidebar auto-collapsed feeling */
  body:not([data-sidebar-collapsed="true"]) .app-shell {
    grid-template-columns: var(--sidebar-width-collapsed) 1fr;
  }
  #appSidebar {
    width: var(--sidebar-width-collapsed);
  }
  #appSidebar .brand-text,
  #appSidebar .nav-label,
  #appSidebar .sidebar-sep {
    display: none;
  }
  #appSidebar .sidebar-head {
    justify-content: center;
  }
  #appSidebar .sidebar-toggle {
    position: absolute;
    right: -14px;
    top: 12px;
    transform: translateX(100%);
  }
  #appSidebar .sidebar-logo {
    width: 100%;
    display: flex;
    justify-content: center;
  }

  .topbar {
    padding-left: 1rem !important;
  }

  .topbar-left {
    flex: 1 1 auto;
  }

  .topbar-search {
    max-width: 200px;
  }
}

@media (max-width: 860px) {
  /* Auth mobile */
  .auth-shell {
    flex-direction: column;
  }

  .auth-visual {
    display: none; /* Mobile: Illustration ausblenden, nur das Formular */
  }

  .auth-panel {
    min-height: 100vh;
    padding-top: 4rem;
    display: flex;
    justify-content: flex-start;
  }

  .auth-card {
    margin-top: 3rem;
  }

  /* Topbar on mobile: stack? (optional später) */
  .topbar-search {
    display: none;
  }
}


/* ======================================================
   TASKS VIEW (Listenansicht)
   ====================================================== */

.page-tasks {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  color: var(--text);
}

/* ===== Header oben: Titel, Breadcrumb, KPI-Row, Action-Icons ===== */

.tasks-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.tasks-head-left {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

.tasks-head-titles {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.tasks-page-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: .5rem;
}

.tasks-breadcrumb {
  font-size: .7rem;
  line-height: 1.2;
  color: var(--muted);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: .4rem;
}
.tasks-breadcrumb .crumb-sep {
  opacity: .6;
}

/* KPI-Row: kleine Cards mit Zahl + Label + Progress-Bar */

.tasks-kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(min(140px,100%),1fr));
  gap: .75rem;
  max-width: 600px;
}

.tasks-kpi-box {
  background: var(--surface-solid);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  box-shadow: 0 1px 5px 1px rgba(0, 0, 0, 0.1);
  padding: .75rem .75rem .6rem;
  min-width: 0;
  transition: background var(--transition), color var(--transition), border var(--transition), box-shadow var(--transition);
}

.kpi-num {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
}
.kpi-label {
  font-size: .75rem;
  color: var(--muted);
  line-height: 1.3;
  margin-top: .25rem;
}

/* kleine Leiste unten als Fortschrittsindikator */
.kpi-bar {
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: rgba(0,0,0,0.15);
  margin-top: .6rem;
  overflow: hidden;
  position: relative;
}
[data-theme="light"] .kpi-bar {
  background: rgba(0,0,0,0.08);
}
.kpi-bar > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(105,108,255,0.7);
}
/* später kannst du pro KPI andere Farben setzen, z.B. overdue rot, etc. */

.tasks-head-right {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
}

/* Icon-Bar rechts oben */
.tasks-actions-bar {
  background: var(--surface-solid);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  box-shadow: 0 1px 5px 1px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  padding: .5rem;
  gap: .5rem;
  min-height: 40px;
}

.tasks-action-btn {
  background: transparent;
  border: 1px solid #696cff;
  border-radius: 8px;
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  font-size: .8rem;
  color: var(--text);
  transition: all var(--transition);
}
.tasks-action-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 10px 20px rgba(105,108,255,0.4);
}

.tasks-add-btn {
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  line-height: 0;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  font-size: .8rem;
  font-weight: 600;
  box-shadow: 0 10px 24px rgba(105,108,255,0.4);
  transition: all var(--transition);
  border: 0;
}
.tasks-add-btn:hover {
  opacity: .9;
  box-shadow: 0 16px 32px rgba(105,108,255,0.4);
  transform: translateY(-1px);
}

/* ===== Filter-Leiste ===== */

.tasks-filters {
  background: var(--surface-solid);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  box-shadow: 0 1px 5px 1px rgba(0, 0, 0, 0.1);
  padding: .75rem 1rem;
  transition: background var(--transition), border var(--transition), color var(--transition), box-shadow var(--transition);
}

.tasks-filter-form {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
  justify-content: space-between;
}

.filter-left {
  flex: 1 1 200px;
  min-width: 200px;
}

.filter-search {
  position: relative;
  display: block;
}
.filter-input {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 6px;
  padding: .6rem .6rem .6rem 2rem;
  font-size: .9rem;
  color: var(--input-text);
  line-height: 1.3;
  outline: none;
  transition: border var(--transition), box-shadow var(--transition), background var(--transition), color var(--transition);
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.filter-input::placeholder {
  color: var(--muted);
  opacity: .8;
}
.filter-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(105,108,255,0.25);
  background: var(--surface-solid);
  color: var(--text);
}
.filter-icon {
  position: absolute;
  left: .6rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: .8rem;
  line-height: 1;
  pointer-events: none;
}

.filter-right {
  flex: 2 1 auto;
  display: flex;
  flex-wrap: wrap;
  gap: .75rem 1rem;
  align-items: flex-end;
  justify-content: flex-end;
}

.filter-field {
  display: flex;
  flex-direction: column;
  min-width: 120px;
}
.filter-label {
  font-size: .7rem;
  color: var(--muted);
  line-height: 1.2;
  font-weight: 500;
  margin-bottom: .3rem;
}
.filter-select {
  appearance: none;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 6px;
  padding: .55rem .6rem;
  font-size: .8rem;
  color: var(--input-text);
  line-height: 1.3;
  min-width: 120px;
  outline: none;
  transition: border var(--transition), box-shadow var(--transition), background var(--transition), color var(--transition);
}
.filter-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(105,108,255,0.25);
  background: var(--surface-solid);
  color: var(--text);
}

.filter-checkbox {
  font-size: .8rem;
  line-height: 1.3;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: .5rem;
}
.filter-checkbox input[type="checkbox"] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
  margin: 0;
  cursor: pointer;
}

.filter-apply-btn {
  background: var(--accent);
  border: none;
  border-radius: 6px;
  color: #fff;
  font-weight: 600;
  font-size: .8rem;
  line-height: 1.2;
  padding: .6rem .75rem;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(105,108,255,0.4);
  transition: all var(--transition);
}
.filter-apply-btn:hover {
  opacity: .9;
  box-shadow: 0 16px 32px rgba(105,108,255,0.4);
  transform: translateY(-1px);
}

/* ===== Tabelle / Task-Liste ===== */

.tasks-table-wrap {
  min-width: 0;
}

.tasks-table-card {
  background: var(--surface-solid);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  box-shadow: 0 1px 5px 1px rgba(0, 0, 0, 0.1);
  overflow-x: auto;
  transition: background var(--transition), border var(--transition), color var(--transition), box-shadow var(--transition);
}

/* Tabelle generisch */
.tasks-table {
  border-collapse: collapse;
  min-width: 800px;
  width: 100%;
  font-size: .8rem;
  line-height: 1.4;
  color: var(--text);
}
.tasks-table thead th {
  text-align: left;
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  padding: .75rem .75rem;
  border-bottom: 1px solid var(--surface-border);
  white-space: nowrap;
}
.tasks-table tbody tr.task-row {
  transition: background var(--transition), color var(--transition);
}
.tasks-table tbody tr.task-row:hover {
  background: rgba(105,108,255,0.06);
}
[data-theme="light"] .tasks-table tbody tr.task-row:hover {
  background: rgba(105,108,255,0.08);
}
.tasks-table tbody tr.task-row.done .task-title-link {
  text-decoration: line-through;
  color: var(--muted);
}
.tasks-table tbody td {
  padding: .75rem .75rem;
  border-bottom: 1px solid var(--surface-border);
  vertical-align: top;
  color: var(--text);
}

/* Spaltenbreiten grob */
.col-done    { width: 32px; }
.col-title   { min-width: 200px; }
.col-prio    { width: 80px; }
.col-assignee{ width: 160px; }
.col-tags    { min-width: 140px; }
.col-due     { width: 110px; white-space: nowrap; }
.col-status  { width: 120px; }
.col-actions { width: 80px; text-align: right; }

/* Checkbox "erledigt" */
.inline-done-form {
  margin: 0;
}
.task-done-check {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* Titelzelle */
.task-title-block {
  display: flex;
  flex-direction: column;
}
.task-title-link {
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  line-height: 1.3;
  font-size: .8rem;
  display: inline-block;
  max-width: 320px;
  word-break: break-word;
}
.task-title-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* Prio-Badge */
.task-prio-badge {
  display: inline-block;
  border-radius: 999px;
  font-size: .7rem;
  line-height: 1.2;
  font-weight: 500;
  padding: .25rem .5rem;
  border: 1px solid transparent;
  white-space: nowrap;
}
.prio-high {
  background: rgba(217,83,79,0.15);
  color: #d9534f;
  border-color: rgba(217,83,79,0.4);
}
.prio-normal {
  background: rgba(105,108,255,0.15);
  color: var(--accent);
  border-color: rgba(105,108,255,0.4);
}
.prio-low {
  background: rgba(153,153,153,0.15);
  color: #999;
  border-color: rgba(153,153,153,0.4);
}

/* Zugewiesen (Avatar + Name) */
.assignee-chip {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-size: .75rem;
  line-height: 1.2;
  max-width: 160px;
  white-space: nowrap;
}
.assignee-avatar {
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  border-radius: 999px;
  font-size: .7rem;
  font-weight: 600;
  color: #fff;
  line-height: 28px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}
.assignee-name {
  color: var(--text);
  text-overflow: ellipsis;
  overflow: hidden;
}

/* Tags */
.task-tags {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  max-width: 220px;
}
.task-tag-chip {
  background: transparent;
  border: 1px solid var(--surface-border);
  color: var(--text);
  font-size: .7rem;
  line-height: 1.2;
  border-radius: 999px;
  padding: .25rem .5rem;
  max-width: 100%;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}
.task-tag-empty {
  color: var(--muted);
  font-size: .7rem;
}

/* Due Date */
.task-due-date {
  font-size: .75rem;
  font-weight: 500;
  line-height: 1.2;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: .35rem;
}
.task-due-date.overdue {
  color: var(--error);
}
.task-due-alert {
  font-size: .8rem;
  line-height: 1;
  color: var(--error);
}
.task-due-empty {
  color: var(--muted);
  font-size: .7rem;
}

/* Status-Pill */
.task-status-pill {
  display: inline-block;
  border-radius: 999px;
  font-size: .7rem;
  line-height: 1.2;
  font-weight: 500;
  padding: .25rem .5rem;
  border: 1px solid transparent;
  white-space: nowrap;
}
.st-open {
  background: rgba(105,108,255,0.15);
  color: var(--accent);
  border-color: rgba(105,108,255,0.4);
}
.st-in_progress {
  background: rgba(0,0,0,0.15);
  color: var(--text);
  border-color: var(--surface-border);
}
[data-theme="light"] .st-in_progress {
  background: rgba(0,0,0,0.08);
}
.st-testing {
  background: rgba(0,0,0,0.15);
  color: var(--text);
  border-color: var(--surface-border);
}
[data-theme="light"] .st-testing {
  background: rgba(0,0,0,0.08);
}
.st-feedback {
  background: rgba(255,193,7,0.15); /* leicht gelb */
  color: #ffc107;
  border-color: rgba(255,193,7,0.4);
}
.st-done {
  background: rgba(40,167,69,0.15);
  color: #28a745;
  border-color: rgba(40,167,69,0.4);
}

/* Actions rechts */
.task-action-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .4rem;
}
.task-action-btn {
  background: transparent;
  border: 1px solid #696cff;
  border-radius: 6px;
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  line-height: 0;
  color: var(--text);
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}
.task-action-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 10px 20px rgba(105,108,255,0.4);
}

/* Leere Liste */
.task-empty-row td {
  text-align: center;
}
.task-empty-msg {
  padding: 2rem 1rem;
  color: var(--muted);
  font-size: .8rem;
  line-height: 1.4;
}
.task-empty-new {
  display: inline-block;
  margin-top: .5rem;
  font-size: .8rem;
  font-weight: 600;
  background: var(--accent);
  color: #fff;
  border-radius: 6px;
  padding: .5rem .75rem;
  box-shadow: 0 10px 24px rgba(105,108,255,0.4);
  transition: all var(--transition);
}
.task-empty-new:hover {
  opacity: .9;
  box-shadow: 0 16px 32px rgba(105,108,255,0.4);
  transform: translateY(-1px);
}

.task-btn {
    border: 1px solid #696cff;
    background: #696cff;
    color: #fff;
}

/* ===== Responsive Tweaks ===== */

@media (max-width: 700px) {
  .tasks-header {
    flex-direction: column;
    align-items: stretch;
  }
  .tasks-head-right {
    order: -1;
  }
  .tasks-actions-bar {
    width: 100%;
    justify-content: flex-end;
  }

  .tasks-filter-form {
    flex-direction: column;
    align-items: stretch;
  }
  .filter-left,
  .filter-right {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    justify-content: flex-start;
  }
  .filter-right {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .tasks-table {
    font-size: .8rem;
  }

  /* Mobile Darstellung:
     Statt 8 Spalten nebeneinander bauen wir Zeilen-"Cards" */
  .tasks-table thead {
    display: none;
  }
  .tasks-table tbody tr {
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-areas:
      "done title actions"
      ". meta  meta";
    row-gap: .5rem;
    padding: .75rem .75rem;
  }
  .tasks-table tbody td {
    border-bottom: 0;
    padding: 0;
  }
  .tasks-table-card {
    border-radius: var(--radius);
    overflow: hidden;
  }
  .task-row {
    border-bottom: 1px solid var(--surface-border);
  }

  .col-done    { grid-area: done; align-self: flex-start; }
  .col-title   { grid-area: title; }
  .col-actions { grid-area: actions; text-align: right; }

  /* "meta"-Bereich = Rest in einer Zeile klein zusammengefasst */
  .col-prio,
  .col-assignee,
  .col-tags,
  .col-due,
  .col-status {
    grid-area: meta;
    font-size: .7rem;
    line-height: 1.4;
    color: var(--muted);
    display: flex;
    flex-wrap: wrap;
    gap: .5rem .75rem;
  }

  .assignee-chip {
    font-size: .7rem;
  }
  .assignee-avatar {
    width: 24px;
    height: 24px;
    min-width: 24px;
    min-height: 24px;
    line-height: 24px;
    font-size: .65rem;
  }

  .task-status-pill {
    font-size: .7rem;
    padding: .2rem .4rem;
  }

  .task-prio-badge {
    font-size: .7rem;
    padding: .2rem .4rem;
  }
}
