/* Yorik design system — tokens drive everything.
   Two themes (dark default, light via data-theme="light"), one set of
   spacing / type / motion / elevation tokens that NEVER vary. */

:root {
  /* ── Color tokens (dark mode — the default) ────────────────────── */
  --bg:                  #0a0d14;
  --bg-2:                #0e131c;
  --bg-3:                #131923;
  --card:                rgba(255, 255, 255, 0.035);
  --card-2:              rgba(255, 255, 255, 0.055);
  --card-border:         rgba(255, 255, 255, 0.08);
  --card-border-strong:  rgba(255, 255, 255, 0.14);
  --accent:              #818cf8;
  --accent-2:            #a5b4fc;
  --accent-dim:          rgba(129, 140, 248, 0.5);
  --accent-soft:         rgba(129, 140, 248, 0.12);
  --text:                #e2e8f0;
  --text-dim:            rgba(226, 232, 240, 0.62);
  --text-faint:          rgba(226, 232, 240, 0.40);
  --danger:              #f87171;
  --ok:                  #34d399;
  --warn:                #fbbf24;
  --info:                #60a5fa;

  --backdrop-gradient-1: radial-gradient(1000px 500px at 0% 0%, rgba(129,140,248,0.06), transparent 60%);
  --backdrop-gradient-2: radial-gradient(900px 500px at 100% 100%, rgba(34,211,238,0.04), transparent 60%);

  /* ── Spacing scale (4-pt grid, theme-invariant) ────────────────── */
  --sp-0:   0;
  --sp-1:   4px;
  --sp-2:   8px;
  --sp-3:  12px;
  --sp-4:  16px;
  --sp-5:  20px;
  --sp-6:  24px;
  --sp-7:  32px;
  --sp-8:  48px;
  --sp-9:  64px;

  /* ── Type scale ──────────────────────────────────────────────── */
  --fs-xs:    11px;
  --fs-sm:    12px;
  --fs-base:  13px;
  --fs-md:    14px;
  --fs-lg:    15px;
  --fs-xl:    18px;
  --fs-2xl:   22px;
  --fs-3xl:   28px;
  --fs-4xl:   36px;
  --lh-tight:    1.35;
  --lh-normal:   1.55;
  --lh-relaxed:  1.7;
  --tracking-wide:   0.5px;
  --tracking-wider:  0.7px;

  /* ── Border radius ───────────────────────────────────────────── */
  --r-sm:    4px;
  --r-md:    6px;
  --r-lg:    8px;
  --r-xl:   12px;
  --r-2xl:  16px;
  --r-pill: 999px;

  /* ── Elevation (consistent shadows) ──────────────────────────── */
  --shadow-sm:  0 1px 2px rgba(0, 0, 0, 0.30);
  --shadow-md:  0 4px 12px rgba(0, 0, 0, 0.35);
  --shadow-lg:  0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-xl:  0 16px 48px rgba(0, 0, 0, 0.55);
  --shadow-focus: 0 0 0 3px var(--accent-soft);

  /* ── Motion ──────────────────────────────────────────────────── */
  --t-fast:  120ms;
  --t-base:  200ms;
  --t-slow:  320ms;
  --ease-out:    cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── Light mode ──────────────────────────────────────────────────── */
:root[data-theme="light"] {
  --bg:                  #f7f8fa;
  --bg-2:                #ffffff;
  --bg-3:                #f0f2f6;
  --card:                rgba(0, 0, 0, 0.025);
  --card-2:              rgba(0, 0, 0, 0.045);
  --card-border:         rgba(0, 0, 0, 0.08);
  --card-border-strong:  rgba(0, 0, 0, 0.16);
  --accent:              #6366f1;
  --accent-2:            #4f46e5;
  --accent-dim:          rgba(99, 102, 241, 0.40);
  --accent-soft:         rgba(99, 102, 241, 0.10);
  --text:                #1a1f2e;
  --text-dim:            rgba(26, 31, 46, 0.65);
  --text-faint:          rgba(26, 31, 46, 0.45);
  --danger:              #dc2626;
  --ok:                  #16a34a;
  --warn:                #d97706;
  --info:                #2563eb;
  --backdrop-gradient-1: radial-gradient(1000px 500px at 0% 0%, rgba(99,102,241,0.04), transparent 60%);
  --backdrop-gradient-2: radial-gradient(900px 500px at 100% 100%, rgba(99,102,241,0.025), transparent 60%);
  --shadow-sm:  0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md:  0 4px 12px rgba(15, 23, 42, 0.08);
  --shadow-lg:  0 8px 24px rgba(15, 23, 42, 0.10);
  --shadow-xl:  0 16px 48px rgba(15, 23, 42, 0.14);
}

/* Reduce motion when the user has it disabled. */
@media (prefers-reduced-motion: reduce) {
  :root {
    --t-fast: 0ms; --t-base: 0ms; --t-slow: 0ms;
  }
}

* { box-sizing: border-box; }

/* Lucide icons rendered via <svg><use href="#i-name"/></svg>. Default 16px
   square + inherits currentColor so the icon matches its surrounding text.
   Variants: .icon.sm (14), .icon.md (default 16), .icon.lg (20), .icon.xl (24). */
.icon {
  display: inline-block;
  width: 16px;
  height: 16px;
  vertical-align: -3px;          /* baseline-align with surrounding text */
  stroke: currentColor;
  fill: none;
  flex-shrink: 0;
}
.icon.sm { width: 14px; height: 14px; }
.icon.lg { width: 20px; height: 20px; }
.icon.xl { width: 24px; height: 24px; }
.icon.xxl { width: 32px; height: 32px; }

/* ── Motion + micro-interactions ──────────────────────────────────────
   One consistent transition curve + duration token across every chrome
   element so state changes feel coherent, never twitchy. Per-component
   transforms (hover-rise, press-down) layer on top of these. */
button, .pill, .icon-btn, .dock-tile, .home-tile, .compose-tpl,
.task, select, input, textarea, .docs-list .doc, .compose-actions button {
  transition:
    background-color   var(--t-fast) var(--ease-out),
    border-color       var(--t-fast) var(--ease-out),
    color              var(--t-fast) var(--ease-out),
    box-shadow         var(--t-base) var(--ease-out),
    transform          var(--t-base) var(--ease-out);
}

/* Press feedback — subtle nudge + scale on :active, doesn't fire when
   reduced-motion is on because the durations zero out. */
button:active:not(:disabled),
.dock-tile:active,
.home-tile:active,
.compose-tpl:active,
.task:active {
  transform: translateY(1px) scale(0.985);
}

/* Hover-rise on card-like surfaces (the macOS dock already has its own
   stronger rise; these are subtler for non-dock cards). */
.home-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.compose-tpl:hover { transform: translateX(2px); }
.docs-list .doc:hover { transform: translateX(2px); }

/* Universal accent focus ring. Use :focus-visible (keyboard nav only) so
   mouse-clicks don't flash rings on every button click. */
:where(button, select, input, textarea, [tabindex]):focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}

/* Modal entrance — fade + slide-up. The .modal-back fades; the inner
   .modal rises 8px while easing in. Cheap, classy, fast. */
.modal-back {
  animation: yk-modal-back-in var(--t-base) var(--ease-out);
}
.modal-back > .modal {
  animation: yk-modal-in var(--t-base) var(--ease-out);
}
@keyframes yk-modal-back-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes yk-modal-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0)   scale(1);    }
}

/* ── Skeleton loaders ─────────────────────────────────────────────────
   Shimmer placeholder for any async content. Three sizes (line/title/
   block/avatar). Each panel that loads slow should render a skeleton
   layout that roughly matches the eventual content so the page doesn't
   jump when the data lands. */
