:root {
  color-scheme: light;
  --background: #f3f5f7;
  --surface: #ffffff;
  --text: #17202a;
  --muted: #66727f;
  --border: #dce2e8;
--accent: #4f46e5;        /* Indigo */
--accent-soft: #e0e7ff;   /* helles Indigo-Blau */
  --success: #16803c;
  --danger: #dc2626;
  --shadow: 0 10px 30px rgba(23, 32, 42, 0.08);
}

:root.dark {
  color-scheme: dark;
  --background: #111827;
  --surface: #1f2937;
  --text: #f3f4f6;
  --muted: #aeb8c4;
  --border: #374151;
  --accent: #60a5fa;
  --accent-soft: #1e3a8a;
  --success: #86efac;
  --danger: #f87171;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

* {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: Arial, sans-serif;
  line-height: 1.5;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: clamp(2rem, 5vw, 3.5rem);
}

h2 {
  margin-bottom: 0;
  font-size: 1.25rem;
}

button,
input {
  max-width: 100%;
}

button {
  font: inherit;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  max-width: 1440px;
  margin: 0 auto;
  padding: 18px 20px 12px;
}

.welcome-area {
  min-width: 220px;
}

.topbar-right {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.dashboard {
  display: grid;
  align-items: stretch;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 20px 16px;
}

.card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  height: 100%;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  margin-bottom: 10px;
}

.card-header h2,
.card-header p {
  overflow-wrap: anywhere;
}

.eyebrow {
  margin-bottom: 2px;
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: bold;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.muted {
  color: var(--muted);
}

.badge {
  flex: 0 0 auto;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: bold;
}

.button {
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
}

.button.secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

/* Navigation */

/* Navigation - Modern "Floating Pill" Style */

.tabs {
  display: flex;
  justify-content: center; /* Zentriert die Navigationsleiste */
  max-width: 1440px;
  margin: 0 auto 24px;
  padding: 0 20px;
}

.tabs-container {
  display: inline-flex;
  background: var(--surface);
  padding: 6px;
  border-radius: 100px; /* Typische "Pillenform" */
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06); /* Sehr weicher, moderner Schatten */
  border: 1px solid var(--border);
  gap: 4px;
}

:root.dark .tabs-container {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.tab-button {
  border: 0;
  background: transparent;
  border-radius: 100px;
  padding: 10px 20px;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 600; /* Etwas dicker für moderne Lesbarkeit */
  cursor: pointer;
  transition: all 0.3s ease; /* Geschmeidige Animation */
  display: flex;
  align-items: center;
  gap: 8px;
}

.tab-button:hover {
  color: var(--text);
  background: var(--background);
}

.tab-button.active {
  background: var(--accent);
  color: #ffffff;
  /* Sanftes Leuchten in der Akzentfarbe */
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3); 
}

:root.dark .tab-button.active {
  /* Leuchten für den Dark-Mode anpassen (blau) */
  box-shadow: 0 4px 12px rgba(96, 165, 250, 0.3);
}

.tab-icon {
  font-size: 1.1rem;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

#overview-tab.tab-panel.active {
  display: grid;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

#overview-tab.tab-panel.active {
  display: grid;
}

/* Checklisten */

.check-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.check-row:last-of-type {
  border-bottom: 0;
}

.check-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.check-row input:checked + span {
  color: var(--muted);
  text-decoration: line-through;
}

/* Workout und Foto-Challenge */

.challenge {
  margin-bottom: 10px;
  padding: 10px;
  border-left: 4px solid var(--accent);
  background: var(--accent-soft);
}

.success-message {
  min-height: 24px;
  margin: 16px 0 0;
  color: var(--success);
  font-weight: bold;
}

#workout-list {
  flex: 1 1 auto;
  min-height: 0;
}

/* Home-Assistant-Aufgaben */

.ha-todo-card {
  min-height: 260px;
}

.ha-todo-card .card-header {
  flex: 0 0 auto;
}

.ha-todo-card .todo-form {
  flex: 0 0 auto;
}

.ha-todo-card #ha-todo-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}

