/* =====================================================================
   Santos Manufactory – Globales Stylesheet
   Dark-Modus als Standard, heller Modus über [data-theme="light"],
   Akzentfarbe über --accent (inline von PHP gesetzt, überschreibbar).
   ===================================================================== */

/* ---------- Design-Token: Dark (Standard) ---------- */
:root {
    --accent: #6366f1;
    --accent-rgb: 99, 102, 241;
    --accent-hover: #7c7ff5;
    --accent-soft: rgba(99, 102, 241, 0.14);

    --bg: #0e0f13;
    --bg-2: #14161c;
    --surface: #1a1d24;
    --surface-2: #21252e;
    --surface-3: #2a2f3a;
    --border: #2c313c;
    --border-soft: #23272f;

    --text: #eef1f6;
    --text-2: #aeb6c4;
    --text-3: #7a8393;

    --green: #22c55e;
    --amber: #f59e0b;
    --red: #ef4444;
    --blue: #3b82f6;
    --teal: #14b8a6;
    --violet: #8b5cf6;

    --shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
    --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.25);
    --radius: 14px;
    --radius-sm: 10px;
    --radius-lg: 20px;
    --sidebar-w: 256px;
    --topbar-h: 62px;
    --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    --transition: 160ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- Design-Token: Light ---------- */
:root[data-theme="light"] {
    --bg: #f4f6fa;
    --bg-2: #eef1f6;
    --surface: #ffffff;
    --surface-2: #f7f9fc;
    --surface-3: #eef1f6;
    --border: #e2e7ef;
    --border-soft: #eaeef4;

    --text: #1a1f2b;
    --text-2: #4a5568;
    --text-3: #8a94a6;

    --shadow: 0 8px 30px rgba(20, 30, 60, 0.10);
    --shadow-sm: 0 2px 10px rgba(20, 30, 60, 0.07);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; font-size: inherit; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--border); }
::-webkit-scrollbar-track { background: transparent; }

/* =====================================================================
   Grundlayout
   ===================================================================== */
.app { display: flex; height: 100vh; height: 100dvh; }

.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--bg-2);
    border-right: 1px solid var(--border-soft);
    display: flex;
    flex-direction: column;
    z-index: 60;
    transition: transform var(--transition);
}

.sidebar-brand {
    display: flex; align-items: center; gap: 12px;
    height: var(--topbar-h);
    padding: 0 18px;
    border-bottom: 1px solid var(--border-soft);
    flex-shrink: 0;
}
.brand-logo {
    width: 42px; height: 42px; border-radius: 8px;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    color: #fff; font-weight: 800; font-size: 14px;
    display: grid; place-items: center; letter-spacing: -0.5px;
    box-shadow: 0 4px 14px rgba(var(--accent-rgb), 0.4);
}
.brand-logo-img { display: block; object-fit: cover; background: #39b3e6; }
.brand-name { font-weight: 700; font-size: 16px; letter-spacing: -0.2px; white-space: nowrap; }
.sidebar-close { display: none; margin-left: auto; }

.nav { flex: 1; overflow-y: auto; padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; border-radius: var(--radius-sm);
    color: var(--text-2); font-weight: 500; font-size: 14.5px;
    transition: background var(--transition), color var(--transition);
    position: relative;
}
.nav-item .ico { width: 19px; height: 19px; flex-shrink: 0; }
.nav-item:hover { background: var(--surface); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-item.active::before {
    content: ""; position: absolute; left: -10px; top: 50%; transform: translateY(-50%);
    width: 3px; height: 20px; background: var(--accent); border-radius: 3px;
}

.sidebar-foot { padding: 14px; border-top: 1px solid var(--border-soft); }
.people-legend { display: flex; flex-direction: column; gap: 8px; }
.people-legend .person-row { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--text-2); }

.sidebar-overlay {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    z-index: 55; backdrop-filter: blur(2px);
}

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

/* ---------- Topbar ---------- */
.topbar {
    height: var(--topbar-h); flex-shrink: 0;
    display: flex; align-items: center; gap: 14px;
    padding: 0 20px;
    background: color-mix(in srgb, var(--bg) 85%, transparent);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-soft);
    position: sticky; top: 0; z-index: 40;
}
#menuToggle { display: none; }

.search-wrap { flex: 1; max-width: 520px; position: relative; }
.search-ico {
    position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
    color: var(--text-3); pointer-events: none;
}
.search-ico .ico { width: 17px; height: 17px; }
.search-input {
    width: 100%; height: 40px; padding: 0 14px 0 38px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 10px; color: var(--text); outline: none;
    transition: border var(--transition), box-shadow var(--transition);
}
.search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.search-results {
    position: absolute; top: calc(100% + 8px); left: 0; right: 0;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow);
    max-height: 420px; overflow-y: auto; z-index: 50; padding: 6px;
}
.search-group-title { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); padding: 8px 10px 4px; }
.search-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; cursor: pointer; }
.search-item:hover { background: var(--surface-2); }
.search-item .si-title { font-weight: 500; font-size: 14px; }
.search-empty { padding: 18px; text-align: center; color: var(--text-3); font-size: 13.5px; }

.topbar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.menu-anchor { position: relative; }

.badge {
    position: absolute; top: -3px; right: -3px; min-width: 17px; height: 17px;
    padding: 0 4px; border-radius: 9px; background: var(--red); color: #fff;
    font-size: 10.5px; font-weight: 700; display: grid; place-items: center;
    border: 2px solid var(--bg);
}

.dropdown {
    position: absolute; top: calc(100% + 10px); right: 0; width: 340px;
    max-height: 440px; overflow-y: auto;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow); z-index: 50;
}
.dropdown-head { padding: 14px 16px; border-bottom: 1px solid var(--border-soft); display: flex; justify-content: space-between; align-items: center; }
.dropdown-head h4 { font-size: 14px; }
.notif-item { display: flex; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border-soft); }
.notif-item:last-child { border-bottom: 0; }
.notif-item.unread { background: var(--accent-soft); }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; }
.notif-item .nt-title { font-weight: 600; font-size: 13.5px; }
.notif-item .nt-msg { font-size: 12.5px; color: var(--text-2); }
.notif-item .nt-time { font-size: 11px; color: var(--text-3); margin-top: 2px; }

