:root {
  --bg: #fafbfc;
  --surface: #ffffff;
  --surface-2: #f6f8fa;
  --surface-3: #eaeef2;
  --rail-bg: #1f2937;
  --rail-active: #db4c3f;
  --panel-bg: #f6f8fa;
  --border: #d0d7de;
  --border-strong: #afb8c1;
  --text: #1f2328;
  --muted: #656d76;
  --accent: #db4c3f;
  --accent-hover: #c53d31;
  --link: #0969da;
  --danger: #cf222e;
  --warning: #bf8700;
  --success: #1a7f37;
  --pri-top: #db4c3f;
  --pri-high: #d97706;
  --pri-med: #0969da;
  --pri-low: #8b949e;
  --pri-neg: #d0d7de;
  --rail-w: 56px;
  --panel-w: 240px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: 14px; line-height: 1.45;
  height: 100vh; overflow: hidden;
}
button { font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; }

/* ---------- Landing / Login ---------- */
.login-screen {
  display: none;
  height: 100vh;
  height: 100dvh;
  width: 100%;
  background: linear-gradient(180deg, #fafbfc 0%, #f6f8fa 60%, #eef1f4 100%);
  overflow-y: auto;
  overflow-x: hidden; /* marketing page scrolls vertically only */
  -webkit-overflow-scrolling: touch;
}
.landing {
  max-width: 1240px;
  margin: 0 auto;
  padding: 28px 28px 18px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-height: 100vh;
  box-sizing: border-box;
}
.landing-top {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(420px, 1.4fr);
  gap: 40px;
  align-items: center;
  flex: 0 0 auto;
  /* fill the first screen, but size to content (no flex-collapse/overflow) */
  min-height: calc(100vh - 80px);
}
.landing-hero { text-align: left; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.landing-logo {
  width: 64px;
  height: 64px;
  object-fit: contain;
  border-radius: 14px;
  box-shadow: 0 4px 14px rgba(31, 35, 40, 0.10);
  background: var(--surface);
  padding: 3px;
}
.landing-brand {
  font-size: 12px; font-weight: 600; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--accent);
}
.landing-headline {
  margin: 0;
  font-size: 36px;
  line-height: 1.1;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}
.landing-subhead {
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
  color: var(--muted);
}
.landing-cta {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
  width: 100%;
  max-width: 380px;
}
.landing-cta-divider {
  display: flex; align-items: center; gap: 10px;
  font-size: 12px; color: var(--muted);
}
.landing-cta-divider::before, .landing-cta-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}
.landing-cta-secondary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.landing-disclaimer { margin: 4px 0 0; font-size: 12px; }

/* Trust row — honest, prominent signals at the CTA */
.landing-trust {
  list-style: none; margin: 14px 0 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 7px 16px;
}
.landing-trust li {
  display: flex; align-items: center; gap: 6px;
  font-size: 12.5px; color: var(--muted);
}
.landing-trust li::before {
  content: '✓'; color: var(--success); font-weight: 700; font-size: 12px;
}

