/* Stack popup — matching mockup.html */

:root {
  /* Paper theme (default) */
  --paper: #f4efe6; --paper-2: #ebe4d6;
  --ink: #1a1714; --ink-2: #4a423a; --ink-3: #8a7f70;
  --rule: #d7cdb9; --rule-2: #c4b89f;
  --accent: #b4451f; --accent-2: #d96a1f;
  --ok: #4a6b3a; --crit: #8c1d0e;
  --amber: #d9b05e;
  --font-sans:  'Inter Tight', sans-serif;
  --font-serif: 'Fraunces', serif;
  --font-mono:  'JetBrains Mono', monospace;
  --noise-opacity: 0.35;
  /* Tag palette — shared across ALL themes for consistency */
  --c01: #3a5a6b; --c02: #2d5f5d; --c03: #4a6b3a; --c04: #6b6a3a;
  --c05: #8a5a2b; --c06: #a0522d; --c07: #b4451f; --c08: #7a3a2a;
  --c09: #6b3a4a; --c10: #8a3a5a; --c11: #5a4a8a; --c12: #6b5a8a;
  --c13: #3a4a6b; --c14: #4a5a5a; --c15: #5a6b4a; --c16: #6b5a4a;
  --c17: #3a6b5a; --c18: #5a3a6b; --c19: #6b3a3a; --c20: #3a3a6b;
}

/* --- Themes: override the mood-dependent variables. Tag palette stays. --- */
body.theme-paper { /* identity */ }

body.theme-midnight {
  --paper: #0e1220; --paper-2: #161b2e;
  --ink: #e8e4d5; --ink-2: #9ca3b8; --ink-3: #5c6480;
  --rule: #252b42; --rule-2: #353c57;
  --accent: #f4a261; --accent-2: #ffb579;
  --ok: #7fb069; --crit: #d96a5e;
  --font-sans: 'Geist', 'Inter Tight', sans-serif;
  --font-serif: 'Geist', sans-serif;
  --font-mono: 'Geist Mono', 'JetBrains Mono', monospace;
  --noise-opacity: 0;
}

body.theme-editorial {
  --paper: #fafaf7; --paper-2: #f0ede4;
  --ink: #111111; --ink-2: #444444; --ink-3: #888888;
  --rule: #e0dcd0; --rule-2: #111111;
  --accent: #c93842; --accent-2: #e0505b;
  --ok: #2d6a4f; --crit: #c93842;
  --font-sans: 'IBM Plex Sans', 'Inter Tight', sans-serif;
  --font-serif: 'Playfair Display', serif;
  --font-mono: 'IBM Plex Mono', 'JetBrains Mono', monospace;
}