.todo-form {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.todo-form input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--surface);
  color: var(--text);
}

.todo-form .button {
  background: var(--accent);
  color: #ffffff;
}

.todo-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}

.todo-row:last-child {
  border-bottom: 0;
}

.todo-row input {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.todo-row input:checked + span {
  color: var(--muted);
  text-decoration: line-through;
}

.todo-row span {
  overflow-wrap: anywhere;
}

.todo-row button {
  margin-left: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.todo-group {
  margin-top: 18px;
}

.todo-group summary {
  color: var(--muted);
  cursor: pointer;
  font-weight: bold;
}

.todo-group-content {
  margin-top: 8px;
}

/* Google Kalender und Google Tasks */

.google-card {
  min-height: 260px;
}

.google-card .card-header {
  flex: 0 0 auto;
}

.google-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}

.google-list-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.google-list-item:last-child {
  border-bottom: 0;
}

.google-list-title {
  overflow-wrap: anywhere;
  font-weight: bold;
}

.google-list-meta {
  color: var(--muted);
  font-size: 0.8rem;
}

.google-empty {
  margin-bottom: 0;
}

.google-list-item.is-overdue {
  border-left: 3px solid var(--danger);
  padding-left: 9px;
}

.google-list-item.is-overdue .google-list-meta {
  color: var(--danger);
  font-weight: bold;
}

.google-list-item.is-today {
  border-left: 3px solid var(--accent);
  padding-left: 9px;
}

.google-list-item.is-today .google-list-meta {
  color: var(--accent);
  font-weight: bold;
}

.google-list-item.is-tomorrow .google-list-meta {
  color: var(--success);
}

/* Wetter */

.weather-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.weather-metric {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 9px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--background);
}

.weather-label {
  color: var(--muted);
  font-size: 0.85rem;
}

.weather-metric strong {
  font-size: 1.15rem;
}

.weather-summary {
  min-width: 360px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.weather-summary-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.weather-location {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: bold;
}

.weather-summary-header .muted {
  margin-bottom: 0;
  font-size: 0.72rem;
  white-space: nowrap;
}

.weather-inline-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.weather-inline-item {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 2px;
}

.weather-inline-item span {
  color: var(--muted);
  font-size: 0.68rem;
  white-space: nowrap;
}

.weather-inline-item strong {
  font-size: 1rem;
  white-space: nowrap;
}

.weather-message {
  min-height: 0;
  margin: 5px 0 0;
  color: var(--danger);
  font-size: 0.75rem;
}

.dashboard-updated {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.68rem;
  text-align: right;
}

/* Einkaufsliste */

.shopping-tab {
  padding: 0 20px 40px;
}

.shopping-card {
  max-width: 900px;
  min-height: 500px;
  margin: 0 auto;
}

.shopping-card .card-header,
.shopping-card .todo-form,
.shopping-card > p {
  flex: 0 0 auto;
}

.shopping-list {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}

.shopping-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 50px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--background);
  cursor: grab;
}

.shopping-item:active {
  cursor: grabbing;
}

.shopping-item.dragging {
  opacity: 0.45;
}

.shopping-item input {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  accent-color: var(--accent);
}

.shopping-item-title {
  flex: 1;
  overflow-wrap: anywhere;
}

.shopping-item-delete {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 8px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
}

.shopping-item-delete:hover {
  color: var(--danger);
}

.shopping-empty {
  margin: 12px 0 0;
  color: var(--muted);
}

/* Sonstiges */

.integration-list {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
}

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

/* Mittlere Bildschirme */

