/* ═══════════════════════════════════════════════════════════════════
   Tessera — Liquid Glass design system, v2
   Layered translucency over an ambient chroma field. Every surface is
   a lens: blur + saturation pull the background through, a 1px inner
   top highlight reads as the specular edge of glass.

   v2: dark-only (locked by owner preference), single --hue token drives
   every accent — blobs, buttons, rings, glows — so the Appearance sheet
   can retheme the whole app live. Hue-tinted tags, film grain, faster
   motion curves, content-visibility so 200-card feeds stay 60fps.
   ═══════════════════════════════════════════════════════════════════ */

:root {
  /* user-tunable accent hue — Appearance sheet writes this inline */
  --hue: 248;
  --hue-2: calc(var(--hue) - 48);    /* companion hue for gradients */
  --hue-3: calc(var(--hue) + 44);    /* tertiary, for the third blob  */

  /* Richer accent than the over-muted pass — present where it matters,
     restrained everywhere else. */
  --accent:   hsl(var(--hue) 58% 66%);
  --accent-2: hsl(var(--hue-2) 70% 62%);
  --accent-3: hsl(var(--hue-3) 60% 66%);
  --danger:   #ff5a4d;
  --ok:       #34d27a;

  /* Warm charcoal base — less clinical than cold blue-black. */
  --bg:        #0e0b0a;
  --bg-2:      #15110f;                     /* sidebar / raised chrome */
  --ink:       rgba(255, 250, 246, .95);
  --ink-2:     rgba(255, 248, 242, .70);
  --ink-3:     rgba(255, 245, 238, .46);
  --surface:   rgba(30, 26, 24, .72);       /* warm, crisp — no diagonal sheen */
  --surface-2: rgba(255, 250, 245, .045);   /* inset wells                      */
  --line:      rgba(255, 248, 240, .10);    /* hairlines                        */
  --line-2:    rgba(255, 248, 240, .18);    /* hover / emphasis hairlines       */
  --fill:      rgba(255, 248, 240, .07);    /* neutral pills, icon buttons      */
  --fill-2:    rgba(255, 248, 240, .13);

  --glass-hi:   rgba(255, 250, 245, .07);
  --glass-lo:   rgba(255, 250, 245, .03);
  --glass-edge: rgba(255, 248, 240, .12);
  --glass-spec: rgba(255, 252, 248, .16);

  --shadow:      0 10px 40px rgba(0, 0, 0, .5);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 36px rgba(0, 0, 0, .34);
  --glow-accent: 0 4px 20px hsl(var(--hue) 60% 50% / .3);

  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", ui-sans-serif, "Segoe UI", sans-serif;
  --serif: ui-serif, "New York", "Iowan Old Style", Georgia, serif;

  --r-sm: 12px;
  --r-md: 18px;
  --r-lg: 26px;
  --pad: 16px;
  --speed: .2s;
  --ease: cubic-bezier(.22, 1, .36, 1);     /* ease-out-quint: fast arrival */
  --ease-spring: cubic-bezier(.34, 1.26, .42, 1);
  color-scheme: dark;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

/* The hidden attribute must always win — author display rules (e.g. the
   palette backdrop's display:grid) would otherwise override it and leave
   an invisible full-screen layer intercepting every touch. */
[hidden] { display: none !important; }

html { height: 100%; -webkit-tap-highlight-color: transparent; }

body {
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 var(--sans);
  letter-spacing: -.006em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  padding-bottom: env(safe-area-inset-bottom);
  animation: page-in .45s var(--ease);
}

@keyframes page-in { from { opacity: 0; } }

::selection { background: hsl(var(--hue) 40% 60% / .35); }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--fill-2); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-3); }

/* ─── Ambient chroma field ──────────────────────────────────────── */

.ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(120% 90% at 85% -10%, hsl(var(--hue) 40% 60% / .13), transparent 55%),
    radial-gradient(110% 90% at 0% 105%, hsl(var(--hue-2) 45% 60% / .11), transparent 55%);
}

/* film grain — kills the "flat vector" feel, costs one static layer */
.ambient::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.blob {
  position: absolute;
  width: 55vmax;
  height: 55vmax;
  border-radius: 50%;
  filter: blur(90px);
  opacity: .16;
  will-change: transform;
}

.blob-a { background: radial-gradient(circle, var(--accent), transparent 65%); top: -18vmax; left: -12vmax; animation: drift-a 36s var(--ease) infinite alternate; }
.blob-b { background: radial-gradient(circle, var(--accent-2), transparent 65%); bottom: -22vmax; right: -14vmax; animation: drift-b 44s var(--ease) infinite alternate; }
.blob-c { background: radial-gradient(circle, var(--accent-3), transparent 65%); top: 30%; left: 55%; width: 38vmax; height: 38vmax; opacity: .14; animation: drift-c 52s var(--ease) infinite alternate; }

@keyframes drift-a { to { transform: translate(9vmax, 7vmax) scale(1.12); } }
@keyframes drift-b { to { transform: translate(-8vmax, -6vmax) scale(1.08); } }
@keyframes drift-c { to { transform: translate(-10vmax, 5vmax) rotate(25deg); } }

/* ─── Glass surfaces ────────────────────────────────────────────── */

/* Crisp translucent material — no diagonal gradient (that sheen read as a
   loading placeholder). One flat fill + blur + a single specular top edge. */
