:root {
  --bg: #0b1220;
  --panel: rgba(255, 255, 255, 0.06);
  --panel-strong: rgba(255, 255, 255, 0.085);
  --border: rgba(255, 255, 255, 0.12);
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.7);
  --muted2: rgba(255, 255, 255, 0.55);
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  --radius: 18px;
  --radius-sm: 14px;
  --accent: #8b5cf6;
  --accent2: #22c55e;
  --warn: #f59e0b;
  --danger: #ef4444;
  --focus: 0 0 0 4px rgba(139, 92, 246, 0.35);
  /* Theme-fähige Hintergründe */
  --grad1: rgba(139, 92, 246, 0.25);
  --grad2: rgba(34, 197, 94, 0.2);
  --grad3: rgba(59, 130, 246, 0.18);
  --input-bg: rgba(10, 16, 30, 0.55);
  --card-bg: rgba(10, 16, 30, 0.6);
  --input-border: rgba(255, 255, 255, 0.14);
  --placeholder: rgba(255, 255, 255, 0.35);
  --login-bg: rgba(15, 23, 42, 0.9);
  /* Oberflächen (Buttons, Chips, Icon-Btns, Badges) */
  --surface: rgba(255, 255, 255, 0.06);
  --surface-border: rgba(255, 255, 255, 0.14);
  --surface-text: rgba(255, 255, 255, 0.85);
  --divider: rgba(255, 255, 255, 0.08);
  --badge-bg: rgba(139, 92, 246, 0.14);
  --badge-border: rgba(255, 255, 255, 0.14);
  --badge-text: rgba(255, 255, 255, 0.88);
  --pill-bg: rgba(10, 16, 30, 0.5);
  /* Modal */
  --modal-bg: linear-gradient(180deg, #020617, #020617f5);
  --modal-border: rgba(148, 163, 184, 0.8);
  --modal-divider: rgba(148, 163, 184, 0.45);
  --modal-preview-bg: rgba(15, 23, 42, 0.7);
  --modal-backdrop: rgba(15, 23, 42, 0.75);
}

/* ═══ Themes ═══════════════════════════════════════════════════════════════ */
[data-theme="dark2"] {
  --bg: #0d1b2e;
  --panel: rgba(255, 255, 255, 0.05);
  --panel-strong: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.1);
  --input-bg: rgba(5, 15, 30, 0.6);
  --card-bg: rgba(5, 15, 30, 0.65);
  --input-border: rgba(255, 255, 255, 0.12);
  --accent: #0ea5e9;
  --focus: 0 0 0 4px rgba(14, 165, 233, 0.35);
  --grad1: rgba(14, 165, 233, 0.2);
  --grad2: rgba(34, 197, 94, 0.15);
  --grad3: rgba(99, 102, 241, 0.15);
  --badge-bg: rgba(14, 165, 233, 0.14);
}

[data-theme="dark3"] {
  --bg: #0f0f14;
  --panel: rgba(255, 255, 255, 0.04);
  --panel-strong: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.09);
  --input-bg: rgba(20, 20, 28, 0.7);
  --card-bg: rgba(20, 20, 28, 0.65);
  --input-border: rgba(255, 255, 255, 0.1);
  --accent: #10b981;
  --focus: 0 0 0 4px rgba(16, 185, 129, 0.3);
  --grad1: rgba(16, 185, 129, 0.18);
  --grad2: rgba(59, 130, 246, 0.15);
  --grad3: rgba(139, 92, 246, 0.12);
  --badge-bg: rgba(16, 185, 129, 0.14);
}

