:root { --red: #D93025; --red-d: #A50E0E; --ink: #202124; --mute: #5f6368; --line: #e8e6e1; --paper: #FFFDF7; --sel: #fce8e6; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--paper); color: var(--ink);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; }
[hidden] { display: none !important; }
button, select, input { font: inherit; }

/* sign-in */
.signin { min-height: 100%; display: grid; place-items: center; padding: 24px; background: linear-gradient(180deg, var(--red) 0 38%, var(--paper) 38%); }
.card { background: #fff; border-radius: 18px; padding: 32px 28px; max-width: 380px; width: 100%; text-align: center; box-shadow: 0 10px 40px rgba(0,0,0,.12); }
.orb { width: 72px; height: 72px; border-radius: 18px; }
.card h1 { margin: 12px 0 6px; font-size: 24px; }
.lead { color: var(--mute); margin: 0 0 22px; }
.btn { display: block; background: var(--red); color: #fff; text-decoration: none; padding: 13px 16px; border-radius: 10px; font-weight: 600; }
.btn:active { background: var(--red-d); }
.fine { color: var(--mute); font-size: 12px; margin: 14px 0 0; }
.msg { margin: 14px 0 0; color: var(--red-d); font-size: 13px; }

/* shell */
.app { height: 100%; display: flex; flex-direction: column; }
.bar { display: flex; align-items: center; gap: 10px; background: var(--red); color: #fff; padding: calc(8px + env(safe-area-inset-top)) 12px 8px; }
.bar-orb { width: 28px; height: 28px; border-radius: 8px; }
.bar-title { font-weight: 700; white-space: nowrap; }
.box { max-width: 220px; min-width: 0; border: 0; border-radius: 8px; padding: 6px 8px; background: rgba(255,255,255,.18); color: #fff; }
.box option { color: var(--ink); }
.search { flex: 1; min-width: 0; }
.search input { width: 100%; border: 0; border-radius: 8px; padding: 8px 12px; background: #fff; color: var(--ink); }
.me { width: 32px; height: 32px; border-radius: 50%; border: 2px solid rgba(255,255,255,.7); background: var(--red-d); color: #fff; font-weight: 700; cursor: pointer; flex: none; }
.menu { position: absolute; right: 10px; top: calc(54px + env(safe-area-inset-top)); background: #fff; border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,.18); padding: 14px 16px; z-index: 10; min-width: 220px; }
.menu-name { font-weight: 600; } .menu-email { color: var(--mute); font-size: 12px; margin-bottom: 10px; }
.menu-link { color: var(--red); text-decoration: none; font-weight: 600; }
.tabs { display: flex; gap: 4px; padding: 6px 10px; border-bottom: 1px solid var(--line); background: #fff; }
.tabs button { border: 0; background: none; padding: 7px 12px; border-radius: 16px; color: var(--mute); cursor: pointer; }
.tabs button.on { background: var(--sel); color: var(--red-d); font-weight: 600; }
.panes { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); }
.list { overflow-y: auto; border-right: 1px solid var(--line); background: #fff; }
.reader { overflow-y: auto; background: var(--paper); }
.empty { color: var(--mute); padding: 40px 20px; text-align: center; }

/* list rows */
.row { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.row:hover { background: #fafafa; } .row.on { background: var(--sel); }
.av { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 15px; }
.who { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.subj { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.snip { color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.meta { text-align: right; color: var(--mute); font-size: 12px; white-space: nowrap; }
.chip { display: inline-block; background: #f1f3f4; color: var(--mute); border-radius: 10px; padding: 1px 7px; font-size: 11px; margin-top: 4px; }
.more { display: block; margin: 12px auto 24px; border: 1px solid var(--line); background: #fff; border-radius: 18px; padding: 8px 18px; cursor: pointer; }
.note { color: var(--mute); text-align: center; padding: 24px 12px; }

/* reader */
.rhead { background: #fff; border-bottom: 1px solid var(--line); padding: 14px 16px; }
.back { display: none; border: 0; background: none; color: var(--red); font-weight: 600; padding: 0 0 8px; cursor: pointer; }
.rsubj { font-size: 18px; font-weight: 600; margin: 0 0 8px; word-wrap: break-word; }
.rline { color: var(--mute); font-size: 13px; word-wrap: break-word; } .rline b { color: var(--ink); font-weight: 600; }
.rtools { margin-top: 8px; display: flex; gap: 8px; flex-wrap: wrap; }
.rtools button { border: 1px solid var(--line); background: #fff; border-radius: 14px; padding: 4px 10px; font-size: 12px; cursor: pointer; }
.atts { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 16px; }
.att { display: inline-flex; gap: 6px; align-items: center; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 6px 10px; text-decoration: none; color: var(--ink); font-size: 13px; max-width: 100%; }
.att span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px; }
.body-frame { width: 100%; border: 0; background: #fff; min-height: 420px; display: block; }
.body-text { white-space: pre-wrap; word-wrap: break-word; padding: 14px 16px; margin: 0; font: inherit; background: #fff; }
.thread { padding: 8px 16px 24px; } .thread h3 { font-size: 13px; color: var(--mute); margin: 14px 0 6px; font-weight: 600; }
.trow { display: flex; justify-content: space-between; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 6px; background: #fff; cursor: pointer; font-size: 13px; }
.trow.cur { border-color: var(--red); }

/* phone: one pane at a time */
@media (max-width: 760px) {
  .bar-title { display: none; } .box { max-width: 120px; }
  .panes { grid-template-columns: 1fr; }
  .reader { display: none; } .reading .reader { display: block; } .reading .list { display: none; }
  .back { display: inline-block; }
}
