/* =========================================
   MASUKMAIL — style.css (v2)
   Stack: Alpine.js + SweetAlert2 + Font Awesome
   Struktur: 1 token · 2 base · 3 layout · 4 komponen · 5 halaman · 6 util
   ========================================= */

/* ---------- 1. TOKEN ---------- */
:root {
  color-scheme: light;
  --page: #F2F2F7;
  --surface: #ffffff;
  --surface-2: #f2f7fa;
  --field: #ffffff;
  --ink: #1f2937;
  --muted: #6b7280;
  --border: rgba(17,24,39,.08);
  --shadow: 0 1px 3px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.05);

  --accent: #2AABEE;
  --accent-2: #229ED9;
  --accent-soft: rgba(42,171,238,.12);
  --danger: #e5484d;
  --ok: #177245;
  --warn: #b45309;

  --brand-mark: #0f766e;
  --r-card: 16px;
  --r-ctrl: 12px;
  --r-pill: 999px;
  --ease: cubic-bezier(.2,.8,.2,1);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
html[data-theme="dark"] {
  color-scheme: dark;
  --page: #0D1015;
  --surface: #151B23;
  --surface-2: #1C2430;
  --field: #10161D;
  --ink: #E8EDF3;
  --muted: #9AA7B5;
  --border: rgba(226,232,240,.10);
  --shadow: 0 2px 8px rgba(0,0,0,.25);
  --accent-soft: rgba(42,171,238,.16);
}

