/* ---------------------------------------------------------------------------
   The app, on the web.

   These rules mirror the React Native styles in app/ and components/ so the
   two products are one interface: same top bar, same command bar, same rows,
   same spacing. Numbers here are the numbers there — app/messages/index.tsx
   and components/CommandBar.tsx are the source of truth, and this file should
   be changed alongside them.
   --------------------------------------------------------------------------- */

.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  background: var(--bg);
  /* On a wide screen the same interface sits in a phone-shaped column rather
     than stretching into a different-looking product. */
  max-width: 520px;
  margin: 0 auto;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
}
@media (max-width: 560px) {
  .app-shell { max-width: none; border: none; }
}

/* ---- top icon bar (app/index.tsx header + iconChip) ---- */
.top-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: calc(4px + env(safe-area-inset-top)) 12px 6px;
  flex: none;
}
.top-icons {
  flex: 1;
  display: flex;
  justify-content: space-evenly;
  align-items: center;
}
.icon-chip {
  flex: 1;
  max-width: 34px;
  height: 34px;
  border-radius: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-muted);
  position: relative;
}
.icon-chip.active { background: var(--accent-soft); color: var(--accent); }
.icon-chip svg { width: 19px; height: 19px; stroke: currentColor; fill: none; stroke-width: 34; }
.icon-chip .dot {
  position: absolute; top: 2px; right: 2px; min-width: 15px; height: 15px;
  border-radius: 8px; background: var(--accent); color: #fff;
  font-size: 10px; font-weight: 700; display: flex; align-items: center;
  justify-content: center; padding: 0 4px;
}

/* ---- screen: what sits between the bars ---- */
.screen { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.screen-scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.screen-pad { padding: 14px 16px 8px; }

/* ---- stack header (the back-chevron screens) ---- */
.stack-head {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 12px 10px; flex: none;
}
.stack-title { flex: 1; text-align: center; font-size: 17px; font-weight: 700; }
.round-btn {
  width: 40px; height: 40px; border-radius: 20px; background: var(--surface);
  display: flex; align-items: center; justify-content: center; color: var(--ink);
  flex: none;
}
.pill-btns {
  display: flex; align-items: center; gap: 18px; background: var(--surface);
  border-radius: 20px; padding: 9px 14px;
}
.pill-btns svg, .round-btn svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 34; }

/* ---- thread rows (app/messages/index.tsx styles.row) ---- */
.thread-row {
  display: flex; align-items: center; width: 100%; text-align: left;
  padding: 11px 16px; border-bottom: 1px solid var(--border);
}
.thread-row .avatar {
  width: 48px; height: 48px; border-radius: 24px; margin-right: 12px; flex: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 700; background: var(--accent-soft); color: var(--accent);
  object-fit: cover;
}
.thread-row .body { flex: 1; min-width: 0; }
.thread-row .top { display: flex; align-items: center; gap: 6px; }
.thread-row .name { flex: 1; font-size: 16.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-row .time { font-size: 13px; color: var(--ink-faint); flex: none; }
.thread-row .preview {
  font-size: 14px; line-height: 19px; color: var(--ink-muted); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---- command bar (components/CommandBar.tsx styles.bar) ---- */
.cmd-bar {
  flex: none;
  margin: 8px 16px calc(10px + env(safe-area-inset-bottom));
  border-radius: 24px;
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 6px 8px;
  display: flex;
  align-items: center;
  gap: 2px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}
.cmd-bar input {
  flex: 1; min-width: 0; border: none; outline: none; background: none;
  font-size: 16px; padding: 8px 4px; color: var(--ink);
}
.cmd-bar input::placeholder { color: var(--ink-faint); }
.cmd-icon {
  width: 30px; height: 30px; border-radius: 15px; flex: none;
  display: flex; align-items: center; justify-content: center; color: var(--ink-muted);
}
.cmd-icon svg { width: 19px; height: 19px; stroke: currentColor; fill: none; stroke-width: 34; }
.cmd-send { background: var(--border); color: var(--bg); }
.cmd-send.ready { background: var(--accent); }

/* Pages still render a .inner block; give it the scrolling, padded frame the
   old .content used to provide so every screen behaves the same way. */
.screen > .inner,
.screen-scroll > .inner { padding: 14px 16px 10px; }
.screen > .inner { overflow-y: auto; -webkit-overflow-scrolling: touch; flex: 1; min-height: 0; }
