/* ============================================================
   dot.css — Dot-inspired Hub interface
   Step 1: static shell (gallery + chat) with the Dot aesthetic.
   ============================================================ */

:root {
  --bg-top: #2a1b3d;
  --bg-bottom: #050309;
  --glass: rgba(255, 255, 255, 0.07);
  --glass-strong: rgba(255, 255, 255, 0.11);
  --hairline: rgba(255, 255, 255, 0.12);
  --text: rgba(255, 255, 255, 0.95);
  --text-dim: rgba(255, 255, 255, 0.55);
  --text-faint: rgba(255, 255, 255, 0.32);
  --accent: #4a9eff;
  --radius: 22px;
  --radius-lg: 30px;
  --ease-spring: cubic-bezier(0.22, 1, 0.36, 1);
  --dot-bg:
    radial-gradient(120% 80% at 50% -10%, rgba(120, 80, 200, 0.45), transparent 60%),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 70%);
  --font-display: ui-rounded, "SF Pro Rounded", "Hiragino Maru Gothic ProN",
    system-ui, -apple-system, sans-serif;
  --font-body: -apple-system, system-ui, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--dot-bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

#dot-root {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: var(--dot-bg);
  transition: background 0.6s var(--ease-spring);
}

/* Accent glow that shifts to the active agent's color */
#dot-root::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(90% 60% at 50% 8%, var(--accent), transparent 55%);
  opacity: var(--root-glow, 0.18);
  transition: opacity 0.6s var(--ease-spring), background 0.6s var(--ease-spring);
  pointer-events: none;
}

/* ---------- Views ---------- */
.view {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
}
/* The morph engine drives transform/opacity per-frame via inline styles,
   so these two must NOT carry CSS transitions (they would fight the rAF spring). */
#home-view, #gallery-view, #chat-view, #detail-view {
  transition: none;
  will-change: transform, opacity, filter;
}
#chat-view, #gallery-view, #detail-view {
  transform-origin: 0 0;   /* grow from the tile/card top-left during a zoom */
}
/* L2 visibility is a pure function of the authoritative nav state (data-l2),
   NOT the spring animation (which only drives the grow/shrink transform). This
   makes a stalled animation unable to leave a layer visible/clickable on top. */
#chat-view, #detail-view {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.28s var(--ease-spring),
    visibility 0s linear 0.28s;
}
#dot-root[data-l2="chat"] #chat-view,
#dot-root[data-l2="detail"] #detail-view {
  visibility: visible;
  transition-delay: 0s;
}
#dot-root[data-l2="chat"]   #chat-view   { opacity: 1; pointer-events: auto; }
#dot-root[data-l2="detail"] #detail-view { opacity: 1; pointer-events: auto; }
/* Parent space recedes while an L2 is open (also state-driven, not spring-driven). */
#space-pager { transition: opacity 0.28s var(--ease-spring), filter 0.28s var(--ease-spring); }
#dot-root[data-l2="chat"]   #space-pager,
#dot-root[data-l2="detail"] #space-pager { opacity: 0; filter: blur(10px); pointer-events: none; }
.view.hidden {
  opacity: 0;
  pointer-events: none;
}

/* Status bar (faux 9:41 like the demo) */
.status-bar {
  position: relative;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 26px 4px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: var(--text);
  flex: 0 0 auto;
}
.pwa-status-heading {
  display: none;
}
html.pwa-standalone .status-bar,
html.ios-standalone .status-bar {
  justify-content: space-between;
  min-height: calc(max(env(safe-area-inset-top), 30px) + 74px);
  padding: calc(max(env(safe-area-inset-top), 30px) + 22px) 24px 12px;
  z-index: 80;
  pointer-events: none;
}
html.pwa-standalone .status-bar .clock,
html.ios-standalone .status-bar .clock {
  display: none;
}
html.pwa-standalone .status-right,
html.ios-standalone .status-right {
  position: relative;
  z-index: 2;
  margin-left: auto;
  pointer-events: auto;
}
html.pwa-standalone .pwa-status-heading,
html.ios-standalone .pwa-status-heading {
  min-width: 0;
  max-width: calc(100% - 124px);
  min-height: 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-right: 14px;
  pointer-events: none;
}
html.pwa-standalone .status-kicker,
html.ios-standalone .status-kicker {
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.2px;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
html.pwa-standalone .status-title,
html.ios-standalone .status-title {
  margin-top: 4px;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 650;
  letter-spacing: 0;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
html.pwa-standalone .bell-btn,
html.ios-standalone .bell-btn {
  width: 48px;
  height: 48px;
  touch-action: manipulation;
}
html.pwa-standalone #home-view > .space-head,
html.pwa-standalone #gallery-view .space > .space-head,
html.ios-standalone #home-view > .space-head,
html.ios-standalone #gallery-view .space > .space-head {
  display: none;
}

/* ============================================================
   GALLERY VIEW  (zoomed-out: choose an agent)
   ============================================================ */
#gallery-view { padding-bottom: env(safe-area-inset-bottom); }

.gallery-head {
  padding: 8px 28px 18px;
  flex: 0 0 auto;
}
.gallery-kicker {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--text-faint);
}
.gallery-title {
  font-family: var(--font-display);
  font-size: 46px;
  font-weight: 600;
  line-height: 1.02;
  letter-spacing: -0.5px;
  margin-top: 4px;
  color: var(--text);
}

