:root {
  color-scheme: light;
  --bg: #f7f3ee;
  --surface: #ffffff;
  --surface-soft: #fff8ef;
  --surface-muted: #efe7dc;
  --text: #2d2a24;
  --muted: #7c7164;
  --border: #e6d9ca;
  --accent: #f97316;
  --accent-strong: #ea580c;
  --accent-soft: #ffedd5;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --shadow: 0 18px 45px rgba(67, 48, 33, 0.12);
  --radius: 22px;
  --sidebar-width: 290px;
}

[data-brand="blue"] {
  --accent: #2563eb;
  --accent-strong: #1d4ed8;
  --accent-soft: #dbeafe;
  --surface-soft: #eff6ff;
  --surface-muted: #dbe7fa;
}

[data-brand="green"] {
  --accent: #16a34a;
  --accent-strong: #15803d;
  --accent-soft: #dcfce7;
  --surface-soft: #f0fdf4;
  --surface-muted: #d7ecdc;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #191715;
  --surface: #24211e;
  --surface-soft: #2d2823;
  --surface-muted: #37312b;
  --text: #fff7ed;
  --muted: #c8b8a7;
  --border: #463c33;
  --accent: #fb923c;
  --accent-strong: #f97316;
  --accent-soft: #4a2b17;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.28);
}

[data-theme="dark"][data-brand="blue"] {
  --accent: #93c5fd;
  --accent-strong: #60a5fa;
  --accent-soft: #1e3a5f;
  --surface-soft: #273242;
  --surface-muted: #354253;
}

[data-theme="dark"][data-brand="green"] {
  --accent: #86efac;
  --accent-strong: #4ade80;
  --accent-soft: #14532d;
  --surface-soft: #22332a;
  --surface-muted: #2f4338;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }

.btn, .icon-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 700;
  min-height: 44px;
  padding: 0 1rem;
}
.btn-primary { background: var(--accent); border-color: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-strong); }
.btn-ghost { background: transparent; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: white; }
.btn-lg { min-height: 52px; padding: 0 1.25rem; }
.icon-btn { width: 44px; padding: 0; }
.icon-btn svg, .btn svg, .sidebar svg, .feature-grid svg { width: 19px; height: 19px; }

.brand { display: inline-flex; align-items: center; gap: 0.65rem; font-weight: 800; }
.brand-logo { width: 38px; height: 38px; border-radius: 14px; display: block; }
.eyebrow { margin: 0 0 0.35rem; color: var(--accent); font-weight: 800; font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; }
.hero-eyebrow { display: inline-block; background: var(--accent-soft); color: var(--accent-strong); padding: 0.35rem 0.85rem; border-radius: 999px; font-size: 0.78rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; margin: 0 0 0.75rem; }
.muted { color: var(--muted); }

/* ── Landing Page ── */
.landing-page { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 40px 0 56px; }
.landing-nav { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.hero-section { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 48px; align-items: center; padding: 88px 0 64px; }
.hero-copy h1 { margin: 0; font-size: clamp(2.4rem, 6vw, 5.5rem); line-height: 0.96; letter-spacing: -0.06em; max-width: 780px; }
.hero-text { color: var(--muted); font-size: 1.12rem; line-height: 1.8; max-width: 650px; }
.hero-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 28px; }
.hero-card { background: var(--surface); border: 1px solid var(--border); border-radius: 32px; padding: 24px; box-shadow: var(--shadow); }
.preview-header { display: flex; justify-content: space-between; margin-bottom: 18px; }
.preview-task { display: flex; gap: 0.9rem; align-items: center; padding: 16px; border-radius: 20px; background: var(--surface-soft); margin-top: 12px; }
.preview-task > span { width: 14px; height: 14px; border-radius: 999px; flex: 0 0 auto; }
.preview-task.high > span { background: var(--danger); }
.preview-task.medium > span { background: var(--warning); }
.preview-task.low > span { background: var(--success); }
.preview-task strong, .preview-task small { display: block; }
.preview-task small { color: var(--muted); margin-top: 4px; }
.highlight { color: var(--accent); }
.info-section { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; padding: 24px 0 48px; }
.info-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.info-card h3 { margin: 12px 0 8px; }
.info-card p { color: var(--muted); line-height: 1.65; margin: 0; font-size: 0.92rem; }
.info-icon { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; }
.info-icon svg { width: 22px; height: 22px; }
.tagline-section { text-align: center; padding: 24px 0 56px; }
.tagline { display: inline-block; background: var(--accent-soft); color: var(--accent-strong); padding: 0.6rem 1.5rem; border-radius: 999px; font-size: 0.95rem; font-weight: 700; white-space: nowrap; margin: 0 auto; }

