/* ==========================================================================
   Roadmap — Design System (Inter · Micro-interactions · Light/Dark)
   ========================================================================== */

/* ---- Design Tokens ---- */
:root {
    /* Neutrale Flächen (Light) */
    --bg:           #f4f5f7;
    --bg-grad-a:    #eef1f6;
    --bg-grad-b:    #f6f7f9;
    --surface:      #ffffff;
    --surface-2:    #eceef1;      /* Listen-Hintergrund */
    --surface-hover:#f7f8fa;
    --text:         #16191d;
    --text-muted:   #5b636e;
    --text-faint:   #6c727c;
    --border:       #e3e6ea;
    --border-strong:#d3d8de;

    /* Marke / Akzent */
    --primary:      #5b5bf0;
    --primary-hover:#4a48e0;
    --primary-soft: #ecebff;
    --primary-fg:   #ffffff;
    --ring:         rgba(91, 91, 240, .45);

    /* Semantik */
    --danger:       #e0413a;
    --danger-soft:  #fdecea;
    --success:      #1f9e5f;
    --success-soft: #e7f6ee;
    --warning:      #d9822b;
    --warning-soft: #fdf0e3;

    /* Tiefen (Elevation) */
    --shadow-sm:  0 1px 2px rgba(16,20,28,.06), 0 1px 1px rgba(16,20,28,.04);
    --shadow:     0 2px 6px rgba(16,20,28,.08), 0 1px 2px rgba(16,20,28,.05);
    --shadow-md:  0 8px 20px rgba(16,20,28,.12), 0 2px 6px rgba(16,20,28,.06);
    --shadow-lg:  0 20px 48px rgba(16,20,28,.22);
    --shadow-card: 0 1px 2px rgba(16,20,28,.10), 0 2px 5px rgba(16,20,28,.05);

    /* Form */
    --radius-sm: 7px;
    --radius:    11px;
    --radius-lg: 16px;
    --radius-pill: 999px;

    /* Spacing-Skala (4/8) */
    --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s8: 48px;

    /* Bewegung */
    --t-fast: 110ms;
    --t:      180ms;
    --ease:   cubic-bezier(.4, 0, .2, 1);
    --ease-out: cubic-bezier(.16, 1, .3, 1);

    --topbar-h: 56px;
}

:root[data-theme="dark"] {
    --bg:           #0d0f13;
    --bg-grad-a:    #0d0f13;
    --bg-grad-b:    #121620;
    --surface:      #181c23;
    --surface-2:    #1c212a;
    --surface-hover:#222834;
    --text:         #e7eaef;
    --text-muted:   #9aa3af;
    --text-faint:   #828b98;
    --border:       #2a313b;
    --border-strong:#3a424e;

    --primary:      #7b7bff;
    --primary-hover:#9090ff;
    --primary-soft: #23253a;
    --primary-fg:   #ffffff;
    --ring:         rgba(123, 123, 255, .5);

    --danger:       #ff6b63;
    --danger-soft:  #2e1a1a;
    --success:      #41c684;
    --success-soft: #14241c;
    --warning:      #e8a45c;
    --warning-soft: #2a2014;

    --shadow-sm:  0 1px 2px rgba(0,0,0,.4);
    --shadow:     0 2px 8px rgba(0,0,0,.45);
    --shadow-md:  0 10px 26px rgba(0,0,0,.55);
    --shadow-lg:  0 24px 56px rgba(0,0,0,.6);
    --shadow-card: 0 1px 3px rgba(0,0,0,.5);
}

/* ---- Reset / Base ---- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }   /* schlägt display-Overrides (flex/grid) */
html, body { height: 100%; }
body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.55;
    color: var(--text);
    background:
        radial-gradient(1200px 600px at 80% -10%, color-mix(in srgb, var(--primary) 9%, transparent), transparent 60%),
        linear-gradient(180deg, var(--bg-grad-a), var(--bg-grad-b));
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;   /* kein horizontales Scrollen auf Mobil */
}
h1, h2, h3 { letter-spacing: -.02em; line-height: 1.2; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }
.muted { color: var(--text-muted); }
::selection { background: color-mix(in srgb, var(--primary) 28%, transparent); }

/* Icons */
.icon { width: 1.15em; height: 1.15em; flex: 0 0 auto; vertical-align: -.18em; }
.icon-sm { width: 1em; height: 1em; }

/* Sichtbare Focus-States (A11y) */
:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--ring);
    border-radius: var(--radius-sm);
}