[data-theme="light1"] {
  color-scheme: light;
  --bg: #eef2f8;
  --panel: rgba(255, 255, 255, 0.72);
  --panel-strong: rgba(255, 255, 255, 0.92);
  --border: rgba(0, 0, 0, 0.1);
  --text: rgba(15, 23, 42, 0.92);
  --muted: rgba(15, 23, 42, 0.6);
  --muted2: rgba(15, 23, 42, 0.45);
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
  --accent: #7c3aed;
  --focus: 0 0 0 4px rgba(124, 58, 237, 0.22);
  --grad1: rgba(124, 58, 237, 0.08);
  --grad2: rgba(34, 197, 94, 0.06);
  --grad3: rgba(59, 130, 246, 0.07);
  --input-bg: rgba(255, 255, 255, 0.85);
  --card-bg: rgba(255, 255, 255, 0.75);
  --input-border: rgba(0, 0, 0, 0.12);
  --placeholder: rgba(15, 23, 42, 0.35);
  --login-bg: rgba(230, 235, 245, 0.92);
  --surface: rgba(0, 0, 0, 0.05);
  --surface-border: rgba(0, 0, 0, 0.1);
  --surface-text: rgba(15, 23, 42, 0.85);
  --divider: rgba(0, 0, 0, 0.08);
  --badge-bg: rgba(124, 58, 237, 0.1);
  --badge-border: rgba(124, 58, 237, 0.28);
  --badge-text: rgba(15, 23, 42, 0.88);
  --pill-bg: rgba(255, 255, 255, 0.65);
  --modal-bg: linear-gradient(180deg, #f5f8ff, rgba(238, 242, 248, 0.97));
  --modal-border: rgba(0, 0, 0, 0.12);
  --modal-divider: rgba(0, 0, 0, 0.08);
  --modal-preview-bg: rgba(210, 220, 240, 0.55);
  --modal-backdrop: rgba(100, 120, 160, 0.35);
}

[data-theme="light2"] {
  color-scheme: light;
  --bg: #fdf6e3;
  --panel: rgba(255, 249, 225, 0.8);
  --panel-strong: rgba(255, 249, 225, 0.96);
  --border: rgba(120, 80, 0, 0.14);
  --text: rgba(55, 35, 5, 0.92);
  --muted: rgba(55, 35, 5, 0.6);
  --muted2: rgba(55, 35, 5, 0.45);
  --shadow: 0 20px 60px rgba(100, 60, 0, 0.12);
  --accent: #c2410c;
  --focus: 0 0 0 4px rgba(194, 65, 12, 0.22);
  --grad1: rgba(194, 65, 12, 0.09);
  --grad2: rgba(34, 197, 94, 0.07);
  --grad3: rgba(214, 158, 11, 0.1);
  --input-bg: rgba(255, 253, 235, 0.9);
  --card-bg: rgba(255, 253, 235, 0.82);
  --input-border: rgba(120, 80, 0, 0.18);
  --placeholder: rgba(55, 35, 5, 0.35);
  --login-bg: rgba(245, 235, 195, 0.92);
  --surface: rgba(0, 0, 0, 0.05);
  --surface-border: rgba(120, 80, 0, 0.14);
  --surface-text: rgba(55, 35, 5, 0.85);
  --divider: rgba(120, 80, 0, 0.08);
  --badge-bg: rgba(194, 65, 12, 0.1);
  --badge-border: rgba(194, 65, 12, 0.28);
  --badge-text: rgba(55, 35, 5, 0.88);
  --pill-bg: rgba(255, 249, 215, 0.75);
  --modal-bg: linear-gradient(180deg, #fffbee, rgba(253, 246, 227, 0.97));
  --modal-border: rgba(120, 80, 0, 0.18);
  --modal-divider: rgba(120, 80, 0, 0.1);
  --modal-preview-bg: rgba(245, 235, 195, 0.55);
  --modal-backdrop: rgba(160, 120, 40, 0.25);
}

[data-theme="light3"] {
  color-scheme: light;
  --bg: #f0f4f8;
  --panel: rgba(255, 255, 255, 0.78);
  --panel-strong: rgba(255, 255, 255, 0.95);
  --border: rgba(0, 0, 0, 0.09);
  --text: rgba(30, 41, 59, 0.92);
  --muted: rgba(30, 41, 59, 0.58);
  --muted2: rgba(30, 41, 59, 0.42);
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.08);
  --accent: #0d9488;
  --focus: 0 0 0 4px rgba(13, 148, 136, 0.2);
  --grad1: rgba(13, 148, 136, 0.07);
  --grad2: rgba(34, 197, 94, 0.06);
  --grad3: rgba(59, 130, 246, 0.06);
  --input-bg: rgba(255, 255, 255, 0.9);
  --card-bg: rgba(255, 255, 255, 0.8);
  --input-border: rgba(0, 0, 0, 0.1);
  --placeholder: rgba(30, 41, 59, 0.38);
  --login-bg: rgba(226, 232, 240, 0.94);
  --surface: rgba(0, 0, 0, 0.04);
  --surface-border: rgba(0, 0, 0, 0.09);
  --surface-text: rgba(30, 41, 59, 0.88);
  --divider: rgba(0, 0, 0, 0.06);
  --badge-bg: rgba(13, 148, 136, 0.1);
  --badge-border: rgba(13, 148, 136, 0.25);
  --badge-text: rgba(30, 41, 59, 0.88);
  --pill-bg: rgba(255, 255, 255, 0.7);
  --modal-bg: linear-gradient(180deg, #f8fafc, rgba(240, 244, 248, 0.98));
  --modal-border: rgba(0, 0, 0, 0.1);
  --modal-divider: rgba(0, 0, 0, 0.06);
  --modal-preview-bg: rgba(226, 232, 240, 0.5);
  --modal-backdrop: rgba(100, 116, 139, 0.3);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
}

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: radial-gradient(1000px 600px at 20% 10%, var(--grad1), transparent 65%),
    radial-gradient(900px 700px at 90% 30%, var(--grad2), transparent 60%),
    radial-gradient(900px 700px at 40% 90%, var(--grad3), transparent 60%),
    var(--bg);
}

/* App-Container: füllt den Viewport als Flex-Spalte */
.app-screen {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.bg {
  position: fixed;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.12) 1px, transparent 1px);
  background-size: 26px 26px;
  opacity: 0.08;
  pointer-events: none;
}

