/* ═══════════════════════════════════════════════════════
   CSS VARIABLES
═══════════════════════════════════════════════════════ */
:root {
  --bg:           #0a0a0f;
  --surface:      #111118;
  --surface2:     #18181f;
  --surface3:     #202028;
  --border:       #2a2a38;
  --border2:      #383848;
  --accent:       #7fff6e;
  --accent-dim:   rgba(127,255,110,0.10);
  --accent2:      #4ef0d5;
  --accent2-dim:  rgba(78,240,213,0.10);
  --accent3:      #ff6eb4;
  --accent3-dim:  rgba(255,110,180,0.10);
  --text:         #e8e8f0;
  --text2:        #b0b0c0;
  --muted:        #5a5a72;
  --danger:       #ff4e6a;
  --danger-dim:   rgba(255,78,106,0.10);
  --warn:         #ffc94d;
  --warn-dim:     rgba(255,201,77,0.10);
  --pin:          #a78bfa;
  --pin-dim:      rgba(167,139,250,0.10);
  --mono:         'Space Mono', monospace;
  --sans:         'Syne', sans-serif;
  --r:            10px;
  --r-sm:         6px;
  --shadow:       0 4px 28px rgba(0,0,0,0.5);
  --tr:           .18s ease;
}

[data-theme="light"] {
  --bg:           #f0f0ec;
  --surface:      #ffffff;
  --surface2:     #f4f4f0;
  --surface3:     #eaeae5;
  --border:       #d4d4cc;
  --border2:      #c0c0b4;
  --accent:       #1e8a10;
  --accent-dim:   rgba(30,138,16,0.10);
  --accent2:      #0a8c78;
  --accent2-dim:  rgba(10,140,120,0.10);
  --accent3:      #cc0070;
  --accent3-dim:  rgba(204,0,112,0.08);
  --text:         #1a1a28;
  --text2:        #44445a;
  --muted:        #8888a0;
  --danger:       #cc2222;
  --danger-dim:   rgba(204,34,34,0.08);
  --warn:         #b87800;
  --warn-dim:     rgba(184,120,0,0.08);
  --pin:          #7c3aed;
  --pin-dim:      rgba(124,58,237,0.08);
  --shadow:       0 4px 24px rgba(0,0,0,0.14);
}

/* ═══════════════════════════════════════════════════════
   RESET & BASE
═══════════════════════════════════════════════════════ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background var(--tr), color var(--tr);
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(rgba(127,255,110,0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(127,255,110,0.022) 1px, transparent 1px);
  background-size: 40px 40px;
}

[data-theme="light"] body::before {
  background-image:
    linear-gradient(rgba(0,0,0,0.038) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,0,0,0.038) 1px, transparent 1px);
}

button { font-family: inherit; cursor: pointer; }
input  { font-family: inherit; }
a      { color: inherit; text-decoration: none; }

/* ═══════════════════════════════════════════════════════
   LOGIN
═══════════════════════════════════════════════════════ */
#login-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-bg-word {
  position: fixed;
  bottom: -4rem;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 20vw;
  font-weight: 700;
  color: var(--accent);
  opacity: 0.02;
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
  letter-spacing: -0.02em;
}

.login-box {
  position: relative;
  z-index: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2.8rem 2.5rem;
  width: 400px;
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
  box-shadow: var(--shadow);
}

.login-box::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--accent), transparent 50%, var(--accent2));
  opacity: 0.12;
  pointer-events: none;
}

.login-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.7rem;
}

.login-logo {
  font-family: var(--mono);
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.login-dots {
  display: flex;
  gap: 0.42rem;
}

.login-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: dotp 1.6s ease-in-out infinite;
}
.login-dot:nth-child(2) { animation-delay: 0.2s; background: var(--accent2); }
.login-dot:nth-child(3) { animation-delay: 0.4s; background: var(--accent3); }

@keyframes dotp {
  0%, 100% { transform: scale(1);    opacity: 1;   }
  50%       { transform: scale(0.45); opacity: 0.2; }
}

.login-sub {
  font-family: var(--mono);
  font-size: 0.67rem;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-align: center;
}

.login-hr {
  height: 1px;
  background: var(--border);
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 0.48rem;
}