/* ---- Topbar ---- */
.topbar {
    position: sticky; top: 0; z-index: 50;
    display: flex; align-items: center; justify-content: space-between; gap: var(--s2);
    height: var(--topbar-h); padding: 0 var(--s5); max-width: 100%;
    background: color-mix(in srgb, var(--surface) 82%, transparent);
    backdrop-filter: saturate(1.6) blur(14px);
    -webkit-backdrop-filter: saturate(1.6) blur(14px);
    border-bottom: 1px solid var(--border);
}
.brand {
    display: inline-flex; align-items: center; gap: var(--s2);
    color: var(--text); font-weight: 700; font-size: 17px; letter-spacing: -.02em;
}
.brand:hover { color: var(--text); }
.brand .brand-mark {
    display: grid; place-items: center; width: 30px; height: 30px;
    border-radius: 9px; color: #fff;
    background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 55%, #b06bff));
    box-shadow: var(--shadow-sm);
}
.topnav { display: flex; align-items: center; gap: var(--s2); }
.topnav-link {
    display: inline-flex; align-items: center; gap: 6px;
    color: var(--text-muted); font-weight: 500; font-size: 14px;
    padding: 7px 11px; border-radius: var(--radius-sm); transition: background var(--t-fast), color var(--t-fast);
}
.topnav-link:hover { color: var(--text); background: var(--surface-2); }
.topnav-user {
    display: inline-flex; align-items: center; gap: 7px;
    color: var(--text-muted); font-size: 14px; font-weight: 500; padding-right: 4px;
}
.icon-btn {
    display: grid; place-items: center; width: 36px; height: 36px;
    border: 1px solid var(--border); background: var(--surface); color: var(--text-muted);
    border-radius: var(--radius-sm); cursor: pointer; transition: all var(--t-fast);
}
.icon-btn:hover { color: var(--text); background: var(--surface-2); border-color: var(--border-strong); }
.icon-btn:active { transform: scale(.94); }

.content { min-height: calc(100vh - var(--topbar-h)); }

/* ---- Buttons ---- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    border: 1px solid transparent; cursor: pointer;
    background: var(--primary); color: var(--primary-fg);
    font: inherit; font-size: 14px; font-weight: 600; letter-spacing: -.01em;
    padding: 9px 15px; border-radius: var(--radius-sm);
    transition: background var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast), filter var(--t-fast);
    box-shadow: var(--shadow-sm);
}
.btn:hover { background: var(--primary-hover); color: var(--primary-fg); }
.btn:active { transform: translateY(1px) scale(.99); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-sm { padding: 6px 11px; font-size: 13px; gap: 5px; }
.btn-lg { padding: 12px 22px; font-size: 15px; border-radius: var(--radius); }
.btn-block { display: flex; width: 100%; }
.btn-ghost {
    background: var(--surface-2); color: var(--text); box-shadow: none; border-color: transparent;
}
.btn-ghost:hover { background: color-mix(in srgb, var(--text) 9%, transparent); color: var(--text); }
.btn-outline {
    background: var(--surface); color: var(--text); border-color: var(--border-strong); box-shadow: var(--shadow-sm);
}
.btn-outline:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--danger); box-shadow: none; }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 85%, #000); color: #fff; }

/* ---- Form-Controls ---- */
input[type=text], input[type=email], input[type=password], input[type=date],
input[type=color], select, textarea, .desc-area {
    width: 100%; font: inherit; font-size: 14px; color: var(--text);
    background: var(--surface); border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm); padding: 10px 12px;
    transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
input::placeholder, textarea::placeholder { color: var(--text-faint); }
input:focus, select:focus, textarea:focus, .desc-area:focus {
    outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring);
}
input[type=color] { padding: 3px; height: 40px; cursor: pointer; }
label.field { display: block; margin-bottom: var(--s4); font-size: 13px; font-weight: 600; color: var(--text); }
label.field > input, label.field > select, label.field > textarea { margin-top: 6px; font-weight: 400; }
small { font-weight: 400; color: var(--text-muted); }