.glass, .glass-strong {
  background: rgba(24, 20, 18, .58);
  -webkit-backdrop-filter: blur(24px) saturate(125%);
  backdrop-filter: blur(24px) saturate(125%);
  border: 1px solid var(--glass-edge);
  box-shadow: var(--shadow), inset 0 1px 0 var(--glass-spec);
  border-radius: var(--r-md);
}

.glass-strong {
  -webkit-backdrop-filter: blur(40px) saturate(135%);
  backdrop-filter: blur(40px) saturate(135%);
  background: rgba(26, 22, 20, .78);
}

/* Solid fallback when the lens can't render */
@supports not (backdrop-filter: blur(1px)) {
  .glass { background: rgba(22, 18, 16, .97); }
  .glass-strong { background: rgba(26, 22, 20, .98); }
}

/* ─── Top bar ───────────────────────────────────────────────────── */

.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 12px 0;
  padding: 11px var(--pad);
  border-radius: var(--r-lg);
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; cursor: pointer; }

.brand-mark {
  width: 26px;
  height: 26px;
  fill: var(--accent-2);
  flex-shrink: 0;
  filter: drop-shadow(0 0 12px hsl(var(--hue-2) 45% 62% / .55));
  transition: transform .4s var(--ease-spring);
}
.brand:active .brand-mark { transform: rotate(90deg) scale(.92); }

.brand-name {
  font-size: 19px;
  font-weight: 750;
  letter-spacing: -.025em;
  background: linear-gradient(120deg, #fff, hsl(var(--hue) 45% 82%) 60%, hsl(var(--hue-2) 45% 70%));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.stats { font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.topbar-actions { display: flex; gap: 8px; flex-shrink: 0; align-items: center; }

/* Accent swatch button — opens the Appearance sheet */
.theme-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--glass-edge);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 2px 12px hsl(var(--hue) 40% 60% / .4);
  cursor: pointer;
  flex-shrink: 0;
  transition: transform .14s var(--ease);
}
.theme-dot:active { transform: scale(.88); }

/* ─── Buttons ───────────────────────────────────────────────────── */

.btn {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 18px;
  font: 600 13px/1 inherit;
  font-family: inherit;
  color: var(--ink);
  background: var(--fill);
  cursor: pointer;
  transition: transform .14s var(--ease), box-shadow var(--speed) var(--ease),
              background .15s, border-color .15s, filter .15s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

@media (hover: hover) {
  .btn:hover { background: var(--fill-2); border-color: var(--line-2); }
  .btn-primary:hover { filter: brightness(1.08); transform: translateY(-1px); }
}
.btn:active { transform: scale(.95); transition-duration: .06s; }

.btn-primary {
  background: linear-gradient(135deg, hsl(var(--hue) 39% 64%), hsl(var(--hue-2) 45% 56%));
  border-color: transparent;
  color: #fff;
  box-shadow: var(--glow-accent), inset 0 1px 0 rgba(255, 255, 255, .38);
  text-shadow: 0 1px 2px rgba(10, 10, 40, .3);
}

.btn-danger { color: #ff8d85; }
@media (hover: hover) {
  .btn-danger:hover { background: rgba(255, 69, 58, .14); border-color: rgba(255, 69, 58, .4); }
}

.btn-ghost { background: transparent; }
.btn-sm { padding: 6px 13px; font-size: 12px; }

.btn kbd {
  font: 600 12px ui-monospace, "SF Mono", Menlo, monospace;
  color: var(--ink-2);
}

/* ─── Shell & search ────────────────────────────────────────────── */

.shell { max-width: 920px; margin: 0 auto; padding: 16px 14px 104px; }

.searchrow {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px 4px 14px;
  margin-bottom: 12px;
  border-radius: 999px;
  transition: box-shadow var(--speed) var(--ease), border-color .15s;
}
.searchrow:focus-within {
  border-color: hsl(var(--hue) 40% 64% / .55);
  box-shadow: var(--shadow), inset 0 1px 0 var(--glass-spec), 0 0 0 3px hsl(var(--hue) 40% 60% / .16);
}

.search-icon { width: 17px; height: 17px; color: var(--ink-3); flex-shrink: 0; }

.searchrow input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 16px;   /* <16px makes iOS Safari zoom on focus */
  padding: 10px 0;
  outline: none;
}
.searchrow input::placeholder { color: var(--ink-3); }

.search-clear {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: var(--fill);
  color: var(--ink-2);
  font-size: 12px;
  cursor: pointer;
  transition: background .15s, color .15s, transform .14s var(--ease);
}
.search-clear:hover { background: var(--fill-2); color: var(--ink); }
.search-clear:active { transform: scale(.88); }

/* ─── Bulk bar ──────────────────────────────────────────────────── */

.bulkbar {
  position: sticky;
  top: 76px;
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  margin-bottom: 12px;
  border-radius: var(--r-lg);
  animation: rise .25s var(--ease);
}
.bulkbar span { flex: 1; font-size: 13px; color: var(--ink-2); }

/* ─── Moment cards ──────────────────────────────────────────────── */

.moments { display: flex; flex-direction: column; gap: 12px; margin-top: 0; }

/* ─── Tabs (Feed / Queue / Archive) ─────────────────────────────── */

/* Section nav — a floating bottom bar on mobile, a left sidebar on desktop.
   Same .tab elements either way, so the view logic is untouched. */
.tabs {
  position: fixed;
  z-index: 95;
  display: flex;
  gap: 3px;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(10px + env(safe-area-inset-bottom));
  padding: 6px;
  border-radius: 999px;
  box-shadow: var(--shadow);
}
.tabs .tab {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--ink-3);
  font: 650 12.5px/1 var(--sans);
  letter-spacing: -.01em;
  padding: 8px 11px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: color .15s, background .2s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.tabs { max-width: calc(100vw - 16px); }
.tabs .tab:hover { color: var(--ink-2); }
.tabs .tab.active { color: var(--ink); background: var(--fill-2); }

@media (min-width: 880px) {
  .tabs {
    left: 18px;
    transform: none;
    bottom: auto;
    top: 88px;
    flex-direction: column;
    gap: 2px;
    width: 188px;
    padding: 10px;
    border-radius: var(--r-lg);
  }
  .tabs .tab { text-align: left; padding: 11px 14px; font-size: 14px; }
  .tabs .tab.active {
    color: var(--ink);
    background: var(--fill);
    box-shadow: inset 2px 0 0 var(--accent-2);
  }
  .shell {
    margin-left: 224px;
    margin-right: auto;
    max-width: 880px;
    padding: 18px 18px 48px;
  }
}

/* ─── Queue tab list ────────────────────────────────────────────── */

.queue-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-card);
}
.queue-main { flex: 1; min-width: 0; }
.queue-task { font-weight: 620; font-size: 14px; letter-spacing: -.01em; line-height: 1.35; }
.queue-card-title {
  font-size: 12px; color: var(--ink-3); margin-top: 3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  cursor: pointer;
}
.queue-card-title:hover { color: var(--accent-2); }
.queue-actions { flex-shrink: 0; display: flex; align-items: center; gap: 8px; }
.queue-group-label {
  font: 700 11px/1 inherit; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-3); margin: 6px 2px 2px;
}