.login-label {
  font-family: var(--mono);
  font-size: 0.6rem;
  color: var(--muted);
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.login-input {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 0.74rem 1rem;
  font-family: var(--mono);
  font-size: 0.88rem;
  color: var(--text);
  outline: none;
  width: 100%;
  transition: border-color var(--tr), box-shadow var(--tr);
}

.login-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.login-input::placeholder { color: var(--muted); }

.login-btn {
  background: var(--accent);
  color: #0a0a0f;
  border: none;
  border-radius: var(--r-sm);
  padding: 0.82rem;
  font-family: var(--mono);
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-top: 0.25rem;
  transition: opacity var(--tr), transform var(--tr);
}

.login-btn:hover  { opacity: 0.87; transform: translateY(-1px); }
.login-btn:active { transform: translateY(0); }

.login-error {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--danger);
  text-align: center;
  min-height: 1.1rem;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-7px); }
  40%       { transform: translateX(7px); }
  60%       { transform: translateX(-4px); }
  80%       { transform: translateX(4px); }
}

/* ═══════════════════════════════════════════════════════
   HEADER
═══════════════════════════════════════════════════════ */
#app { display: none; }

header {
  position: sticky;
  top: 0;
  z-index: 200;
  height: 60px;
  padding: 0 1.6rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  background: rgba(10,10,15,0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  transition: background var(--tr);
}

[data-theme="light"] header {
  background: rgba(240,240,236,0.94);
}

.logo {
  font-family: var(--mono);
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.17em;
  display: flex;
  align-items: center;
  gap: 0.58rem;
  user-select: none;
  flex-shrink: 0;
}

.logo-dot {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes pulse {
  0%, 100% { opacity: 1;   transform: scale(1); }
  50%       { opacity: 0.3; transform: scale(0.6); }
}

.hdr-center {
  flex: 1;
  display: flex;
  justify-content: center;
}

.hdr-stats {
  display: flex;
  align-items: center;
  gap: 1.2rem;
}

.hdr-stat {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--muted);
}

.hdr-stat b {
  color: var(--accent2);
  font-weight: 700;
}

.hdr-sep {
  width: 1px;
  height: 14px;
  background: var(--border);
}

.hdr-right {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.icon-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text2);
  width: 34px;
  height: 34px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  transition: all var(--tr);
}

.icon-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}

/* ═══════════════════════════════════════════════════════
   APP LAYOUT
═══════════════════════════════════════════════════════ */
.app-wrap {
  display: grid;
  grid-template-columns: 268px 1fr;
  height: calc(100vh - 60px);
  position: relative;
  z-index: 1;
}

/* ═══════════════════════════════════════════════════════
   SIDEBAR
═══════════════════════════════════════════════════════ */
.sidebar {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
  border-right: 1px solid var(--border);
}

.sb-head {
  padding: 0.9rem 0.9rem 0.75rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.68rem;
  flex-shrink: 0;
}

.sb-title {
  font-family: var(--mono);
  font-size: 0.58rem;
  color: var(--muted);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.sb-search {
  position: relative;
}

.sb-search input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 0.48rem 0.72rem 0.48rem 1.9rem;
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--text);
  outline: none;
  transition: border-color var(--tr), box-shadow var(--tr);
}

.sb-search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim);
}

.sb-search input::placeholder { color: var(--muted); }

.sb-search-icon {
  position: absolute;
  left: 0.58rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 0.85rem;
  pointer-events: none;
  line-height: 1;
}

.alias-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.3rem 0;
}

.alias-list::-webkit-scrollbar { width: 3px; }
.alias-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.alias-list::-webkit-scrollbar-thumb:hover { background: var(--border2); }

.alias-item {
  display: flex;
  align-items: center;
  padding: 0.56rem 0.9rem;
  gap: 0.55rem;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background var(--tr), border-color var(--tr);
  min-height: 44px;
}

.alias-item:hover { background: var(--surface2); }

.alias-item.active {
  background: var(--accent-dim);
  border-left-color: var(--accent);
}

.alias-icon {
  font-size: 0.82rem;
  color: var(--muted);
  flex-shrink: 0;
  font-family: var(--mono);
}

.alias-item.active .alias-icon { color: var(--accent); }

.alias-name {
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--text2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  transition: color var(--tr);
}

.alias-item:hover:not(.active) .alias-name { color: var(--text); }
.alias-item.active .alias-name { color: var(--accent); }

.alias-count {
  font-family: var(--mono);
  font-size: 0.6rem;
  color: var(--muted);
  background: var(--surface3);
  border: 1px solid var(--border);
  padding: 0.08rem 0.42rem;
  border-radius: 20px;
  min-width: 24px;
  text-align: center;
  flex-shrink: 0;
  transition: all var(--tr);
}

