/* ============================================================
   DoThisWeek — Solarized Theme
   ============================================================ */

/* --- Solarized palette --- */
:root {
  --sol-base03:  #002b36;
  --sol-base02:  #073642;
  --sol-base01:  #586e75;
  --sol-base00:  #657b83;
  --sol-base0:   #839496;
  --sol-base1:   #93a1a1;
  --sol-base2:   #eee8d5;
  --sol-base3:   #fdf6e3;
  --sol-yellow:  #b58900;
  --sol-orange:  #cb4b16;
  --sol-red:     #dc322f;
  --sol-magenta: #d33682;
  --sol-violet:  #6c71c4;
  --sol-blue:    #268bd2;
  --sol-cyan:    #2aa198;
  --sol-green:   #859900;
}

/* --- Light theme (default) --- */
:root, .theme-light {
  --bg:          var(--sol-base3);
  --bg-alt:      var(--sol-base2);
  --fg:          var(--sol-base00);
  --fg-strong:   var(--sol-base01);
  --fg-muted:    var(--sol-base1);
  --border:      var(--sol-base2);
  --accent:      var(--sol-blue);
  --must-color:  var(--sol-blue);
  --want-color:  var(--sol-cyan);
  --done-color:  var(--sol-green);
  --link:        var(--sol-blue);
  --link-hover:  var(--sol-violet);
  --input-bg:    var(--sol-base2);
  --input-border: var(--sol-base1);
  --btn-bg:      var(--sol-blue);
  --btn-fg:      var(--sol-base3);
  --btn-hover:   var(--sol-violet);
  --banner-bg:   var(--sol-base2);
}

/* --- Dark theme --- */
.theme-dark {
  --bg:          var(--sol-base03);
  --bg-alt:      var(--sol-base02);
  --fg:          var(--sol-base0);
  --fg-strong:   var(--sol-base1);
  --fg-muted:    var(--sol-base01);
  --border:      var(--sol-base02);
  --input-bg:    var(--sol-base02);
  --input-border: var(--sol-base01);
  --banner-bg:   var(--sol-base02);
  --btn-fg:      var(--sol-base2);
}

/* ============================================================
   Reset & Base
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  line-height: 1.6;
  /* Prevent iOS text size adjustment on orientation change */
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--fg);
  min-height: 100vh;
  min-height: 100dvh; /* dynamic viewport height for mobile browsers */
  /* Prevent pull-to-refresh interfering with scroll */
  overscroll-behavior-y: contain;
}

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

/* ============================================================
   Layout
   ============================================================ */
.container {
  max-width: 640px;
  margin: 0 auto;
  padding: 1rem 1rem;
  /* Safe area insets for notched phones */
  padding-left: max(1rem, env(safe-area-inset-left));
  padding-right: max(1rem, env(safe-area-inset-right));
  padding-bottom: max(1rem, env(safe-area-inset-bottom));
}

/* ============================================================
   Navigation
   ============================================================ */
.top-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.nav-brand {
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--fg-strong);
}
.nav-brand:hover {
  color: var(--accent);
  text-decoration: none;
}