@media (max-width: 1099px) and (min-width: 761px) {
  .dashboard {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .weather-summary {
    min-width: 320px;
  }
}

/* Kleine Bildschirme */

@media (max-width: 760px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
    padding-top: 24px;
  }

  .topbar-right {
    align-items: stretch;
    flex-direction: column;
  }

  .weather-summary {
    min-width: 0;
  }

  .topbar .button {
    width: 100%;
  }

  .dashboard {
    grid-template-columns: 1fr;
    gap: 14px;
    padding-right: 18px;
    padding-left: 18px;
  }
.tabs {
    justify-content: flex-start;
    overflow-x: auto;
    padding-right: 18px;
    padding-left: 18px;
    padding-bottom: 12px; /* Etwas Luft für den Scrollbalken */
  }
  
  .tabs-container {
    flex-shrink: 0; /* Verhindert, dass die Pille gequetscht wird */
  }

  .card {
    padding: 18px;
  }

  .card-header {
    flex-wrap: wrap;
  }

  .ha-todo-card,
  .google-card {
    min-height: 220px;
  }

  .shopping-tab {
    padding-right: 18px;
    padding-left: 18px;
  }

  .shopping-card {
    min-height: 400px;
  }
}

/* Sehr kleine Bildschirme */

@media (max-width: 500px) {
  .todo-form {
    align-items: stretch;
    flex-direction: column;
  }

  .weather-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  .topbar {
    padding-right: 14px;
    padding-left: 14px;
  }

  .dashboard {
    padding-right: 14px;
    padding-left: 14px;
  }

  .tabs {
    padding-right: 14px;
    padding-left: 14px;
  }

  .shopping-tab {
    padding-right: 14px;
    padding-left: 14px;
  }

  h1 {
    font-size: 2rem;
  }

  .card {
    padding: 16px;
    border-radius: 14px;
  }

  .weather-inline-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .weather-summary-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }

  .todo-row {
    align-items: flex-start;
  }
}
/* Kompakte Einkaufsliste */

.shopping-card {
  max-width: 1100px;
  min-height: 420px;
  margin: 0 auto;
}

.shopping-card .card-header {
  margin-bottom: 8px;
}

.shopping-card .todo-form {
  margin-bottom: 4px;
}

.shopping-card > #shopping-message {
  min-height: 20px;
  margin: 4px 0 10px;
  font-size: 0.8rem;
}

.shopping-columns {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(220px, 0.65fr);
  align-items: start;
  gap: 18px;
  flex: 1 1 auto;
  min-height: 0;
}

.shopping-open-section,
.shopping-completed-section {
  min-width: 0;
}

.shopping-section-header,
.shopping-completed-section > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 32px;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: bold;
}

.shopping-section-header h3 {
  margin: 0;
  color: var(--text);
  font-size: 0.9rem;
}

.shopping-section-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: bold;
}

.shopping-list,
.shopping-completed-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}

.shopping-list {
  max-height: 310px;
}

.shopping-completed-list {
  max-height: 260px;
  padding-top: 6px;
}

.shopping-completed-section {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--background);
}

.shopping-completed-section > summary {
  margin: 0;
  padding: 8px 10px;
  color: var(--text);
  cursor: pointer;
  list-style-position: inside;
}

.shopping-completed-section > summary::marker {
  color: var(--accent);
}

.shopping-completed-section[open] > summary {
  border-bottom: 1px solid var(--border);
}

.shopping-completed-list {
  padding: 6px 10px 10px;
}

.shopping-item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  cursor: grab;
}

.shopping-item:active {
  cursor: grabbing;
}

.shopping-item.dragging {
  opacity: 0.45;
}

.shopping-item input {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  accent-color: var(--accent);
}

.shopping-item-title {
  flex: 1;
  overflow-wrap: anywhere;
  font-size: 0.9rem;
}

.shopping-item-delete {
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 4px 7px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.75rem;
  cursor: pointer;
}

.shopping-item-delete:hover {
  color: var(--danger);
}

.shopping-completed-list .shopping-item {
  opacity: 0.72;
}

.shopping-completed-list .shopping-item-title {
  color: var(--muted);
  text-decoration: line-through;
}