.login-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 30;
}

.login-box {
  width: min(360px, 100%);
  padding: 28px;
  background: linear-gradient(180deg, var(--panel-strong), var(--panel));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.login-title {
  margin: 0;
  font-size: 22px;
  text-align: center;
}

.login-subtitle {
  margin: 8px 0 20px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.login-form .field {
  margin-bottom: 14px;
}

.login-form .field:last-of-type {
  margin-bottom: 18px;
}

.login-error {
  margin: 0 0 12px;
  padding: 10px 12px;
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.5);
  border-radius: var(--radius-sm);
  color: #fca5a5;
  font-size: 13px;
}

.btn-block {
  width: 100%;
}

.user-info {
  font-size: 12px;
  color: var(--muted);
  margin-right: 8px;
  align-self: center;
}

.admin-panel {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: var(--login-bg);
  backdrop-filter: blur(16px);
  display: none;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  padding: 24px 18px;
}

.admin-panel.show {
  display: flex;
}

.admin-inner {
  width: 100%;
  max-width: 1600px;
}

.admin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.admin-tabs {
  margin-top: 16px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.admin-head h2 {
  margin: 0;
  font-size: 18px;
}

.admin-head p {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--muted2);
}

.admin-grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 16px;
}

.admin-user-list {
  margin-top: 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--card-bg);
  max-height: 220px;
  overflow-y: auto;
}

.admin-user-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  font-size: 12px;
  border-bottom: 1px solid var(--divider);
}

.admin-user-row .admin-user-meta {
  flex: 1;
  cursor: pointer;
}

.admin-user-delete-btn {
  flex-shrink: 0;
  padding: 4px 8px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
}

.admin-user-delete-btn:hover {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.2);
}