/* Animated daily-brief demo (replaces the static screenshot) */
.brief-demo {
  width: 100%; max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 18px 50px rgba(31, 35, 40, 0.16);
  overflow: hidden;
  font-size: 13px;
}
.bd-bar {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.bd-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--border-strong); }
.bd-dot:nth-child(1) { background: #ff5f57; }
.bd-dot:nth-child(2) { background: #febc2e; }
.bd-dot:nth-child(3) { background: #28c840; }
.bd-title { margin-left: 8px; font-weight: 700; color: var(--text); }
.bd-date { margin-left: auto; font-size: 12px; color: var(--muted); }
.bd-body { padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.bd-focus-card {
  background: rgba(219, 76, 63, 0.06);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: 10px 12px;
  min-height: 74px;
  line-height: 1.5;
}
.bd-thinking { display: flex; align-items: center; gap: 7px; color: var(--muted); font-style: italic; }
.bd-spark { font-style: normal; }
.bd-dots { display: inline-flex; gap: 3px; }
.bd-dots i { width: 4px; height: 4px; border-radius: 50%; background: var(--accent); animation: bdpulse 1s infinite; }
.bd-dots i:nth-child(2) { animation-delay: 0.15s; }
.bd-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes bdpulse { 0%, 100% { opacity: 0.25; } 50% { opacity: 1; } }
.bd-focus { color: var(--text); }
.bd-focus-label { font-weight: 700; color: var(--accent); margin-right: 6px; }
.bd-caret {
  display: inline-block; width: 2px; height: 1em; margin-left: 1px;
  background: var(--accent); vertical-align: -2px;
  animation: bdblink 1s step-end infinite;
}
@keyframes bdblink { 50% { opacity: 0; } }
.bd-hide { display: none; }
.bd-changes { font-size: 11px; color: var(--muted); }
.bd-tasks { display: flex; flex-direction: column; gap: 6px; }
.bd-task {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 8px;
}
.bd-task-dim { opacity: 0.6; }
.bd-check { width: 16px; height: 16px; border: 2px solid var(--border-strong); border-radius: 50%; flex-shrink: 0; }
.bd-task-title { flex: 1; color: var(--text); }
.bd-chip { font-size: 10px; font-weight: 600; padding: 2px 7px; border-radius: 5px; white-space: nowrap; }
.bd-chip-p3 { background: var(--accent); color: #fff; }
.bd-chip-today { background: #fff3cd; color: #8a6d00; }
.bd-chip-push { background: var(--surface-3); color: var(--muted); }
.bd-chip-folder { background: #ddf4ff; color: #0969da; }
.bd-chip-ctx { background: #e7e0ff; color: #6639ba; }

/* ---------- Landing: scrolling marketing sections ---------- */
.landing-section-title {
  margin: 0; text-align: center;
  font-size: 26px; font-weight: 700; letter-spacing: -0.01em; color: var(--text);
}
.landing-section-sub {
  margin: 8px 0 0; text-align: center;
  font-size: 14px; color: var(--muted);
}

/* How it works — 3 steps */
.landing-how { padding: 44px 0 8px; }
.how-steps {
  margin-top: 26px;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px;
}
.how-step {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px 20px 20px;
  display: flex; flex-direction: column; gap: 8px;
}
.how-num {
  position: absolute; top: -14px; left: 20px;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
  box-shadow: 0 2px 8px rgba(219, 76, 63, 0.35);
}
.how-step svg { width: 24px; height: 24px; color: var(--accent); }
.how-step h3 { margin: 4px 0 0; font-size: 16px; color: var(--text); }
.how-step p { margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--muted); }
.how-step code {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 4px; padding: 1px 5px; font-size: 12px; color: var(--text);
  white-space: nowrap;
}

/* Alternating benefit rows */
.landing-benefits { padding: 36px 0; display: flex; flex-direction: column; gap: 36px; }
.benefit-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 36px; align-items: center;
}
.benefit-row-reverse .benefit-text { order: 2; }
.benefit-row-reverse .benefit-visual { order: 1; }
.benefit-kicker {
  font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--accent);
}
.benefit-text h3 { margin: 8px 0 6px; font-size: 21px; line-height: 1.2; color: var(--text); }
.benefit-text p { margin: 0; font-size: 14.5px; line-height: 1.55; color: var(--muted); }
.benefit-visual {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 10px 30px rgba(31, 35, 40, 0.08);
  display: flex; flex-direction: column; gap: 10px;
}
/* let grid/flex items shrink so demo rows can't blow the 1fr track past the viewport */
.benefit-text, .benefit-visual { min-width: 0; }
.bd-task, .bd-quickadd { min-width: 0; }
.bd-task-title { min-width: 0; }
.benefit-visual .bd-focus-card { min-height: 0; }
.bd-quickadd {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; background: var(--surface-2);
}
.bd-quickadd svg { width: 18px; height: 18px; color: var(--muted); flex-shrink: 0; }
.bd-quickadd-text { font-size: 13.5px; color: var(--text); }
.bd-quickadd-text em { font-style: normal; color: var(--accent); font-weight: 600; }
.bd-parsed { display: flex; flex-wrap: wrap; gap: 6px; }

/* Real-screenshot showcase */
.landing-showcase { padding: 28px 0 8px; text-align: center; }
.landing-showcase-shot {
  margin-top: 22px; width: 100%; max-width: 880px; height: auto;
  border-radius: 12px; border: 1px solid var(--border);
  box-shadow: 0 16px 50px rgba(31, 35, 40, 0.16);
  background: var(--surface);
}

/* Closing CTA band */
.landing-final-cta {
  margin: 44px 0 8px;
  padding: 40px 24px;
  text-align: center;
  background: linear-gradient(135deg, rgba(219, 76, 63, 0.07), rgba(9, 105, 218, 0.05));
  border: 1px solid var(--border);
  border-radius: 18px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.landing-final-cta h2 { margin: 0; font-size: 24px; font-weight: 700; color: var(--text); }
.landing-final-cta p { margin: 0 0 8px; font-size: 14px; color: var(--muted); }
.landing-final-cta .login-btn-primary { width: auto; min-width: 240px; }

@media (max-width: 760px) {
  .how-steps { grid-template-columns: 1fr; gap: 26px; }
  .benefit-row, .benefit-row-reverse { grid-template-columns: 1fr; gap: 16px; }
  .benefit-row-reverse .benefit-text { order: 0; }
  .benefit-row-reverse .benefit-visual { order: 0; }
  .benefit-text h3 { font-size: 19px; }
  .landing-section-title { font-size: 22px; }
}
.landing-shot-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  min-width: 0;
}
.landing-shot {
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: 70vh;
  object-fit: contain;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: 0 12px 40px rgba(31, 35, 40, 0.12);
  background: var(--surface);
}
.landing-feature-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.landing-feature-mini {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}
.landing-feature-mini svg {
  width: 18px; height: 18px; flex-shrink: 0; color: var(--accent);
}
.landing-feature-mini strong { color: var(--text); font-weight: 600; }
.landing-footer { text-align: center; }
@media (max-width: 500px) {
  .landing-footer { display: flex; flex-direction: column; gap: 4px; }
  .landing-footer-sep { display: none; }
}

/* ---------- Shopping page ---------- */
.lists-page { padding: 18px 22px; overflow-y: auto; }
.lists-content { max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.lists-header h2 { margin: 0; font-size: 22px; }
.lists-header p { margin: 4px 0 0; }
.lists-header-title { display: flex; align-items: center; gap: 8px; }
.lists-list-rename, .lists-list-delete {
  width: 28px; height: 28px; padding: 0;
  border: 1px solid transparent; border-radius: 6px;
  background: transparent; color: var(--muted);
  font-family: inherit; font-size: 14px; cursor: pointer;
}
.lists-list-rename:hover { color: var(--accent); border-color: var(--border); }
.lists-list-delete:hover { color: var(--accent); border-color: var(--border); }

/* Side panel (list of stores) */
.lists-panel { display: flex; flex-direction: column; gap: 10px; padding: 8px 6px; }
.lists-panel-rows { display: flex; flex-direction: column; gap: 2px; }
.lists-list-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 12px;
  border: 0; background: transparent;
  border-radius: 6px;
  font: inherit; color: var(--text);
  cursor: pointer; text-align: left;
}
.lists-list-row:hover { background: var(--surface-2); }
.lists-list-row.is-active { background: var(--accent); color: #fff; }
.lists-list-row.is-active .lists-list-name { color: #fff; }
.lists-list-name { font-size: 14px; font-weight: 500; }
.lists-list-badge {
  min-width: 22px; padding: 1px 8px;
  background: var(--surface-3); color: var(--text);
  border-radius: 12px;
  font-size: 11px; font-weight: 600;
}
.lists-list-row.is-active .lists-list-badge { background: rgba(255,255,255,0.25); color: #fff; }
.lists-list-add {
  margin: 4px 6px 0;
  padding: 8px 12px;
  border: 1px dashed var(--border); border-radius: 6px;
  background: transparent; color: var(--muted);
  font: inherit; font-size: 13px; cursor: pointer;
}
.lists-list-add:hover { color: var(--accent); border-color: var(--accent); }

/* Main area */
.lists-add-form {
  display: flex; gap: 8px; align-items: center;
  padding: 6px; background: var(--surface-2); border-radius: 8px;
}
.lists-add-form input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface); color: var(--text);
  font: inherit;
}
.lists-add-form input:focus { outline: none; border-color: var(--accent); }
.lists-add-state-chips { display: inline-flex; gap: 4px; }
.lists-add-chip {
  padding: 4px 12px;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--muted);
  font: inherit; font-size: 12px; cursor: pointer;
}
.lists-add-chip:hover { border-color: var(--accent); color: var(--accent); }
.lists-add-chip.is-active { background: var(--accent); color: #fff; border-color: var(--accent); }

.lists-section-label {
  margin-top: 4px;
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text); font-weight: 600;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.lists-section-label.muted { color: var(--muted); font-weight: 500; }
.lists-clear-cart {
  padding: 3px 10px;
  font-size: 12px; font-weight: 500;
  text-transform: none; letter-spacing: 0;
  border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
  border-radius: 6px;
}
.lists-clear-cart:hover { border-color: var(--accent); color: var(--accent); }
.lists-section-count {
  display: inline-block; padding: 1px 8px;
  background: var(--surface-3); color: var(--text);
  border-radius: 10px;
  font-size: 11px; font-weight: 600; letter-spacing: 0;
}

.lists-list { display: flex; flex-direction: column; gap: 4px; }
.lists-row {
  display: grid;
  grid-template-columns: 32px 1fr 28px 32px;
  align-items: center; gap: 8px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px;
}
.lists-row.is-list { opacity: 0.65; }
.lists-row.is-buy {
  /* Row stays neutral; the red toggle on the left is the visual cue. */
}
.lists-row.is-cart {
  opacity: 0.55;
  background: var(--surface-2);
}
.lists-row.is-cart .lists-row-title { text-decoration: line-through; }

.lists-row-toggle {
  width: 28px; height: 28px; padding: 0;
  border: 1px solid var(--border); border-radius: 50%;
  background: var(--surface); color: var(--muted);
  font-size: 14px; font-family: inherit; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.lists-row.is-buy .lists-row-toggle {
  background: rgba(219, 76, 63, 0.15);
  color: var(--accent);
  border-color: rgba(219, 76, 63, 0.5);
}
.lists-row.is-cart .lists-row-toggle {
  background: var(--success, #1a7f37); color: #fff; border-color: var(--success, #1a7f37);
}
.lists-row-title {
  font-size: 15px;
  flex: 1 1 auto;
  text-align: left;
  background: transparent; border: 0; padding: 4px 6px;
  color: inherit; font-family: inherit;
  cursor: pointer; border-radius: 4px;
  white-space: normal; word-break: break-word;
}
.lists-row-title:hover { background: var(--surface-3); }
.lists-row-title:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.lists-row-revert {
  width: 24px; height: 24px; padding: 0;
  border: 1px solid transparent; border-radius: 6px;
  background: transparent; color: var(--muted);
  font-size: 14px; font-family: inherit; cursor: pointer;
}
.lists-row-revert:hover { background: var(--surface-3); color: var(--text); border-color: var(--border); }
.lists-row-revert-spacer { display: inline-block; width: 24px; }
.lists-row-remove {
  width: 28px; height: 28px; padding: 0;
  border: 0; background: transparent;
  color: var(--muted); font-size: 18px; cursor: pointer;
  border-radius: 6px;
}
.lists-row-remove:hover { background: var(--surface-3); color: var(--accent); }

.lists-bottom-bar {
  position: sticky; bottom: 0;
  padding: 12px 0 calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, transparent 0%, var(--surface) 30%);
  display: flex; justify-content: center;
}
.lists-empty { display: flex; flex-direction: column; gap: 12px; padding: 24px 0; }

/* In-app modal for create / edit list */
.lists-modal {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  z-index: 9100;
  opacity: 0;
  transition: opacity 0.18s ease;
  pointer-events: none;
}
.lists-modal.open { opacity: 1; pointer-events: auto; }
.lists-modal-card {
  width: 480px; max-width: calc(100vw - 32px);
  max-height: calc(100vh - 32px);
  background: var(--surface);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.lists-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.lists-modal-header h3 { margin: 0; font-size: 16px; }
.lists-modal-close {
  width: 28px; height: 28px; padding: 0;
  border: 0; background: transparent;
  color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer;
  border-radius: 6px;
}
.lists-modal-close:hover { background: var(--surface-2); color: var(--text); }
.lists-modal-form {
  padding: 16px 18px;
  display: flex; flex-direction: column; gap: 12px;
  overflow-y: auto;
}
.lists-modal-field { display: flex; flex-direction: column; gap: 4px; }
.lists-modal-field span { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.lists-modal-field input {
  padding: 8px 12px;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface); color: var(--text);
  font: inherit;
}
.lists-modal-field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(219, 76, 63, 0.15); }
.lists-modal-hint {
  margin: 0; padding: 8px 10px;
  background: var(--surface-2);
  border-radius: 6px;
  font-size: 12px; color: var(--muted); line-height: 1.5;
}
.lists-modal-hint em { color: var(--text); font-style: normal; font-weight: 500; }
.lists-modal-actions {
  display: flex; justify-content: flex-end; gap: 8px;
  margin-top: 4px;
}

/* ---------- Analytics page ---------- */
.analytics-page { flex: 1; min-height: 0; overflow-y: auto; }
.analytics-page[hidden] { display: none; }
.analytics-content { padding: 22px 28px 60px; display: flex; flex-direction: column; gap: 16px; }
.analytics-page-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  border-bottom: 1px solid var(--border); padding-bottom: 12px;
}
.analytics-page-header h2 { margin: 0; font-size: 20px; }
.analytics-month-picker { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.analytics-month-picker input[type="month"] {
  padding: 5px 8px; border: 1px solid var(--border); border-radius: 4px;
  background: var(--surface); color: var(--text); font-family: inherit; font-size: 13px;
}
.analytics-body { display: flex; flex-direction: column; gap: 14px; }
.analytics-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.analytics-stat {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  text-align: center;
}
.analytics-stat-value { font-size: 22px; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.analytics-stat-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin-top: 4px; }
.analytics-stat-sub { font-size: 11px; color: var(--muted); margin-top: 2px; font-variant-numeric: tabular-nums; }
.analytics-stats { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.analytics-subheader { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 600; margin: 16px 0 8px; }
.analytics-pages { display: flex; flex-wrap: wrap; gap: 6px; }
.analytics-user-pages { display: flex; flex-wrap: wrap; gap: 4px; }
.analytics-user-pages .analytics-page-pill { padding: 2px 8px; font-size: 11px; }
.analytics-page-pill {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 12px;
  color: var(--muted);
}
.analytics-page-pill strong { color: var(--text); margin-left: 4px; }
.analytics-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.analytics-table thead th {
  text-align: left; padding: 6px 10px; border-bottom: 2px solid var(--border);
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted);
}
.analytics-table th.num, .analytics-table td.num { text-align: right; }
.analytics-table td { padding: 6px 10px; border-bottom: 1px solid var(--border); }
.analytics-user-name { font-weight: 600; }
.analytics-user-email { font-size: 11px; color: var(--muted); }
@media (max-width: 900px) {
  .landing {
    gap: 18px;
    padding: 22px 18px calc(28px + env(safe-area-inset-bottom));
    min-height: 0;
  }
  .landing-top { grid-template-columns: 1fr; gap: 22px; flex: 0 0 auto; align-items: stretch; min-height: 0; }
  .landing-headline { font-size: 28px; }
  .landing-shot { max-height: none; }
  .landing-feature-strip { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 500px) {
  .landing-feature-strip { grid-template-columns: 1fr; }
  .landing-hero { align-self: stretch; }
  .landing-cta { max-width: none; }
  .landing-email-form { width: 100%; }
}

.login-btn {
  padding: 11px 18px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text);
  font-size: 14px; font-weight: 500; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  gap: 10px;
  font-family: inherit;
}
.login-btn:hover { background: var(--surface-2); }
.login-btn-microsoft:hover { background: var(--surface-2); }
.login-btn-apple:hover { background: var(--surface-2); }

/* Primary CTA — one dominant button (Google), others demoted below */
.login-btn-primary {
  width: 100%;
  padding: 14px 18px;
  font-size: 15px;
  font-weight: 600;
  border-color: var(--border-strong);
  box-shadow: 0 2px 8px rgba(31, 35, 40, 0.10);
}
.login-btn-primary:hover { background: var(--surface); box-shadow: 0 5px 16px rgba(31, 35, 40, 0.16); }
.login-btn-sm { padding: 9px 8px; font-size: 13px; font-weight: 500; gap: 7px; }

.login-btn-email-toggle {
  background: var(--surface);
  color: var(--text);
}
.landing-email-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 360px;
}
.landing-email-form[hidden] { display: none; }
.landing-email-form input[type="email"],
.landing-email-form input[type="password"] {
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}
.landing-email-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(219, 76, 63, 0.15);
}
.landing-email-actions { display: flex; gap: 8px; }
.landing-email-actions .login-btn { flex: 1; }
.login-btn-email-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.login-btn-email-primary:hover { background: #c43d31; }
.login-btn-email-secondary { background: var(--surface); color: var(--text); }
.landing-email-reset {
  background: none;
  border: none;
  color: var(--link);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  padding: 4px;
  align-self: center;
}
.landing-email-reset:hover { text-decoration: underline; }

@media (max-width: 600px) {
  .landing { padding: 36px 18px 24px; gap: 32px; }
  .landing-headline { font-size: 30px; }
  .landing-subhead { font-size: 15px; }
}

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

/* ---------- Icon rail ---------- */
.icon-rail {
  width: var(--rail-w);
  flex-shrink: 0;
  background: var(--rail-bg);
  display: flex; flex-direction: column;
  align-items: center;
  padding: 8px 0;
  gap: 4px;
}
.rail-btn {
  width: 40px; height: 40px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.1s, color 0.1s;
}
.rail-btn svg { width: 20px; height: 20px; }
.rail-btn:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.rail-btn.active { background: var(--rail-active); color: #fff; }
.rail-collapse { color: rgba(255, 255, 255, 0.5); margin-bottom: 4px; }
.rail-collapse svg { transition: transform 0.15s ease; }
.app-shell:has(.panel.hidden) .rail-collapse svg { transform: rotate(180deg); }
.rail-spacer { flex: 1; }
.rail-btn[data-panel="aiplan"] { color: #ffd166; }
.rail-btn[data-panel="aiplan"]:hover { color: #fff; background: rgba(255, 209, 102, 0.2); }
.rail-btn[data-panel="aiplan"].active { background: linear-gradient(135deg, #ffd166, #db4c3f); color: #fff; }
.rail-bottom { margin-bottom: 8px; }

/* ---------- Panel ---------- */
.panel {
  width: var(--panel-w);
  flex-shrink: 0;
  background: var(--panel-bg);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden;
  transition: margin-left 0.2s ease;
}
.panel.hidden { margin-left: calc(-1 * var(--panel-w)); }
.panel-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-bg);
  color: var(--text);
}
.panel-title {
  margin: 0;
  font-size: 16px; font-weight: 600;
}
.panel-content {
  flex: 1;
  overflow-y: auto;
}
.panel-list {
  list-style: none;
  margin: 0; padding: 4px 0;
}
.panel-item {
  padding: 8px 16px;
  cursor: pointer;
  display: flex; align-items: center;
  font-size: 14px;
  color: var(--text);
  transition: background 0.1s;
}
.panel-item:hover { background: var(--surface-3); }
.panel-item.active {
  background: var(--surface);
  color: var(--accent);
  font-weight: 600;
  border-left: 3px solid var(--accent);
  padding-left: 13px;
}
.panel-item-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.panel-item-count {
  font-size: 12px;
  color: var(--muted);
  font-weight: 400;
}
.panel-item.active .panel-item-count { color: var(--accent); }
.panel-manage-row { padding: 6px 12px 4px; }
.panel-manage-btn {
  width: 100%; padding: 6px 10px;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface); color: var(--muted);
  font: inherit; font-size: 12px; cursor: pointer;
}
.panel-manage-btn:hover { border-color: var(--accent); color: var(--accent); }

/* Manage modal — table-style list with inline rename + × delete */
.manage-modal-card { width: 560px; }
.manage-modal-body { padding: 12px 18px 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.manage-add-row {
  display: flex; gap: 8px; align-items: center;
  padding: 8px;
  background: var(--surface-2);
  border-radius: 6px;
  margin-bottom: 8px;
}
.manage-add-row input {
  flex: 1;
  padding: 7px 10px;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface); color: var(--text);
  font: inherit;
}
.manage-add-row input:focus { outline: none; border-color: var(--accent); }
.manage-row {
  display: grid;
  grid-template-columns: 1fr auto 48px 28px;
  align-items: center; gap: 8px;
  padding: 4px 0;
}
.manage-row-kind {
  padding: 3px 8px;
  border: 1px solid var(--border); border-radius: 999px;
  background: transparent; color: var(--muted);
  font: inherit; font-size: 11px; line-height: 1.4;
  cursor: pointer; white-space: nowrap;
}
.manage-row-kind:hover { color: var(--text); border-color: var(--accent); }
.manage-row-kind[data-kind="list"] { color: var(--accent); border-color: var(--accent); }
.manage-row-name {
  padding: 6px 10px;
  border: 1px solid transparent; border-radius: 4px;
  background: transparent; color: var(--text);
  font: inherit;
}
.manage-row-name:hover { border-color: var(--border); }
.manage-row-name:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 2px rgba(219, 76, 63, 0.15); }
.manage-row-count {
  text-align: right;
  font-size: 12px; color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.manage-row-delete {
  width: 26px; height: 26px; padding: 0;
  border: 1px solid transparent; border-radius: 4px;
  background: transparent; color: var(--muted);
  font: inherit; font-size: 16px; line-height: 1; cursor: pointer;
}
.manage-row-delete:hover:not(:disabled) { background: var(--surface-3); color: var(--accent); border-color: var(--border); }
.manage-row-delete:disabled { opacity: 0.3; cursor: not-allowed; }
.panel-section {
  padding: 14px 16px 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.5px;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  background: var(--surface-3);
}
.panel-section:hover { color: var(--text); }
.collapse-arrow {
  display: inline-block;
  width: 8px; height: 8px;
  margin-right: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.15s;
}
.panel-section.collapsed .collapse-arrow { transform: rotate(-45deg); }

/* ---------- Main area ---------- */
.main-area {
  flex: 1;
  display: flex; flex-direction: column;
  min-width: 0; overflow: hidden;
}

.app-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  background: var(--panel-bg);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.mobile-menu-btn {
  display: none;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  width: 36px;
  height: 36px;
  border-radius: 6px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}
.mobile-menu-btn:hover { background: var(--surface-2); }
.header-title { font-size: 18px; font-weight: 600; margin: 0; }
.header-spacer { flex: 1; }
.task-count { font-size: 13px; color: var(--muted); }
.sync-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  margin-left: 8px;
}
.sync-indicator[hidden] { display: none; }

/* ---------- Home / Command Center ---------- */
.app-shell.home-mode .panel { display: none; }
.home-page { flex: 1; min-height: 0; overflow-y: auto; }
.home-page[hidden] { display: none; }
.home-content { padding: 22px 28px 60px; display: flex; flex-direction: column; gap: 18px; }
.home-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.home-greet { font-size: 18px; font-weight: 600; color: var(--text); }
.home-refresh { padding: 4px 10px; font-size: 14px; }
.home-header-actions { display: flex; align-items: center; gap: 10px; }
.home-reschedule-picker {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 8px;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface);
  font-size: 12px;
}
.home-reschedule-picker input[type="date"] {
  border: 0; background: transparent; padding: 0;
  font: inherit; color: var(--text);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.home-reschedule-picker input[type="date"]:focus { outline: none; }
.home-brief {
  background: var(--surface-2);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: 12px 16px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  white-space: pre-wrap;
}
.home-filter-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.home-filter-chip {
  padding: 4px 10px;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--muted);
  font: inherit; font-size: 12px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.home-filter-chip:hover { border-color: var(--accent); color: var(--accent); }
.home-filter-chip.is-active { background: var(--accent); color: #fff; border-color: var(--accent); }
.home-filter-chip-count {
  display: inline-block; min-width: 18px; padding: 0 6px;
  background: var(--surface-3); color: var(--text);
  border-radius: 999px; font-size: 11px; font-weight: 600;
}
.home-filter-chip.is-active .home-filter-chip-count { background: rgba(255,255,255,0.25); color: #fff; }
.home-section { display: flex; flex-direction: column; gap: 6px; }
.home-section-title { margin: 0 0 4px; font-size: 14px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.home-section-count { display: inline-block; margin-left: 6px; padding: 1px 8px; background: var(--surface-3); color: var(--text); border-radius: 10px; font-size: 11px; font-weight: 600; }
.home-empty { padding: 12px; background: var(--surface-2); border-radius: 6px; font-size: 13px; }
.home-ai-setup { display: flex; flex-direction: column; gap: 10px; position: relative; }
.home-ai-setup-dismiss {
  position: absolute; top: 4px; right: 4px;
  width: 28px; height: 28px; padding: 0;
  background: transparent; border: 0; border-radius: 6px;
  color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer;
}
.home-ai-setup-dismiss:hover { background: var(--surface-3); color: var(--text); }
.home-ai-setup-title { font-size: 15px; font-weight: 600; color: var(--text); }
.home-ai-setup-sub { font-size: 13px; color: var(--muted); line-height: 1.5; }
.home-ai-setup-steps { margin: 4px 0 4px 18px; padding: 0; font-size: 13px; line-height: 1.7; color: var(--text); }
.home-ai-setup-steps li { margin-bottom: 2px; }
.home-ai-setup-steps code { background: var(--surface-3); padding: 1px 6px; border-radius: 4px; font-size: 12px; }
.home-ai-setup-btn { align-self: flex-start; margin-top: 4px; }
.home-ai-setup-note { margin-top: 2px; }
.home-list { display: flex; flex-direction: column; gap: 4px; }
.home-row {
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
}
.home-row.has-sug { box-shadow: 0 0 0 2px rgba(255, 209, 102, 0.4); border-color: #ffd166; }
.home-row.has-pending-manual { box-shadow: 0 0 0 2px rgba(9, 105, 218, 0.3); border-color: var(--link); }
.home-row-manual-badge { background: var(--link) !important; color: #fff !important; }
.home-row-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.home-row-title-line { display: flex; align-items: center; gap: 12px; min-width: 0; }
.home-row-title-line .home-row-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-row:hover { background: var(--surface-2); }
.home-row-body { min-width: 0; }
.home-row-title { font-size: 14px; font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-row-star { color: var(--warning); }
.home-row-meta { font-size: 12px; }
.home-row-chips { display: flex; gap: 2px; flex-shrink: 0; }
.home-row-chips .rs-chip {
  width: 22px; height: 22px;
  padding: 0;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.home-row-chips .rs-chip:hover { border-color: var(--accent); color: var(--accent); }
.home-row-chips .rs-chip.is-today { background: var(--accent); border-color: var(--accent); color: #fff; }
.home-row-chips .rs-chip.is-tomorrow { background: var(--link); border-color: var(--link); color: #fff; }
.home-row-chips .rs-chip.is-selected { background: var(--success); border-color: var(--success); color: #fff; box-shadow: 0 0 0 2px rgba(26, 127, 55, 0.25); }
.home-row-chips .rs-chip.is-current {
  background: rgba(219, 76, 63, 0.15);
  border-color: rgba(219, 76, 63, 0.5);
  color: var(--accent);
}
.home-row-chips .rs-chip-plus5 {
  width: auto;
  padding: 0 6px;
  margin-left: 4px;
  border-style: dashed;
}
.home-row-chips .rs-chip-plus5:hover { border-style: solid; }
.home-row-pris { display: flex; gap: 2px; flex-shrink: 0; }
.home-row-pris .pri-chip {
  min-width: 28px; height: 22px; padding: 0 6px;
  border: 1px solid var(--border); background: var(--surface);
  border-radius: 4px; font-size: 11px; font-weight: 600; font-family: inherit;
  color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.home-row-pris .pri-chip:hover { border-color: var(--accent); color: var(--accent); }
.home-row-pris .pri-chip.pri-3 { color: var(--pri-top); }
.home-row-pris .pri-chip.pri-2 { color: var(--pri-high); }
.home-row-pris .pri-chip.pri-1 { color: var(--pri-med); }
.home-row-pris .pri-chip.pri-0 { color: var(--pri-low); }
.home-row-pris .pri-chip.pri-neg { color: var(--pri-neg); }
.home-row-pris .pri-chip.is-selected {
  background: var(--success); border-color: var(--success); color: #fff;
  box-shadow: 0 0 0 2px rgba(26, 127, 55, 0.25);
}
.home-row-pris .pri-chip.is-current {
  background: rgba(219, 76, 63, 0.15);
  border-color: rgba(219, 76, 63, 0.5);
  color: var(--accent);
}
.home-row-sug-inline { display: inline-flex; align-items: center; gap: 6px; color: var(--text); flex-wrap: wrap; }
.home-row-diff { font-weight: 600; font-size: 12px; }
.home-row-diff .diff-was { color: var(--accent); background: rgba(219, 76, 63, 0.12); padding: 1px 6px; border-radius: 3px; }
.home-row-diff .diff-new { color: var(--success); background: rgba(26, 127, 55, 0.12); padding: 1px 6px; border-radius: 3px; }
.home-row-sug-badge {
  background: #ffd166; color: #5a4200;
  padding: 1px 6px; border-radius: 3px;
  font-weight: 700; font-size: 10px; letter-spacing: 0.04em;
}
.home-row-sug-reason { font-size: 12px; }
.home-row-date-btn {
  margin-left: 6px;
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.home-row-date-btn svg { color: var(--muted); }
.home-row-date-btn:hover svg { color: var(--accent); }
.home-row-date-btn:hover { border-color: var(--accent); background: var(--surface-2); }
.home-row-actions { display: flex; gap: 4px; }
.home-row-actions.is-disabled button {
  opacity: 0.25;
  cursor: not-allowed;
  pointer-events: none;
}
.home-row-actions button {
  width: 24px; height: 24px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 4px; cursor: pointer;
  font-size: 13px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.home-row-actions .home-sug-accept { color: var(--success); }
.home-row-actions .home-sug-accept:hover { background: var(--success); color: #fff; border-color: var(--success); }
.home-row-actions .home-sug-skip { color: var(--muted); }
.home-row-actions .home-sug-skip:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.home-suggest-state { padding: 0 4px; }
.home-row.pri-top { border-left: 3px solid var(--pri-top); }
.home-row.pri-high { border-left: 3px solid var(--pri-high); }
.home-row.pri-med { border-left: 3px solid var(--pri-med); }
.home-row.pri-low { border-left: 3px solid var(--pri-low); }
.home-row.pri-neg { border-left: 3px solid var(--pri-neg); }

@media (max-width: 768px) {
  .home-content { padding: 14px 12px 80px; }
  .home-row { grid-template-columns: 26px 1fr; gap: 10px; padding: 8px 10px; }
  .home-row-title-line { flex-wrap: wrap; }
}
.sync-indicator .sync-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: sync-pulse 1.1s ease-in-out infinite;
}
@keyframes sync-pulse {
  0%, 100% { opacity: 0.3; transform: scale(0.85); }
  50%      { opacity: 1;   transform: scale(1.15); }
}
.filter-search {
  width: 240px;
  padding: 6px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
}
.filter-search:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(219, 76, 63, 0.2);
}

/* Profile menu */
.profile-menu { position: relative; }
.profile-icon-btn {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.profile-icon-btn:hover { background: var(--surface-3); }
.profile-dropdown {
  position: absolute; right: 0; top: 40px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-width: 220px;
  padding: 8px;
  display: none;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(31, 35, 40, 0.1);
}
.profile-dropdown.open { display: block; }
.profile-dropdown-name { padding: 6px 10px; font-weight: 600; }
.profile-dropdown-email { padding: 0 10px 8px; color: var(--muted); font-size: 12px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.profile-dropdown-logout, .profile-dropdown-link {
  width: 100%; padding: 8px 10px; border: none; background: transparent;
  color: var(--text); cursor: pointer; text-align: left; border-radius: 4px;
  font-size: 13px;
}
.profile-dropdown-logout:hover, .profile-dropdown-link:hover { background: var(--surface-2); }
.profile-dropdown-link { border-bottom: 1px solid var(--border); padding-bottom: 8px; margin-bottom: 4px; }

/* ---------- Bulk bar ---------- */
.bulk-bar {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--accent);
  color: #fff;
  flex-shrink: 0;
}
.bulk-bar.visible { display: flex; }
.bulk-bar .btn { background: rgba(255, 255, 255, 0.2); border-color: rgba(255, 255, 255, 0.3); color: #fff; }
.bulk-bar .btn:hover { background: rgba(255, 255, 255, 0.3); }
.bulk-date-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #fff;
}
.bulk-date {
  padding: 5px 8px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border-radius: 6px;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  color-scheme: dark;
}
.bulk-date:focus { outline: none; border-color: #fff; }
.bulk-count { font-size: 13px; font-weight: 500; margin-right: 8px; }
.bulk-bar .spacer { flex: 1; }

/* ---------- Task table ---------- */
#app-content {
  flex: 1;
  overflow: auto;
  background: var(--surface);
}
.task-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.task-table thead th {
  position: sticky; top: 0; z-index: 5;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  padding: 8px 10px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  white-space: nowrap;
  user-select: none;
}
.task-table th.sortable { cursor: pointer; }
.task-table th.sortable:hover { background: var(--surface-3); color: var(--text); }
.task-table th.sortable::after {
  content: '';
  display: inline-block;
  width: 8px; height: 8px;
  margin-left: 4px;
  opacity: 0.3;
}
.task-table th.sort-asc::after { content: ' ▲'; opacity: 1; }
.task-table th.sort-desc::after { content: ' ▼'; opacity: 1; }
.task-table th.sort-secondary::after { opacity: 0.45; }
.task-table tbody tr {
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.1s;
}
.task-table tbody tr:hover { background: var(--surface-2); }
.task-table tbody tr.selected { background: rgba(9, 105, 218, 0.08); }
.task-table tbody tr.task-row-completed .col-title { text-decoration: line-through; color: var(--muted); }
/* Subtask indent (desktop table) */
.task-row.task-row-child .col-check { padding-left: calc(14px + var(--depth, 1) * 20px); }
.task-row.task-row-child .col-title { color: var(--muted); }
.task-row.task-row-child .col-title .title-text::before {
  content: '↳';
  margin-right: 6px;
  color: var(--muted);
  opacity: 0.7;
}
.task-table td { padding: 6px 10px; vertical-align: middle; }
.col-check { width: 36px; padding-left: 14px; }
.col-priority { width: 90px; white-space: nowrap; }
.col-due { width: 110px; white-space: nowrap; }
.col-context { width: 130px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.col-folder { width: 110px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.col-star { width: 30px; text-align: center; color: var(--warning); }
.col-reschedule { width: 360px; white-space: nowrap; }
.col-reschedule .rs-chip-plus5 {
  width: auto;
  padding: 0 6px;
  margin-left: 4px;
  border-style: dashed;
}
.col-reschedule .rs-chip-plus5:hover { border-style: solid; }
.col-reschedule .home-row-date-btn { margin-left: 6px; vertical-align: middle; }
.col-reschedule .rs-chip {
  width: 22px;
  height: 22px;
  padding: 0;
  margin-right: 2px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.col-reschedule .rs-chip:hover { border-color: var(--accent); color: var(--accent); }
.col-reschedule .rs-chip.is-today { background: var(--accent); border-color: var(--accent); color: #fff; }
.col-reschedule .rs-chip.is-today:hover { filter: brightness(1.1); }
.col-reschedule .rs-chip.is-tomorrow { background: var(--link); border-color: var(--link); color: #fff; }
.col-reschedule .rs-chip.is-tomorrow:hover { filter: brightness(1.1); }
.col-reschedule .rs-chip.is-selected {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
  box-shadow: 0 0 0 2px rgba(26, 127, 55, 0.25);
}
.col-reschedule .rs-chip.is-selected:hover { filter: brightness(1.1); }
.col-pri-chips { width: 170px; white-space: nowrap; }
.col-pri-chips .pri-chip {
  min-width: 28px;
  height: 22px;
  padding: 0 6px;
  margin-right: 2px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.col-pri-chips .pri-chip:hover { border-color: var(--accent); color: var(--accent); }
.col-pri-chips .pri-chip.pri-3 { color: var(--pri-top); }
.col-pri-chips .pri-chip.pri-2 { color: var(--pri-high); }
.col-pri-chips .pri-chip.pri-1 { color: var(--pri-med); }
.col-pri-chips .pri-chip.pri-0 { color: var(--pri-low); }
.col-pri-chips .pri-chip.pri-neg { color: var(--pri-neg); }
.col-pri-chips .pri-chip.is-selected {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
  box-shadow: 0 0 0 2px rgba(26, 127, 55, 0.25);
}
.col-pri-chips .pri-chip.is-selected:hover { filter: brightness(1.1); }
.col-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 0; }
.col-actions { width: 36px; text-align: center; white-space: nowrap; }
.col-actions .row-edit-btn {
  width: 26px; height: 22px;
  padding: 0;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  border-radius: 4px;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  transition: color 0.1s, border-color 0.1s, background 0.1s;
}
.col-actions .row-edit-btn:hover { color: var(--accent); border-color: var(--accent); background: var(--surface-2); }
/* Todoist-style priority ring checkbox */
.task-check {
  appearance: none;
  -webkit-appearance: none;
  width: 20px; height: 20px;
  margin: 0;
  border-radius: 50%;
  border: 2px solid var(--pri-low);
  background: transparent;
  cursor: pointer;
  position: relative;
  vertical-align: middle;
  transition: background 0.1s;
}
.task-check:hover { background: rgba(0,0,0,0.04); }
.task-check:checked::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
}
.task-row.priority-3 .task-check { border-color: var(--pri-top); background: rgba(219, 76, 63, 0.08); }
.task-row.priority-2 .task-check { border-color: var(--pri-high); background: rgba(217, 119, 6, 0.08); }
.task-row.priority-1 .task-check { border-color: var(--pri-med); background: rgba(9, 105, 218, 0.08); }
.task-row.priority-0 .task-check { border-color: var(--pri-low); background: transparent; }
.task-row.priority-neg .task-check { border-color: var(--pri-neg); background: transparent; }
.task-row.priority-3 .task-check:checked { background: var(--pri-top); border-color: var(--pri-top); }
.task-row.priority-2 .task-check:checked { background: var(--pri-high); border-color: var(--pri-high); }
.task-row.priority-1 .task-check:checked { background: var(--pri-med); border-color: var(--pri-med); }
.task-row.priority-0 .task-check:checked { background: var(--pri-low); border-color: var(--pri-low); }
.task-row.priority-neg .task-check:checked { background: var(--pri-neg); border-color: var(--pri-neg); }

.pri-flag {
  display: inline-block;
  width: 0; height: 0;
  border-style: solid;
  border-width: 0 0 12px 8px;
  border-color: transparent transparent var(--pri-low) transparent;
  margin-right: 6px;
  vertical-align: middle;
}
.pri-flag-3 { border-color: transparent transparent var(--pri-top) transparent; }
.pri-flag-2 { border-color: transparent transparent var(--pri-high) transparent; }
.pri-flag-1 { border-color: transparent transparent var(--pri-med) transparent; }
.pri-flag-0 { border-color: transparent transparent var(--pri-low) transparent; }

.note-icon {
  width: 14px; height: 14px;
  color: var(--muted);
  vertical-align: middle;
  margin-right: 6px;
  flex-shrink: 0;
}
.note-indicator { display: inline-flex; align-items: center; cursor: help; }
.note-indicator:hover .note-icon { color: var(--accent); }
.title-text { vertical-align: middle; }
.panel-footer {
  border-top: 1px solid var(--border);
  padding: 12px 16px;
  background: var(--surface-3);
  flex-shrink: 0;
}
.panel-footer-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.kbd-row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 4px;
  font-size: 12px;
}
.kbd {
  display: inline-block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 1px 6px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", monospace;
  font-size: 11px;
  font-weight: 500;
  color: var(--text);
  min-width: 18px;
  text-align: center;
}
.kbd-desc {
  margin-left: 6px;
  color: var(--muted);
}
.group-label { font-weight: 600; }
.group-select {
  padding: 6px 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
}
.group-select:focus { outline: none; border-color: var(--accent); }
.cols-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
}
.cols-btn:hover { background: var(--surface-2); border-color: var(--accent); }
.cols-popover {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  box-shadow: 0 4px 16px rgba(31, 35, 40, 0.15);
  min-width: 240px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.col-popover-title {
  padding: 4px 8px 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.col-row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 4px;
}
.col-row:hover { background: var(--surface-2); border-radius: 4px; }
.sort-popover { min-width: 260px; }
.sort-row { gap: 6px; padding: 3px 4px; }
.sort-row .group-select { flex: 1; }
.sort-row-label { font-size: 12px; color: var(--muted); min-width: 46px; }
.col-arrow {
  width: 22px; height: 22px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 4px;
  cursor: pointer;
  font-size: 9px;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.col-arrow:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }
.col-arrow:disabled { opacity: 0.3; cursor: not-allowed; }
.col-toggle {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  font-size: 13px;
  cursor: pointer;
}
.col-toggle input { accent-color: var(--accent); }
.col-reset {
  margin-top: 8px;
  font-size: 12px;
}
.task-table tr.group-header {
  background: var(--surface-2);
  cursor: pointer;
  position: sticky;
  top: 32px;
  z-index: 4;
  user-select: none;
}
.task-table tr.group-header:hover { background: var(--surface-3); }
.group-arrow {
  display: inline-block;
  width: 8px; height: 8px;
  margin-right: 8px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.15s;
  vertical-align: middle;
}
.task-table tr.group-header.collapsed .group-arrow { transform: rotate(-45deg); }
.task-table tr.group-header td {
  padding: 10px 12px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  border-top: 1px solid var(--border);
}
.group-count {
  margin-left: 10px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1px 8px;
  font-size: 11px;
  color: var(--muted);
}
.due-popover {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px;
  box-shadow: 0 4px 16px rgba(31, 35, 40, 0.15);
  display: flex;
  flex-direction: column;
  gap: 0;
}
.inline-cal {
  width: 240px;
  padding: 4px;
}
.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 6px 8px;
}
.cal-nav {
  width: 24px; height: 24px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  color: var(--text);
}
.cal-nav:hover { background: var(--surface-2); border-color: var(--accent); }
.cal-title {
  font-size: 13px;
  font-weight: 600;
}
.cal-dow {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.cal-dow-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 4px 0;
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  text-align: center;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.cal-dow-btn:hover {
  background: var(--surface-2);
  color: var(--accent);
  border-color: var(--accent);
}
.cal-dow-btn.is-today {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.cal-dow-btn.is-today:hover { filter: brightness(1.1); }
.cal-dow-btn.is-tomorrow {
  background: var(--link);
  color: #fff;
  border-color: var(--link);
}
.cal-dow-btn.is-tomorrow:hover { filter: brightness(1.1); }
.cal-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  padding-top: 4px;
}
.cal-day {
  aspect-ratio: 1;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text);
  padding: 0;
  font-family: inherit;
}
.cal-day:hover { background: var(--surface-2); border-color: var(--border); }
.cal-day.dim { color: var(--muted); opacity: 0.5; }
.cal-day.past { color: var(--muted); opacity: 0.3; cursor: not-allowed; }
.cal-day.past:hover { background: transparent; border-color: transparent; }
.cal-nav:disabled { opacity: 0.3; cursor: not-allowed; }
.cal-nav:disabled:hover { background: var(--surface); border-color: var(--border); }
.cal-day.today { font-weight: 700; border-color: var(--accent); }
.cal-day.selected { background: var(--accent); color: #fff; border-color: var(--accent); }
.cal-buttons {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}
.due-custom {
  padding: 7px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  min-width: 180px;
}
.due-custom:focus { outline: none; border-color: var(--accent); }
.due-quick {
  padding: 6px 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  text-align: center;
}
.due-quick:hover { background: var(--surface-2); border-color: var(--accent); }
.due-quick-row {
  display: flex;
  gap: 4px;
  margin-top: 6px;
}
.due-quick-mini {
  padding: 4px 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 5px;
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
}
.due-quick-mini:hover { background: var(--surface-2); border-color: var(--accent); }
.due-quick-clear { color: var(--danger); border-color: var(--border); margin-left: auto; }
.due-quick-clear:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.due-clear {
  padding: 6px 10px;
  border: 1px solid var(--border);
  background: transparent;
  border-radius: 6px;
  color: var(--danger);
  cursor: pointer;
  font-size: 12px;
  text-align: center;
  margin-top: 4px;
}
.due-clear:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.quick-add-wrap {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 6;
}
.quick-add-wrap.expanded {
  border: 1px solid var(--accent);
  border-radius: 8px;
  margin: 8px 12px;
  box-shadow: 0 1px 4px rgba(31, 35, 40, 0.06);
}
.quick-add-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
}
.qa-add-inline {
  flex-shrink: 0;
  padding: 5px 14px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 6px;
}
.quick-add-icon { width: 16px; height: 16px; color: var(--muted); flex-shrink: 0; }
@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(219, 76, 63, 0.5); }
  50% { box-shadow: 0 0 0 10px rgba(219, 76, 63, 0); }
}
.mb-btn.listening svg {
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  padding: 6px;
  animation: mic-pulse 1.2s infinite;
}
.quick-add-input {
  flex: 1;
  padding: 7px 10px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--text);
  font-size: 14px;
}
.quick-add-input:focus,
.quick-add-input:hover {
  outline: none;
  border-color: var(--border);
  background: var(--surface);
}
.quick-add-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(219, 76, 63, 0.15);
}
.qa-note {
  display: block;
  width: calc(100% - 32px);
  margin: 0 16px 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  resize: vertical;
  min-height: 48px;
}
.qa-note:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(219, 76, 63, 0.15);
}
.qa-note[hidden] { display: none; }
.qa-section { display: flex; align-items: center; gap: 10px; padding: 4px 16px; }
.qa-section[hidden] { display: none; }
.qa-label { width: 80px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); flex-shrink: 0; }
.qa-chips { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; align-items: center; }
.qa-actions { display: flex; align-items: center; gap: 8px; padding: 8px 16px; border-top: 1px solid var(--border); }
.qa-actions .spacer { flex: 1; }
.qa-pri-chips .pri-chip {
  min-width: 32px; height: 26px; padding: 0 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  border-radius: 4px; font-size: 12px; font-weight: 600; cursor: pointer; font-family: inherit;
  display: inline-flex; align-items: center; justify-content: center;
}
.qa-pri-chips .pri-chip:hover { border-color: var(--accent); color: var(--accent); }
.qa-pri-chips .pri-chip.pri-3 { color: var(--pri-top); }
.qa-pri-chips .pri-chip.pri-2 { color: var(--pri-high); }
.qa-pri-chips .pri-chip.pri-1 { color: var(--pri-med); }
.qa-pri-chips .pri-chip.pri-0 { color: var(--pri-low); }
.qa-pri-chips .pri-chip.pri-neg { color: var(--pri-neg); }
.qa-pri-chips .pri-chip.is-selected {
  background: var(--success); border-color: var(--success); color: #fff;
  box-shadow: 0 0 0 2px rgba(26, 127, 55, 0.25);
}
.qa-folder-chip {
  height: 26px; padding: 0 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: 4px; font-size: 12px; font-weight: 500; cursor: pointer; font-family: inherit;
  display: inline-flex; align-items: center;
}
.qa-folder-chip:hover { border-color: var(--accent); color: var(--accent); }
.qa-folder-chip.is-selected {
  background: var(--success); border-color: var(--success); color: #fff;
  box-shadow: 0 0 0 2px rgba(26, 127, 55, 0.25);
}
.qa-dow-chips .rs-chip {
  width: 26px; height: 26px;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  border-radius: 4px; font-size: 11px; font-weight: 600; cursor: pointer; font-family: inherit;
  display: inline-flex; align-items: center; justify-content: center;
}
.qa-dow-chips .rs-chip:hover { border-color: var(--accent); color: var(--accent); }
.qa-dow-chips .rs-chip.is-today { background: var(--accent); border-color: var(--accent); color: #fff; }
.qa-dow-chips .rs-chip.is-tomorrow { background: var(--link); border-color: var(--link); color: #fff; }
.qa-dow-chips .rs-chip.is-selected {
  background: var(--success); border-color: var(--success); color: #fff;
  box-shadow: 0 0 0 2px rgba(26, 127, 55, 0.25);
}
.qa-date-pick-btn, .qa-date-clear-btn {
  margin-left: 6px;
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
}
.qa-date-pick-btn:hover, .qa-date-clear-btn:hover { border-color: var(--accent); }
.qa-date-clear-btn { padding: 3px 8px; font-weight: 700; color: var(--muted); }
.ef-star-toggle {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  padding: 5px 12px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
}
.ef-star-toggle.is-on {
  background: rgba(217, 119, 6, 0.12);
  border-color: var(--warning);
  color: var(--warning);
  font-weight: 600;
}
.ef-attach-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
}
.ef-subtasks-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
}
.ef-subtasks-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.ef-subtasks-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ef-subtask-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}
.ef-subtask-row:hover { border-color: var(--accent); }
.ef-subtask-pri {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex: none;
  background: var(--muted);
}
.ef-subtask-pri.pri-3 { background: var(--pri-top); }
.ef-subtask-pri.pri-2 { background: var(--pri-high); }
.ef-subtask-pri.pri-1 { background: var(--pri-med); }
.ef-subtask-pri.pri-0 { background: var(--pri-low); }
.ef-subtask-pri.pri-neg { background: var(--pri-neg); }
.ef-subtask-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ef-attach-header {
  display: flex;
  align-items: center;
  gap: 12px;
}
.ef-attach-title {
  flex: 1;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.ef-attachments {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ef-attachments .muted.small { padding: 2px 0; }
.ef-attach-input { display: none !important; }
.ef-attach-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
}
.ef-attach-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--link); cursor: pointer; }
.ef-attach-name:hover { text-decoration: underline; }
.ef-attach-del {
  width: 22px; height: 22px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 4px;
  color: var(--muted);
  cursor: pointer;
  font-weight: 700;
}
.ef-attach-del:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.ef-attach-btn {
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
}
.ef-attach-btn:hover { border-color: var(--accent); color: var(--accent); }
.ef-context-select {
  flex: 1;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
}
.quick-add-options {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 8px 0 12px;
}
.quick-add-options[hidden] { display: none; }
.quick-add-options .spacer { flex: 1; }
.qa-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  cursor: pointer;
  font-size: 12px;
}
.qa-chip svg { width: 13px; height: 13px; }
.qa-chip:hover { background: var(--surface-2); border-color: var(--accent); }
.qa-chip[data-empty="true"] { color: var(--muted); }
.qa-chip[data-empty="false"] { background: rgba(219, 76, 63, 0.08); border-color: var(--accent); color: var(--accent); }
.qa-chip[data-empty="false"]:hover { background: rgba(219, 76, 63, 0.15); }
.chip-popover {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px;
  box-shadow: 0 4px 16px rgba(31, 35, 40, 0.15);
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 320px;
  overflow-y: auto;
  min-width: 200px;
}
.qa-list-item {
  text-align: left;
  padding: 6px 10px;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
}
.qa-list-item:hover { background: var(--surface-2); }
.qa-list-item-new { color: var(--accent); border-top: 1px solid var(--border); margin-top: 2px; padding-top: 8px; font-weight: 500; }
.qa-list-item.priority-3 { color: var(--pri-top); }
.qa-list-item.priority-2 { color: var(--pri-high); }
.qa-list-item.priority-1 { color: var(--pri-med); }
.ac-popup {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 6px 24px rgba(31, 35, 40, 0.18);
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 220px;
  max-height: 280px;
  overflow-y: auto;
}
.ac-item {
  text-align: left;
  padding: 6px 10px;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  font-family: inherit;
}
.ac-item:hover, .ac-item.active {
  background: var(--accent);
  color: #fff;
}
.due-empty { color: var(--muted); }
.col-due { cursor: pointer; }
.col-due:hover { background: var(--surface-2); }
.due-overdue { color: var(--danger); font-weight: 600; }
.due-today { color: var(--accent); font-weight: 600; }
.due-tomorrow { color: var(--warning); font-weight: 500; }
.ctx-name { color: var(--link); }

/* ---------- Drawer ---------- */
.drawer-backdrop {
  position: fixed; inset: 0;
  background: rgba(31, 35, 40, 0.4);
  z-index: 9000;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.drawer-backdrop.open { opacity: 1; }
.drawer-backdrop[hidden] { display: none; }
.edit-drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 720px;
  max-width: 92vw;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 24px rgba(31, 35, 40, 0.15);
  z-index: 9001;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.22s ease;
  overflow: hidden;
}
.edit-drawer.open { transform: translateX(0); }
.edit-drawer[hidden] { display: none; }
/* AI Plan: full-page view (not a drawer) */
.aiplan-page {
  flex: 1;
  overflow-y: auto;
  background: var(--surface);
}
.aiplan-page[hidden] { display: none !important; }
.aiplan-bottom-bar {
  flex-shrink: 0;
  display: flex;
  gap: 8px;
  padding: 12px 28px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  box-shadow: 0 -4px 12px rgba(31, 35, 40, 0.06);
  align-items: center;
}
.aiplan-bottom-bar[hidden] { display: none !important; }
.aiplan-bottom-bar .spacer { flex: 1; }
.tasks-page { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: hidden; }
.tasks-page[hidden] { display: none !important; }
.aiplan-side { padding: 14px 16px; display: flex; flex-direction: column; gap: 16px; }
.aiplan-side-section { display: flex; flex-direction: column; gap: 6px; }
.aiplan-side textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  resize: vertical;
}
.aiplan-side textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(219,76,63,0.15); }
.ap-settings { display: flex; flex-direction: column; gap: 6px; }
.ap-setting-row { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.ap-setting-row span { flex: 1; color: var(--text); }
.ap-setting-row input[type="date"] {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
}
.ap-setting-row input[type="date"]:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(219,76,63,0.15); }
.ap-setting-clear {
  width: 22px; height: 22px;
  padding: 0;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 4px;
  color: var(--muted);
  cursor: pointer;
  font-weight: 700;
}
.ap-setting-clear:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.aiplan-generate { width: 100%; }
.aiplan-label { display: block; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; }
.aiplan-label.small { font-size: 10px; }
.ap-source-count { font-size: 11px; color: var(--muted); }
.aiplan-main { padding: 22px 28px; }
.aiplan-main-header { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.aiplan-main-header h2 { margin: 0; font-size: 18px; }
.ap-stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.ap-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 90px;
  transition: border-color 0.1s, box-shadow 0.1s, background 0.1s;
}
.ap-stat-clickable { cursor: pointer; }
.ap-stat-clickable:hover { border-color: var(--accent); background: var(--surface-2); }
.ap-stat-clickable.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(219, 76, 63, 0.18);
  background: var(--surface);
}
.ap-stat-num {
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
  color: var(--text);
}
.ap-stat-num-pending { color: var(--warning); }
.ap-stat-num-accepted { color: var(--success); }
.ap-stat-num-skipped { color: var(--muted); }
.ap-stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--muted);
  font-weight: 600;
}
.ap-stat-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}
.ap-stat-chip {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 3px;
  font-weight: 500;
}
.ap-stat-chip-amber { background: rgba(217, 119, 6, 0.15); color: #b45309; }
.ap-stat-chip-red { background: rgba(219, 76, 63, 0.15); color: var(--accent); }
.ap-stat-chip-green { background: rgba(46, 160, 67, 0.15); color: var(--success); }
.ap-stat-chip-gray { background: var(--surface-3); color: var(--muted); }
@media (max-width: 900px) {
  .ap-stats { grid-template-columns: repeat(2, 1fr); }
}
.aiplan-empty { padding: 60px 28px; text-align: center; }
.aiplan-empty h2 { font-size: 22px; margin-bottom: 12px; }
.aiplan-empty .ap-current-info { margin-top: 24px; padding: 10px 14px; background: var(--surface-2); border-radius: 6px; display: inline-block; }
.ap-source-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.ap-source-select {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}
.ap-source-select:hover { border-color: var(--accent); }
.ap-source-select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(219,76,63,0.15); }
.ap-source-count { margin-top: 4px; }
.ap-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.ap-chip {
  padding: 6px 12px; border: 1px solid var(--border); background: var(--surface);
  border-radius: 999px; font-size: 12px; cursor: pointer; color: var(--text);
}
.ap-chip:hover { border-color: var(--accent); }
.ap-chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.ap-presets { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.ap-preset {
  text-align: left; padding: 6px 10px; border: 1px dashed var(--border);
  background: transparent; border-radius: 6px; cursor: pointer; font-size: 12px;
  color: var(--muted); font-family: inherit;
}
.ap-preset:hover { border-style: solid; border-color: var(--accent); color: var(--text); }
.aiplan-actions { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; padding-top: 8px; border-top: 1px solid var(--border); padding-top: 16px; }
.ap-loading { padding: 30px; text-align: center; }
.ap-loading span {
  display: inline-block; width: 8px; height: 8px;
  background: var(--accent); border-radius: 50%; margin-right: 4px;
  animation: chat-bounce 1.2s infinite;
}
.ap-loading span:nth-child(2) { animation-delay: 0.15s; }
.ap-loading span:nth-child(3) { animation-delay: 0.3s; }
.ap-empty, .ap-error { padding: 20px; text-align: center; }
.ap-error { color: var(--danger); }
.ap-summary {
  background: var(--surface-2); padding: 10px 14px; border-radius: 8px;
  margin-bottom: 12px; font-size: 13px; border-left: 3px solid var(--accent);
}
.ap-summary-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  margin-bottom: 6px;
  padding: 0; border: 0; background: transparent;
  font: inherit; font-size: 12px; font-weight: 600;
  color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em;
  cursor: pointer;
}
.ap-summary-toggle:hover { color: var(--text); }
.ap-summary-toggle-caret { font-size: 10px; }
.ap-summary-body { white-space: pre-wrap; }
.ap-summary.is-collapsed .ap-summary-body { display: none; }
.ap-summary.is-collapsed { padding-bottom: 8px; padding-top: 8px; margin-bottom: 8px; }
.ap-table-wrap { overflow-x: auto; margin-bottom: 12px; }
.ap-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ap-table thead th {
  text-align: left; font-size: 11px; text-transform: uppercase; color: var(--muted);
  padding: 6px 10px; border-bottom: 1px solid var(--border); background: var(--surface-2);
}
.ap-table tbody td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.ap-row-accepted { opacity: 0.55; background: rgba(46, 160, 67, 0.05); }
.ap-row-skipped { opacity: 0.4; }
.ap-check { width: 32px; padding-left: 12px; }
.ap-check input { accent-color: var(--accent); }
.ap-task { max-width: 280px; }
.ap-task strong { font-size: 13px; }
.ap-current { white-space: nowrap; color: var(--muted); }
.ap-action { white-space: nowrap; }
.ap-priority, .ap-due { white-space: nowrap; }
.ap-badge {
  display: inline-block; padding: 3px 9px; border-radius: 4px; font-size: 11px;
  font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px;
}
.ap-badge-amber { background: rgba(217, 119, 6, 0.15); color: #b45309; }
.ap-badge-red { background: rgba(219, 76, 63, 0.15); color: var(--accent); }
.ap-badge-green { background: rgba(46, 160, 67, 0.15); color: var(--success); }
.ap-badge-gray { background: var(--surface-3); color: var(--muted); }
.ap-dow-chips {
  display: inline-flex;
  gap: 2px;
  margin-left: 8px;
  vertical-align: middle;
}
.ap-dow-chip {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
  color: var(--muted);
  cursor: pointer;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.ap-dow-chip:hover { border-color: var(--accent); color: var(--accent); }
.ap-dow-chip.is-today { background: var(--accent); border-color: var(--accent); color: #fff; }
.ap-dow-chip.is-today:hover { filter: brightness(1.1); }
.ap-dow-chip.is-tomorrow { background: var(--link); border-color: var(--link); color: #fff; }
.ap-dow-chip.is-tomorrow:hover { filter: brightness(1.1); }
.ap-dow-chip.is-selected {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
  box-shadow: 0 0 0 2px rgba(26, 127, 55, 0.25);
}
.ap-dow-chip.is-selected:hover { filter: brightness(1.1); }
.ap-pri-chips {
  display: inline-flex;
  gap: 2px;
  margin-left: 8px;
  vertical-align: middle;
}
.ap-pri-chip {
  min-width: 28px;
  height: 22px;
  padding: 0 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.ap-pri-chip:hover { border-color: var(--accent); color: var(--accent); }
.ap-pri-chip.ap-pri-chip-3 { color: var(--pri-top); }
.ap-pri-chip.ap-pri-chip-2 { color: var(--pri-high); }
.ap-pri-chip.ap-pri-chip-1 { color: var(--pri-med); }
.ap-pri-chip.ap-pri-chip-0 { color: var(--pri-low); }
.ap-pri-chip.ap-pri-chip-neg { color: var(--pri-neg); }
.ap-pri-chip.is-selected {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
  box-shadow: 0 0 0 2px rgba(26, 127, 55, 0.25);
}
.ap-pri-chip.is-selected:hover { filter: brightness(1.1); }
.ap-date-btn, .ap-pri-edit {
  margin-left: 6px;
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 12px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.ap-date-btn:hover, .ap-pri-edit:hover { border-color: var(--accent); background: var(--surface-2); }
.ap-pri-edit:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(219,76,63,0.15); }
.ap-reason { max-width: 240px; font-size: 12px; }
.ap-controls { white-space: nowrap; text-align: right; }
.ap-controls .btn-icon { margin-left: 4px; }
.ap-controls .ap-accept { border-color: var(--success); color: var(--success); }
.ap-controls .ap-accept:hover { background: var(--success); color: #fff; }
.ap-controls .ap-skip:hover { color: var(--muted); border-color: var(--muted); }
.ap-status { font-size: 11px; padding: 3px 8px; border-radius: 4px; font-weight: 600; }
.ap-status-accepted { background: rgba(46, 160, 67, 0.15); color: var(--success); }
.ap-status-skipped { background: var(--surface-3); color: var(--muted); }
.ap-bulk { display: flex; gap: 8px; padding-top: 10px; border-top: 1px solid var(--border); }
.settings-drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 480px;
  max-width: 92vw;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 24px rgba(31, 35, 40, 0.15);
  z-index: 9001;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.22s ease;
  overflow: hidden;
}
.settings-drawer.open { transform: translateX(0); }
.settings-drawer[hidden] { display: none; }
.settings-body { flex: 1; overflow-y: auto; padding: 0; }
.settings-section {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}
.settings-section:last-child { border-bottom: none; }
.settings-section h3 {
  margin: 0 0 12px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
}
.settings-section h3 small { font-weight: 400; text-transform: none; letter-spacing: 0; margin-left: 4px; }
.settings-kv {
  display: flex;
  align-items: baseline;
  padding: 6px 0;
  font-size: 13px;
}
.settings-key { color: var(--muted); width: 110px; flex-shrink: 0; }
.settings-val { color: var(--text); }
.settings-input-label {
  display: block;
  margin-top: 12px;
  font-size: 12px;
  color: var(--muted);
}
.settings-input-label input {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 12px;
}
.settings-input-label input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(219, 76, 63, 0.15);
}
.settings-key-display {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.settings-export-btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.settings-key-display code {
  flex: 1;
  background: var(--surface-2);
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 12px;
  color: var(--muted);
}
#set-save-key { margin-top: 10px; }
.settings-status { margin-top: 12px; padding: 8px 10px; background: var(--surface-2); border-radius: 6px; }
.small { font-size: 12px; }
.smart-drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 720px;
  max-width: 95vw;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 24px rgba(31, 35, 40, 0.15);
  z-index: 9001;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.22s ease;
  overflow: hidden;
}
.smart-drawer.open { transform: translateX(0); }
.smart-drawer[hidden] { display: none; }
.ss-body { flex: 1; overflow-y: auto; padding: 16px 20px; }
.ss-context { font-size: 12px; font-weight: 400; margin-left: 8px; }
.ss-config {
  display: flex; align-items: center; gap: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  font-size: 13px;
}
.ss-config label { display: inline-flex; align-items: center; gap: 6px; }
.ss-num { width: 56px; padding: 4px 6px; border: 1px solid var(--border); border-radius: 4px; font-size: 13px; }
.ss-summary { padding: 10px 0 6px; font-size: 12px; }
.ss-table-wrap { overflow-x: auto; }
.ss-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ss-table thead th { background: var(--surface-2); padding: 6px 10px; text-align: left; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; }
.ss-table tbody td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.ss-table tbody tr.dropped { opacity: 0.4; text-decoration: line-through; }
.ss-score { font-weight: 600; color: var(--accent); cursor: help; width: 50px; }
.ss-title { max-width: 280px; }
.ss-cur, .ss-prop { white-space: nowrap; width: 140px; }
.ss-prop-input { padding: 4px 6px; border: 1px solid var(--border); border-radius: 4px; font-size: 12px; }
.ss-drop { width: 32px; }
.btn-icon {
  background: transparent; border: 1px solid var(--border);
  color: var(--muted); cursor: pointer;
  width: 24px; height: 24px;
  border-radius: 4px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px;
}
.btn-icon:hover { color: var(--danger); border-color: var(--danger); }
.ss-footer {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}
.ss-footer .spacer { flex: 1; }
.ss-chat {
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  overflow: hidden;
}
.ss-chat-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  background: var(--surface-3);
  font-size: 13px;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}
.ss-chat-toggle {
  background: transparent; border: none; cursor: pointer; font-size: 18px; line-height: 1;
  width: 24px; height: 24px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--muted);
}
.ss-chat-body { padding: 12px 14px; max-height: 360px; overflow-y: auto; transition: max-height 0.2s; }
.ss-chat-body.collapsed { max-height: 0; padding: 0 14px; overflow: hidden; }
.ss-chat-messages { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.ss-chat-empty { font-size: 12px; padding: 8px 0; }
.ss-chat-msg { padding: 7px 10px; border-radius: 8px; font-size: 13px; line-height: 1.4; }
.ss-chat-msg p { margin: 0 0 6px; }
.ss-chat-msg p:last-child { margin-bottom: 0; }
.ss-chat-msg ul { margin: 4px 0; padding-left: 18px; }
.ss-chat-msg li { margin-bottom: 2px; }
.ss-chat-msg code { background: rgba(0,0,0,0.05); padding: 1px 4px; border-radius: 3px; font-size: 12px; }
.ss-chat-msg-user { background: var(--accent); color: #fff; align-self: flex-end; max-width: 85%; }
.ss-chat-msg-assistant { background: var(--surface); color: var(--text); align-self: flex-start; max-width: 95%; }
.ss-chat-msg-thinking {
  background: var(--surface);
  align-self: flex-start;
  padding: 10px 12px;
}
.ss-chat-msg-thinking span {
  display: inline-block;
  width: 5px; height: 5px;
  background: var(--muted);
  border-radius: 50%;
  margin-right: 3px;
  animation: chat-bounce 1.2s infinite;
}
.ss-chat-msg-thinking span:nth-child(2) { animation-delay: 0.15s; }
.ss-chat-msg-thinking span:nth-child(3) { animation-delay: 0.3s; }
.ss-chat-quick {
  display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px;
}
.ss-chat-quick button {
  padding: 5px 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
  color: var(--text);
}
.ss-chat-quick button:hover { border-color: var(--accent); background: var(--surface-3); }
.ss-chat-input-row { display: flex; gap: 6px; }
#ss-chat-input {
  flex: 1;
  padding: 7px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
}
#ss-chat-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(219,76,63,0.15); }

/* ---------- AI Chat ---------- */
.chat-drawer {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 420px;
  max-width: 92vw;
  height: 600px;
  max-height: calc(100vh - 48px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 16px 48px rgba(31, 35, 40, 0.25);
  z-index: 8001;
  display: flex;
  flex-direction: column;
  transform: translateY(20px) scale(0.95);
  opacity: 0;
  transition: all 0.22s ease;
  overflow: hidden;
}
.chat-drawer.open { transform: translateY(0) scale(1); opacity: 1; }
.chat-drawer[hidden] { display: none; }
.chat-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, var(--accent), #c53d31);
  color: #fff;
}
.chat-header h3 { margin: 0; font-size: 14px; flex: 1; font-weight: 600; }
.chat-close, .chat-clear {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: #fff;
  width: 28px; height: 28px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}
.chat-close:hover, .chat-clear:hover { background: rgba(255, 255, 255, 0.35); }
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.chat-msg {
  max-width: 85%;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.4;
}
.chat-msg p { margin: 0 0 6px; }
.chat-msg p:last-child { margin-bottom: 0; }
.chat-msg code { background: var(--surface-3); padding: 1px 4px; border-radius: 3px; font-size: 12px; }
.chat-msg-user {
  background: var(--accent);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 2px;
}
.chat-msg-assistant {
  background: var(--surface-2);
  color: var(--text);
  align-self: flex-start;
  border-bottom-left-radius: 2px;
}
.chat-tool-notice {
  font-size: 11px;
  color: var(--muted);
  align-self: flex-start;
  font-family: ui-monospace, SFMono-Regular, monospace;
}
.chat-typing {
  padding: 6px 16px;
  text-align: left;
}
.chat-typing span {
  display: inline-block;
  width: 6px; height: 6px;
  background: var(--muted);
  border-radius: 50%;
  margin-right: 3px;
  animation: chat-bounce 1.2s infinite;
}
.chat-typing span:nth-child(2) { animation-delay: 0.15s; }
.chat-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes chat-bounce {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}
.chat-input-row {
  display: flex;
  gap: 6px;
  padding: 10px;
  border-top: 1px solid var(--border);
}
#chat-input {
  flex: 1;
  resize: none;
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
}
#chat-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(219, 76, 63, 0.15); }
#chat-send { align-self: stretch; }
.chat-empty {
  padding: 20px;
  text-align: center;
  color: var(--muted);
}
.chat-empty-title { font-size: 13px; margin-bottom: 12px; }
.chat-empty-examples { display: flex; flex-direction: column; gap: 6px; }
.chat-empty-examples button {
  padding: 8px 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}
.chat-empty-examples button:hover { border-color: var(--accent); background: var(--surface-2); }
.drawer-header {
  display: flex;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  flex-shrink: 0;
}
.drawer-header h2 { margin: 0; font-size: 16px; flex: 1; }
.drawer-close {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
}
.drawer-close:hover { background: var(--surface-3); color: var(--text); }
.edit-form {
  padding: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  overflow-y: auto;
}
.edit-form h2 { margin: 0 0 16px; }
.edit-form label { margin-bottom: 0; }
.note-label {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 200px;
}
.ef-complete-row {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--surface-2);
  border-radius: 6px;
  border: 1px solid var(--border);
  margin-bottom: 4px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  text-transform: none;
  font-weight: 500;
}
.ef-complete-row input[type="checkbox"] {
  width: auto;
  margin: 0;
  accent-color: var(--success);
}
.ef-complete-row input:disabled + span { color: var(--success); }
.note-textarea {
  flex: 1 1 auto;
  resize: vertical;
  min-height: 180px;
  height: 100%;
  font-family: inherit;
}
.note-preview {
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px dashed var(--border);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  word-break: break-word;
  max-height: 200px;
  overflow-y: auto;
}
.note-preview a { color: var(--accent); text-decoration: underline; }
.note-preview a:hover { text-decoration: none; }
.note-preview[hidden] { display: none; }
.modal-actions { margin-top: auto; flex-shrink: 0; }
.edit-form label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 12px;
}
.edit-form input,
.edit-form select,
.edit-form textarea {
  display: block; width: 100%;
  margin-top: 4px;
  padding: 7px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
}
.edit-form input:focus,
.edit-form select:focus,
.edit-form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(219, 76, 63, 0.2);
}
.edit-form input[type="date"] { font-family: inherit; cursor: pointer; }
.edit-form .row { display: flex; gap: 10px; }
.edit-form .row > label { flex: 1; }
.modal-actions { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.modal-actions .spacer { flex: 1; }
.btn {
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }

/* ---------- Access denied ---------- */
#access-denied-overlay {
  position: fixed; inset: 0;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  z-index: 10000;
}
#access-denied-overlay .ad-card {
  background: var(--surface);
  border: 1px solid var(--danger);
  border-radius: 12px;
  padding: 32px 40px;
  max-width: 420px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(207, 34, 46, 0.15);
}
#access-denied-overlay h1 { margin: 0 0 12px; color: var(--danger); }
#access-denied-overlay button {
  margin-top: 16px; padding: 10px 24px;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px; cursor: pointer;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border);
  padding: 10px 16px; border-radius: 6px;
  opacity: 0; transition: all 0.25s ease;
  z-index: 10001;
  font-size: 13px;
  box-shadow: 0 4px 12px rgba(31, 35, 40, 0.1);
}
.toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast-error { border-color: var(--danger); color: var(--danger); }
.toast-success { border-color: var(--success); color: var(--success); }

.hidden { display: none !important; }

/* Mobile bottom nav (hidden by default; shown on small screens) */
.mobile-bottom-nav {
  display: none;
}

/* ===================== Mobile: ≤900px ===================== */
@media (max-width: 900px) {
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    box-shadow: 0 -2px 10px rgba(31, 35, 40, 0.06);
    z-index: 9000;
    padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
  }
  .mb-btn {
    flex: 1;
    min-height: 44px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    background: transparent;
    border: none;
    color: var(--muted);
    padding: 10px 4px;
    font-size: 11px;
    cursor: pointer;
    font-family: inherit;
  }
  .mb-btn:active { background: var(--surface-2); }
  .mb-btn span { font-weight: 500; }
  .mb-btn-primary {
    color: var(--accent);
  }
  .mb-btn-primary svg {
    background: var(--accent);
    color: #fff;
    border-radius: 50%;
    padding: 6px;
    box-sizing: content-box;
    width: 22px !important;
    height: 22px !important;
    box-shadow: 0 4px 12px rgba(219, 76, 63, 0.35);
  }

  /* Make room above the bottom nav so content isn't hidden behind it */
  .main-area {
    padding-bottom: calc(80px + env(safe-area-inset-bottom));
  }
  /* Lift the chat-drawer (bottom sheet) above the bottom nav */
  .chat-drawer {
    bottom: calc(80px + env(safe-area-inset-bottom)) !important;
  }
  /* Hamburger no longer needed — rail stays visible */
  .mobile-menu-btn { display: none; }

  /* Rail: sits above the bottom nav (not over it), items stacked bottom-up for thumb reach */
  .icon-rail {
    position: fixed;
    right: 0;
    top: auto;
    bottom: calc(80px + env(safe-area-inset-bottom));
    width: 68px;
    flex-direction: column-reverse;
    padding: 8px 0;
    gap: 4px;
    z-index: 9560;
    border-left: 1px solid var(--border);
    box-shadow: -2px 0 8px rgba(31,35,40,0.08);
    border-radius: 8px 0 0 0;
    overflow-y: auto;
    transition: transform 0.25s ease;
  }

  /* Hamburger-toggled collapsed state — rail slides off-screen, content reflows full width */
  .app-shell.rail-collapsed .icon-rail { transform: translateX(100%); }
  .app-shell.rail-collapsed .task-table,
  .app-shell.rail-collapsed .bulk-bar,
  .app-shell.rail-collapsed .aiplan-bottom-bar { margin-right: 0; }
  .task-table, .bulk-bar, .aiplan-bottom-bar { transition: margin-right 0.25s ease; }
  .rail-btn { width: 52px; height: 52px; border-radius: 8px; }
  .rail-btn svg { width: 26px; height: 26px; }

  /* Main area is full-width on mobile — only the elements that actually intersect
     the rail's footprint get rail clearance. */
  .task-table,
  .bulk-bar,
  .aiplan-bottom-bar { margin-right: 68px; }

  /* Panel slides in from the right, sits beside the rail (not over it) */
  .panel {
    position: fixed;
    top: 0;
    bottom: calc(80px + env(safe-area-inset-bottom));
    right: 68px;
    left: auto;
    z-index: 9550;
    width: calc(100vw - 68px);
    max-width: 320px;
    transform: translateX(calc(100% + 68px));
    transition: transform 0.25s ease;
  }
  .app-shell.mobile-menu-open .panel { transform: translateX(0); }
  .app-shell.mobile-menu-open::before {
    content: '';
    position: fixed;
    top: 0;
    bottom: calc(80px + env(safe-area-inset-bottom));
    left: 0;
    right: 68px;
    background: rgba(0,0,0,0.4);
    z-index: 9540;
  }

  /* Header tighter */
  .app-header { padding: 8px 12px; gap: 8px; }
  .header-title { font-size: 15px; }
  .filter-search { width: 130px; min-width: 0; font-size: 13px; }

  /* Header: hide secondary controls to save space */
  .group-select, .cols-btn, .group-label { display: none !important; }
  .filter-search { flex: 1; max-width: 200px; }

  /* Drawers full-width */
  .edit-drawer, .settings-drawer, .smart-drawer, .aiplan-drawer {
    width: 100vw !important;
    max-width: 100vw !important;
  }

  /* Edit drawer: keep Save reachable — actions pin to the bottom of the
     scrolling form, above the iOS home indicator */
  .edit-form { padding-bottom: 0; }
  .modal-actions {
    position: sticky;
    bottom: 0;
    flex-wrap: wrap;
    background: var(--surface);
    border-top: 1px solid var(--border);
    margin: 12px -20px 0;
    padding: 10px 20px calc(10px + env(safe-area-inset-bottom));
  }
  .ss-table { font-size: 12px; }
  .ss-table th, .ss-table td { padding: 4px 6px; }

  /* Chat drawer becomes a bottom sheet */
  .chat-drawer {
    bottom: 0 !important;
    right: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    height: 80vh !important;
    border-radius: 14px 14px 0 0 !important;
  }
  /* AI Plan: side panel becomes top section, main below */
  .aiplan-bottom-bar { padding: 10px 12px; flex-wrap: wrap; }
  .aiplan-bottom-bar .btn { flex: 1; min-width: 0; }
  .aiplan-bottom-bar .spacer { display: none; }
  .aiplan-main { padding: 14px 16px; }

  /* AI Plan stats: 2 columns */
  .ap-stats { grid-template-columns: repeat(2, 1fr); gap: 8px; }

  /* Bulk bar wraps */
  .bulk-bar { flex-wrap: wrap; padding: 8px 12px; gap: 6px; }
  .bulk-bar .btn { padding: 5px 10px; font-size: 12px; }
}

/* ===================== Mobile cards: ≤768px ===================== */
@media (max-width: 768px) {
  /* Task table → card list */
  .task-table thead { display: none; }
  .task-table, .task-table tbody { display: block; }
  .task-table tr.task-row {
    display: grid;
    grid-template-columns: 24px 1fr auto;
    grid-template-rows: auto auto;
    column-gap: 10px;
    row-gap: 2px;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
    margin: 6px 12px;
    background: var(--surface);
    align-items: center;
  }
  .task-table tr.task-row:hover { background: var(--surface); }
  /* Subtask indent for mobile cards: shift the whole card; don't pad the check cell */
  .task-table tr.task-row.task-row-child {
    margin-left: calc(12px + var(--depth, 1) * 18px);
  }
  .task-table tr.task-row.task-row-child .col-check { padding-left: 0; }
  .task-table td { display: block; border: none; padding: 0; }
  .task-table .col-check {
    grid-column: 1;
    grid-row: 1 / span 2;
    align-self: center;
  }
  .task-table .col-title {
    grid-column: 2 / span 2;
    grid-row: 1;
    font-size: 14px;
    font-weight: 500;
    overflow: hidden;
    white-space: normal;
    text-overflow: ellipsis;
    max-width: none;
  }
  .task-table .col-due {
    grid-column: 2;
    grid-row: 2;
    font-size: 12px;
    color: var(--muted);
  }
  .task-table .col-due:empty { display: none; }
  .task-table .col-context {
    grid-column: 3;
    grid-row: 2;
    font-size: 11px;
    text-align: right;
  }
  .task-table .col-folder, .task-table .col-star { display: none !important; }
  .task-table .col-reschedule, .task-table .col-pri-chips { display: none !important; }

  .task-table .col-actions {
    grid-column: 3;
    grid-row: 1;
    align-self: center;
    width: auto;
    text-align: right;
  }

  /* Bigger checkboxes for fingers */
  .task-check { width: 22px; height: 22px; }

  /* Quick-add: just the input on mobile, options chips wrap */
  .quick-add-options { padding: 6px 12px 8px; }

  /* Filter chip rows scroll horizontally */
  .filter-bar { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
  .filter-chips { flex-shrink: 0; }
}

/* ===================== Phone tight: ≤480px ===================== */
@media (max-width: 480px) {
  .header-title { display: none; }
  .filter-search { max-width: 100%; }
  .ap-stats { grid-template-columns: 1fr; }
}
