/* Email — JayAutomotive's standalone mail app (inbox.jayautomotive.ca).
   Gmail's ergonomics translated into the company's matte black + gold:
   pill search, sender avatars, bold unread rows, subject + snippet,
   right-aligned dates, folder chips, a floating compose button and a
   bottom app bar on phones. Generous spacing, 48px+ touch targets. */
:root {
  --bg: #0e1116;
  --panel: #15181d;
  --panel2: #1c2026;
  --line: #2b2f36;
  --text: #f2f1ec;
  --muted: #a3a099;
  --accent: #d4a017;
  --btn: #8c6a0e;
  --btn-text: #ffffff;
  --error: #ff8a8a;
  --notice: #9fe8b1;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body { font-family: system-ui, -apple-system, "Segoe UI", sans-serif; margin: 0; color: var(--text); background: var(--bg); }
a { color: var(--accent); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.mmain { max-width: 860px; margin: 0 auto; padding: 20px 16px 120px; animation: rise .25s ease both; }
.mtop { position: sticky; top: 0; z-index: 20; background: rgba(14,17,22,.96); border-bottom: 2px solid var(--accent); padding: 10px 16px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.mbrand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 800; font-size: 1.25rem; letter-spacing: .02em; min-height: 48px; }
.mlogoimg { width: 38px; height: 38px; border-radius: 9px; }
.acct { margin-left: auto; display: inline-flex; align-items: center; gap: 12px; }
.acctmail { color: var(--muted); font-size: .9rem; }
.signout { margin: 0; }
.linkbtn { background: none; border: 0; color: var(--accent); font: inherit; font-weight: 700; cursor: pointer; padding: 10px 6px; min-height: 44px; }
h1 { font-size: 1.55rem; margin: 10px 0 14px; }
h1.msgsubject { font-size: 1.3rem; line-height: 1.35; }
h2 { font-size: 1.1rem; color: var(--accent); margin-top: 4px; }
.msub { color: var(--muted); line-height: 1.5; }
.gold { color: var(--accent); }
.mcard { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin: 14px 0; }
.mmsg { padding: 12px 14px; border-radius: 10px; }
.mmsg.error { background: #3a1d1d; color: var(--error); border: 1px solid #5a2b2b; }
.mmsg.notice { background: #17301e; color: var(--notice); border: 1px solid #245232; }
label { display: block; margin: 12px 0; font-weight: 600; }
input, select, textarea { display: block; width: 100%; margin-top: 5px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; font: inherit; font-weight: 400; background: var(--panel2); color: var(--text); min-height: 48px; }
textarea { min-height: auto; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.mbtn { display: inline-flex; align-items: center; justify-content: center; background: var(--btn); color: var(--btn-text); border: 0; border-radius: 999px; padding: 12px 22px; font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; min-height: 48px; transition: filter .15s ease, transform .1s ease; }
.mbtn:hover { filter: brightness(1.15); }
.mbtn:active { transform: scale(.98); }
.mbtn.ghost { background: var(--panel2); color: var(--text); border: 1px solid var(--line); }
.mbtn.ghost:hover { border-color: var(--accent); filter: none; }
.mbtn.danger { background: #8a2626; color: #fff; }
.mbtn.small { padding: 8px 16px; min-height: 44px; font-size: .95rem; }
.mbtn.big { width: 100%; font-size: 1.05rem; padding: 14px 22px; }
.btnrow { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 14px; }
.inlineform { display: inline-flex; gap: 8px; align-items: center; margin: 0; flex-wrap: wrap; }
.inlineform label { margin: 0; display: inline-flex; align-items: center; gap: 8px; }
.inlineform select { width: auto; margin-top: 0; min-height: 48px; }
/* toolbar: pill search, Gmail-style */
.mtoolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 6px 0 14px; }
.msearch { flex: 1 1 260px; display: flex; gap: 8px; background: var(--panel2); border: 1px solid var(--line); border-radius: 999px; padding: 4px 4px 4px 18px; align-items: center; }
.msearch:focus-within { border-color: var(--accent); }
.msearch input { flex: 1; border: 0; background: transparent; margin: 0; padding: 8px 0; min-height: 40px; }
.msearch input:focus { outline: none; }
.msearch .mbtn { min-height: 40px; padding: 8px 16px; }
/* folder chips */
.folders { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 10px; scrollbar-width: none; }
.folders::-webkit-scrollbar { display: none; }
.folder { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 7px; min-height: 48px; padding: 10px 18px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); color: var(--text); text-decoration: none; font-weight: 600; }
.folder.on { border-color: var(--accent); color: var(--accent); background: #221c08; }
.fcount { color: var(--muted); font-weight: 400; font-size: .88rem; }
.funread { background: var(--accent); color: #0e1116; border-radius: 999px; padding: 1px 9px; font-size: .8rem; font-weight: 800; }
.sortbar { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; margin: 6px 0 12px; }
.sortbar label { margin: 0; }
.sortbar select, .sortbar input[type="search"] { width: auto; }
.checkline { display: inline-flex !important; gap: 9px; align-items: center; font-weight: 600; margin: 0; }
.checkline input { width: 22px; height: 22px; margin: 0; accent-color: var(--accent); flex: 0 0 auto; min-height: 0; }
/* bulk bar */
.bulkbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; }
.bulkbar select { width: auto; margin: 0; min-height: 44px; }
.movelabel { display: inline-flex; align-items: center; gap: 8px; margin: 0; }
.bulksep { flex: 1; }
/* message list — Gmail rows */
.mlist { display: flex; flex-direction: column; gap: 8px; }
.mrow { display: flex; gap: 12px; align-items: flex-start; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 13px 14px; transition: border-color .15s ease, background .15s ease; }
.mrow:hover { border-color: var(--accent); }
.mrow:active { background: var(--panel2); }
.mrow.unread { border-left: 4px solid var(--accent); background: #191b17; }
.mcheck { margin: 2px 0 0; }
.mcheck input { width: 22px; height: 22px; accent-color: var(--accent); margin: 0; min-height: 0; }
.avatar { flex: 0 0 auto; width: 42px; height: 42px; border-radius: 50%; background: linear-gradient(145deg, #3a2f10, #8c6a0e); color: #ffe9a8; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.05rem; margin-top: 1px; }
.mmain-link { flex: 1; min-width: 0; color: var(--text); text-decoration: none; display: block; }
.mrow-top { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.mfrom { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mrow.unread .mfrom, .mrow.unread .msubject { font-weight: 800; }
.mwhen { color: var(--muted); font-size: .83rem; white-space: nowrap; }
.msubject { display: block; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msnippet { display: block; color: var(--muted); font-size: .92rem; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.star { color: var(--accent); }
.dlv { display: inline-block; border: 1px solid var(--line); border-radius: 999px; padding: 0 8px; font-size: .75rem; font-weight: 700; margin-left: 8px; vertical-align: 2px; }
.dlv-open { color: var(--notice); border-color: #3f7d4e; }
.dlv-del, .dlv-sent { color: var(--accent); }
.dlv-fail { color: var(--error); border-color: #7d3f3f; }
.dlv-wait { color: var(--muted); }
.dlvlist { color: var(--muted); }
/* message view */
.msghead p { line-height: 1.6; margin-top: 0; }
.mailbody { white-space: pre-wrap; word-break: break-word; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px; font: inherit; line-height: 1.6; overflow-x: auto; }
.mailframe { width: 100%; min-height: 320px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.mailplain summary { cursor: pointer; color: var(--accent); padding: 10px 0; font-weight: 600; }
/* floating compose + bottom app bar */
.fab { position: fixed; right: 20px; bottom: 96px; z-index: 30; width: 60px; height: 60px; border-radius: 50%; background: var(--accent); color: #0e1116; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; text-decoration: none; box-shadow: 0 10px 26px rgba(0,0,0,.55); border: 2px solid #f4c542; }
.fab:active { transform: scale(.96); }
.appbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: rgba(17,19,23,.98); border-top: 1px solid var(--accent); display: flex; }
.appbar a { flex: 1; min-height: 64px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--text); text-decoration: none; font-size: .8rem; font-weight: 600; padding: 8px 2px calc(8px + env(safe-area-inset-bottom)); }
.appbar a:active { color: var(--accent); }
.ab-ico { font-size: 1.25rem; line-height: 1; }
.mfoot { text-align: center; color: var(--muted); padding: 18px; font-size: .85rem; }
.authwrap { max-width: 460px; margin: 4vh auto 0; }
.authwrap h1 { text-align: center; }
.authwrap .msub { text-align: center; }
.steps p { line-height: 1.7; }
.pklist { list-style: none; padding: 0; margin: 0 0 8px; }
.pklist li { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
@media (min-width: 760px) {
  .fab { bottom: 36px; }
  .appbar { display: none; }
  .mmain { padding-bottom: 48px; }
}
/* account switcher */
.acctswitch { max-width: 860px; margin: 0 auto; padding: 12px 16px 0; display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.acctswitch::-webkit-scrollbar { display: none; }
.acctchip { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 7px; min-height: 44px; padding: 9px 16px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); color: var(--text); text-decoration: none; font-weight: 600; font-size: .95rem; }
.acctchip.on { border-color: var(--accent); color: var(--accent); background: #221c08; }
.acctchip.add { border-style: dashed; color: var(--accent); }
.acctchip.sync { color: var(--muted); }