.agent-deck {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 4px 20px 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scrollbar-width: none;
}
.agent-deck::-webkit-scrollbar { display: none; }

.agent-card {
  position: relative;
  border-radius: var(--radius-lg);
  padding: 22px 22px 20px;
  background: var(--glass);
  border: 1px solid var(--hairline);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.4s var(--ease-spring), background 0.3s ease;
  --card-accent: #4a9eff;
}
.agent-card:active { transform: scale(0.975); }
.agent-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(80% 120% at 0% 0%, var(--card-accent), transparent 60%);
  opacity: 0.22;
  pointer-events: none;
}

.agent-card-name {
  position: relative;
  font-family: var(--font-display);
  font-size: 40px;
  font-weight: 600;
  line-height: 0.98;
  letter-spacing: -0.6px;
}
.agent-card-role {
  position: relative;
  margin-top: 8px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.4px;
  color: var(--card-accent);
  filter: brightness(1.5);
}
.agent-card-summary {
  position: relative;
  margin-top: 10px;
  font-size: 15px;
  line-height: 1.4;
  color: var(--text-dim);
  max-width: 90%;
}
.agent-card-dot {
  position: absolute;
  top: 22px;
  right: 22px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--card-accent);
  box-shadow: 0 0 14px var(--card-accent);
}
/* pulsing dot while one of the agent's conversations is thinking */
@keyframes agent-thinking { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.55); opacity: 0.45; } }
.agent-card.thinking .agent-card-dot { animation: agent-thinking 1s ease-in-out infinite; }

/* ============================================================
   CHAT VIEW  (zoomed-in: talk to the agent)
   ============================================================ */
.chat-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 20px 10px;
  flex: 0 0 auto;
  z-index: 3;
}
.chat-head > div:not(.chat-head-spacer) {
  min-width: 0;
}
.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--hairline);
  background: var(--glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: var(--text);
  font-size: 20px;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex: 0 0 auto;
  transition: transform 0.2s var(--ease-spring), background 0.2s ease;
}
.icon-btn:active { transform: scale(0.9); }
.chat-agent-name {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-agent-status {
  font-size: 12px;
  color: var(--accent);
  filter: brightness(1.4);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-head-spacer { flex: 1 1 auto; }

/* Mode toggle: text / push-to-talk / conversation */
.mode-toggle {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--hairline);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.mode-btn {
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 600;
  padding: 7px 13px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.25s var(--ease-spring);
}
.mode-btn.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 16px -4px var(--accent);
}

/* Slideable content pane (horizontal agent swipe moves this) */
.chat-pane {
  position: relative;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  will-change: transform, opacity;
}

/* Peeking neighbor labels at the screen edges during a horizontal swipe */
.peek-label {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -1px;
  color: var(--text);
  opacity: 0;
  pointer-events: none;
  z-index: 2;
  transition: opacity 0.15s linear;
}
.peek-left  { left: 18px; }
.peek-right { right: 18px; }

/* Giant watermark agent name behind transcript */
.chat-watermark {
  position: absolute;
  top: 64px;
  left: 22px;
  font-family: var(--font-display);
  font-size: 88px;
  font-weight: 700;
  line-height: 0.88;
  letter-spacing: -2px;
  color: var(--text);
  opacity: 0.06;
  pointer-events: none;
  z-index: 0;
}

.transcript {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 18px 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: none;
}
.transcript::-webkit-scrollbar { display: none; }

.transcript-hint {
  margin: auto;
  color: var(--text-faint);
  font-size: 15px;
  text-align: center;
  padding: 24px;
}
.bubble pre {
  margin: 8px 0 2px;
  padding: 10px 12px;
  background: rgba(0,0,0,0.28);
  border-radius: 12px;
  overflow-x: auto;
  font-size: 13px;
}
.bubble code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.92em; }
.bubble a { color: inherit; text-decoration: underline; }

.bubble {
  max-width: 82%;
  padding: 13px 17px;
  border-radius: 20px;
  font-size: 16px;
  line-height: 1.42;
  overflow-wrap: anywhere;   /* long URLs wrap inside the bubble */
  word-break: break-word;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--hairline);
  animation: bubble-in 0.4s var(--ease-spring) both;
}
.bubble.user {
  align-self: flex-end;
  background: var(--glass-strong);
  border-bottom-right-radius: 6px;
}
.bubble.agent {
  align-self: flex-start;
  background: rgba(120, 80, 200, 0.18);
  border-bottom-left-radius: 6px;
}
@keyframes bubble-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}

/* Page dots (agent position indicator) */
.page-dots {
  display: flex;
  justify-content: center;
  gap: 7px;
  padding: 4px 0 8px;
  flex: 0 0 auto;
}
.page-dots .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-faint);
  transition: all 0.3s var(--ease-spring);
}
.page-dots .dot.active {
  width: 20px;
  border-radius: 3px;
  background: var(--text);
}
.page-dots .dot.edge { transform: scale(0.55); opacity: 0.5; }   /* hint there are more */