/* Hamburger button — hidden on desktop */
.nav-hamburger {
  display: none;
  background: none;
  border: none;
  font-size: 1.25rem;
  color: var(--fg-muted);
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 0;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.nav-hamburger:hover {
  color: var(--accent);
}

.nav-link {
  font-size: 0.875rem;
  color: var(--fg-muted);
}
.nav-link:hover, .nav-link.active {
  color: var(--accent);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Settings and sign-out links in nav */
.nav-links a.nav-link,
.nav-links .btn-link {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

/* Button styled as a text link (for logout in nav) */
.btn-link {
  background: none;
  border: none;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  font-family: inherit;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* Nav theme toggle — styled like other nav links */
.nav-theme-toggle {
  font-size: 0.875rem;
  color: var(--fg-muted);
}
.nav-theme-toggle:hover {
  color: var(--accent);
}

/* ============================================================
   Auth pages
   ============================================================ */
#auth-container {
  max-width: 360px;
  margin: 4rem auto;
  text-align: center;
}

#auth-container h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--fg-strong);
  margin-bottom: 0.25rem;
}

.subtitle {
  color: var(--fg-muted);
  margin-bottom: 2rem;
  font-size: 0.95rem;
}

.hint {
  margin-top: 1.5rem;
  font-size: 0.85rem;
  color: var(--fg-muted);
}

/* ============================================================
   Forms & Inputs
   ============================================================ */
.form-group {
  margin-bottom: 1rem;
  text-align: left;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--fg-strong);
  margin-bottom: 0.25rem;
}

input[type="text"],
input[type="email"],
select {
  width: 100%;
  padding: 0.625rem 0.75rem;
  /* 16px prevents iOS zoom on focus */
  font-size: 1rem;
  border: 1px solid var(--input-border);
  border-radius: 6px;
  background: var(--input-bg);
  color: var(--fg);
  outline: none;
  transition: border-color 0.15s;
  /* Remove iOS input styling */
  -webkit-appearance: none;
  appearance: none;
}

select {
  /* Restore dropdown arrow for selects */
  -webkit-appearance: menulist;
  appearance: menulist;
}

input:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(38, 139, 210, 0.2);
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-block;
  padding: 0.625rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  /* 44px minimum touch target */
  min-height: 44px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.btn-primary {
  background: var(--btn-bg);
  color: var(--btn-fg);
  width: 100%;
  margin-top: 0.5rem;
}
.btn-primary:hover {
  background: var(--btn-hover);
}

.btn-secondary {
  background: var(--bg-alt);
  color: var(--fg-strong);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-small {
  padding: 0.25rem 0.75rem;
  font-size: 0.85rem;
}

.btn-active {
  background: var(--accent);
  color: var(--btn-fg);
}

.btn-icon {
  background: none;
  border: none;
  color: var(--fg-muted);
  cursor: pointer;
  /* 44px touch target */
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  border-radius: 6px;
  font-weight: 700;
  line-height: 1;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.btn-icon:hover {
  color: var(--accent);
  background: var(--bg-alt);
}
.btn-delete:hover {
  color: var(--must-color);
}

/* ============================================================
   Alerts
   ============================================================ */
.alert {
  padding: 0.75rem 1rem;
  border-radius: 4px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.alert-error {
  background: rgba(220, 50, 47, 0.1);
  color: var(--must-color);
  border: 1px solid rgba(220, 50, 47, 0.25);
}

/* ============================================================
   Week page
   ============================================================ */
.week-page {
  padding-bottom: 3rem;
}

/* --- Week navigation --- */
.week-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.week-nav-center {
  text-align: center;
  flex: 1;
  min-width: 0;
}

.week-nav-center h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--fg-strong);
  line-height: 1.2;
}

.week-nav-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  font-size: 1.75rem;
  font-weight: 300;
  color: var(--accent);
  border-radius: 6px;
  text-decoration: none;
  flex-shrink: 0;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.1s, color 0.1s;
}
.week-nav-arrow:hover {
  background: var(--bg-alt);
  color: var(--link-hover);
  text-decoration: none;
}
.week-nav-arrow.disabled {
  color: var(--fg-muted);
  opacity: 0.3;
  pointer-events: none;
}

.week-nav-today {
  text-align: center;
  margin-bottom: 1rem;
}

.week-dates {
  color: var(--fg-muted);
  font-size: 0.9rem;
  margin-bottom: 0;
}

/* ============================================================
   Task sections
   ============================================================ */
.task-section {
  margin-bottom: 2rem;
}

.section-header {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.75rem;
  padding-bottom: 0.35rem;
  border-bottom: 2px solid var(--border);
}

.must-header {
  color: var(--must-color);
  border-bottom-color: var(--must-color);
}

.want-header {
  color: var(--want-color);
  border-bottom-color: var(--want-color);
}

/* --- Done section --- */
.done-header {
  color: var(--done-color);
  border-bottom-color: var(--done-color);
}

.done-section {
  margin-top: 1rem;
}

.done-sub-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-muted);
  margin: 0.5rem 0 0.25rem 0;
  padding-left: 0.5rem;
}

.done-tasks {
  /* No sortable styling — done tasks are not draggable */
}

/* Hide drag handles in done section but preserve layout alignment */
.done-section .drag-handle {
  visibility: hidden;
}

/* Hide priority toggle in done section (already hidden via when-not done,
   but belt-and-suspenders for any edge case) */
.done-section .task-actions .btn-icon:not(.btn-delete) {
  display: none;
}

/* ============================================================
   Tasks
   ============================================================ */