body.theme-workbench {
  --paper: #ffffff; --paper-2: #f7f7f8;
  --ink: #111114; --ink-2: #52525b; --ink-3: #a1a1aa;
  --rule: #ececee; --rule-2: #d4d4d8;
  --accent: #5b47e0; --accent-2: #7566f0;
  --ok: #10b981; --crit: #ef4444;
  --font-sans: 'Inter Tight', sans-serif;
  --font-serif: 'Inter Tight', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

body.theme-graphite {
  --paper: #1a1a1a; --paper-2: #242424;
  --ink: #e8e8e8; --ink-2: #a8a8a8; --ink-3: #6e6e6e;
  --rule: #2e2e2e; --rule-2: #3a3a3a;
  --accent: #e8a33d; --accent-2: #ffbf5d;
  --ok: #7fb069; --crit: #e06454;
  --font-sans: 'IBM Plex Sans Condensed', 'Inter Tight', sans-serif;
  --font-serif: 'IBM Plex Sans Condensed', sans-serif;
  --font-mono: 'IBM Plex Mono', 'JetBrains Mono', monospace;
  --noise-opacity: 0;
}

body.theme-obsidian {
  --paper: #0a0a0a; --paper-2: #131313;
  --ink: #d4d4d4; --ink-2: #8a8a8a; --ink-3: #4a4a4a;
  --rule: #1f1f1f; --rule-2: #2a2a2a;
  --accent: #50fa7b; --accent-2: #7aff9c;
  --ok: #50fa7b; --crit: #ff5555;
  --font-sans: 'Fira Code', monospace;
  --font-serif: 'Fira Code', monospace;
  --font-mono: 'Fira Code', monospace;
  --noise-opacity: 0;
}

body.theme-dusk {
  --paper: #26201c; --paper-2: #2f2824;
  --ink: #e8dccf; --ink-2: #b0a194; --ink-3: #7a6d62;
  --rule: #3a322c; --rule-2: #4a4038;
  --accent: #d68a8a; --accent-2: #e8a0a0;
  --ok: #a8c088; --crit: #d96a5e;
  --font-sans: 'Crimson Pro', serif;
  --font-serif: 'Crimson Pro', serif;
  --font-mono: 'Space Mono', monospace;
  --noise-opacity: 0;
}

body.theme-blueprint {
  --paper: #0e2540; --paper-2: #143054;
  --ink: #e8f0ff; --ink-2: #8fa8c7; --ink-3: #5c7491;
  --rule: #1c3d66; --rule-2: #2a4f7a;
  --accent: #ffffff; --accent-2: #e8f0ff;
  --ok: #7fb069; --crit: #ff7a7a;
  --font-sans: 'Space Grotesk', sans-serif;
  --font-serif: 'Space Grotesk', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --noise-opacity: 0;
}

body.theme-linen {
  --paper: #eae6df; --paper-2: #e0dcd3;
  --ink: #1a1a1a; --ink-2: #5a5750; --ink-3: #8a877f;
  --rule: #c8c2b3; --rule-2: #b5aea0;
  --accent: #1a1a1a; --accent-2: #3a3a3a;
  --ok: #4a6b3a; --crit: #8c1d0e;
  --font-sans: 'Inter Tight', sans-serif;
  --font-serif: 'Instrument Serif', serif;
  --font-mono: 'JetBrains Mono', monospace;
}

body.theme-newsprint {
  --paper: #f5f3ec; --paper-2: #ebe8df;
  --ink: #000000; --ink-2: #3a3a3a; --ink-3: #7a7570;
  --rule: #c8c2b3; --rule-2: #000000;
  --accent: #000000; --accent-2: #3a3a3a;
  --ok: #2d6a4f; --crit: #8c1d0e;
  --font-sans: 'Courier Prime', monospace;
  --font-serif: 'Fraunces', serif;
  --font-mono: 'Courier Prime', monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%; background: var(--paper); color: var(--ink);
  font-family: var(--font-sans);
  overflow: hidden;
}

body::before {
  content: ''; position: fixed; inset: 0; pointer-events: none;
  opacity: var(--noise-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0.1 0 0 0 0 0.08 0 0 0 0 0.06 0 0 0 0 0.08 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  z-index: 0;
}

#app {
  position: relative; z-index: 1;
  display: flex; flex-direction: column;
  height: 100vh; width: 100vw;
}

/* --- Identity picker --- */
.picker {
  position: absolute; inset: 0; background: var(--paper);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 20px; padding: 30px; z-index: 10;
}
.picker[hidden] { display: none; }
.picker h1 {
  font-family: var(--font-serif); font-weight: 400; font-size: 28px;
  letter-spacing: -0.02em;
}
.picker h1 em { color: var(--accent); }
.picker p {
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink-3);
}
.picker-list { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.picker-btn {
  font-family: var(--font-mono); font-weight: 600; font-size: 14px;
  padding: 10px 18px; border: 1px solid var(--rule-2);
  background: var(--paper); color: var(--ink-2);
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  text-transform: uppercase;
}
.picker-btn:hover { border-color: var(--ink); color: var(--ink); }
.picker-btn .av {
  width: 18px; height: 18px; border-radius: 50%; font-size: 10px;
  color: #fff; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}

/* --- Titlebar --- */
.titlebar {
  background: var(--paper-2); border-bottom: 1px solid var(--rule-2);
  padding: 8px 14px; display: flex; align-items: center; gap: 10px; flex-shrink: 0;
}
.title {
  font-family: var(--font-serif); font-style: italic;
  font-size: 13px; color: var(--ink-2); flex: 1; text-align: center;
}
.title b { font-style: normal; font-weight: 600; color: var(--ink); }
.title-right { display: flex; align-items: center; gap: 10px; }
.sync {
  font-family: var(--font-mono); font-size: 9px;
  color: var(--ink-3); letter-spacing: 0.1em; text-transform: uppercase;
  display: flex; align-items: center; gap: 5px;
}
.sync-dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--ok);
  box-shadow: 0 0 0 2px rgba(74,107,58,0.15);
}
.sync-dot.pending { background: var(--amber); box-shadow: 0 0 0 2px rgba(217,176,94,0.15); }
.sync-dot.offline { background: var(--crit); box-shadow: 0 0 0 2px rgba(140,29,14,0.15); }
.gear-btn {
  background: transparent; border: none; cursor: pointer;
  color: var(--ink-2); opacity: 0.7; padding: 0; display: flex;
}
.gear-btn:hover { opacity: 1; }
.gear-btn svg { width: 14px; height: 14px; }