.skeleton {
  display: block;
  background: linear-gradient(90deg,
    var(--card) 0%, var(--card-2) 50%, var(--card) 100%);
  background-size: 200% 100%;
  animation: yk-shimmer 1.4s var(--ease-out) infinite;
  border-radius: var(--r-md);
  height: 12px;
}
.skeleton.line   { height: 12px; margin-bottom: 8px; }
.skeleton.title  { height: 18px; width: 55%; margin-bottom: 12px; }
.skeleton.block  { height: 96px; margin-bottom: 12px; }
.skeleton.avatar { width: 36px; height: 36px; border-radius: 50%; }
.skeleton.pill   { height: 28px; border-radius: var(--r-pill); width: 90px; display: inline-block; }
.skeleton-stack  { display: flex; flex-direction: column; gap: 8px; padding: 14px 18px; }
.skeleton-row    { display: flex; gap: 10px; align-items: center; padding: 8px 12px; }
.skeleton-row .skeleton { margin: 0; }
.skeleton-row .col { flex: 1; display: flex; flex-direction: column; gap: 6px; }
@keyframes yk-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Floating ✨ Ask Yorik pill — small entry pop so the user notices it. */
.compose-pill {
  animation: yk-pop-in 220ms var(--ease-bounce);
}
.compose-ask-panel {
  animation: yk-modal-in 180ms var(--ease-out);
}
@keyframes yk-pop-in {
  from { opacity: 0; transform: translateX(-50%) translateY(4px) scale(0.85); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0)   scale(1);    }
}

/* The HTML `hidden` attribute is supposed to set display:none, but our
   custom `display:grid`/`flex` on .chat-view, .docs-view, etc. overrides
   it. Force-respect it across the app. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--backdrop-gradient-1), var(--backdrop-gradient-2), var(--bg);
  color: var(--text);
  font: var(--fs-md)/var(--lh-normal) -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  transition: background-color var(--t-slow) var(--ease-out), color var(--t-slow) var(--ease-out);
}

a { color: var(--accent); }

header.app {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-bottom: 1px solid var(--card-border);
  /* Translucent surface that picks up either palette cleanly. In dark
     mode it reads as a darker bar above the bg gradient; in light mode
     it sits as a soft off-white above the page bg. */
  background: var(--bg-2);
  backdrop-filter: saturate(140%) blur(8px);
  -webkit-backdrop-filter: saturate(140%) blur(8px);
}

header.app h1 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0.5px;
  color: var(--accent);
}

/* Brand mark — left side of the header. Non-interactive; navigation lives
   in the bottom dock. */
.brand-block {
  display: inline-flex;
  align-items: center;
  padding: 4px 4px;
}
.brand-block .brand {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: var(--accent);
  text-transform: lowercase;
}

/* ---- Bottom dock --------------------------------------------------- */

.dock {
  position: fixed;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;        /* inline → shrinks to fit its tiles */
  width: -moz-fit-content;
  width: fit-content;
  max-width: calc(100vw - 24px);
  align-items: center;
  gap: 4px;
  padding: 6px 8px;
  /* Theme-aware surface — picks up either palette cleanly. */
  background: var(--bg-2);
  border: 1px solid var(--card-border-strong);
  border-radius: 20px;
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  z-index: 50;
  overflow-x: auto;
  scrollbar-width: none;
}
.dock::-webkit-scrollbar { display: none; }
.dock-tile {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 160ms cubic-bezier(.34, 1.56, .64, 1),
              background 120ms ease,
              border-color 120ms ease;
  flex-shrink: 0;
}
.dock-tile:hover {
  background: rgba(129, 140, 248, 0.12);
  transform: translateY(-6px) scale(1.12);
}
/* macOS-style neighbour bump: tiles adjacent to a hovered tile lift slightly. */
.dock-tile:hover + .dock-tile,
.dock-tile:has(+ .dock-tile:hover) {
  transform: translateY(-3px) scale(1.05);
}
.dock-tile.active {
  background: rgba(129, 140, 248, 0.18);
  border-color: var(--accent-dim);
}
.dock-tile.active::after {
  content: "";
  position: absolute;
  bottom: -7px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent);
}
.dock-tile .dock-icon {
  font-size: 24px;
  line-height: 1;
}
.dock-tile .dock-tooltip {
  position: absolute;
  bottom: 100%;
  margin-bottom: 8px;
  padding: 4px 8px;
  background: rgba(0, 0, 0, 0.85);
  color: var(--text);
  font-size: 11px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 120ms ease, transform 120ms ease;
}
.dock-tile:hover .dock-tooltip {
  opacity: 1;
  transform: translateY(0);
}
.dock-divider {
  width: 1px;
  height: 30px;
  background: rgba(255, 255, 255, 0.10);
  margin: 0 2px;
  flex-shrink: 0;
}

/* No reserved body padding-bottom — the dock floats over content macOS-style,
   not on top of a reserved "footer" band. Apps that need their own bottom
   safe-area (e.g. iframes) handle it themselves; passive scroll-content
   simply scrolls under the dock with the blur picking up the layer behind. */
@media (max-width: 600px) {
  .dock-tile { width: 46px; height: 46px; }
  .dock-tile .dock-icon { font-size: 22px; }
}

/* ---- HOME app ------------------------------------------------------- */

.stage { padding: 0; }
.home-view {
  padding: 32px 24px 48px;
}
.home-greeting {
  font-size: 22px;
  font-weight: 300;
  letter-spacing: -0.3px;
  margin-bottom: 20px;
  color: var(--text-dim);
}
.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 16px;
}
.home-tile {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 18px;
  padding: 20px 16px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}
.home-tile:hover {
  transform: translateY(-2px);
  background: rgba(129, 140, 248, 0.10);
  border-color: var(--accent-dim);
}
.home-tile .tile-icon {
  font-size: 36px;
  line-height: 1;
}
.home-tile .tile-name {
  font-weight: 600;
  font-size: 14px;
}
.home-tile .tile-desc {
  color: var(--text-dim);
  font-size: 11px;
  line-height: 1.4;
}
.home-tile.community-tile { border-style: dashed; }

/* ---- CHAT app — Grok/GPT-style polished conversation view ──────── */

.chat-view {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 14px;
  /* padding handled by the shared .chat-view rule near the bottom of the
     file so all top-level views share the same outer rhythm. */
  height: calc(100vh - 200px);
  min-height: 480px;
}
@media (max-width: 760px) {
  .chat-view { grid-template-columns: 1fr; }
  .chat-sidebar { display: none; }
}

/* Sidebar — slim list of past conversations */
.chat-sidebar {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}
.chat-sidebar #chat-new {
  background: transparent;
  border: 1px dashed var(--card-border-strong);
  color: var(--text-dim);
  font-weight: 500;
  font-size: 13px;
  padding: 9px 12px;
  border-radius: 10px;
  width: 100%;
  transition: border-color 120ms ease, color 120ms ease, background 120ms ease;
}
.chat-sidebar #chat-new:hover {
  border-color: var(--accent-dim);
  color: var(--accent-2);
  background: var(--accent-soft);
}
.chat-history {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
  margin: 0 -4px;
  padding: 0 4px;
}
.chat-history .conv {
  padding: 9px 11px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-dim);
  border: 1px solid transparent;
  line-height: 1.35;
  transition: background 100ms ease, color 100ms ease;
}
.chat-history .conv:hover { background: var(--card-2); color: var(--text); }
.chat-history .conv.active {
  background: var(--accent-soft);
  color: var(--text);
}
.chat-history .conv .meta {
  font-size: 10px;
  color: var(--text-faint);
  margin-top: 3px;
  letter-spacing: 0.3px;
}

/* Main pane — messages above + ask form below */
.chat-main {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 28px 0 16px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  scroll-behavior: smooth;
}