/* ---------- Content ---------- */
.content { flex: 1; overflow-y: auto; padding: 24px 28px 60px; }
.loading-screen { display: grid; place-items: center; height: 60vh; }
.spinner {
    width: 34px; height: 34px; border: 3px solid var(--surface-3);
    border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Seitenkopf ---------- */
.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .ph-text { flex: 1; min-width: 200px; }
.page-head h1 { font-size: 24px; font-weight: 700; letter-spacing: -0.4px; }
.page-head .subtitle { color: var(--text-2); font-size: 14px; margin-top: 3px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* =====================================================================
   Buttons
   ===================================================================== */
.btn {
    display: inline-flex; align-items: center; gap: 7px;
    height: 40px; padding: 0 16px; border-radius: 10px;
    border: 1px solid transparent; font-weight: 600; font-size: 14px;
    color: var(--text); background: var(--surface-2); border-color: var(--border);
    transition: all var(--transition); white-space: nowrap;
}
.btn:hover { background: var(--surface-3); }
.btn .ico { width: 17px; height: 17px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { background: transparent; border-color: var(--red); color: var(--red); }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; justify-content: center; }
.quick-add span { display: inline; }

.icon-btn {
    width: 40px; height: 40px; border-radius: 10px; border: 1px solid transparent;
    background: transparent; color: var(--text-2); display: grid; place-items: center;
    position: relative; transition: all var(--transition);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn .ico { width: 20px; height: 20px; }
button.sidebar-close { display: none; }

/* Segment-Umschalter (Ansichten) */
.segmented { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 2px; }
.segmented button {
    border: 0; background: transparent; color: var(--text-2);
    padding: 6px 13px; border-radius: 7px; font-size: 13px; font-weight: 600;
    transition: all var(--transition); display: inline-flex; align-items: center; gap: 6px;
}
.segmented button .ico { width: 15px; height: 15px; }
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* Filterleiste */
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.filter-select {
    height: 36px; padding: 0 30px 0 12px; border-radius: 9px;
    background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237a8393' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center;
    border: 1px solid var(--border); color: var(--text); appearance: none; outline: none; font-size: 13.5px;
}
.filter-select:focus { border-color: var(--accent); }

/* =====================================================================
   Karten & Grid
   ===================================================================== */
.card {
    background: var(--surface); border: 1px solid var(--border-soft);
    border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.card-pad { padding: 18px; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--border-soft); }
.card-head h3 { font-size: 15px; font-weight: 650; flex: 1; }
.card-head .ch-ico { color: var(--accent); display: grid; place-items: center; }
.card-head .ch-ico .ico { width: 18px; height: 18px; }
.card-link { font-size: 12.5px; color: var(--text-3); font-weight: 600; }
.card-link:hover { color: var(--accent); }
.card-body { padding: 8px 18px 16px; }

.grid { display: grid; gap: 16px; }
.dash-grid { grid-template-columns: repeat(12, 1fr); }
.col-3 { grid-column: span 3; } .col-4 { grid-column: span 4; }
.col-6 { grid-column: span 6; } .col-8 { grid-column: span 8; }
.col-9 { grid-column: span 9; } .col-12 { grid-column: span 12; }
.cards-auto { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.cards-auto-lg { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }

/* Statistik-Kacheln */
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-tile { background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 16px 18px; display: flex; align-items: center; gap: 14px; }
.stat-tile .st-ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex-shrink: 0; }
.stat-tile .st-ico .ico { width: 22px; height: 22px; }
.stat-tile .st-val { font-size: 24px; font-weight: 750; line-height: 1; letter-spacing: -0.5px; }
.stat-tile .st-label { font-size: 12.5px; color: var(--text-3); margin-top: 4px; }

/* =====================================================================
   Personen-Avatare & Chips
   ===================================================================== */
.avatar {
    width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
    color: #fff; font-size: 11px; font-weight: 700; flex-shrink: 0;
    box-shadow: inset 0 0 0 2px rgba(255,255,255,0.12);
}
.avatar-sm { width: 20px; height: 20px; font-size: 9.5px; }
.avatar-lg { width: 34px; height: 34px; font-size: 13px; }
.assignee-avatars { display: inline-flex; align-items: center; flex-shrink: 0; }
.assignee-avatars .avatar + .avatar { margin-left: -5px; }
.assignee-avatars .avatar { outline: 2px solid var(--surface); }
.dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }

.chip {
    display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px;
    border-radius: 20px; font-size: 11.5px; font-weight: 600; background: var(--surface-3); color: var(--text-2);
}
.chip .dot { width: 7px; height: 7px; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11px; background: var(--surface-3); color: var(--text-2); }

/* Prioritäts- und Statusfarben */
.badge-status { padding: 3px 9px; border-radius: 7px; font-size: 11.5px; font-weight: 650; }
.st-offen       { background: rgba(148,163,184,.16); color: #94a3b8; }
.st-in_arbeit   { background: rgba(59,130,246,.16);  color: #60a5fa; }
.st-warten      { background: rgba(245,158,11,.16);  color: #fbbf24; }
.st-erledigt    { background: rgba(34,197,94,.16);   color: #4ade80; }
.st-abgebrochen { background: rgba(239,68,68,.14);   color: #f87171; }

.prio-dot { width: 8px; height: 8px; border-radius: 50%; }
.prio-niedrig  { background: #64748b; }
.prio-normal   { background: #3b82f6; }
.prio-hoch     { background: #f59e0b; }
.prio-dringend { background: #ef4444; }

/* =====================================================================
   Aufgabenliste
   ===================================================================== */
.task-list { display: flex; flex-direction: column; gap: 8px; }
.task-item {
    display: flex; align-items: flex-start; gap: 12px; padding: 13px 15px;
    background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius-sm);
    transition: border var(--transition), transform var(--transition);
}
.task-item:hover { border-color: var(--border); }
.task-check {
    width: 20px; height: 20px; border-radius: 6px; border: 2px solid var(--border);
    background: transparent; flex-shrink: 0; margin-top: 1px; display: grid; place-items: center;
    transition: all var(--transition); color: transparent;
}
.task-check:hover { border-color: var(--accent); }
.task-check.done { background: var(--green); border-color: var(--green); color: #fff; }
.task-check .ico { width: 13px; height: 13px; }
.task-main { flex: 1; min-width: 0; }
.task-title { font-weight: 550; font-size: 14.5px; }
.task-item.completed .task-title { text-decoration: line-through; color: var(--text-3); }
.task-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 6px; font-size: 12px; color: var(--text-3); }
.task-meta > span { display: inline-flex; align-items: center; gap: 4px; }
.task-meta .ico { width: 13px; height: 13px; }
.task-actions { display: flex; gap: 2px; opacity: 0; transition: opacity var(--transition); }
.task-item:hover .task-actions { opacity: 1; }
.overdue-text { color: var(--red) !important; font-weight: 600; }

.subprogress { height: 4px; background: var(--surface-3); border-radius: 3px; margin-top: 8px; overflow: hidden; }
.subprogress > i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }

/* =====================================================================
   Kanban-Board
   ===================================================================== */
.board { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
.board-col { flex: 0 0 290px; background: var(--bg-2); border: 1px solid var(--border-soft); border-radius: var(--radius); display: flex; flex-direction: column; max-height: calc(100vh - 220px); }
.board-col-head { padding: 12px 14px; display: flex; align-items: center; gap: 8px; font-weight: 650; font-size: 13.5px; position: sticky; top: 0; }
.board-col-head .count { margin-left: auto; background: var(--surface-3); color: var(--text-2); border-radius: 20px; padding: 1px 8px; font-size: 11.5px; }
.board-col-body { padding: 4px 10px 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 9px; min-height: 40px; }
.board-col-body.drag-over { background: var(--accent-soft); }
.board-card {
    background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius-sm);
    padding: 12px; cursor: grab; box-shadow: var(--shadow-sm);
}
.board-card:active { cursor: grabbing; }
.board-card.dragging { opacity: .4; }
.board-card .bc-title { font-weight: 600; font-size: 13.8px; margin-bottom: 8px; }
.board-card .bc-foot { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 11.5px; color: var(--text-3); }

/* =====================================================================
   Fortschrittsbalken
   ===================================================================== */
.progress { height: 8px; background: var(--surface-3); border-radius: 5px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent); border-radius: 5px; transition: width .4s ease; }
.progress-lg { height: 10px; }
.progress-label { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-2); margin-bottom: 6px; }

.ring { --p: 0; width: 54px; height: 54px; border-radius: 50%;
    background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--surface-3) 0);
    display: grid; place-items: center; }
.ring::before { content: ""; position: absolute; width: 40px; height: 40px; border-radius: 50%; background: var(--surface); }
.ring span { position: relative; font-size: 12px; font-weight: 700; }
.ring-wrap { position: relative; display: inline-grid; place-items: center; }

/* =====================================================================
   Projekt-/Ziel-/Ideen-Karten
   ===================================================================== */
.entity-card { background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 12px; transition: border var(--transition), transform var(--transition); cursor: pointer; }
.entity-card:hover { border-color: var(--border); transform: translateY(-2px); }
.entity-card .ec-top { display: flex; align-items: flex-start; gap: 12px; }
.entity-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; color: #fff; flex-shrink: 0; }
.entity-icon .ico { width: 22px; height: 22px; }
.entity-card h3 { font-size: 15.5px; font-weight: 650; }
.entity-card .ec-desc { font-size: 13px; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.entity-card .ec-foot { display: flex; align-items: center; gap: 10px; margin-top: auto; }

.idea-score { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
.idea-score b { color: var(--text); }
.stars { color: var(--amber); letter-spacing: 1px; }

/* =====================================================================
   Kalender
   ===================================================================== */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--border-soft); border: 1px solid var(--border-soft); border-radius: var(--radius); overflow: hidden; }
.cal-weekday { background: var(--bg-2); padding: 10px; text-align: center; font-size: 12px; font-weight: 650; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; }
.cal-cell { background: var(--surface); min-height: 108px; padding: 7px 8px; display: flex; flex-direction: column; gap: 4px; cursor: pointer; transition: background var(--transition); }
.cal-cell:hover { background: var(--surface-2); }
.cal-cell.other-month { background: var(--bg-2); }
.cal-cell.other-month .cal-num { color: var(--text-3); opacity: .5; }
.cal-cell.today .cal-num { background: var(--accent); color: #fff; }
.cal-cell.drag-over { background: var(--accent-soft); }
.cal-num { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 600; }
.cal-event { font-size: 11.5px; padding: 3px 7px; border-radius: 6px; color: #fff; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: grab; }
.cal-event.is-task { background: var(--surface-3) !important; color: var(--text) !important; display: flex; align-items: center; gap: 5px; }
.cal-event.is-task::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.cal-more { font-size: 11px; color: var(--text-3); font-weight: 600; }
.cal-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.cal-title { font-size: 18px; font-weight: 700; min-width: 180px; }

.agenda-day { margin-bottom: 20px; }
.agenda-date { font-size: 13px; font-weight: 700; color: var(--accent); margin-bottom: 8px; text-transform: capitalize; }
.agenda-item { display: flex; gap: 12px; padding: 11px 14px; background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius-sm); margin-bottom: 7px; align-items: center; }
.agenda-time { font-size: 12.5px; color: var(--text-2); font-weight: 600; min-width: 88px; }

/* Wochenansicht */
.week-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; }
.week-col { background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius-sm); padding: 10px; min-height: 200px; }
.week-col-head { font-size: 12.5px; font-weight: 650; margin-bottom: 8px; text-align: center; }
.week-col.today .week-col-head { color: var(--accent); }

/* =====================================================================
   Gewohnheiten
   ===================================================================== */
.person-work-section { padding: 14px 0 18px 14px; border-left: 3px solid var(--person-color); margin-bottom: 20px; }
.person-work-head { min-height: 40px; display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.person-work-head > div { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.person-work-head b { font-size: 15px; }
.person-work-head > div > span { color: var(--text-3); font-size: 11.5px; }
.person-work-head strong { min-width: 28px; height: 24px; padding: 0 7px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); font-size: 11px; }
.person-work-empty { padding: 12px 14px; border: 1px dashed var(--border); border-radius: var(--radius-sm); color: var(--text-3); font-size: 12.5px; }
.habit-row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius); margin-bottom: 9px; }
.habit-icon { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; color: #fff; flex-shrink: 0; }
.habit-week { display: flex; gap: 6px; margin-left: auto; }
.habit-day { width: 34px; text-align: center; }
.habit-day .hd-label { font-size: 10px; color: var(--text-3); margin-bottom: 4px; }
.habit-cell { width: 30px; height: 30px; border-radius: 9px; border: 2px solid var(--border); background: transparent; display: grid; place-items: center; transition: all var(--transition); margin: 0 auto; color: transparent; }
.habit-cell.done { background: var(--green); border-color: var(--green); color: #fff; }
.habit-cell.today { border-color: var(--accent); }
.habit-cell:hover { border-color: var(--accent); }
.habit-cell .ico { width: 15px; height: 15px; }
.streak-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; color: var(--amber); }

.heat { display: grid; grid-template-columns: repeat(auto-fill, 15px); gap: 4px; }
.heat-cell { width: 15px; height: 15px; border-radius: 4px; background: var(--surface-3); }

/* Routinen */
.routine-slot-summary { display: flex; flex-wrap: wrap; gap: 5px; margin: -3px 0 10px; }
.routine-time-group { margin-top: 10px; }
.routine-time-label { display: flex; align-items: center; gap: 6px; padding-bottom: 4px; color: var(--text-3); font-size: 11px; font-weight: 700; }
.routine-slot-picker { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.routine-slot-opt { min-height: 38px; display: flex; align-items: center; gap: 7px; padding: 7px 9px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface-2); color: var(--text-2); cursor: pointer; font-size: 12px; }
.routine-slot-opt span { width: 18px; height: 18px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 5px; color: transparent; flex-shrink: 0; }
.routine-slot-opt.active { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.routine-slot-opt.active span { border-color: var(--accent); background: var(--accent); color: #fff; }
.routine-step { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border-soft); }
.routine-step:last-child { border-bottom: 0; }
.step-check { width: 22px; height: 22px; border-radius: 7px; border: 2px solid var(--border); display: grid; place-items: center; color: transparent; flex-shrink: 0; }
.step-check.done { background: var(--accent); border-color: var(--accent); color: #fff; }
.step-check .ico { width: 13px; height: 13px; }
.routine-step.done .rs-title { text-decoration: line-through; color: var(--text-3); }

/* =====================================================================
   Notizen
   ===================================================================== */
.note-card { background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 16px; cursor: pointer; display: flex; flex-direction: column; gap: 8px; transition: border var(--transition), transform var(--transition); position: relative; }
.note-card:hover { border-color: var(--border); transform: translateY(-2px); }
.note-card h3 { font-size: 15px; font-weight: 650; padding-right: 24px; }
.note-preview { font-size: 13px; color: var(--text-2); white-space: pre-wrap; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.55; }
.note-pin { position: absolute; top: 12px; right: 12px; color: var(--amber); }
.note-foot { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--text-3); margin-top: auto; }

/* Markdown-Vorschau */
.md-body { line-height: 1.65; }
.md-body h1 { font-size: 20px; margin: 14px 0 8px; }
.md-body h2 { font-size: 17px; margin: 12px 0 7px; }
.md-body h3 { font-size: 15px; margin: 10px 0 6px; }
.md-body p { margin: 8px 0; }
.md-body ul, .md-body ol { margin: 8px 0 8px 22px; }
.md-body li { margin: 3px 0; }
.md-body blockquote { border-left: 3px solid var(--accent); padding: 4px 0 4px 14px; color: var(--text-2); margin: 10px 0; }
.md-body code { background: var(--surface-3); padding: 2px 6px; border-radius: 5px; font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 13px; }
.md-body pre { background: var(--bg-2); border: 1px solid var(--border-soft); padding: 12px; border-radius: 9px; overflow-x: auto; margin: 10px 0; }
.md-body pre code { background: transparent; padding: 0; }
.md-body hr { border: 0; border-top: 1px solid var(--border); margin: 14px 0; }
.md-body a { color: var(--accent); text-decoration: underline; }
.md-body .md-check { list-style: none; margin-left: 0; }

/* Editor-Toolbar */
.editor-toolbar { display: flex; gap: 3px; flex-wrap: wrap; padding: 6px; background: var(--surface-2); border: 1px solid var(--border); border-bottom: 0; border-radius: 10px 10px 0 0; }
.editor-toolbar button { width: 32px; height: 30px; border: 0; background: transparent; color: var(--text-2); border-radius: 6px; font-weight: 700; font-size: 13px; }
.editor-toolbar button:hover { background: var(--surface-3); color: var(--text); }
.editor-area { border-radius: 0 0 10px 10px !important; border-top: 0 !important; min-height: 220px; font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 13.5px; }

/* Große Dokumentoberfläche für Notizen */
.note-editor-shell, .note-view-shell { min-height: 100%; }
.note-editor-shell { display: flex; flex-direction: column; gap: 16px; }
.note-properties {
    width: min(1000px, 100%); margin: 0 auto; padding: 0 4px 16px;
    border-bottom: 1px solid var(--border-soft);
}
.note-document-tools {
    position: sticky; top: -20px; z-index: 4; width: min(1000px, 100%);
    margin: 0 auto; padding: 10px 0; background: var(--surface);
}
.note-document-tools .editor-toolbar {
    border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px;
    box-shadow: var(--shadow-sm);
}
.note-document {
    width: min(816px, 100%); min-height: 1056px; margin: 0 auto;
    padding: 72px 84px 88px; background: #fff; color: #202124;
    border: 1px solid #d9dce1; border-radius: 2px;
    box-shadow: 0 3px 18px rgba(0,0,0,.18);
    font-family: Arial, "Helvetica Neue", sans-serif;
}
.note-doc-title-input {
    width: 100%; height: auto; padding: 0; border: 0; border-radius: 0;
    background: transparent; color: #202124; box-shadow: none;
    font: 700 32px/1.25 Arial, "Helvetica Neue", sans-serif;
}
.note-doc-title-input:focus { border: 0; box-shadow: none; outline: none; }
.note-doc-title-input::placeholder { color: #9aa0a6; }
.note-doc-rule { height: 1px; margin: 24px 0 30px; background: #e1e4e8; }
.note-doc-editor {
    display: block; width: 100%; min-height: 780px; padding: 0 !important;
    border: 0 !important; border-radius: 0 !important; outline: none;
    background: transparent; color: #202124; resize: vertical;
    font: 15px/1.75 Arial, "Helvetica Neue", sans-serif;
}
.note-doc-editor:focus { border: 0 !important; box-shadow: none !important; }
.note-doc-editor::placeholder { color: #9aa0a6; }
.note-doc-preview { min-height: 780px; color: #202124; font-size: 15px; line-height: 1.75; }
.note-document-options {
    width: min(816px, 100%); margin: 0 auto; display: flex;
    align-items: center; gap: 24px; padding: 2px 0 8px;
}
.note-document-view { min-height: 1056px; }
.note-doc-head { display: flex; align-items: flex-start; gap: 18px; }
.note-doc-title { font: 700 32px/1.25 Arial, "Helvetica Neue", sans-serif; color: #202124; }
.note-doc-people { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.note-document .assignee-avatars .avatar { outline-color: #fff; }
.note-document .view-badges { margin-top: 12px; }
.note-document .view-badges .chip, .note-document .view-tags .tag {
    background: #f1f3f4; color: #5f6368;
}
.note-document .view-tags { margin-top: 16px; }
.note-document .note-reading .md-body { color: #202124; font-size: 15px; line-height: 1.75; }
.note-document .md-body h1 { font-size: 25px; color: #202124; margin: 28px 0 12px; }
.note-document .md-body h2 { font-size: 21px; color: #202124; margin: 24px 0 10px; }
.note-document .md-body h3 { font-size: 18px; color: #202124; margin: 20px 0 8px; }
.note-document .md-body p { margin: 0 0 14px; }
.note-document .md-body blockquote { color: #5f6368; border-left-color: #5f6368; }
.note-document .md-body code { background: #f1f3f4; color: #202124; }
.note-document .md-body pre { background: #f8f9fa; border-color: #dadce0; }
.note-document .md-body hr { border-top-color: #dadce0; }
.note-document .md-body a { color: #1a73e8; }

/* =====================================================================
   Businessplan / Timeline
   ===================================================================== */
.timeline { position: relative; padding-left: 28px; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 4px; bottom: 4px; width: 2px; background: var(--border); }
.tl-item { position: relative; margin-bottom: 18px; }
.tl-item::before { content: ""; position: absolute; left: -28px; top: 4px; width: 14px; height: 14px; border-radius: 50%; background: var(--accent); border: 3px solid var(--bg); }
.tl-year { font-size: 12px; font-weight: 700; color: var(--accent); }

.life-section { margin-bottom: 26px; }
.life-section-title { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 700; margin-bottom: 12px; }

/* Businessplan – Detailseite (ausführliche Vorlage) */
.bp-title-input {
    width: 100%; border: none; background: transparent; color: var(--text);
    font-size: 22px; font-weight: 700; padding: 4px 0; margin-bottom: 14px; font-family: inherit;
}
.bp-title-input:focus { outline: none; }
.bp-title-input::placeholder { color: var(--text-3); font-weight: 600; }
.bp-meta-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
.bp-meta-grid .form-row input, .bp-meta-grid .form-row select { height: 38px; }

.bp-section { margin-bottom: 30px; background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 20px 22px; }
.bp-section-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.bp-section-head svg, .bp-section-head [data-icon] { color: var(--accent); }
.bp-section-head h2 { font-size: 16px; font-weight: 700; margin: 0; }
.bp-section-num {
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; font-weight: 700;
    color: var(--accent); background: var(--accent-soft); padding: 2px 7px; border-radius: 5px;
}
.bp-hint { font-size: 12.5px; font-style: italic; color: var(--text-3); margin: -6px 0 14px; }
.bp-subhead { font-size: 14px; font-weight: 700; margin: 20px 0 10px; }
.bp-subhead:first-of-type { margin-top: 0; }
.bp-label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin: 4px 0 8px; }

.bp-section textarea, .bp-mix-card textarea {
    width: 100%; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--border);
    border-radius: 9px; color: var(--text); resize: vertical; line-height: 1.5; font-family: inherit; font-size: 13.5px;
}
.bp-section textarea:focus, .bp-mix-card textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.bp-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.bp-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
.bp-mix-card { background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: 9px; padding: 12px 14px; }
.bp-mix-card h3 { font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--accent); margin-bottom: 8px; }
.bp-mix-card textarea { min-height: 90px; background: var(--surface); }

.bp-swot { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.bp-swot-card { border-radius: 9px; padding: 14px 16px; border: 1px solid var(--border); border-left: 4px solid var(--border); background: var(--surface-2); }
.bp-swot-card.pos { border-left-color: var(--green); }
.bp-swot-card.neg { border-left-color: var(--red); }
.bp-swot-card h3 { font-size: 13px; margin-bottom: 8px; }
.bp-swot-card.pos h3 { color: var(--green); }
.bp-swot-card.neg h3 { color: var(--red); }
.bp-swot-card textarea { min-height: 90px; background: var(--surface); }

.bp-table-wrap { overflow-x: auto; border: 1px solid var(--border-soft); border-radius: 9px; margin-bottom: 6px; }
.bp-table { width: 100%; border-collapse: collapse; min-width: 480px; }
.bp-table thead th {
    text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--text-3);
    background: var(--surface-2); padding: 9px 12px; border-bottom: 1px solid var(--border-soft);
}
.bp-table thead th.num { text-align: right; }
.bp-table tbody td { padding: 6px 10px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.bp-table tbody tr:last-child td { border-bottom: none; }
.bp-table td.num-cell { text-align: right; }
.bp-table tr.bp-total-row td { font-weight: 700; border-top: 2px solid var(--border); background: var(--surface-2); }
.bp-table tr.bp-calc-row td { font-style: italic; color: var(--text-2); background: var(--surface-2); }

.bp-input {
    width: 100%; border: none; background: transparent; color: var(--text); font-size: 13px;
    padding: 6px 4px; border-radius: 4px; font-family: inherit;
}
.bp-input:hover { background: var(--surface-2); }
.bp-input:focus { outline: none; background: var(--surface-2); box-shadow: 0 0 0 1px var(--accent) inset; }
.bp-input::placeholder { color: var(--text-3); font-style: italic; }
.num-input.bp-input { text-align: right; font-variant-numeric: tabular-nums; }

.bp-select {
    border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 12.5px;
    padding: 5px 8px; border-radius: 6px; font-family: inherit;
}

.bp-sum { font-variant-numeric: tabular-nums; }
.bp-sum.pos { color: var(--green); }
.bp-sum.neg { color: var(--red); }

@media (max-width: 900px) {
    .bp-meta-grid { grid-template-columns: 1fr 1fr; }
    .bp-grid-4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 620px) {
    .bp-meta-grid { grid-template-columns: 1fr; }
    .bp-grid-2, .bp-grid-4, .bp-swot { grid-template-columns: 1fr; }
}

/* Tagesplanung */
.planner-cols { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.planner-col { background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 14px; min-height: 160px; }
.planner-col.drag-over, .planner-pool.drag-over { border-color: var(--accent); background: var(--accent-soft); }
.planner-col-head { font-weight: 650; font-size: 13.5px; margin-bottom: 10px; display: flex; align-items: center; gap: 7px; }
.planner-col-head .planner-count { margin-left: auto; }
.planner-count { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; display: inline-grid; place-items: center; background: var(--surface-3); color: var(--text-2); font-size: 11px; }
.planner-toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.planner-toolbar .filter-select { width: auto; height: 38px; }
.planner-hint { margin-left: 4px; font-size: 12.5px; }
.planner-overview { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 20px; }
.planner-overview-item { min-height: 50px; display: grid; grid-template-columns: 30px auto 1fr; align-items: center; gap: 8px; padding: 8px 11px; border-top: 2px solid var(--accent); background: var(--surface); color: var(--text-2); font-size: 12px; }
.planner-overview-item b { color: var(--text); font-size: 18px; line-height: 1; }
.planner-overview-icon { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 7px; background: var(--accent-soft); color: var(--accent); }
.planner-pool { background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 14px; transition: border var(--transition), background var(--transition); }
.planner-drop { min-height: 42px; }
.planner-empty { color: var(--text-3); font-size: 12.5px; padding: 6px 2px; }
.planner-person-group { border-left: 2px solid var(--person-color); padding-left: 8px; margin-top: 10px; }
.planner-person-group:first-child { margin-top: 0; }
.planner-person-head { min-height: 24px; display: flex; align-items: center; gap: 6px; margin-bottom: 6px; color: var(--text-2); }
.planner-person-head b { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11.5px; }
.planner-person-head > span:last-child { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-3); font-size: 9.5px; }
.planner-person-empty { padding: 4px 2px 7px; color: var(--text-3); font-size: 10.5px; }
.planner-person-group.compact { padding-left: 6px; margin-top: 8px; }
.planner-person-group.compact .planner-person-head { margin-bottom: 4px; }
.planner-person-group.compact .planner-person-head b { font-size: 10px; }
.planner-person-group.compact .avatar { width: 18px; height: 18px; font-size: 7px; }
.planner-person-lanes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; align-items: start; }
.planner-person-lane { min-width: 0; border-top: 4px solid var(--person-color); }
.planner-person-lane + .planner-person-lane { border-left: 1px solid var(--border-soft); padding-left: 28px; }
.planner-lane-header { min-height: 70px; display: flex; align-items: center; gap: 11px; padding: 12px 4px; }
.planner-lane-header .avatar { width: 38px; height: 38px; font-size: 12px; }
.planner-lane-title { min-width: 0; flex: 1; }
.planner-lane-title h2 { font-size: 17px; line-height: 1.25; overflow-wrap: anywhere; }
.planner-lane-title span { color: var(--text-3); font-size: 11.5px; }
.planner-lane-header > strong { padding: 5px 8px; border-radius: 6px; background: color-mix(in srgb, var(--person-color) 15%, transparent); color: var(--text-2); font-size: 10.5px; white-space: nowrap; }
.planner-lane-summary { display: flex; align-items: center; gap: 6px; padding: 0 4px 12px; }
.planner-lane-summary span { min-height: 25px; display: inline-flex; align-items: center; gap: 4px; padding: 4px 7px; border-radius: 6px; background: var(--surface-2); color: var(--text-2); font-size: 10.5px; }
.planner-lane-section { display: grid; grid-template-columns: minmax(105px, 125px) minmax(0, 1fr); gap: 10px; min-height: 62px; padding: 11px 4px; border-top: 1px solid var(--border-soft); transition: background var(--transition); }
.planner-lane-section.drag-over { background: var(--accent-soft); }
.planner-lane-section-head { display: flex; align-items: flex-start; gap: 6px; padding-top: 3px; color: var(--text-2); font-size: 11.5px; font-weight: 700; }
.planner-lane-section-head > span { min-width: 0; flex: 1; display: flex; align-items: center; gap: 6px; }
.planner-lane-section-head > b { min-width: 20px; height: 20px; display: grid; place-items: center; border-radius: 10px; background: var(--surface-3); color: var(--text-3); font-size: 9.5px; }
.planner-lane-pool { background: color-mix(in srgb, var(--person-color) 5%, transparent); }
.planner-lane-empty { padding: 7px 2px; color: var(--text-3); font-size: 11px; }
.planner-entry { --entry-color: var(--accent); background: var(--surface-2); border: 1px solid var(--border-soft); border-left: 3px solid var(--entry-color); border-radius: 7px; padding: 8px 9px; margin-bottom: 7px; font-size: 13px; cursor: pointer; display: flex; align-items: center; gap: 7px; min-width: 0; }
.planner-task { cursor: grab; --entry-color: var(--accent); }
.planner-routine { --entry-color: var(--amber); flex-wrap: wrap; }
.planner-entry:hover { border-color: var(--border); border-left-color: var(--entry-color); }
.planner-entry-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.planner-entry-main b { font-size: 12.5px; line-height: 1.3; white-space: normal; overflow-wrap: anywhere; }
.planner-entry-main small { display: flex; align-items: center; gap: 4px; color: var(--text-3); font-size: 10.5px; line-height: 1.35; white-space: normal; }
.planner-type { width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; flex-shrink: 0; background: color-mix(in srgb, var(--entry-color) 14%, transparent); color: var(--entry-color); }
.planner-check { width: 23px; height: 23px; border: 2px solid var(--entry-color); border-radius: 7px; display: grid; place-items: center; flex-shrink: 0; background: transparent; color: transparent; }
.planner-check.done { background: var(--entry-color); color: #fff; }
.planner-habit.done .planner-entry-main b { text-decoration: line-through; color: var(--text-3); }
.planner-routine-steps { width: 100%; display: flex; flex-direction: column; gap: 4px; padding: 3px 0 0 29px; }
.planner-routine-step { width: 100%; display: flex; align-items: center; gap: 7px; padding: 4px 5px; border: 0; border-radius: 5px; background: transparent; color: var(--text-2); text-align: left; font-size: 11.5px; }
.planner-routine-step:hover { background: var(--surface-3); }
.planner-routine-step:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.planner-routine-step span { width: 17px; height: 17px; border: 1px solid var(--border); border-radius: 5px; display: grid; place-items: center; color: transparent; flex-shrink: 0; }
.planner-routine-step.done { color: var(--text-3); text-decoration: line-through; }
.planner-routine-step.done span { color: #fff; background: var(--accent); border-color: var(--accent); }
.planner-week-grid { align-items: start; }
.planner-week-col { min-width: 0; padding: 10px 3px; border: 0; border-top: 3px solid var(--border); border-radius: 0; background: transparent; }
.planner-week-col.today { border-top-color: var(--accent); }
.planner-week-head { width: 100%; border: 0; background: transparent; color: var(--text); display: flex; justify-content: space-between; text-align: left; border-radius: 5px; padding: 2px; }
.planner-week-head:hover { color: var(--accent); }
.planner-week-head span { color: var(--text-3); font-size: 11px; }
.planner-week-list { min-width: 0; }
.planner-entry.compact { padding: 6px; gap: 5px; cursor: pointer; }
.planner-entry.compact .planner-type { width: 19px; height: 19px; }
.planner-entry.compact .planner-entry-main b { font-size: 11px; }
.planner-entry.compact .planner-entry-main small { font-size: 9.5px; }
.day-review-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.rating-stars { display: flex; gap: 6px; }
.rating-stars button { background: transparent; border: 0; font-size: 26px; color: var(--surface-3); line-height: 1; }
.rating-stars button.on { color: var(--amber); }

/* =====================================================================
   Formulare
   ===================================================================== */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row { display: flex; flex-direction: column; gap: 6px; }
.form-row.full { grid-column: 1 / -1; }
.form-row label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.form-row input, .form-row textarea, .form-row select {
    height: 40px; padding: 0 12px; background: var(--surface-2); border: 1px solid var(--border);
    border-radius: 9px; color: var(--text); outline: none; transition: border var(--transition), box-shadow var(--transition); width: 100%;
}
.form-row textarea { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.form-row select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237a8393' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
.form-row input:focus, .form-row textarea:focus, .form-row select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.form-hint { font-size: 11.5px; color: var(--text-3); }
.form-row.error input, .form-row.error textarea { border-color: var(--red); }
.field-err { font-size: 11.5px; color: var(--red); }

.person-picker { display: flex; gap: 8px; flex-wrap: wrap; }
.person-opt { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 20px; border: 1.5px solid var(--border); background: var(--surface-2); cursor: pointer; font-size: 13px; font-weight: 550; transition: all var(--transition); }
.person-opt.active { border-color: var(--accent); background: var(--accent-soft); }

.color-picker { display: flex; gap: 8px; flex-wrap: wrap; }
.color-opt { width: 30px; height: 30px; border-radius: 8px; cursor: pointer; border: 2px solid transparent; }
.color-opt.active { border-color: var(--text); box-shadow: 0 0 0 2px var(--bg); }

.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { display: none; }
.switch-track { width: 42px; height: 24px; background: var(--surface-3); border-radius: 20px; position: relative; transition: background var(--transition); }
.switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform var(--transition); }
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(18px); }

.subtask-editor { display: flex; flex-direction: column; gap: 6px; }
.subtask-edit-row { display: flex; align-items: center; gap: 8px; }
.subtask-edit-row input { flex: 1; height: 34px; }

/* =====================================================================
   Detailansicht (Lesemodus für Aufgaben / Termine / Notizen)
   ===================================================================== */
.view-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 18px; }
.view-title { font-size: 19px; font-weight: 700; letter-spacing: -0.3px; line-height: 1.3; }
.view-title.is-done { color: var(--text-3); text-decoration: line-through; }
.view-badges { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-top: 8px; }
.view-badges .chip { gap: 5px; }
.view-badges .chip .ico { width: 12px; height: 12px; }
.chip-danger { background: rgba(239,68,68,.14); color: var(--red); }
.task-check.lg { width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0; margin-top: 2px; }
.task-check.lg .ico { width: 16px; height: 16px; }
.note-pin-static { color: var(--amber); flex-shrink: 0; margin-top: 3px; }

.view-section { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border-soft); }
.view-section:first-of-type { margin-top: 4px; }
.view-section-title { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); margin-bottom: 9px; }
.view-text { font-size: 14px; line-height: 1.7; color: var(--text-2); white-space: pre-wrap; }

.view-meta { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px 20px; margin-top: 18px; padding: 14px 16px; background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: var(--radius-sm); }
.view-meta-item { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.view-meta-item span { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); }
.view-meta-item b { font-size: 13.5px; font-weight: 600; display: flex; align-items: center; gap: 5px; }
.view-meta-item b .ico { width: 13px; height: 13px; flex-shrink: 0; color: var(--text-3); }

.view-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 14px; }

.note-reading .md-body { font-size: 14.5px; }

/* =====================================================================
   Modal / Toast / Confirm
   ===================================================================== */
[hidden] {
    display: none !important;
}

.modal-backdrop {
    position: fixed; inset: 0; background: rgba(0,0,0,0.55); backdrop-filter: blur(3px);
    z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px;
    animation: fade .18s ease;
}
@keyframes fade { from { opacity: 0; } }
.modal {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
    box-shadow: var(--shadow); width: 100%; max-width: 620px; max-height: 90vh;
    display: flex; flex-direction: column; animation: pop .2s cubic-bezier(.2,.8,.3,1.1);
}
@keyframes pop { from { transform: translateY(14px) scale(.98); opacity: 0; } }
.modal-sm { max-width: 420px; }
.modal-lg { max-width: 820px; }
.modal-xl { max-width: min(1180px, calc(100vw - 32px)); height: min(94vh, 1000px); max-height: 94vh; }
.modal-xl .modal-body { padding: 20px 24px 36px; background: color-mix(in srgb, var(--bg-2) 78%, #fff 22%); }
.modal-head { display: flex; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--border-soft); }
.modal-head h3 { font-size: 17px; font-weight: 700; flex: 1; }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--border-soft); flex-wrap: wrap; }
.modal-foot .foot-left { margin-right: auto; }

.toast-wrap { position: fixed; bottom: 22px; right: 22px; z-index: 200; display: flex; flex-direction: column; gap: 10px; max-width: 360px; }
.toast {
    background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--accent);
    border-radius: 11px; box-shadow: var(--shadow); padding: 13px 16px; display: flex; align-items: center; gap: 11px;
    animation: slideIn .25s ease; font-size: 14px;
}
@keyframes slideIn { from { transform: translateX(120%); opacity: 0; } }
.toast.success { border-left-color: var(--green); }
.toast.error { border-left-color: var(--red); }
.toast.info { border-left-color: var(--blue); }
.toast .ico { width: 18px; height: 18px; flex-shrink: 0; }
.toast.success .ico { color: var(--green); }
.toast.error .ico { color: var(--red); }

/* =====================================================================
   Leerzustände
   ===================================================================== */
.empty-state { text-align: center; padding: 50px 20px; color: var(--text-3); }
.empty-state .es-ico { width: 60px; height: 60px; border-radius: 18px; background: var(--surface-2); display: grid; place-items: center; margin: 0 auto 16px; color: var(--text-3); }
.empty-state .es-ico .ico { width: 30px; height: 30px; }
.empty-state h3 { color: var(--text-2); font-size: 16px; margin-bottom: 6px; }
.empty-state p { font-size: 13.5px; max-width: 340px; margin: 0 auto 16px; }

/* =====================================================================
   Diagramme (selbst gezeichnet)
   ===================================================================== */
.bar-chart { display: flex; align-items: flex-end; gap: 10px; height: 180px; padding-top: 10px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bar { width: 100%; max-width: 42px; background: var(--accent); border-radius: 6px 6px 0 0; min-height: 3px; transition: height .5s ease; position: relative; }
.bar-val { font-size: 12px; font-weight: 700; }
.bar-label { font-size: 11px; color: var(--text-3); }

.hbar-row { display: flex; align-items: center; gap: 12px; margin-bottom: 11px; }
.hbar-label { width: 120px; font-size: 12.5px; color: var(--text-2); flex-shrink: 0; text-align: right; }
.hbar-track { flex: 1; height: 22px; background: var(--surface-3); border-radius: 6px; overflow: hidden; }
.hbar-fill { height: 100%; border-radius: 6px; display: flex; align-items: center; padding-left: 8px; font-size: 11.5px; font-weight: 700; color: #fff; min-width: 24px; transition: width .5s ease; }

.donut-wrap { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.donut { width: 150px; height: 150px; border-radius: 50%; flex-shrink: 0; }
.donut-legend { display: flex; flex-direction: column; gap: 8px; }
.donut-legend .dl-row { display: flex; align-items: center; gap: 9px; font-size: 13px; }
.donut-legend .dl-row b { margin-left: auto; }

/* =====================================================================
   Icons
   ===================================================================== */
.ico { display: inline-block; vertical-align: middle; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.muted { color: var(--text-3); }
.text-right { text-align: right; }
.flex { display: flex; align-items: center; gap: 8px; }
.flex-wrap { flex-wrap: wrap; }
.gap-sm { gap: 6px; }
.mt-1 { margin-top: 10px; } .mt-2 { margin-top: 18px; } .mb-1 { margin-bottom: 10px; }
.grow { flex: 1; }
.hidden { display: none !important; }

/* =====================================================================
   Login / Ersteinrichtung (login.php – eigenständige Seite)
   ===================================================================== */
.auth-body { overflow: auto; min-height: 100%; display: flex; }
.auth-page {
    flex: 1; display: flex; align-items: center; justify-content: center;
    padding: 24px; background:
        radial-gradient(circle at 15% 10%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 55%),
        radial-gradient(circle at 85% 90%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 55%),
        var(--bg);
}
.auth-card {
    width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 32px 30px 26px;
}
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.auth-brand .brand-logo { width: 76px; height: 76px; border-radius: 12px; }
.auth-brand .brand-name { font-weight: 700; font-size: 17px; }
.auth-title { font-size: 21px; font-weight: 700; letter-spacing: -0.3px; margin-bottom: 4px; }
.auth-sub { color: var(--text-2); font-size: 13.5px; margin-bottom: 20px; line-height: 1.5; }
.auth-alert {
    background: rgba(239,68,68,.12); border: 1px solid rgba(239,68,68,.3); color: var(--red);
    border-radius: var(--radius-sm); padding: 11px 14px; font-size: 13px; margin-bottom: 16px; line-height: 1.5;
}
.auth-notice {
    background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); color: var(--accent);
    border-radius: var(--radius-sm); padding: 11px 14px; font-size: 13px; margin-bottom: 16px; line-height: 1.5;
}
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.auth-input {
    height: 42px; padding: 0 13px; background: var(--surface-2); border: 1px solid var(--border);
    border-radius: 9px; color: var(--text); outline: none; font-size: 14px;
    transition: border var(--transition), box-shadow var(--transition);
}
.auth-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.auth-input-disabled { opacity: .65; cursor: not-allowed; }
.auth-submit { height: 44px; font-size: 14.5px; margin-top: 6px; }
.auth-foot { text-align: center; color: var(--text-3); font-size: 11.5px; margin-top: 22px; }

/* =====================================================================
   Responsive
   ===================================================================== */
@media (max-width: 1100px) {
    .col-3 { grid-column: span 6; } .col-4 { grid-column: span 6; }
    .col-8 { grid-column: span 12; } .col-9 { grid-column: span 12; } .col-6 { grid-column: span 12; }
    .day-review-grid { grid-template-columns: 1fr; }
    .week-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) {
    .planner-person-lanes { grid-template-columns: 1fr; }
    .planner-person-lane + .planner-person-lane { border-left: 0; padding-left: 0; margin-top: 18px; }
}

@media (max-width: 860px) {
    :root { --topbar-h: 58px; }
    .sidebar {
        position: fixed; top: 0; left: 0; bottom: 0; height: 100%;
        transform: translateX(-100%); box-shadow: var(--shadow);
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar.open ~ .sidebar-overlay { display: block; }
    button.sidebar-close { display: grid; }
    #menuToggle { display: grid; }
    .content { padding: 18px 16px 60px; }
    .form-grid { grid-template-columns: 1fr; }
    .quick-add span { display: none; }
    .quick-add { width: 40px; padding: 0; justify-content: center; }
    .col-3, .col-4, .col-6, .col-8, .col-9 { grid-column: span 12; }
    .week-grid { grid-template-columns: 1fr; }
    .dropdown { width: calc(100vw - 32px); position: fixed; right: 16px; top: var(--topbar-h); }
    .cal-cell { min-height: 76px; }
    .cal-event { font-size: 10px; }
    .habit-week { display: none; }
    .modal-xl { max-width: calc(100vw - 16px); height: calc(100dvh - 16px); max-height: calc(100dvh - 16px); }
    .note-document { padding: 48px 42px 64px; min-height: 820px; }
    .note-doc-editor, .note-doc-preview { min-height: 590px; }
}

@media (max-width: 560px) {
    .page-head h1 { font-size: 20px; }
    .modal-foot { flex-direction: column-reverse; }
    .modal-foot .btn { width: 100%; justify-content: center; }
    .modal-foot .foot-left { margin-right: 0; }
    .stat-tiles { grid-template-columns: 1fr 1fr; }
    .planner-toolbar { gap: 6px; }
    .planner-toolbar .filter-select { flex: 1; min-width: 135px; }
    .planner-hint { width: 100%; margin-left: 0; }
    .planner-overview { grid-template-columns: 1fr 1fr; }
    .planner-overview-item { grid-template-columns: 27px auto 1fr; padding: 7px; }
    .planner-overview-icon { width: 27px; height: 27px; }
    .planner-lane-section { grid-template-columns: 1fr; gap: 5px; }
    .planner-lane-section-head { align-items: center; }
    .routine-slot-picker { grid-template-columns: 1fr 1fr; }
    .cal-num { width: 22px; height: 22px; font-size: 11px; }
    .search-wrap { max-width: none; }
    .modal-backdrop { padding: 0; }
    .modal-xl { max-width: 100vw; width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; border: 0; }
    .modal-xl .modal-head { padding: 14px 16px; }
    .modal-xl .modal-body { padding: 12px 10px 24px; }
    .modal-xl .modal-foot { padding: 10px 12px; flex-direction: row; flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; }
    .modal-xl .modal-foot .btn { width: auto; flex: 0 0 auto; }
    .modal-xl .modal-foot .foot-left { margin-right: 0; }
    .note-properties { padding: 0 4px 12px; }
    .note-document-tools { top: -12px; padding: 8px 0; }
    .note-document { padding: 34px 22px 48px; min-height: 720px; }
    .note-doc-title, .note-doc-title-input { font-size: 27px; }
    .note-doc-editor, .note-doc-preview { min-height: 500px; }
    .note-document-options { padding-inline: 4px; flex-wrap: wrap; }
}

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