/* Sophia feed — Phase 3 surface. Approved v4 design, scoped to #tab-feed.
 * Semantic color language: memory=blue, action=amber, system=violet, ambient=green.
 * Do not restyle without Manny's eyes on a preview first ("show first, ship second"). */
#tab-feed {
  --hatch-widget-bg: #0b0e13;
  --hatch-widget-surface: #141a23;
  --hatch-widget-surface-muted: #1b2534;
  --hatch-widget-text: #eef2f7;
  --hatch-widget-muted: #9aa7bb;
  --hatch-widget-border: #232c3a;
  --hatch-widget-accent: #7db4ff;
  --hatch-widget-on-accent: #08111f;
  --hatch-widget-focus: #4d8dff;
  --hatch-widget-shadow: rgba(0, 0, 0, 0.5);
  background: var(--hatch-widget-bg);
  color: var(--hatch-widget-text);
  padding: 20px 16px 48px;
}
@media (prefers-color-scheme: light) {
  #tab-feed {
    --hatch-widget-bg: #f4f5f7;
    --hatch-widget-surface: #ffffff;
    --hatch-widget-surface-muted: #eceff3;
    --hatch-widget-text: #14161a;
    --hatch-widget-muted: #5d6b7f;
    --hatch-widget-border: #dde3ea;
    --hatch-widget-accent: #2f6fed;
    --hatch-widget-on-accent: #ffffff;
    --hatch-widget-focus: #2f6fed;
    --hatch-widget-shadow: rgba(20, 30, 50, 0.12);
  }
}
#tab-feed .feed { max-width: 560px; margin: 0 auto; }
#tab-feed .greet h1 { font-size: 26px; margin: 4px 0 2px; font-weight: 700; letter-spacing: -0.01em; }
#tab-feed .greet .dayline { color: var(--hatch-widget-muted); font-size: 14px; margin-bottom: 14px; }

#tab-feed .legend { display: flex; gap: 14px; flex-wrap: wrap; margin: 4px 0 6px; }
#tab-feed .legend span { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--hatch-widget-muted); }
#tab-feed .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
#tab-feed .c-memory { background: #6ea8fe; }
#tab-feed .c-action { background: #fbbf24; }
#tab-feed .c-system { background: #c084fc; }
#tab-feed .c-ambient { background: #4ade80; }

#tab-feed .section-label {
  font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--hatch-widget-muted); margin: 26px 0 4px;
}
#tab-feed .card {
  position: relative;
  display: flex; gap: 14px;
  background: var(--hatch-widget-surface);
  border: 1px solid var(--hatch-widget-border);
  border-left: 3px solid #6ea8fe;
  border-radius: 12px; padding: 14px 16px; margin: 10px 0;
}
#tab-feed .card.memory { border-left-color: #6ea8fe; }
#tab-feed .card.action { border-left-color: #fbbf24; }
#tab-feed .card.system { border-left-color: #c084fc; }
#tab-feed .card.ambient { border-left-color: #4ade80; }
#tab-feed .card .dismiss {
  position: absolute; top: 8px; right: 10px;
  border: 0; background: none; cursor: pointer;
  color: var(--hatch-widget-muted); font-size: 16px; line-height: 1; padding: 4px;
  opacity: 0.55;
}
#tab-feed .card .dismiss:hover { opacity: 1; }
#tab-feed .icon {
  flex: 0 0 40px; width: 40px; height: 40px; border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  background: var(--hatch-widget-surface-muted);
}
#tab-feed .icon svg { width: 22px; height: 22px; }
#tab-feed .memory .icon svg { stroke: #6ea8fe; }
#tab-feed .action .icon svg { stroke: #fbbf24; }
#tab-feed .system .icon svg { stroke: #c084fc; }
#tab-feed .ambient .icon svg { stroke: #4ade80; }
#tab-feed .card .body { flex: 1; min-width: 0; padding-right: 14px; }
#tab-feed .card .kind { font-size: 11px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--hatch-widget-muted); }
#tab-feed .card h3 { margin: 3px 0 2px; font-size: 16px; font-weight: 650; }
#tab-feed .card .why { font-size: 12px; color: var(--hatch-widget-muted); }
#tab-feed .card p { margin: 6px 0 0; font-size: 14px; color: var(--hatch-widget-text); opacity: 0.92; }
#tab-feed .card .actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
#tab-feed .btn {
  padding: 7px 14px; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer;
  border: 1px solid var(--hatch-widget-border);
  background: var(--hatch-widget-surface-muted); color: var(--hatch-widget-text);
  text-decoration: none; display: inline-block;
}
#tab-feed .btn.primary { background: var(--hatch-widget-accent); border-color: var(--hatch-widget-accent); color: var(--hatch-widget-on-accent); }
#tab-feed .btn:disabled { opacity: 0.55; cursor: wait; }

#tab-feed .live { align-items: center; }
#tab-feed .pulse { width: 10px; height: 10px; border-radius: 50%; background: #c084fc; animation: feedpulse 1.6s infinite; flex: 0 0 10px; }
@keyframes feedpulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
#tab-feed .bar { height: 6px; border-radius: 3px; background: var(--hatch-widget-surface-muted); margin-top: 8px; overflow: hidden; }
#tab-feed .bar i { display: block; height: 100%; width: 0%; background: #c084fc; border-radius: 3px; }

