:root {
  color-scheme: light dark;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

body {
  margin: 0;
  background: #f5f6f8;
  color: #1a1a1a;
}

header {
  padding: 1.25rem 2rem;
  background: #1f2933;
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

header h1 {
  margin: 0;
  font-size: 1.25rem;
}

.tabs {
  display: flex;
  gap: 0.5rem;
}

.tab-btn {
  background: transparent;
  color: #cbd2d9;
  border: 1px solid #3e4c59;
}

.tab-btn:hover {
  background: #323f4b;
  color: white;
}

.tab-btn.active {
  background: #2563eb;
  color: white;
  border-color: #2563eb;
}

main {
  padding: 1.5rem 2rem;
  max-width: 900px;
  margin: 0 auto;
}

.panel {
  background: white;
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.search-row {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

button {
  cursor: pointer;
  border: none;
  border-radius: 6px;
  padding: 0.5rem 1rem;
  font-size: 0.95rem;
  background: #2563eb;
  color: white;
}

button:hover {
  background: #1d4ed8;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border-radius: 6px;
  background: #e5e7eb;
  color: #374151;
  flex-shrink: 0;
}

.icon-btn:hover {
  background: #d1d5db;
}

.icon-btn svg {
  width: 1rem;
  height: 1rem;
  fill: currentColor;
}

.icon-btn.primary {
  background: #2563eb;
  color: white;
}

.icon-btn.primary:hover {
  background: #1d4ed8;
}

.icon-btn.danger {
  background: #fee2e2;
  color: #b91c1c;
}

.icon-btn.danger:hover {
  background: #fecaca;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  text-align: left;
  padding: 0.6rem 0.5rem;
  border-bottom: 1px solid #eee;
}

th {
  font-size: 0.8rem;
  text-transform: uppercase;
  color: #6b7280;
}

.row-actions {
  display: flex;
  gap: 0.5rem;
}

dialog {
  border: none;
  border-radius: 10px;
  padding: 0;
  width: min(560px, 92vw);
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.4);
}

#feed-form {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  max-height: 85vh;
  overflow-y: auto;
}

#feed-form h2 {
  margin: 0 0 0.25rem 0;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.9rem;
  color: #374151;
}

input, textarea, select {
  font-family: inherit;
  font-size: 0.95rem;
  padding: 0.5rem 0.6rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: white;
}

.hint {
  margin: 0;
  font-size: 0.8rem;
  color: #6b7280;
}

.task-area-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.task-area-label {
  font-size: 0.9rem;
  color: #374151;
}

.tag-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: #eef2ff;
  color: #3730a3;
  border-radius: 999px;
  padding: 0.25rem 0.4rem 0.25rem 0.7rem;
  font-size: 0.85rem;
}

.tag-chip button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1rem;
  height: 1.1rem;
  padding: 0;
  border-radius: 50%;
  background: transparent;
  color: #3730a3;
}

.tag-chip button:hover {
  background: #c7d2fe;
}

.tag-chip button svg {
  width: 0.6rem;
  height: 0.6rem;
  fill: currentColor;
}

.tag-input-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.tag-input-row input {
  flex: 1;
}

.field-error {
  color: #dc2626;
  font-size: 0.8rem;
  min-height: 1em;
}

.form-error {
  color: #dc2626;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 0.5rem;
}

/* --- Stream / Todos --- */

.stream-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.view-toggle {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
}

.stream-toolbar .view-toggle {
  margin-bottom: 0;
}

.toggle-btn {
  background: #f1f5f9;
  color: #374151;
  border: 1px solid #e5e7eb;
}

.toggle-btn:hover {
  background: #e5e7eb;
}

.toggle-btn.active {
  background: #2563eb;
  color: white;
  border-color: #2563eb;
}

.category-filter {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: #6b7280;
}

.category-filter select {
  padding: 0.35rem 0.5rem;
}

.cluster-group {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 1.25rem;
}

.cluster-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.8rem;
}

.cluster-group-header h3 {
  margin: 0;
  font-size: 0.85rem;
  color: #6b7280;
  font-weight: 600;
  text-transform: uppercase;
}

.cluster-group-read-btn {
  background: transparent;
  color: #2563eb;
  border: 1px solid #c7d2fe;
  padding: 0.3rem 0.7rem;
  font-size: 0.78rem;
  border-radius: 999px;
  flex-shrink: 0;
}

.cluster-group-read-btn:hover {
  background: #eef2ff;
}