.card {
  padding: var(--pad);
  cursor: pointer;
  position: relative;
  border-radius: var(--r-md);
  /* off-screen cards skip layout+paint — long feeds scroll at 60fps */
  content-visibility: auto;
  contain-intrinsic-size: auto 124px;
  transition: border-color var(--speed), box-shadow var(--speed) var(--ease),
              transform .12s var(--ease);
}

/* Solid translucent surface — per-card backdrop blur made scrolling
   stutter on iOS, and hover-lift moved elements under the finger. */
.card.glass {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  background: var(--surface);
  border-color: var(--line);
  box-shadow: var(--shadow-card), inset 0 1px 0 var(--glass-spec);
}

@media (hover: hover) {
  .card:hover {
    border-color: var(--line-2);
    box-shadow: var(--shadow-card), 0 0 0 1px hsl(var(--hue) 40% 60% / .15),
                0 14px 40px hsl(var(--hue) 40% 60% / .13), inset 0 1px 0 var(--glass-spec);
  }
}
.card:active { transform: scale(.985); }
.card, .card * { -webkit-user-select: none; user-select: none; }
.card a { -webkit-touch-callout: default; }

/* Entrance animation only on first paint; re-renders stay locked in place */
.moments:not(.settled) .card { animation: rise .4s var(--ease) backwards; }

.card.selected {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 1px var(--accent-2), var(--shadow-card), inset 0 1px 0 var(--glass-spec);
}

@keyframes rise { from { opacity: 0; transform: translateY(12px) scale(.99); } }

.card-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 6px; }

.card-check {
  width: 19px; height: 19px;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.card-title {
  flex: 1;
  min-width: 0;
  padding-right: 10px;   /* keep the title clear of the timestamp */
  font-weight: 680;
  font-size: 15px;
  letter-spacing: -.014em;
  line-height: 1.35;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.card-time {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-3);
  margin-left: auto;
  flex-shrink: 0;
  align-self: flex-start;
  background: var(--fill);
  border-radius: 999px;
  padding: 3px 9px;
}

.card-note { color: var(--ink-2); font-size: 14px; margin: 4px 0 8px; word-break: break-word; }

.card-url {
  display: inline-block;
  max-width: 100%;
  font-size: 12.5px;
  color: var(--accent-2);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 8px;
}
.card-url:hover { text-decoration: underline; }

/* ─── Tags — hue-tinted from the tag name (JS sets --h) ─────────── */

.tagrow { display: flex; flex-wrap: wrap; gap: 6px; }

.tag {
  font: 600 11.5px/1.2 inherit;
  padding: 4px 11px;
  border-radius: 999px;
  background: hsl(var(--hue) 26% 50% / .14);
  border: 1px solid hsl(var(--hue) 22% 55% / .22);
  color: hsl(var(--hue) 20% 78%);
}

.tag.t-ok   { color: hsl(150 20% 70%); border-color: hsl(150 18% 46% / .3); background: hsl(150 20% 44% / .1); }
.tag.t-lock { color: hsl(44 24% 72%);  border-color: hsl(44 24% 48% / .3);  background: hsl(44 24% 48% / .1); }
.tag.t-col  { color: hsl(var(--hue) 20% 78%); }

.tag[data-tag] { cursor: pointer; transition: transform .14s var(--ease), filter .15s; }
@media (hover: hover) {
  .tag[data-tag]:hover { filter: brightness(1.1); }
}
.tag[data-tag]:active { transform: scale(.93); }

.tag-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--r-md);
  border: 1px solid hsl(var(--hue-2) 45% 62% / .32);
  background: hsl(var(--hue-2) 45% 62% / .08);
  font-size: 13px;
  color: var(--ink-2);
}
.tag-banner span { flex: 1; }
.tag-banner strong { color: var(--accent-2); font-weight: 680; }