/* Bottom input bar (+ / Chat… / mic) */
.input-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 18px calc(16px + env(safe-area-inset-bottom));
  flex: 0 0 auto;
  z-index: 3;
}
.input-pill {
  flex: 1 1 auto;
  height: 48px;
  padding: 0 18px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--hairline);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  outline: none;
}
.input-pill::placeholder { color: var(--text-dim); }
.input-pill:focus { border-color: var(--accent); }
.mic-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex: 0 0 auto;
  box-shadow: 0 6px 20px -6px var(--accent);
  transition: transform 0.2s var(--ease-spring);
  /* Press-and-hold must not trigger text selection / iOS callout / scrolling */
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.mic-btn:active { transform: scale(0.9); }
.mic-btn svg { width: 22px; height: 22px; pointer-events: none; }   /* events target the button */
.mic-btn.recording {
  background: #ff4b4b;
  box-shadow: 0 0 0 0 rgba(255, 75, 75, 0.55);
  animation: mic-pulse 1.2s ease-out infinite;
}
.mic-btn.pulsing { box-shadow: 0 0 18px -2px var(--accent); }
@keyframes mic-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(255, 75, 75, 0.55); }
  100% { box-shadow: 0 0 0 18px rgba(255, 75, 75, 0); }
}

/* Small "step 1 — static shell" build badge */
.build-badge {
  position: fixed;
  bottom: 6px;
  right: 10px;
  font-size: 10px;
  letter-spacing: 0.5px;
  color: var(--text-faint);
  z-index: 50;
  pointer-events: none;
}

/* ============================================================
   Notifications (step 6) — Dot-themed bell, panel, toasts
   ============================================================ */
.status-right { display: flex; align-items: center; gap: 12px; }

.bell-btn {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--hairline);
  background: var(--glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.2s var(--ease-spring), background 0.2s ease;
}
.bell-btn:active { transform: scale(0.9); }
.bell-btn svg { width: 19px; height: 19px; }
.bell-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: #ff3b6b;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: grid;
  place-items: center;
  box-shadow: 0 0 12px rgba(255, 59, 107, 0.7);
}
.bell-badge.hidden { display: none; }

/* Slide-in panel */
.notif-scrim {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s var(--ease-spring);
}
.notif-scrim.open { opacity: 1; pointer-events: auto; }

.notif-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 61;
  width: min(92vw, 420px);
  display: flex;
  flex-direction: column;
  pointer-events: none;
  visibility: hidden;
  transform: translateX(102%);
  transition:
    transform 0.4s var(--ease-spring),
    visibility 0s linear 0.4s;
  background:
    radial-gradient(120% 50% at 100% 0%, rgba(120, 80, 200, 0.28), transparent 60%),
    linear-gradient(180deg, rgba(28, 20, 44, 0.96), rgba(8, 5, 16, 0.97));
  border-left: 1px solid var(--hairline);
  backdrop-filter: blur(30px) saturate(140%);
  -webkit-backdrop-filter: blur(30px) saturate(140%);
  padding-top: env(safe-area-inset-top);
}
.notif-panel.open {
  pointer-events: auto;
  visibility: visible;
  transform: translateX(0);
  transition-delay: 0s;
}

.notif-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 12px;
  flex: 0 0 auto;
}
.notif-title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.4px;
}