/* --- Identity strip --- */
.identity {
  padding: 6px 14px; border-bottom: 1px solid var(--rule);
  display: flex; align-items: center; gap: 8px;
  background: linear-gradient(180deg, rgba(255,255,255,0.25), transparent);
  flex-shrink: 0;
}
.identity-label {
  font-family: var(--font-mono); font-size: 9px;
  color: var(--ink-3); letter-spacing: 0.15em; text-transform: uppercase;
}
.people { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.person {
  font-family: var(--font-mono); font-size: 10px; font-weight: 600;
  padding: 3px 8px; border: 1px solid var(--rule-2); color: var(--ink-3);
  text-transform: uppercase; display: flex; align-items: center; gap: 5px;
  cursor: pointer; background: var(--paper);
}
.person .avatar {
  width: 12px; height: 12px; border-radius: 50%; font-size: 7px;
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 700;
}
.person.me { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.identity-push { flex: 1; }
.identity-hint { font-family: var(--font-serif); font-style: italic; font-size: 11px; color: var(--ink-3); }

/* --- Summary --- */
.summary {
  padding: 10px 18px; border-bottom: 1px solid var(--rule);
  display: flex; justify-content: space-between; align-items: baseline;
  flex-shrink: 0;
}
.date { font-family: var(--font-serif); font-size: 17px; font-weight: 500; }
.date .weekday { font-style: italic; font-weight: 400; color: var(--ink-2); margin-right: 6px; }
.stats {
  font-family: var(--font-mono); font-size: 10px;
  color: var(--ink-3); letter-spacing: 0.05em;
}
.stats b { color: var(--ink); font-weight: 600; }

/* --- Quick add --- */
.quickadd {
  padding: 16px 18px; border-bottom: 1px solid var(--rule);
  background: linear-gradient(180deg, var(--paper-2), transparent);
  display: flex; align-items: center; gap: 12px; position: relative;
  flex-shrink: 0;
  box-shadow: 0 2px 0 var(--rule-2) inset;
}
.quickadd:focus-within {
  background: linear-gradient(180deg, rgba(180,69,31,0.08), transparent);
  box-shadow: 0 2px 0 var(--accent) inset;
}
.quickadd-prompt { font-family: var(--font-mono); font-size: 20px; color: var(--accent); font-weight: 700; line-height: 1; }
.quickadd-input {
  flex: 1; font-family: var(--font-mono); font-size: 15px; color: var(--ink);
  background: transparent; border: none; outline: none;
  padding: 4px 0;
}
.quickadd-input::placeholder { color: var(--ink-3); opacity: 0.7; }
.quickadd-hint {
  font-family: var(--font-mono); font-size: 10px;
  color: var(--ink-3); letter-spacing: 0.08em; text-transform: uppercase;
}
.parse-preview {
  position: absolute; top: 100%; left: 40px; right: 40px;
  padding: 10px 12px; background: var(--ink); color: var(--paper);
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.03em; z-index: 20; display: grid;
  grid-template-columns: auto 1fr; gap: 3px 14px;
  margin-top: 4px;
  box-shadow: 0 6px 20px -6px rgba(0,0,0,0.4);
}
.parse-preview::before {
  content: ''; position: absolute; top: -5px; left: 40px;
  width: 10px; height: 10px; background: var(--ink);
  transform: rotate(45deg);
}
.parse-preview.hidden { display: none; }
.parse-preview .k {
  color: rgba(244,239,230,0.5); letter-spacing: 0.12em;
  text-transform: uppercase; font-size: 8px; line-height: 1.8;
}
.parse-preview .v { color: var(--paper); font-weight: 600; }
.parse-preview .v em {
  font-family: var(--font-serif); font-style: italic;
  font-weight: 400; color: var(--accent-2); margin-left: 5px;
}

/* --- Scroll area --- */
.scroll {
  flex: 1; overflow-y: auto; position: relative;
}
.scroll::-webkit-scrollbar { width: 8px; }
.scroll::-webkit-scrollbar-thumb { background: var(--rule-2); border-radius: 4px; }

/* --- Sections --- */
.section-head {
  padding: 14px 18px 6px; display: flex; align-items: center; gap: 10px;
}
.section-head h2 {
  font-family: var(--font-serif); font-style: italic;
  font-weight: 400; font-size: 13px; color: var(--ink-2);
}
.section-head.mine h2 { color: var(--ink); font-weight: 500; }
.section-head.mine h2 em { color: var(--accent); font-style: italic; }
.section-head.scheduled h2 em { color: var(--c07); font-style: italic; }
.section-head .count {
  font-family: var(--font-mono); font-size: 10px;
  color: var(--ink-3); letter-spacing: 0.08em;
}
.section-head .rule { flex: 1; height: 1px; background: var(--rule); }

.tasks { padding: 0 18px 8px; }
.mine-section {
  background: linear-gradient(90deg, rgba(26,23,20,0.025), transparent 40%);
  position: relative;
}
.mine-section::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: 2px; background: var(--ink); opacity: 0.35;
}

.task {
  padding: 12px 0; border-bottom: 1px dashed var(--rule);
  display: grid; grid-template-columns: 28px 1fr auto;
  gap: 12px; align-items: center; position: relative;
}
.task:last-child { border-bottom: none; }
.task.active {
  background: linear-gradient(90deg, rgba(180,69,31,0.06), transparent 80%);
  margin: 0 -18px; padding-left: 14px; padding-right: 18px;
  border-left: 3px solid var(--accent);
}
.task.done { opacity: 0.5; }
.task.done .title-text { text-decoration: line-through; }

/* "Currently working on" highlight. --working-color is set inline per
   task in JS from the working teammate's palette color. Bold left
   stripe + a strong background tint so the row reads at a glance
   across a long list. */
.task.working {
  cursor: pointer;
  box-shadow: inset 6px 0 0 var(--working-color, transparent);
  background: color-mix(in srgb, var(--working-color, transparent) 22%, transparent);
  margin: 0 -18px;
  padding-left: 16px;
  padding-right: 18px;
}
.task.working .title-text { font-weight: 600; }

/* The colored pill added to the meta row — name + "WORKING" badge. */
.working-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px 2px 2px; border-radius: 99px;
  font-family: var(--font-mono);
  font-size: 10px; font-weight: 700; letter-spacing: 0.06em;
  color: #fff; white-space: nowrap;
}
.working-pill .av {
  width: 16px; height: 16px; border-radius: 50%;
  background: rgba(255,255,255,0.28);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; color: #fff; font-weight: 700;
}