/* ── Landing Footer ── */
.landing-footer { border-top: 1px solid var(--border); padding: 28px 0 20px; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.footer-links { display: flex; align-items: center; gap: 0.75rem; flex-shrink: 0; }
.footer-link { color: var(--muted); font-size: 0.88rem; font-weight: 600; }
.footer-link:hover { color: var(--accent); }
.footer-credit { color: var(--muted); font-size: 0.78rem; margin: 0; text-align: center; }
.btn-sm { min-height: 36px; font-size: 0.85rem; padding: 0 0.85rem; }

/* ── App Shell ── */
.app-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr); }

/* ── Sidebar (slide-over overlay on all screens) ── */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 22px;
  height: 100vh;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 50;
  width: var(--sidebar-width);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 220ms cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: none;
}
.sidebar.open {
  transform: translateX(0);
  box-shadow: 8px 0 30px rgba(0, 0, 0, 0.15);
}
.sidebar-backdrop {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 45;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
}
.sidebar-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}
.sidebar-section { margin-top: 24px; }
.sidebar-title { color: var(--muted); font-size: 0.78rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; margin: 0 0 10px; }
.nav-item, .category-item { width: 100%; border: 0; background: transparent; color: var(--text); display: flex; align-items: center; gap: 0.7rem; padding: 11px 12px; border-radius: 15px; font-weight: 700; text-align: left; }
.nav-item:hover, .category-item:hover, .nav-item.active, .category-item.active { background: var(--accent-soft); color: var(--accent-strong); }
.category-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.count-pill { margin-left: auto; color: var(--muted); font-size: 0.8rem; }
.count-inline { font-weight: 500; white-space: nowrap; }
.sidebar-main { flex: 1 1 auto; min-height: 0; }
.sidebar-settings { margin-top: auto; padding-top: 18px; border-top: 1px solid var(--border); }
.settings-item { width: 100%; border: 0; background: transparent; color: var(--text); display: flex; align-items: center; gap: 0.7rem; padding: 11px 12px; border-radius: 15px; font-weight: 700; text-align: left; cursor: pointer; }
.settings-item:hover, .settings-item.active { background: var(--accent-soft); color: var(--accent-strong); }
.settings-item svg { flex-shrink: 0; }
.setting-switch { display: block; margin-left: auto; width: 40px; height: 24px; border: 0; padding: 0; border-radius: 999px; background: var(--border); position: relative; flex-shrink: 0; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.06); transition: background 200ms ease; }
.setting-switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.25); transition: transform 200ms cubic-bezier(0.4, 0, 0.2, 1); }
.setting-switch.on { background: var(--accent); }
.setting-switch.on::after { transform: translateX(16px); }

/* ── Settings Page ── */
.settings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.settings-card-header { margin-bottom: 14px; }
.settings-card-header h3 { margin: 0 0 4px; }
.settings-card-header p { margin: 0; font-size: 0.86rem; }
.settings-list { display: grid; gap: 8px; }
#danger-main { display: grid; gap: 8px; }
.settings-row { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 16px; background: var(--surface-soft); }
.settings-row-icon { width: 38px; height: 38px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-strong); display: grid; place-items: center; flex-shrink: 0; }
.settings-row-icon svg { width: 19px; height: 19px; }
.settings-row-copy { display: grid; gap: 2px; min-width: 0; margin-right: auto; }
.settings-row-copy strong { font-weight: 700; }
.settings-row-copy .muted, .settings-check { font-size: 0.8rem; }
.settings-check { white-space: nowrap; }

