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

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}

.aurora {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 60% 45% at 18% 8%, var(--bg-gradient-a), transparent 60%),
    radial-gradient(ellipse 50% 40% at 85% 90%, var(--bg-gradient-b), transparent 60%);
}

.glass-card {
  background: var(--surface);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.muted { color: var(--text-muted); }
.small { font-size: 12.5px; }
.spacer { flex: 1; }

/* ---------- Buttons & Inputs ---------- */
.btn {
  border: 1px solid var(--glass-border);
  background: var(--surface-strong);
  color: var(--text);
  padding: 8px 16px;
  border-radius: var(--radius-small);
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--accent); border-color: transparent; color: var(--accent-text); font-weight: 600; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn-ghost:hover { color: var(--text); background: var(--surface); }
.btn-small { padding: 5px 10px; font-size: 13px; }
.btn-block { width: 100%; margin-top: 14px; }

.icon-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 15px;
  padding: 4px 6px;
  border-radius: 6px;
  color: var(--text-muted);
  transition: background 0.15s;
}
.icon-btn:hover { background: var(--surface-strong); }

input[type="text"], input[type="password"], input[type="date"], textarea, select {
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-small);
  color: var(--text);
  padding: 9px 12px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }

.select { padding: 8px 10px; }
.inline-input { width: 100%; margin: 4px 0; }

/* ---------- Login ---------- */
.login-wrap { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.login-card { width: 100%; max-width: 380px; padding: 38px 34px; text-align: center; }
.login-logo {
  width: 54px; height: 54px;
  margin: 0 auto 14px;
  display: grid; place-items: center;
  border-radius: 16px;
  background: var(--accent);
  color: #fff;
  font-size: 26px; font-weight: 700;
}
.login-card h1 { font-size: 22px; margin-bottom: 4px; }
.login-card .muted { margin-bottom: 20px; }
.field-label { display: block; text-align: left; font-size: 13px; color: var(--text-muted); margin: 14px 0 6px; }
.login-card input { width: 100%; }
.form-error { color: var(--danger); font-size: 14px; margin-bottom: 8px; }

/* ---------- Layout ---------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 264px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--glass-border);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  padding: 22px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar-head { margin-bottom: 22px; }
.brand { font-size: 19px; font-weight: 700; color: var(--text); text-decoration: none; }
.section-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted); margin: 4px 8px 8px;
}
.project-list { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.project-row {
  display: flex; align-items: center;
  border-radius: var(--radius-small);
  padding: 2px 4px;
}
.project-row:hover { background: var(--surface); }
.project-row.active { background: var(--surface-strong); }
.project-link {
  flex: 1; display: flex; align-items: center; justify-content: space-between;
  color: var(--text); text-decoration: none; padding: 7px 8px; min-width: 0;
}
.project-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge {
  background: var(--accent); color: #fff;
  font-size: 11.5px; font-weight: 600;
  border-radius: 99px; padding: 1px 8px; margin-left: 8px;
}
.row-actions { display: none; gap: 2px; }
.project-row:hover .row-actions { display: flex; }
.archived-projects { margin-top: 10px; }
.project-row.archived { color: var(--text-muted); padding: 5px 8px; justify-content: space-between; }
.sidebar-foot {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 16px; padding-top: 14px;
  border-top: 1px solid var(--glass-border);
}
.theme-toggle { font-size: 17px; }
:root[data-theme="dark"] .theme-icon-dark { display: none; }
:root[data-theme="light"] .theme-icon-light { display: none; }

/* ---------- Main ---------- */
.main { flex: 1; padding: 30px 36px 60px; max-width: 880px; }
.mobile-menu { display: none; }
.main-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 18px; }
.main-head h1 { font-size: 26px; }

.add-card { padding: 16px; margin-bottom: 22px; }
.add-title { width: 100%; font-size: 15px; margin-bottom: 10px; }
.add-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- Todo-Karten ---------- */
.todo-list { display: flex; flex-direction: column; gap: 10px; }
.todo-card { padding: 13px 16px; border-left: 3px solid transparent; }
.todo-card.prio-hoch { border-left-color: var(--prio-hoch); }
.todo-card.prio-mittel { border-left-color: var(--prio-mittel); }
.todo-card.prio-niedrig { border-left-color: var(--prio-niedrig); }