.alert {
    display: flex; gap: 9px; align-items: flex-start;
    background: var(--danger-soft); color: color-mix(in srgb, var(--danger) 85%, #000);
    padding: 11px 13px; border-radius: var(--radius-sm); margin-bottom: var(--s4);
    font-size: 13.5px; border: 1px solid color-mix(in srgb, var(--danger) 25%, transparent);
}
:root[data-theme="dark"] .alert { color: var(--danger); }

/* ==========================================================================
   Auth / Landing
   ========================================================================== */
.auth-hero { max-width: 760px; margin: 12vh auto 0; text-align: center; padding: 0 var(--s5); }
.hero-badge {
    display: inline-flex; align-items: center; gap: 7px; margin-bottom: var(--s5);
    padding: 6px 13px; border-radius: var(--radius-pill); font-size: 13px; font-weight: 600;
    color: var(--primary); background: var(--primary-soft);
    border: 1px solid color-mix(in srgb, var(--primary) 22%, transparent);
}
.auth-hero h1 {
    font-size: clamp(34px, 6vw, 54px); margin: 0 0 var(--s4); font-weight: 800; letter-spacing: -.035em;
}
.auth-hero h1 .grad {
    background: linear-gradient(120deg, var(--primary), #b06bff 70%);
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.auth-hero p { font-size: clamp(16px, 2.4vw, 19px); color: var(--text-muted); max-width: 580px; margin: 0 auto; }
.auth-hero-actions { margin-top: var(--s6); display: flex; gap: var(--s3); justify-content: center; flex-wrap: wrap; }
.feature-row {
    margin: var(--s8) auto 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s4);
    max-width: 760px; padding: 0 var(--s5) var(--s8);
}
.feature {
    text-align: left; background: color-mix(in srgb, var(--surface) 70%, transparent);
    border: 1px solid var(--border); border-radius: var(--radius); padding: var(--s4);
    backdrop-filter: blur(6px);
}
.feature .icon { color: var(--primary); width: 22px; height: 22px; }
.feature h3 { font-size: 15px; margin: 9px 0 4px; }
.feature p { font-size: 13.5px; color: var(--text-muted); margin: 0; }
@media (max-width: 680px) { .feature-row { grid-template-columns: 1fr; } }

.auth-card {
    max-width: 420px; margin: 8vh auto; background: var(--surface); padding: var(--s6);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-md); border: 1px solid var(--border);
}
.auth-card h1 { margin: 0 0 var(--s5); font-size: 26px; font-weight: 800; }
.auth-switch { margin-top: var(--s5); text-align: center; color: var(--text-muted); font-size: 14px; }
.checkbox-row { display: flex; align-items: center; gap: 9px; margin-bottom: var(--s4); font-size: 14px; font-weight: 500; cursor: pointer; }
.checkbox-row input { width: 18px; height: 18px; margin: 0; flex: 0 0 auto; accent-color: var(--primary); cursor: pointer; }

/* ==========================================================================
   Dashboard
   ========================================================================== */
.dashboard { max-width: 1140px; margin: 0 auto; padding: var(--s6) var(--s5) var(--s8); }
.dash-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); margin-bottom: var(--s5); }
.dash-head h1 { font-size: 26px; font-weight: 800; margin: 0; }
.section-label {
    display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint);
    margin: var(--s6) 0 var(--s3);
}
.board-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: var(--s4);
}
.board-tile {
    position: relative; height: 116px; border-radius: var(--radius); padding: var(--s4);
    color: #fff; display: flex; flex-direction: column; justify-content: flex-end;
    overflow: hidden; box-shadow: var(--shadow); isolation: isolate;
    transition: transform var(--t) var(--ease-out), box-shadow var(--t);
}
.board-tile::after {
    content: ''; position: absolute; inset: 0; z-index: -1;
    background: linear-gradient(160deg, rgba(255,255,255,.18), rgba(0,0,0,.45));
}
.board-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); color: #fff; }
.board-tile-title { font-weight: 700; font-size: 16px; text-shadow: 0 1px 3px rgba(0,0,0,.35); }
.board-tile-meta {
    display: inline-flex; align-items: center; gap: 6px; margin-top: 4px;
    font-size: 12px; font-weight: 500; opacity: .95; text-shadow: 0 1px 2px rgba(0,0,0,.4);
}
.board-tile-meta .icon { width: 14px; height: 14px; }
.board-tile.new {
    color: var(--text-muted); background: transparent; border: 1.5px dashed var(--border-strong);
    align-items: center; justify-content: center; box-shadow: none; gap: 6px; flex-direction: row;
}
.board-tile.new::after { display: none; }
.board-tile.new:hover { color: var(--primary); border-color: var(--primary); transform: translateY(-3px); }
.empty-hint {
    grid-column: 1 / -1; color: var(--text-muted); font-size: 14px;
    padding: var(--s5); text-align: center; border: 1.5px dashed var(--border); border-radius: var(--radius);
}

/* ==========================================================================
   Board-Ansicht
   ========================================================================== */