/* Message rows — avatar + body, like Grok/ChatGPT */
.chat-msg {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 14px;
  padding: 0 28px;
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
  font-size: 14px;
  line-height: 1.65;
  word-wrap: break-word;
}
.chat-msg .avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  flex-shrink: 0;
  margin-top: 2px;
}
.chat-msg.user .avatar {
  background: linear-gradient(135deg, var(--accent), #6366f1);
  color: #0a0d14;
}
.chat-msg.assistant .avatar {
  background: linear-gradient(135deg, #14b8a6, #0d9488);
  color: #052520;
}
.chat-msg.system .avatar {
  background: var(--card-2);
  color: var(--warn);
}
.chat-msg .body {
  min-width: 0;
}
.chat-msg .body .who {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  margin-bottom: 4px;
}
.chat-msg .body .content {
  color: var(--text);
  white-space: pre-wrap;
}
.chat-msg.user .body .who { color: var(--accent-2); }
.chat-msg.system .body .content { color: var(--warn); font-style: italic; font-size: 13px; }
.chat-msg .body .meta {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 6px;
  letter-spacing: 0.2px;
}
.chat-msg .body pre {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 12px 14px;
  margin: 10px 0;
  overflow-x: auto;
  line-height: 1.5;
}
.chat-msg .body code:not(pre code) {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px;
  background: var(--card-2);
  padding: 1px 6px;
  border-radius: 4px;
}
/* Shared empty-state component — one look across Chat, Docs, Apps, etc. */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
  padding: 56px 24px;
  color: var(--text-dim);
}
.empty-state .icon {
  font-size: 44px;
  line-height: 1;
  opacity: 0.65;
  filter: drop-shadow(0 4px 12px rgba(129, 140, 248, 0.18));
}
.empty-state .title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-top: 4px;
}
.empty-state .subtitle {
  font-size: 13px;
  max-width: 360px;
  line-height: 1.5;
}
.empty-state .action {
  margin-top: 8px;
}
/* Chat-empty must also fill the available vertical space so the icon
   centres inside chat-main. */
.chat-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Ask form when docked inside chat-main: drop the top-of-page border, add
   one across the top to separate it from the messages above. */
.ask.ask--in-chat {
  margin: 0;
  padding: 12px 16px;
  border-bottom: none;
  border-top: 1px solid var(--card-border);
  background: rgba(0, 0, 0, 0.25);
  border-radius: 0 0 16px 16px;
}
.ask.ask--in-chat input {
  background: rgba(255, 255, 255, 0.06);
}

/* ---- COMPOSE app (TipTap) ------------------------------------------- */

.compose-view {
  display: grid;
  grid-template-columns: 240px 1fr 320px;
  gap: 14px;
  /* padding from shared .compose-view rule */
  height: calc(100vh - 200px);
  min-height: 480px;
}
@media (max-width: 980px) {
  .compose-view { grid-template-columns: 1fr; }
  .compose-templates, .compose-ai { display: none; }
}

.compose-templates, .compose-ai {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}
.compose-templates-h, .compose-ai-h {
  font-size: 11px;
  color: var(--text-faint);
  letter-spacing: 0.6px;
  text-transform: uppercase;
  font-weight: 600;
}
.compose-templates-list { overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.compose-tpl {
  padding: 9px 11px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 100ms ease;
}
.compose-tpl:hover { background: var(--card-2); }
.compose-tpl.active { background: var(--accent-soft); border-color: var(--accent-dim); }
.compose-tpl-name { font-weight: 600; font-size: 13px; color: var(--text); }
.compose-tpl-desc { font-size: 11px; color: var(--text-faint); margin-top: 2px; line-height: 1.3; }
.compose-empty {
  padding: 16px 8px;
  color: var(--text-faint);
  font-size: 12px;
  text-align: center;
  line-height: 1.5;
}

.compose-editor {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}
.compose-toolbar {
  display: flex;
  gap: 4px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--card-border);
  flex-wrap: wrap;
  align-items: center;
}
.compose-toolbar button {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-dim);
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
}
.compose-toolbar button:hover { background: var(--card-2); color: var(--text); border-color: var(--card-border); }
.compose-toolbar button.active { background: var(--accent-soft); color: var(--accent-2); border-color: var(--accent-dim); }
.compose-toolbar .tb-sep { width: 1px; height: 20px; background: var(--card-border); margin: 0 4px; }

.compose-editor-host {
  flex: 1;
  overflow-y: auto;
  padding: 32px 56px 64px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
}
/* TipTap content styling — make documents feel like documents. */
.compose-editor-host .ProseMirror { outline: none; min-height: 100%; }
.compose-editor-host .ProseMirror p { margin: 0 0 12px; }
.compose-editor-host .ProseMirror h1 { font-size: 26px; font-weight: 600; margin: 24px 0 12px; letter-spacing: -0.3px; }
.compose-editor-host .ProseMirror h2 { font-size: 20px; font-weight: 600; margin: 22px 0 10px; letter-spacing: -0.2px; }
.compose-editor-host .ProseMirror h3 { font-size: 16px; font-weight: 600; margin: 18px 0 8px; }
.compose-editor-host .ProseMirror ul,
.compose-editor-host .ProseMirror ol { padding-left: 22px; margin: 0 0 12px; }
.compose-editor-host .ProseMirror li { margin: 2px 0; }
.compose-editor-host .ProseMirror hr {
  border: none; border-top: 1px solid var(--card-border);
  margin: 24px 0;
}
.compose-editor-host .ProseMirror a { color: var(--accent-2); text-decoration: underline; }
.compose-editor-host .ProseMirror code {
  background: var(--card-2); padding: 1px 6px; border-radius: 4px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 13px;
}
.compose-editor-host .ProseMirror p.is-editor-empty:first-child::before {
  content: attr(data-placeholder);
  color: var(--text-faint);
  float: left;
  pointer-events: none;
  height: 0;
}
/* Tables — for invoice line items. */
.compose-editor-host .tiptap-table {
  border-collapse: collapse;
  margin: 12px 0;
  width: 100%;
  font-size: 13px;
  table-layout: fixed;
}
.compose-editor-host .tiptap-table td,
.compose-editor-host .tiptap-table th {
  border: 1px solid var(--card-border);
  padding: 6px 10px;
  min-width: 60px;
  vertical-align: top;
}
.compose-editor-host .tiptap-table th {
  background: var(--card-2);
  font-weight: 600;
  text-align: left;
}
/* Mention chips — for ${customer.name}-style placeholders. */
.compose-editor-host .tiptap-mention {
  background: var(--accent-soft);
  color: var(--accent-2);
  padding: 1px 7px;
  border-radius: 5px;
  font-size: 12.5px;
  font-weight: 500;
  border: 1px solid var(--accent-dim);
}