.admin-user-row:last-child {
  border-bottom: none;
}

.admin-user-row:hover {
  background: var(--panel);
}

.admin-user-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.admin-user-name {
  font-weight: 600;
}

.admin-user-extra {
  font-size: 11px;
  color: var(--muted2);
}

.admin-form {
  margin-top: 12px;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--panel-strong), var(--panel));
  display: flex;
  flex-direction: column;
  gap: 10px;
}

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

.admin-design-section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--divider);
}

.admin-design-section h3 {
  margin: 0 0 6px;
  font-size: 16px;
}

.admin-design-form {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px 20px;
  margin-top: 12px;
}

.admin-design-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.admin-design-field label {
  font-size: 12px;
  color: var(--muted);
}

.admin-design-field input[type="color"] {
  width: 100%;
  height: 36px;
  padding: 2px;
  border: 1px solid var(--input-border);
  border-radius: 10px;
  cursor: pointer;
  background: var(--input-bg);
}

.admin-design-field input[type="text"] {
  padding: 8px 10px;
  font-size: 13px;
}

.admin-design-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.admin-db-explorer {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--divider);
}

.admin-db-explorer h3 {
  margin: 0 0 6px;
  font-size: 16px;
}

.admin-db-hint {
  margin: 0 0 12px;
  font-size: 12px;
  color: var(--muted2);
}

.admin-db-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.admin-db-select {
  min-width: 180px;
}

.admin-db-sql {
  font-family: ui-monospace, monospace;
  font-size: 13px;
  resize: vertical;
}

.admin-db-actions {
  margin-top: 8px;
}

.admin-db-result-wrap {
  margin-top: 16px;
}

.admin-db-result-msg {
  font-size: 12px;
  margin-bottom: 8px;
}

.admin-db-result-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--card-bg);
  max-height: 360px;
  overflow-y: auto;
}

.admin-db-result-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.admin-db-result-table th,
.admin-db-result-table td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--divider);
}

.admin-db-result-table th {
  background: var(--panel);
  color: var(--muted);
  font-weight: 600;
  position: sticky;
  top: 0;
}

.admin-db-result-table tr:last-child td {
  border-bottom: none;
}

.admin-db-result-table td {
  color: var(--text);
}

.app-header {
  max-width: 1600px;
  margin: 28px auto 0;
  padding: 0 18px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
}

.title-wrap h1 {
  font-size: 26px;
  margin: 0;
  letter-spacing: -0.02em;
}

.subtitle {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  max-width: 64ch;
}

.header-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* ─── Haupt-Layout ─────────────────────────────────────────────────────────── */
.app {
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
  padding: 18px 18px 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
}

.app-top {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(260px, 1fr);
  gap: 14px;
  align-items: stretch;
  flex-shrink: 0;
}

.composer {
  background: linear-gradient(180deg, var(--panel-strong), var(--panel));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.composer-form {
  padding: 16px;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 12px;
}

#taskNotes {
  min-height: 90px;
  resize: vertical;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field-wide {
  grid-column: 1 / -1;
}

label {
  font-size: 12px;
  color: var(--muted);
}

input[type="text"],
input[type="email"],
input[type="search"],
input[type="password"],
input[type="number"],
textarea,
select {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--text);
  border-radius: 14px;
  padding: 12px 12px;
  outline: none;
  font-family: inherit;
  font-size: inherit;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.5)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

select option {
  background: var(--bg);
  color: var(--text);
}

select:focus {
  border-color: rgba(139, 92, 246, 0.55);
  box-shadow: var(--focus);
}

input::placeholder,
textarea::placeholder {
  color: var(--placeholder);
}

input:focus,
textarea:focus {
  border-color: rgba(139, 92, 246, 0.55);
  box-shadow: var(--focus);
}