/* Manual "send to Slack" pill button. Subtle by default, brand-purple
   on hover so the affordance is discoverable without dominating. */
.slack-btn {
  font-family: var(--font-mono);
  font-size: 10px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 8px; border-radius: 99px;
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
  transition: background 0.1s ease, color 0.1s ease, border-color 0.1s ease;
}
.slack-btn:hover:not(:disabled) {
  background: #4a154b;  /* Slack aubergine */
  color: #fff;
  border-color: #4a154b;
}
.slack-btn:disabled { cursor: default; opacity: 0.7; }
/* Show a pointer over the empty task area so the "click to mark working"
   affordance is discoverable. Children with their own cursor rules (title
   text/edit, time, checkbox) keep theirs via specificity. */
.task { cursor: pointer; }

/* Checkbox: a checkmark glyph itself, not a square.
   Always visible — muted grey when unchecked, accent-colored when checked. */
.check {
  width: 24px; height: 24px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  background: transparent; border: none; padding: 0;
  color: var(--ink-3);
  font-size: 22px; line-height: 1; font-weight: 700;
  transition: color .1s ease, transform .1s ease;
}
.check::before { content: '✓'; }
.check:hover { color: var(--ink); transform: scale(1.1); }
.check.grabbable { opacity: 0.5; }
.check.grabbable:hover { opacity: 1; color: var(--ink-2); }
.check.checked { color: var(--accent); }
.check.checked:hover { color: var(--accent-2); }

.task-body { min-width: 0; }
.task-meta { display: flex; align-items: center; gap: 6px; margin-bottom: 5px; flex-wrap: wrap; }

.tag {
  font-family: var(--font-mono); font-size: 9px; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase;
  padding: 2px 6px; border-radius: 1px;
  /* Fixed white foreground — tag palette is constant across themes, so contrast
     against the (darkish) tag background must also be constant. */
  color: #fff;
}
.assignee {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--font-mono); font-size: 9px; font-weight: 600;
  letter-spacing: 0.1em; padding: 2px 6px 2px 4px;
  border-radius: 1px; text-transform: uppercase;
}
.assignee .av {
  width: 11px; height: 11px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 6px; color: #fff; font-weight: 700;
}
.assignee.me-badge::after {
  content: 'YOU'; font-size: 8px; background: var(--ink); color: var(--paper);
  padding: 1px 3px; margin-left: 2px; letter-spacing: 0.08em; border-radius: 1px;
}
.assignee.all {
  color: var(--ink-2); background: transparent;
  border: 1px dashed var(--ink-2); padding: 1px 6px 1px 4px;
}
.assignee.all .av { background: var(--ink); color: var(--paper); font-size: 8px; }

.claimed-by {
  display: inline-flex; align-items: center; gap: 3px;
  font-family: var(--font-mono); font-size: 9px;
  color: var(--ink-2); padding: 2px 6px;
  background: var(--paper-2); border: 1px solid var(--rule-2);
  border-left: 2px solid; letter-spacing: 0.05em;
}
.claimed-by::before { content: '✓'; color: var(--ok); font-size: 10px; font-weight: 700; }
.claimed-by b { font-weight: 600; color: var(--ink); }

.claim-btn, .snooze-btn {
  font-family: var(--font-mono); font-size: 9px; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase;
  padding: 2px 7px; color: var(--accent); background: transparent;
  border: 1px solid var(--accent); cursor: pointer; border-radius: 1px;
}
.claim-btn:hover, .snooze-btn:hover { background: var(--accent); color: var(--paper); }

.title-text {
  font-family: var(--font-serif); font-size: 15px; font-weight: 500;
  line-height: 1.3; color: var(--ink); word-wrap: break-word;
  cursor: text;
}
.title-text:hover { background: rgba(0,0,0,0.04); }
textarea.title-edit {
  font-family: var(--font-serif); font-size: 15px; font-weight: 500;
  line-height: 1.3; color: var(--ink); background: var(--paper);
  border: 1px solid var(--accent); border-radius: 3px;
  padding: 2px 6px; width: 100%; box-sizing: border-box;
  outline: none;
  resize: none;
  overflow: hidden;
  min-height: 1.3em;
  word-wrap: break-word;
  white-space: pre-wrap;
}
input.time-edit {
  font-family: var(--font-mono); font-size: 13px; font-weight: 600;
  color: var(--ink); background: var(--paper);
  border: 1px solid var(--accent); border-radius: 3px;
  padding: 2px 6px; width: 120px; box-sizing: border-box;
  outline: none; text-align: right;
}
.time { cursor: pointer; }
.time:hover { opacity: 0.7; }
.sub { font-size: 11px; color: var(--ink-3); margin-top: 3px; font-style: italic; font-family: var(--font-serif); }

.timer { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; margin-top: 2px; }
.time {
  font-family: var(--font-mono); font-size: 13px; font-weight: 600;
  color: var(--ink); line-height: 1;
}
.time.warn { color: var(--accent); }
.time.crit { color: var(--crit); }
.time .auto-dot {
  display: inline-block; width: 4px; height: 4px;
  background: var(--ink-3); border-radius: 50%;
  margin-right: 4px; vertical-align: middle;
}
.time.scheduled {
  color: var(--c07); display: flex; flex-direction: column;
  align-items: flex-end; gap: 2px; font-weight: 600;
}
.time.scheduled .clock { font-size: 13px; letter-spacing: -0.01em; }
.time.scheduled .when {
  font-family: var(--font-serif); font-style: italic;
  font-size: 10px; font-weight: 400; color: var(--ink-3); letter-spacing: 0;
}
.time.scheduled.today .when { color: var(--accent); }
.bar {
  width: 70px; height: 3px; background: var(--paper-2);
  border: 1px solid var(--rule); position: relative; overflow: hidden;
}
.bar-fill { position: absolute; inset: 0 auto 0 0; background: var(--ink-2); transition: width .3s; }
.bar-fill.warn { background: var(--accent); }
.bar-fill.crit { background: var(--crit); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

.sched-icon { width: 9px; height: 9px; color: var(--c07); flex-shrink: 0; }

/* --- Continuous strobes tied to time remaining ---
   flash-warn fires while the task has 25%–10% time left (yellow, gentle).
   flash-crit fires below 10% or past-due (red, faster and more urgent).
   Both are theme-dependent: --accent is the theme's yellow/amber, --crit
   is its red. Background is tinted via color-mix so light + dark themes
   both read correctly without hard-coded RGB values.
   The negative horizontal margin + matching padding make the tint bleed
   out to the full viewport column width, same trick used for the old
   flash alerts. */
@keyframes strobeWarn {
  0%, 100% { background-color: transparent; }
  50%      { background-color: color-mix(in srgb, var(--accent) 22%, transparent); }
}
@keyframes strobeCrit {
  0%, 100% { background-color: transparent; opacity: 1; }
  50%      { background-color: color-mix(in srgb, var(--crit) 28%, transparent); opacity: 0.7; }
}
.task.flash-warn {
  animation: strobeWarn 1.2s ease-in-out infinite;
  margin: 0 -18px; padding-left: 18px; padding-right: 18px;
}
.task.flash-crit {
  animation: strobeCrit 0.8s ease-in-out infinite;
  margin: 0 -18px; padding-left: 18px; padding-right: 18px;
}

/* --- Whole-screen strobe: any task expired for >5 minutes --- */
@keyframes screenFlash {
  0%, 100% { background-color: transparent; }
  50%      { background-color: rgba(140, 29, 14, 0.30); }
}
#app.screen-flash-crit::after {
  content: ''; position: absolute; inset: 0;
  pointer-events: none; z-index: 9999;
  animation: screenFlash 0.8s ease-in-out infinite;
}

/* --- Edit controls --- */
.assignee, .tag { cursor: pointer; }
.time-adjust {
  display: inline-flex; gap: 0; margin-top: 3px;
}
.time-adjust button {
  font-family: var(--font-mono); font-size: 9px; font-weight: 600;
  padding: 1px 6px; background: var(--paper-2); border: 1px solid var(--rule-2);
  color: var(--ink-2); cursor: pointer; letter-spacing: 0.05em;
}
.time-adjust button:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.time-adjust button:first-child { border-right: none; }
.assignee-menu {
  position: absolute; background: var(--ink); color: var(--paper);
  padding: 4px 0; z-index: 50; min-width: 100px;
  box-shadow: 0 6px 20px -6px rgba(0,0,0,0.4);
  font-family: var(--font-mono); font-size: 10px;
}
.assignee-menu button {
  display: block; width: 100%; text-align: left;
  background: transparent; color: var(--paper); border: none;
  padding: 5px 12px; cursor: pointer; font-family: inherit; font-size: inherit;
  text-transform: uppercase; letter-spacing: 0.08em;
}
.assignee-menu button:hover { background: rgba(255,255,255,0.1); }

.empty-state {
  padding: 40px 20px; text-align: center;
  font-family: var(--font-serif); font-style: italic;
  color: var(--ink-3); font-size: 13px;
}

/* --- Footer --- */
.footer {
  border-top: 1px solid var(--rule); padding: 8px 18px;
  display: flex; justify-content: space-between; align-items: center;
  font-family: var(--font-mono); font-size: 10px;
  color: var(--ink-3); letter-spacing: 0.08em; text-transform: uppercase;
  background: var(--paper-2); flex-shrink: 0;
}
.footer .tabs { display: flex; gap: 14px; }
.footer .tab { cursor: pointer; }
.footer .tab.active { color: var(--ink); font-weight: 600; }
.footer .tab.active::before {
  content: ''; display: inline-block; width: 4px; height: 4px;
  border-radius: 50%; background: var(--accent);
  margin-right: 6px; vertical-align: middle;
}

/* --- Settings --- */
.settings-page {
  display: flex; flex-direction: column; height: 100vh;
  background: var(--paper); position: relative; z-index: 1;
}
.settings-tabs {
  display: flex; border-bottom: 1px solid var(--rule);
  background: var(--paper-2);
}
.settings-tab {
  padding: 10px 18px; cursor: pointer;
  font-family: var(--font-mono); font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--ink-3); border-bottom: 2px solid transparent;
}
.settings-tab.active { color: var(--ink); border-bottom-color: var(--accent); }
.settings-body { flex: 1; overflow-y: auto; padding: 20px; }
.settings-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0; border-bottom: 1px dashed var(--rule);
}
.settings-row input[type=text], .settings-row input[type=number], .settings-row select {
  font-family: var(--font-mono); font-size: 12px;
  padding: 5px 8px; border: 1px solid var(--rule-2); background: var(--paper);
  color: var(--ink); outline: none;
}
.settings-row input[type=color] {
  width: 32px; height: 28px; border: 1px solid var(--rule-2); padding: 0; background: none;
}
.settings-row .grow { flex: 1; }
.btn {
  font-family: var(--font-mono); font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.1em;
  padding: 5px 10px; background: var(--ink); color: var(--paper);
  border: none; cursor: pointer;
}
.btn.secondary { background: transparent; color: var(--ink); border: 1px solid var(--rule-2); }
.btn.danger { background: var(--crit); color: var(--paper); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--rule-2); }
.stepper button {
  background: var(--paper-2); border: none; padding: 4px 9px; cursor: pointer;
  font-family: var(--font-mono); font-size: 12px;
}
.stepper input {
  width: 50px; text-align: center; border: none; border-left: 1px solid var(--rule-2);
  border-right: 1px solid var(--rule-2); font-family: var(--font-mono); font-size: 12px;
  background: var(--paper);
}
.settings-section-title {
  font-family: var(--font-serif); font-style: italic; font-size: 18px;
  margin-bottom: 10px; color: var(--ink);
}
.settings-add-row {
  display: flex; gap: 8px; padding: 14px 0 8px; border-top: 1px solid var(--rule);
  margin-top: 14px;
}
.color-swatch {
  width: 16px; height: 16px; border-radius: 2px; display: inline-block;
  border: 1px solid var(--rule-2);
}

.theme-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px; margin-top: 12px;
}
.theme-card {
  border: 1px solid var(--rule-2); cursor: pointer;
  padding: 0; display: flex; flex-direction: column;
  background: var(--paper); transition: transform .1s ease;
}
.theme-card:hover { transform: translateY(-2px); }
.theme-card.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset; }
.theme-card .swatch-row {
  display: flex; height: 44px;
}
.theme-card .swatch-row > div { flex: 1; }
.theme-card .meta {
  padding: 8px 10px; display: flex; flex-direction: column; gap: 2px;
}
.theme-card .meta .name {
  font-family: var(--font-serif); font-size: 14px; font-weight: 500;
  color: var(--ink);
}
.theme-card .meta .mood {
  font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ink-3);
}

/* ================================================================== */
/*  Web-only additions. The extension runs in a fixed side-panel so it */
/*  assumed a narrow-column layout. On the web we need a centered      */
/*  column on wide screens and full-bleed on phones.                   */
/* ================================================================== */

html, body { margin: 0; padding: 0; }
body {
  background: var(--paper);
  min-height: 100vh;
}

#app {
  max-width: 560px;
  margin: 0 auto;
  padding: 0 16px;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

/* Password gate overlay. Plaintext password never touches the DOM; the
   input value is hashed in-browser before being compared. */
.gate-overlay {
  position: fixed; inset: 0; z-index: 10000;
  background: var(--paper);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.gate-card {
  max-width: 320px; width: 100%;
  display: flex; flex-direction: column; gap: 12px;
  text-align: center;
}
.gate-title {
  font-family: var(--font-serif); font-size: 28px; font-weight: 600;
  color: var(--ink);
}
.gate-sub {
  font-family: var(--font-serif); font-style: italic;
  color: var(--ink-3); font-size: 14px;
}
.gate-input {
  font-family: var(--font-mono); font-size: 16px;
  padding: 12px 14px;
  border: 1px solid var(--rule); border-radius: 6px;
  background: var(--paper);
  color: var(--ink); width: 100%;
  box-sizing: border-box;
  outline: none;
}
.gate-input:focus { border-color: var(--accent); }
.gate-btn {
  font-family: var(--font-mono); font-size: 13px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  padding: 12px 18px;
  background: var(--ink); color: var(--paper);
  border: none; border-radius: 6px; cursor: pointer;
}
.gate-btn:hover:not(:disabled) { background: var(--accent); }
.gate-btn:disabled { opacity: 0.5; cursor: default; }
.gate-err {
  font-family: var(--font-mono); font-size: 11px;
  color: var(--crit); letter-spacing: 0.04em;
}

/* ================================================================== */
/*  Touch-device overrides                                             */
/*                                                                      */
/*  `(pointer: coarse)` picks up phones, tablets, and laptops in touch  */
/*  mode — anywhere a fingertip is the primary input. Desktop mice are  */
/*  unaffected. Targets Apple's 44pt / Google's 48dp minimum-tappable   */
/*  guideline without blowing up typography on the narrow column.      */
/* ================================================================== */
@media (pointer: coarse) {

  /* Done checkbox — the single most-tapped control. */
  .check {
    width: 40px; height: 40px;
    font-size: 28px;
  }

  /* Chip-row controls (claim, snooze, slack, assignee, tag). Bump
     padding + font so fingertips can hit them without zooming. */
  .claim-btn, .snooze-btn,
  .slack-btn {
    font-size: 11px;
    padding: 7px 12px;
  }
  .assignee, .tag {
    font-size: 11px;
    padding: 6px 9px 6px 7px;
  }
  .assignee .av { width: 14px; height: 14px; font-size: 8px; }
  .assignee.me-badge::after { font-size: 10px; padding: 2px 4px; }
  .claimed-by { font-size: 11px; padding: 5px 8px; }

  /* ±5m time buttons — previously 1-pixel-padding micro-buttons. */
  .time-adjust { margin-top: 6px; }
  .time-adjust button {
    font-size: 12px;
    padding: 8px 14px;
    min-width: 52px;
  }

  /* Settings page controls */
  .btn {
    font-size: 12px;
    padding: 10px 16px;
  }
  .stepper button { padding: 10px 16px; font-size: 14px; }
  .settings-tab { padding: 14px 18px; font-size: 12px; }
  .settings-row input[type=text],
  .settings-row input[type=number],
  .settings-row select {
    font-size: 14px;
    padding: 10px 12px;
  }
  .settings-row input[type=color] {
    width: 44px; height: 40px;
  }

  /* Assignee pop-up menu */
  .assignee-menu { font-size: 12px; min-width: 140px; }
  .assignee-menu button { padding: 12px 16px; }

  /* Gear / back icon in the titlebar */
  .gear-btn svg { width: 20px; height: 20px; }
  .gear-btn { padding: 6px; }

  /* Footer tabs (Current / Done) */
  .footer { padding: 12px 18px; font-size: 12px; }
  .footer .tabs { gap: 20px; }
  .footer .tab { padding: 4px 0; }

  /* Quick-add input */
  .quickadd { padding: 12px 14px; }
  .quickadd-input { font-size: 16px; /* prevents iOS auto-zoom on focus */ }
  .quickadd-prompt { font-size: 24px; }
  .quickadd-hint { font-size: 14px; }
}
