/* tmail — tema gelap ala aplikasi email: latar gelap, aksen biru, baris email rapat. */
:root {
  --bg: #202124;
  --surface: #2d2e30;
  --surface-2: #35363a;
  --text: #e8eaed;
  --muted: #9aa0a6;
  --line: #3c4043;
  --line-soft: #2f3033;
  --accent: #8ab4f8;
  --accent-strong: #aecbfa;
  --accent-surface: #394457;
  --accent-text: #202124;
  --green: #81c995;
  --green-bg: #1e3a2a;
  --red: #f28b82;
  --red-bg: #44272a;
  --star: #fdd663;
  --radius: 16px;
  --shadow: 0 1px 3px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
  --font-ui: "Roboto", -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Roboto Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14.5px/1.55 var(--font-ui);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; font-weight: 500; }
p { margin: 0; }
button { font: inherit; cursor: pointer; color: inherit; }
input, select { font: inherit; color: inherit; }
::selection { background: var(--accent-surface); }

.wrap { max-width: 680px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.ic { width: 20px; height: 20px; flex: none; }
.ic-sm { width: 16px; height: 16px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 0;
  background: transparent; color: var(--text); display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.icon-btn:hover { background: rgba(232, 234, 237, .08); }
.icon-btn.sm { width: 32px; height: 32px; }
.icon-btn.sm .ic { width: 17px; height: 17px; }

/* ---------- bar atas ---------- */
.appbar { position: sticky; top: 0; z-index: 30; background: var(--bg); padding: 10px 0 6px; }
.appbar-in { max-width: 680px; margin: 0 auto; padding: 0 12px; display: flex; align-items: center; gap: 4px; }
.search-pill {
  flex: 1; display: flex; align-items: center; gap: 8px; height: 48px;
  background: var(--surface); border-radius: 999px; padding: 0 8px 0 16px; min-width: 0;
}
.search-pill .ic { color: var(--muted); }
.search-pill input {
  flex: 1; min-width: 0; border: 0; outline: none; background: transparent;
  font-size: 15px; color: var(--text);
}
.search-pill input::placeholder { color: var(--muted); }
.avatar-wrap { position: relative; flex: none; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--accent);
  background: #7c4dff; color: #fff; font: 500 16px var(--font-ui);
  display: flex; align-items: center; justify-content: center; margin-left: 6px;
}
.avatar-menu {
  position: absolute; top: calc(100% + 8px); right: 0; width: 300px; max-width: calc(100vw - 24px);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 10px 0 12px; z-index: 45;
}
.am-label { padding: 10px 18px 6px; font-size: 12px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.am-addr-row { display: flex; align-items: center; gap: 2px; padding: 0 8px 0 0; }
.am-addr {
  flex: 1; min-width: 0; display: block; text-align: left; padding: 10px 18px; border: 0; background: none;
  color: var(--accent-strong); font: 500 13.5px var(--font-mono);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-radius: 0 999px 999px 0;
}
.am-addr:hover { background: rgba(232, 234, 237, .06); }
.am-new {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 11px 18px; border: 0; border-top: 1px solid var(--line-soft); margin-top: 8px;
  background: none; color: var(--accent-strong); font: 500 14px var(--font-ui);
}
.am-new:hover { background: rgba(232, 234, 237, .06); }

/* ---------- drawer ---------- */
.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); z-index: 40; }
.drawer {
  position: fixed; top: 0; left: 0; bottom: 0; width: 300px; max-width: 84vw; z-index: 50;
  background: var(--surface); box-shadow: var(--shadow);
  transform: translateX(-105%); transition: transform .22s ease; overflow-y: auto; padding-bottom: 24px;
}
.drawer.open { transform: translateX(0); }
.drawer-head { padding: 22px 20px 14px; border-bottom: 1px solid var(--line-soft); }
.brand-name { font: 700 24px/1 var(--font-ui); letter-spacing: -.02em; color: var(--text); }
.drawer-nav { padding: 10px 8px 10px 0; }
.nav-item {
  display: flex; align-items: center; gap: 16px; width: 100%; text-align: left;
  padding: 11px 20px 11px 20px; border: 0; background: none; color: var(--text);
  font-size: 15px; border-radius: 0 999px 999px 0; text-decoration: none;
}
.nav-item:hover { background: rgba(232, 234, 237, .06); }
.nav-item.active { background: var(--accent-surface); color: var(--accent-strong); font-weight: 500; }
.nav-item .ic { color: var(--muted); }
.nav-item.active .ic { color: var(--accent-strong); }
.nav-item span:nth-child(2) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { font: 500 13px var(--font-ui); color: var(--muted); }
.nav-item.active .badge { color: var(--accent-strong); }
.drawer-section { padding: 18px 20px 8px; font-size: 13px; font-weight: 500; color: var(--muted); }
.status-list { padding: 0 20px; }
.status-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line-soft); font-size: 14px; }
.status-row:last-child { border-bottom: 0; }
.status-key { color: var(--muted); }
.status-val { margin-left: auto; font-weight: 500; font-family: var(--font-mono); font-size: 13px; text-align: right; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.status-dot.ok { background: var(--green); box-shadow: 0 0 0 3px rgba(129, 201, 149, .2); }
.status-dot.err { background: var(--red); box-shadow: 0 0 0 3px rgba(242, 139, 130, .2); }
.drawer-foot { border-top: 1px solid var(--line-soft); margin-top: 12px; }

/* ---------- konten ---------- */
.content { max-width: 680px; margin: 0 auto; padding: 8px 12px 150px; }

/* ---------- tombol ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px;
  border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--accent-strong);
  font-weight: 500; font-size: 14px; text-align: center;
}
.btn:hover { background: rgba(138, 180, 248, .08); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); padding: 8px 10px; }
.btn.ghost:hover { background: rgba(232, 234, 237, .08); color: var(--text); }
.btn.big { width: 100%; justify-content: center; padding: 12px 16px; font-size: 15px; margin-top: 16px; }
.btn:disabled { opacity: .55; cursor: default; }
/* tombol di lembar buat email: sudut lebih kalem, sejajar dengan field */
.sheet .btn.big { border-radius: 12px; padding: 13px 16px; margin-top: 6px; }
.sheet #customGo { border-radius: 10px; padding: 10px 18px; }
.link-btn { border: 0; background: none; color: var(--accent); font: 500 14px var(--font-ui); padding: 4px 2px; }
.link-btn:hover { text-decoration: underline; }

.custom-row { display: flex; gap: 8px; align-items: center; margin-top: 14px; flex-wrap: wrap; }
.custom-row input {
  flex: 1; min-width: 150px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  font: 500 14.5px var(--font-mono); color: var(--text); background: var(--bg); outline: none;
}
.custom-row input:focus { border-color: var(--accent); }
.custom-at { color: var(--muted); font-weight: 500; }

/* ---------- dropdown domain kustom (list kebawah, bukan popup bawaan) ---------- */
.domain-dd { position: relative; flex: 1; min-width: 150px; }
.domain-dd-btn {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%;
  padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text); font: 500 14px var(--font-ui); cursor: pointer;
}
.domain-dd-btn .dd-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.domain-dd-btn .ic { color: var(--muted); transition: transform .18s ease; }
.domain-dd.open .domain-dd-btn .ic { transform: rotate(180deg); }
.domain-dd-list {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 70;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow); max-height: 220px; overflow-y: auto; padding: 4px;
}
.domain-dd-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%;
  padding: 10px 12px; border: 0; background: none; color: var(--text);
  font: 500 14px var(--font-ui); text-align: left; border-radius: 8px; cursor: pointer;
}
.domain-dd-item:hover { background: rgba(232, 234, 237, .08); }
.domain-dd-item.selected { color: var(--accent-strong); }
.domain-dd-item .ic { color: var(--accent-strong); visibility: hidden; }
.domain-dd-item.selected .ic { visibility: visible; }