.load-more-btn {
  display: block;
  margin: 0.75rem auto;
  background: transparent;
  color: #2563eb;
  border: 1px solid #c7d2fe;
  padding: 0.4rem 1rem;
  border-radius: 999px;
  font-size: 0.85rem;
}

.load-more-btn:hover {
  background: #eef2ff;
}

.article-card {
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
  width: 100%;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 0.5rem;
  margin-bottom: 0.6rem;
}

.article-card.is-todo {
  border-left: 3px solid #f59e0b;
}

.article-card.is-done {
  opacity: 0.6;
}

.article-card-main {
  display: block;
  flex: 1;
  min-width: 0;
  text-align: left;
  background: transparent;
  padding: 0.4rem 0.5rem;
  color: #1a1a1a;
  border-radius: 6px;
}

.article-card-main:hover {
  background: #f1f5f9;
}

.article-card-read-btn {
  align-self: center;
}

.article-card-title {
  display: block;
  font-weight: 600;
  margin-bottom: 0.3rem;
}

.article-card-excerpt {
  display: block;
  font-size: 0.88rem;
  color: #4b5563;
  margin-bottom: 0.5rem;
}

.article-card-meta {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  font-size: 0.78rem;
  color: #6b7280;
}

.article-card-meta .category-tag {
  background: #eef2ff;
  color: #3730a3;
  border-radius: 999px;
  padding: 0.1rem 0.55rem;
}

.article-card-feed {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.feed-color-dot {
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  flex-shrink: 0;
}

.color-field input[type="color"],
input[type="color"] {
  width: 3.5rem;
  height: 2.2rem;
  padding: 0.2rem;
  cursor: pointer;
}

#user-table input[type="color"] {
  width: 2.4rem;
  height: 1.8rem;
}

.color-swatch {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

#stream-empty-state, #todos-empty-state, #archive-empty-state, #feed-empty-state, #category-empty-state {
  color: #6b7280;
  text-align: center;
  padding: 1rem 0;
}

/* --- Kanban-Board --- */

.kanban-board {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.kanban-column {
  background: #f9fafb;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  padding: 0.9rem;
  min-height: 200px;
  transition: border-color 0.15s, background 0.15s;
}

.kanban-column.drag-over {
  border-color: #2563eb;
  background: #eef2ff;
}

.kanban-column h3 {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  color: #6b7280;
  font-weight: 600;
  text-transform: uppercase;
}

.kanban-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  min-height: 80px;
}

.kanban-tile {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 0.7rem 0.8rem;
  cursor: grab;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.kanban-tile:hover {
  border-color: #c7d2fe;
}

.kanban-tile.dragging {
  opacity: 0.4;
}

.kanban-tile .article-card-title {
  margin: 0;
  font-size: 0.9rem;
}

@media (max-width: 640px) {
  .kanban-board {
    grid-template-columns: 1fr;
  }
}

/* --- Artikel-Detail --- */

#article-detail {
  padding: 1.5rem;
  max-height: 85vh;
  overflow-y: auto;
}

.article-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.article-detail-header h2 {
  margin: 0;
}

.article-content {
  font-size: 0.95rem;
  line-height: 1.6;
  color: #1f2933;
  margin-bottom: 1.25rem;
}

.article-content img {
  max-width: 100%;
}

.article-meta-block {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  border-top: 1px solid #e5e7eb;
  padding-top: 1rem;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  color: #6b7280;
}

.article-meta-block a {
  color: #2563eb;
}

.article-todo-actions {
  display: flex;
  gap: 0.6rem;
}

/* --- Login --- */

.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.login-card {
  background: white;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  padding: 2rem;
  width: min(360px, 90vw);
}

.login-card h1 {
  margin: 0 0 1.25rem;
  font-size: 1.25rem;
  text-align: center;
}

.login-card form {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

/* --- Header-Nutzerbereich --- */

.header-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: #cbd2d9;
  font-size: 0.85rem;
}

.header-user button {
  background: transparent;
  border: 1px solid #3e4c59;
  color: #cbd2d9;
  padding: 0.4rem 0.8rem;
  font-size: 0.82rem;
}

.header-user button:hover {
  background: #323f4b;
  color: white;
}

.header-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.todo-owner-tag {
  display: inline-block;
  background: #f3f4f6;
  color: #374151;
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
  font-size: 0.72rem;
}

.kanban-tile.foreign {
  cursor: default;
  opacity: 0.75;
}

.hidden-feed-row {
  opacity: 0.55;
}

.new-user-admin-check {
  flex-direction: row;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
  font-size: 0.85rem;
}