.task {
  border-radius: 6px;
  margin-bottom: 2px;
  transition: background 0.1s;
}
.task:hover {
  background: var(--bg-alt);
}

/* The main row: handle + checkbox + text + actions */
.task-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem;
  /* Minimum touch-friendly row height */
  min-height: 48px;
}

/* --- Drag handle --- */
.drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  min-height: 44px;
  font-size: 1.25rem;
  color: var(--fg-muted);
  cursor: grab;
  flex-shrink: 0;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  opacity: 0.5;
  transition: opacity 0.15s, color 0.15s;
}
.drag-handle:hover {
  opacity: 1;
  color: var(--fg-strong);
}
.drag-handle:active {
  cursor: grabbing;
}

/* SortableJS drag states */
.task-ghost {
  opacity: 0.4;
  background: var(--bg-alt);
  border: 1px dashed var(--accent);
  border-radius: 6px;
}
.task-chosen {
  background: var(--bg-alt);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}
.task-drag {
  opacity: 0.9;
}

.task-check {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  cursor: pointer;
  /* Ensure the label itself is a good touch target */
  min-height: 44px;
  /* Wider horizontal padding for easier tapping */
  padding: 0 0.5rem 0 0.25rem;
  flex-shrink: 0;
}

.task-check input[type="checkbox"] {
  width: 1.25rem;
  height: 1.25rem;
  cursor: pointer;
  flex-shrink: 0;
  /* Custom checkbox — full control over colors in both themes */
  -webkit-appearance: none;
  appearance: none;
  background: var(--input-bg);
  border: 2px solid var(--input-border);
  border-radius: 4px;
  transition: background 0.15s, border-color 0.15s;
  position: relative;
}
.task-check input[type="checkbox"]:checked {
  background: var(--done-color);
  border-color: var(--done-color);
}
.task-check input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 0.3rem;
  top: 0.1rem;
  width: 0.3rem;
  height: 0.6rem;
  border: solid var(--bg);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.task-check input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.task-text {
  flex: 1;
  font-size: 1rem;
  color: var(--fg);
  word-break: break-word;
  text-align: left;
}

.task.done .task-text {
  text-decoration: line-through;
  color: var(--fg-muted);
}

.task.rolled-forward .task-text::before {
  content: "\21B3 ";
  color: var(--fg-muted);
  font-size: 0.8rem;
}

.task-actions {
  display: flex;
  gap: 0;
  flex-shrink: 0;
}

/* On devices with hover (desktop), hide actions until hover */
@media (hover: hover) {
  .task-actions {
    opacity: 0;
    transition: opacity 0.15s;
  }
  .task:hover .task-actions {
    opacity: 1;
  }
}

/* On touch devices (no hover), always show actions */
@media (hover: none) {
  .task-actions {
    opacity: 1;
  }
}

.empty-hint {
  color: var(--fg-muted);
  font-size: 0.9rem;
  font-style: italic;
  padding: 0.5rem 0;
}

/* --- Task text with note icon --- */
.task-text-label {
  margin-right: 0.375rem;
  cursor: pointer;
  border-radius: 3px;
  transition: color 0.1s;
}
.task-text-label[data-edit-text]:hover {
  color: var(--accent);
}
.task-text-label[data-edit-text]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Inline edit input */
.task-edit-input {
  font-family: inherit;
  font-size: 1rem;
  color: var(--fg);
  background: var(--input-bg);
  border: 1px solid var(--accent);
  border-radius: 4px;
  padding: 0.125rem 0.375rem;
  width: 100%;
  box-shadow: 0 0 0 2px rgba(38, 139, 210, 0.2);
  outline: none;
}

.task-text-content {
  /* no extra styling needed, just used as a wrapper */
}

/* --- Hashtag tags --- */
.tag {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
  font-size: 0.8em;
  font-weight: 500;
  white-space: nowrap;
  line-height: 1.4;
  vertical-align: baseline;
  cursor: pointer;
}

/* Tag color variants — 5-color accessible subset of solarized palette
   (no red, magenta, green — safe for red-green color deficiency) */
.tag-yellow {
  background: rgba(181, 137, 0, 0.15);
  color: var(--sol-yellow);
}

.tag-orange {
  background: rgba(203, 75, 22, 0.15);
  color: var(--sol-orange);
}