#tab-feed .thumb {
  margin-top: 10px; border-radius: 10px; overflow: hidden;
  border: 1px solid var(--hatch-widget-border);
  aspect-ratio: 16 / 8; width: 100%; display: block; object-fit: cover;
  background: var(--hatch-widget-surface-muted);
}

#tab-feed .conn-row { display: flex; align-items: center; justify-content: space-between; padding: 9px 0; border-top: 1px solid var(--hatch-widget-border); font-size: 14px; }
#tab-feed .conn-row:first-of-type { border-top: 0; }
#tab-feed .pill { font-size: 12px; padding: 3px 10px; border-radius: 12px; background: var(--hatch-widget-surface-muted); color: var(--hatch-widget-muted); margin-left: 8px; white-space: nowrap; }
#tab-feed .pill.on { color: #4ade80; }

#tab-feed .foot { text-align: center; margin-top: 30px; }
#tab-feed .foot a { color: var(--hatch-widget-accent); font-size: 14px; text-decoration: none; cursor: pointer; }
#tab-feed .note { font-size: 12px; color: var(--hatch-widget-muted); text-align: center; margin-top: 8px; }
#tab-feed .empty { text-align: center; color: var(--hatch-widget-muted); padding: 40px 20px; font-size: 15px; }
#tab-feed .feed-err { text-align: center; color: var(--hatch-widget-muted); padding: 40px 20px; font-size: 14px; }

/* Ask Sophia modal — acts on top of the feed; depth is opt-in. */
#tab-feed .overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(5, 7, 10, 0.62);
  display: flex; align-items: flex-end; justify-content: center; padding: 16px;
}
#tab-feed .modal {
  width: 100%; max-width: 480px; max-height: 78%;
  background: var(--hatch-widget-surface);
  border: 1px solid var(--hatch-widget-border);
  border-radius: 16px; display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 24px 64px var(--hatch-widget-shadow);
}
#tab-feed .modal-head { padding: 14px 16px; border-bottom: 1px solid var(--hatch-widget-border); display: flex; align-items: center; gap: 8px; }
#tab-feed .modal-head b { font-size: 15px; }
#tab-feed .modal-head span { font-size: 12px; color: var(--hatch-widget-muted); }
#tab-feed .modal-head .x { margin-left: auto; border: 0; background: none; color: var(--hatch-widget-muted); font-size: 20px; cursor: pointer; }
#tab-feed .msgs { padding: 14px 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
#tab-feed .q { align-self: flex-end; background: var(--hatch-widget-accent); color: var(--hatch-widget-on-accent); padding: 9px 13px; border-radius: 14px 14px 4px 14px; font-size: 14px; max-width: 85%; }
#tab-feed .a { align-self: flex-start; background: var(--hatch-widget-surface-muted); padding: 9px 13px; border-radius: 14px 14px 14px 4px; font-size: 14px; max-width: 88%; }
#tab-feed .minput { display: flex; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--hatch-widget-border); }
#tab-feed .minput input { flex: 1; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--hatch-widget-border); background: var(--hatch-widget-bg); color: var(--hatch-widget-text); font-size: 14px; }
#tab-feed .quick-row { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 16px 4px; }

/* Atlas Home Sprint 1: feed composition — main column + rail on desktop;
 * on mobile the wrappers dissolve (display:contents) and the blocks stack
 * in design order, the rail's live card between Needs you and New. The
 * Places list is desktop-only here; on mobile the More hub carries it. */
@media (min-width: 900px) {
  #tab-feed .feed {
    max-width: none; display: grid;
    grid-template-columns: minmax(0, 1fr) 330px;
    gap: 20px; align-items: start;
  }
  #tab-feed .feed-main { min-width: 0; }
  #tab-feed .feed-rail { position: sticky; top: 16px; min-width: 0; }
}
@media (max-width: 899px) {
  #tab-feed .feed { display: flex; flex-direction: column; }
  #tab-feed .feed-main, #tab-feed .feed-rail { display: contents; }
  #tab-feed .greet { order: 1; }
  #tab-feed .legend { order: 2; }
  #tab-feed .sec-live { order: 3; }
  #tab-feed .sec-needs { order: 4; }
  #tab-feed .live-card { order: 5; }
  #tab-feed .sec-new { order: 6; }
  #tab-feed .sec-around { order: 7; }
  #tab-feed .empty { order: 8; }
  #tab-feed .foot { order: 9; }
  #tab-feed .note { order: 10; }
  #tab-feed .rail-places { display: none; }
}
#tab-feed .live-card { align-items: center; }
#tab-feed .live-ava {
  flex: 0 0 46px; width: 46px; height: 46px; border-radius: 50%;
  object-fit: cover; border: 2px solid var(--hatch-widget-accent);
}
#tab-feed .card.rail-places { display: block; }
#tab-feed .place-group {
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--hatch-widget-muted);
  margin: 14px 0 2px;
}
#tab-feed .place-row {
  display: flex; justify-content: space-between; align-items: center;
  width: 100%; background: none; border: 0;
  border-bottom: 1px solid var(--hatch-widget-border);
  color: var(--hatch-widget-text); font-size: 14px; font-weight: 600;
  padding: 9px 0; cursor: pointer; text-align: left;
}
#tab-feed .place-row:last-child { border-bottom: 0; }
#tab-feed .place-row .chev { color: var(--hatch-widget-muted); }
