:root {
  --bg: #f0f4f8;
  --surface: rgba(248, 250, 252, 0.82);
  --surface-strong: #f8fafc;
  --text: #0f172a;
  --muted: #64748b;
  --line: rgba(15, 23, 42, 0.10);
  --accent: #2563eb;
  --accent-soft: #dbeafe;
  --shadow: 0 30px 80px rgba(15, 23, 42, 0.08);
  --radius: 12px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.12), transparent 30%),
    linear-gradient(135deg, #f0f4f8 0%, #e2e8f0 55%, #cbd5e1 100%);
  color: var(--text);
  font-family: "Inter", sans-serif;
}

/* --- Navigation --- */

.top-nav {
  display: flex;
  align-items: center;
  gap: 2rem;
  width: min(1040px, calc(100vw - 2rem));
  margin: 0 auto;
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
}

.nav-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: "Inter", sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}

.nav-logo {
  width: 1.5rem;
  height: 1.5rem;
}

.nav-links {
  display: flex;
  gap: 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-links a {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
}

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

.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.08);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
  color: var(--muted);
  vertical-align: middle;
  margin-left: 0.25rem;
}

.nav-badge-green {
  background: rgba(22, 163, 74, 0.12);
  color: #15803d;
}

.nav-badge-red {
  background: rgba(220, 38, 38, 0.12);
  color: #b91c1c;
}

.nav-badge-blue {
  background: rgba(37, 99, 235, 0.12);
  color: #1d4ed8;
}

/* --- Layout --- */

.shell {
  width: min(1040px, calc(100vw - 2rem));
  margin: 0 auto;
  padding: 2rem 0 5rem;
}

h1,
h2 {
  font-family: "Inter", sans-serif;
  font-weight: 700;
}

h1 {
  margin: 0 0 1.5rem;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.1;
}

/* --- Quick-add form --- */

.quick-add {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

.quick-add input[type="text"] {
  flex: 1;
  padding: 0.65rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  font-size: 1rem;
  font-family: inherit;
  color: var(--text);
}

.quick-add input[type="text"]:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.quick-add button {
  padding: 0.65rem 1.5rem;
  border: none;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

.quick-add button:hover {
  opacity: 0.9;
}

/* --- Task list --- */

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

.task-item {
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  backdrop-filter: blur(20px);
}

.task-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.task-title {
  flex: 1;
  font-weight: 500;
}

.task-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.badge {
  padding: 0.15rem 0.55rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
}

.badge-due {
  background: var(--accent-soft);
  color: var(--accent);
}

.badge-project {
  background: rgba(15, 23, 42, 0.08);
  color: var(--muted);
}

.inline-form {
  display: inline;
}

.btn-complete {
  width: 1.7rem;
  height: 1.7rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: none;
  color: var(--muted);
  font-size: 0.85rem;
  cursor: pointer;
}

.btn-complete:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-edit {
  font-size: 0.85rem;
  color: var(--muted);
  text-decoration: none;
}

.btn-edit:hover {
  color: var(--accent);
}

.task-notes {
  margin-top: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.04);
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--muted);
}

.task-notes p {
  margin: 0.25rem 0;
}

.empty-state {
  padding: 2rem;
  text-align: center;
  color: var(--muted);
  font-size: 1.05rem;
}

/* --- Edit form --- */

.edit-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  max-width: 40rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.edit-form label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
}

.hint {
  font-weight: 400;
  font-size: 0.82rem;
}

.edit-form input[type="text"],
.edit-form input[type="date"],
.edit-form input[type="number"],
.edit-form select,
.edit-form textarea {
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text);
}

.edit-form textarea {
  resize: vertical;
  font-family: "IBM Plex Mono", monospace, "Inter", sans-serif;
  font-size: 0.9rem;
}

.edit-form input:focus,
.edit-form select:focus,
.edit-form textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.recurrence-fields {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  margin: 0;
}

.recurrence-fields legend {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  padding: 0 0.25rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 500 !important;
  color: var(--text) !important;
  margin-bottom: 0.5rem;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  padding-top: 0.5rem;
}

