:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --text: #1f2937;
  --muted: #4b5563;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --border: #e5e7eb;
  --error: #dc2626;
  --error-bg: #fef2f2;
  --success: #16a34a;
  --success-bg: #f0fdf4;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
  --radius: 8px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-inner {
  max-width: 100%;
  margin: 0 auto;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  color: var(--text);
}

.logo img { height: 40px; width: auto; display: block; }

.nav { display: none; align-items: center; gap: 1rem; }

.nav a, .nav button {
  font-size: 0.95rem;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.4rem 0.6rem;
}

.nav a:hover, .nav button:hover { color: var(--accent); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: none;
  border-radius: var(--radius);
  padding: 0.65rem 1rem;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }

.btn-secondary { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover:not(:disabled) { background: #f1f5f9; }

.btn-danger { background: var(--error-bg); color: var(--error); border: 1px solid #fecaca; }
.btn-danger:hover:not(:disabled) { background: #fee2e2; }

.btn-block { width: 100%; }

.menu-toggle {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--muted);
  cursor: pointer;
}

.nav.open { display: flex; flex-direction: column; position: absolute; top: 100%; right: 0; left: 0; background: var(--surface); border-bottom: 1px solid var(--border); padding: 0.75rem 1rem; gap: 0.5rem; }

main { flex: 1; padding: 1.5rem 1rem; }

.container {
  width: 100%;
  max-width: 28rem;
  margin: 0 auto;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
}

.card h1, .card h2 { margin: 0 0 0.25rem; font-size: 1.4rem; }

.subtitle { color: var(--muted); margin: 0 0 1.25rem; }

.form-group { margin-bottom: 1rem; }

label {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 0.35rem;
}

input[type="email"], input[type="password"], input[type="text"], textarea {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
  color: var(--text);
  background: var(--surface);
}

input:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,0.12); }

textarea { resize: vertical; min-height: 6rem; }

.help-text { font-size: 0.8rem; color: var(--muted); margin-top: 0.25rem; }

.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.95rem;
  margin-bottom: 1rem;
  display: none;
}

.alert.visible { display: block; }

.alert-error { background: var(--error-bg); color: var(--error); border: 1px solid #fecaca; }
.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid #bbf7d0; }

.spinner {
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.switch-link { text-align: center; margin-top: 1rem; font-size: 0.95rem; }

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

.dashboard-header h1 { margin: 0; font-size: 1.35rem; }

.notes-list { display: flex; flex-direction: column; gap: 0.75rem; }

.note {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem;
}

.note-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.note-title { margin: 0; font-size: 1.05rem; font-weight: 600; }

.note-date { font-size: 0.8rem; color: var(--muted); margin-top: 0.15rem; }

.note-preview { margin: 0.5rem 0 0; color: var(--muted); font-size: 0.95rem; line-height: 1.4; }

.note-actions { display: flex; gap: 0.4rem; }

.note-actions button {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.35rem 0.5rem;
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--muted);
}

.note-actions button:hover { background: var(--bg); color: var(--text); }

.empty-state { text-align: center; padding: 2.5rem 1rem; }
.empty-state h2 { margin: 0 0 0.5rem; font-size: 1.2rem; }
.empty-state p { margin: 0 0 1rem; color: var(--muted); }

.editor {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem;
  margin-bottom: 1rem;
}

.editor-actions { display: flex; gap: 0.5rem; margin-top: 1rem; flex-wrap: wrap; }

.hidden { display: none !important; }

footer {
  text-align: center;
  padding: 1rem;
  font-size: 0.85rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
  background: var(--surface);
}

@media (min-width: 768px) {
  .header-inner { max-width: 42rem; padding: 0.75rem 1.5rem; }
  .container { max-width: 42rem; }
  .menu-toggle { display: none; }
  .nav { display: flex; flex-direction: row; position: static; border: none; padding: 0; background: transparent; }
  main { padding: 2rem 1.5rem; }
}

@media (min-width: 1024px) {
  .header-inner { max-width: 56rem; }
  .container { max-width: 56rem; }
}