.btn {
  border: 1px solid var(--surface-border);
  border-radius: 14px;
  padding: 11px 12px;
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.btn-primary {
  border-color: rgba(139, 92, 246, 0.5);
  background: linear-gradient(180deg, rgba(139, 92, 246, 0.95), rgba(99, 102, 241, 0.92));
}

.btn-primary:hover {
  background: linear-gradient(180deg, rgba(139, 92, 246, 1), rgba(99, 102, 241, 0.98));
}

.btn-secondary {
  border-color: rgba(34, 197, 94, 0.5);
  background: rgba(34, 197, 94, 0.14);
}

.btn-secondary:hover {
  background: rgba(34, 197, 94, 0.18);
}

.btn-ghost {
  background: transparent;
}

.btn-ghost:hover {
  background: var(--surface);
}

.composer-meta {
  padding: 0 16px 16px;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--divider);
}

.chips {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.chip {
  border: 1px solid var(--surface-border);
  background: var(--surface);
  color: var(--muted);
  border-radius: 999px;
  padding: 9px 10px;
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease, transform 120ms ease;
}

.chip:hover {
  background: var(--surface);
  color: var(--text);
}

.chip:active {
  transform: translateY(1px);
}

.chip-active {
  color: rgba(255, 255, 255, 0.92);
  border-color: rgba(139, 92, 246, 0.55);
  background: rgba(139, 92, 246, 0.16);
}

.search {
  min-width: min(420px, 100%);
}

.board {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  overflow-y: visible;
  padding-bottom: 8px;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
}

.board::-webkit-scrollbar {
  height: 10px;
}

.board::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 5px;
}

.board::-webkit-scrollbar-thumb {
  background: rgba(139, 92, 246, 0.4);
  border-radius: 5px;
}

.board::-webkit-scrollbar-thumb:hover {
  background: rgba(139, 92, 246, 0.6);
}

/* 4 Spalten sichtbar; bei mehr als 4 erscheint der horizontale Rollbalken */
.board .column {
  min-width: 268px;
  flex: 0 0 268px;
}

