/* doot app shell + screens. Builds on tokens.css, base.css and components.css. */
html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
body { position: fixed; inset: 0; width: 100%; }
#app { height: 100%; }
.danger-text { color: var(--danger); }
.accent { color: var(--accent); }
.stack-gap { display: grid; gap: var(--s-3); }

/* ---------- frame ---------- */
.shell { height: var(--app-h, 100dvh); }
.pane-thread { display: none; position: relative; }
.shell[data-open="1"] .pane-list, .shell[data-open="1"] .tabbar { display: none; }
.shell[data-open="1"] .pane-thread { display: flex; }
.pane-list .scroll, .pane-thread .scroll { background: var(--bg); }
@media (min-width: 900px) {
  .shell[data-open] .pane-list { display: flex; }
  .pane-thread, .shell[data-open="1"] .pane-thread { display: flex; background: var(--bg); }
}
.list { padding: var(--s-2); }
.list.you, .list.stack-gap { padding: var(--s-4); }
.rail .badge, .tab .badge { font-size: 11px; min-width: 18px; height: 18px; padding: 0 5px; }
.rail .tab .badge { position: absolute; top: 6px; right: 4px; left: auto; }
.rail .tab-label { display: none; }
.rail .logo { width: 44px; height: 30px; margin-bottom: var(--s-4); }
.topbar .btn-icon.back { margin-left: -6px; }
@media (min-width: 900px) { .topbar .btn-icon.back { display: none; } }
.tab:focus-visible { outline-offset: -3px; }