/* ─── Empty & loading states ────────────────────────────────────── */

.no-results {
  text-align: center;
  padding: 56px 20px;
  color: var(--ink-3);
  font-size: 14px;
}
.no-results::before {
  content: "✦";
  display: block;
  font-size: 26px;
  margin-bottom: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.skeleton {
  height: 110px;
  pointer-events: none;
  position: relative;
  overflow: hidden;
}
.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 30%, var(--glass-hi) 50%, transparent 70%);
  animation: shimmer 1.2s infinite;
}
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

/* ─── Bottom sheets ─────────────────────────────────────────────── */

.sheet-backdrop, .palette-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(4, 5, 14, .45);
  -webkit-backdrop-filter: blur(8px) saturate(106%);
  backdrop-filter: blur(8px) saturate(106%);
  opacity: 0;
  transition: opacity var(--speed) var(--ease);
}
/* [hidden] loses to author display rules (e.g. .palette-backdrop { display: grid })
   unless we re-assert it. Without this, the fullscreen invisible backdrop sits at
   z-index 200 over the topbar and eats every click. */
[hidden] { display: none !important; }
.sheet-backdrop.open, .palette-backdrop.open { opacity: 1; }

.sheet {
  position: fixed;
  left: 50%;
  bottom: max(14px, env(safe-area-inset-bottom));
  z-index: 210;
  width: min(680px, calc(100% - 24px));
  max-height: 88dvh;
  overflow-y: auto;
  transform: translate(-50%, calc(100% + 28px));
  transition: transform .34s var(--ease);
  /* fully rounded — the card window floats clear of the screen edge */
  border-radius: var(--r-lg);
  padding: 8px 20px 22px;
  touch-action: pan-y;
}
.sheet.open { transform: translate(-50%, 0); }
.sheet.dragging { transition: none; }
.sheet, .detail-content, .detail-prose, .palette-results, .digest-body {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
body.sheet-open { overflow: hidden; }
.sheet-tall { height: 86dvh; }

.sheet-close {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--fill);
  color: var(--ink-2);
  font-size: 14px;
  cursor: pointer;
  z-index: 2;
  transition: background .15s, color .15s, transform .14s var(--ease);
}
.sheet-close:hover { background: var(--fill-2); color: var(--ink); }
.sheet-close:active { transform: scale(.88); }

.dropzone {
  display: block;
  margin: 0 0 12px;
  padding: 18px 14px;
  border: 1.5px dashed var(--line-2);
  border-radius: var(--r-sm);
  text-align: center;
  font-size: 13px;
  color: var(--ink-3);
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}
.dropzone.armed, .dropzone:hover {
  border-color: var(--accent-2);
  background: hsl(var(--hue-2) 45% 62% / .08);
  color: var(--ink-2);
}

/* The notch is the drag handle — its hit area is the full top strip. */
.grabber {
  width: 100%;
  padding: 10px 0 12px;
  margin: 0 auto 6px;
  display: flex;
  justify-content: center;
  cursor: grab;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}
.grabber::before {
  content: "";
  width: 42px;
  height: 5px;
  border-radius: 3px;
  background: var(--fill-2);
  transition: background .15s, width .15s;
}
.grabber:active { cursor: grabbing; }
.grabber:active::before { background: var(--ink-3); width: 54px; }

.sheet h2 {
  font-size: 21px;
  font-weight: 740;
  letter-spacing: -.028em;
  line-height: 1.25;
  margin-bottom: 14px;
  padding-right: 40px;   /* clear the ✕ */
}

.sheet label { display: block; font-size: 12px; color: var(--ink-3); margin-bottom: 12px; }

.sheet textarea, .sheet input[type="text"], .sheet input[type="url"], .sheet select {
  display: block;
  width: 100%;
  margin-top: 5px;
  padding: 11px 13px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, .25);
  color: var(--ink);
  font: inherit;
  font-size: 16px;   /* <16px makes iOS Safari zoom on focus */
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  resize: vertical;
}

.sheet textarea:focus, .sheet input:focus, .sheet select:focus {
  border-color: hsl(var(--hue) 40% 64% / .6);
  box-shadow: 0 0 0 3px hsl(var(--hue) 40% 60% / .15);
}

.field-row { display: flex; gap: 10px; margin-bottom: 12px; }
.field-row > * { flex: 1; margin: 0 !important; }

.slider-label { font-size: 12px; color: var(--ink-3); display: block; }
.slider-label output { float: right; color: var(--ink-2); font-weight: 600; }
.slider-label input[type="range"] { width: 100%; margin-top: 8px; accent-color: var(--accent); }

.sheet-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
  flex-wrap: wrap;
}
.sheet-actions .btn { flex: 1; min-width: 90px; text-align: center; }

/* ─── Appearance sheet ──────────────────────────────────────────── */

.appearance-label {
  font: 700 11px/1 inherit;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 4px 0 10px;
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 10px;
  margin-bottom: 22px;
}
.theme-card {
  position: relative;
  border: 1.5px solid var(--line);
  border-radius: var(--r-sm);
  padding: 0;
  overflow: hidden;
  cursor: pointer;
  background: none;
  text-align: left;
  transition: transform .14s var(--ease), border-color .15s;
  -webkit-tap-highlight-color: transparent;
}
.theme-card:active { transform: scale(.96); }
.theme-card.active { border-color: #fff; }
.theme-swatch {
  height: 56px;
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 10px;
}
.theme-swatch .dot {
  width: 18px; height: 18px; border-radius: 50%;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.4), 0 1px 4px rgba(0,0,0,.3);
}
.theme-name {
  display: block;
  padding: 8px 11px 9px;
  font: 650 12.5px/1 inherit;
  color: var(--ink);
  background: var(--surface);
}
.theme-card.active .theme-name::after {
  content: "✓";
  float: right;
  color: var(--accent-2);
  font-weight: 700;
}