.shopping-empty {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

@media (max-width: 760px) {
  .shopping-columns {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .shopping-list,
  .shopping-completed-list {
    max-height: 240px;
  }

  .shopping-completed-section {
    order: 2;
  }
}
/* Einkaufsliste vollständig anzeigen */

.shopping-card {
  min-height: 0;
  height: auto;
}

.shopping-columns {
  align-items: start;
}

.shopping-list,
.shopping-completed-list {
  max-height: none;
  overflow-y: visible;
}

.shopping-list {
  flex: 0 0 auto;
}

.shopping-completed-list {
  flex: 0 0 auto;
}

.shopping-item {
  min-height: 38px;
  padding: 6px 8px;
}
/* Mobiler Verschiebegriff */

.shopping-item {
  position: relative;
  cursor: default;
}

.shopping-drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  min-width: 24px;
  height: 28px;
  margin-left: -3px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 1rem;
  letter-spacing: -3px;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.shopping-drag-handle::before {
  content: "⋮⋮";
}

.shopping-drag-handle:hover,
.shopping-drag-handle:active,
.shopping-item.is-dragging .shopping-drag-handle {
  color: var(--accent);
  cursor: grabbing;
}

.shopping-item.is-dragging {
  opacity: 0.55;
  border-color: var(--accent);
  background: var(--accent-soft);
}

.shopping-item.drop-before {
  border-top: 3px solid var(--accent);
}

.shopping-item.drop-after {
  border-bottom: 3px solid var(--accent);
}

.shopping-item-actions {
  display: none;
}

@media (max-width: 760px) {
  .shopping-drag-handle {
    width: 30px;
    min-width: 30px;
    height: 34px;
    font-size: 1.2rem;
  }

  .shopping-item {
    min-height: 44px;
  }
}
.notion-card {
  min-height: 260px;
}

.notion-card .card-header {
  flex: 0 0 auto;
}

.notion-card .google-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}

.notion-card .google-list-title {
  color: var(--text);
  text-decoration: none;
}

.notion-card .google-list-title:hover {
  color: var(--accent);
  text-decoration: underline;
}

.notion-card .google-list-item.is-mine {
  margin: 0 -6px;
  padding: 10px 6px 10px 9px;
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  background: var(--accent-soft);
}
.notes-card {
  max-width: 1200px;
  min-height: 500px;
  margin: 0 auto;
}

.notes-card .card-header {
  flex: 0 0 auto;
}

/* Notizverwaltung: links Baum, rechts Editor */

.notes-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 20px;
  margin-top: 10px;
  min-height: 480px;
}

.notes-sidebar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  padding-right: 16px;
  border-right: 1px solid var(--border);
}