.alias-item.active .alias-count {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

.sb-empty {
  padding: 2.5rem 1.2rem;
  text-align: center;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.74rem;
  line-height: 2.2;
}

/* ═══════════════════════════════════════════════════════
   MAIN CONTENT
═══════════════════════════════════════════════════════ */
main {
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Wrapper for list page vs email panel */
#main-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.email-panel {
  display: grid;
  grid-template-columns: 360px 1fr;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

/* ═══════════════════════════════════════════════════════
   EMAIL LIST PANE
═══════════════════════════════════════════════════════ */
.el-pane {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
  border-right: 1px solid var(--border);
}

.el-header {
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 50px;
  flex-shrink: 0;
}

.el-title {
  font-family: var(--mono);
  font-size: 0.62rem;
  color: var(--muted);
  letter-spacing: 0.13em;
  text-transform: uppercase;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.el-alias-hl {
  color: var(--accent2);
  font-size: 0.76rem;
}

.tabs {
  display: flex;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 2px;
  gap: 2px;
  flex-shrink: 0;
}

.tab {
  background: transparent;
  border: none;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.05em;
  padding: 0.22rem 0.56rem;
  border-radius: 4px;
  transition: all var(--tr);
}

.tab:hover { color: var(--text2); }

.tab.active {
  background: var(--surface3);
  color: var(--accent2);
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.refresh-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--tr);
  flex-shrink: 0;
}

.refresh-btn:hover { border-color: var(--accent); color: var(--accent); }
.refresh-btn.spinning { animation: spin 0.65s linear infinite; }

@keyframes spin { to { transform: rotate(360deg); } }

.el-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.25rem 0;
}

.el-list::-webkit-scrollbar { width: 3px; }
.el-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ─── Email Card ─── */
.ecard {
  position: relative;
  padding: 0.8rem 0.9rem;
  cursor: pointer;
  border-left: 3px solid transparent;
  border-bottom: 1px solid rgba(42,42,56,0.5);
  transition: background var(--tr), border-color var(--tr);
}

[data-theme="light"] .ecard {
  border-bottom-color: rgba(212,212,204,0.5);
}

.ecard:hover { background: var(--surface2); }

.ecard.active {
  background: var(--accent2-dim);
  border-left-color: var(--accent2);
}

.ecard.pinned {
  border-left-color: var(--pin);
}

.ecard.pinned.active {
  background: var(--pin-dim);
}

.ecard.archived { opacity: 0.52; }

.ecard-row1 {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.26rem;
}

.ecard-pin-icon {
  font-size: 0.65rem;
  flex-shrink: 0;
  line-height: 1;
}

.ecard-from {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--accent2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.ecard.pinned .ecard-from { color: var(--pin); }

/* Titik 3 menu button */
.ecard-menu {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.05rem;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--tr), background var(--tr), color var(--tr);
  flex-shrink: 0;
  line-height: 1;
  letter-spacing: 0;
}

.ecard:hover .ecard-menu { opacity: 1; }
.ecard-menu:hover { background: var(--surface3); color: var(--text); }

.ecard-subject {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 0.3rem;
}

.ecard-row2 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
}

.ecard-to {
  font-family: var(--mono);
  font-size: 0.59rem;
  background: var(--accent3-dim);
  border: 1px solid rgba(255,110,180,0.18);
  color: var(--accent3);
  padding: 0.1rem 0.42rem;
  border-radius: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 200px;
}

.ecard-badges {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-shrink: 0;
}

.badge {
  font-family: var(--mono);
  font-size: 0.56rem;
  padding: 0.09rem 0.34rem;
  border-radius: 3px;
  flex-shrink: 0;
}

.badge-pin  { background: var(--pin-dim);  border: 1px solid rgba(167,139,250,0.25); color: var(--pin); }
.badge-arch { background: var(--warn-dim); border: 1px solid rgba(255,201,77,0.22);  color: var(--warn); }

.ecard-time {
  font-family: var(--mono);
  font-size: 0.58rem;
  color: var(--muted);
}

/* ─── Empty state ─── */
.el-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.74rem;
  text-align: center;
  padding: 2.5rem;
}

.el-empty-icon { font-size: 2.6rem; }

/* ─── Skeleton ─── */
.skel-card {
  padding: 0.82rem 0.9rem;
  border-bottom: 1px solid rgba(42,42,56,0.5);
}