.swatches { display: flex; gap: 12px; flex-wrap: wrap; margin: 4px 0 18px; }

.swatch {
  --sh: 248;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid transparent;
  background: linear-gradient(135deg, hsl(var(--sh) 78% 64%), hsl(calc(var(--sh) - 48) 90% 56%));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 2px 10px hsl(var(--sh) 80% 60% / .35);
  cursor: pointer;
  transition: transform .14s var(--ease), border-color .15s, box-shadow .15s;
}
.swatch:active { transform: scale(.88); }
.swatch.active {
  border-color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 0 0 3px hsl(var(--sh) 80% 60% / .35);
}

/* ─── Detail sheet internals ────────────────────────────────────── */

.detail-meta { font-size: 12.5px; color: var(--ink-3); margin-bottom: 14px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.detail-meta a { color: var(--accent-2); text-decoration: none; font-weight: 600; }

.detail-section { margin-bottom: 18px; }
.detail-section h3 {
  font: 700 11px/1 inherit;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 8px;
}

.detail-content {
  -webkit-user-select: text;
  user-select: text;
  font-size: 13.5px;
  color: var(--ink-2);
  line-height: 1.6;
  padding: 12px 14px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
  white-space: pre-wrap;
  word-break: break-word;
}

/* Expansion rendered as typeset prose, not a monospace slab. No inner
   scroll — the whole sheet scrolls, so the expansion reads in full. */
.detail-prose {
  -webkit-user-select: text;
  user-select: text;
  font-size: 14px;
  color: var(--ink-2);
  line-height: 1.65;
  padding: 14px 16px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
  word-break: break-word;
}

/* ─── Detail sheet: two-column split on desktop ─────────────────────
   Note + Expansion fill the main column; Tags, Agent actions, and
   Related move to a sticky side column on the other half. Mobile keeps
   the single stacked flow. */
.detail-grid { display: block; }

@media (min-width: 820px) {
  #detailSheet { width: min(1080px, 96vw); }
  .detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    gap: 28px;
    align-items: start;
  }
  .detail-col-side {
    position: sticky;
    top: 0;
    align-self: start;
  }
  .detail-col > .detail-section:first-child { margin-top: 0; }
}

.related-item, .task-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--ink-2);
}

.related-item { cursor: pointer; transition: background .15s, border-color .15s; }
.related-item:hover { background: var(--fill); border-color: var(--line-2); }
.related-item .score { margin-left: auto; color: var(--accent-2); font-weight: 650; flex-shrink: 0; font-variant-numeric: tabular-nums; }

.task-item .task-text { flex: 1; line-height: 1.5; }
.task-item .kid { font: 11px ui-monospace, Menlo, monospace; color: var(--ink-3); flex-shrink: 0; }
.task-item .done { color: var(--ok); flex-shrink: 0; }