.compose-ai-data {
  flex: 1;
  overflow-y: auto;
  font-size: 12px;
  color: var(--text-dim);
}
.compose-ai-data .ai-section { margin-bottom: 14px; }
.compose-ai-data .ai-section-h {
  font-size: 10px; color: var(--text-faint);
  letter-spacing: 0.5px; text-transform: uppercase;
  font-weight: 600; margin-bottom: 6px;
}
.compose-ai-data .ai-template {
  font-size: 13px; color: var(--text); font-weight: 600;
}
.compose-ai-data .ai-row {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 4px 0; border-bottom: 1px solid rgba(255,255,255,0.04);
}
.compose-ai-data .ai-row:last-child { border-bottom: none; }
.compose-ai-data .ai-k {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color: var(--accent-2); font-size: 11.5px;
}
.compose-ai-data .ai-v {
  color: var(--text-dim); text-align: right; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; max-width: 60%;
}
.compose-actions {
  border-top: 1px solid var(--card-border);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.compose-actions button {
  padding: 9px 12px;
  font-size: 13px;
  text-align: left;
}

/* Highlight-and-ask pill + suggestion panel — appear over the editor */
.compose-pill {
  position: absolute;
  z-index: 80;
  display: none;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: var(--accent);
  color: #0a0d14;
  border: none;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(129, 140, 248, 0.4);
  transform: translateX(-50%);
}
.compose-pill:hover { background: var(--accent-2); }

.compose-ask-panel {
  position: absolute;
  z-index: 80;
  width: 360px;
  max-width: 90vw;
  padding: 14px;
  background: var(--bg-3);
  border: 1px solid var(--card-border-strong);
  border-radius: 12px;
  box-shadow: 0 12px 36px rgba(0,0,0,0.55);
}
.compose-ask-h {
  font-size: 11px; color: var(--text-faint);
  letter-spacing: 0.6px; text-transform: uppercase;
  font-weight: 600; margin-bottom: 8px;
}
.compose-ask-sel {
  font-size: 12px; color: var(--text-dim); line-height: 1.4;
  padding: 8px 10px; background: var(--card-2);
  border-radius: 6px; margin-bottom: 10px;
  border-left: 3px solid var(--accent-dim);
}
.compose-ask-row { display: flex; gap: 6px; margin-bottom: 10px; }
.compose-ask-input {
  flex: 1; padding: 8px 12px; font-size: 13px;
  background: var(--card-2); border: 1px solid var(--card-border);
  border-radius: 8px; color: var(--text);
}
.compose-ask-input:focus { border-color: var(--accent-dim); outline: none; }
.compose-ask-go {
  padding: 8px 14px; border-radius: 8px;
  background: var(--accent); color: #0a0d14; font-weight: 600;
  border: 1px solid var(--accent); cursor: pointer;
}
.compose-ask-results { display: flex; flex-direction: column; gap: 6px; }
.compose-ask-loading {
  font-size: 12px; color: var(--text-faint); padding: 6px 4px;
}
.compose-suggestion {
  display: flex; gap: 8px; align-items: center;
  padding: 8px 10px; background: var(--card);
  border: 1px solid var(--card-border); border-radius: 8px;
}
.compose-suggestion-text {
  flex: 1; font-size: 12.5px; line-height: 1.4; color: var(--text);
}
.compose-accept {
  padding: 4px 10px; font-size: 11px;
  background: var(--accent); color: #0a0d14; font-weight: 600;
  border: 1px solid var(--accent); border-radius: 6px; cursor: pointer;
}
.compose-ask-foot { display: flex; justify-content: flex-end; margin-top: 10px; }
.compose-ask-cancel {
  font-size: 12px; padding: 4px 10px; color: var(--text-dim);
  background: transparent; border: 1px solid transparent; border-radius: 6px;
}
.compose-ask-cancel:hover { background: var(--card-2); color: var(--text); }

/* ---- COMMUNITY APP iframe ------------------------------------------- */

/* padding from shared .community-app-view rule */
.community-app-host {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  overflow: hidden;
  min-height: 720px;
}
.community-app-host .app-iframe {
  display: block;
  width: 100%;
}
/* External-iframe apps (Paperless, Immich, future external integrations)
   have their own internal scrolling and don't talk to window.yorik.setHeight.
   Fill viewport - Yorik header. The dock floats on top macOS-style, no
   reserved footer band. Community apps (carpenter / praxis) keep growing
   via setHeight as before. */
.community-app-host:has(.app-iframe[data-kind="external-app"]) {
  height: calc(100vh - 56px);
  min-height: 480px;
}
.community-app-host .app-iframe[data-kind="external-app"] {
  height: 100%;
}

/* Fullscreen app chrome — manifest sets `"chrome": "fullscreen"`. The
   Yorik header collapses; the iframe takes the WHOLE viewport (full
   100vh) and the dock floats on top. No visible Yorik chrome below
   the iframe = no purple stripe behind a white-themed app like Immich.
   Content under the dock area scrolls behind it just like macOS. */
body.chrome-fullscreen {
  padding-bottom: 0;   /* reclaim the dock-reservation space */
}
/* Fullscreen apps (Immich, etc.): strip ALL Yorik chrome above the iframe
   — header, ask bar, response panel — so the iframe is the entire page
   and the dock is the only floating element. Same look as a praxis app
   with no surrounding padding band. */
body.chrome-fullscreen header.app,
body.chrome-fullscreen #ask-form,
body.chrome-fullscreen #response {
  display: none !important;
}
body.chrome-fullscreen #app-stage,
body.chrome-fullscreen .community-app-view {
  padding: 0 !important;
  margin: 0 !important;
}
body.chrome-fullscreen .community-app-host {
  background: transparent;
  border: none;
  border-radius: 0;
  /* !important to defeat the .community-app-host:has(.app-iframe
     [data-kind="external-app"]) rule which has higher specificity
     and otherwise leaves a 56 px gap (the now-hidden header height
     it was originally subtracting). */
  height: 100vh !important;
  min-height: 100vh !important;
  margin: 0;
}
body.chrome-fullscreen .community-app-host .app-iframe {
  height: 100vh !important;
  display: block;
}
/* Fullscreen apps (e.g. Immich) hide ONLY the Yorik header. Dock + voice FAB
   stay visible — the dock's home tile is the way back to the launcher. */

/* ---- DOCS app — modern file listing ──────────────────────────────── */

.docs-view {
  /* padding from shared .docs-view rule */
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: calc(100vh - 200px);
  min-height: 480px;
}
.docs-search-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 6px 6px 6px 14px;
}
.docs-search-bar input {
  flex: 1;
  padding: 9px 0;
  font-size: 14px;
  background: transparent;
  border: none;
  outline: none;
}
.docs-search-bar input:focus { box-shadow: none; }
.docs-search-bar button {
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
}
.docs-body {
  flex: 1;
  overflow: hidden;
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 14px;
}
@media (max-width: 800px) {
  .docs-body { grid-template-columns: 1fr; }
}