.skel {
  border-radius: 4px;
  margin-bottom: 7px;
  background: linear-gradient(
    90deg,
    var(--surface2) 25%,
    var(--surface3) 50%,
    var(--surface2) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}

.skel:last-child { margin-bottom: 0; }

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ═══════════════════════════════════════════════════════
   CONTEXT MENU (titik 3)
═══════════════════════════════════════════════════════ */
.ctx-menu {
  position: fixed;
  z-index: 8000;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 0.35rem;
  min-width: 170px;
  animation: ctxIn 0.15s cubic-bezier(0.34,1.56,0.64,1);
}

@keyframes ctxIn {
  from { transform: scale(0.92) translateY(-5px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}

.ctx-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.52rem 0.78rem;
  border-radius: var(--r-sm);
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--text2);
  cursor: pointer;
  transition: background var(--tr), color var(--tr);
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}

.ctx-item:hover                { background: var(--surface3); color: var(--text); }
.ctx-item.ctx-pin:hover        { background: var(--pin-dim);    color: var(--pin); }
.ctx-item.ctx-pin              { color: var(--pin); }
.ctx-item.ctx-danger           { color: var(--danger); }
.ctx-item.ctx-danger:hover     { background: var(--danger-dim); }

.ctx-hr {
  height: 1px;
  background: var(--border);
  margin: 0.3rem 0;
}

/* ═══════════════════════════════════════════════════════
   EMAIL VIEWER
═══════════════════════════════════════════════════════ */
.ev {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

/* Welcome state */
.ev-welcome {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.3rem;
  padding: 3rem;
  text-align: center;
}

.ev-ascii {
  font-family: var(--mono);
  font-size: 0.68rem;
  line-height: 1.56;
  color: var(--accent);
  opacity: 0.2;
  white-space: pre;
  user-select: none;
}

.ev-wtitle {
  font-family: var(--mono);
  font-size: 0.96rem;
  color: var(--text2);
  letter-spacing: 0.04em;
}

.ev-wsub {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--muted);
  line-height: 1.95;
}

/* Loading */
.ev-loading {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.76rem;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Viewer top */
.ev-top {
  padding: 1.25rem 1.75rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

.ev-subject {
  font-size: 1.16rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
  margin-bottom: 0.95rem;
  word-break: break-word;
}

.ev-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  margin-bottom: 0.95rem;
}

.meta-field {
  display: flex;
  flex-direction: column;
  gap: 0.24rem;
  min-width: 90px;
}

.meta-label {
  font-family: var(--mono);
  font-size: 0.57rem;
  color: var(--muted);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.meta-value {
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--text);
  word-break: break-all;
}

.meta-value.from    { color: var(--accent3); }
.meta-value.to      { color: var(--accent); }
.meta-value.pinned  { color: var(--pin); }
.meta-value.lp-link {
  color: var(--accent2);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.meta-value.lp-link:hover { opacity: 0.8; }

/* Action bar */
.ev-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.48rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--border);
}

.ev-actions-label {
  font-family: var(--mono);
  font-size: 0.58rem;
  color: var(--muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-right: 0.2rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  padding: 0.36rem 0.82rem;
  border-radius: var(--r-sm);
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  border: 1px solid transparent;
  transition: all var(--tr);
  white-space: nowrap;
  cursor: pointer;
}

.btn-ghost  { background: transparent; border-color: var(--border);  color: var(--text2); }
.btn-ghost:hover { border-color: var(--accent2); color: var(--accent2); background: var(--accent2-dim); }

.btn-pin    { background: transparent; border-color: rgba(167,139,250,0.3); color: var(--pin); }
.btn-pin:hover   { background: var(--pin-dim);  border-color: var(--pin); }

.btn-warn   { background: transparent; border-color: rgba(255,201,77,0.3);  color: var(--warn); }
.btn-warn:hover  { background: var(--warn-dim); border-color: var(--warn); }

.btn-danger { background: transparent; border-color: rgba(255,78,106,0.3);  color: var(--danger); }
.btn-danger:hover { background: var(--danger-dim); border-color: var(--danger); }

/* View toggle bar */
.vt-bar {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.48rem 1.75rem;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.vt-label {
  font-family: var(--mono);
  font-size: 0.58rem;
  color: var(--muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.vt-group {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 2px;
  gap: 2px;
}

.vt-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.6rem;
  padding: 0.22rem 0.56rem;
  border-radius: 3px;
  transition: all var(--tr);
}

.vt-btn.active {
  background: var(--surface2);
  color: var(--text);
}

/* Body area */
.ev-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.6rem;
}

.ev-body::-webkit-scrollbar { width: 5px; }
.ev-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.ev-body::-webkit-scrollbar-thumb:hover { background: var(--border2); }

.email-iframe {
  width: 100%;
  border: none;
  background: #fff;
  border-radius: 12px;
  min-height: 300px;
  display: block;
  box-shadow: 0 2px 18px rgba(0,0,0,0.18);
}

.email-text-body {
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.9;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.55rem 1.75rem;
}

/* HTML email wrapper */
.email-html-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  min-height: 320px;
}

.email-empty {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--border2);
  border-radius: 12px;
  padding: 1.4rem 1.5rem;
}

/* ═══════════════════════════════════════════════════════
   LIST PAGE (/list/alias@emsimail.lol)
═══════════════════════════════════════════════════════ */
#list-page {
  display: none;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.lp-top {
  padding: 1.2rem 1.8rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  flex-shrink: 0;
}

.lp-title {
  font-family: var(--mono);
  font-size: 0.88rem;
  color: var(--text2);
}

.lp-title span { color: var(--accent); }

.lp-back {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.7rem;
  padding: 0.36rem 0.85rem;
  border-radius: var(--r-sm);
  transition: all var(--tr);
}

.lp-back:hover { border-color: var(--accent); color: var(--accent); }

.lp-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem 1.8rem;
}