/* Dispatched-task status block */
.task-block { flex-direction: column; align-items: stretch; gap: 8px; }
.task-row { display: flex; align-items: center; gap: 10px; }
.task-row .task-text { flex: 1; }
.task-row .kid { margin-right: auto; }
.task-meta { font-size: 11.5px; color: var(--ink-3); }
.task-msg {
  font: 12px/1.5 ui-monospace, "SF Mono", Menlo, monospace;
  color: var(--ink-2);
  background: rgba(0, 0, 0, .28);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 140px;
  overflow-y: auto;
}
.task-msg.bad { color: #ff9d96; border-color: rgba(255, 69, 58, .3); background: rgba(255, 69, 58, .08); }

.status-pill {
  flex-shrink: 0;
  font: 700 10px/1 inherit;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid transparent;
}
.status-pill.p-bad  { color: #ff9d96; background: rgba(255, 69, 58, .14);  border-color: rgba(255, 69, 58, .4); }
.status-pill.p-ok   { color: #7ee2a0; background: rgba(48, 209, 88, .14);  border-color: rgba(48, 209, 88, .4); }
.status-pill.p-run  { color: #9fc3ff; background: rgba(100, 160, 255, .16); border-color: rgba(100, 160, 255, .4); }
.status-pill.p-warn { color: #f5d76e; background: rgba(245, 215, 110, .14); border-color: rgba(245, 215, 110, .35); }
.status-pill.p-idle { color: var(--ink-3); background: var(--fill); }

.icon-btn {
  border: none;
  background: var(--fill);
  color: var(--ink-2);
  width: 24px; height: 24px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 13px;
  margin-left: 8px;
  vertical-align: middle;
  transition: transform var(--speed) var(--ease), background .15s;
}
.icon-btn:hover { background: var(--fill-2); transform: rotate(90deg); }

/* ─── Questions sheet ───────────────────────────────────────────── */

.q-status { font-size: 13px; color: var(--ink-3); padding: 8px 0 14px; }
.q-status.ok { color: var(--ok); }
.q-status.err { color: var(--danger); }

.q-list { list-style: none; counter-reset: q; }
.q-item { margin-bottom: 14px; counter-increment: q; }
.q-item .q-text { font-size: 13.5px; color: var(--ink); margin-bottom: 6px; line-height: 1.45; }
.q-item .q-text::before {
  content: counter(q);
  display: inline-grid;
  place-items: center;
  width: 20px; height: 20px;
  margin-right: 8px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font: 700 11px/1 inherit;
  vertical-align: 1px;
}
.q-item textarea { min-height: 0; }

/* Progress shimmer while the LLM thinks */
.thinking {
  height: 4px;
  border-radius: 2px;
  margin: 10px 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--accent-3), var(--accent));
  background-size: 300% 100%;
  animation: think 1.4s linear infinite;
}
@keyframes think { to { background-position: -300% 0; } }

/* ─── Markdown prose (digests + expansions) ─────────────────────── */

.digest-body { font-size: 14px; color: var(--ink-2); line-height: 1.65; }

.digest-body h1, .detail-prose h1 { font-size: 18px; color: var(--ink); margin: 14px 0 8px; letter-spacing: -.02em; font-weight: 720; }
.digest-body h2, .detail-prose h2 { font-size: 15px; color: var(--ink); margin: 16px 0 6px; font-weight: 700; }
.digest-body h3, .detail-prose h3 { font-size: 13.5px; color: var(--ink); margin: 12px 0 4px; font-weight: 680; }
.digest-body p,  .detail-prose p,
.digest-body li, .detail-prose li { margin-bottom: 5px; }
.digest-body ul, .detail-prose ul { padding-left: 20px; }
.digest-body a,  .detail-prose a { color: var(--accent-2); }
.digest-body hr, .detail-prose hr { border: none; border-top: 1px solid var(--line); margin: 14px 0; }
.digest-body code, .detail-prose code {
  font: 12.5px ui-monospace, Menlo, monospace;
  background: var(--fill);
  padding: 1px 6px;
  border-radius: 5px;
}
.digest-body blockquote, .detail-prose blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 12px;
  color: var(--ink-3);
  margin: 8px 0;
}
.digest-body strong, .detail-prose strong { color: var(--ink); font-weight: 680; }
.detail-prose > :first-child, .digest-body > :first-child { margin-top: 0; }

/* ─── Source index list ─────────────────────────────────────────── */

.source-index { list-style: none; counter-reset: src; padding: 0; }
.source-index li {
  counter-increment: src;
  position: relative;
  padding: 11px 12px 11px 38px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--surface-2);
  margin-bottom: 8px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.source-index li:hover { background: var(--fill); border-color: var(--line-2); }
.source-index li::before {
  content: counter(src);
  position: absolute;
  left: 10px;
  top: 11px;
  font: 600 11px ui-monospace, Menlo, monospace;
  color: var(--ink-3);
}
.source-index .src-title { display: block; font-weight: 620; font-size: 13.5px; color: var(--ink); }
.source-index .src-url {
  display: block;
  font-size: 12px;
  color: var(--accent-2);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 2px;
}
.source-index .src-date { font-size: 11px; color: var(--ink-3); }

/* ─── Top-anchored sheet (capture, so it clears the mobile keyboard) ─ */

/* Capture sheet floats from the top (clears the mobile keyboard) but no
   longer butts a full-width border line against the screen edge. */
.sheet.sheet-top {
  top: max(12px, env(safe-area-inset-top));
  bottom: auto;
  transform: translate(-50%, calc(-100% - 28px));
  border-radius: var(--r-lg);
  padding-top: 6px;
  padding-bottom: 22px;
}
.sheet.sheet-top.open { transform: translate(-50%, 0); }

/* ─── Command palette ───────────────────────────────────────────── */

.palette-backdrop { display: grid; place-items: start center; padding-top: 12vh; }

.palette {
  width: min(640px, 92vw);
  border-radius: var(--r-lg);
  overflow: hidden;
  transform: scale(.96) translateY(-8px);
  transition: transform var(--speed) var(--ease);
}
.palette-backdrop.open .palette { transform: none; }

.palette input {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  padding: 18px 20px;
  outline: none;
  border-bottom: 1px solid var(--line);
}
.palette input::placeholder { color: var(--ink-3); }

.palette-results {
  list-style: none;
  max-height: 46vh;
  overflow-y: auto;
  padding: 8px;
}

.palette-results li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 13px;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 14px;
  color: var(--ink-2);
}

.palette-results li.active {
  background: linear-gradient(135deg, hsl(var(--hue) 40% 60% / .32), hsl(var(--hue-2) 45% 60% / .18));
  color: var(--ink);
}

.palette-results .kind {
  font: 600 10px/1 inherit;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--fill);
  color: var(--ink-3);
  flex-shrink: 0;
}

.palette-results .p-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-results .p-snippet { display: none; }
.palette-results .p-key {
  flex-shrink: 0;
  min-width: 20px;
  text-align: center;
  font: 600 11px ui-monospace, Menlo, monospace;
  color: var(--ink-2);
  background: var(--fill);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 3px 6px;
}

.palette-hint {
  padding: 10px 16px;
  font-size: 11px;
  color: var(--ink-3);
  border-top: 1px solid var(--line);
  display: flex;
  gap: 14px;
}
.palette-hint kbd {
  font: 600 10px ui-monospace, Menlo, monospace;
  background: var(--fill);
  border-radius: 4px;
  padding: 2px 5px;
  margin-right: 4px;
}

/* ─── Toasts ────────────────────────────────────────────────────── */