.tag-violet {
  background: rgba(108, 113, 196, 0.15);
  color: var(--sol-violet);
}

.tag-blue {
  background: rgba(38, 139, 210, 0.15);
  color: var(--sol-blue);
}

.tag-cyan {
  background: rgba(42, 161, 152, 0.15);
  color: var(--sol-cyan);
}

/* Reduce opacity of tags in completed tasks */
.task.done .tag {
  opacity: 0.6;
}

/* --- Tag color picker popup --- */
.tag-color-picker {
  position: absolute;
  z-index: 100;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.375rem 0.5rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  display: none;
  align-items: center;
  gap: 0.25rem;
}

.picker-swatches {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.tag-swatch {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  font-size: 0;
  line-height: 0;
  transition: transform 0.1s, border-color 0.1s;
  outline: none;
}

.tag-swatch:hover {
  transform: scale(1.15);
}

.tag-swatch:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.tag-swatch.active {
  border-color: var(--fg);
  box-shadow: 0 0 0 1px var(--card-bg), 0 0 0 3px var(--fg);
}

.swatch-yellow  { background: var(--sol-yellow); }
.swatch-orange  { background: var(--sol-orange); }
.swatch-violet  { background: var(--sol-violet); }
.swatch-blue    { background: var(--sol-blue); }
.swatch-cyan    { background: var(--sol-cyan); }

.swatch-reset {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--card-bg);
  color: var(--fg-muted);
  cursor: pointer;
  padding: 0;
  font-size: 14px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s, border-color 0.1s;
  outline: none;
}

.swatch-reset:hover {
  transform: scale(1.15);
  border-color: var(--fg-muted);
}

.swatch-reset:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* --- Tag filter bar --- */
.tag-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 0.5rem 0;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.tag-bar-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-right: 0.125rem;
}

.tag-filter {
  /* Inherits .tag pill styles; override cursor */
  cursor: pointer;
  transition: background 0.15s, color 0.15s, opacity 0.15s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  border: none;
  font-family: inherit;
}
.tag-filter:hover {
  opacity: 0.85;
}

/* Active filter state — solid background instead of translucent */
.tag-filter.active.tag-yellow { background: var(--sol-yellow); color: var(--bg); font-weight: 700; }
.tag-filter.active.tag-orange { background: var(--sol-orange); color: var(--bg); font-weight: 700; }
.tag-filter.active.tag-violet { background: var(--sol-violet); color: var(--bg); font-weight: 700; }
.tag-filter.active.tag-blue   { background: var(--sol-blue);   color: var(--bg); font-weight: 700; }
.tag-filter.active.tag-cyan   { background: var(--sol-cyan);   color: var(--bg); font-weight: 700; }

/* Clear filter button */
.tag-bar-clear {
  background: none;
  border: 1px solid var(--border);
  color: var(--fg-muted);
  cursor: pointer;
  font-size: 0.75rem;
  line-height: 1;
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, border-color 0.15s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  font-family: inherit;
}
.tag-bar-clear:hover {
  color: var(--fg-strong);
  border-color: var(--fg-muted);
}

/* Hidden tasks when filter is active */
.task.tag-hidden {
  display: none;
}

.note-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: var(--fg-muted);
  opacity: 0.5;
  transition: opacity 0.15s, color 0.15s;
  vertical-align: middle;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0.25rem 0.375rem;
  border-radius: 3px;
  flex-shrink: 0;
  line-height: 1;
  font-family: inherit;
}
.note-icon:hover {
  opacity: 1;
  color: var(--accent);
}
.note-icon:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  opacity: 1;
}
.note-icon.has-notes {
  color: var(--accent);
  opacity: 0.8;
  font-weight: 700;
}
.task:hover .note-icon,
.task.expanded .note-icon {
  opacity: 1;
}

/* --- Expandable notes panel --- */
.task-notes {
  display: none;
  padding: 0.25rem 0.5rem 0.5rem 2.75rem; /* indent past handle + checkbox */
}
.task.expanded .task-notes {
  display: block;
}

.task-notes textarea {
  width: 100%;
  min-height: 3rem;
  max-height: 12rem;
  padding: 0.5rem 0.625rem;
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--fg);
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  resize: none; /* we auto-resize via JS */
  overflow: hidden;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.15s;
}
.task-notes textarea:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 2px rgba(38, 139, 210, 0.2);
}
.task-notes textarea::placeholder {
  color: var(--fg-muted);
}

