/* MailChat Phase 2 — clean card style, Bob R9 design language */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --ink: #17233b; --muted: #68738a; --line: #e4e8f0; --bg: #eef1f6;
  --blue: #2563eb; --blue-dark: #1d4fd0; --amber: #b45309; --amber-bg: #fdf3e2;
  --red: #b3261e;
}
html, body { height: 100%; }
body {
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg); color: var(--ink);
}
.phone {
  max-width: 560px; margin: 0 auto; min-height: 100vh; background: #fff;
  display: flex; flex-direction: column; box-shadow: 0 0 24px rgba(23,35,59,.08);
}
/* ---- app header: the signed-in account is ALWAYS visible ---- */
.appbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--line); background: #fff;
  position: sticky; top: 0; z-index: 20;
}
.brand { font-size: 20px; font-weight: 800; color: var(--ink); text-decoration: none; letter-spacing: -.02em; }
.brand span { color: var(--blue); }
.account { text-align: right; min-width: 0; }
.account-email { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px; }
.account-links { font-size: 12px; }
.account-links a { color: var(--blue); text-decoration: none; font-weight: 600; }
.account-links .dot { color: var(--muted); margin: 0 2px; }
.prototype-strip {
  background: var(--amber-bg); color: var(--amber); font-size: 12px; font-weight: 600;
  text-align: center; padding: 6px 12px; border-bottom: 1px solid #f0dfba;
}
.content { flex: 1; display: flex; flex-direction: column; min-height: 0; }
/* ---- bottom tab bar (R9 five-icon bar) ---- */
.tabbar {
  display: flex; border-top: 1px solid var(--line); background: #fff;
  position: sticky; bottom: 0; z-index: 20;
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 0 10px; font-size: 11px; font-weight: 600; color: var(--muted);
  text-decoration: none; background: none; border: 0; cursor: pointer; font-family: inherit;
}
.tab svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tab.active { color: var(--blue); }
/* ---- generic ---- */
.page-head { padding: 16px 16px 8px; }
.page-head h1 { font-size: 24px; font-weight: 800; letter-spacing: -.02em; margin-bottom: 10px; }
.page-head input, .thread-tools input {
  width: 100%; padding: 10px 14px; border: 1px solid var(--line); border-radius: 999px;
  font-size: 14px; background: #f6f8fb; outline: none;
}
.page-head input:focus, .thread-tools input:focus { border-color: var(--blue); background: #fff; }
.loading, .no-results { padding: 28px 16px; text-align: center; color: var(--muted); font-size: 14px; }
.card {
  margin: 12px 16px; padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: #fff;
}
.card h2 { font-size: 15px; font-weight: 800; margin-bottom: 10px; }
.card-p { font-size: 14px; line-height: 1.5; color: #33405a; margin-bottom: 10px; }
.card-p:last-child { margin-bottom: 0; }
.kv { display: flex; justify-content: space-between; gap: 16px; font-size: 14px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.kv:last-of-type { border-bottom: 0; }
.kv span:first-child { color: var(--muted); }
.kv span:last-child, .kv strong { text-align: right; }
.badge-proto { background: var(--amber-bg); color: var(--amber); font-weight: 700; padding: 2px 8px; border-radius: 999px; font-size: 12px; }
.danger-link { display: inline-block; margin-top: 12px; color: var(--red); font-weight: 700; font-size: 14px; text-decoration: none; }
.primary-btn {
  display: inline-block; background: var(--blue); color: #fff; border: 0; border-radius: 12px;
  padding: 12px 16px; font-size: 15px; font-weight: 700; cursor: pointer; text-align: center; text-decoration: none; font-family: inherit;
}
.primary-btn:hover { background: var(--blue-dark); }
.primary-btn.block { display: block; margin-top: 14px; }
code { background: #f0f2f7; padding: 1px 5px; border-radius: 6px; font-size: 12.5px; }
/* ---- login ---- */
.login-wrap { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px 16px; background: linear-gradient(180deg, #f4f7fd, #fff); }
.login-card { width: 100%; max-width: 380px; background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 28px 24px; box-shadow: 0 12px 32px rgba(23,35,59,.08); }
.logo { font-size: 30px; font-weight: 800; letter-spacing: -.02em; text-align: center; }
.logo span { color: var(--blue); }
.tagline { text-align: center; color: var(--muted); font-size: 14px; margin: 4px 0 22px; }
.card-h { font-size: 18px; font-weight: 800; text-align: center; margin-bottom: 10px; }
.google-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%;
  padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff;
  font-size: 15px; font-weight: 600; color: var(--ink); text-decoration: none;
}
.google-btn:hover { background: #f6f8fb; }
.g-icon { width: 20px; height: 20px; }
.fineprint { font-size: 12px; color: var(--muted); line-height: 1.45; margin-top: 10px; text-align: center; }
.divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--muted); font-size: 12px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.local-form { display: flex; flex-direction: column; gap: 10px; }
.proto-label { font-size: 13px; font-weight: 800; }
.proto-label span { font-weight: 600; color: var(--amber); }
.local-form input {
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; font-size: 15px; outline: none;
}
.local-form input:focus { border-color: var(--blue); }
.form-error { background: #fdeceb; color: var(--red); font-size: 13px; font-weight: 600; padding: 8px 12px; border-radius: 10px; }
/* ---- thread list ---- */
.thread-list { padding: 4px 8px 16px; }
.thread-row { display: flex; gap: 12px; align-items: center; padding: 12px 10px; border-radius: 14px; text-decoration: none; color: var(--ink); }
.thread-row:hover { background: #f6f8fb; }
.avatar {
  width: 48px; height: 48px; border-radius: 50%; flex: 0 0 48px; color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 16px;
}
.row-main { flex: 1; min-width: 0; }
.row-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.row-name { font-weight: 700; font-size: 15.5px; }
.row-time { font-size: 12px; color: var(--muted); white-space: nowrap; }
.row-preview { font-size: 13.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.unread-badge { background: var(--blue); color: #fff; font-size: 11px; font-weight: 800; min-width: 20px; height: 20px; border-radius: 999px; display: flex; align-items: center; justify-content: center; padding: 0 6px; }
/* ---- thread view ---- */
.thread-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.thread-head .avatar { width: 40px; height: 40px; flex-basis: 40px; font-size: 14px; }
.back { font-size: 26px; color: var(--blue); text-decoration: none; line-height: 1; padding-right: 2px; }
.thread-name { font-weight: 800; font-size: 16px; }
.thread-sub { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread-tools { padding: 10px 16px 0; }
.send-notice { margin: 10px 16px 0; background: var(--amber-bg); color: #7c4a03; border: 1px solid #f0dfba; border-radius: 12px; padding: 10px 12px; font-size: 13px; line-height: 1.45; }
.messages { padding: 14px 16px 18px; display: flex; flex-direction: column; gap: 4px; }
.subj-divider { text-align: center; margin: 14px 0 8px; }
.subj-divider span { background: #eef1f6; color: var(--muted); font-size: 11.5px; font-weight: 700; padding: 4px 10px; border-radius: 999px; display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bubble-wrap { display: flex; flex-direction: column; max-width: 85%; margin-top: 8px; }
.bubble-wrap.mine { align-self: flex-end; align-items: flex-end; }
.bubble-wrap.theirs { align-self: flex-start; align-items: flex-start; }
.bubble { padding: 10px 13px; border-radius: 18px; font-size: 14.5px; line-height: 1.45; white-space: pre-wrap; word-break: break-word; cursor: pointer; }
.bubble-wrap.mine .bubble { background: var(--blue); color: #fff; border-bottom-right-radius: 6px; }
.bubble-wrap.theirs .bubble { background: #f2f4f8; color: var(--ink); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.bubble-wrap.selected .bubble { outline: 2px solid var(--amber); }
.bubble-meta { font-size: 11.5px; color: var(--muted); margin: 0 4px 3px; }
.attach-chip { display: inline-block; margin-top: 8px; background: rgba(255,255,255,.22); border: 1px solid rgba(0,0,0,.08); background-color: #e8edf5; color: var(--ink); font-size: 12.5px; font-weight: 600; padding: 5px 9px; border-radius: 8px; }
.bubble-wrap.mine .attach-chip { background: rgba(255,255,255,.25); color: #fff; border-color: transparent; }
.attach-only { color: var(--muted); font-style: italic; }
.notsent-tag { margin-top: 4px; background: #fdeceb; color: var(--red); font-size: 11.5px; font-weight: 800; padding: 4px 9px; border-radius: 999px; }
/* suggested contact */
.suggest-card { margin: 12px 16px 0; border: 1px solid #c9d8fb; background: #f2f6ff; border-radius: 16px; padding: 14px; }
.suggest-card h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--blue); margin-bottom: 6px; }
.suggest-card .s-name { font-weight: 800; font-size: 15px; }
.suggest-card .s-line { font-size: 13.5px; color: #33405a; }
.suggest-actions { display: flex; gap: 8px; margin-top: 10px; }
.suggest-actions button { border-radius: 10px; padding: 8px 14px; font-size: 13.5px; font-weight: 700; cursor: pointer; font-family: inherit; }
.btn-approve { background: var(--blue); color: #fff; border: 0; }
.btn-dismiss { background: #fff; color: var(--muted); border: 1px solid var(--line); }
.suggest-done { font-size: 13.5px; font-weight: 700; color: var(--blue); margin-top: 8px; }
/* reply dock */
.reply-dock { border-top: 1px solid var(--line); padding: 10px 12px; background: #fff; position: sticky; bottom: 57px; }
.reply-chip { display: flex; justify-content: space-between; align-items: center; gap: 8px; background: #f2f6ff; border: 1px solid #c9d8fb; color: #33405a; font-size: 12.5px; border-radius: 10px; padding: 7px 10px; margin-bottom: 8px; }
.reply-chip button { border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 13px; }
.reply-form { display: flex; gap: 8px; align-items: flex-end; }
.reply-form textarea {
  flex: 1; border: 1px solid var(--line); border-radius: 18px; padding: 10px 14px;
  font-size: 14.5px; font-family: inherit; resize: none; outline: none; max-height: 110px;
}
.reply-form textarea:focus { border-color: var(--blue); }
.send-btn { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--blue); color: #fff; font-size: 16px; cursor: pointer; flex: 0 0 40px; }
.send-btn:hover { background: var(--blue-dark); }
/* toast */
.toast {
  position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%);
  background: var(--ink); color: #fff; font-size: 13.5px; font-weight: 600; line-height: 1.4;
  padding: 11px 16px; border-radius: 12px; max-width: min(92vw, 480px); z-index: 50;
  box-shadow: 0 10px 28px rgba(23,35,59,.3); text-align: center;
}
