/* Taskboard: Liquid-Glass-Look (helle Glasflächen über farbigem Grund) */
:root {
  --bg: #EEF1F8;
  --text: #1D1D1F;
  --text-2: #4B4B55;
  --line: rgba(255, 255, 255, 0.6);
  --glass: rgba(255, 255, 255, 0.46);
  --glass-strong: rgba(255, 255, 255, 0.68);
  --glass-edge: inset 0 1px 0 rgba(255, 255, 255, 0.85), inset 0 0 0 1px rgba(255, 255, 255, 0.35);
  --shadow: 0 10px 40px rgba(40, 50, 110, 0.12), 0 2px 6px rgba(40, 50, 110, 0.06);
  --card: rgba(255, 255, 255, 0.82);
  --card-hover: rgba(255, 255, 255, 0.95);
  --card-shadow: 0 1px 2px rgba(30, 35, 80, 0.08), 0 4px 14px rgba(30, 35, 80, 0.06);
  --blue: #0071E3;
  --blue-press: #0062C4;
  --red: #D70015;
  --seg: rgba(118, 118, 128, 0.14);
  --blur: blur(28px) saturate(175%);
  --radius-l: 22px;
  --radius-m: 14px;
  --radius-s: 10px;
  --col-eingang: #5B6B8C;
  --col-ai: #6E4BE0;
  --col-dich: #C25E00;
  --col-fokus: #0071E3;
  --col-erledigt: #1E7F3A;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0B0D14;
    --text: #F5F5F7;
    --text-2: #B4B4BE;
    --line: rgba(255, 255, 255, 0.12);
    --glass: rgba(36, 38, 52, 0.48);
    --glass-strong: rgba(40, 42, 58, 0.72);
    --glass-edge: inset 0 1px 0 rgba(255, 255, 255, 0.14), inset 0 0 0 1px rgba(255, 255, 255, 0.06);
    --shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
    --card: rgba(58, 60, 78, 0.72);
    --card-hover: rgba(70, 72, 92, 0.9);
    --card-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 14px rgba(0, 0, 0, 0.2);
    --blue: #0A84FF;
    --blue-press: #0071E3;
    --red: #FF6961;
    --seg: rgba(118, 118, 128, 0.28);
    --col-eingang: #9AA8C7;
    --col-ai: #B49CFF;
    --col-dich: #FFB340;
    --col-fokus: #64B5FF;
    --col-erledigt: #4CD964;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Farbiger Grund, durch den das Glas sichtbar wird */
.backdrop { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.blob { position: absolute; border-radius: 50%; filter: blur(70px); opacity: 0.55; }
.b1 { width: 52vw; height: 52vw; left: -12vw; top: -18vw; background: #7FB2FF; }
.b2 { width: 46vw; height: 46vw; right: -10vw; top: -8vw; background: #D7A6FF; }
.b3 { width: 42vw; height: 42vw; left: 28vw; bottom: -22vw; background: #8FE3D6; }
.b4 { width: 30vw; height: 30vw; right: 6vw; bottom: -6vw; background: #FFC98A; opacity: 0.45; }
@media (prefers-color-scheme: dark) {
  .blob { opacity: 0.32; }
  .b1 { background: #1E5BD8; } .b2 { background: #7B3FD1; } .b3 { background: #138A7A; } .b4 { background: #B4661A; opacity: 0.22; }
}

.glass {
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  box-shadow: var(--glass-edge), var(--shadow);
  border: 1px solid var(--line);
}

.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.logo-mark { width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(160deg, #3B8CFF, #6E4BE0); display: inline-flex; align-items: center; justify-content: center; flex: none; box-shadow: inset 0 1px 0 rgba(255,255,255,0.45), 0 3px 10px rgba(80, 70, 220, 0.35); }
.logo-mark svg { width: 17px; height: 17px; fill: none; stroke: #FFF; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; padding: 0 15px; border: 0; border-radius: var(--radius-s); font-weight: 600; cursor: pointer; white-space: nowrap; transition: background 0.15s, transform 0.1s; }
.btn:active { transform: scale(0.97); }
.btn:focus-visible, .card:focus-visible, .chip:focus-visible, .seg-btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--blue) 55%, transparent); outline-offset: 2px; }
.btn.primary { background: var(--blue); color: #FFF; box-shadow: inset 0 1px 0 rgba(255,255,255,0.25), 0 2px 8px color-mix(in srgb, var(--blue) 35%, transparent); }
.btn.primary:hover { background: var(--blue-press); }
.btn.primary:disabled { opacity: 0.45; cursor: default; }
.btn.ghost { background: var(--seg); color: var(--text); }
.btn.ghost:hover { background: color-mix(in srgb, var(--seg) 100%, rgba(118,118,128,0.12)); }
.btn.danger-ghost { background: transparent; color: var(--red); padding: 0 10px; }
.btn.danger-ghost.armed { background: var(--red); color: #FFF; }
.btn.wide { width: 100%; min-height: 46px; }
.icon-btn { width: 40px; padding: 0; }

/* Anmeldung */
.login { position: relative; z-index: 1; min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { width: min(380px, 100%); padding: 32px 28px 28px; border-radius: 28px; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.login-card .logo-mark { width: 52px; height: 52px; border-radius: 15px; }
.login-card .logo-mark svg { width: 28px; height: 28px; }
.login-card h1 { margin: 0 0 4px; font-size: 26px; letter-spacing: -0.02em; }
.login-card .field { width: 100%; }
.error { margin: 0; min-height: 1.2em; color: var(--red); font-size: 14px; font-weight: 500; }

/* Formfelder */
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.field input, .field select, .field textarea {
  width: 100%; min-height: 42px; padding: 9px 12px; border-radius: var(--radius-s);
  border: 1px solid color-mix(in srgb, var(--text) 12%, transparent);
  background: var(--glass-strong); color: var(--text); font-size: 15px; font-weight: 400;
  outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
.field textarea { resize: vertical; line-height: 1.45; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 25%, transparent); }
.title-input { font-size: 20px !important; font-weight: 700 !important; letter-spacing: -0.01em; min-height: 56px !important; resize: none !important; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.muted { margin: 0; color: var(--text-2); font-size: 14px; }
.small { font-size: 12.5px; }

/* App-Rahmen */
.app { position: relative; z-index: 1; height: 100%; display: flex; flex-direction: column; gap: 14px; padding: 14px 16px 0; padding-top: max(14px, env(safe-area-inset-top)); }
.topbar { display: flex; align-items: center; gap: 14px; padding: 10px 12px 10px 14px; border-radius: var(--radius-l); flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-name { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.filters { display: flex; gap: 4px; padding: 3px; border-radius: 12px; background: var(--seg); overflow-x: auto; scrollbar-width: none; max-width: 100%; flex: 0 1 auto; min-width: 0; }
.filters::-webkit-scrollbar { display: none; }
.chip { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px; border: 0; border-radius: 9px; background: transparent; font-weight: 500; font-size: 14px; cursor: pointer; white-space: nowrap; color: var(--text); }
.chip[aria-pressed="true"] { background: var(--glass-strong); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,0.12), inset 0 1px 0 rgba(255,255,255,0.6); }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08); }
.actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.search { display: flex; align-items: center; gap: 6px; height: 40px; padding: 0 12px; border-radius: var(--radius-s); background: var(--seg); color: var(--text-2); }
.search input { border: 0; outline: 0; background: transparent; width: 140px; color: var(--text); }
.search input::-webkit-search-cancel-button { opacity: 0.5; }

/* Spalten-Reiter (nur schmal) */
.coltabs { display: none; }

/* Board */
.board { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(5, minmax(250px, 1fr)); gap: 14px; overflow-x: auto; padding-bottom: max(16px, env(safe-area-inset-bottom)); }
.col { display: flex; flex-direction: column; min-height: 0; border-radius: var(--radius-l); }
.col-head { display: flex; align-items: center; gap: 10px; padding: 14px 12px 8px 16px; }
.col-icon { width: 26px; height: 26px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; flex: none; color: #FFF; }
.col-icon .ic { width: 15px; height: 15px; stroke-width: 2.1; }
.col-title { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.col-title h2 { margin: 0; font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }
.col-title p { margin: 0; font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.count { min-width: 26px; height: 24px; padding: 0 8px; border-radius: 12px; background: var(--seg); font-size: 13px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; font-variant-numeric: tabular-nums; }
.col-add { width: 32px; height: 32px; border-radius: 9px; border: 0; background: transparent; color: var(--text-2); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.col-add:hover { background: var(--seg); color: var(--text); }
.list { flex: 1; min-height: 60px; overflow-y: auto; padding: 4px 10px 12px; display: flex; flex-direction: column; gap: 8px; scrollbar-width: thin; }
.list.drop-target { background: color-mix(in srgb, var(--blue) 7%, transparent); border-radius: 0 0 var(--radius-l) var(--radius-l); }
.empty { margin: 6px 4px; padding: 18px 10px; border-radius: var(--radius-m); border: 1.5px dashed color-mix(in srgb, var(--text) 16%, transparent); color: var(--text-2); font-size: 13px; text-align: center; }
.quick { margin: 0 10px 12px; }
.quick input { width: 100%; min-height: 40px; padding: 8px 12px; border-radius: var(--radius-s); border: 1px dashed color-mix(in srgb, var(--text) 22%, transparent); background: transparent; color: var(--text); outline: none; }
.quick input:focus { border-style: solid; border-color: var(--blue); background: var(--glass-strong); }

/* Karten */
.card {
  position: relative; display: flex; flex-direction: column; gap: 8px; padding: 11px 12px 10px;
  border-radius: var(--radius-m); background: var(--card); box-shadow: var(--card-shadow), inset 0 1px 0 rgba(255,255,255,0.5);
  cursor: grab; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: manipulation;
  transition: background 0.15s, box-shadow 0.15s, opacity 0.15s;
}
.card:hover { background: var(--card-hover); }
.card .t { font-size: 14px; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card.done .t { color: var(--text-2); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--text) 30%, transparent); }
.meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
.tag { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 11px; background: var(--seg); font-weight: 600; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.tag.due { background: transparent; padding: 0 2px; }
.tag.due.over { color: var(--red); }
.tag.ai { background: color-mix(in srgb, var(--col-ai) 16%, transparent); color: var(--col-ai); }
.tag .ic { width: 13px; height: 13px; }
.card.placeholder { opacity: 0.35; box-shadow: none; outline: 2px dashed color-mix(in srgb, var(--blue) 50%, transparent); }
.ghost-card { position: fixed; z-index: 100; pointer-events: none; transform: rotate(2.5deg) scale(1.03); box-shadow: 0 18px 40px rgba(20, 25, 70, 0.28) !important; background: var(--card-hover) !important; }
body.dragging, body.dragging * { cursor: grabbing !important; }
.card.lifting { transform: scale(1.02); }

/* Dialoge */
.sheet { width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 0; border-radius: 26px; color: var(--text); overflow: auto; background: var(--glass-strong); }
.sheet::backdrop { background: rgba(15, 18, 35, 0.28); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.sheet form { display: flex; flex-direction: column; gap: 16px; padding: 22px 22px 18px; }
.sheet h2 { margin: 0; font-size: 22px; letter-spacing: -0.02em; }
.sheet-actions { display: flex; align-items: center; gap: 8px; justify-content: flex-end; padding-top: 4px; }
.spacer { flex: 1; }
.segmented { display: flex; gap: 3px; padding: 3px; border-radius: 12px; background: var(--seg); flex-wrap: wrap; }
.seg-btn { flex: 1 1 auto; min-height: 36px; padding: 0 10px; border: 0; border-radius: 9px; background: transparent; font-weight: 500; font-size: 13.5px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; color: var(--text); }
.seg-btn[aria-checked="true"] { background: var(--card-hover); font-weight: 700; box-shadow: 0 1px 3px rgba(0,0,0,0.12); }
.proj-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 46vh; overflow: auto; }
.proj-list li { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 12px; background: var(--card); }
.proj-list input[type=text] { flex: 1; min-width: 0; min-height: 36px; border: 0; background: transparent; font-weight: 600; outline: none; color: var(--text); }
.swatches { display: flex; gap: 4px; flex-wrap: wrap; }
.swatch { width: 22px; height: 22px; border-radius: 50%; border: 0; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.1); }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--glass-strong), 0 0 0 4px var(--text); }
.proj-add { display: flex; gap: 8px; align-items: flex-end; }
.grow { flex: 1; }
.proj-remove { border: 0; background: transparent; color: var(--text-2); cursor: pointer; width: 32px; height: 32px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; }
.proj-remove:hover { color: var(--red); background: var(--seg); }

.toast { position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 200; padding: 11px 18px; border-radius: 14px; font-weight: 600; font-size: 14px; display: flex; gap: 12px; align-items: center; background: var(--glass-strong); }
.toast button { border: 0; background: transparent; color: var(--blue); font-weight: 700; cursor: pointer; padding: 4px; }

/* Schmale Fenster und Handy: eine Spalte pro Bildschirm, wischen oder Reiter */
@media (max-width: 860px) {
  .app { padding: 10px 10px 0; gap: 10px; padding-top: max(10px, env(safe-area-inset-top)); }
  .topbar { gap: 10px; padding: 8px 8px 8px 12px; }
  .brand-name { display: none; }
  .actions { gap: 6px; }
  .search input { width: 90px; }
  .btn.primary span, #btnImport span { display: none; }
  #btnNew, #btnImport { width: 40px; padding: 0; }
  .filters { order: 5; flex-basis: 100%; }
  .coltabs { display: flex; gap: 3px; padding: 4px; border-radius: 16px; overflow-x: auto; scrollbar-width: none; }
  .coltabs::-webkit-scrollbar { display: none; }
  .coltab { flex: 1 0 auto; min-height: 36px; padding: 0 10px; border: 0; border-radius: 12px; background: transparent; font-weight: 600; font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; color: var(--text); }
  .coltab[aria-current="true"] { background: var(--glass-strong); box-shadow: 0 1px 3px rgba(0,0,0,0.12); }
  .coltab .n { font-variant-numeric: tabular-nums; color: var(--text-2); font-weight: 700; }
  .board { grid-template-columns: repeat(5, 100%); gap: 10px; scroll-snap-type: x mandatory; scrollbar-width: none; }
  .board::-webkit-scrollbar { display: none; }
  .col { scroll-snap-align: start; }
  .card { padding: 13px 14px 12px; }
  .card .t { font-size: 15px; }
  .sheet { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 26px 26px 0 0; max-height: 92dvh; }
  .sheet form { padding-bottom: max(18px, env(safe-area-inset-bottom)); }
  .row2 { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