/* Character count + save indicator */
.notes-charcount {
  display: block;
  text-align: right;
  font-size: 0.75rem;
  color: var(--fg-muted);
  margin-top: 0.25rem;
  min-height: 1.1em;
  opacity: 0;
  transition: opacity 0.2s;
}
.notes-charcount.visible {
  opacity: 1;
}
.notes-charcount.warn {
  color: var(--sol-orange);
}
.notes-charcount.limit {
  color: var(--must-color);
  font-weight: 600;
}

/* Brief save indicator */
.notes-saved {
  color: var(--done-color);
  font-size: 0.75rem;
  margin-right: 0.5rem;
}

/* ============================================================
   Add task form
   ============================================================ */
.add-task {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
  align-items: center;
}

.task-input {
  flex: 1;
  padding: 0.625rem 0.75rem;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--input-bg);
  color: var(--fg);
  min-height: 44px;
  -webkit-appearance: none;
  appearance: none;
}
.task-input:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 2px rgba(38, 139, 210, 0.2);
}

.add-task .btn-small {
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  padding: 0;
  flex-shrink: 0;
  background: var(--btn-bg);
  color: var(--btn-fg);
}
.add-task .btn-small:hover {
  background: var(--btn-hover);
}

/* ============================================================
   Roll-forward banner
   ============================================================ */
.banner {
  padding: 0.75rem 1rem;
  margin-bottom: 1.5rem;
  background: var(--banner-bg);
  border-radius: 6px;
  border-left: 3px solid var(--sol-yellow);
}

.banner-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.banner-content p {
  font-size: 0.9rem;
  color: var(--fg-strong);
  flex: 1;
}

.banner-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.btn-text {
  background: none;
  border: none;
  color: var(--fg-muted);
  font-size: 0.85rem;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  text-decoration: underline;
  min-height: 44px;
}
.btn-text:hover {
  color: var(--fg-strong);
}

/* ============================================================
   Settings page
   ============================================================ */
.settings-page h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--fg-strong);
  margin-bottom: 1.5rem;
}

.setting-group {
  margin-bottom: 2rem;
}

.setting-group h2 {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-muted);
  margin-bottom: 0.75rem;
}

.setting-group p {
  margin-bottom: 0.75rem;
  color: var(--fg);
}

.setting-group select {
  max-width: 200px;
}

.theme-toggle {
  display: flex;
  gap: 0.5rem;
}

/* ============================================================
   Marketing / landing page
   ============================================================ */
.marketing-page {
  padding-bottom: 3rem;
}

.hero {
  text-align: center;
  padding: 3rem 0 2.5rem;
}

.hero-headline {
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--fg-strong);
  line-height: 1.15;
  margin-bottom: 1rem;
}

.hero-sub {
  font-size: 1.1rem;
  color: var(--fg);
  max-width: 480px;
  margin: 0 auto 2rem;
  line-height: 1.6;
}

.hero-cta {
  display: inline-block;
  padding: 0.875rem 2rem;
  font-size: 1.05rem;
  font-weight: 700;
  border-radius: 8px;
  text-decoration: none;
}
.hero-cta:hover {
  text-decoration: none;
}

.features {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  padding: 1.5rem 0 2.5rem;
}

.feature-card {
  background: var(--bg-alt);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
}

.feature-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: var(--accent);
  color: var(--btn-fg);
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.feature-card h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--fg-strong);
  margin-bottom: 0.375rem;
}

.feature-card p {
  font-size: 0.9rem;
  color: var(--fg);
  line-height: 1.55;
}

.bottom-cta {
  text-align: center;
  padding: 2rem 0 1rem;
  border-top: 1px solid var(--border);
}

.bottom-cta h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--fg-strong);
  margin-bottom: 0.5rem;
}

.bottom-cta p {
  color: var(--fg);
  margin-bottom: 1.5rem;
}

/* ============================================================
   HTMX loading indicator
   ============================================================ */
.htmx-indicator {
  opacity: 0;
  transition: opacity 0.2s;
}
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  opacity: 1;
}

/* ============================================================
   Notes tooltip (first-visit hint)
   ============================================================ */
