:root {
  --bg: #f6f7f9;
  --sidebar-bg: #191b20;
  --sidebar-text: #a6a9b4;
  --accent: #12b886;
  --accent-soft: #e6f9f2;
  --card: #ffffff;
  --border: #e7e8ec;
  --text: #1f2228;
  --text-muted: #868a94;
  --radius: 10px;
}

* { box-sizing: border-box; }

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

button { font-family: inherit; }

/* ---------- Login / Registrierung ---------- */

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

.auth-card {
  width: 340px;
  background: var(--card);
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(20, 20, 30, 0.08);
  padding: 30px 28px;
}

.auth-card .brand {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.auth-tabs {
  display: flex;
  background: var(--bg);
  border-radius: 9px;
  padding: 3px;
  margin-bottom: 18px;
}

.auth-tab {
  flex: 1;
  border: none;
  background: none;
  padding: 8px;
  border-radius: 7px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text-muted);
}
.auth-tab.active {
  background: #fff;
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

#authForm label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin: 12px 0 5px;
}

#authForm input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 9px 11px;
  font-size: 13.5px;
  font-family: inherit;
}
#authForm input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

.hint { font-size: 11px; color: #9aa; margin-top: 5px; }

.error-box {
  display: none;
  margin-top: 12px;
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 12px;
}

.primary-btn {
  width: 100%;
  margin-top: 18px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 9px;
  padding: 10px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}
.primary-btn:disabled { opacity: 0.6; cursor: default; }

/* ---------- App-Shell ---------- */

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

.sidebar {
  width: 208px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
}

.sidebar-top { padding: 20px 18px 12px; }
.sidebar .brand { color: #fff; font-weight: 600; font-size: 14.5px; display: flex; align-items: center; gap: 8px; }

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; padding: 8px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  color: var(--sidebar-text);
  text-align: left;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  cursor: pointer;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.06); }
.nav-item.active { background: var(--accent); color: #fff; }

.sidebar-bottom {
  margin-top: auto;
  padding: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.user-chip { font-size: 11.5px; color: #7d818c; padding: 4px 12px 8px; }

/* ---------- Notizliste ---------- */

.note-list-pane {
  width: 290px;
  flex-shrink: 0;
  background: var(--card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 14px 10px;
}
.pane-header h2 { font-size: 15px; margin: 0; font-weight: 600; }

.icon-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: none;
  background: var(--bg);
  cursor: pointer;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.icon-btn:hover { filter: brightness(0.95); }
.icon-btn.primary { background: var(--accent); color: #fff; }
.icon-btn.danger:hover { background: #fee2e2; }

.note-list { flex: 1; overflow-y: auto; padding: 6px; }

.note-card {
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  margin-bottom: 2px;
}
.note-card:hover { background: var(--bg); }
.note-card.selected { background: var(--accent-soft); }
.note-card .nc-title {
  font-weight: 600;
  font-size: 13.5px;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.note-card .nc-preview {
  font-size: 12.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.note-card .nc-date { font-size: 10.5px; color: #b0b3ba; margin-top: 3px; }
.empty-hint { padding: 14px; font-size: 12.5px; color: var(--text-muted); }

/* ---------- Editor ---------- */

.editor-pane { flex: 1; display: flex; flex-direction: column; background: var(--card); min-width: 0; }

.empty-state {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 13.5px;
  text-align: center;
  padding: 20px;
}

.editor-fields { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.hidden { display: none !important; }

.editor-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--border);
}
.title-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 19px;
  font-weight: 600;
  font-family: inherit;
  min-width: 0;
}
.editor-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.save-status { font-size: 11px; color: var(--text-muted); margin-right: 6px; white-space: nowrap; }

.content-area {
  flex: 1;
  min-height: 0;
  border: none;
  outline: none;
  resize: none;
  padding: 20px 22px;
  font-family: inherit;
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--text);
}

.image-strip {
  display: flex;
  gap: 8px;
  padding: 10px 22px;
  border-top: 1px solid var(--border);
  overflow-x: auto;
  align-items: center;
  min-height: 46px;
}
.image-thumb {
  width: 50px;
  height: 50px;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.reminder-banner {
  display: none;
  background: #fff7e6;
  color: #92640a;
  padding: 8px 22px;
  font-size: 12.5px;
  border-top: 1px solid #ffe8b3;
}
.reminder-banner.visible { display: block; }

/* ---------- Dialoge ---------- */

dialog.modal {
  border: none;
  border-radius: 14px;
  padding: 0;
  box-shadow: 0 20px 60px rgba(10, 10, 20, 0.25);
}
dialog.modal::backdrop { background: rgba(15, 17, 23, 0.45); }

.modal-header {
  padding: 16px 20px;
  font-weight: 600;
  font-size: 15px;
  border-bottom: 1px solid var(--border);
}

.modal-body { padding: 18px 20px; min-width: 300px; }
.modal-body label { display: block; font-size: 12px; color: var(--text-muted); margin: 10px 0 4px; }
.modal-body label:first-child { margin-top: 0; }
.modal-body input[type="text"],
.modal-body input[type="datetime-local"] {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 13.5px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
}

.btn {
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
  background: var(--bg);
}
.btn.primary { background: var(--accent); color: #fff; }
.btn.subtle { background: none; color: var(--text-muted); }

.reminder-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.reminder-row:last-child { border-bottom: none; }
.reminder-due { color: #b91c1c; font-weight: 600; }

#imageViewImg { max-width: 70vw; max-height: 60vh; display: block; border-radius: 8px; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #d8dade; border-radius: 6px; }