/* File list — proper row layout with icon + metadata */
.docs-list {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 6px;
  overflow-y: auto;
}
.docs-list .doc {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 9px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 100ms ease, border-color 100ms ease;
}
.docs-list .doc:hover { background: var(--card-2); }
.docs-list .doc.active {
  background: var(--accent-soft);
  border-color: var(--accent-dim);
}
.docs-list .doc .file-icon {
  width: 36px;
  height: 42px;
  border-radius: 5px;
  background: var(--card-2);
  border: 1px solid var(--card-border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: 0.5px;
  position: relative;
  flex-shrink: 0;
}
.docs-list .doc .file-icon.pdf  { color: #ef6b6b; border-color: rgba(239,107,107,0.30); background: rgba(239,107,107,0.06); }
.docs-list .doc .file-icon.docx { color: #60a5fa; border-color: rgba(96,165,250,0.30); background: rgba(96,165,250,0.06); }
.docs-list .doc .file-icon.md   { color: var(--accent-2); border-color: var(--accent-dim); background: var(--accent-soft); }
.docs-list .doc .file-icon.txt  { color: var(--text-dim); }
.docs-list .doc .meta-block { min-width: 0; }
.docs-list .doc .title {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.docs-list .doc .meta {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 3px;
  display: flex;
  gap: 8px;
  align-items: center;
}
.docs-list .doc .meta .dot { width: 2px; height: 2px; background: currentColor; border-radius: 50%; opacity: 0.6; }

/* Detail / preview pane */
.docs-detail {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 22px 28px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.docs-detail h2 {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 600;
}

/* Inline document preview area */
.docs-preview {
  flex: 1;
  min-height: 360px;
  background: var(--card-2);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.docs-preview-frame {
  flex: 1;
  width: 100%;
  border: 0;
  background: #fff;
}
.docs-preview-image {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  overflow: auto;
}
.docs-preview-image img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
.docs-preview-text {
  flex: 1;
  margin: 0;
  padding: 16px 18px;
  font-family: ui-monospace, "JetBrains Mono", "SF Mono", Menlo, monospace;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  overflow: auto;
}

/* Search-results panel — distinct from the file list */
.docs-results {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 8px 4px;
  overflow-y: auto;
}
.docs-result {
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 13px;
  border-radius: 8px;
  margin: 0 4px;
  transition: background 100ms ease;
}
.docs-result:last-child { border-bottom: none; }
.docs-result:hover { background: var(--card-2); }
.docs-result .doc-name {
  font-weight: 600;
  color: var(--text);
  display: flex;
  gap: 8px;
  align-items: baseline;
}
.docs-result .doc-name .score {
  font-size: 11px;
  color: var(--accent-2);
  font-weight: 500;
  background: var(--accent-soft);
  padding: 1px 7px;
  border-radius: 999px;
  letter-spacing: 0.3px;
}
.docs-result .chunk {
  color: var(--text-dim);
  margin-top: 8px;
  white-space: pre-wrap;
  line-height: 1.55;
  font-size: 12.5px;
}

header.app .controls {
  display: flex;
  gap: 10px;
  align-items: center;
}
/* Group related header controls into a single rounded pill cluster
   (role + voice + settings on the right; layout + +Event on the calendar). */
.header-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--card-border);
  border-radius: 999px;
}
.header-group .pill,
.header-group .icon-btn {
  border-radius: 999px;
}
.pill {
  background: transparent !important;
  border: none !important;
  padding: 6px 12px;
  font-size: 13px;
  color: var(--text);
}
.pill:hover { background: rgba(129, 140, 248, 0.15) !important; }
button.primary.pill {
  background: var(--accent) !important;
  color: #1a1640;
  font-weight: 600;
}
button.primary.pill:hover { background: #b9a2ff !important; }
/* Compact circular icon button (e.g. ⚙ Settings in the header). */
.icon-btn {
  width: 34px; height: 34px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 16px;
  background: transparent;
  border: 1px solid transparent;
}
.icon-btn:hover { background: rgba(129, 140, 248, 0.15); border-color: var(--card-border); }

select, button, input {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 14px;
  outline: none;
}

button {
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease;
}
button:hover { background: rgba(129, 140, 248, 0.15); }
button.primary {
  background: var(--accent);
  color: #1a1640;
  font-weight: 600;
  border-color: var(--accent);
}
button.primary:hover { background: #c4b5fd; }
button.danger { color: var(--danger); }

.ask {
  display: flex;
  gap: 8px;
  padding: 12px 24px;
  align-items: center;
  border-bottom: 1px solid var(--card-border);
}
.ask input { flex: 1; }
/* ── Floating microphone (fixed bottom-right, always visible) ────── */
.voice-fab {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 60;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px 12px 14px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: var(--text);
  background: var(--bg-2);
  border: 1px solid var(--card-border-strong);
  border-radius: 999px;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease;
}
.voice-fab:hover {
  transform: translateY(-2px);
  background: rgba(28, 36, 50, 0.96);
  border-color: var(--accent-dim);
}
.voice-fab .voice-ic { font-size: 18px; line-height: 1; }
.voice-fab .voice-lbl { font-variant-numeric: tabular-nums; }

/* Recording — solid red, white text, pulsing ring. Impossible to miss. */
.voice-fab.recording {
  background: #dc2626;
  color: #fff;
  border-color: #ef4444;
  animation: rec-pulse 1.1s infinite;
}
.voice-fab.recording:hover {
  background: #ef4444;
  border-color: #f87171;
}
@keyframes rec-pulse {
  0%, 100% { box-shadow: 0 0 0 0  rgba(239, 68, 68, 0.55), 0 12px 36px rgba(0, 0, 0, 0.55); }
  50%      { box-shadow: 0 0 0 14px rgba(239, 68, 68, 0),  0 12px 36px rgba(0, 0, 0, 0.55); }
}

/* TTS playing — accent indigo, signals "tap to stop". Calmer than recording. */
.voice-fab.playing {
  background: var(--accent);
  border-color: var(--accent);
  color: #0a0d14;
  animation: play-pulse 1.6s infinite;
}
@keyframes play-pulse {
  0%, 100% { box-shadow: 0 0 0 0  rgba(129, 140, 248, 0.5), 0 12px 36px rgba(0, 0, 0, 0.55); }
  50%      { box-shadow: 0 0 0 12px rgba(129, 140, 248, 0), 0 12px 36px rgba(0, 0, 0, 0.55); }
}

@media (max-width: 600px) {
  .voice-fab { padding: 11px 14px; font-size: 12px; right: 14px; bottom: 14px; }
}

.response-panel {
  margin: 0 24px 12px;
  padding: 12px 16px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  min-height: 0;
  max-height: 280px;
  overflow: auto;
}
.response-panel:empty { display: none; }
.response-panel pre {
  background: rgba(0, 0, 0, 0.3);
  padding: 8px;
  border-radius: 6px;
  overflow: auto;
  font-size: 12px;
}

/* Shared base for every top-level app view (calendar, chat, docs,
   compose, community-app, photos). Locks outer padding to one place so
   we can't accidentally drift each app to its own spacing. The grid /
   flex direction per app stays as its own override below. */
.calendar-view,
.chat-view,
.docs-view,
.compose-view,
.whatsapp-view,
.community-app-view {
  padding: 20px 28px 32px;
}

/* ---- WhatsApp app: 3-pane (chats / thread / draft) ───────────────── */
.whatsapp-view {
  display: grid;
  grid-template-columns: 280px 1fr 320px;
  gap: 16px;
  height: calc(100vh - 200px);
  min-height: 540px;
}
.whatsapp-view aside,
.whatsapp-view section {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--r-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.wa-chats-h, .wa-draft-h {
  padding: 12px 14px;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  border-bottom: 1px solid var(--card-border);
  display: flex; align-items: center; justify-content: space-between;
}
.wa-chats-list { overflow-y: auto; flex: 1; }
.wa-chat-item {
  padding: 10px 14px;
  border-bottom: 1px solid var(--card-border);
  cursor: pointer;
  display: grid;
  grid-template-columns: 40px 1fr;
  grid-template-rows: auto auto;
  column-gap: 10px;
  align-items: center;
  transition: background var(--t-fast) var(--ease-out);
}
.wa-chat-item .wa-avatar { grid-row: span 2; }
.wa-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--card-2);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-dim);
  font-weight: 700; font-size: var(--fs-md);
  overflow: hidden;
  flex-shrink: 0;
  text-transform: uppercase;
  line-height: 1;
}
.wa-avatar img { width: 100%; height: 100%; object-fit: cover; }
.wa-avatar--lg { width: 44px; height: 44px; font-size: var(--fs-lg); }
.wa-thread-h { display: flex; align-items: center; gap: 12px; }
.wa-chat-item:hover { background: var(--card-2); }
.wa-chat-item.active { background: var(--accent-soft); }
.wa-chat-item .wa-chat-name { font-weight: 600; font-size: var(--fs-md); color: var(--text); }
.wa-chat-item .wa-chat-preview {
  font-size: var(--fs-sm); color: var(--text-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.wa-chat-item .wa-chat-meta {
  display: flex; justify-content: space-between; align-items: center; margin-top: 2px;
}
.wa-chat-item .wa-chat-ts { font-size: var(--fs-xs); color: var(--text-faint); }
.wa-chat-item .wa-unread {
  background: var(--accent); color: #fff;
  border-radius: var(--r-pill);
  padding: 0 6px; font-size: var(--fs-xs); font-weight: 700; min-width: 18px; text-align: center;
}

.wa-thread-h {
  padding: 14px 18px;
  border-bottom: 1px solid var(--card-border);
  font-weight: 600;
}
.wa-thread-msgs {
  flex: 1; overflow-y: auto;
  padding: 16px 18px;
  display: flex; flex-direction: column; gap: 8px;
  background: var(--bg-3);
}
.wa-msg {
  max-width: 75%;
  padding: 8px 12px;
  border-radius: var(--r-lg);
  font-size: var(--fs-md);
  line-height: var(--lh-normal);
  word-wrap: break-word;
}
.wa-msg.in {
  align-self: flex-start;
  background: var(--card);
  border: 1px solid var(--card-border);
  color: var(--text);
}
.wa-msg.out {
  align-self: flex-end;
  background: var(--accent);
  color: #fff;
}
.wa-msg-ts { font-size: var(--fs-xs); opacity: 0.65; margin-top: 4px; }
.wa-msg-media {
  font-style: italic; opacity: 0.85;
}
.wa-msg-author { font-size: var(--fs-xs); font-weight: 600; color: var(--accent-2); margin-bottom: 2px; }
.wa-msg-transcript {
  margin-top: 6px;
  padding: 6px 8px;
  background: rgba(0, 0, 0, 0.18);
  border-left: 2px solid var(--accent);
  border-radius: 4px;
  font-size: var(--fs-sm);
  font-style: italic;
  opacity: 0.92;
}
.wa-msg.out .wa-msg-transcript { background: rgba(255, 255, 255, 0.16); }
.wa-msg-badge {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 8px;
  font-size: var(--fs-xs);
  font-weight: 600;
  background: rgba(0, 0, 0, 0.18);
  color: var(--text-dim);
  border-radius: var(--r-pill);
  text-decoration: none;
  transition: background var(--t-fast) var(--ease-out);
}
.wa-msg-badge:hover { background: rgba(0, 0, 0, 0.30); color: var(--text); }
.wa-msg.out .wa-msg-badge { background: rgba(255, 255, 255, 0.20); color: rgba(255,255,255,0.9); }
.wa-msg.out .wa-msg-badge:hover { background: rgba(255, 255, 255, 0.32); color: #fff; }

.wa-send {
  display: flex; gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--card-border);
}
.wa-send input { flex: 1; }

/* ── Auth overlay (login / first-run setup) ───────────────── */
.auth-overlay {
  position: fixed; inset: 0;
  background: var(--bg);
  background-image: var(--backdrop-gradient-1), var(--backdrop-gradient-2);
  z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.auth-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--r-xl);
  padding: 40px 36px;
  max-width: 380px;
  width: 100%;
  box-shadow: var(--shadow-xl);
}
.auth-brand {
  font-size: var(--fs-4xl);
  font-weight: 800;
  letter-spacing: -1px;
  color: var(--accent);
  margin-bottom: 4px;
  text-align: center;
}
.auth-tagline {
  font-size: var(--fs-md);
  color: var(--text-dim);
  margin-bottom: 28px;
  text-align: center;
}
.auth-field {
  display: block;
  margin-bottom: 14px;
}
.auth-field > span {
  display: block;
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--text-dim);
  margin-bottom: 4px;
}
.auth-field > input {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-3);
  border: 1px solid var(--card-border-strong);
  border-radius: var(--r-md);
  font-size: var(--fs-md);
  color: var(--text);
  box-sizing: border-box;
}
.auth-field > input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--shadow-focus);
}
.auth-submit {
  width: 100%;
  padding: 12px;
  font-size: var(--fs-md);
  font-weight: 600;
  margin-top: 6px;
}
.auth-error {
  background: rgba(248, 113, 113, 0.12);
  border-left: 3px solid var(--danger);
  border-radius: var(--r-sm);
  padding: 8px 10px;
  margin-bottom: 12px;
  color: var(--text);
  font-size: var(--fs-sm);
}

/* ── Settings → Backup ─── */
.bk-banner {
  padding: 10px 14px;
  border-radius: var(--r-md);
  margin-bottom: 14px;
  font-size: var(--fs-sm);
}
.bk-banner.bk-ok   { background: rgba(52, 211, 153, 0.10); color: var(--ok); border-left: 3px solid var(--ok); }
.bk-banner.bk-warn { background: rgba(251, 191, 36, 0.10); color: var(--warn); border-left: 3px solid var(--warn); }
.bk-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
@media (max-width: 720px) { .bk-grid { grid-template-columns: 1fr; } }
.bk-section {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--r-md);
  padding: 14px;
}
.bk-section h4 { margin: 0 0 10px; font-size: var(--fs-md); color: var(--accent-2); }
.bk-section.bk-run { grid-column: 1 / -1; display: flex; align-items: center; gap: 14px; }
.bk-section.bk-run h4 { margin: 0; }
.bk-check {
  display: flex; align-items: center; gap: 8px;
  margin: 6px 0;
  font-size: var(--fs-sm);
}