.board-shell {
  flex: 1 1 auto;
  max-height: calc(100vh - 260px);
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.column {
  background: linear-gradient(180deg, var(--panel-strong), var(--panel));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.column-head {
  padding: 14px 14px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--divider);
}

.column-head-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.column-head-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.column-head-actions .icon-btn {
  padding: 6px;
  min-width: 28px;
  min-height: 28px;
  font-size: 12px;
}

.column-head h2 {
  margin: 0;
  font-size: 14px;
  letter-spacing: -0.01em;
}

.count {
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  color: var(--muted);
}

.dropzone {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  overflow-y: visible;
  min-height: 0;
}

.dropzone.drop-target {
  outline: 2px dashed rgba(139, 92, 246, 0.45);
  outline-offset: -8px;
  background: rgba(139, 92, 246, 0.08);
}

.card {
  border: 1px solid var(--input-border);
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  padding: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  cursor: grab;
  user-select: none;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.card:active {
  cursor: grabbing;
}

.card.dragging {
  opacity: 0.7;
  transform: rotate(-0.6deg) scale(0.995);
  border-color: rgba(139, 92, 246, 0.55);
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.card-project {
  margin-top: 4px;
  font-size: 11.5px;
  color: var(--muted2);
}

.card-title {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.card-title[contenteditable="true"],
.card-notes[contenteditable="true"] {
  outline: none;
  border-radius: 10px;
  padding: 6px 8px;
  margin-left: -8px;
  margin-right: -8px;
  background: var(--surface);
  border: 1px solid var(--surface-border);
}

.card-title[contenteditable="true"]:focus,
.card-notes[contenteditable="true"]:focus {
  box-shadow: var(--focus);
  border-color: rgba(139, 92, 246, 0.5);
}

.badge {
  font-size: 11px;
  font-weight: 700;
  padding: 6px 8px;
  border-radius: 999px;
  border: 1px solid var(--badge-border);
  color: var(--badge-text);
  background: var(--badge-bg);
  white-space: nowrap;
}

.badge.done {
  background: rgba(34, 197, 94, 0.16);
  border-color: rgba(34, 197, 94, 0.32);
}

.badge.doing {
  background: rgba(245, 158, 11, 0.14);
  border-color: rgba(245, 158, 11, 0.32);
}

.badge.zuzuordnen {
  background: rgba(148, 163, 184, 0.2);
  border-color: rgba(148, 163, 184, 0.4);
}

.card-meta {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted2);
  font-size: 12px;
}

.email {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  overflow: hidden;
}

.email .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(139, 92, 246, 0.85);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.16);
  flex: 0 0 auto;
}

.email .txt {
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-actions {
  display: flex;
  gap: 8px;
}

.icon-btn {
  border: 1px solid var(--surface-border);
  background: var(--surface);
  color: var(--surface-text);
  border-radius: 12px;
  padding: 8px 9px;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, transform 120ms ease;
}

.icon-btn:hover {
  background: var(--surface);
  opacity: 0.85;
}

.icon-btn:active {
  transform: translateY(1px);
}

.icon-btn.danger:hover {
  border-color: rgba(239, 68, 68, 0.45);
  background: rgba(239, 68, 68, 0.14);
}

.icon-btn:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.card-notes {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.35;
  word-break: break-word;
}

.attachments {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.attachment-pill {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  font-size: 11.5px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--surface-border);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.attachment-pill:hover {
  background: rgba(139, 92, 246, 0.18);
  border-color: rgba(139, 92, 246, 0.45);
}

.attachment-icon {
  margin-right: 6px;
  font-size: 1em;
  line-height: 1;
  flex-shrink: 0;
}

.preview-type-icon {
  display: block;
  font-size: 1.5rem;
  margin-bottom: 8px;
  line-height: 1;
}

.project-sidebar {
  background: linear-gradient(180deg, var(--panel-strong), var(--panel));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
}

.project-sidebar-head h2 {
  margin: 0;
  font-size: 14px;
  letter-spacing: -0.01em;
}

.project-sidebar-head p {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--muted2);
}

.project-sidebar-body {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.project-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  /* Maximal 5 Pills sichtbar (~34px Höhe + 6px Gap pro Eintrag) */
  max-height: calc(5 * 34px + 4 * 6px);
  overflow-y: auto;
  padding-right: 2px;
}

.new-project-form,
.new-status-form {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}

.new-project-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-compact {
  padding-inline: 10px;
  padding-block: 7px;
  font-size: 12px;
}

.project-pill-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.project-pill-wrap .project-pill {
  flex: 1;
  min-width: 0;
}

.project-pill {
  width: 100%;
  text-align: left;
  border-radius: 999px;
  border: 1px solid var(--surface-border);
  background: var(--pill-bg);
  padding: 7px 10px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease, transform 120ms ease;
}

.project-delete-btn {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 120ms ease, background 120ms ease;
}

.project-rename-btn {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 120ms ease, background 120ms ease;
}

.project-rename-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.1);
}

.project-delete-btn:hover {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.2);
}

.project-pill:hover {
  background: var(--surface);
  color: var(--text);
}

.project-pill-active {
  border-color: rgba(139, 92, 246, 0.6);
  background: rgba(139, 92, 246, 0.22);
  color: rgba(255, 255, 255, 0.95);
}

.project-pill span {
  opacity: 0.7;
  margin-left: 6px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--modal-backdrop);
  backdrop-filter: blur(12px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 40;
}

.modal-backdrop.show {
  display: flex;
}

