:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --border: #e2e4e9;
  --text: #1f2430;
  --text-muted: #6b7280;
  --accent: #1e3a5f;
  --accent-soft: #e8eef5;
  --danger: #c0392b;
  --radius: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 280px;
  flex-shrink: 0;
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
}

.logo {
  display: block;
  width: 100%;
  max-width: 220px;
  height: auto;
  margin: 0 0 10px;
}

.subtitle {
  margin: 0 0 20px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.project-form {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.project-form input[type="text"] {
  flex: 1;
  min-width: 200px;
}

input, select, button {
  font: inherit;
}

input[type="text"], input[type="date"], select {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
}

button {
  padding: 8px 12px;
  border: none;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

button:hover { opacity: 0.9; }

.main-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
}

.nav-item {
  background: transparent;
  color: var(--text);
  text-align: left;
  border: 1px solid transparent;
  padding: 10px 12px;
  border-radius: var(--radius);
  font-weight: 700;
}

.nav-item.active, .nav-item:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.nav-group-label {
  margin: 12px 0 2px;
  padding: 0 12px;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.nav-subitem {
  padding-left: 24px;
  font-weight: 500;
  font-size: 0.92rem;
}

.view[hidden] {
  display: none;
}

.project-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.project-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.project-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.project-name {
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-description {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.85rem;
  min-height: 1.2em;
}

.project-due {
  margin: 0;
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 600;
}

.project-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.project-status-select {
  padding: 4px 6px;
  font-size: 0.8rem;
}

.link-button-inline {
  background: transparent;
  color: var(--accent);
  padding: 4px 0;
  border: none;
  text-decoration: underline;
  cursor: pointer;
  font-size: 0.8rem;
}

.icon-button {
  background: transparent;
  color: var(--text-muted);
  padding: 2px 6px;
  line-height: 1;
}

.icon-button:hover { color: var(--danger); }

.main {
  flex: 1;
  padding: 24px 32px;
  min-width: 0;
}

.main-header h2 {
  margin: 0;
}

.main-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

#task-project-filter {
  min-width: 200px;
}

.meta {
  margin: 4px 0 20px;
  color: var(--text-muted);
}

.task-form {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.task-form input[type="text"] {
  flex: 1;
  min-width: 200px;
}

.error-banner {
  background: #fdecea;
  color: var(--danger);
  border: 1px solid #f5c6c0;
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 16px;
}

.task-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.task-column {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  min-height: 200px;
}

.task-column h3 {
  margin: 0 0 10px;
  font-size: 0.9rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.task-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.task-item {
  border: 1px solid var(--border);
  border-left: 4px solid var(--text-muted);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: #fff;
}

.task-item.priority-high { border-left-color: var(--danger); }
.task-item.priority-normal { border-left-color: var(--accent); }
.task-item.priority-low { border-left-color: #9aa5b1; }

.task-title {
  font-weight: 600;
  margin-bottom: 4px;
}

.task-sub {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.task-project {
  background: var(--accent-soft);
  color: var(--accent);
  padding: 1px 6px;
  border-radius: 999px;
}

.badge {
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 0.75rem;
}

.badge-manual { background: #eef0f2; color: var(--text-muted); }
.badge-outlook { background: #e3f0fd; color: #0f5ea8; }
.badge-consilio { background: #eee6f8; color: #6b3fa0; }
.badge-onenote { background: #f8e6f3; color: #a1218b; }
.badge-task-marker { background: #fdf0d5; color: #a0621b; }

.task-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.status-select {
  padding: 4px 6px;
  font-size: 0.8rem;
}

.note-form {
  margin-bottom: 20px;
}

.note-form textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 1rem;
  resize: vertical;
}

.note-form-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.note-task-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.note-task-toggle input {
  width: auto;
}

.note-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.note-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: #fff;
}

.note-content {
  margin: 0 0 8px;
  white-space: pre-wrap;
}

.note-item-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.note-item-footer .mark-due-input {
  padding: 4px 6px;
  font-size: 0.8rem;
}

@media (max-width: 800px) {
  .app { flex-direction: column; }
  .sidebar { width: auto; border-right: none; border-bottom: 1px solid var(--border); padding: 16px; }
  .main { padding: 16px; }
  .task-columns { grid-template-columns: 1fr; }
  .main-header-top { flex-direction: column; align-items: stretch; }
  #task-project-filter { min-width: 0; width: 100%; }
  .project-grid { grid-template-columns: 1fr; }

  /* Grosszuegigere Tastziele auf Touch-Geraeten */
  button, .nav-item, input[type="text"], input[type="date"], select, textarea {
    min-height: 44px;
  }
  .icon-button { min-height: 32px; min-width: 32px; }
  .link-button-inline { min-height: 32px; }
}