.btn-primary {
  padding: 0.6rem 1.8rem;
  border: none;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

.btn-primary:hover {
  opacity: 0.9;
}

.btn-secondary {
  padding: 0.6rem 1.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
  font-weight: 500;
  font-family: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.btn-secondary:hover {
  border-color: var(--muted);
}

/* --- Notes preview --- */

.notes-preview {
  margin-top: 2rem;
  max-width: 40rem;
}

.notes-preview h2 {
  font-size: 1.1rem;
  margin: 0 0 0.75rem;
  color: var(--muted);
}

.rendered-markdown {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  line-height: 1.65;
}

.rendered-markdown p {
  margin: 0.4rem 0;
}

.rendered-markdown h1,
.rendered-markdown h2,
.rendered-markdown h3 {
  margin: 0.8rem 0 0.3rem;
}

.rendered-markdown code {
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  background: rgba(15, 23, 42, 0.06);
  font-size: 0.88em;
}

.rendered-markdown pre {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.06);
  overflow-x: auto;
}

/* --- Section headings --- */

.section-heading {
  font-size: 1.15rem;
  margin: 1.75rem 0 0.75rem;
  color: var(--text);
}

.section-overdue {
  color: #dc2626;
}

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

/* --- Overdue badge --- */

.badge-overdue {
  background: #fef2f2;
  color: #dc2626;
}

.badge-recurring {
  background: transparent;
  padding: 0;
  font-size: 0.9rem;
}

.badge-count {
  background: rgba(15, 23, 42, 0.08);
  color: var(--muted);
}

/* --- Task state variants --- */

.task-overdue {
  border-left: 3px solid #dc2626;
}

.task-due-today {
  border-left: 3px solid var(--accent);
}

.task-done {
  opacity: 0.55;
}

.task-done .task-title {
  text-decoration: line-through;
}

.task-inbox {
  border-left: 3px solid #15803d;
}

/* --- Due-today badge --- */

.badge-due-today {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

/* --- Status badges --- */

.badge-status {
  font-size: 0.75rem;
  text-transform: capitalize;
}

.badge-status-inbox {
  background-color: #fef3c7;
  color: #92400e;
}

.badge-status-next_action {
  background-color: #dcfce7;
  color: #166534;
}

.badge-status-waiting_for {
  background-color: #fef2f2;
  color: #991b1b;
}

.badge-status-scheduled {
  background-color: var(--accent-soft);
  color: var(--accent);
}

.badge-status-someday_maybe {
  background-color: rgba(15, 23, 42, 0.06);
  color: var(--muted);
}

.badge-status-done {
  background-color: rgba(15, 23, 42, 0.06);
  color: var(--muted);
}

/* --- Inline quick-update selectors --- */

.inline-selector {
  display: inline-flex;
  align-items: center;
}

.inline-select {
  padding: 0.12rem 0.4rem;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5'%3E%3Cpath d='M0 0l4 5 4-5z' fill='%2364748b'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.35rem center;
  padding-right: 1.2rem;
}

.inline-select:hover {
  border-color: var(--line);
}

.inline-select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.inline-status {
  text-transform: capitalize;
}

.inline-project {
  background-color: rgba(15, 23, 42, 0.06);
  color: var(--muted);
}

.inline-date {
  padding: 0.1rem 0.35rem;
  border: 1px solid transparent;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 500;
  font-family: "Inter", sans-serif !important;
  cursor: pointer;
  -webkit-appearance: textfield;
  appearance: textfield;
}

/* Re-show the calendar picker icon after resetting appearance */
.inline-date::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.6;
}

.inline-date::-webkit-datetime-edit,
.inline-date::-webkit-datetime-edit-fields-wrapper,
.inline-date::-webkit-datetime-edit-text,
.inline-date::-webkit-datetime-edit-month-field,
.inline-date::-webkit-datetime-edit-day-field,
.inline-date::-webkit-datetime-edit-year-field {
  font-family: "Inter", sans-serif !important;
}

.inline-date:hover {
  border-color: var(--line);
}

.inline-date:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* Empty date input placeholder styling */
.inline-date:not([value]),
.inline-date[value=""] {
  color: var(--muted);
  background: rgba(15, 23, 42, 0.04);
}

/* --- Filter disclosure (collapsible filter bar) --- */

.filter-disclosure {
  margin-bottom: 2rem;
}

.filter-disclosure summary {
  cursor: pointer;
  color: var(--muted);
  padding: 0.4rem 0;
  user-select: none;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.filter-disclosure summary::-webkit-details-marker {
  display: none;
}

.icon-filter {
  width: 1.3rem;
  height: 1.3rem;
  stroke-width: 2.5;
}

.filter-disclosure summary:hover {
  color: var(--text);
}

.filter-disclosure .filter-bar {
  margin-top: 0.75rem;
}

/* --- Filter bar --- */

.filter-bar {
  margin-bottom: 2rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
  min-width: 140px;
}

.filter-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}

.filter-group input,
.filter-group select {
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text);
}

.filter-group input:focus,
.filter-group select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

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

.btn-sm {
  padding: 0.4rem 1rem;
  font-size: 0.9rem;
}

/* --- Project list --- */

.project-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.project-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  backdrop-filter: blur(20px);
}

.project-link {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  text-decoration: none;
  color: var(--text);
}

.project-link:hover .project-name {
  color: var(--accent);
}

.project-name {
  font-weight: 600;
  font-size: 1.05rem;
}