.board-view { min-height: calc(100vh - var(--topbar-h)); display: flex; flex-direction: column; position: relative; }
.board-view::before {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,.16), rgba(0,0,0,.28));
    pointer-events: none;
}
.board-bar {
    position: relative; z-index: 2;
    display: flex; align-items: center; justify-content: space-between; gap: var(--s4);
    padding: var(--s3) var(--s5);
    background: color-mix(in srgb, #000 34%, transparent);
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    color: #fff;
}
.board-bar-left { display: flex; align-items: center; gap: var(--s3); min-width: 0; }
.board-name { font-size: 19px; font-weight: 700; margin: 0; text-shadow: 0 1px 3px rgba(0,0,0,.4); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board-vis {
    display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto;
    font-size: 12.5px; font-weight: 600; background: rgba(255,255,255,.22);
    padding: 4px 10px; border-radius: var(--radius-pill); color: #fff;
}
.board-vis .icon { width: 14px; height: 14px; }
.board-bar-right { display: flex; align-items: center; gap: var(--s3); }
.board-bar-right .btn-outline {
    background: rgba(255,255,255,.16); color: #fff; border-color: rgba(255,255,255,.28); backdrop-filter: blur(4px);
}
.board-bar-right .btn-outline:hover { background: rgba(255,255,255,.28); color: #fff; }
.member-avatars { display: flex; }
.member-avatars .avatar { margin-left: -7px; border: 2px solid rgba(255,255,255,.85); box-shadow: var(--shadow-sm); }

/* Listen-Spalten */
.lists {
    position: relative; z-index: 1; flex: 1; display: flex; align-items: flex-start; gap: var(--s3);
    padding: var(--s4) var(--s5) var(--s6); overflow-x: auto; scroll-padding: var(--s5);
}
.list {
    background: var(--surface-2); border-radius: var(--radius); width: 286px; flex: 0 0 286px;
    max-height: calc(100vh - var(--topbar-h) - 96px); display: flex; flex-direction: column;
    box-shadow: var(--shadow); border: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
}
.list.sortable-chosen { box-shadow: var(--shadow-lg); }
.list-header { display: flex; align-items: center; padding: 10px 9px 5px; gap: 4px; }
.list-grip {
    color: var(--text-faint); cursor: grab; display: grid; place-items: center;
    width: 24px; height: 28px; border-radius: 6px; flex: 0 0 auto; opacity: .65;
}
.list-grip:hover { background: color-mix(in srgb, var(--text) 8%, transparent); opacity: 1; }
.list-grip:active { cursor: grabbing; }
.list-title-input {
    flex: 1; min-width: 0; border: 1px solid transparent; background: transparent; font-weight: 700;
    font-size: 14.5px; padding: 5px 7px; border-radius: var(--radius-sm); color: var(--text);
}
.list-title-input:hover { background: color-mix(in srgb, var(--text) 5%, transparent); }
.list-title-input:focus { background: var(--surface); border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
.list-menu-btn {
    border: none; background: transparent; cursor: pointer; color: var(--text-faint);
    display: grid; place-items: center; width: 28px; height: 28px; border-radius: 6px; flex: 0 0 auto;
    transition: all var(--t-fast);
}
.list-menu-btn:hover { background: var(--danger-soft); color: var(--danger); }
.cards { padding: 4px 8px; overflow-y: auto; flex: 1 1 auto; min-height: 6px; }
.cards::-webkit-scrollbar, .lists::-webkit-scrollbar { width: 9px; height: 9px; }
.cards::-webkit-scrollbar-thumb, .lists::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--text) 18%, transparent); border-radius: 99px; }
.lists::-webkit-scrollbar-thumb { background: rgba(255,255,255,.35); }

/* Karten */
.card {
    background: var(--surface); border-radius: var(--radius-sm); box-shadow: var(--shadow-card);
    padding: 9px 11px; margin-bottom: 8px; cursor: pointer; font-size: 14px;
    border: 1px solid transparent;
    transition: transform var(--t-fast) var(--ease-out), box-shadow var(--t-fast), border-color var(--t-fast);
}
.card:hover { border-color: color-mix(in srgb, var(--primary) 45%, transparent); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.card:active { transform: scale(.99); }
.card.sortable-ghost { opacity: .45; }
.card.sortable-drag { box-shadow: var(--shadow-lg); transform: rotate(2deg); }
.card.dragging { opacity: .5; }
.card-cover {
    height: 124px; border-radius: 6px; margin: -1px -1px 9px; background-size: cover; background-position: center;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,.06);
}
.card-labels { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 7px; }
.card-label {
    font-size: 11px; font-weight: 600; color: #fff; padding: 2px 9px; border-radius: var(--radius-pill);
    max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-height: 17px; line-height: 14px;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,.08);
}
.card-title { line-height: 1.4; word-break: break-word; color: var(--text); font-weight: 500; }
.card-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 9px; }
.badge { font-size: 12px; font-weight: 600; color: var(--text-muted); display: inline-flex; align-items: center; gap: 4px; }
.badge .icon { width: 14px; height: 14px; }
.badge-due { background: var(--surface-2); padding: 3px 8px; border-radius: var(--radius-pill); }
.badge-due.badge-overdue { background: var(--danger-soft); color: var(--danger); }
.badge-done { background: var(--success-soft); color: var(--success); padding: 3px 8px; border-radius: var(--radius-pill); }
.avatar {
    width: 25px; height: 25px; border-radius: 50%; color: #fff; font-size: 11px; font-weight: 700;
    display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
    background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 50%, #b06bff));
}
.avatar-lg { width: 31px; height: 31px; font-size: 12px; }