/* ── Settings → Account ─── */
.account-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
@media (max-width: 700px) { .account-grid { grid-template-columns: 1fr; } }
.account-section h4 {
  margin: 0 0 12px;
  font-size: var(--fs-lg);
  color: var(--accent-2);
}
.account-section input[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ── Settings → Users ─── */
.users-toolbar {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 12px;
}
.users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}
.users-table th, .users-table td {
  text-align: left;
  padding: 8px 6px;
  border-bottom: 1px solid var(--card-border);
  vertical-align: middle;
}
.users-table th {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--text-dim);
}
.user-row-name { font-weight: 600; color: var(--text); }
.user-role-sel { padding: 3px 6px; font-size: var(--fs-sm); }
.user-act {
  padding: 3px 8px;
  font-size: var(--fs-xs);
  margin-right: 4px;
}
.users-add-form {
  margin-top: 16px;
  padding: 14px;
  background: var(--card-2);
  border-radius: var(--r-md);
  border: 1px solid var(--card-border-strong);
}
.users-add-form h4 { margin: 0 0 12px; font-size: var(--fs-md); }
.ext-badges {
  display: flex; gap: 4px; margin-top: 4px;
}
.ext-badge {
  font-size: var(--fs-xs);
  padding: 1px 6px;
  border-radius: var(--r-pill);
  background: var(--card-2);
  color: var(--text-faint);
  opacity: 0.7;
}
.ext-badge.ok {
  background: rgba(52, 211, 153, 0.18);
  color: var(--ok);
  opacity: 1;
  font-weight: 600;
}
.auto-provision-checks {
  display: flex; gap: 14px;
  margin-top: 4px;
}
.auto-provision-checks label {
  display: flex; align-items: center; gap: 6px;
  font-size: var(--fs-sm);
  cursor: pointer;
}

/* User pill in the top-right replaces the old role dropdown. */
.user-pill-role {
  margin-left: 6px;
  font-size: var(--fs-xs);
  opacity: 0.7;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
}