/* phone push/pop transitions */
.slide-in { animation: slide-in var(--dur-slow) var(--ease); }
.slide-back { animation: slide-back var(--dur-slow) var(--ease); }
@keyframes slide-in { from { transform: translateX(28px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes slide-back { from { transform: translateX(-24px); opacity: 0; } to { transform: none; opacity: 1; } }

/* connection pill */
.pill {
  position: fixed; top: calc(var(--safe-t) + var(--topbar-h) + 10px); left: 50%; transform: translateX(-50%); white-space: nowrap;
  z-index: var(--z-toast); display: inline-flex; align-items: center; gap: var(--s-2);
  max-width: 94vw; padding: 8px var(--s-4); border-radius: var(--r-full);
  background: var(--surface-2); color: var(--text); border: 1px solid var(--line);
  box-shadow: var(--shadow-2); font-size: var(--fs-sm); font-weight: 500; pointer-events: none;
  animation: pill-in var(--dur) var(--ease);
}
.pill-offline { background: var(--attention-soft); }
.pill-offline .icon { color: var(--attention); }
@keyframes pill-in { from { opacity: 0; transform: translate(-50%, -8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---------- chat list ---------- */
.chat-row .body { min-width: 0; }
.chat-row .you { color: var(--dim); }
.chat-row.unread .you { color: var(--dim); font-weight: 400; }
.chat-row .txt { overflow: hidden; text-overflow: ellipsis; }
.chat-row .typing-text { color: var(--accent); font-weight: 600; }
.chat-row .tick { width: 14px; height: 14px; }
.chat-row:focus-visible { outline-offset: -2px; }

/* ---------- thread ---------- */
.thread-bar { gap: var(--s-3); }
.thread-bar .who { flex: 1; min-width: 0; }
.thread-bar h1 { font-size: var(--fs-md); font-weight: 650; line-height: 1.2; }
.thread-bar .sub { font-size: var(--fs-xs); color: var(--dim); font-weight: 400; min-height: 1.2em; }
.thread-bar .sub.accent { color: var(--accent); }
.thread-wrap { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.thread-wrap .scroll { flex: 1; }
.thread { min-height: 100%; justify-content: flex-end; }
.thread-empty { align-self: center; margin: var(--s-8) 0; color: var(--dim); }
.older { align-self: center; margin-bottom: var(--s-2); }
.jump { position: absolute; right: var(--s-4); bottom: var(--s-3); box-shadow: var(--shadow-2); }
.jump .badge { background: var(--on-accent); color: var(--accent); }
.bubble { position: relative; -webkit-touch-callout: none; }
.bubble.typing { padding: 10px 14px; }
.bubble .more {
  position: absolute; top: 4px; width: 26px; height: 26px; padding: 0; display: none; place-items: center;
  border: 0; border-radius: 50%; background: var(--surface-2); color: var(--dim);
}
.bubble .more .icon { width: 16px; height: 16px; }
.bubble:not(.mine) .more { left: 100%; margin-left: 6px; }
.bubble.mine .more { right: 100%; margin-right: 6px; }
@media (hover: hover) { .bubble:hover .more, .bubble .more:focus-visible { display: grid; } }
.bubble .more:focus-visible { display: grid; }
@media (pointer: coarse) { .bubble { user-select: none; -webkit-user-select: none; } }
.bubble.failed { cursor: pointer; }
.composer-hint { padding: var(--s-3) var(--s-4) calc(var(--s-3) + var(--safe-b)); background: var(--bg); border-top: 1px solid var(--line); color: var(--dim); text-align: center; font-size: var(--fs-base); }
.empty-pane { height: 100%; display: grid; place-content: center; justify-items: center; gap: var(--s-4); color: var(--dim); }
.empty-pane .mark { width: 96px; height: 64px; color: var(--text); opacity: 0.9; }

/* ---------- requests, you, sheets ---------- */
.request .quote { white-space: pre-wrap; }
.profile { display: flex; align-items: center; gap: var(--s-4); padding: var(--s-3) var(--s-1) var(--s-5); }
.you .sec { margin: var(--s-5) var(--s-2) var(--s-2); font-size: var(--fs-sm); color: var(--dim); font-weight: 600; text-transform: lowercase; }
.you .hint { margin: var(--s-2) var(--s-2) 0; }
.you .cell label { font-weight: 500; }
.you .signout { margin-top: var(--s-7); padding-bottom: var(--s-6); }
.you .seg button { padding: 0 var(--s-3); }
.sheet-actions { display: flex; justify-content: flex-end; gap: var(--s-2); margin-top: var(--s-5); }
.found { display: flex; align-items: center; gap: var(--s-3); margin-top: var(--s-4); padding: var(--s-3); border-radius: var(--r-md); background: var(--surface-2); }
.menu.flat { border: 0; box-shadow: none; padding: 0; min-width: 0; background: none; }
.menu.flat button { min-height: 52px; font-size: var(--fs-md); }
.menu.pop { position: fixed; z-index: var(--z-pop); }

/* ---------- auth ---------- */
.auth { height: var(--app-h, 100dvh); overflow-y: auto; display: grid; place-items: center; padding: var(--s-6) var(--s-4) calc(var(--s-6) + var(--safe-b)); }
.auth-card { width: 100%; max-width: 400px; display: grid; gap: var(--s-4); }
.auth-card .wordmark { width: 132px; color: var(--text); margin-bottom: var(--s-3); }
.auth-form { display: grid; gap: var(--s-4); margin-top: var(--s-2); }
.auth-links { display: flex; justify-content: space-between; gap: var(--s-4); flex-wrap: wrap; font-size: var(--fs-base); }
.auth-links a { color: var(--dim); }

/* ---------- single-box sign-in ---------- */
.auth-step { animation: pop-in var(--dur) var(--ease); }
.auth-card h1 { font-size: var(--fs-2xl); }
.auth-card .hint { margin: 0; }
.chip { display: flex; align-items: center; gap: var(--s-2); width: fit-content; max-width: 100%; padding: 4px var(--s-3) 4px 4px; border-radius: var(--r-full); background: var(--surface-2); }
.chip b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip .link { margin-left: var(--s-2); font-size: var(--fs-sm); }
.link { background: none; border: 0; padding: 4px 0; font: inherit; color: var(--dim); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.link:disabled { opacity: 0.7; text-decoration: none; cursor: default; }
@media (hover: hover) { .link:not(:disabled):hover { color: var(--text); } }
.auth-links .link { padding: 8px 0; }