/* Karte hinzufügen */
.add-card { padding: 4px 8px 9px; }
.add-card-input {
    width: 100%; border: 1px solid transparent; border-radius: var(--radius-sm); padding: 9px 10px; font: inherit;
    font-size: 14px; resize: none; background: var(--surface); box-shadow: var(--shadow-card); color: var(--text);
}
.add-card-input::placeholder { color: var(--text-faint); }
.add-card-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
.add-card-actions { display: flex; gap: 7px; margin-top: 7px; align-items: center; }

.board-empty {
    color: #fff; background: rgba(255,255,255,.14); border: 1.5px dashed rgba(255,255,255,.45);
    border-radius: var(--radius); padding: var(--s5); font-weight: 600; align-self: flex-start;
    max-width: 320px; backdrop-filter: blur(4px);
}

/* Listen-Composer */
.list-composer { width: 286px; flex: 0 0 286px; }
.add-list-btn {
    display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; border: none; cursor: pointer;
    color: #fff; background: rgba(255,255,255,.18); padding: 12px 14px; border-radius: var(--radius);
    font: inherit; font-size: 14px; font-weight: 600; backdrop-filter: blur(4px); transition: background var(--t-fast);
}
.add-list-btn:hover { background: rgba(255,255,255,.30); }
.add-list-form { background: var(--surface-2); padding: 9px; border-radius: var(--radius); box-shadow: var(--shadow); }
.add-list-form input { border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
.add-list-actions { display: flex; gap: 7px; margin-top: 8px; align-items: center; }

/* ==========================================================================
   Modals
   ========================================================================== */
.modal-overlay {
    position: fixed; inset: 0; z-index: 100; background: rgba(8, 10, 14, .55);
    backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
    display: flex; align-items: flex-start; justify-content: center; padding: 6vh var(--s4) var(--s5);
    overflow-y: auto; animation: overlay-in var(--t) var(--ease) both;
}
.modal-overlay[hidden] { display: none; }
@keyframes overlay-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
    background: var(--surface); border-radius: var(--radius-lg); width: 100%;
    box-shadow: var(--shadow-lg); border: 1px solid var(--border);
    animation: modal-in var(--t) var(--ease-out) both;
}
@keyframes modal-in { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-sm { max-width: 460px; }
.modal-lg { max-width: 860px; }
.modal-header { display: flex; align-items: center; gap: var(--s3); padding: var(--s5) var(--s5) var(--s3); }
.modal-header h2 { margin: 0; font-size: 18px; font-weight: 700; flex: 1; }
.modal-title-input {
    flex: 1; border: 1px solid transparent; background: transparent; font-size: 19px; font-weight: 700;
    padding: 6px 9px; border-radius: var(--radius-sm); color: var(--text); letter-spacing: -.02em;
}
.modal-title-input:hover { background: var(--surface-2); }
.modal-title-input:focus { outline: none; background: var(--surface); border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
.modal-close {
    border: none; background: var(--surface-2); color: var(--text-muted); cursor: pointer;
    display: grid; place-items: center; width: 34px; height: 34px; border-radius: var(--radius-sm); flex: 0 0 auto;
    transition: all var(--t-fast);
}
.modal-close:hover { background: var(--danger-soft); color: var(--danger); }
.modal-body { padding: var(--s2) var(--s5) var(--s5); }
.card-modal-body { display: grid; grid-template-columns: 1fr 232px; gap: var(--s5); }
@media (max-width: 740px) { .card-modal-body { grid-template-columns: 1fr; } }

/* Modal-Inhalt */
.section { margin-bottom: var(--s5); }
.section h3 {
    display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); margin: 0 0 var(--s2);
}
.section h3 .icon { color: var(--text-muted); width: 15px; height: 15px; }
.desc-area { min-height: 96px; resize: vertical; line-height: 1.5; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip {
    font-size: 12.5px; font-weight: 600; padding: 5px 12px; border-radius: var(--radius-pill); cursor: pointer;
    background: var(--surface); border: 1px solid var(--border-strong); color: var(--text);
    transition: all var(--t-fast);
}
.chip:hover { border-color: var(--primary); }
.chip.active { background: var(--primary); color: var(--primary-fg); border-color: var(--primary); }
.label-chip { color: #fff; border: none; box-shadow: inset 0 0 0 1px rgba(0,0,0,.1); }
.inline-form { display: flex; gap: 7px; margin-top: 9px; align-items: center; flex-wrap: wrap; }
.inline-form input[type=text] { flex: 1; min-width: 120px; }
.inline-form input[type=color] { width: 44px; flex: 0 0 auto; }

.side-actions { display: flex; flex-direction: column; gap: 7px; margin-bottom: var(--s5); }

.checklist { margin-bottom: var(--s4); }
.checklist-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.checklist-head strong { font-size: 14px; }
.progress { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin: 8px 0; }
.progress > div { height: 100%; background: linear-gradient(90deg, var(--success), color-mix(in srgb, var(--success) 70%, #7ed)); border-radius: 99px; transition: width var(--t) var(--ease-out); }
.check-item { display: flex; align-items: center; gap: 9px; padding: 4px 0; font-size: 14px; }
.check-item.done span { text-decoration: line-through; color: var(--text-faint); }
.check-item input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--primary); cursor: pointer; flex: 0 0 auto; }
.check-item span { flex: 1; word-break: break-word; }
.check-item .del {
    margin-left: auto; cursor: pointer; color: var(--text-faint); border: none; background: none;
    display: grid; place-items: center; width: 26px; height: 26px; border-radius: 6px; flex: 0 0 auto;
}
.check-item .del:hover { background: var(--danger-soft); color: var(--danger); }

.attachments { display: flex; flex-wrap: wrap; gap: var(--s3); }
.attachment { width: 128px; font-size: 12px; }
.attachment-thumb {
    height: 76px; background: var(--surface-2) center/cover no-repeat; border-radius: var(--radius-sm);
    display: grid; place-items: center; color: var(--text-muted); border: 1px solid var(--border);
}
.attachment-thumb .icon { width: 26px; height: 26px; }
.attachment-name { display: block; margin-top: 5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-actions { display: flex; gap: 10px; margin-top: 2px; }
.att-actions a { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.att-actions a:hover { color: var(--primary); }

.comment { display: flex; gap: 10px; margin-bottom: var(--s3); }
.comment .avatar { margin-top: 2px; }
.comment-bubble { flex: 1; min-width: 0; background: var(--surface-2); border-radius: var(--radius-sm); padding: 8px 11px; }
.comment-meta { font-size: 11.5px; color: var(--text-faint); margin-bottom: 2px; }
.comment-meta strong { color: var(--text); font-weight: 600; }
.comment-body { font-size: 13.5px; white-space: pre-wrap; word-break: break-word; }
.comment .del { font-size: 11.5px; cursor: pointer; color: var(--text-faint); font-weight: 600; margin-top: 3px; display: inline-block; border: none; background: none; padding: 0; font-family: inherit; }
.comment .del:hover { color: var(--danger); }

.invite-link { display: flex; gap: 7px; margin: var(--s2) 0 var(--s4); }
.invite-link input { flex: 1; font-size: 12.5px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.member-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.member-row:last-child { border-bottom: none; }
.member-row .mname { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; }
.member-row .mname small { display: block; font-weight: 400; }
.member-row select { width: auto; flex: 0 0 auto; padding: 6px 8px; font-size: 13px; }
.role-badge {
    font-size: 11.5px; font-weight: 600; color: var(--text-muted);
    background: var(--surface-2); padding: 3px 9px; border-radius: var(--radius-pill);
}
hr { border: none; border-top: 1px solid var(--border); margin: var(--s4) 0; }
.empty-note { color: var(--text-faint); font-size: 13px; font-style: italic; }

/* Toast */
.toast {
    position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(20px);
    z-index: 200; background: var(--text); color: var(--surface);
    padding: 11px 18px; border-radius: var(--radius-pill); font-size: 13.5px; font-weight: 600;
    box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none;
    transition: opacity var(--t), transform var(--t) var(--ease-out);
    display: flex; align-items: center; gap: 8px;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ==========================================================================
   Karten-Modal v2 (Aktions-Sidebar + Popovers + Dropzone)
   ========================================================================== */
.modal { position: relative; }

/* Meta-Leiste oben (Labels/Mitglieder/Fällig) */
.cm-meta { display: flex; flex-wrap: wrap; gap: var(--s5); margin-bottom: var(--s5); }
.cm-meta-group { display: flex; flex-direction: column; gap: 6px; }
.cm-meta-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); }
.cm-meta-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.cm-meta-row .card-label { font-size: 12.5px; padding: 4px 11px; }

/* Blöcke */
.cm-block { margin-bottom: var(--s5); }
.cm-block[hidden] { display: none; }
.cm-block h3 {
    display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); margin: 0 0 var(--s2);
}
.cm-block h3 .icon { color: var(--text-muted); width: 15px; height: 15px; }

/* Aktions-Sidebar */
.cm-side-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); margin: 0 0 var(--s2); }
.cm-side-actions { display: flex; flex-direction: column; gap: 7px; }
.cm-action {
    display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
    background: var(--surface-2); color: var(--text); border: 1px solid transparent;
    padding: 10px 12px; border-radius: var(--radius-sm); font: inherit; font-size: 13.5px; font-weight: 600;
    cursor: pointer; transition: background var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
}
.cm-action:hover { background: var(--surface-hover); border-color: var(--border-strong); transform: translateX(2px); }
.cm-action:active { transform: translateX(2px) scale(.98); }
.cm-action .icon { color: var(--text-muted); width: 16px; height: 16px; }
.cm-action.cm-action-danger { color: var(--danger); }
.cm-action.cm-action-danger:hover { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.cm-action.cm-action-danger .icon { color: var(--danger); }

.cm-comment-form { display: flex; flex-direction: column; }

/* Popover */
.popover {
    position: fixed; z-index: 300; width: 290px; max-width: calc(100vw - 24px);
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow-lg); overflow: hidden; animation: pop-in 140ms var(--ease-out) both;
}
@keyframes pop-in { from { opacity: 0; transform: translateY(-6px) scale(.97); } to { opacity: 1; transform: none; } }
.popover-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 11px 13px; border-bottom: 1px solid var(--border); }
.popover-head span { font-size: 13px; font-weight: 700; }
.popover-close {
    border: none; background: var(--surface-2); color: var(--text-muted); cursor: pointer;
    display: grid; place-items: center; width: 28px; height: 28px; border-radius: 6px; flex: 0 0 auto; transition: all var(--t-fast);
}
.popover-close:hover { background: var(--danger-soft); color: var(--danger); }
.popover-body { padding: 12px 13px; max-height: 56vh; overflow-y: auto; }

/* Dropdown-Menü (Foto/Datei) */
.menu { display: flex; flex-direction: column; gap: 2px; }
.menu-item {
    display: flex; align-items: center; gap: 11px; width: 100%; text-align: left;
    border: none; background: transparent; border-radius: var(--radius-sm); cursor: pointer;
    padding: 11px 11px; font: inherit; font-size: 14px; font-weight: 500; color: var(--text); transition: background var(--t-fast);
}
.menu-item:hover { background: var(--surface-2); }
.menu-item .icon { color: var(--primary); width: 19px; height: 19px; }
.menu-item small { display: block; font-weight: 400; color: var(--text-muted); font-size: 12px; }

/* Dropzone */
.dropzone {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    border: 2px dashed var(--border-strong); border-radius: var(--radius); padding: 26px 16px;
    text-align: center; color: var(--text-muted); cursor: pointer; transition: all var(--t-fast);
}
.dropzone:hover { border-color: var(--primary); color: var(--text); background: color-mix(in srgb, var(--primary) 4%, transparent); }
.dropzone.drag { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); transform: scale(1.01); }
.dropzone .icon { width: 30px; height: 30px; color: var(--primary); margin-bottom: 4px; }
.dropzone strong { font-size: 14px; color: var(--text); font-weight: 700; }
.dropzone small { font-size: 12.5px; }
.dz-back { margin-top: 10px; font-size: 12.5px; color: var(--text-muted); cursor: pointer; display: inline-flex; align-items: center; gap: 5px; font-weight: 600; }
.dz-back:hover { color: var(--primary); }

/* Label-Popover Reihen */
.lp-row { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.lp-swatch {
    flex: 1; min-width: 0; height: 34px; border-radius: 7px; display: flex; align-items: center; gap: 7px;
    padding: 0 11px; color: #fff; font-size: 12.5px; font-weight: 600; cursor: pointer;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); transition: transform var(--t-fast);
}
.lp-swatch:hover { transform: translateX(2px); }
.lp-swatch .icon { width: 15px; height: 15px; margin-left: auto; }
.lp-edit { border: none; background: var(--surface-2); color: var(--text-muted); width: 30px; height: 30px; border-radius: 6px; cursor: pointer; display: grid; place-items: center; flex: 0 0 auto; }
.lp-edit:hover { background: var(--danger-soft); color: var(--danger); }
.pop-divider { border: none; border-top: 1px solid var(--border); margin: 12px 0; }
.pop-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); margin-bottom: 7px; }