/* ── Settings → Skills panel ────────────────────── */
.skills-intro {
  font-size: var(--fs-sm);
  color: var(--text-dim);
  padding: 0 4px 12px;
  border-bottom: 1px solid var(--card-border);
  margin-bottom: 12px;
}
.skills-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
.skill-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--r-md);
  padding: 10px 12px;
}
.skill-card-h { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.skill-name { font-size: var(--fs-md); font-weight: 700; color: var(--accent-2); }
.skill-tag {
  background: var(--card-2);
  color: var(--text-dim);
  font-size: var(--fs-xs);
  padding: 1px 6px;
  border-radius: var(--r-pill);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
}
.skill-desc { font-size: var(--fs-sm); color: var(--text); margin-bottom: 6px; line-height: var(--lh-normal); }
.skill-inputs { font-size: var(--fs-xs); color: var(--text-dim); }
.skill-inputs code {
  background: var(--bg-3); padding: 1px 4px; border-radius: 3px;
  font-size: var(--fs-xs); color: var(--accent-2);
}
.skill-opt { color: var(--text-faint); font-style: italic; }
.skill-details { margin-top: 8px; font-size: var(--fs-sm); }
.skill-details summary { cursor: pointer; color: var(--text-dim); }
.skill-when, .skill-body {
  background: var(--bg-3);
  padding: 8px 10px;
  border-radius: var(--r-sm);
  font-size: var(--fs-xs);
  white-space: pre-wrap;
  font-family: -apple-system, BlinkMacSystemFont, "Inter", sans-serif;
  color: var(--text-dim);
  margin: 6px 0;
}
.skill-body-mount { margin-top: 8px; }
.skill-load-body { font-size: var(--fs-sm); color: var(--accent); cursor: pointer; }

/* ── Draft variants (auto-drafted on incoming) ─── */
.wa-variants {
  padding: 10px 12px;
  display: flex; flex-direction: column; gap: 8px;
  overflow-y: auto;
  max-height: 38vh;
  border-bottom: 1px solid var(--card-border);
}
.wa-variant {
  background: var(--bg-3);
  border: 1px solid var(--card-border);
  border-radius: var(--r-md);
  padding: 8px 10px;
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease-out), background var(--t-fast) var(--ease-out);
  position: relative;
}
.wa-variant:hover { background: var(--card-2); border-color: var(--accent-dim); }
.wa-variant.active { border-color: var(--accent); background: var(--accent-soft); }
.wa-variant-label {
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--accent-2);
  margin-bottom: 4px;
}
.wa-variant-text {
  font-size: var(--fs-sm);
  line-height: var(--lh-normal);
  color: var(--text);
  white-space: pre-wrap;
}
.wa-draft-manual-h {
  padding: 10px 14px 6px;
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-dim);
  letter-spacing: var(--tracking-wide);
}
.wa-draft-h-actions { display: flex; gap: 4px; }
/* Pending-draft badge on chat list rows */
.wa-pending-badge {
  background: var(--accent);
  color: #fff;
  font-size: var(--fs-xs);
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--r-pill);
  display: inline-flex; align-items: center; gap: 3px;
}

.wa-draft { padding: 0; }
.wa-draft > button,
.wa-draft > textarea {
  margin: 10px 14px;
}
.wa-draft textarea {
  flex: 1; min-height: 120px;
  font-family: inherit;
  background: var(--bg-3);
  border: 1px solid var(--card-border);
  border-radius: var(--r-md);
  padding: 10px 12px;
  color: var(--text);
  resize: none;
}
.wa-draft-sources-h {
  padding: 8px 14px;
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-dim);
  letter-spacing: var(--tracking-wide);
  border-top: 1px solid var(--card-border);
}
.wa-draft-sources {
  padding: 8px 14px 14px;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 6px;
}
.wa-draft-src {
  font-size: var(--fs-sm);
  padding: 6px 10px;
  background: var(--card-2);
  border-radius: var(--r-sm);
  border-left: 3px solid var(--accent);
  color: var(--text-dim);
}
.wa-empty, .wa-empty-sm {
  color: var(--text-faint);
  text-align: center;
  padding: 20px;
  font-style: italic;
}
.wa-empty-sm { padding: 8px; font-size: var(--fs-sm); }

/* QR pairing overlay (shown when bridge has a QR but no session yet). */
.wa-qr-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(6px);
}
.wa-qr-card {
  background: var(--bg-2);
  border: 1px solid var(--card-border-strong);
  border-radius: var(--r-xl);
  padding: 24px 28px;
  max-width: 420px;
  text-align: center;
  box-shadow: var(--shadow-xl);
}
.wa-qr-card { position: relative; }
.wa-qr-close {
  position: absolute; top: 10px; right: 12px;
  width: 28px; height: 28px;
  background: transparent; border: none;
  color: var(--text-dim);
  font-size: 22px; line-height: 1; cursor: pointer;
  border-radius: 50%;
  transition: background var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out);
}
.wa-qr-close:hover { background: var(--card-2); color: var(--text); }
.wa-qr-card h2 { margin: 0 0 8px; font-size: var(--fs-xl); }
.wa-briefing-card {
  max-width: 640px;
  width: 90vw;
  max-height: 86vh;
  display: flex; flex-direction: column;
  text-align: left;
}
.wa-briefing-controls {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 0 14px;
  border-bottom: 1px solid var(--card-border);
  font-size: var(--fs-sm); color: var(--text-dim);
}
.wa-briefing-controls select { padding: 4px 8px; }
.wa-briefing-body {
  flex: 1;
  overflow-y: auto;
  padding-top: 12px;
}
.wa-briefing-stats {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--text-dim);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--card-border);
}
.wa-briefing-content { line-height: var(--lh-relaxed); font-size: var(--fs-md); }
.wa-briefing-content h3 {
  font-size: var(--fs-lg);
  margin: 18px 0 6px;
  color: var(--accent-2);
}
.wa-briefing-content p { margin: 6px 0; }
.wa-briefing-content ul { padding-left: 22px; margin: 6px 0; }
.wa-briefing-content li { margin: 4px 0; }
.wa-briefing-content strong { color: var(--text); font-weight: 700; }
.wa-briefing-foot {
  margin-top: 14px;
  padding-top: 8px;
  border-top: 1px dashed var(--card-border);
  font-size: var(--fs-xs);
  color: var(--text-faint);
}
.wa-briefing-error {
  padding: 14px;
  background: rgba(248, 113, 113, 0.12);
  border-left: 3px solid var(--danger);
  border-radius: var(--r-sm);
  color: var(--text);
}
.wa-qr-card p  { margin: 0 0 16px; color: var(--text-dim); font-size: var(--fs-md); }
.wa-qr-card img {
  width: 280px; height: 280px;
  border-radius: var(--r-md);
  background: #fff; padding: 12px;
}
.wa-qr-steps { text-align: left; margin: 14px 0 0; padding-left: 18px; color: var(--text-dim); font-size: var(--fs-sm); }

/* Two-column layout for the calendar view (calendar + tasks sidebar).
   Used to be `main.grid` — but the calendar lives in <section class="grid">
   under app-stage, so the rule never matched. Just use `.grid`. */
.grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
}
@media (max-width: 880px) {
  .grid { grid-template-columns: 1fr; }
}

.panel {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 20px;
  min-width: 0;  /* allow children (calendar iframe) to shrink in the grid track */
}
.panel h2 {
  margin: 0 0 14px;
  font-size: 14px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-dim);
}

/* ----- Google calendar layout ----- */
.gcal {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: rgba(129, 140, 248, 0.15);
  border-radius: 12px;
  overflow: hidden;
}
.gcal .gcal-weekday {
  background: rgba(0, 0, 0, 0.3);
  padding: 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-dim);
  text-align: center;
}
.gcal .gcal-day {
  background: rgba(15, 12, 41, 0.85);
  padding: 8px;
  min-height: 96px;
  cursor: pointer;
  position: relative;
}
.gcal .gcal-day.other-month { opacity: 0.4; }
.gcal .gcal-day.today { background: rgba(129, 140, 248, 0.18); }
.gcal .gcal-day.selected { outline: 2px solid var(--accent); outline-offset: -2px; }
.gcal .gcal-day.highlight { background: rgba(245, 158, 11, 0.22); outline: 2px solid var(--warn); outline-offset: -2px; }
.gcal .gcal-day .day-num { font-weight: 600; }
.gcal .gcal-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin: 4px 4px 0 0;
}
.gcal-controls { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; gap: 12px; flex-wrap: wrap; }
.gcal-view-switch { display: flex; gap: 4px; }
.gcal-view-switch button { padding: 6px 10px; font-size: 12px; }