/* ── Main Panel ── */
.main-panel { min-width: 0; width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 24px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 22px; }
.topbar-left { display: flex; align-items: center; gap: 0.75rem; min-width: 0; }
.topbar h2 { margin: 0; color: var(--accent-strong); font-size: clamp(1.15rem, 2.4vw, 1.5rem); letter-spacing: -0.03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }

/* ── Notification bell ── */
.notif-wrap { position: relative; }
#notif-badge.notif-badge { position: absolute; top: -3px; right: -7px; min-width: 17px; height: 17px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 0.64rem; font-weight: 700; line-height: 1; display: flex; align-items: center; justify-content: center; padding: 0 4px; box-shadow: 0 0 0 2px var(--surface); }
.notif-panel { position: absolute; top: calc(100% + 8px); right: 0; width: 320px; max-width: 92vw; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); z-index: 60; padding: 0.75rem; }
.notif-panel-head { display: flex; align-items: center; justify-content: space-between; padding: 0.25rem 0.25rem 0.6rem; border-bottom: 1px solid var(--border); }
.notif-panel-head strong { font-size: 0.95rem; }
.notif-list { max-height: 320px; overflow-y: auto; display: flex; flex-direction: column; gap: 0.3rem; padding: 0.5rem 0; }
.notif-group-label { margin: 0.45rem 0.35rem 0.1rem; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.notif-group-label:first-child { margin-top: 0; }
.notif-item { display: flex; align-items: center; gap: 0.6rem; width: 100%; text-align: left; background: transparent; border: 0; padding: 0.5rem 0.5rem; border-radius: 12px; cursor: pointer; color: var(--text); }
.notif-item:hover { background: var(--surface-soft); }
.notif-dot { width: 10px; height: 10px; border-radius: 999px; flex-shrink: 0; }
.notif-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.notif-copy strong { font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notif-copy .muted { font-size: 0.78rem; }
.notif-pill { font-size: 0.7rem; font-weight: 700; padding: 0.15rem 0.5rem; border-radius: 999px; background: var(--surface-soft); color: var(--muted); white-space: nowrap; }
.notif-empty { padding: 1rem; text-align: center; color: var(--muted); font-size: 0.85rem; }
.notif-panel-footer { border-top: 1px solid var(--border); padding-top: 0.6rem; }
.notif-panel-loading { padding: 1rem; text-align: center; color: var(--muted); }
.view-content { display: grid; gap: 18px; }

/* ── Cards & Grids ── */
.grid { display: grid; gap: 18px; }
.stats-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: 0 1px 0 rgba(0,0,0,0.02); }
.card h3 { margin: 0 0 12px; }
.stat-card strong { display: block; font-size: 2rem; letter-spacing: -0.04em; }

/* ── Quick Create ── */
.quick-create { display: grid; grid-template-columns: minmax(0, 1fr) 160px 130px auto; gap: 10px; }

/* ── Form Fields ── */
.field, .textarea, .select { width: 100%; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 14px; min-height: 44px; padding: 0 0.9rem; outline: none; }
.textarea { min-height: 92px; padding-top: 0.85rem; resize: vertical; }
.field:focus, .textarea:focus, .select:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.section-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }

/* ── Category Picker ── */
.cat-picker { position: relative; }
.cat-picker-trigger { width: 100%; min-height: 44px; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 14px; padding: 0 0.9rem; display: flex; align-items: center; gap: 0.55rem; font-weight: 700; font-family: inherit; font-size: 0.9rem; text-align: left; cursor: pointer; }
.cat-picker-trigger:hover, .cat-picker-trigger:focus-visible { border-color: var(--accent); }
.cat-picker-trigger [data-cat-label] { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-picker-trigger svg { flex-shrink: 0; color: var(--muted); }
.cat-picker-menu { position: absolute; z-index: 40; top: calc(100% + 6px); left: 0; min-width: 100%; max-height: 320px; overflow-y: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 15px; box-shadow: 0 18px 45px rgba(67, 48, 33, 0.16); padding: 6px; }
.cat-option { border-radius: 15px; padding: 8px 10px; transition: background 0.12s ease; }
.cat-option:hover, .cat-option.selected { background: var(--accent-soft); }
.cat-option-main { display: flex; align-items: center; gap: 0.7rem; width: 100%; border: 0; background: transparent; color: var(--text); font-weight: 700; font-family: inherit; font-size: 0.9rem; text-align: left; cursor: pointer; padding: 0; }
.cat-option.selected .cat-opt-name { color: var(--accent-strong); }
.cat-opt-check { margin-left: auto; color: var(--accent-strong); opacity: 0; flex-shrink: 0; }
.cat-option.selected .cat-opt-check { opacity: 1; }
.cat-opt-swatches { display: none; flex-wrap: wrap; gap: 5px; margin: 8px 2px 2px 26px; }
.cat-option.selected .cat-opt-swatches { display: flex; }
.swatch { width: 16px; height: 16px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; }
.swatch:hover { transform: scale(1.15); }
.swatch.active { border-color: var(--accent-strong); box-shadow: 0 0 0 2px var(--surface); }

/* ── Date Picker / Calendar ── */
.date-picker .cat-picker-menu { width: min(284px, calc(100vw - 48px)); padding: 10px; }
.date-picker .cat-picker-trigger [data-lucide="calendar"] { flex-shrink: 0; color: var(--accent-strong); }
.cal-header { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 0 2px 8px; }
.cal-header .icon-btn { width: 30px; height: 30px; }
.cal-title { font-weight: 800; font-size: 0.85rem; text-transform: capitalize; white-space: nowrap; }
.cal-weekdays, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-weekdays { margin-bottom: 4px; }
.cal-weekday { text-align: center; font-size: 0.68rem; font-weight: 700; color: var(--muted); padding: 3px 0; }
.cal-day { min-height: 30px; border: 0; background: transparent; color: var(--text); border-radius: 9px; font-family: inherit; font-size: 0.8rem; font-weight: 600; cursor: pointer; }
.cal-day:hover { background: var(--accent-soft); }
.cal-day.empty { pointer-events: none; }
.cal-day.today { outline: 2px solid var(--accent-strong); outline-offset: -2px; }
.cal-day.selected { background: var(--accent); color: white; }
.cal-day.selected.today { outline-color: var(--accent-strong); }
.cal-clear { margin-top: 8px; width: 100%; border: 1px solid var(--border); background: transparent; color: var(--muted); border-radius: 12px; padding: 8px; font-weight: 700; font-family: inherit; font-size: 0.78rem; cursor: pointer; }
.cal-clear:hover { color: var(--danger); border-color: var(--danger); }
.task-list { display: grid; gap: 10px; }

/* ── Task Card ── */
.task-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: start; border: 1px solid var(--border); background: var(--surface); border-radius: 18px; padding: 14px; }
.task-card.completed { opacity: 0.68; }
.status-btn { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--border); background: var(--surface); margin-top: 2px; }
.status-btn.in_progress { border-color: var(--warning); background: #fef3c7; }
.status-btn.completed { border-color: var(--success); background: var(--success); }
.task-title { font-weight: 800; margin: 0 0 4px; }
.task-meta { color: var(--muted); font-size: 0.86rem; display: flex; flex-wrap: wrap; gap: 0.45rem; }
.badge { border-radius: 999px; padding: 0.2rem 0.55rem; font-size: 0.75rem; font-weight: 800; white-space: nowrap; }
.badge.high { background: #fee2e2; color: #991b1b; }
.badge.medium { background: #ffedd5; color: #9a3412; }
.badge.low { background: #dcfce7; color: #166534; }
.badge.pending { background: #e0e7ff; color: #3730a3; }
.task-actions { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 8px; }
.chip-btn { display: inline-flex; align-items: center; gap: 0.35rem; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-soft); color: var(--muted); font-weight: 700; font-size: 0.75rem; padding: 0.28rem 0.65rem; cursor: pointer; }
.chip-btn.active { border-color: var(--accent); color: var(--accent-strong); background: var(--accent-soft); }
.chip-btn svg { width: 13px; height: 13px; }
.archive-list { display: flex; flex-direction: column; gap: 8px; }
.archive-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--border); padding: 10px 0; }
.archive-row:last-child { border-bottom: 0; }
.archive-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.archive-copy .muted { font-size: 0.82rem; }

/* ── Category Grid ── */
.category-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.category-card { border: 1px solid var(--border); background: var(--surface); border-radius: 18px; padding: 16px; text-align: left; cursor: pointer; transition: background 0.12s ease, border-color 0.12s ease; }
.category-card:hover { background: var(--surface-soft); border-color: var(--accent); }
.template-row { display: flex; gap: 8px; row-gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.template-chip { border: 1px solid var(--border); border-radius: 999px; background: var(--surface-soft); padding: 0.3rem 0.7rem; font-size: 0.8rem; font-weight: 700; line-height: 1.3; }
.form-grid { display: grid; gap: 12px; }
.two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* ── Modals ── */
.modal-backdrop { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 18px; background: rgba(24, 20, 16, 0.38); }
.modal-card { width: min(560px, 100%); max-height: calc(100vh - 36px); overflow: auto; background: var(--surface); color: var(--text); border-radius: 28px; padding: 22px; box-shadow: var(--shadow); }
.modal-lg { width: min(760px, 100%); }
.modal-header { display: flex; align-items: start; justify-content: space-between; gap: 1rem; margin-bottom: 16px; }
.modal-header h3 { margin: 0; font-size: 1.5rem; letter-spacing: -0.03em; }

/* ── Create/Edit Task form (Direction A) ── */
.hdr-accent { color: var(--accent-strong); }
.flabel { display: block; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); margin: 0 0 6px 2px; }
.flabel .req { color: var(--danger); }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.template-chip { cursor: pointer; }
.template-chip.active { border-color: var(--accent); color: var(--accent-strong); background: var(--accent-soft); display: inline-flex; align-items: center; gap: 6px; }
.template-chip-clear { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--accent); color: white; }
.template-chip-clear svg { width: 12px; height: 12px; }
.modal-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.footer-hint { color: var(--muted); font-size: 0.8rem; }
.footer-actions { display: flex; align-items: center; gap: 10px; }

/* ── FAB ── */
.fab { position: fixed; right: 24px; bottom: 24px; width: 62px; height: 62px; border-radius: 24px; border: 0; background: var(--accent); color: white; box-shadow: var(--shadow); display: grid; place-items: center; z-index: 20; }
.fab svg { width: 26px; height: 26px; }
.empty-state { text-align: center; padding: 30px; color: var(--muted); }

/* ══════════════════════════════════════════
   TABLET (≤ 900px)
   ══════════════════════════════════════════ */
@media (max-width: 900px) {
  .sidebar { width: min(310px, 85vw); }

  .topbar { gap: 0.5rem; }
  .topbar-actions { gap: 0.35rem; }
  .topbar-actions .btn { font-size: 0.82rem; min-height: 38px; padding: 0 0.7rem; }

  .hero-section { grid-template-columns: 1fr; padding-top: 56px; }
  .feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .info-section { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settings-grid { grid-template-columns: 1fr; }
  .quick-create { grid-template-columns: 1fr; }

  .fab { right: 20px; bottom: 20px; width: 56px; height: 56px; border-radius: 20px; }
}

/* ══════════════════════════════════════════
   MOBILE (≤ 620px)
   ══════════════════════════════════════════ */
@media (max-width: 620px) {
  .landing-page { width: 100%; padding: 0; margin: 0; }

  /* ── Nav ── */
  .landing-nav { padding: 20px 16px 12px; gap: 0.5rem; }
  .landing-nav .btn { font-size: 0.82rem; min-height: 38px; padding: 0 0.85rem; }
  .landing-nav .brand span { font-size: 1rem; }

  /* ── Hero ── */
  .hero-section { padding: 0 16px 32px; gap: 24px; }
  .hero-eyebrow { font-size: 0.7rem; padding: 0.3rem 0.75rem; margin: 60px 0 0.6rem; }
  .hero-copy { padding: 0; }
  .hero-copy h1 { font-size: clamp(1.6rem, 7vw, 2.4rem); max-width: 100%; margin: 12px 0 0; }
  .hero-text { font-size: 0.92rem; line-height: 1.7; max-width: 100%; margin: 14px 0 0; }
  .hero-actions { flex-direction: column; margin-top: 18px; }
  .hero-actions .btn { width: 100%; justify-content: center; }
  .hero-actions .btn-lg { min-height: 52px; font-size: 1rem; padding: 0 1.25rem; margin-top: 18px; margin-bottom: 0; }
  .archive-row { flex-direction: column; align-items: stretch; }
  .hero-card { padding: 16px; border-radius: 20px; margin-top: 0; }
  .preview-header { margin-bottom: 14px; font-size: 0.9rem; }
  .preview-task { padding: 12px 14px; gap: 0.75rem; margin-top: 10px; border-radius: 16px; }
  .preview-task > span { width: 12px; height: 12px; }
  .preview-task strong { font-size: 0.92rem; }
  .preview-task small { font-size: 0.78rem; }

  /* ── Info Cards ── */
  .info-section { grid-template-columns: 1fr; gap: 12px; padding: 4px 16px 24px; }
  .info-card { padding: 16px; border-radius: 18px; display: grid; grid-template-columns: 36px 1fr; gap: 4px 12px; align-items: center; }
  .info-icon { width: 36px; height: 36px; border-radius: 12px; grid-row: 1 / 3; align-self: start; margin-top: 2px; }
  .info-icon svg { width: 19px; height: 19px; }
  .info-card h3 { margin: 0; font-size: 0.95rem; align-self: end; line-height: 1.3; }
  .info-card p { font-size: 0.82rem; line-height: 1.55; margin: 0; align-self: start; }

  /* ── Tagline ── */
  .tagline-section { padding: 4px 16px 24px; }
  .tagline { white-space: normal; font-size: 0.82rem; padding: 0.5rem 1rem; display: block; }

  /* ── Footer ── */
  .landing-footer { padding: 20px 16px 24px; }
  .footer-inner { flex-direction: column; text-align: center; gap: 12px; }
  .footer-credit { font-size: 0.7rem; margin: 0; line-height: 1.6; order: 2; }
  .footer-links { order: 3; }
  .btn-sm { min-height: 34px; font-size: 0.8rem; padding: 0 0.75rem; }

  /* ── Topbar (app) ── */
  .topbar { flex-wrap: wrap; gap: 0.5rem; }
  .topbar-left { flex: 1; min-width: 0; }
  .topbar h2 { font-size: 1.6rem; }
  .topbar-actions { width: 100%; justify-content: flex-end; }
  .topbar-actions .icon-btn { width: 42px; height: 42px; }
  .notif-panel { position: fixed; top: 4.5rem; right: 1rem; left: auto; width: min(320px, calc(100vw - 2rem)); }

  /* ── Task Card ── */
  .task-card { grid-template-columns: auto 1fr; gap: 10px; padding: 12px; }
  .badge { grid-column: 1 / -1; justify-self: start; margin-top: 4px; }

  /* ── Forms ── */
  .two-col { grid-template-columns: 1fr; }

  /* ── Modals - bottom sheet ── */
  .modal-backdrop { padding: 0; align-items: flex-end; background: rgba(0,0,0,0.45); }
  .modal-card { width: 100%; max-height: 92vh; border-radius: 22px 22px 0 0; padding: 20px 16px 28px; margin: 0; }
  .modal-lg { width: 100%; }
  .modal-header h3 { font-size: 1.25rem; }
  .modal-footer { flex-direction: column; align-items: stretch; }
  .modal-footer .footer-actions { justify-content: space-between; }
  .modal-footer .btn-danger { margin-right: auto; }

  /* ── Category grid in quick-add ── */
  .category-grid { grid-template-columns: 1fr; gap: 10px; }
  .category-card { padding: 14px; display: flex; align-items: center; gap: 12px; }
  .category-card h3 { margin: 0; font-size: 0.95rem; }
  .category-card p { display: none; }
  .template-chip { font-size: 0.78rem; padding: 0.26rem 0.6rem; }

  /* ── Stats ── */
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card { padding: 16px; }
  .stat-card strong { font-size: 1.6rem; }

  /* ── FAB - centered bottom ── */
  .fab { right: 50%; transform: translateX(50%); bottom: 20px; width: 58px; height: 58px; border-radius: 20px; }

  /* ── Sidebar - full screen mobile ── */
  .sidebar { width: 100%; max-width: 100%; padding: 24px 22px; }
  .sidebar .brand { display: flex; align-items: center; gap: 0.75rem; padding-bottom: 20px; margin-bottom: 8px; border-bottom: 1px solid var(--border); }
  .sidebar .sidebar-section { margin-top: 24px; padding-top: 4px; }
  .sidebar-title { margin-bottom: 14px; }
  .nav-item, .category-item { padding: 14px 14px; font-size: 0.95rem; min-height: 48px; }
  .settings-item { padding: 14px 14px; font-size: 0.95rem; min-height: 48px; }
  .brand-logo { width: 34px; height: 34px; }
}

/* ══════════════════════════════════════════
   VERY SMALL (≤ 380px)
   ══════════════════════════════════════════ */
@media (max-width: 380px) {
  .hero-copy h1 { font-size: 1.6rem; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-card { padding: 12px; }
  .stat-card strong { font-size: 1.4rem; }
  .card { padding: 16px; border-radius: 18px; }
  .task-card { padding: 10px; border-radius: 14px; }
}

/* ══════════════════════════════════════════
   SETTINGS (v2)
   ══════════════════════════════════════════ */
.settings-grid-full { grid-template-columns: 1fr; }

.card-gradient-purple {
  background: linear-gradient(160deg, var(--surface) 0%, color-mix(in srgb, var(--surface) 86%, #a855f7) 100%);
  border-color: color-mix(in srgb, var(--border) 70%, #a855f7 30%);
}

.card-gradient-blue {
  background: linear-gradient(160deg, var(--surface) 0%, color-mix(in srgb, var(--surface) 86%, #3b82f6) 100%);
  border-color: color-mix(in srgb, var(--border) 70%, #3b82f6 30%);
}

.settings-card-header > div { display: flex; flex-direction: column; align-items: flex-start; }
.settings-card-header svg { width: 24px; height: 24px; margin-bottom: 6px; color: var(--accent-strong); }

.profile-line { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-form { display: grid; gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); }
.profile-form-grid { display: grid; gap: 12px; }
.field-group { display: grid; gap: 6px; }
.field-group .flabel { margin-bottom: 0; }
.profile-form-hint { margin: 0; font-size: 0.8rem; line-height: 1.5; }
.profile-form-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.onboarding-privacy { margin: 0; font-size: 0.8rem; line-height: 1.5; }

.segmented { display: inline-flex; gap: 4px; background: var(--surface-soft); border: 1px solid var(--border); border-radius: 999px; padding: 4px; }
.segmented button { border: 0; background: transparent; color: var(--muted); font-weight: 700; font-size: 0.86rem; padding: 0.45rem 0.9rem; border-radius: 999px; cursor: pointer; }
.segmented button.active { background: var(--accent); color: #fff; }

.palette-row { display: flex; gap: 8px; flex-wrap: wrap; }
.palette-chip { border: 2px solid var(--border); background: var(--surface); color: var(--text); font-weight: 700; font-size: 0.8rem; min-height: 34px; padding: 0 0.75rem; border-radius: 999px; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.palette-chip::before { content: ''; width: 12px; height: 12px; border-radius: 50%; background: var(--chip); }
.palette-chip.active { border-color: var(--chip); }

.sync-form { display: grid; gap: 8px; margin-top: 12px; }
.sync-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.sync-status-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px; border-radius: 16px; background: var(--surface-soft); }
.sync-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex-shrink: 0; }
.sync-dot[data-state="connected"] { background: var(--success); box-shadow: 0 0 0 4px color-mix(in srgb, var(--success) 25%, transparent); }
.sync-dot[data-state="syncing"] { background: var(--warning); animation: syncPulse 1s ease-in-out infinite; }
.sync-dot[data-state="error"] { background: var(--danger); }
.sync-error { font-size: 0.85rem; margin: 6px 4px 0; }
@keyframes syncPulse { 50% { opacity: 0.35; } }

.sync-how { margin-top: 14px; border: 1px solid var(--border); border-radius: 14px; padding: 12px; background: var(--surface-soft); }
.sync-how summary { font-weight: 700; cursor: pointer; margin-bottom: 6px; }
.sync-how-trigger { display: flex; align-items: center; gap: 6px; }
.sync-how ol { margin: 0 0 10px; padding-left: 20px; color: var(--muted); font-size: 0.86rem; line-height: 1.8; }
.sync-how pre { white-space: pre-wrap; word-break: break-word; background: var(--surface); border: 1px solid var(--border); color: var(--muted); border-radius: 12px; padding: 12px; font-size: 0.72rem; line-height: 1.6; max-height: 220px; overflow: auto; margin: 0 0 10px; }
.sync-how .btn { margin-top: 2px; }

/* ── Broadcast toasts & promo banner ── */
.broadcast-holder {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9998;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(92vw, 560px);
  pointer-events: none;
}
.bc-pill {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 12px;
  border-radius: 12px;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.45;
  text-decoration: none;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
  animation: bc-in 0.25s ease;
}
.bc-pill.bc-info    { background: #2563eb; }
.bc-pill.bc-warning { background: #d97706; }
.bc-pill.bc-success { background: #16a34a; }
.bc-pill.bc-error   { background: #dc2626; }
.bc-icon, .bc-extlink { flex-shrink: 0; width: 15px; height: 15px; }
.bc-pill .bc-text { flex: 1; min-width: 0; display: inline; }
.bc-pill .bc-title { font-weight: 700; }
.bc-pill .bc-extlink { margin-left: 4px; opacity: 0.85; }
.bc-close {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  opacity: 0.8;
  cursor: pointer;
}
.bc-close:hover { opacity: 1; background: rgba(255, 255, 255, 0.2); }
.bc-close svg { width: 14px; height: 14px; }
.bc-pill.bc-leaving { transition: transform 0.25s ease, opacity 0.25s ease; transform: translateX(-140%) !important; opacity: 0; }
@keyframes bc-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

.banner-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.banner-modal {
  position: relative;
  width: 100%;
  max-width: 420px;
  max-height: calc(100vh - 3rem);
  overflow: hidden auto;
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: bc-in 0.25s ease;
}
.banner-modal a { color: inherit; text-decoration: none; display: block; }
.banner-modal img.banner-img { display: block; width: 100%; max-height: 260px; object-fit: cover; }
.banner-modal .banner-body { padding: 1.1rem 1.25rem 1.35rem; }
.banner-modal .banner-body h2 { margin: 0 0 0.5rem; font-size: 1.05rem; }
.banner-modal .banner-body p { margin: 0; color: var(--muted); white-space: pre-line; font-size: 0.875rem; }
.banner-topbtn {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
}
.banner-topbtn.closeable { cursor: pointer; }
.banner-topbtn.closeable:hover { background: rgba(0, 0, 0, 0.65); }
.banner-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  cursor: pointer;
}
.banner-close:hover { background: rgba(0, 0, 0, 0.8); }
.banner-close svg { width: 16px; height: 16px; }

.settings-row .bc-device-id { display: block; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.78rem; letter-spacing: 0.02em; word-break: break-all; margin: 1px 0 3px; }
.settings-row .bc-device-hint { display: block; font-size: 0.76rem; }