/* Mitglieder-Popover Reihen */
.mp-row {
    display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
    border: none; background: transparent; padding: 7px 8px; border-radius: var(--radius-sm); cursor: pointer;
    font: inherit; font-size: 13.5px; font-weight: 600; color: var(--text); transition: background var(--t-fast);
}
.mp-row:hover { background: var(--surface-2); }
.mp-row .check-on { margin-left: auto; color: var(--primary); }

/* Voller Modal-Drop-Hinweis */
.cm-drop-hint {
    position: absolute; inset: 6px; z-index: 6; pointer-events: none;
    background: color-mix(in srgb, var(--primary) 13%, var(--surface));
    border: 2.5px dashed var(--primary); border-radius: var(--radius);
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
    color: var(--primary); font-weight: 800; font-size: 17px; letter-spacing: -.01em;
    backdrop-filter: blur(2px); animation: overlay-in 120ms var(--ease) both;
}
.cm-drop-hint .icon { width: 36px; height: 36px; }

/* ==========================================================================
   Mobile / Responsive
   ========================================================================== */

/* Tablet & schmaler */
@media (max-width: 900px) {
    .dashboard { padding: var(--s5) var(--s4) var(--s8); }
    .board-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: var(--s3); }
}

/* Karten-Modal einspaltig: Aktionen NACH OBEN, als kompakte Button-Reihe */
@media (max-width: 740px) {
    .card-modal-body { grid-template-columns: 1fr; gap: var(--s4); }
    #cardSide { order: -1; }
    .cm-side-actions { flex-direction: row; flex-wrap: wrap; gap: 8px; }
    .cm-action { width: auto; flex: 1 1 calc(50% - 4px); justify-content: center; padding: 11px 10px; }
    .cm-action.cm-action-danger { flex-basis: 100%; }
    .cm-side-title { margin-top: 4px; }
    .cm-side-title + .cm-side-actions { margin-bottom: 6px; }
}