.modal {
  position: relative;
  width: min(780px, 100% - 40px);
  height: min(85vh, 820px);
  max-width: 96vw;
  max-height: 90vh;
  min-width: 320px;
  min-height: 280px;
  background: var(--modal-bg);
  border-radius: 20px;
  border: 1px solid var(--modal-border);
  box-shadow: 0 22px 70px rgba(15, 23, 42, 0.85);
  color: var(--text);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-resize-handle {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 24px;
  height: 24px;
  cursor: nwse-resize;
  background: linear-gradient(135deg, transparent 50%, var(--modal-divider) 50%);
  border-radius: 0 0 20px 0;
}

.modal-resize-handle:hover {
  background: linear-gradient(135deg, transparent 50%, var(--muted2) 50%);
}

.modal-head {
  padding: 14px 18px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--modal-divider);
}

.modal-head h2 {
  margin: 0;
  font-size: 16px;
}

.modal-subtitle {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted2);
}

.modal-body {
  padding: 14px 18px 4px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 12px;
}

.modal-grid textarea {
  resize: vertical;
  min-height: 70px;
}

.richtext-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}

.richtext-toolbar button {
  border: 1px solid var(--surface-border);
  background: var(--surface);
  color: var(--surface-text);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
  cursor: pointer;
}

.richtext-toolbar button:hover {
  background: rgba(148, 163, 184, 0.35);
}

.richtext {
  border-radius: 12px;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  padding: 8px 10px;
  min-height: 160px;
  max-height: 480px;
  overflow-y: auto;
  font-size: 13px;
  resize: vertical;
}

/* Farbenmenü Rich-Text */
.rt-color-wrap {
  position: relative;
}

.rt-color-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  padding: 10px;
  background: var(--modal-bg);
  border: 1px solid var(--modal-border);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  z-index: 20;
}

.rt-color-menu.open {
  display: block;
}

.rt-color-swatches {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  margin-bottom: 10px;
}

.rt-color-swatches button {
  width: 28px;
  height: 28px;
  border: 2px solid var(--surface-border);
  border-radius: 8px;
  cursor: pointer;
  padding: 0;
}

.rt-color-swatches button:hover {
  transform: scale(1.08);
}

.rt-color-custom {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted2);
}

.rt-color-custom input[type="color"] {
  width: 36px;
  height: 28px;
  border: 1px solid var(--input-border);
  border-radius: 8px;
  cursor: pointer;
  padding: 2px;
  background: var(--input-bg);
}

.richtext:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.modal-section {
  margin-top: 6px;
  border-top: 1px solid var(--modal-divider);
  padding-top: 10px;
}

.modal-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.modal-section-head h3 {
  margin: 0;
  font-size: 13px;
}

.modal-preview {
  margin-top: 10px;
  padding: 10px;
  border-radius: 12px;
  border: 1px dashed var(--modal-divider);
  background: var(--modal-preview-bg);
  min-height: 40px;
  font-size: 12px;
  color: var(--muted2);
}

.modal-preview img {
  max-width: 100%;
  border-radius: 10px;
  display: block;
}

.modal-preview iframe {
  width: 100%;
  min-height: 260px;
  border: none;
  border-radius: 10px;
}

.modal-footer {
  padding: 10px 18px 14px;
  border-top: 1px solid var(--modal-divider);
  display: flex;
  justify-content: flex-end;
}

.modal-progress-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-progress-row input[type="range"] {
  flex: 1;
}

.modal-progress-value {
  font-size: 12px;
  color: var(--muted);
  min-width: 34px;
  text-align: right;
}

.app-footer {
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
  padding: 8px 18px;
  color: var(--muted2);
  font-size: 12px;
  flex-shrink: 0;
}