/* ----- Google week view ----- */
.gweek {
  display: grid;
  grid-template-columns: 56px repeat(7, 1fr);
  grid-auto-rows: auto;
  gap: 1px;
  background: rgba(129, 140, 248, 0.15);
  border-radius: 12px;
  overflow: hidden;
  font-size: 12px;
}
.gweek-corner,
.gweek-dayhead,
.gweek-allday-label,
.gweek-allday-cell,
.gweek-hourgutter,
.gweek-daycol {
  background: rgba(15, 12, 41, 0.85);
}
.gweek-corner { padding: 8px; }
.gweek-dayhead {
  text-align: center;
  padding: 8px 6px;
  cursor: pointer;
}
.gweek-dayhead.today { background: rgba(129, 140, 248, 0.18); }
.gweek-dayname { color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.7px; font-size: 10px; }
.gweek-daynum { font-size: 18px; font-weight: 600; margin-top: 2px; }
.gweek-allday-label {
  display: flex; align-items: center; justify-content: flex-end;
  padding: 6px 8px;
  color: var(--text-dim);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.gweek-allday-cell {
  padding: 4px;
  min-height: 28px;
  cursor: pointer;
}
.gweek-allday-event {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  color: #1a1640;
  font-weight: 600;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gweek-hourgutter {
  position: relative;
}
.gweek-hourlabel {
  position: relative;
  border-top: 1px solid rgba(129, 140, 248, 0.1);
  padding: 2px 6px 0 6px;
  text-align: right;
  color: var(--text-dim);
  font-size: 10px;
  box-sizing: border-box;
}
.gweek-hourlabel:first-child { border-top: none; }
.gweek-daycol {
  position: relative;
  cursor: crosshair;
  user-select: none;
}
.gweek-ghost {
  position: absolute;
  left: 2px;
  right: 2px;
  background: rgba(129, 140, 248, 0.35);
  border: 1px dashed var(--accent);
  border-radius: 6px;
  z-index: 5;
  pointer-events: none;
}
.gweek-hourrow {
  border-top: 1px solid rgba(129, 140, 248, 0.08);
  box-sizing: border-box;
}
.gweek-hourrow:first-child { border-top: none; }
.gweek-event {
  position: absolute;
  border-radius: 6px;
  border-left: 3px solid;
  padding: 4px 6px;
  overflow: hidden;
  color: #1a1640;
  background: rgba(129, 140, 248, 0.85);
  cursor: pointer;
  z-index: 2;
  transition: filter 120ms ease, transform 120ms ease;
}
.gweek-event:hover { filter: brightness(1.08); transform: translateY(-1px); }
.gweek-event.highlight {
  box-shadow: 0 0 0 2px var(--warn), 0 0 18px 4px rgba(245, 158, 11, 0.55);
  z-index: 4;
  animation: highlight-pulse 1.6s ease-out 2;
}
@keyframes highlight-pulse {
  0%   { box-shadow: 0 0 0 0  rgba(245, 158, 11, 0.9), 0 0 0 0 rgba(245, 158, 11, 0); }
  100% { box-shadow: 0 0 0 2px var(--warn), 0 0 24px 8px rgba(245, 158, 11, 0); }
}
.gweek-event-title {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gweek-event-time {
  font-size: 10px;
  opacity: 0.85;
}
.gweek-now {
  position: absolute;
  left: 0; right: 0;
  height: 2px;
  background: var(--danger);
  z-index: 3;
  pointer-events: none;
}
.gweek-now::before {
  content: "";
  position: absolute;
  left: -5px;
  top: -4px;
  width: 10px; height: 10px;
  background: var(--danger);
  border-radius: 50%;
}

/* ----- Apple calendar layout ----- */
.acal {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.acal-header {
  font-size: 28px;
  font-weight: 200;
  letter-spacing: -0.5px;
}
.acal-day {
  display: flex;
  gap: 16px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 14px;
  border-left: 3px solid var(--accent);
}
.acal-day .acal-date {
  min-width: 60px;
  font-size: 28px;
  font-weight: 300;
  text-align: center;
  color: var(--accent);
}
.acal-day .acal-date small {
  display: block;
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
}
.acal-day .acal-events { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.acal-event {
  background: rgba(129, 140, 248, 0.12);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13px;
}

/* ----- Tasks panel: header + per-category sections ----- */
.tasks-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 14px;
}
.tasks-header h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.1px;
  color: var(--text);
  display: flex; align-items: center; gap: 8px;
}
.tasks-header .tasks-role {
  font-size: 10px;
  color: var(--text-faint);
  letter-spacing: 0.4px;
  font-weight: 500;
  padding: 2px 8px;
  background: var(--card-2);
  border-radius: 999px;
  text-transform: lowercase;
}
.tasks-header-actions { display: flex; gap: 6px; }
.tasks-header-actions button { padding: 5px 11px; font-size: 12px; }
.tasks-header-actions .subtle {
  background: transparent;
  border-color: transparent;
  color: var(--text-dim);
  width: 28px; padding: 0;
  height: 28px;
}
.tasks-header-actions .subtle:hover {
  background: var(--card-2);
  color: var(--text);
}
.tasks-empty {
  padding: 24px 8px;
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
  background: var(--card);
  border: 1px dashed var(--card-border);
  border-radius: 12px;
}

.tasks-body { display: flex; flex-direction: column; gap: 16px; }
.task-cat-h {
  display: flex; align-items: center; gap: 8px;
  margin: 0 2px 6px;
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.7px;
}
.task-cat-dot {
  width: 8px; height: 8px; border-radius: 50%;
  box-shadow: 0 0 8px currentColor;
}
.task-cat-name { font-weight: 600; color: var(--text); flex: 1; letter-spacing: 0.4px; }
.task-cat-count {
  font-size: 10px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
  padding: 1px 7px;
  background: var(--card-2);
  border-radius: 999px;
}
.task-cat-list { display: flex; flex-direction: column; gap: 4px; }

/* Compact task card — NOT full-width strip. Each card sits on a subtle
   tinted surface with a 3px coloured edge picked up from its category. */
.task {
  display: flex;
  gap: 10px;
  padding: 9px 10px 9px 12px;
  border-radius: 8px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-left: 3px solid transparent;
  align-items: flex-start;
  cursor: pointer;
  transition: background 100ms ease, border-color 100ms ease, transform 80ms ease;
}
.task:hover {
  background: var(--card-2);
  border-color: var(--card-border-strong);
  transform: translateX(1px);
}
.task.done {
  background: transparent;
}
.task.done .task-title { text-decoration: line-through; color: var(--text-faint); }

/* Custom checkbox — circular, on-card */
.task-check {
  position: relative;
  width: 18px; height: 18px;
  margin-top: 1px;
  flex-shrink: 0;
  cursor: pointer;
}
.task-check input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.task-check .checkmark {
  position: absolute; inset: 0;
  border: 1.5px solid var(--card-border-strong);
  border-radius: 50%;
  transition: background 120ms ease, border-color 120ms ease;
}
.task-check input:checked + .checkmark {
  background: var(--accent);
  border-color: var(--accent);
}
.task-check input:checked + .checkmark::after {
  content: "";
  position: absolute;
  left: 5px; top: 2px;
  width: 4px; height: 8px;
  border: solid #0a0d14;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
}

.task-body { flex: 1; min-width: 0; }
.task-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.35;
  word-wrap: break-word;
}
.task-meta {
  display: flex; gap: 6px; align-items: center;
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-faint);
}
.task-meta .due {
  font-variant-numeric: tabular-nums;
}
.task-meta .person {
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-2);
  font-weight: 500;
}

/* ----- Modal ----- */
.modal-back {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 50;
}
.modal {
  background: var(--bg-2);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 24px;
  width: 100%; max-width: 420px;
  display: flex; flex-direction: column; gap: 12px;
}
.modal h3 { margin: 0 0 6px; color: var(--accent); }
.modal label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-dim); }
.modal input { width: 100%; }
.modal .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }

.tag {
  display: inline-block;
  padding: 2px 8px;
  background: rgba(129, 140, 248, 0.2);
  border-radius: 999px;
  font-size: 11px;
  color: var(--accent);
}