/* Handy */
@media (max-width: 560px) {
    :root { --topbar-h: 52px; }
    .topbar { padding: 0 var(--s3); }
    .brand { font-size: 16px; }
    .topnav { gap: 6px; }
    .topnav-link span:not(.icon), .topnav-user, .hide-mobile { display: none; }   /* Nur Icons */
    .topnav-link { padding: 8px; }
    .brand .brand-mark { width: 28px; height: 28px; }

    /* iOS-Auto-Zoom vermeiden: Eingaben >= 16px */
    input[type=text], input[type=email], input[type=password], input[type=date],
    select, textarea, .desc-area, .modal-title-input, .add-card-input, .list-title-input {
        font-size: 16px;
    }

    /* Auth */
    .auth-card { margin: 5vh auto; padding: var(--s5); border-radius: var(--radius); }
    .auth-hero { margin-top: 7vh; }
    .auth-hero-actions .btn { flex: 1 1 100%; }

    /* Board: eine Liste fast bildschirmbreit, Snap-Scrolling */
    .board-bar { padding: 10px var(--s3); gap: 8px; }
    .board-name { font-size: 17px; }
    .member-avatars { display: none; }
    .board-bar-right { gap: 7px; }
    .lists { gap: 10px; padding: var(--s3) var(--s3) var(--s5); scroll-snap-type: x mandatory; }
    .list { width: 84vw; flex-basis: 84vw; max-width: 320px; scroll-snap-align: start; max-height: calc(100vh - var(--topbar-h) - 78px); }
    .list-composer { width: 84vw; flex-basis: 84vw; max-width: 320px; }

    /* Modals als (fast) Vollbild-Sheet */
    .modal-overlay { padding: 0; align-items: stretch; }
    .modal { border-radius: 0; min-height: 100dvh; border: none; }
    .modal-lg, .modal-sm { max-width: 100%; }
    .modal-header { padding: var(--s4) var(--s4) var(--s2); position: sticky; top: 0; background: var(--surface); z-index: 2; }
    .modal-body { padding: var(--s2) var(--s4) calc(var(--s8) + env(safe-area-inset-bottom, 0px)); }
    .modal-title-input { font-size: 17px; }

    /* Popover als Bottom-Sheet */
    .popover.sheet {
        left: 0 !important; right: 0; top: auto !important; bottom: 0; width: 100%; max-width: 100%;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0; animation: sheet-in 220ms var(--ease-out) both;
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }
    @keyframes sheet-in { from { transform: translateY(100%); } to { transform: none; } }
    .popover.sheet .popover-head { padding: 14px 16px; }
    .popover.sheet .popover-body { max-height: 62vh; padding: 14px 16px; }
    .popover.sheet .popover-close { width: 34px; height: 34px; }

    /* Touch-Ziele etwas größer */
    .menu-item { padding: 13px 12px; }
    .lp-swatch { height: 40px; }
    .mp-row { padding: 10px 9px; }
    .check-item input[type=checkbox] { width: 20px; height: 20px; }
    /* Touch-Ziele >= 40px */
    .list-menu-btn, .list-grip, .lp-edit, .check-item .del, .popover-close, .icon-btn { width: 40px; height: 40px; }

    .dashboard { padding: var(--s4) var(--s3) var(--s8); }
    .dash-head h1 { font-size: 22px; }
    .board-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
    .board-tile { height: 96px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