.sep {
  margin: 0 8px;
  opacity: 0.6;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  background: rgba(10, 16, 30, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  padding: 10px 14px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 12.5px;
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(-2px);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Tablet */
@media (max-width: 980px) {
  .app-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .header-actions {
    width: 100%;
    justify-content: flex-start;
  }
  .app {
    padding-left: 12px;
    padding-right: 12px;
  }
  .app-top {
    grid-template-columns: 1fr;
  }
  .search {
    min-width: 0;
    width: 100%;
  }
  .composer-meta {
    flex-direction: column;
    align-items: stretch;
  }
  .modal {
    width: calc(100% - 24px);
    max-height: 90vh;
  }
  .modal-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .login-box {
    padding: 20px;
  }
  .login-title {
    font-size: 20px;
  }
  .app-header {
    padding-left: 12px;
    padding-right: 12px;
  }
  .title-wrap h1 {
    font-size: 22px;
  }
  .subtitle {
    font-size: 12px;
  }
  .btn {
    min-height: 44px;
    padding: 12px 14px;
  }
  .chip {
    min-height: 44px;
    padding: 10px 12px;
  }
  .board .column {
    min-width: 280px;
    flex: 0 0 280px;
  }
  .column {
    min-height: 300px;
  }
  .card {
    padding: 14px;
  }
  .card-actions {
    flex-wrap: wrap;
  }
  .icon-btn {
    min-height: 40px;
    min-width: 40px;
    padding: 10px;
  }
  .modal-backdrop {
    padding: 0;
    align-items: stretch;
  }
  .modal {
    width: 100%;
    max-width: 100%;
    max-height: 100%;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }
  .modal-head {
    padding: 16px 14px 12px;
  }
  .modal-body {
    padding: 14px;
  }
  .modal-footer {
    padding: 14px;
  }
  .project-sidebar {
    max-height: none;
  }
  .admin-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .admin-panel {
    padding-inline: 12px;
  }
  .new-project-row,
  .new-status-form .new-project-row {
    flex-direction: column;
    align-items: stretch;
  }
  .new-project-row .btn,
  #newStatusBtn {
    width: 100%;
  }
}

/* ─── Helle Themes: Korrekturen ──────────────────────────────────────────── */
/* Select-Pfeil: weißer SVG-Stroke → dunkler Stroke */
[data-theme="light1"] select,
[data-theme="light2"] select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='rgba(0,0,0,0.45)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}

/* Aktive Chips auf hellem Hintergrund lesbar halten */
[data-theme="light1"] .chip-active,
[data-theme="light2"] .chip-active {
  color: #fff;
}

/* Aktive Projekt-Pills auf hellem Hintergrund */
[data-theme="light1"] .project-pill-active,
[data-theme="light2"] .project-pill-active {
  color: #fff;
}

/* Input-Focus-Ring theme-angepasst */
[data-theme="light1"] input:focus,
[data-theme="light1"] textarea:focus,
[data-theme="light1"] select:focus,
[data-theme="light2"] input:focus,
[data-theme="light2"] textarea:focus,
[data-theme="light2"] select:focus {
  border-color: var(--accent);
}

/* ─── Theme Switcher ──────────────────────────────────────────────────────── */
.theme-switcher {
  display: flex;
  align-items: center;
}

.theme-select {
  appearance: none;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 28px 8px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  min-width: 120px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M2.5 4.5L6 8l3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.theme-select:hover {
  border-color: var(--accent);
}

.theme-select:focus {
  outline: none;
  box-shadow: var(--focus);
}

/* ─── Archiv-Sektion ──────────────────────────────────────────────────────── */
.archive-section {
  flex-shrink: 0;
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}

.archive-select-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.archive-select-row select {
  flex: 1;
  min-width: 0;
  font-style: italic;
  opacity: 0.85;
}

.archive-view-hint {
  margin: 6px 0 0;
  font-size: 12px;
}

/* ─── Projekt archivieren Button ──────────────────────────────────────────── */
.project-archive-btn {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 120ms ease, background 120ms ease;
}

.project-archive-btn:hover {
  color: var(--warn);
  background: rgba(245, 158, 11, 0.15);
}

/* Touch: sichtbare Scrollbalken auf Geräten mit grober Pointer-Auflösung */
@media (pointer: coarse) {
  .board {
    padding-bottom: 12px;
  }
  .board::-webkit-scrollbar {
    height: 12px;
  }
}