.toasts {
  position: fixed;
  bottom: calc(18px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 400;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}

.toast {
  padding: 11px 20px;
  border-radius: 999px;
  font: 600 13px/1.2 inherit;
  color: var(--ink);
  background: linear-gradient(135deg, var(--glass-hi), var(--glass-lo));
  -webkit-backdrop-filter: blur(24px) saturate(112%);
  backdrop-filter: blur(24px) saturate(112%);
  border: 1px solid var(--glass-edge);
  box-shadow: var(--shadow), inset 0 1px 0 var(--glass-spec);
  animation: toast-in .3s var(--ease-spring);
  max-width: 86vw;
}
.toast.err { border-color: rgba(255, 69, 58, .5); color: #ff9d96; }
.toast.ok  { border-color: rgba(48, 209, 88, .45); }
.toast.bye { animation: toast-out .3s var(--ease) forwards; }

@keyframes toast-in  { from { opacity: 0; transform: translateY(14px) scale(.92); } }
@keyframes toast-out { to   { opacity: 0; transform: translateY(10px) scale(.95); } }

/* ─── Motion & accessibility ────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

/* ─── Agent actions (dispatched task status + result) ──────────── */
.task-item {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 6px 0;
}
.task-item .task-text { flex: 1 1 auto; min-width: 0; }
.task-item .kid { font-family: ui-monospace, SF Mono, Menlo, monospace; font-size: 11px; color: var(--ink-3); }
.task-item .task-row { display: contents; }
.task-dispatched { flex-direction: column; align-items: stretch; }
.task-dispatched .task-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.task-status {
  font-size: 10px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase;
  padding: 2px 8px; border-radius: 999px;
  background: rgba(255,255,255,.08);
  color: var(--ink-2);
  white-space: nowrap;
}
.task-status[data-status="queued"]    { background: rgba(140,160,200,.18); color: #b9c8e6; }
.task-status[data-status="ready"]     { background: rgba(140,200,180,.20); color: #b6e6cd; }
.task-status[data-status="running"]   { background: rgba(255,200,80,.22);  color: #f0d68a; }
.task-status[data-status="done"]      { background: rgba(80,200,120,.22);  color: #a4e8b8; }
.task-status[data-status="archived"]  { background: rgba(160,160,180,.18); color: #aab0c0; }
.task-status[data-status="failed"]    { background: rgba(220,80,80,.25);   color: #f4a8a8; }
.task-status[data-status="error"]     { background: rgba(220,80,80,.25);   color: #f4a8a8; }
.task-toggle { padding: 2px 8px; min-width: 0; }
.task-detail {
  margin-top: 6px;
  padding: 10px 12px;
  background: rgba(0,0,0,.18);
  border: 1px solid var(--glass-bd, rgba(255,255,255,.06));
  border-radius: var(--r-sm, 8px);
  font-size: 12px;
}
.task-meta {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 2px 12px;
  margin: 0 0 8px;
  font-size: 11px;
  color: var(--ink-3);
}
.task-meta dt { color: var(--ink-3); }
.task-meta dd { margin: 0; color: var(--ink-1); }
.task-section h4 {
  font-size: 11px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--ink-3);
  margin: 6px 0 4px;
}
.task-output {
  margin: 0; padding: 8px 10px;
  background: rgba(0,0,0,.30);
  border-radius: 6px;
  font-family: ui-monospace, SF Mono, Menlo, monospace;
  font-size: 11px; line-height: 1.45;
  white-space: pre-wrap; word-break: break-word;
  max-height: 320px; overflow: auto;
  color: var(--ink-1);
}
.task-output.task-err { color: #f4a8a8; }
.task-pending { color: var(--ink-3); font-size: 11px; }
.task-artifacts {
  margin-top: 8px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: 11px;
  color: var(--ink-2);
}
.task-artifacts ul {
  margin: 4px 0 0;
  padding-left: 18px;
  list-style: disc;
}
.task-artifacts li { margin: 2px 0; }
.task-artifacts a {
  color: var(--accent-2, #6cf);
  text-decoration: none;
  border-bottom: 1px dotted currentColor;
}
.task-artifacts a:hover { border-bottom-style: solid; }
#agentActionsHost h3 { display: flex; align-items: center; gap: 8px; }
#agentActionsRefresh { padding: 2px 8px; font-size: 14px; }

@media (max-width: 600px) {
  .topbar { margin: 8px 8px 0; padding: 10px 12px; }
  .stats { display: none; }
  .shell { padding: 12px 8px 80px; }
  .sheet-actions .btn { min-width: 72px; }
}


/* ─── Details (provenance facts) — replaces Related ─────────────── */
.facts { display: flex; flex-direction: column; }
.fact { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.fact:last-child { border-bottom: none; }
.fact dt { color: var(--ink-3); min-width: 84px; flex-shrink: 0; }
.fact dd { color: var(--ink-2); flex: 1; min-width: 0; word-break: break-word; }
.fact dd a { color: var(--accent-2); text-decoration: none; }

/* ─── Connections (wiki pages, opened inline) ──────────────────── */
.wiki-link {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 12px; border-radius: var(--r-sm);
  background: var(--surface-2); border: 1px solid var(--line);
  margin-bottom: 8px; font-size: 13px; color: var(--ink); font-weight: 600;
  cursor: pointer; transition: background .15s, border-color .15s;
}
.wiki-link:hover { background: var(--fill); border-color: var(--line-2); }
.wiki-link .wl-icon { color: var(--ink-3); flex-shrink: 0; font-size: 14px; }

/* ─── Threads tab ──────────────────────────────────────────────── */
.thread-card {
  padding: 15px 16px; border-radius: var(--r-md);
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow-card); cursor: pointer;
  transition: border-color .15s, box-shadow var(--speed) var(--ease);
}
.thread-card:hover { border-color: var(--line-2); }
.thread-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 9px; }
.thread-title { font-weight: 680; font-size: 15px; letter-spacing: -.01em; flex: 1; color: var(--ink); }
.thread-count { font-size: 12px; color: var(--ink-3); flex-shrink: 0; }
.thread-members { font-size: 13px; color: var(--ink-2); line-height: 1.55; }
.thread-members .tm { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: .9; }

.sched-select { width: auto; margin: 0; padding: 6px 10px; font-size: 13px; flex-shrink: 0; }
.task-block .task-row { gap: 8px; }

/* ─── Today's Edition (the calm replacement feed) ──────────────── */
.edition { max-width: 640px; margin: 0 auto; padding: 4px 2px 8px; }
.ed-date {
  font: 600 12px/1 inherit; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-3); margin-bottom: 10px;
}
.ed-overview {
  font-size: 18px; line-height: 1.5; color: var(--ink);
  letter-spacing: -.01em; margin-bottom: 26px; font-weight: 500;
}
.ed-section { margin-bottom: 22px; }
.ed-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.ed-interest {
  font-weight: 700; font-size: 16px; letter-spacing: -.01em; color: var(--ink);
  cursor: pointer; flex: 1;
}
.ed-interest:hover { color: var(--accent-2); }
.ed-count {
  font: 600 11px/1 ui-monospace, Menlo, monospace; color: var(--ink-3);
  background: var(--fill); border-radius: 999px; padding: 3px 8px; flex-shrink: 0;
}
.ed-label {
  font: 700 11px/1 inherit; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-3); margin-bottom: 10px;
}
.ed-moments { display: flex; flex-direction: column; gap: 7px; margin-bottom: 10px; }
.ed-moment {
  display: block; width: 100%; text-align: left;
  padding: 11px 14px; border-radius: var(--r-sm);
  background: var(--surface-2); border: 1px solid var(--line);
  color: var(--ink-2); font: inherit; font-size: 14px; line-height: 1.4;
  cursor: pointer; transition: background .15s, border-color .15s, transform .12s var(--ease);
}
.ed-moment:hover { background: var(--fill); border-color: var(--line-2); color: var(--ink); }
.ed-moment:active { transform: scale(.99); }
.ed-badge {
  font-size: 11px; color: var(--accent-2); font-weight: 600;
  margin-left: 6px;
}
.ed-research { margin-top: 2px; }

/* ═══ Refinement layer (v3): editorial rows · hierarchy · serif ═══ */

/* Feed / Archive as editorial rows — hairline-separated, with substance and
   a hover lift. Replaces the boxed cards that read as empty placeholders. */
.rows { display: flex; flex-direction: column; }
.row {
  display: flex;
  gap: 14px;
  padding: 15px 12px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background .15s, transform .12s var(--ease);
}
.rows .row:last-child { border-bottom: none; }
.row:hover { background: var(--surface-2); }
.row:active { transform: scale(.995); }
.row.selected { background: hsl(var(--hue) 45% 50% / .1); }
.moments:not(.settled) .row { animation: rise .4s var(--ease) backwards; }

.row-avatar {
  flex-shrink: 0;
  width: 40px; height: 40px;
  border-radius: 12px;
  display: grid; place-items: center;
  background: var(--fill);
  border: 1px solid var(--line);
  font: 600 17px/1 var(--serif);
  color: var(--ink-2);
}
.row-main { flex: 1; min-width: 0; }
.row-top { display: flex; align-items: baseline; gap: 10px; }
.row-title {
  flex: 1; min-width: 0;
  font: 660 16px/1.32 var(--sans);
  letter-spacing: -.016em;
  color: var(--ink);
  overflow: hidden; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.row-time { flex-shrink: 0; font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.row-snippet {
  margin-top: 4px;
  font-size: 13.5px; line-height: 1.5; color: var(--ink-2);
  overflow: hidden; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.row-meta {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  margin-top: 9px; font-size: 12px; color: var(--ink-3);
}
.row-meta > span { white-space: nowrap; }
.row-meta i { opacity: .45; font-style: normal; }
.row-tags { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.row .card-check { width: 20px; height: 20px; align-self: center; flex-shrink: 0; accent-color: var(--accent); }

/* Stronger, more confident heading hierarchy */
#detailTitle { font: 720 22px/1.25 var(--sans); letter-spacing: -.03em; }
.sheet h2 { font-weight: 720; letter-spacing: -.03em; }
.detail-section h3, .ed-label, .appearance-label {
  font-weight: 700; letter-spacing: .1em;
}

/* Today's Edition — serif for an editorial, premium register */
.edition { max-width: 600px; }
.ed-overview {
  font-family: var(--serif); font-size: 21px; line-height: 1.48;
  font-weight: 480; letter-spacing: -.011em; color: var(--ink);
}
.ed-interest { font-family: var(--serif); font-weight: 600; font-size: 18px; letter-spacing: -.01em; }

/* Disciplined accent — neutral focus/hover; accent stays on active + primary */
.searchrow:focus-within {
  border-color: var(--line-2);
  box-shadow: var(--shadow), inset 0 1px 0 var(--glass-spec);
}

/* Toasts clear the floating mobile bottom bar */
@media (max-width: 879px) {
  .toasts { bottom: calc(78px + env(safe-area-inset-bottom)); }
}