/* ---------- 2. BASE ---------- */
*, *::before, *::after { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[x-cloak] { display: none !important; }
html { min-height: 100%; }
body {
  margin: 0;
  padding-bottom: max(24px, env(safe-area-inset-bottom));
  color: var(--ink);
  background: var(--page);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background-color .25s, color .25s;
}
a { color: var(--accent-2); text-decoration: none; }
a:hover { color: var(--accent); }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
p { margin: 0; }
i { line-height: 1; }

/* Animasi masuk halus, cuma sekali */
.fade-in { animation: fade .3s var(--ease) both; }
.slide-up { animation: up .4s var(--ease) both; }
.stagger-1 { animation-delay: .04s; }
.stagger-2 { animation-delay: .08s; }
.stagger-3 { animation-delay: .12s; }
.stagger-4 { animation-delay: .16s; }
@keyframes fade { from { opacity: 0; } }
@keyframes up   { from { opacity: 0; transform: translateY(10px); } }

/* ---------- 3. LAYOUT ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  min-height: 60px;
  padding: max(10px, env(safe-area-inset-top)) max(16px, calc((100vw - 720px) / 2)) 10px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(14px) saturate(1.5);
  -webkit-backdrop-filter: blur(14px) saturate(1.5);
  border-bottom: 1px solid var(--border);
}
.topbar-title { display: flex; flex-direction: column; min-width: 0; }
.topbar-title b { font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-title small { color: var(--muted); font-size: 12px; }
.header-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.brand { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 16px; font-weight: 800; }
.brand:hover { color: var(--ink); }

.wrap { width: min(100% - 28px, 720px); margin: 18px auto 32px; }
.wrap.flush-top { padding-top: 0; margin-top: 0; }
.page-shell { width: min(100% - 28px, 640px); margin: 0 auto; padding: 18px 0 40px; }
.page-heading { margin: 8px 0 18px; }
.page-heading h1 { font-size: 22px; font-weight: 800; }
.page-toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 14px; }
.page-foot { margin-top: 18px; text-align: center; }

.grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.center { text-align: center; }

/* ---------- 4. KOMPONEN ---------- */

/* Kartu */
.card {
  margin: 0 0 14px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  box-shadow: var(--shadow);
}
.card h3 { margin-bottom: 12px; font-size: 15px; font-weight: 750; }
.muted { color: var(--muted); font-size: 13px; }
.small-note { font-size: 12px; color: var(--muted); }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

/* Alert */
.alert {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 11px 13px; margin-bottom: 12px;
  border-radius: var(--r-ctrl); font-size: 13px;
  background: var(--surface-2); color: var(--ink);
}
.alert.bad { background: rgba(229,72,77,.1); color: #c53030; }
html[data-theme="dark"] .alert.bad { color: #ff9b9e; }

/* Chip status */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: var(--r-pill);
  font-size: 12px; font-weight: 650;
  background: var(--surface-2); color: var(--muted);
}
.chip.ok   { background: rgba(23,114,69,.12); color: var(--ok); }
.chip.warn { background: rgba(180,83,9,.12); color: var(--warn); }
.chip.bad  { background: rgba(229,72,77,.12); color: var(--danger); }
.chip .fa-circle { font-size: 7px; }

/* Input */
label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 650; }
input, select, textarea {
  display: block; width: 100%; min-width: 0;
  padding: 11px 13px;
  font: inherit; font-size: 15px; color: var(--ink);
  background: var(--field);
  border: 1px solid var(--border);
  border-radius: var(--r-ctrl);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
input:disabled { color: var(--muted); background: var(--surface-2); }
textarea { min-height: 140px; resize: vertical; line-height: 1.55; }
.admin-input { margin-bottom: 0; }
.code-input { text-align: center; font-size: 22px; font-weight: 700; letter-spacing: .3em; }

/* Tombol */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 10px 16px;
  border: 0; border-radius: var(--r-ctrl);
  font: inherit; font-size: 14px; font-weight: 700;
  color: #fff; background: var(--accent);
  cursor: pointer; text-decoration: none;
  transition: background .15s, transform .1s, opacity .15s;
}
.btn:hover { color: #fff; background: var(--accent-2); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.sec { color: var(--ink); background: var(--surface-2); border: 1px solid var(--border); }
.btn.sec:hover { color: var(--ink); background: var(--border); }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #cf3b40; }
.btn.sm { min-height: 34px; padding: 7px 12px; font-size: 13px; border-radius: 10px; }
.btn.block { width: 100%; }
.login-submit { width: 100%; margin-top: 16px; }

/* Ikon bulat dekoratif */
.step-icon, .settings-icon {
  display: inline-grid; place-items: center; flex: none;
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--accent-soft); color: var(--accent-2);
}
.settings-icon.green  { background: rgba(23,114,69,.12); color: var(--ok); }
.settings-icon.purple { background: rgba(124,58,237,.12); color: #7c3aed; }
.settings-icon.indigo { background: rgba(79,70,229,.12); color: #4f46e5; }
.settings-icon.orange { background: rgba(234,88,12,.12); color: #ea580c; }
.settings-icon.red    { background: rgba(229,72,77,.12); color: var(--danger); }
.settings-icon.yellow { background: rgba(202,138,4,.14); color: #a16207; }

/* Tema toggle */
.theme-toggle {
  display: inline-grid; place-items: center;
  width: 36px; height: 36px; padding: 0;
  border: 0; border-radius: var(--r-pill);
  background: transparent; color: var(--muted); cursor: pointer;
}
.theme-toggle:hover { background: var(--surface-2); color: var(--ink); }
.theme-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .theme-label { display: none; }
.theme-icon-sun { display: none; }
html[data-theme="dark"] .theme-icon-sun { display: block; }
html[data-theme="dark"] .theme-icon-moon { display: none; }
.theme-fixed { position: fixed; top: 14px; right: 14px; z-index: 5; }
.theme-fixed .theme-toggle { width: 40px; height: 40px; }

/* Pill link di topbar */
.logout {
  flex: none; padding: 7px 12px; border-radius: var(--r-pill);
  font-size: 13px; font-weight: 650; color: var(--muted);
  background: var(--surface-2);
}
.logout:hover { color: var(--ink); background: var(--border); }

/* ----- Sidebar drawer ----- */
.sidebar-overlay {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(0,0,0,.45);
  opacity: 0; pointer-events: none;
  transition: opacity .2s;
}
.sidebar-overlay.active { opacity: 1; pointer-events: auto; }
.sidebar {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 100;
  display: flex; flex-direction: column;
  width: min(86vw, 300px);
  padding: max(16px, env(safe-area-inset-top)) 14px 14px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  transform: translateX(-102%);
  transition: transform .25s var(--ease);
}
.sidebar.active { transform: translateX(0); }
.sidebar-header { display: flex; align-items: center; justify-content: space-between; padding: 4px 4px 14px; }
.close-btn {
  display: grid; place-items: center; width: 34px; height: 34px;
  border: 0; border-radius: var(--r-pill); background: transparent; color: var(--muted); cursor: pointer;
}
.close-btn:hover { background: var(--surface-2); color: var(--ink); }
.sidebar-btn-add {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; margin-bottom: 10px; padding: 10px;
  border-radius: var(--r-ctrl); font-weight: 700; font-size: 14px;
  color: var(--accent-2); background: var(--accent-soft);
}
.sidebar-btn-add:hover { color: var(--accent-2); filter: brightness(.97); }
.sidebar-nav {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 12px; margin-bottom: 4px; border-radius: var(--r-ctrl);
  color: var(--ink); font-weight: 600; font-size: 14px;
}
.sidebar-nav:hover { background: var(--surface-2); color: var(--ink); }
.sidebar-nav.active { background: var(--accent-soft); color: var(--accent-2); }
.sidebar-section { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.sidebar-email-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 6px 4px 8px;
}
.sidebar-email-row b { display: block; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; word-break: break-all; }
.sidebar-email-row small { color: var(--muted); font-size: 12px; }
.sidebar-menu { display: flex; flex-direction: column; gap: 2px; }
.sidebar-menu a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 10px; border-radius: 10px;
  font-size: 14px; color: var(--ink);
}
.sidebar-menu a i { width: 16px; text-align: center; color: var(--muted); }
.sidebar-menu a:hover { background: var(--surface-2); color: var(--ink); }
.sidebar-menu a.text-red, .sidebar-menu a.text-red i { color: var(--danger); }
.sidebar-footer {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border);
}
.sidebar-logout { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--muted); }
.sidebar-logout:hover { color: var(--danger); }

/* ----- Inbox ----- */
.search-bar {
  display: flex; align-items: center; gap: 10px;
  margin: 14px 0 12px; padding: 0 14px;
  min-height: 46px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-ctrl);
  transition: border-color .15s, box-shadow .15s;
}
.search-bar:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-bar i { color: var(--muted); font-size: 14px; }
.search-bar input { padding: 11px 0; border: 0; background: transparent; box-shadow: none; }
.search-bar input:focus { box-shadow: none; }

.filter-tabs {
  display: flex; gap: 4px; padding: 4px;
  margin-bottom: 12px;
  background: var(--surface-2);
  border-radius: var(--r-ctrl);
}
.filter-tabs button {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 36px; padding: 6px 8px;
  border: 0; border-radius: 9px;
  background: transparent; color: var(--muted);
  font: inherit; font-size: 13px; font-weight: 650; cursor: pointer;
  transition: background .15s, color .15s;
}
.filter-tabs button.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.badge {
  min-width: 20px; padding: 1px 6px; border-radius: var(--r-pill);
  font-size: 11px; font-weight: 700; line-height: 1.5;
  background: var(--border); color: var(--muted); text-align: center;
}
.filter-tabs button.active .badge { background: var(--accent-soft); color: var(--accent-2); }

.mail-list {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  box-shadow: var(--shadow);
}
.mail-row {
  display: block; padding: 13px 16px;
  color: var(--ink);
  border-bottom: 1px solid var(--border);
  transition: background .12s;
}
.mail-row:last-child { border-bottom: 0; }
.mail-row:hover { background: var(--surface-2); color: var(--ink); }
.mail-row-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.mail-from { min-width: 0; font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-date { flex: none; color: var(--muted); font-size: 12px; white-space: nowrap; }
.mail-subject { margin-top: 3px; color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-row.unread .mail-from { font-weight: 700; }
.mail-row.unread .mail-subject { color: var(--accent-2); font-weight: 600; }
.mail-row.unread::before {
  content: ""; float: left; width: 7px; height: 7px; margin: 7px 8px 0 -8px;
  border-radius: 50%; background: var(--accent);
}

.empty-state-card {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 44px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  box-shadow: var(--shadow);
}
.empty-icon {
  display: grid; place-items: center; width: 56px; height: 56px; margin-bottom: 14px;
  border-radius: 16px; background: var(--surface-2); color: var(--muted); font-size: 22px;
}
.empty-state-card h3 { margin-bottom: 6px; font-size: 16px; }
.empty-state-card p { max-width: 300px; color: var(--muted); font-size: 14px; }

.pager { display: flex; justify-content: center; gap: 6px; margin-top: 14px; }

/* ----- Detail email ----- */
.email-header-meta { display: grid; gap: 4px; margin-bottom: 14px; color: var(--muted); font-size: 13px; }
.email-header-meta i { width: 14px; text-align: center; margin-right: 6px; }
.email-body {
  padding: 16px; line-height: 1.6;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-ctrl);
  overflow-wrap: anywhere;
}
.email-frame {
  width: 100%; min-height: 360px; border: 1px solid var(--border);
  border-radius: var(--r-ctrl); background: #fff;
}
.attachments { margin-top: 16px; }
.attachments a { margin: 0 6px 6px 0; }

/* Kode OTP dari hasil cek (verify) */
.result-box { display: flex; gap: 10px; align-items: flex-start; padding: 13px; border-radius: var(--r-ctrl); font-size: 14px; }
.result-valid   { background: rgba(23,114,69,.1); color: var(--ok); }
.result-invalid { background: rgba(229,72,77,.1); color: var(--danger); }
.result-unknown { background: var(--surface-2); color: var(--muted); }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 200; transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
  padding: 10px 16px; border-radius: var(--r-pill);
  font-size: 13px; font-weight: 600; color: #fff; background: #111827;
  transition: opacity .2s, transform .2s var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.type-ok { background: var(--ok); }
.toast.type-error { background: var(--danger); }

/* Skeleton loading */
.skeleton {
  border-radius: 8px;
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s linear infinite;
}
.skeleton-text { height: 12px; margin: 8px 0; }
.skeleton-text.short { width: 40%; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* Modal (dipakai halaman akun) */
.modal-overlay {
  position: fixed; inset: 0; z-index: 120;
  display: flex; align-items: flex-end; justify-content: center;
  background: rgba(0,0,0,.45);
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.modal-overlay.active { opacity: 1; pointer-events: auto; }
.modal-box {
  width: min(100%, 520px); max-height: 88vh; overflow: auto;
  padding: 18px 18px max(18px, env(safe-area-inset-bottom));
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  transform: translateY(20px); transition: transform .25s var(--ease);
}
.modal-overlay.active .modal-box { transform: translateY(0); }
@media (min-width: 640px) {
  .modal-overlay { align-items: center; }
  .modal-box { border-radius: var(--r-card); }
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.modal-header h3 { font-size: 17px; }
.modal-body { margin-bottom: 16px; color: var(--muted); font-size: 14px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }
.modal-close { border: 0; background: transparent; color: var(--muted); font-size: 18px; cursor: pointer; }

/* ---------- 5. HALAMAN ---------- */

/* Login */
.login-page .login-shell { width: min(100% - 28px, 380px); margin: 0 auto; padding: 14vh 0 40px; }
.login-heading { text-align: center; margin-bottom: 22px; }
.login-mark {
  display: grid; place-items: center; width: 60px; height: 60px; margin: 0 auto 12px;
  border-radius: 18px; background: var(--brand-mark); color: #fff; font-size: 24px;
}
.login-heading h1 { font-size: 24px; font-weight: 800; }
.login-heading p { color: var(--muted); font-size: 14px; margin-top: 4px; }
.login-card { padding: 20px; }
.login-form label:not(:first-child) { margin-top: 12px; }
.login-help { margin-top: 14px; color: var(--muted); font-size: 13px; text-align: center; }
.guide-link { display: flex; justify-content: center; gap: 6px; margin-top: 18px; font-size: 13px; color: var(--muted); }

/* Dashboard */
.account-card { display: grid; gap: 10px; padding: 16px; margin-bottom: 10px; }
.addr .email { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 14px; font-weight: 700; word-break: break-all; }
.addr-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }

/* Panduan */
.guide-card { padding: 18px; }
.guide-card h2 { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 16px; font-weight: 750; }
.guide-steps, .guide-list { margin: 0; padding-left: 20px; color: var(--ink); font-size: 14px; }
.guide-steps li, .guide-list li { margin-bottom: 6px; }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.info-grid > div { padding: 10px; background: var(--surface-2); border-radius: 10px; }
.info-grid span { display: block; color: var(--muted); font-size: 12px; }
.info-grid b { font-size: 13px; }

/* Pengaturan (akun) */
.settings-topbar { justify-content: flex-start; }
.settings-wrap { width: min(100% - 28px, 640px); margin: 16px auto 40px; }
.settings-page-heading { margin: 6px 0 16px; }
.settings-page-heading h1 { font-size: 22px; font-weight: 800; }
.settings-avatar {
  display: grid; place-items: center; width: 48px; height: 48px; flex: none;
  border-radius: 50%; background: var(--accent-soft); color: var(--accent-2);
  font-size: 18px; font-weight: 800;
}
.settings-group {
  margin-bottom: 14px; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-card); box-shadow: var(--shadow);
}
.settings-row, .settings-row-button, .settings-theme-row, .settings-logout-row {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 13px 16px;
  color: var(--ink); background: transparent; border: 0;
  font: inherit; text-align: left;
  border-bottom: 1px solid var(--border);
}
.settings-row:last-child, .settings-row-button:last-child, .settings-theme-row:last-child { border-bottom: 0; }
button.settings-row-button { cursor: pointer; }
button.settings-row-button:hover { background: var(--surface-2); }
.settings-label { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.settings-label b { font-size: 14px; font-weight: 650; }
.settings-label small { color: var(--muted); font-size: 12px; }
.settings-chevron { color: var(--muted); font-size: 12px; }
.settings-account-note { padding: 12px 16px; color: var(--muted); font-size: 12px; background: var(--surface-2); }
.settings-footer { margin-top: 8px; text-align: center; font-size: 12px; color: var(--muted); }
.settings-logout-group .settings-logout-row { color: var(--danger); font-weight: 650; justify-content: center; }

/* Tulis email (compose) & send */
.compose-form .field { margin-bottom: 12px; }
.compose-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

/* ---------- 6. RESPONSIF ---------- */
@media (min-width: 720px) {
  .wrap { margin-top: 26px; }
}
@media (max-width: 380px) {
  .grid { grid-template-columns: 1fr; }
  .info-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* State busy saat aksi berjalan */
.is-busy { opacity: .7; transition: opacity .15s; }

/* Ikon tambahan */
.settings-icon.blue { background: var(--accent-soft); color: var(--accent-2); }
.settings-icon.gray { background: var(--surface-2); color: var(--muted); }
.settings-avatar { font-size: 16px; }
.attachments .btn { margin: 0 6px 6px 0; }
.compose-form .field { margin-bottom: 14px; }
.compose-form input[disabled] { opacity: .75; }
.compose-form textarea { min-height: 200px; }

/* ---------- 7. SENTUHAN IOS ---------- */
/* Large title di bawah topbar, ala iOS */
.large-title { padding: 14px 4px 2px; }
.large-title h1 { font-size: 30px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.large-title p { margin-top: 4px; color: var(--muted); font-size: 14px; }

/* Umpan balik tekan: sedikit mengecil, seperti tombol native */
.mail-row, .card a, .settings-row, .settings-row-button, .sidebar-nav, .sidebar-menu a,
.filter-tabs button, .close-btn, .theme-toggle, .logout {
  transition: transform .12s var(--ease), background .15s, color .15s;
}
.mail-row:active, .settings-row:active, .settings-row-button:active,
.sidebar-nav:active, .sidebar-menu a:active, .close-btn:active, .theme-toggle:active {
  transform: scale(.985);
}
.filter-tabs button:active { transform: scale(.97); }

/* Pemisah sisa dari list ala iOS: inset dari kiri */
.settings-group .settings-row + .settings-row { border-top: 1px solid var(--border); }

/* ---------- 8. BOTTOM SHEET (menu aksi per alamat) ---------- */
.sheet-overlay {
  position: fixed; inset: 0; z-index: 110;
  background: rgba(0,0,0,.4);
  opacity: 0; pointer-events: none;
  transition: opacity .25s;
}
.sheet-overlay.active { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 111;
  max-width: 520px; margin: 0 auto;
  padding: 8px 8px max(14px, env(safe-area-inset-bottom));
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -8px 30px rgba(0,0,0,.18);
  transform: translateY(105%);
  transition: transform .3s var(--ease);
}
.sheet.active { transform: translateY(0); }
.sheet-grabber { width: 38px; height: 5px; margin: 6px auto 10px; border-radius: 3px; background: var(--border); }
.sheet-head { padding: 6px 12px 12px; text-align: center; }
.sheet-head b { display: block; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; word-break: break-all; }
.sheet-head small { color: var(--muted); font-size: 12px; }
.sheet-group { overflow: hidden; background: var(--surface-2); border-radius: 14px; }
.sheet-item {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 14px 14px;
  border: 0; background: transparent; color: var(--ink);
  font: inherit; font-size: 15px; text-align: left; cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.sheet-item:last-child { border-bottom: 0; }
.sheet-item:active { background: var(--border); }
.sheet-item i { width: 18px; text-align: center; color: var(--muted); }
.sheet-item.danger, .sheet-item.danger i { color: var(--danger); }
.sheet-cancel {
  display: block; width: 100%; margin-top: 8px; padding: 14px;
  border: 0; border-radius: 14px; background: var(--surface-2);
  color: var(--accent-2); font: inherit; font-size: 15px; font-weight: 700; cursor: pointer;
}
.sheet-cancel:active { background: var(--border); }
.icon-btn {
  display: grid; place-items: center; width: 36px; height: 36px; flex: none;
  border: 0; border-radius: var(--r-pill); background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.account-head { display: flex; align-items: flex-start; gap: 8px; }
.account-head > div:first-child { flex: 1; min-width: 0; }


/* ---------- 9. PENYESUAIAN COMPACT (mobile-first) ---------- */
.topbar { min-height: 52px; padding-top: 8px; padding-bottom: 8px; gap: 8px; }
.brand { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.brand i { flex: none; }
.header-actions { gap: 4px; flex-wrap: nowrap; flex: none; }
.topbar .logout {
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 11px; font-size: 13px; white-space: nowrap;
}
.topbar .logout i { font-size: 13px; }
.logout-danger { color: var(--danger) !important; }
.theme-toggle { width: 34px; height: 34px; }

.large-title { padding: 10px 2px 0; }
.large-title h1 { font-size: 26px; }
.large-title p { font-size: 13px; margin-top: 2px; }

.wrap { margin-top: 14px; }
.card { padding: 14px; margin-bottom: 10px; }
.card h3 { margin-bottom: 8px; }

/* Kartu alamat email: rapat, rata kiri */
.account-card { display: flex; flex-direction: column; gap: 8px; padding: 14px; margin-bottom: 10px; }
.account-card .email { font-size: 13px; line-height: 1.35; }
.account-card .muted { font-size: 12px; }
.account-head { align-items: flex-start; gap: 6px; }
.account-head .icon-btn { width: 32px; height: 32px; margin: -6px -6px 0 0; }
.account-status { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.account-status .muted { font-size: 12px; }
.chip { padding: 2px 8px; font-size: 11px; }
.addr-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 2px; }
.addr-actions .btn.sm { min-height: 32px; padding: 6px 8px; font-size: 12px; width: 100%; }

/* Daftar email: baris lebih rapat */
.mail-row { padding: 10px 14px; }
.mail-from { font-size: 13px; }
.mail-subject { font-size: 13px; margin-top: 2px; }
.mail-date { font-size: 11px; }
.search-bar { min-height: 40px; margin: 10px 0; }
.filter-tabs { margin-bottom: 10px; }
.filter-tabs button { min-height: 32px; font-size: 12px; }

/* Pengaturan: baris lebih pendek */
.settings-row, .settings-row-button, .settings-theme-row, .settings-logout-row { padding: 10px 14px; gap: 10px; }
.settings-icon { width: 30px; height: 30px; border-radius: 9px; }
.settings-label b { font-size: 13px; }
.settings-label small { font-size: 11px; }

/* Di layar kecil, label menu di topbar disembunyikan, cukup ikon */
@media (max-width: 520px) {
  .nav-label { display: none; }
  .topbar .logout { width: 34px; padding: 0; justify-content: center; }
  .topbar .logout i { margin: 0; }
  .brand { font-size: 14px; }
}


/* ---------- 10. FITUR BARU ---------- */

/* Banner masa aktif */
.alert.warn-banner { background: rgba(180,83,9,.12); color: var(--warn); align-items: center; margin-bottom: 10px; }
html[data-theme="dark"] .alert.warn-banner { color: #fbbf24; }

/* Header large-title dengan tombol aksi di kanan */
.large-title-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; }
.icon-btn.is-on { background: var(--accent-soft); color: var(--accent-2); }

/* Pull to refresh */
.pull-hint { display: flex; align-items: center; justify-content: center; overflow: hidden; color: var(--muted); font-size: 14px; transition: height .15s; }
.pull-hint i { transition: transform .15s; }

/* Baris email: kontainer swipe & seleksi */
.mail-row { position: relative; background: var(--surface); touch-action: pan-y; }
.mail-row.is-selected { background: var(--accent-soft); }
.mail-row-main { display: flex; align-items: center; gap: 8px; min-width: 0; }
.mail-code-icon { color: var(--accent-2); font-size: 11px; margin-right: 6px; }
.sel-dot {
  display: inline-grid; place-items: center; flex: none;
  width: 18px; height: 18px; border-radius: 50%;
  border: 1.5px solid var(--muted); color: transparent; font-size: 9px;
}
.sel-dot.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.empty-line { padding: 18px; text-align: center; }

/* Bar aksi massal (mengambang di bawah) */
.bulk-bar {
  position: fixed; left: 50%; bottom: max(14px, env(safe-area-inset-bottom));
  z-index: 60; transform: translateX(-50%);
  width: min(calc(100% - 24px), 480px);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: 0 10px 30px rgba(0,0,0,.2);
}
.bulk-count { font-size: 13px; color: var(--muted); padding-left: 4px; }
.bulk-count b { color: var(--ink); }
.bulk-actions { display: flex; gap: 6px; }

/* Kode OTP di halaman baca */
.otp-card {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px; margin-bottom: 12px;
  background: var(--accent-soft); border-radius: var(--r-ctrl);
}
.otp-code { display: block; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 22px; letter-spacing: .18em; }

/* Pratinjau gambar lampiran */
.attachments .att-title { margin-bottom: 8px; }
.att-preview { display: block; margin-bottom: 8px; border-radius: var(--r-ctrl); overflow: hidden; border: 1px solid var(--border); }
.att-preview img { display: block; width: 100%; height: auto; max-height: 360px; object-fit: contain; background: var(--surface-2); }
.view-subject { font-size: 18px; font-weight: 800; margin-bottom: 12px; overflow-wrap: anywhere; }

/* Meter penyimpanan */
.meter { display: block; height: 6px; margin-top: 6px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.meter-bar { display: block; height: 100%; border-radius: 4px; background: var(--accent); transition: width .3s var(--ease); }

/* ---------- 11. ANTI-OVERFLOW (layar sempit) ---------- */
html, body { max-width: 100%; overflow-x: hidden; }
.topbar { max-width: 100vw; overflow: hidden; }
.topbar > * { min-width: 0; }
.brand { flex: 1 1 auto; min-width: 0; }
.header-actions { flex: 0 0 auto; max-width: 100%; }
.header-actions .logout, .header-actions .theme-toggle { flex: 0 0 auto; }
.wrap, .page-shell, .settings-wrap { max-width: 100%; }
.card, .account-card, .mail-row { min-width: 0; max-width: 100%; }
.card > *, .account-card > *, .settings-label { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 520px) {
  .topbar { gap: 6px; padding-left: 12px; padding-right: 12px; }
  .header-actions { gap: 4px; }
  .topbar .logout { min-width: 34px; }
  .topbar .nav-label { display: none !important; }
  .brand { font-size: 14px; }
  .brand i { display: none; }
  .large-title h1 { font-size: 24px; }
  .wrap { width: calc(100% - 24px); margin-left: auto; margin-right: auto; }
}