.notes-tooltip {
  position: absolute;
  z-index: 100;
  background: var(--accent);
  color: var(--btn-fg);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  max-width: 260px;
  animation: tooltipFadeIn 0.3s ease-out;
}
.notes-tooltip::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 20px;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 8px solid var(--accent);
}

@keyframes tooltipFadeIn {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.tooltip-content {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.tooltip-content p {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  flex: 1;
}
.tooltip-close {
  background: none;
  border: none;
  color: var(--btn-fg);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  opacity: 0.8;
  transition: opacity 0.15s, background 0.15s;
  flex-shrink: 0;
}
.tooltip-close:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.15);
}

/* ============================================================
   Responsive — Mobile first
   ============================================================ */

/* --- Small screens (phones) --- */
@media (max-width: 480px) {
  /* Hamburger nav */
  .nav-hamburger {
    display: inline-flex;
  }
  .nav-links {
    display: none;
    flex-basis: 100%;
    flex-direction: column;
    align-items: flex-end;
    gap: 0;
    padding-top: 0.5rem;
  }
  .nav-open .nav-links {
    display: flex;
  }
  .nav-links a.nav-link,
  .nav-links .btn-link {
    padding: 0.5rem 0;
  }

  .container {
    padding: 0.75rem;
    padding-left: max(0.75rem, env(safe-area-inset-left));
    padding-right: max(0.75rem, env(safe-area-inset-right));
  }

  #auth-container {
    margin: 2rem auto;
    padding: 0 0.5rem;
  }

  .banner-content {
    flex-direction: column;
    align-items: stretch;
  }
  .banner-actions {
    flex-direction: column;
  }
  .banner-actions .btn-secondary,
  .banner-actions .btn-text {
    text-align: center;
    width: 100%;
  }

  .week-header h1,
  .week-nav-center h1 {
    font-size: 1.25rem;
  }

  .week-nav-arrow {
    font-size: 1.5rem;
    min-width: 40px;
    min-height: 44px;
  }

  .hero-headline {
    font-size: 1.75rem;
  }

  .hero-sub {
    font-size: 1rem;
  }

  .task-row {
    padding: 0.625rem 0.25rem;
  }

  .task-text {
    font-size: 0.95rem;
  }

  .task-notes {
    padding-left: 2.25rem; /* slightly less indent on phones */
  }

  .setting-group select {
    max-width: 100%;
  }

  .theme-toggle {
    flex: 1;
  }
  .theme-toggle .btn {
    flex: 1;
    text-align: center;
  }
}

/* --- Tablets and up — a little more breathing room --- */
@media (min-width: 481px) {
  .container {
    padding: 1.5rem 2rem;
  }

  .features {
    grid-template-columns: 1fr 1fr;
  }
}

/* ============================================================
   Utility: visually hidden (accessible labels)
   ============================================================ */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ============================================================
   Inbox badge (nav)
   ============================================================ */
.inbox-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--sol-orange);
  color: var(--bg);
  font-size: 0.65rem;
  font-weight: 700;
  min-width: 1.1em;
  height: 1.1em;
  padding: 0 0.3em;
  border-radius: 999px;
  margin-left: 0.3em;
  vertical-align: middle;
  line-height: 1;
}

/* ============================================================
   Quick-capture bar (week page)
   ============================================================ */
.quick-capture {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.quick-capture-toggle {
  background: none;
  border: 1px solid var(--border);
  color: var(--fg-muted);
  font-size: 1.1rem;
  width: 2.5rem;
  height: 2.5rem;
  min-width: 44px;
  min-height: 44px;
  border-radius: 0.5rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}
.quick-capture-toggle:hover,
.quick-capture-toggle[aria-expanded="true"] {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--bg-elevated);
}

.quick-capture-form {
  flex: 1;
  display: flex;
  gap: 0.375rem;
  align-items: center;
}

.quick-capture-form .task-input {
  flex: 1;
}

/* Confirmation flash */
.quick-capture-flash {
  color: var(--sol-green, var(--accent));
  font-size: 0.8rem;
  font-weight: 600;
  opacity: 1;
  transition: opacity 0.4s;
  white-space: nowrap;
}

/* ============================================================
   Inbox page
   ============================================================ */
.inbox-page {
  max-width: 40rem;
  margin: 0 auto;
}

.inbox-header {
  margin-bottom: 1rem;
}