.lp-body::-webkit-scrollbar { width: 5px; }
.lp-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.lp-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-width: 860px;
  margin: 0 auto;
}

.lp-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  cursor: pointer;
  transition: border-color var(--tr), background var(--tr), transform var(--tr);
}

.lp-row:hover {
  border-color: var(--accent2);
  background: var(--accent2-dim);
  transform: translateX(2px);
}

.lp-row-left { flex: 1; min-width: 0; }

.lp-from {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--accent2);
  margin-bottom: 0.28rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lp-subject {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lp-row-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.3rem;
  flex-shrink: 0;
}

.lp-time { font-family: var(--mono); font-size: 0.62rem; color: var(--muted); }
.lp-open { font-family: var(--mono); font-size: 0.62rem; color: var(--accent2); }

.lp-empty {
  text-align: center;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
  padding: 4rem 2rem;
}

/* ═══════════════════════════════════════════════════════
   TOASTS
═══════════════════════════════════════════════════════ */
.toast-wrap {
  position: fixed;
  bottom: 1.4rem;
  right: 1.4rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  pointer-events: none;
}

.toast {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 0.68rem 1.1rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text);
  box-shadow: var(--shadow);
  max-width: 300px;
  pointer-events: auto;
  animation: tIn 0.26s cubic-bezier(0.34,1.56,0.64,1);
}

.toast.ok   { border-color: var(--accent);  color: var(--accent);  }
.toast.err  { border-color: var(--danger);  color: var(--danger);  }
.toast.info { border-color: var(--accent2); color: var(--accent2); }
.toast.warn { border-color: var(--warn);    color: var(--warn);    }

@keyframes tIn {
  from { transform: translateX(110%) scale(0.94); opacity: 0; }
  to   { transform: translateX(0)    scale(1);    opacity: 1; }
}

/* ═══════════════════════════════════════════════════════
   HELPERS
═══════════════════════════════════════════════════════ */
.hidden {
  display: none !important;
}

/* ═══════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════ */
@media (max-width: 1100px) {
  .email-panel {
    grid-template-columns: 320px 1fr;
  }
}

@media (max-width: 900px) {
  .app-wrap {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

  .email-panel {
    grid-template-columns: 1fr;
  }

  .el-pane {
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 320px;
  }

  .ev-top,
  .vt-bar,
  .ev-body {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

@media (max-width: 640px) {
  .login-box {
    width: calc(100vw - 1.5rem);
    padding: 2rem 1.15rem;
    border-radius: 16px;
  }

  header {
    padding: 0 0.8rem;
    gap: 0.6rem;
  }

  .hdr-center {
    display: none;
  }

  .el-header {
    flex-wrap: wrap;
    gap: 0.6rem;
  }

  .el-title {
    width: 100%;
    flex: none;
  }

  .lp-top,
  .lp-body {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .lp-row {
    padding: 0.85rem 0.95rem;
  }

  .ecard-to {
    max-width: 120px;
  }
}

/* ═══════════════════════════════════════════════════════
   SCROLLBAR GLOBAL
═══════════════════════════════════════════════════════ */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }