/* Kobie components. One layout density, no glow, no glass, no gradients as decoration. */

/* ---------- Key gate ---------- */
.gate {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--screen-pad);
}
.gate-card {
  width: 100%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  gap: var(--s4);
  text-align: center;
}
.gate-card h1 { font-size: var(--type-hero); font-weight: 700; letter-spacing: -0.5px; margin: 0 0 var(--s2); }
.gate-error {
  color: var(--text);
  font-size: var(--type-meta);
  min-height: 1.25rem;
  margin: 0;
}

/* ---------- Intro ---------- */
.intro {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--screen-pad);
  text-align: center;
  gap: var(--s4);
}
.intro-dots { display: flex; gap: var(--s2); margin-top: var(--s6); }
.intro-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); }
.intro-dot.on { background: var(--accent); }
.intro-skip {
  margin-top: var(--s4);
  color: var(--muted);
  font-size: var(--type-meta);
  min-height: var(--tap-min);
  padding: 0 var(--s4);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 var(--s6);
  border-radius: var(--r-comp);
  font-size: var(--type-body);
  font-weight: 500;
  line-height: 1.2;
}
.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
}
.btn-primary:disabled { opacity: 0.4; }
.btn-quiet {
  border: 1px solid var(--border-strong);
  color: var(--text);
}
.btn-full { width: 100%; }

/* ---------- NOW surface ---------- */
.now { flex: 1; display: flex; flex-direction: column; padding: 0 var(--screen-pad); }

.status-strip {
  display: flex;
  align-items: center;
  min-height: var(--tap-min);
  margin-top: max(var(--s4), env(safe-area-inset-top));
  font-size: var(--type-meta);
  color: var(--muted);
  text-align: left;
  width: 100%;
}
.status-strip .pending-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  margin-right: var(--s2);
  flex: none;
}

.hero-zone {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--s8) 0;
  min-height: 40dvh;
}
.hero-title { margin: 0 0 var(--s3); overflow-wrap: break-word; }
.hero-title.clamp {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.hero-why { margin-bottom: var(--s6); }
.hero-actions { display: flex; gap: var(--s3); }
.hero-actions .btn { flex: 1; min-height: 56px; }

.then-line {
  display: flex;
  align-items: center;
  min-height: var(--tap-min);
  margin-bottom: max(var(--s6), env(safe-area-inset-bottom));
  font-size: var(--type-meta);
  color: var(--muted);
  text-align: left;
  width: 100%;
}

/* Snooze chips under the action row */
.snooze-chips { display: flex; gap: var(--s2); margin-top: var(--s4); }

/* "Is this still real?" compassionate check */
.real-check {
  margin-top: var(--s4);
  padding: var(--s4);
  border: 1px solid var(--border);
  border-radius: var(--r-comp);
  background: var(--surface);
}
.real-check p { margin: 0 0 var(--s3); font-size: var(--type-body); }
.real-check .row { display: flex; gap: var(--s2); }
.real-check .row .btn { flex: 1; min-height: var(--tap-min); padding: 0 var(--s2); }

/* Inline hero expansion (details under the title) */
.hero-detail {
  margin-top: var(--s4);
  padding-top: var(--s4);
  border-top: 1px solid var(--border);
}
.hero-detail .notes { font-size: var(--type-body); margin: 0 0 var(--s3); white-space: pre-wrap; }
.hero-detail .contract { margin: 0 0 var(--s3); }
.hero-more-row { display: flex; justify-content: flex-start; margin-top: var(--s3); }
.hero-more-row .btn { min-height: var(--tap-min); padding: 0 var(--s4); }

/* Pending / queued mark on an item */
.queued-mark {
  display: inline-flex;
  align-items: center;
  gap: var(--s1);
  font-size: var(--type-meta);
  color: var(--muted);
  margin-top: var(--s2);
}
.queued-mark .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }

/* ---------- Rescue state ---------- */
.rescue-label { margin-bottom: var(--s3); }
.rescue-options { display: flex; flex-direction: column; gap: var(--s2); margin: var(--s4) 0; }
.rescue-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  width: 100%;
  min-height: 64px;
  padding: var(--s3) var(--s4);
  border: 1px solid var(--border);
  border-radius: var(--r-comp);
  background: var(--surface);
  gap: var(--s1);
}
.rescue-option .t-body { font-weight: 500; }

/* ---------- FAB ---------- */
.fab {
  position: fixed;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 28px;
  font-weight: 400;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 40;
}

/* ---------- Sheets ---------- */
.scrim {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 50;
}
.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 51;
  background: var(--surface);
  border-radius: var(--r-sheet) var(--r-sheet) 0 0;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.5);
  padding: 0 var(--screen-pad) calc(var(--screen-pad) + env(safe-area-inset-bottom));
  max-height: 92dvh;
  display: flex;
  flex-direction: column;
}
.sheet.peek { max-height: 60dvh; }
.sheet.full { max-height: 92dvh; }
.sheet.tall { min-height: 70dvh; }
.drag-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--faint);
  margin: var(--s3) auto var(--s4);
  flex: none;
}
.sheet h2 { margin: 0 0 var(--s4); }
.sheet-body { overflow-y: auto; flex: 1; }

/* Top sheet (status panel) */
.sheet-top {
  top: 0;
  bottom: auto;
  border-radius: 0 0 var(--r-sheet) var(--r-sheet);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  max-height: 60dvh;
}

/* Menu sheet rows */
.menu-row {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 56px;
  padding: 0 var(--s2);
  font-size: var(--type-body);
  text-align: left;
  border-top: 1px solid var(--border);
}
.menu-row:first-of-type { border-top: none; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: var(--screen-pad);
  right: var(--screen-pad);
  bottom: calc(88px + env(safe-area-inset-bottom));
  z-index: 60;
  background: var(--raised);
  border-radius: var(--r-comp);
  padding: var(--s3) var(--s4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4);
  border: 1px solid var(--border);
}
.toast-msg { font-size: var(--type-body); margin: 0; flex: 1; }
.toast-undo {
  color: var(--accent);
  font-size: var(--type-body);
  font-weight: 500;
  min-height: var(--tap-min);
  padding: 0 var(--s2);
  flex: none;
}

/* ---------- Chips ---------- */
.chips { display: flex; gap: var(--s2); overflow-x: auto; padding-bottom: var(--s2); }
.chip {
  flex: none;
  min-height: var(--tap-min);
  padding: 0 var(--s4);
  border-radius: var(--r-chip);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: var(--type-body);
  display: inline-flex;
  align-items: center;
}
.chip[aria-pressed="true"] {
  border-color: var(--accent);
  color: var(--accent);
}

/* ---------- Text field ---------- */
.field {
  width: 100%;
  min-height: 56px;
  border-radius: var(--r-comp);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: var(--type-body);
  padding: 0 var(--s4);
}
.field:focus { border: 2px solid var(--accent); outline: none; padding: 0 calc(var(--s4) - 1px); }
textarea.field {
  padding: var(--s4);
  line-height: 1.5;
  resize: none;
  min-height: 120px;
}
textarea.field:focus { padding: calc(var(--s4) - 1px); }

/* ---------- Capture sheet ---------- */
.capture-row { display: flex; gap: var(--s3); margin-top: var(--s4); align-items: stretch; }
.capture-row .btn-primary { flex: 1; }
.mic-btn {
  width: 52px;
  min-height: 52px;
  border-radius: var(--r-comp);
  border: 1px solid var(--border-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex: none;
  position: relative;
}
.mic-btn.listening { border-color: var(--accent); color: var(--accent); }
.mic-btn.listening::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 16px;
  border: 2px solid var(--accent);
  opacity: 0.6;
}
.capture-err { margin: var(--s3) 0 0; display: flex; gap: var(--s3); align-items: center; flex-wrap: wrap; }

/* ---------- Today drawer ---------- */
.timeline {
  height: 120px;
  border: 1px solid var(--border);
  border-radius: var(--r-comp);
  background: var(--bg);
  position: relative;
  margin-bottom: var(--s2);
  overflow: hidden;
  flex: none;
}
.timeline-event {
  position: absolute;
  top: 12px;
  bottom: 34px;
  background: var(--event-fill);
  border-radius: 8px;
  min-width: 8px;
  border: none;
  padding: 0;
}
.timeline-event .t-meta { display: none; }
.timeline-now {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--accent);
}
.timeline-scale {
  position: absolute;
  bottom: 8px;
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  color: var(--faint);
  font-size: 0.75rem;
}
.timeline-next { margin: 0 0 var(--s4); }
.event-detail {
  border: 1px solid var(--border);
  border-radius: var(--r-comp);
  padding: var(--s3) var(--s4);
  margin-bottom: var(--s4);
  background: var(--bg);
}