.notes-search,
.notes-folder-input,
.notes-title-input {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.notes-tree {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 70vh;
  overflow-y: auto;
}

.notes-tree-favorites,
.notes-tree-all {
  padding-bottom: 8px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.notes-tree-archive {
  margin-top: 4px;
}

.notes-tree-folder,
.notes-tree-note {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 5px 8px 5px calc(8px + var(--depth, 0) * 14px);
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--text);
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
}

.notes-tree-folder {
  justify-content: space-between;
  font-weight: bold;
}

.notes-tree-folder::before {
  content: "▸";
  color: var(--muted);
  font-size: 0.75rem;
  transition: transform 0.15s;
}

.notes-tree-folder[aria-expanded="true"]::before {
  transform: rotate(90deg);
}

.notes-tree-folder > span:first-child {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notes-tree-count {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: normal;
}

.notes-tree-note {
  display: block;
  overflow: hidden;
  padding-left: calc(22px + var(--depth, 0) * 14px);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notes-tree-note.is-favorite::after {
  content: " ★";
  color: #d97706;
  font-size: 0.75rem;
}

.notes-tree-folder:hover,
.notes-tree-note:hover {
  background: var(--background);
}

.notes-tree-note.is-selected {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: bold;
}

.notes-tree-empty {
  padding: 8px;
}

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

.notes-back {
  display: none;
  align-self: flex-start;
  margin-bottom: 10px;
}

.notes-empty {
  margin: auto;
  text-align: center;
}

.notes-editor {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.notes-editor[hidden] {
  display: none;
}

.notes-editor-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.notes-title-input {
  flex: 1;
  min-width: 0;
  border-color: transparent;
  padding: 6px 8px;
  font-size: 1.35rem;
  font-weight: bold;
}

.notes-title-input:hover,
.notes-title-input:focus {
  border-color: var(--border);
}

.notes-favorite-btn {
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.notes-favorite-btn.is-active {
  color: #d97706;
}

.notes-editor-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  font-size: 0.85rem;
}

.notes-editor-meta label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.notes-folder-input {
  width: 220px;
  padding: 5px 8px;
}

.notes-updated {
  margin-right: auto;
}

.notes-small-btn {
  padding: 4px 10px;
  font-size: 0.8rem;
}

.notes-delete-btn:hover {
  color: var(--danger);
}

.notes-editor {
  position: relative;
}

.notes-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 4px;
  border: 1px solid var(--border);
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
  background: var(--background);
}

.notes-toolbar button {
  min-width: 32px;
  padding: 4px 8px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--text);
  font-weight: bold;
  cursor: pointer;
}

.notes-toolbar button:hover {
  background: var(--surface);
}

.notes-toolbar button.is-active {
  background: var(--accent-soft);
  color: var(--accent);
}

.notes-content .tiptap {
  min-height: 380px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 0 0 10px 10px;
  background: var(--surface);
  color: var(--text);
  line-height: 1.6;
  outline: none;
}

.notes-content .tiptap:focus {
  border-color: var(--accent);
}

.notes-content .tiptap > * + * {
  margin-top: 0.5em;
}

.notes-content .tiptap :is(h1, h2, h3) {
  margin: 1em 0 0.3em;
  line-height: 1.25;
}

.notes-content .tiptap h1 { font-size: 1.5rem; }
.notes-content .tiptap h2 { font-size: 1.25rem; }
.notes-content .tiptap h3 { font-size: 1.05rem; }

.notes-content .tiptap p {
  margin: 0;
}

.notes-content .tiptap :is(ul, ol) {
  margin: 0;
  padding-left: 1.4em;
}

.notes-content .tiptap blockquote {
  margin: 0;
  padding-left: 12px;
  border-left: 3px solid var(--border);
  color: var(--muted);
}

.notes-content .tiptap pre {
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--background);
  font-size: 0.85rem;
  overflow-x: auto;
}

.notes-content .tiptap code {
  font-size: 0.9em;
}

.notes-content .tiptap a {
  color: var(--accent);
}

.notes-content .tiptap hr {
  border: 0;
  border-top: 1px solid var(--border);
}

/* Checklisten */
.notes-content .tiptap ul[data-type="taskList"] {
  padding-left: 0;
  list-style: none;
}

.notes-content .tiptap li[data-type="taskItem"] {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.notes-content .tiptap li[data-type="taskItem"] > label {
  flex: 0 0 auto;
  margin-top: 0.25em;
}

.notes-content .tiptap li[data-type="taskItem"] > div {
  flex: 1;
}

.notes-content .tiptap li[data-type="taskItem"][data-checked="true"] > div {
  color: var(--muted);
  text-decoration: line-through;
}

/* Aufklapp-Blöcke */
.notes-content .tiptap .notes-details {
  display: flex;
  gap: 4px;
}

.notes-content .tiptap .notes-details > button {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  margin-top: 0.15em;
  border: 0;
  border-radius: 4px;
  background: none;
  color: var(--muted);
  cursor: pointer;
}

.notes-content .tiptap .notes-details > button::before {
  content: "▸";
  display: inline-block;
  transition: transform 0.15s;
}

.notes-content .tiptap .notes-details.is-open > button::before {
  transform: rotate(90deg);
}

.notes-content .tiptap .notes-details > button:hover {
  background: var(--background);
}

.notes-content .tiptap .notes-details > div {
  flex: 1;
  min-width: 0;
}

.notes-content .tiptap .notes-details summary {
  font-weight: bold;
  list-style: none;
}

.notes-content .tiptap .notes-details summary::-webkit-details-marker {
  display: none;
}

.notes-content .tiptap .notes-details.ProseMirror-selectednode {
  border-radius: 6px;
  background: var(--accent-soft);
  outline: 2px solid var(--accent);
}

.notes-content .tiptap [data-type="detailsContent"][hidden] {
  display: none;
}

.notes-content .tiptap [data-type="detailsContent"] {
  margin-top: 0.3em;
}

/* Platzhalter für leere Zeilen */
.notes-content .tiptap .is-empty::before {
  content: attr(data-placeholder);
  float: left;
  height: 0;
  color: var(--muted);
  pointer-events: none;
}

/* "/"-Menü */
.notes-slash-menu {
  position: absolute;
  z-index: 20;
  display: flex;
  flex-direction: column;
  min-width: 190px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.notes-slash-menu[hidden] {
  display: none;
}

.notes-slash-menu button {
  padding: 6px 10px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.notes-slash-menu button.is-selected,
.notes-slash-menu button:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

@media (max-width: 800px) {
  .notes-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .notes-sidebar {
    padding-right: 0;
    border-right: 0;
  }

  .notes-layout.has-selection .notes-sidebar,
  .notes-layout:not(.has-selection) .notes-main {
    display: none;
  }

  .notes-back {
    display: inline-flex;
  }

  .notes-folder-input {
    width: 160px;
  }
}

.notes-status {
  min-height: 24px;
  margin: 10px 0 0;
}

.google-list-item.calendar-primary {
  border-left: 3px solid var(--accent);
  padding-left: 9px;
}

.google-list-item.calendar-dpma {
  border-left: 3px solid #d97706;
  padding-left: 9px;
}

.google-list-item.calendar-family {
  border-left: 3px solid #16a34a;
  padding-left: 9px;
}

.google-list-item.calendar-dpma .calendar-name {
  color: #d97706;
  font-weight: bold;
}

.google-list-item.calendar-family .calendar-name {
  color: #16a34a;
  font-weight: bold;
}

.calendar-name {
  font-size: 0.75rem;
}

.google-list-item.calendar-primary,
.google-list-item.calendar-dpma,
.google-list-item.calendar-family {
  border-left-width: 4px !important;
  border-left-style: solid !important;
}

.google-list-item.calendar-primary {
  border-left-color: #8b5cf6 !important;
}

.google-list-item.calendar-dpma {
  border-left-color: #f59e0b !important;
}

.google-list-item.calendar-family {
  border-left-color: #22c55e !important;
}

.workout-level-navigation {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.workout-level-navigation .button {
  min-width: 8.5rem;
}

.workout-preview {
  min-height: 1.4rem;
  margin: 0 0 0.75rem;
  text-align: center;
}

@media (max-width: 600px) {
  .workout-level-navigation .button {
    min-width: auto;
    padding-inline: 0.6rem;
  }
}
.shopping-item-dragging {
  opacity: 0.6;
  background: var(--accent-soft);
}

.shopping-item-drag {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* --- Tagebuch / Historie --- */

/* Heatmap */
.heatmap-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.heatmap-day {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  background-color: var(--border);
  position: relative;
  cursor: help;
}

/* Intensitätsstufen für die Heatmap */
.heatmap-day.level-1 { background-color: var(--success); opacity: 0.3; }
.heatmap-day.level-2 { background-color: var(--success); opacity: 0.6; }
.heatmap-day.level-3 { background-color: var(--success); opacity: 1.0; }

/* Timeline */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 10px;
  padding-left: 14px;
  border-left: 2px solid var(--border);
}

.timeline-item {
  position: relative;
  padding-left: 20px;
}

/* Der kleine Punkt an der Zeitachse */
.timeline-item::before {
  content: "";
  position: absolute;
  left: -21px; /* zentriert auf der Border */
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: var(--accent);
  border: 2px solid var(--surface);
}

.timeline-date {
  font-size: 0.85rem;
  font-weight: bold;
  color: var(--accent);
  margin-bottom: 4px;
}

.timeline-content {
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
}

.timeline-content p {
  margin: 0 0 6px 0;
  font-size: 0.9rem;
}

.timeline-photo img {
  max-width: 100%;
  border-radius: 8px;
  margin-top: 8px;
  border: 1px solid var(--border);
}

.timeline-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
/* Deals */

.deals-terms {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 4px;
}

.deals-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 4px 4px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: bold;
  font-size: 0.85rem;
}

.deals-chip-remove {
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.deals-chip-remove:hover {
  background: var(--surface);
}

.deals-term {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.deals-term > summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
}

.deals-term > summary::-webkit-details-marker {
  display: none;
}

.deals-term > summary::before {
  content: "▸";
  color: var(--muted);
  transition: transform 0.15s;
}

.deals-term[open] > summary::before {
  transform: rotate(90deg);
}

.deals-term[open] > summary {
  border-bottom: 1px solid var(--border);
}

.deals-term-name {
  font-size: 1.05rem;
}

.deals-term-stats {
  color: var(--muted);
  font-size: 0.9rem;
}

.deals-new-badge {
  padding: 1px 7px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: bold;
}

.deals-term-filter {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.8rem;
}

.deals-term-content {
  padding: 12px 14px 14px;
}

.deals-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--background);
  font-size: 0.85rem;
}

.deals-filter-label {
  color: var(--muted);
  font-weight: bold;
}

.deals-filter label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.deals-filter input {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 8px;
  background: var(--surface);
  color: var(--text);
}

.deals-filter-price {
  width: 90px;
}

.deals-filter-words {
  width: 180px;
}

.deals-filter .button {
  padding: 6px 12px;
}

.deals-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.deals-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
  font-weight: bold;
}

.deals-column-header a {
  color: var(--text);
}

.deal-list {
  display: flex;
  flex-direction: column;
}

.deal-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  color: inherit;
  text-decoration: none;
}

.deal-item:last-child {
  border-bottom: 0;
}

.deal-item:hover .deal-title {
  color: var(--accent);
}

.deal-item.is-new {
  border-left: 3px solid var(--accent);
  padding-left: 7px;
}

.deal-item.is-new .deal-title::before {
  content: "Neu";
  margin-right: 6px;
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: bold;
}

.deal-item.is-filtered {
  opacity: 0.5;
}

.deal-image {
  flex: 0 0 56px;
  height: 42px;
  overflow: hidden;
  border-radius: 6px;
  background: var(--background);
}

.deal-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.deal-body {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  gap: 1px;
}

.deal-title {
  overflow: hidden;
  font-size: 0.9rem;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.deal-meta {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.75rem;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.deal-price {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  flex: 0 0 auto;
  color: var(--success);
  font-weight: bold;
  font-size: 0.9rem;
  white-space: nowrap;
}

.deals-hot {
  color: var(--danger);
  font-size: 0.75rem;
}

.deals-cold {
  color: var(--accent);
  font-size: 0.75rem;
}

.deals-hidden-toggle {
  margin-top: 6px;
  padding: 4px 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 0.8rem;
  cursor: pointer;
}

.deals-hidden-toggle:hover {
  color: var(--accent);
}

@media (max-width: 800px) {
  .deals-columns {
    grid-template-columns: minmax(0, 1fr);
  }

  .deals-term-filter {
    margin-left: 0;
    flex-basis: 100%;
  }
}

/* Laufen (Strava) in der Workout-Karte */

.running-section {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.running-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.running-header strong {
  margin-right: auto;
}

.running-dots {
  display: inline-flex;
  gap: 4px;
}

.running-dot {
  width: 10px;
  height: 10px;
  border: 2px solid var(--success);
  border-radius: 50%;
}

.running-dot.is-done {
  background: var(--success);
}

.running-list {
  display: flex;
  flex-direction: column;
}

.running-item {
  display: grid;
  grid-template-columns: 90px 70px minmax(0, 1fr);
  align-items: baseline;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
  color: inherit;
  font-size: 0.9rem;
  text-decoration: none;
}

.running-item:last-child {
  border-bottom: 0;
}

.running-item:hover strong {
  color: var(--accent);
}

.running-day {
  color: var(--muted);
}

.running-note {
  margin: 8px 0 0;
  font-size: 0.85rem;
}

.running-connect {
  display: inline-block;
  margin-top: 8px;
  text-decoration: none;
}

.exercise-guide-link {
  align-self: flex-start;
  margin-top: 2px;
  color: var(--accent);
  font-size: 0.8rem;
  text-decoration: none;
}

.exercise-guide-link:hover {
  text-decoration: underline;
}