/* ---------- daftar email ---------- */
.inbox { margin-top: 12px; }
.inbox-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 0 6px; margin-bottom: 6px; }
.inbox-head h2 { font-size: 17px; font-weight: 500; }
.inbox-tools { display: flex; align-items: center; gap: 2px; }

/* ---------- kartu iklan (ala kartu promo Gmail) ---------- */
.ad-card {
  display: flex; gap: 14px; align-items: flex-start; background: var(--surface);
  border-radius: var(--radius); padding: 16px; margin: 10px 0 12px; box-shadow: var(--shadow);
}
/* display:flex di atas menimpa atribut hidden bawaan — tanpa baris ini kartu
   tidak bisa disembunyikan walau hidden=true (bug 2026-11-07). */
.ad-card[hidden] { display: none; }
.ad-icon {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  background: #2e4a7a; color: var(--accent-strong);
  display: flex; align-items: center; justify-content: center;
}
.ad-main { flex: 1; min-width: 0; }
.ad-main h3 { font-size: 16.5px; line-height: 1.35; margin-bottom: 6px; }
.ad-main p { font-size: 14px; color: var(--muted); line-height: 1.5; }
.ad-actions { display: flex; gap: 8px; margin-top: 12px; }
.ad-actions .link-btn { padding: 6px 12px 6px 0; }
.ad-card .icon-btn { margin: -6px -6px 0 0; }
.msg-list { border-top: 1px solid var(--line-soft); }
.msg-list:empty { display: none; }
.msg-row {
  display: flex; gap: 12px; align-items: flex-start; width: 100%; text-align: left;
  padding: 13px 6px; background: var(--bg); border: 0; border-bottom: 1px solid var(--line-soft);
  color: var(--text); font: inherit; touch-action: pan-y; will-change: transform;
  position: relative; z-index: 1;
}
.msg-row:active { background: var(--bg); }
.msg-row:hover { background: #2d2e30; }
.msg-ava {
  width: 40px; height: 40px; border-radius: 50%; flex: none; color: #fff;
  display: flex; align-items: center; justify-content: center; font: 500 16px var(--font-ui);
  -webkit-touch-callout: none; -webkit-user-select: none; user-select: none;
}
/* Avatar logo pengirim — background-image (bukan <img>) supaya tidak bisa
   ditekan lama lalu disimpan/dibuka gambarnya. Glyph di lingkaran putih,
   logo penuh menuhin lingkaran. */
.msg-ava.logo { background-color: #fff; background-position: center; background-repeat: no-repeat; background-size: 60%; }
.msg-ava.logo.full { background-color: transparent; background-size: cover; }
.msg-main { flex: 1; min-width: 0; padding-top: 1px; }
.msg-top { display: flex; align-items: baseline; gap: 10px; }
.msg-from { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-row.unread .msg-from, .msg-row.unread .msg-subject { font-weight: 700; color: #fff; }
.msg-time { margin-left: auto; flex: none; font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.unread-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
.msg-subject { display: block; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-preview { display: block; font-size: 14px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- geser buat hapus (ala Gmail) ---------- */
.swipe-wrap { position: relative; overflow: hidden; }
/* Latar merah + ikon tong sampah HANYA muncul saat baris benar-benar digeser.
   Sebelumnya .msg-row:hover semi-transparan, jadi warna merah tembus keluar
   tiap baris diketuk (hover nempel di HP) — baris jadi merah penuh. */
.swipe-bg {
  position: absolute; inset: 0; background: #8c1d18; color: #fff;
  display: flex; align-items: center; justify-content: space-between; padding: 0 22px;
  opacity: 0; transition: opacity .15s ease;
}
.swipe-wrap.swiping .swipe-bg { opacity: 1; }
.swipe-bg .ic { width: 22px; height: 22px; }

/* ---------- chip OTP di daftar ---------- */
.otp-chip {
  display: inline-flex; align-items: center; gap: 6px; width: fit-content;
  margin-top: 7px; padding: 4px 10px 4px 8px; border-radius: 999px; cursor: pointer;
  background: var(--accent-surface); color: var(--accent-strong); font: 500 12.5px var(--font-ui);
}
.otp-chip:hover { background: #44536e; }
.otp-chip .ic-sm { width: 14px; height: 14px; }
.otp-chip code { font: 500 13px var(--font-mono); letter-spacing: .04em; }
.msg-side { display: flex; flex-direction: column; align-items: center; gap: 8px; flex: none; padding-top: 2px; }
.star-btn { border: 0; background: none; padding: 2px; color: var(--muted); display: flex; }
.star-btn:hover { color: var(--text); }
.star-btn.starred { color: var(--star); }
.star-btn .ic { width: 20px; height: 20px; }
.msg-attach { color: var(--muted); display: flex; }
.msg-attach .ic { width: 15px; height: 15px; }

.empty { padding: 56px 24px; text-align: center; }
.empty-art { width: 88px; height: auto; margin-bottom: 12px; opacity: .85; }
.empty p { color: var(--muted); font-size: 15px; }

/* ---------- baca surat ---------- */
.reader { margin-top: 6px; }
.reader-bar { display: flex; align-items: center; gap: 4px; padding: 4px 0 10px; }
.reader-spacer { flex: 1; }
.mail { background: var(--surface); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.mail-subject { font-size: 20px; line-height: 1.35; margin-bottom: 16px; }
.mail-sender { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.mail-ava {
  width: 40px; height: 40px; border-radius: 50%; color: #fff;
  display: flex; align-items: center; justify-content: center; font: 500 16px var(--font-ui); flex: none;
  -webkit-touch-callout: none; -webkit-user-select: none; user-select: none;
}
.mail-ava.logo { background-color: #fff; background-position: center; background-repeat: no-repeat; background-size: 60%; }
.mail-ava.logo.full { background-color: transparent; background-size: cover; }
.mail-who { flex: 1; min-width: 0; }
.mail-who strong { display: block; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-who span { display: block; font-size: 12.5px; color: var(--muted); }
.mail-attach { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 12px; font-size: 13px; color: var(--muted); }
.mail-attach span { display: inline-flex; align-items: center; gap: 6px; background: var(--bg); border: 1px solid var(--line-soft); border-radius: 999px; padding: 3px 10px; }
.mail-attach .ic { width: 14px; height: 14px; }
.mail-body { border-top: 1px solid var(--line-soft); padding-top: 16px; font-size: 14.5px; }
.mail-body pre { white-space: pre-wrap; word-break: break-word; font: inherit; margin: 0; }
.mail-body iframe { width: 100%; min-height: 420px; border: 0; display: block; background: #fff; border-radius: 8px; }

/* ---------- skeleton isi pesan (tampil selagi isi dimuat) ---------- */
.mail-loading { display: grid; gap: 10px; padding-top: 4px; }
.mail-loading i { display: block; height: 12px; border-radius: 6px; background: var(--surface-2); animation: mail-pulse 1.1s ease-in-out infinite; }
.mail-loading i:nth-child(2) { animation-delay: .15s; }
.mail-loading i:nth-child(3) { animation-delay: .3s; }
@keyframes mail-pulse { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }

/* ---------- Tools: Authenticator (TOTP) ---------- */
.totp { margin-top: 6px; }
.totp-head { display: flex; align-items: center; gap: 4px; padding: 4px 0 10px; }
.totp-title { font-size: 17px; font-weight: 500; margin: 0; }
.totp-add { background: var(--surface); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); display: grid; gap: 10px; margin-bottom: 14px; }
.totp-add input { width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; color: var(--text); font: inherit; font-size: 14.5px; padding: 11px 12px; outline: none; }
.totp-add input:focus { border-color: var(--accent); }
.totp-hint { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.totp-list { display: grid; gap: 10px; }
.totp-item { background: var(--surface); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.totp-top { display: flex; align-items: flex-start; gap: 8px; }
.totp-who { flex: 1; min-width: 0; }
.totp-who strong { display: block; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.totp-secret { display: block; font: 12px var(--font-mono); color: var(--muted); margin-top: 2px; cursor: pointer; word-break: break-all; }
.totp-code { display: block; width: 100%; border: 0; background: none; padding: 10px 0 8px; font: 500 30px var(--font-mono); letter-spacing: .12em; color: var(--accent-strong); text-align: left; cursor: pointer; }
.totp-foot { display: flex; align-items: center; gap: 10px; }
.totp-progress { flex: 1; height: 4px; border-radius: 2px; background: var(--surface-2); overflow: hidden; }
.totp-progress i { display: block; height: 100%; background: var(--accent); border-radius: 2px; transition: width 1s linear; }
.totp-count { font-size: 12px; color: var(--muted); flex: none; }

/* ---------- Tools: Outlook Reader ---------- */
.outlook { margin-top: 6px; }
.outlook-login { background: var(--surface); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); display: grid; gap: 10px; margin-bottom: 14px; }
.outlook-login textarea { width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; color: var(--text); font: 13px var(--font-mono); padding: 11px 12px; outline: none; resize: vertical; word-break: break-all; }
.outlook-login textarea:focus { border-color: var(--accent); }
.outlook-head { display: flex; align-items: center; gap: 8px; padding: 2px 0 12px; }
.outlook-addr { flex: 1; min-width: 0; font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.outlook-tools { display: flex; align-items: center; gap: 4px; flex: none; }
.outlook-body { margin: 2px 0 14px 58px; padding: 14px 16px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; }
.outlook-body pre { white-space: pre-wrap; word-break: break-word; font: inherit; font-size: 14px; line-height: 1.65; color: var(--text); margin: 0; max-height: 320px; overflow: auto; }
.outlook-copy { width: 100%; justify-content: center; margin-top: 12px; }
.outlook-err { color: var(--red); font-size: 13.5px; line-height: 1.5; margin: 10px 0 0; }
.outlook-err:not([hidden]) { display: block; }
.outlook-addr-sel { flex: 1; min-width: 0; font-size: 14px; font-weight: 500; color: var(--text); background: transparent; border: 0; outline: none; cursor: pointer; padding: 2px 0; text-overflow: ellipsis; }
.outlook-addr-sel option { background: var(--surface); color: var(--text); }
.auto-btn { flex: none; padding: 6px 11px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--muted); font: 500 12.5px var(--font-ui); cursor: pointer; }
.auto-btn.on { background: var(--accent-surface); border-color: var(--accent); color: var(--accent-strong); }
.outlook-saved { margin-top: 2px; }
.outlook-saved-title { font-size: 13px; color: var(--muted); margin: 0 0 6px; }
.outlook-saved-row { display: flex; align-items: center; gap: 8px; padding: 7px 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; margin-bottom: 6px; }
.outlook-saved-mail { flex: 1; min-width: 0; text-align: left; background: none; border: 0; color: var(--text); font: 500 13.5px var(--font-ui); padding: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }

/* ---------- lembar buat email baru ---------- */
.sheet-scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); z-index: 55; }
.sheet {
  position: fixed; left: 50%; bottom: 0; transform: translate(-50%, 105%); z-index: 56;
  width: 100%; max-width: 520px; background: var(--surface); border-radius: 20px 20px 0 0;
  box-shadow: var(--shadow); padding: 18px 20px 28px; transition: transform .22s ease;
}
.sheet.open { transform: translate(-50%, 0); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.sheet-head h3 { font-size: 19px; }
.sheet-div { display: flex; align-items: center; gap: 12px; margin: 18px 0 4px; color: var(--muted); font-size: 13px; }
.sheet-div::before, .sheet-div::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ---------- bar bawah (ala Gmail) ---------- */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; height: 66px;
  background: var(--bg); border-top: 1px solid var(--line-soft);
  display: flex; justify-content: center; gap: 48px; padding: 6px 0 8px;
}
.bn-item {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  border: 0; background: none; color: var(--muted); font: 500 12px var(--font-ui); padding: 0 8px;
}
.bn-ic {
  position: relative; display: flex; align-items: center; justify-content: center;
  width: 56px; height: 30px; border-radius: 999px;
}
.bn-ic .ic { width: 21px; height: 21px; }
.bn-item.active { color: var(--accent-strong); }
.bn-item.active .bn-ic { background: var(--accent-surface); }
.bn-badge {
  position: absolute; top: -6px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: var(--accent); color: var(--accent-text);
  font: 700 11px/18px var(--font-ui); text-align: center;
}

/* ---------- FAB + toast ---------- */
.fab {
  position: fixed; right: 18px; bottom: 82px; z-index: 35;
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--accent); color: var(--accent-text); border: 0; border-radius: 16px;
  padding: 15px 20px; font: 500 14.5px var(--font-ui); box-shadow: 0 4px 14px rgba(0, 0, 0, .5);
}
.fab:hover { background: var(--accent-strong); }
.toast {
  position: fixed; left: 50%; bottom: 92px; transform: translateX(-50%); z-index: 60;
  background: var(--text); color: var(--accent-text); border-radius: 8px;
  padding: 12px 20px; font: 500 14px var(--font-ui); box-shadow: var(--shadow); white-space: nowrap;
  display: flex; align-items: center; gap: 18px; max-width: calc(100vw - 32px);
}
.toast[hidden] { display: none; }
.toast-action {
  background: none; border: 0; padding: 0; cursor: pointer;
  color: #0b57d0; font: 700 13px var(--font-ui); letter-spacing: .05em; text-transform: uppercase;
}

@media (max-width: 640px) {
  .msg-time .time-text { display: none; }
  .mail { padding: 16px; }
}

/* Aturan display bawaan author menimpa [hidden] bawaan browser, jadi
   FAB + bar bawah tidak mau hilang walau hidden=true tanpa baris ini. */
.fab[hidden], .bottom-nav[hidden] { display: none; }

/* ---------- elemen desktop (tersembunyi di HP) ---------- */
.compose-btn { display: none; }
.row-check, .row-actions { display: none; }
.select-all, .inbox-count { display: none; }
.bulk-bar { display: none; align-items: center; gap: 4px; }
.inbox-head.bulk .bulk-bar { display: flex; }
.inbox-head.bulk h2, .inbox-head.bulk .inbox-tools { display: none; }
#bulkCount { font-size: 17px; font-weight: 500; margin-right: 8px; }

/* ---------- tampilan desktop ala Gmail (lebar >= 1024px) ---------- */
@media (min-width: 1024px) {
  /* Sidebar tetap kelihatan di kiri, bukan drawer geser. */
  .drawer {
    transform: none; width: 256px; max-width: none;
    background: var(--bg); box-shadow: none; z-index: 20;
  }
  .scrim { display: none; }
  .appbar, .content { margin-left: 256px; }
  .appbar-in { max-width: none; padding: 0 24px; }
  .search-pill { max-width: 720px; margin: 0 auto; }
  .content { max-width: none; padding: 8px 32px 60px; }
  .bottom-nav, .fab { display: none; }

  /* Tombol tulis ala Gmail (Tulis) di atas navigasi sidebar. */
  .compose-btn {
    display: inline-flex; align-items: center; gap: 12px;
    margin: 14px 20px 6px; padding: 0 20px; height: 56px;
    background: var(--accent); color: var(--accent-text); border: 0; border-radius: 16px;
    font: 500 14.5px var(--font-ui); box-shadow: 0 1px 3px rgba(0, 0, 0, .4);
  }
  .compose-btn:hover { background: var(--accent-strong); }

  /* Hamburger menciutkan sidebar jadi rel ikon (ala Gmail). */
  body.side-collapsed .drawer { width: 76px; }
  body.side-collapsed .drawer-head { display: none; }
  body.side-collapsed .compose-btn { margin: 14px auto 6px; padding: 0; width: 48px; justify-content: center; }
  body.side-collapsed .compose-btn span { display: none; }
  body.side-collapsed .drawer-nav { padding: 10px 0; display: flex; flex-direction: column; align-items: center; }
  body.side-collapsed .nav-item { width: 48px; height: 48px; padding: 0; justify-content: center; border-radius: 50%; }
  body.side-collapsed .nav-item span:nth-child(2), body.side-collapsed .badge { display: none; }
  body.side-collapsed .drawer-section, body.side-collapsed .status-list, body.side-collapsed .drawer-foot { display: none; }
  body.side-collapsed .appbar, body.side-collapsed .content { margin-left: 76px; }

  /* Bilah alat kotak masuk ala Gmail. */
  .inbox-head { border-bottom: 1px solid var(--line-soft); padding-bottom: 10px; }
  .select-all { display: inline-flex; align-items: center; padding: 0 4px; cursor: pointer; }
  .select-all input, .row-check input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); cursor: pointer; }
  .inbox-count { display: inline; font-size: 13px; color: var(--muted); margin-right: 4px; }

  /* Baris pesan satu baris: checkbox, bintang, avatar, pengirim, subjek + cuplikan, tanggal. */
  #msgList .msg-row { align-items: center; padding: 11px 16px 11px 44px; }
  #msgList .msg-main { display: flex; align-items: center; gap: 12px; padding-top: 0; }
  #msgList .msg-top { display: contents; }
  #msgList .msg-from { flex: 0 0 190px; order: 0; }
  #msgList .msg-subject { flex: 0 1 auto; max-width: 36%; order: 1; }
  #msgList .msg-preview { flex: 1 1 auto; order: 2; }
  #msgList .otp-chip { margin-top: 0; flex: none; order: 3; }
  #msgList .msg-time { order: 4; margin-left: auto; }
  #msgList .msg-side { order: -1; flex-direction: row; align-items: center; gap: 4px; padding-top: 0; }
  #msgList .msg-ava { width: 36px; height: 36px; }
  .swipe-wrap.checked .msg-row, .swipe-wrap.checked .msg-row:hover { background: var(--accent-surface); }

  /* Checkbox muncul pas hover / pas dipilih; aksi cepat muncul pas hover (tanggal disembunyikan). */
  .row-check {
    display: flex; position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
    z-index: 2; opacity: 0; transition: opacity .12s ease;
  }
  .swipe-wrap:hover .row-check, .swipe-wrap.checked .row-check { opacity: 1; }
  .row-actions {
    display: none; position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
    z-index: 2; align-items: center; gap: 2px;
  }
  #msgList .swipe-wrap:hover .row-actions { display: flex; }
  #msgList .swipe-wrap:hover .msg-time { visibility: hidden; }

  /* Baris Outlook ikut diratakan satu baris (tanpa checkbox). */
  #outlookList .msg-row { align-items: center; padding: 11px 16px; }
  #outlookList .msg-main { display: flex; align-items: center; gap: 12px; padding-top: 0; }
  #outlookList .msg-top { display: contents; }
  #outlookList .msg-from { flex: 0 0 190px; order: 0; }
  #outlookList .msg-subject { flex: 0 1 auto; max-width: 36%; order: 1; }
  #outlookList .msg-preview { flex: 1 1 auto; order: 2; }
  #outlookList .otp-chip { margin-top: 0; flex: none; order: 3; }
  #outlookList .msg-time { order: 4; margin-left: auto; }

  /* Baca surat datar ala Gmail: tanpa kartu, isi di tengah. */
  .reader-bar { border-bottom: 1px solid var(--line-soft); padding: 6px 0 10px; margin-bottom: 4px; }
  .reader .mail { background: transparent; box-shadow: none; border-radius: 0; max-width: 760px; margin: 0 auto; padding: 20px 0 48px; }
  .mail-subject { font-size: 22px; }
  .mail-attach span { background: var(--surface); }
}