.inbox-header h1 {
  font-size: 1.5rem;
  color: var(--fg-strong);
  margin: 0 0 0.25rem;
}

.inbox-ttl-hint {
  font-size: 0.8rem;
  color: var(--fg-muted);
  margin: 0;
}

.add-inbox-item {
  display: flex;
  gap: 0.375rem;
  margin-bottom: 1rem;
}

.add-inbox-item .task-input {
  flex: 1;
}

/* --- Inbox item --- */
.inbox-item {
  border-bottom: 1px solid var(--border);
  padding: 0.5rem 0;
}

.inbox-item-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
}

.inbox-item-text {
  flex: 1;
  color: var(--fg);
  font-size: 0.95rem;
  word-break: break-word;
}

.inbox-item-age {
  font-size: 0.75rem;
  color: var(--fg-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.inbox-item-age.age-warm {
  color: var(--sol-yellow);
}

.inbox-item-age.age-hot {
  color: var(--sol-orange);
  font-weight: 600;
}

.inbox-item-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
}

.inbox-promote {
  color: var(--accent);
  font-weight: 700;
}

/* Demote button (task -> inbox) */
.btn-demote {
  color: var(--fg-muted);
  font-size: 0.9rem;
}
.btn-demote:hover {
  color: var(--sol-cyan);
}

/* --- Promote chooser --- */
.inbox-promote-chooser {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0 0.375rem 0.5rem;
  font-size: 0.85rem;
}

.promote-label {
  color: var(--fg-muted);
  font-size: 0.8rem;
  white-space: nowrap;
}

.btn-must {
  background: var(--sol-orange);
  color: var(--bg);
  border: none;
  font-weight: 600;
}
.btn-must:hover {
  opacity: 0.85;
}

.btn-want {
  background: var(--sol-cyan);
  color: var(--bg);
  border: none;
  font-weight: 600;
}
.btn-want:hover {
  opacity: 0.85;
}

.promote-cancel {
  color: var(--fg-muted);
}

/* --- Inbox item notes (mirrors task notes) --- */
.inbox-item-notes {
  display: none;
  padding: 0.25rem 0 0.25rem 0.5rem;
}

.inbox-item.expanded .inbox-item-notes {
  display: block;
}

.inbox-item-notes textarea {
  width: 100%;
  min-height: 3rem;
  max-height: 12rem;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  background: var(--bg-elevated);
  color: var(--fg);
  font-family: inherit;
  font-size: 0.85rem;
  resize: vertical;
  box-sizing: border-box;
}
.inbox-item-notes textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: var(--accent);
}

.inbox-item-notes .notes-charcount {
  display: block;
  text-align: right;
  font-size: 0.7rem;
  color: var(--fg-muted);
  margin-top: 0.125rem;
}

/* --- Settings hint --- */
.setting-hint {
  font-size: 0.8rem;
  color: var(--fg-muted);
  margin: 0 0 0.375rem;
}

/* ============================================================
   Inbox mobile adjustments
   ============================================================ */
@media (max-width: 480px) {
  .inbox-promote-chooser {
    flex-wrap: wrap;
    gap: 0.375rem;
  }
  .promote-label {
    width: 100%;
  }
}

/* ============================================================
   Keyboard shortcuts overlay
   ============================================================ */
#shortcuts-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.shortcuts-dialog {
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--bg-alt);
  border-radius: 0.5rem;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
  max-width: 340px;
  width: 100%;
  padding: 1.25rem 1.5rem;
}

.shortcuts-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.shortcuts-header h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.shortcuts-close {
  background: none;
  border: none;
  color: var(--fg-muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.shortcuts-close:hover {
  color: var(--fg);
}

.shortcuts-list {
  margin: 0;
  padding: 0;
}

.shortcut-row {
  display: flex;
  align-items: center;
  padding: 0.4rem 0;
  gap: 0.75rem;
}

.shortcut-row dt {
  flex-shrink: 0;
  width: 3rem;
  text-align: center;
}

.shortcut-row dd {
  margin: 0;
  color: var(--fg);
  font-size: 0.95rem;
}

kbd {
  display: inline-block;
  padding: 0.2em 0.5em;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--fg);
  background: var(--bg-alt);
  border: 1px solid var(--fg-muted);
  border-radius: 0.25rem;
  min-width: 1.5em;
  text-align: center;
}