.todo-row { display: flex; align-items: flex-start; gap: 12px; }
.check {
  width: 19px; height: 19px;
  margin-top: 3px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}
.check-small { width: 15px; height: 15px; margin-top: 0; }
.todo-body { flex: 1; min-width: 0; }
.todo-title {
  background: none; border: none; cursor: pointer;
  color: var(--text); font-size: 15.5px; font-weight: 600;
  text-align: left; padding: 0; font-family: inherit;
}
.todo-title:hover { color: var(--accent); }
.todo-meta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 4px; }
.meta-item { font-size: 12.5px; color: var(--text-muted); }
.due-badge.overdue { color: var(--danger); font-weight: 600; }
.todo-actions { display: flex; align-items: center; gap: 2px; }

.prio-wrap { position: relative; }
.prio-badge {
  border: none; cursor: pointer;
  font-size: 12px; font-weight: 700;
  padding: 3px 10px; border-radius: 99px;
  color: #fff;
}
.prio-badge.prio-hoch { background: var(--prio-hoch); }
.prio-badge.prio-mittel { background: var(--prio-mittel); }
.prio-badge.prio-niedrig { background: var(--prio-niedrig); }
.prio-menu {
  position: absolute; right: 0; top: 28px; z-index: 20;
  display: flex; flex-direction: column;
  padding: 6px; min-width: 110px;
  background: var(--surface-strong);
}
.prio-menu button {
  background: none; border: none; cursor: pointer;
  color: var(--text); padding: 7px 10px; text-align: left;
  border-radius: 6px; font-size: 13.5px; font-family: inherit;
}
.prio-menu button:hover { background: var(--surface); }

.notes-wrap { margin: 10px 0 0 31px; position: relative; }
.notes { width: 100%; min-height: 84px; resize: vertical; font-size: 14px; }
.saved-hint { position: absolute; right: 10px; bottom: 10px; font-size: 12px; color: var(--ok); }

.edit-wrap { display: flex; gap: 8px; margin: 10px 0 0 31px; flex-wrap: wrap; }
.edit-wrap .inline-input { flex: 1; min-width: 180px; margin: 0; }

.subs-wrap { margin: 10px 0 0 31px; display: flex; flex-direction: column; gap: 4px; }
.sub-row { display: flex; align-items: center; gap: 9px; }
.sub-title { flex: 1; font-size: 14px; }
.sub-title.done { text-decoration: line-through; color: var(--text-muted); }

.empty-state { padding: 40px; text-align: center; color: var(--text-muted); }

/* ---------- Archiv ---------- */
.archive { margin-top: 28px; }
.archive-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.archive-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
}
.archive-title { flex: 1; text-decoration: line-through; color: var(--text-muted); }

/* ---------- Mobile ---------- */
@media (max-width: 760px) {
  .sidebar {
    position: fixed; z-index: 50; left: -280px;
    transition: left 0.25s ease;
  }
  .sidebar.open { left: 0; }
  .mobile-menu { display: block; font-size: 22px; margin-bottom: 12px; }
  .main { padding: 18px 16px 60px; }
}

/* ---------- Verschachtelte Subtasks ---------- */
.sub-node { display: flex; flex-direction: column; gap: 2px; }
.sub-children {
  margin-left: 20px;
  border-left: 1px solid var(--glass-border);
  padding-left: 10px;
  display: flex; flex-direction: column; gap: 2px;
}
.sub-title {
  background: none; border: none; cursor: pointer;
  color: var(--text); font-size: 14px; font-family: inherit;
  text-align: left; padding: 0; flex: 1;
}
.sub-title:hover { color: var(--accent); }
.sub-notes { position: relative; margin: 4px 0 4px 24px; }
.notes-small { min-height: 56px; font-size: 13.5px; }
.note-dot { font-size: 11px; }

/* ---------- Telegram-Sektion ---------- */
.section-title {
  font-size: 13px; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--text-muted); margin: 4px 0 10px;
}
.tg-section { margin-bottom: 24px; }
.tg-section .todo-card { border-left-color: var(--accent); }