.project-desc {
  font-size: 0.88rem;
  color: var(--muted);
}

.project-meta {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.project-description {
  color: var(--muted);
  margin: -0.75rem 0 1.5rem;
}

/* --- Project notes & due date --- */

.project-due-date {
  font-size: 0.95rem;
  color: var(--muted);
  margin: -0.75rem 0 1rem;
}

.project-due-date-overdue {
  color: #dc2626;
  font-weight: 600;
}

.project-notes {
  margin-bottom: 1.5rem;
}

.project-notes .rendered-markdown {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  line-height: 1.65;
}

.btn-primary:disabled,
.btn-primary.btn-disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* --- Project completion --- */

.project-heading {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.project-heading h1 {
  margin-bottom: 0;
}

.btn-complete-project {
  padding: 0.45rem 1.2rem;
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  background: none;
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
}

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

.btn-complete-project.btn-disabled {
  border-color: var(--line);
  color: var(--muted);
  opacity: 0.5;
  cursor: not-allowed;
}

.badge-completed {
  background: #dcfce7;
  color: #166534;
  font-weight: 600;
}

.project-completed {
  opacity: 0.6;
}

/* --- Legacy hero (index.html) --- */

.hero {
  display: grid;
  gap: 1.5rem;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.lede {
  width: min(42rem, 100%);
  margin: 0;
  font-size: 1.12rem;
  line-height: 1.7;
  color: var(--muted);
}

.panel-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
}

.panel {
  padding: 1.5rem;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
}

.panel.accent {
  background: linear-gradient(180deg, var(--surface-strong), var(--accent-soft));
}

.panel h2 {
  margin-top: 0;
  margin-bottom: 0.75rem;
  font-size: 1.4rem;
}

.panel ul {
  margin: 0;
  padding-left: 1.1rem;
  line-height: 1.7;
}

.meta {
  padding-top: 0.5rem;
  color: var(--muted);
  font-size: 0.95rem;
}

@media (max-width: 720px) {
  .shell,
  .top-nav {
    width: min(100vw - 1.25rem, 100%);
  }

  .shell {
    padding: 1.5rem 0 3rem;
  }

  .form-row,
  .panel-grid {
    grid-template-columns: 1fr;
  }

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

  .task-meta {
    flex-wrap: wrap;
    width: 100%;
    margin-top: 0.35rem;
  }
}

/* --- Auth Pages --- */

.auth-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
}

.auth-card {
  width: min(440px, 100%);
  padding: 3rem 2.5rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  backdrop-filter: blur(24px);
  box-shadow:
    0 0 0 1px rgba(15, 23, 42, 0.04),
    0 8px 40px rgba(15, 23, 42, 0.08),
    0 30px 80px rgba(15, 23, 42, 0.06);
  text-align: center;
}

.auth-logo {
  margin-bottom: 1.5rem;
}

.auth-logo img {
  width: 48px;
  height: 48px;
  filter: drop-shadow(0 2px 8px rgba(37, 99, 235, 0.25));
}

.auth-title {
  margin: 0 0 0.5rem;
  font-size: 1.6rem;
  letter-spacing: -0.02em;
}

.auth-subtitle {
  margin: 0 0 2rem;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.auth-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.85rem 1.5rem;
  border: none;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

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

.auth-btn:active {
  transform: scale(0.98);
}

.auth-btn-icon {
  flex-shrink: 0;
}

.auth-status {
  margin-top: 1.25rem;
  font-size: 0.875rem;
  color: var(--muted);
  min-height: 1.4em;
}

.auth-status-error {
  color: #b91c1c;
}

/* Nav logout */

.nav-spacer {
  flex: 1;
}

.nav-logout-btn {
  padding: 0.35rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.nav-logout-btn:hover {
  color: var(--text);
  border-color: var(--text);
}

/* --- Settings / Gear Icon --- */

.nav-settings-link {
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  transition: color 0.15s;
}

.nav-settings-link:hover {
  color: var(--text);
}

.page-settings {
  max-width: 700px;
}

.settings-info-banner {
  background: var(--accent-soft);
  color: var(--text);
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}

.settings-description {
  color: var(--muted);
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
}

.settings-error {
  background: #fef2f2;
  color: #b91c1c;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.settings-new-key {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  padding: 1rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
}

.new-key-display {
  display: flex;
  gap: 0.5rem;
  margin: 0.5rem 0;
}

.new-key-input {
  flex: 1;
  font-family: monospace;
  font-size: 0.85rem;
  padding: 0.5rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.new-key-warning {
  color: #b91c1c;
  font-size: 0.85rem;
  font-weight: 500;
  margin: 0.5rem 0 0;
}

.settings-create-form {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.settings-create-form input[type="text"] {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 0.9rem;
  font-family: inherit;
}

.settings-key-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.settings-key-table th,
.settings-key-table td {
  text-align: left;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--line);
}

.settings-key-table th {
  font-weight: 600;
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
}

/* --- Nav icon buttons --- */

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  flex-wrap: nowrap;
}

.nav-actions form {
  display: contents;
}

.nav-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s;
  text-decoration: none;
  font-family: inherit;
  font-size: inherit;
  line-height: 1;
}

.nav-icon-btn:hover {
  color: var(--text);
}

/* Theme toggle icons */
.icon-sun { display: none; }
.icon-moon { display: block; }

[data-theme="dark"] .icon-sun { display: block; }
[data-theme="dark"] .icon-moon { display: none; }

/* --- Dark Mode --- */

[data-theme="dark"] {
  --bg: #0f172a;
  --surface: rgba(30, 41, 59, 0.82);
  --surface-strong: #1e293b;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --line: rgba(248, 250, 252, 0.10);
  --accent: #3b82f6;
  --accent-soft: rgba(59, 130, 246, 0.15);
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.3);
  color-scheme: dark;
}

[data-theme="dark"] body {
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.08), transparent 30%),
    linear-gradient(135deg, #0f172a 0%, #1e293b 55%, #0f172a 100%);
}