.task-list { display: flex; flex-direction: column; }
.task-row {
  display: flex;
  align-items: flex-start;
  gap: var(--s3);
  width: 100%;
  min-height: 64px;
  padding: var(--s3) var(--s2);
  text-align: left;
  border-top: 1px solid var(--border);
}
.task-row .status-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 8px; flex: none; }
.status-dot.active { background: var(--accent); }
.status-dot.waiting { background: var(--faint); }
.task-row .task-main { flex: 1; min-width: 0; }
.task-row .task-title { font-size: var(--type-body); font-weight: 500; margin: 0; overflow-wrap: break-word; }
.task-row .task-sub { margin: var(--s1) 0 0; display: flex; gap: var(--s2); align-items: center; }
.task-row .task-time { margin-left: auto; flex: none; padding-left: var(--s3); }
.task-expand {
  padding: 0 var(--s2) var(--s4) calc(var(--s3) + 8px);
  border-top: none;
}
.task-expand .notes { white-space: pre-wrap; margin: 0 0 var(--s3); }
.task-expand .row-actions { display: flex; gap: var(--s2); margin-top: var(--s3); }
.task-expand .row-actions .btn { flex: 1; min-height: 52px; padding: 0 var(--s2); font-size: 0.9375rem; }

/* ---------- Status panel ---------- */
.status-rows { display: flex; flex-direction: column; }
.status-row {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 56px;
  font-size: var(--type-body);
  text-align: left;
  border-top: 1px solid var(--border);
  padding: 0 var(--s2);
  gap: var(--s2);
}
.status-row:first-child { border-top: none; }
.status-row .chev { margin-left: auto; color: var(--faint); }
.status-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: var(--s4);
  padding-top: var(--s4);
  border-top: 1px solid var(--border);
}

/* ---------- Settings ---------- */
.settings-list { display: flex; flex-direction: column; }
.settings-row {
  display: flex;
  align-items: center;
  gap: var(--s3);
  width: 100%;
  min-height: 56px;
  padding: var(--s2);
  font-size: var(--type-body);
  text-align: left;
  border-top: 1px solid var(--border);
}
.settings-row:first-child { border-top: none; }
.settings-row .value { margin-left: auto; color: var(--muted); font-size: var(--type-meta); flex: none; }
.settings-sub { padding: var(--s2); }
.seg { display: flex; gap: var(--s2); margin-top: var(--s2); }
.seg .chip { flex: 1; justify-content: center; }

/* ---------- Skeletons ---------- */
.skel { position: relative; overflow: hidden; background: var(--surface); border-radius: var(--r-comp); }
.skel::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(232, 234, 237, 0.06), transparent);
}
.skel-hero-title { height: 34px; width: 80%; margin-bottom: var(--s3); }
.skel-hero-why { height: 16px; width: 45%; margin-bottom: var(--s6); }
.skel-hero-actions { display: flex; gap: var(--s3); }
.skel-hero-actions .skel { height: 56px; flex: 1; }
.skel-timeline { height: 120px; margin-bottom: var(--s4); }
.skel-row { height: 64px; margin-bottom: var(--s2); }

/* ---------- Error states ---------- */
.error-card {
  border: 1px solid var(--border);
  border-radius: var(--r-hero);
  background: var(--surface);
  padding: var(--s6) var(--screen-pad);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: var(--s4);
  align-items: center;
}
.error-card p { margin: 0; }
.inline-error {
  display: flex;
  align-items: center;
  gap: var(--s3);
  flex-wrap: wrap;
  padding: var(--s3) var(--s4);
  border: 1px solid var(--border);
  border-radius: var(--r-comp);
  background: var(--surface);
  margin-top: var(--s3);
}
.inline-error p { margin: 0; flex: 1; min-width: 140px; }

/* ---------- Stuck micro-scaffold ---------- */
.stuck-actions { display: flex; flex-direction: column; gap: var(--s3); margin-top: var(--s4); }
.stuck-quiet-row { display: flex; gap: var(--s2); }
.stuck-quiet-row .btn { flex: 1; min-height: var(--tap-min); }

/* ---------- Empty state ---------- */
.empty-next { margin-top: var(--s3); }

/* ---------- Desktop ---------- */
@media (min-width: 560px) {
  .now, .sheet { max-width: 480px; margin-left: auto; margin-right: auto; }
  .sheet { left: 50%; right: auto; transform: translateX(-50%); width: min(480px, 100%); border-radius: var(--r-sheet); }
  .sheet-top { top: var(--s6); bottom: auto; border-radius: var(--r-sheet); }
  .btn-quiet:hover { background: rgba(255, 255, 255, 0.04); }
  .menu-row:hover, .task-row:hover, .status-row:hover, .settings-row:hover, .rescue-option:hover { background: rgba(255, 255, 255, 0.03); }
  .fab { right: calc(50% - 240px + 16px); }
  .toast { max-width: 480px; margin: 0 auto; }
}