.notif-enable {
  margin: 0 16px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px;
  border-radius: 16px;
  border: 1px solid var(--hairline);
  background: var(--glass);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
}
.notif-enable .notif-enable-cta {
  font-weight: 700;
  color: #fff;
  background: linear-gradient(180deg, #9a7dff, #7e56d6);
  padding: 6px 14px;
  border-radius: 999px;
  box-shadow: 0 6px 18px -6px rgba(126, 86, 214, 0.8);
}
.notif-enable.hidden { display: none; }

.notif-list {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 6px 16px calc(24px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: none;
}
.notif-list::-webkit-scrollbar { display: none; }

.notif-card {
  position: relative;
  padding: 14px 16px 14px 18px;
  border-radius: 18px;
  background: var(--glass);
  border: 1px solid var(--hairline);
  border-left: 3px solid var(--c, var(--accent));
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  animation: notif-in 0.35s var(--ease-spring) both;
  overflow-wrap: anywhere;
}
@keyframes notif-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.notif-card .nc-title { font-size: 15px; font-weight: 600; color: var(--text); }
.notif-card .nc-body  { margin-top: 4px; font-size: 14px; line-height: 1.4; color: var(--text-dim); }
.notif-card .nc-meta  { margin-top: 8px; font-size: 11.5px; letter-spacing: 0.3px; color: var(--text-faint); text-transform: uppercase; }
.notif-card .nc-dot   { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--c, var(--accent)); margin-right: 6px; vertical-align: middle; }

.notif-empty {
  margin: auto;
  text-align: center;
  color: var(--text-faint);
  font-size: 15px;
  padding: 40px 24px;
}

/* Live toasts */
.toast-stack {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 12px);
  left: 0;
  right: 0;
  z-index: 70;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  padding: 0 12px;
}
.toast {
  pointer-events: auto;
  width: min(92vw, 440px);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 16px;
  border-radius: 16px;
  border: 1px solid var(--hairline);
  border-left: 3px solid var(--c, var(--accent));
  background:
    radial-gradient(120% 100% at 0% 0%, rgba(120, 80, 200, 0.18), transparent 60%),
    rgba(20, 14, 30, 0.86);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  box-shadow: 0 18px 50px -16px rgba(0, 0, 0, 0.7);
  cursor: pointer;
  transform: translateY(-22px);
  opacity: 0;
  transition: transform 0.4s var(--ease-spring), opacity 0.3s ease;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast .t-title { font-size: 14.5px; font-weight: 600; color: var(--text); }
.toast .t-body { margin-top: 2px; font-size: 13px; line-height: 1.35; color: var(--text-dim);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.toast .t-dot { flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; background: var(--c, var(--accent)); box-shadow: 0 0 10px var(--c, var(--accent)); }

/* ============================================================
   Multi-space pager (step 7) — Today / Agents / Library / Settings
   ============================================================ */
.space-tabs {
  display: flex;
  gap: 4px;
  margin: 4px 20px 6px;
  padding: 4px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--hairline);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  flex: 0 0 auto;
}
.space-tab {
  flex: 1 1 0;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 6px;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.2s, background 0.25s var(--ease-spring);
}
.space-tab.active { color: #fff; background: rgba(255, 255, 255, 0.14); }

.space-pager {
  flex: 1 1 auto;
  display: flex;
  overflow-x: hidden;        /* no user swipe between spaces — navigate via Home pinch */
  overflow-y: hidden;
  scrollbar-width: none;
  min-height: 0;
}
.space-pager::-webkit-scrollbar { display: none; }

.space {
  flex: 0 0 100%;
  width: 100%;
  scroll-snap-align: start;
  overflow-y: auto;
  scrollbar-width: none;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.space::-webkit-scrollbar { display: none; }

.space-head { padding: 6px 28px 16px; flex: 0 0 auto; }
.space-kicker {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--text-faint);
}
.space-title {
  font-family: var(--font-display);
  font-size: 40px;
  font-weight: 600;
  line-height: 1.02;
  letter-spacing: -0.5px;
  margin-top: 4px;
  color: var(--text);
}

/* agent deck inside a space: the space scrolls, not the deck */
.space .agent-deck { flex: 0 0 auto; overflow: visible; padding-top: 0; }

.space-body {
  padding: 0 20px calc(28px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Generic Dot card (today / library) */
.dot-card {
  position: relative;
  padding: 16px 18px 16px 18px;
  border-radius: var(--radius);
  background: var(--glass);
  border: 1px solid var(--hairline);
  border-left: 3px solid var(--c, var(--accent));
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
}
.dot-card.tappable { cursor: pointer; transition: transform 0.2s var(--ease-spring), background 0.2s; }
.dot-card.tappable:active { transform: scale(0.985); }
.dot-card .dc-title { font-size: 16px; font-weight: 600; color: var(--text); }
.dot-card .dc-body { margin-top: 6px; font-size: 14px; line-height: 1.45; color: var(--text-dim); }
.dot-card .dc-meta { margin-top: 10px; font-size: 11.5px; letter-spacing: 0.3px; text-transform: uppercase; color: var(--text-faint); }
.dot-card .dc-tags { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.dot-card .dc-tag { font-size: 11px; padding: 3px 9px; border-radius: 999px; background: rgba(255,255,255,0.08); color: var(--text-dim); }

.section-label {
  margin: 10px 4px 2px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-faint);
}
.space-empty { margin: 32px auto; color: var(--text-faint); font-size: 15px; text-align: center; }

/* Quick capture and asset grids for top-level mobile spaces */
.dot-quickadd {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
  padding: 10px;
  border-radius: var(--radius);
  background: var(--glass);
  border: 1px solid var(--hairline);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.dot-quickadd.collapsed {
  gap: 0;
}
.dot-collapse-trigger,
.bookmark-filter-toggle {
  width: 100%;
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--hairline);
  border-radius: 16px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.06);
  color: var(--text);
  font-family: var(--font-body);
  text-align: left;
  cursor: pointer;
}
.dot-collapse-trigger strong,
.bookmark-filter-toggle strong {
  display: block;
  font-size: 15px;
  font-weight: 800;
}
.dot-collapse-trigger small,
.bookmark-filter-toggle small {
  display: block;
  margin-top: 2px;
  color: var(--text-dim);
  font-size: 12.5px;
  line-height: 1.25;
}
.dot-collapse-cta,
.bookmark-filter-cta {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(255,255,255,0.1);
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}
.dot-quick-row {
  display: flex;
  gap: 10px;
  align-items: center;
}
.dot-quick-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.78fr);
  gap: 10px;
}
.dot-quick-input {
  min-width: 0;
  flex: 1 1 auto;
  height: 42px;
  border: none;
  outline: none;
  border-radius: 999px;
  padding: 0 14px;
  background: rgba(255,255,255,0.08);
  color: var(--text);
  font-size: 15px;
}
.dot-quick-input::placeholder { color: var(--text-dim); }
.dot-field {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.dot-field span {
  padding-left: 2px;
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}
.dot-field input,
.dot-field select,
.dot-field textarea {
  min-width: 0;
  max-width: 100%;
  width: 100%;
  border: 1px solid var(--hairline);
  outline: none;
  border-radius: 14px;
  padding: 10px 11px;
  background: rgba(255,255,255,0.08);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
}
.dot-field input,
.dot-field select {
  height: 42px;
}
.dot-field textarea {
  min-height: 76px;
  resize: vertical;
  line-height: 1.4;
}
.dot-field textarea::placeholder { color: var(--text-faint); }
.dot-field input:focus,
.dot-field select:focus,
.dot-field textarea:focus { border-color: var(--accent); }
.dot-quick-btn {
  flex: 0 0 auto;
  height: 42px;
  border: none;
  border-radius: 999px;
  padding: 0 16px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 18px -8px var(--accent);
}
.dot-quick-btn:disabled { opacity: 0.55; cursor: default; }
.dot-form-error {
  padding: 9px 11px;
  border-radius: 12px;
  background: rgba(255, 75, 75, 0.12);
  border: 1px solid rgba(255, 75, 75, 0.22);
  color: #ffb3b3;
  font-size: 13px;
  line-height: 1.35;
}
.dot-form-error.hidden { display: none; }

.asset-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--hairline);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.asset-tab {
  flex: 1 1 0;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 700;
  padding: 9px 8px;
  border-radius: 999px;
  cursor: pointer;
}
.asset-tab.active { color: #fff; background: rgba(255,255,255,0.14); }
.asset-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.asset-card {
  min-width: 0;
  border: 1px solid var(--hairline);
  border-left: 3px solid var(--c, var(--accent));
  border-radius: 18px;
  background: var(--glass);
  color: var(--text);
  padding: 10px;
  cursor: pointer;
  text-align: left;
  overflow: hidden;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  transition: transform 0.2s var(--ease-spring), background 0.2s;
}
.asset-card:active { transform: scale(0.985); }
.asset-thumb {
  width: 100%;
  aspect-ratio: 1;
  display: block;
  border-radius: 12px;
  object-fit: cover;
  background: rgba(255,255,255,0.06);
}
.video-thumb {
  display: grid;
  place-items: center;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}
.asset-label {
  margin-top: 8px;
  font-size: 12.5px;
  line-height: 1.25;
  color: var(--text-dim);
  overflow-wrap: anywhere;
}

.bookmark-tools {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius);
  background: var(--glass);
  border: 1px solid var(--hairline);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.bookmark-filter-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.bookmark-filter-panel.hidden {
  display: none;
}
.bookmark-search {
  display: flex;
  gap: 10px;
  align-items: center;
}
.bookmark-query {
  min-width: 0;
  flex: 1 1 auto;
  height: 42px;
  border: 1px solid var(--hairline);
  outline: none;
  border-radius: 999px;
  padding: 0 14px;
  background: rgba(255,255,255,0.08);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
}
.bookmark-query::placeholder { color: var(--text-faint); }
.bookmark-query:focus { border-color: var(--accent); }
.bookmark-submit,
.bookmark-clear {
  flex: 0 0 auto;
  height: 42px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 0 14px;
  background: rgba(255,255,255,0.08);
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}
.bookmark-submit {
  border-color: transparent;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 6px 18px -10px var(--accent);
}
.bookmark-submit:not(.pending) {
  background: rgba(255,255,255,0.08);
  border-color: var(--hairline);
  color: var(--text-dim);
  box-shadow: none;
}
.bookmark-grid,
.bookmark-custom-dates {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.bookmark-custom-dates.hidden { display: none; }
.bookmark-field {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.bookmark-field span {
  padding-left: 2px;
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}
.bookmark-field select,
.bookmark-field input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--hairline);
  outline: none;
  border-radius: 14px;
  padding: 0 11px;
  background: rgba(255,255,255,0.08);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
}
.bookmark-field select:focus,
.bookmark-field input:focus { border-color: var(--accent); }
.bookmark-tags {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding-bottom: 1px;
  scrollbar-width: none;
}
.bookmark-tags::-webkit-scrollbar { display: none; }
.bookmark-tag {
  flex: 0 0 auto;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  color: var(--text-dim);
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.bookmark-tag.active {
  border-color: transparent;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 6px 18px -10px var(--accent);
}
.bookmark-count {
  padding: 0 2px;
  color: var(--text-faint);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
}
.bookmark-results {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Settings rows */
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-radius: var(--radius);
  background: var(--glass);
  border: 1px solid var(--hairline);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.setting-row.tappable { cursor: pointer; transition: transform 0.2s var(--ease-spring), background 0.2s; }
.setting-row.tappable:active { transform: scale(0.985); background: rgba(255,255,255,0.1); }
.setting-row .sr-main { min-width: 0; }
.setting-row .sr-title { font-size: 16px; font-weight: 600; color: var(--text); }
.setting-row .sr-sub { margin-top: 3px; font-size: 13px; color: var(--text-dim); }
.setting-row .sr-cta { flex: 0 0 auto; font-size: 18px; color: var(--text-faint); }
.setting-row.danger .sr-title { color: #ff6b6b; }
.setting-row.danger .sr-cta { color: #ff6b6b; }
.setting-row.notification-setting {
  width: 100%;
  color: inherit;
  font: inherit;
  text-align: left;
  appearance: none;
  -webkit-appearance: none;
}
.setting-row.notification-setting:disabled {
  cursor: default;
  opacity: 1;
}
.settings-control {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 9px;
}
.settings-switch {
  position: relative;
  flex: 0 0 auto;
  --switch-x: 0px;
  width: 50px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.14);
  box-shadow: inset 0 1px 5px rgba(0,0,0,0.22);
  transition: background 0.22s var(--ease-spring), border-color 0.22s var(--ease-spring);
}
.settings-switch > span {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 4px 12px rgba(0,0,0,0.28);
  transform: translateX(var(--switch-x));
  transition: transform 0.22s var(--ease-spring);
}
.settings-switch.on {
  --switch-x: 20px;
  border-color: rgba(80, 235, 184, 0.55);
  background: linear-gradient(180deg, #50ebb8, #1eaa87);
}
.settings-switch.busy > span {
  animation: settingsSwitchPulse 0.85s ease-in-out infinite alternate;
}
.settings-action-pill {
  flex: 0 0 auto;
  min-width: 62px;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.1);
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  text-align: center;
}
.voice-settings-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.voice-agent-row {
  --voice-accent: var(--accent);
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  border-radius: var(--radius);
  border: 1px solid var(--hairline);
  border-left: 3px solid var(--voice-accent);
  background: var(--glass);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.voice-agent-label {
  min-width: 0;
}
.voice-agent-label strong,
.voice-agent-label span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.voice-agent-label strong {
  color: var(--text);
  font-size: 15px;
  font-weight: 800;
}
.voice-agent-label span {
  margin-top: 2px;
  color: var(--text-dim);
  font-size: 12.5px;
}
.voice-agent-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px 48px;
  gap: 8px;
  align-items: center;
}
.voice-select {
  min-width: 0;
  width: 100%;
  height: 44px;
  border: 1px solid var(--hairline);
  border-radius: 14px;
  padding: 0 34px 0 12px;
  background:
    linear-gradient(45deg, transparent 50%, var(--text-dim) 50%) right 16px center / 6px 6px no-repeat,
    linear-gradient(135deg, var(--text-dim) 50%, transparent 50%) right 10px center / 6px 6px no-repeat,
    rgba(255,255,255,0.08);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  appearance: none;
  -webkit-appearance: none;
}
.voice-select:focus {
  outline: none;
  border-color: var(--voice-accent);
}
.voice-preview-btn {
  width: 44px;
  height: 44px;
  border: 1px solid var(--hairline);
  border-radius: 14px;
  background: rgba(255,255,255,0.1);
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}
.voice-preview-btn:disabled {
  opacity: 0.55;
  cursor: default;
}
.voice-save-status {
  min-width: 48px;
  color: #50ebb8;
  font-size: 12px;
  font-weight: 800;
  opacity: 0;
  text-align: right;
  transition: opacity 0.18s;
}
.voice-save-status.visible { opacity: 1; }
.voice-save-status.error { color: #ff8d9a; }
@keyframes settingsSwitchPulse {
  from { opacity: 0.58; transform: translateX(var(--switch-x)) scale(0.96); }
  to { opacity: 1; transform: translateX(var(--switch-x)) scale(1); }
}

@media (max-width: 380px) {
  .settings-control { gap: 7px; }
  .settings-action-pill {
    min-width: 54px;
    padding-inline: 8px;
  }
  .voice-agent-controls {
    grid-template-columns: minmax(0, 1fr) 42px;
  }
  .voice-save-status {
    grid-column: 1 / -1;
    min-height: 15px;
    text-align: left;
  }
}

/* ============================================================
   Home (L0) — spaces as pinchable tiles (zoom-stack)
   ============================================================ */
#home-view { padding-bottom: env(safe-area-inset-bottom); }
.home-deck {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 4px 20px 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scrollbar-width: none;
}
.home-deck::-webkit-scrollbar { display: none; }

.space-tile {
  position: relative;
  border-radius: var(--radius-lg);
  padding: 26px 24px;
  min-height: 116px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: var(--glass);
  border: 1px solid var(--hairline);
  border-left: 3px solid var(--c, var(--accent));
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.4s var(--ease-spring), background 0.3s ease;
}
.space-tile:active { transform: scale(0.975); }
.space-tile::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(80% 120% at 0% 0%, var(--c, var(--accent)), transparent 60%);
  opacity: 0.18;
  pointer-events: none;
}
.space-tile .tile-name {
  position: relative;
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 600;
  letter-spacing: -0.5px;
}
.space-tile .tile-sub {
  position: relative;
  margin-top: 6px;
  font-size: 15px;
  line-height: 1.4;
  color: var(--text-dim);
}

/* ============================================================
   Detail view (L2) — Today/Library reader
   ============================================================ */
.detail-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 8px 24px calc(28px + env(safe-area-inset-bottom));
  scrollbar-width: none;
  will-change: transform, opacity;
}
.detail-body::-webkit-scrollbar { display: none; }
#detail-title {
  max-width: calc(100vw - 112px);
}
.detail-display {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.5px;
  line-height: 1.06;
  margin: 6px 0 14px;
}
.detail-meta {
  font-size: 12px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 16px;
}
.detail-text {
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  white-space: normal;
  overflow-wrap: anywhere;
}
.detail-text a { color: inherit; text-decoration: underline; }
.detail-media {
  margin: 10px 0 18px;
  border-radius: 18px;
  overflow: hidden;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--hairline);
}
.detail-media img,
.detail-media video {
  display: block;
  width: 100%;
  max-height: 58vh;
  object-fit: contain;
  background: rgba(0,0,0,0.22);
}
.detail-actions { margin-top: 22px; display: flex; flex-direction: column; gap: 10px; }
.detail-action {
  display: block;
  text-align: center;
  padding: 14px 18px;
  border-radius: 16px;
  border: 1px solid var(--hairline);
  background: var(--glass);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  transition: transform 0.2s var(--ease-spring), background 0.2s;
}
.detail-action.primary { background: linear-gradient(180deg, #9a7dff, #7e56d6); border-color: transparent; box-shadow: 0 8px 24px -8px rgba(126,86,214,0.8); }
.detail-action:active { transform: scale(0.98); }
.detail-tags { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 6px; }
.detail-tags .dc-tag { font-size: 12px; padding: 4px 11px; border-radius: 999px; background: rgba(255,255,255,0.08); color: var(--text-dim); }

.detail-review-controls,
.detail-task-controls {
  margin-top: 20px;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--glass);
  border: 1px solid var(--hairline);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.detail-task-controls.collapsed {
  padding: 12px;
}
.detail-task-summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.detail-task-summary-title {
  color: var(--text);
  font-size: 15px;
  font-weight: 800;
}
.detail-task-summary-sub {
  margin-top: 3px;
  color: var(--text-dim);
  font-size: 12.5px;
  line-height: 1.3;
}
.detail-task-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.detail-task-editor-head span {
  color: var(--text);
  font-size: 15px;
  font-weight: 800;
}
.detail-task-editor-head button {
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 7px 11px;
  background: rgba(255,255,255,0.08);
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.detail-review-label,
.detail-task-label {
  display: block;
  margin: 4px 2px 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-faint);
}
.detail-task-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.78fr);
  gap: 10px;
}
.detail-task-field {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}
.detail-task-field span {
  padding-left: 2px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-faint);
}
.detail-task-input,
.detail-task-field input,
.detail-task-field select,
.detail-task-field textarea {
  min-width: 0;
  max-width: 100%;
  width: 100%;
  border: 1px solid var(--hairline);
  border-radius: 16px;
  outline: none;
  padding: 12px 13px;
  background: rgba(0,0,0,0.18);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
}
.detail-task-input {
  height: 46px;
  margin-bottom: 12px;
}
.detail-task-field input,
.detail-task-field select {
  height: 46px;
}
.detail-task-field input[type="date"],
.detail-task-field input[type="time"],
.dot-field input[type="date"],
.dot-field input[type="time"] {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mobile-picker-shell {
  position: relative;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 46px;
  display: flex;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--hairline);
  border-radius: 16px;
  padding: 0 13px;
  background: rgba(0,0,0,0.18);
  color: var(--text);
}
.dot-field .mobile-picker-shell {
  height: 42px;
  border-radius: 14px;
  background: rgba(255,255,255,0.08);
}
.mobile-picker-value {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1;
}
.mobile-picker-shell.empty .mobile-picker-value {
  color: var(--text-faint);
}
.mobile-picker-shell input[type="date"],
.mobile-picker-shell input[type="time"] {
  position: absolute;
  inset: 0;
  width: 100%;
  max-width: 100%;
  height: 100%;
  margin: 0;
  border: 0;
  border-radius: inherit;
  padding: 0;
  background: transparent;
  color: transparent;
  opacity: 0.01;
  appearance: auto;
  -webkit-appearance: auto;
  cursor: pointer;
}
.mobile-picker-shell:focus-within {
  border-color: var(--accent);
}
.detail-task-field textarea {
  min-height: 96px;
  resize: vertical;
  line-height: 1.42;
}
.detail-task-field textarea::placeholder { color: var(--text-faint); }
.detail-task-input:focus,
.detail-task-field input:focus,
.detail-task-field select:focus,
.detail-task-field textarea:focus { border-color: var(--accent); }
.detail-review-content,
.detail-review-guidance {
  width: 100%;
  min-height: 96px;
  resize: vertical;
  border: 1px solid var(--hairline);
  border-radius: 16px;
  outline: none;
  padding: 12px 13px;
  background: rgba(0,0,0,0.18);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.42;
}
.detail-review-guidance {
  min-height: 78px;
  margin-bottom: 12px;
}
.detail-review-content:focus,
.detail-review-guidance:focus { border-color: var(--accent); }
.detail-review-guidance::placeholder { color: var(--text-faint); }
.detail-review-count {
  margin: 7px 2px 12px;
  text-align: right;
  font-size: 12px;
  color: var(--text-faint);
}
.detail-review-count.over { color: #ff6b6b; }
.detail-review-actions,
.detail-task-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}
.detail-review-btn,
.detail-task-btn {
  min-width: 0;
  height: 44px;
  border-radius: 14px;
  border: 1px solid var(--hairline);
  background: rgba(255,255,255,0.08);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.2s var(--ease-spring), opacity 0.2s;
}
.detail-review-btn.primary,
.detail-task-btn.primary {
  border-color: transparent;
  background: var(--accent);
  box-shadow: 0 8px 22px -10px var(--accent);
}
.detail-review-btn.warn { color: #ffd166; }
.detail-review-btn.danger,
.detail-task-btn.danger { color: #ff8a8a; }
.detail-review-btn:active,
.detail-task-btn:active { transform: scale(0.97); }
.detail-review-btn:disabled,
.detail-task-btn:disabled { opacity: 0.55; cursor: default; transform: none; }
.detail-review-error,
.detail-task-error {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 75, 75, 0.12);
  border: 1px solid rgba(255, 75, 75, 0.22);
  color: #ffb3b3;
  font-size: 13px;
  line-height: 1.35;
}

@media (max-width: 480px) {
  .dot-quick-grid,
  .detail-task-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 380px) {
  .bookmark-search {
    flex-wrap: wrap;
  }
  .bookmark-query {
    flex-basis: 100%;
  }
  .bookmark-submit,
  .bookmark-clear {
    flex: 1 1 0;
  }
}

/* Disable the browser's own pinch-zoom (iOS Safari) on all touch surfaces so
   our pinch drives the zoom-stack; pan/scroll still works. (mic-btn keeps none) */
.view, .agent-deck, .home-deck, .space, .space-pager, .chat-pane, .transcript,
.detail-body, .agent-card, .space-tile, .dot-card, .asset-card, .asset-grid,
.dot-quickadd, .bookmark-tools, .bookmark-tags, .detail-review-controls,
.detail-task-controls, .notif-panel, .notif-list {
  touch-action: pan-x pan-y;
}

/* (L2 pointer-events/visibility now handled by the data-l2 gate above.) */

@media (max-width: 380px), (max-height: 740px) {
  .status-bar {
    padding: 10px 18px 2px;
  }

  .status-right {
    gap: 8px;
  }

  .bell-btn {
    width: 36px;
    height: 36px;
  }

  .space-head {
    padding: 4px 22px 12px;
  }

  .space-title {
    font-size: 34px;
    line-height: 1.04;
  }

  .home-deck,
  .agent-deck {
    padding: 2px 16px 22px;
    gap: 12px;
  }

  .space-tile {
    min-height: 102px;
    padding: 20px 20px;
  }

  .space-tile .tile-name,
  .agent-card-name {
    font-size: 31px;
  }

  .space-tile .tile-sub,
  .agent-card-summary {
    font-size: 14px;
  }

  .agent-card {
    padding: 18px 18px 16px;
    border-radius: 26px;
  }

  .chat-head {
    gap: 8px;
    padding: 4px 14px 8px;
  }

  .chat-agent-name {
    max-width: 88px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mode-toggle {
    gap: 2px;
    padding: 3px;
  }

  .mode-btn {
    padding: 7px 9px;
    font-size: 11px;
  }

  .transcript {
    padding: 14px 16px 10px;
  }

  .bubble {
    max-width: 88%;
    padding: 12px 15px;
    font-size: 15px;
  }

  .input-bar {
    gap: 8px;
    padding: 7px 14px calc(12px + env(safe-area-inset-bottom));
  }

  .input-pill {
    height: 46px;
    padding: 0 15px;
  }

  .mic-btn {
    width: 46px;
    height: 46px;
  }

  .notif-panel {
    width: min(96vw, 420px);
  }

  .notif-header {
    padding: 16px 16px 10px;
  }

  .notif-list {
    padding-inline: 12px;
  }
}

@media (display-mode: standalone) {
  .status-bar {
    justify-content: space-between;
    min-height: calc(max(env(safe-area-inset-top), 30px) + 74px);
    padding: calc(max(env(safe-area-inset-top), 30px) + 22px) 24px 12px;
    z-index: 80;
    pointer-events: none;
  }

  .status-bar .clock {
    display: none;
  }

  .status-right {
    position: relative;
    z-index: 2;
    margin-left: auto;
    pointer-events: auto;
  }

  .pwa-status-heading {
    min-width: 0;
    max-width: calc(100% - 124px);
    min-height: 48px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-right: 14px;
    pointer-events: none;
  }

  .status-kicker {
    color: var(--text-faint);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1.2px;
    line-height: 1;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .status-title {
    margin-top: 4px;
    color: var(--text);
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 650;
    letter-spacing: 0;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .bell-btn {
    width: 48px;
    height: 48px;
    touch-action: manipulation;
  }

  #home-view > .space-head,
  #gallery-view .space > .space-head {
    display: none;
  }
}