/* Nav badges */
[data-theme="dark"] .nav-badge {
  background: rgba(248, 250, 252, 0.08);
}

[data-theme="dark"] .nav-badge-green {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
}

[data-theme="dark"] .nav-badge-red {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

[data-theme="dark"] .nav-badge-blue {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
}

/* Status badges */
[data-theme="dark"] .badge-overdue {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

[data-theme="dark"] .badge-status-inbox {
  background-color: rgba(251, 191, 36, 0.15);
  color: #fbbf24;
}

[data-theme="dark"] .badge-status-next_action {
  background-color: rgba(34, 197, 94, 0.15);
  color: #4ade80;
}

[data-theme="dark"] .badge-status-waiting_for {
  background-color: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

[data-theme="dark"] .badge-status-scheduled {
  background-color: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
}

[data-theme="dark"] .badge-status-someday_maybe {
  background-color: rgba(248, 250, 252, 0.06);
  color: var(--muted);
}

[data-theme="dark"] .badge-status-done {
  background-color: rgba(248, 250, 252, 0.06);
  color: var(--muted);
}

[data-theme="dark"] .badge-completed {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
}

/* Section headings */
[data-theme="dark"] .section-overdue {
  color: #f87171;
}

/* Task borders */
[data-theme="dark"] .task-overdue {
  border-left-color: #f87171;
}

[data-theme="dark"] .task-inbox {
  border-left-color: #4ade80;
}

/* Code & notes */
[data-theme="dark"] .rendered-markdown code {
  background: rgba(248, 250, 252, 0.08);
}

[data-theme="dark"] .rendered-markdown pre {
  background: rgba(248, 250, 252, 0.06);
}

[data-theme="dark"] .task-notes {
  background: rgba(248, 250, 252, 0.04);
}

/* Inline selectors */
[data-theme="dark"] .inline-select {
  background-color: var(--surface-strong);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5'%3E%3Cpath d='M0 0l4 5 4-5z' fill='%2394a3b8'/%3E%3C/svg%3E");
}

[data-theme="dark"] .inline-date {
  background: var(--accent-soft);
  color: var(--accent);
}

[data-theme="dark"] select.inline-select option {
  background: var(--surface-strong);
  color: var(--text);
}

[data-theme="dark"] .inline-project {
  background-color: rgba(248, 250, 252, 0.06);
}

[data-theme="dark"] .inline-date:not([value]),
[data-theme="dark"] .inline-date[value=""] {
  background: rgba(248, 250, 252, 0.04);
}

/* Settings page */
[data-theme="dark"] .settings-info-banner {
  background: rgba(59, 130, 246, 0.15);
}

[data-theme="dark"] .settings-error {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

[data-theme="dark"] .settings-new-key {
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.2);
}

[data-theme="dark"] .new-key-warning {
  color: #f87171;
}

/* Auth card */
[data-theme="dark"] .auth-card {
  box-shadow:
    0 0 0 1px rgba(248, 250, 252, 0.04),
    0 8px 40px rgba(0, 0, 0, 0.3),
    0 30px 80px rgba(0, 0, 0, 0.25);
}

[data-theme="dark"] .auth-btn {
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

[data-theme="dark"] .auth-status-error {
  color: #f87171;
}

[data-theme="dark"] .project-due-date-overdue {
  color: #f87171;
}

/* Auth logo */
[data-theme="dark"] .auth-logo img {
  filter: drop-shadow(0 2px 8px rgba(59, 130, 246, 0.4)) brightness(1.1);
}