/* ─────────────────────────────────────────────────────────────────────────────
   MonoMail — Premium Dark Dashboard CSS
   ───────────────────────────────────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ─── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-base:      #0a0a0f;
  --bg-surface:   #111118;
  --bg-elevated:  #16161f;
  --bg-hover:     #1c1c28;
  --bg-active:    #1f1f2e;
  --border:       rgba(255,255,255,0.06);
  --border-hover: rgba(255,255,255,0.12);

  --accent:       #7c3aed;
  --accent-light: #9f67ff;
  --accent-glow:  rgba(124,58,237,0.35);
  --blue:         #3b82f6;
  --blue-glow:    rgba(59,130,246,0.25);
  --green:        #22c55e;
  --red:          #ef4444;
  --orange:       #f59e0b;

  --text-primary:   #f1f1f5;
  --text-secondary: #8b8ba7;
  --text-muted:     #4a4a6a;

  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  16px;
  --radius-xl:  22px;

  --sidebar-w:  240px;
  --topbar-h:   58px;

  --shadow-sm:  0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg:  0 8px 32px rgba(0,0,0,0.6);
  --shadow-glow: 0 0 24px var(--accent-glow);

  --font-sans: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  --transition: 0.18s cubic-bezier(0.4,0,0.2,1);
}

html { font-size: 14px; scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  height: 100vh;
}

a { color: var(--accent-light); text-decoration: none; }
a:hover { text-decoration: underline; }
code {
  font-family: var(--font-mono);
  background: rgba(255,255,255,0.06);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.85em;
  color: var(--accent-light);
}
::selection { background: var(--accent-glow); }
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

.hidden { display: none !important; }
.mono { font-family: var(--font-mono); }

/* ─── Utility Buttons ──────────────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex; align-items: center; gap: 6px;
  background: linear-gradient(135deg, var(--accent), var(--blue));
  color: #fff; border: none; border-radius: var(--radius-md);
  padding: 8px 16px; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: var(--transition);
  box-shadow: 0 2px 12px var(--accent-glow);
  white-space: nowrap;
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px var(--accent-glow);
  filter: brightness(1.1);
}
.btn-primary:active { transform: translateY(0); }
.btn-sm { padding: 6px 12px; font-size: 12px; }

.btn-ghost {
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent; color: var(--text-secondary);
  border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 8px 16px; font-size: 13px; font-weight: 500;
  cursor: pointer; transition: var(--transition);
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border-hover); }

.icon-btn {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: var(--radius-sm);
  background: transparent; border: none;
  color: var(--text-secondary); cursor: pointer; transition: var(--transition);
  flex-shrink: 0;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.icon-btn.active { color: var(--orange); }
.danger-btn:hover { background: rgba(239,68,68,0.12) !important; color: var(--red) !important; }

/* ─────────────────────────────────────────────────────────────────────────────
   LOGIN SCREEN
   ───────────────────────────────────────────────────────────────────────────── */
.login-screen {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-base);
  overflow: hidden;
}

.login-bg { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.login-orb {
  position: absolute; border-radius: 50%;
  filter: blur(80px); opacity: 0.25;
  animation: orbFloat 8s ease-in-out infinite;
}
.orb-1 { width: 500px; height: 500px; background: var(--accent); top: -150px; left: -100px; animation-delay: 0s; }
.orb-2 { width: 400px; height: 400px; background: var(--blue); bottom: -100px; right: -80px; animation-delay: -3s; }
.orb-3 { width: 300px; height: 300px; background: #ec4899; top: 40%; left: 50%; animation-delay: -5s; opacity: 0.12; }

@keyframes orbFloat {
  0%, 100% { transform: translateY(0) scale(1); }
  50%       { transform: translateY(-30px) scale(1.05); }
}

.login-card {
  position: relative; z-index: 2;
  background: rgba(17,17,24,0.85);
  backdrop-filter: blur(24px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-xl);
  padding: 40px 36px;
  width: 100%; max-width: 420px;
  box-shadow: var(--shadow-lg), 0 0 60px rgba(124,58,237,0.1);
}

.login-logo {
  display: flex; align-items: center; gap: 12px; margin-bottom: 24px;
}
.logo-icon { width: 44px; height: 44px; flex-shrink: 0; }
.logo-icon svg { width: 100%; height: 100%; display: block; }
.login-title { font-size: 22px; font-weight: 700; letter-spacing: -0.3px; }
.login-subtitle { font-size: 12px; color: var(--text-muted); margin-top: 1px; }

.login-domain-badge {
  display: inline-block;
  background: linear-gradient(90deg, rgba(124,58,237,0.15), rgba(59,130,246,0.15));
  border: 1px solid rgba(124,58,237,0.3);
  border-radius: 99px; padding: 4px 14px;
  font-family: var(--font-mono); font-size: 11.5px; color: var(--accent-light);
  margin-bottom: 24px;
}

.login-form { display: flex; flex-direction: column; gap: 16px; }
.login-btn { width: 100%; justify-content: center; padding: 11px; font-size: 14px; }
.login-error { color: var(--red); font-size: 12.5px; text-align: center; }
.login-footer { margin-top: 20px; text-align: center; font-size: 11.5px; color: var(--text-muted); }

/* ─── Inputs ───────────────────────────────────────────────────────────────── */
.input-group { display: flex; flex-direction: column; gap: 6px; }
.input-label { font-size: 12.5px; font-weight: 500; color: var(--text-secondary); }
.label-opt { color: var(--text-muted); font-weight: 400; }

.input-wrap { position: relative; display: flex; align-items: center; }
.input-icon { position: absolute; left: 11px; color: var(--text-muted); flex-shrink: 0; }
.input-eye  { position: absolute; right: 8px; background: none; border: none; cursor: pointer; color: var(--text-muted); padding: 4px; display: flex; align-items: center; }
.input-eye:hover { color: var(--text-secondary); }

.input-field {
  width: 100%; background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary); font-family: var(--font-sans); font-size: 13.5px;
  padding: 9px 12px; outline: none; transition: var(--transition);
}
.input-wrap .input-field { padding-left: 36px; }
.input-field::placeholder { color: var(--text-muted); }
.input-field:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124,58,237,0.15); background: rgba(255,255,255,0.05); }

.select-field { appearance: none; cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b8ba7' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 32px; }

.alias-input-wrap { display: flex; align-items: center; gap: 0; }
.alias-input-wrap .input-field { border-radius: var(--radius-md) 0 0 var(--radius-md); border-right: none; }
.alias-suffix { background: var(--bg-elevated); border: 1px solid var(--border); border-left: none; border-radius: 0 var(--radius-md) var(--radius-md) 0; padding: 9px 12px; font-family: var(--font-mono); font-size: 11.5px; color: var(--text-muted); white-space: nowrap; }

.input-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.btn-loader {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.3); border-top-color: white;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─────────────────────────────────────────────────────────────────────────────
   APP LAYOUT
   ───────────────────────────────────────────────────────────────────────────── */
.app { display: flex; height: 100vh; overflow: hidden; }

/* ─── SIDEBAR ──────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w); height: 100vh;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  flex-shrink: 0; overflow-y: auto; overflow-x: hidden;
  transition: transform var(--transition);
  position: relative; z-index: 100;
}

.sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo { display: flex; align-items: center; gap: 9px; }
.logo-icon-sm { width: 28px; height: 28px; flex-shrink: 0; }
.sidebar-logo-text { font-size: 15px; font-weight: 700; letter-spacing: -0.2px; }
.sidebar-close-btn { display: none; background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 4px; border-radius: 6px; }
.sidebar-close-btn:hover { background: var(--bg-hover); color: var(--text-primary); }

.sidebar-domain { padding: 10px 16px; }
.domain-pill {
  display: inline-block; background: rgba(124,58,237,0.12);
  border: 1px solid rgba(124,58,237,0.25); border-radius: 99px;
  padding: 3px 10px; font-family: var(--font-mono); font-size: 10.5px;
  color: var(--accent-light);
}

.sidebar-stats {
  display: flex; align-items: center;
  margin: 0 16px 16px; padding: 12px 0;
  background: var(--bg-elevated); border-radius: var(--radius-md);
  border: 1px solid var(--border);
}
.stat-item { flex: 1; text-align: center; }
.stat-num { display: block; font-size: 17px; font-weight: 700; color: var(--text-primary); line-height: 1; }
.stat-lbl { display: block; font-size: 10px; color: var(--text-muted); margin-top: 3px; }
.stat-divider { width: 1px; height: 28px; background: var(--border); }

.sidebar-nav { flex: 1; padding: 0 10px; display: flex; flex-direction: column; gap: 2px; }
.nav-section-label { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); padding: 10px 8px 4px; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  background: none; border: none; color: var(--text-secondary);
  font-size: 13.5px; font-weight: 500; cursor: pointer;
  transition: var(--transition); width: 100%; text-align: left;
  position: relative;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active { background: var(--bg-active); color: var(--text-primary); }
.nav-item.active::before {
  content: ''; position: absolute; left: -10px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px; background: linear-gradient(to bottom, var(--accent), var(--blue));
  border-radius: 0 3px 3px 0;
}

.nav-badge {
  margin-left: auto; background: var(--accent); color: white;
  font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 99px; min-width: 18px; text-align: center;
}

.sidebar-footer { padding: 12px 10px; border-top: 1px solid var(--border); }
.logout-item { color: var(--text-muted); }
.logout-item:hover { background: rgba(239,68,68,0.1) !important; color: var(--red) !important; }

.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 99; backdrop-filter: blur(2px); }

/* ─── MAIN ─────────────────────────────────────────────────────────────────── */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }

/* ─── TOPBAR ───────────────────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h); display: flex; align-items: center; gap: 12px;
  padding: 0 16px 0 12px;
  background: var(--bg-surface); border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.menu-btn { display: none; background: none; border: none; color: var(--text-secondary); cursor: pointer; padding: 6px; border-radius: var(--radius-sm); }
.menu-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.topbar-title { font-size: 16px; font-weight: 600; white-space: nowrap; }

.topbar-center { flex: 1; max-width: 400px; }
.search-wrap {
  position: relative; display: flex; align-items: center;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-md); overflow: hidden;
  transition: var(--transition);
}
.search-wrap:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124,58,237,0.12); }
.search-icon { position: absolute; left: 10px; color: var(--text-muted); flex-shrink: 0; }
.search-field { background: none; border: none; outline: none; color: var(--text-primary); font-family: var(--font-sans); font-size: 13px; padding: 8px 8px 8px 34px; width: 100%; }
.search-field::placeholder { color: var(--text-muted); }
.search-kbd { margin-right: 10px; background: var(--bg-hover); border: 1px solid var(--border); border-radius: 4px; padding: 2px 5px; font-size: 10px; color: var(--text-muted); font-family: var(--font-mono); white-space: nowrap; }

.topbar-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.live-indicator { display: flex; align-items: center; gap: 5px; padding: 4px 10px; background: rgba(34,197,94,0.08); border: 1px solid rgba(34,197,94,0.2); border-radius: 99px; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); animation: pulse-green 2s ease-in-out infinite; flex-shrink: 0; }
.live-text { font-size: 11px; font-weight: 600; color: var(--green); }
@keyframes pulse-green { 0%,100% { box-shadow: 0 0 0 0 rgba(34,197,94,0.4); } 50% { box-shadow: 0 0 0 4px rgba(34,197,94,0); } }

/* ─── PAGES ────────────────────────────────────────────────────────────────── */
.page { flex: 1; overflow: hidden; display: flex; flex-direction: column; }
.page.hidden { display: none; }
.page.active { display: flex; }

.page-content { flex: 1; overflow-y: auto; padding: 24px; }
.page-header-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-section-title { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.page-section-desc { font-size: 13px; color: var(--text-secondary); }

/* ─── EMAIL LAYOUT ─────────────────────────────────────────────────────────── */
.email-layout { display: flex; flex: 1; overflow: hidden; }

/* LIST PANEL */
.email-list-panel { width: 340px; flex-shrink: 0; display: flex; flex-direction: column; border-right: 1px solid var(--border); overflow: hidden; }
.panel-toolbar { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.filter-tabs { display: flex; gap: 2px; background: var(--bg-elevated); border-radius: var(--radius-sm); padding: 2px; }
.filter-tab { background: none; border: none; padding: 5px 12px; border-radius: calc(var(--radius-sm) - 2px); font-size: 12.5px; font-weight: 500; color: var(--text-secondary); cursor: pointer; transition: var(--transition); }
.filter-tab.active { background: var(--bg-hover); color: var(--text-primary); }
.panel-actions { display: flex; gap: 4px; }

.email-list { flex: 1; overflow-y: auto; }

.email-item {
  display: flex; flex-direction: column; gap: 4px;
  padding: 12px 14px; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background var(--transition);
  position: relative;
}
.email-item:hover { background: var(--bg-hover); }
.email-item.active { background: var(--bg-active); }
.email-item.unread .email-item-subject { font-weight: 600; color: var(--text-primary); }
.email-item.unread::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: linear-gradient(to bottom, var(--accent), var(--blue)); border-radius: 0 2px 2px 0; }

.email-item-row1 { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.email-item-from { font-size: 13px; font-weight: 500; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.email-item-date { font-size: 11px; color: var(--text-muted); white-space: nowrap; flex-shrink: 0; }
.email-item-subject { font-size: 12.5px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.email-item-preview { font-size: 11.5px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.email-item-alias { display: inline-block; background: rgba(124,58,237,0.1); border: 1px solid rgba(124,58,237,0.2); border-radius: 99px; padding: 1px 7px; font-family: var(--font-mono); font-size: 9.5px; color: var(--accent-light); margin-top: 2px; }

/* DETAIL PANEL */
.email-detail-panel { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }

.detail-empty { flex: 1; display: flex; align-items: center; justify-content: center; }
.detail-empty-inner { text-align: center; color: var(--text-muted); }
.detail-empty-inner svg { margin: 0 auto 16px; display: block; }
.detail-empty-inner p { font-size: 14px; }

.email-detail { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.detail-header { padding: 16px 20px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.detail-header-top { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.back-btn { display: none; }
.detail-subject { flex: 1; font-size: 16px; font-weight: 700; line-height: 1.3; min-width: 0; }
.detail-actions { display: flex; gap: 4px; flex-shrink: 0; }

.detail-meta { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.detail-from { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--blue)); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; flex-shrink: 0; }
.from-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.from-name { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.from-addr { font-size: 12px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-mono); }
.detail-info-right { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; flex-shrink: 0; }
.detail-to { font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); }
.detail-date { font-size: 11px; color: var(--text-muted); }

.detail-body-wrap { flex: 1; overflow-y: auto; padding: 20px; }
.detail-body { font-size: 13.5px; line-height: 1.7; color: var(--text-primary); }
.detail-body iframe { width: 100%; border: none; border-radius: var(--radius-md); background: white; min-height: 300px; }
.detail-body pre { background: var(--bg-elevated); padding: 16px; border-radius: var(--radius-md); overflow-x: auto; font-family: var(--font-mono); font-size: 12px; line-height: 1.6; white-space: pre-wrap; word-break: break-all; }

.detail-attachments { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.attachment-title { font-size: 12px; font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.06em; }
.attachment-list { display: flex; flex-wrap: wrap; gap: 8px; }
.attachment-item { display: flex; align-items: center; gap: 8px; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 8px 12px; cursor: pointer; transition: var(--transition); font-size: 12.5px; }
.attachment-item:hover { border-color: var(--accent); background: var(--bg-hover); }
.attachment-item svg { color: var(--accent); flex-shrink: 0; }
.attachment-size { color: var(--text-muted); font-size: 11px; }

/* ─── EMPTY STATES ─────────────────────────────────────────────────────────── */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 60px 24px; text-align: center; }
.empty-icon { margin-bottom: 16px; }
.empty-title { font-size: 15px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.empty-desc { font-size: 13px; color: var(--text-muted); }

/* ─── ALIASES PAGE ─────────────────────────────────────────────────────────── */
.alias-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }

.alias-card {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px;
  transition: var(--transition);
}
.alias-card:hover { border-color: var(--border-hover); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.alias-card.inactive { opacity: 0.5; }

.alias-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.alias-address-wrap { min-width: 0; }
.alias-address { font-family: var(--font-mono); font-size: 12.5px; color: var(--accent-light); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.alias-address:hover { color: var(--text-primary); }
.alias-label { font-size: 11.5px; color: var(--text-muted); margin-top: 3px; }
.alias-badges { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 8px; }
.badge { display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px; border-radius: 99px; font-size: 10.5px; font-weight: 600; }
.badge-active { background: rgba(34,197,94,0.12); color: var(--green); border: 1px solid rgba(34,197,94,0.2); }
.badge-inactive { background: rgba(100,100,120,0.12); color: var(--text-muted); border: 1px solid var(--border); }
.badge-onetime { background: rgba(245,158,11,0.12); color: var(--orange); border: 1px solid rgba(245,158,11,0.2); }
.badge-forward { background: rgba(59,130,246,0.12); color: var(--blue); border: 1px solid rgba(59,130,246,0.2); }
.badge-expired { background: rgba(239,68,68,0.12); color: var(--red); border: 1px solid rgba(239,68,68,0.2); }

.alias-stats { display: flex; gap: 16px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.alias-stat { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-muted); }
.alias-stat svg { opacity: 0.6; }

.alias-actions { display: flex; gap: 4px; margin-top: 12px; }
.alias-copy-btn { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 7px; background: rgba(124,58,237,0.08); border: 1px solid rgba(124,58,237,0.2); border-radius: var(--radius-sm); color: var(--accent-light); font-size: 12px; cursor: pointer; transition: var(--transition); }
.alias-copy-btn:hover { background: rgba(124,58,237,0.15); }
.alias-delete-btn { display: flex; align-items: center; justify-content: center; padding: 7px 10px; background: none; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-muted); font-size: 12px; cursor: pointer; transition: var(--transition); }
.alias-delete-btn:hover { background: rgba(239,68,68,0.1); border-color: rgba(239,68,68,0.3); color: var(--red); }

/* ─── API KEYS PAGE ─────────────────────────────────────────────────────────── */
.api-docs-card {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 18px; margin-bottom: 20px;
}
.api-docs-title { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; margin-bottom: 14px; }
.api-endpoints { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.api-ep { display: flex; align-items: center; gap: 10px; font-size: 12.5px; }
.method { font-family: var(--font-mono); font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 4px; flex-shrink: 0; }
.method.get { background: rgba(34,197,94,0.12); color: var(--green); }
.method.post { background: rgba(59,130,246,0.12); color: var(--blue); }
.ep-desc { color: var(--text-muted); font-size: 12px; }
.api-auth-note { display: flex; align-items: center; gap: 6px; padding: 8px 12px; background: rgba(124,58,237,0.07); border: 1px solid rgba(124,58,237,0.2); border-radius: var(--radius-sm); font-size: 12px; color: var(--text-secondary); }

.key-grid { display: flex; flex-direction: column; gap: 10px; }
.key-card { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 14px 16px; display: flex; align-items: center; gap: 12px; }
.key-info { flex: 1; min-width: 0; }
.key-label { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.key-value { font-family: var(--font-mono); font-size: 11.5px; color: var(--accent-light); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.key-value:hover { color: var(--text-primary); }
.key-meta { font-size: 11px; color: var(--text-muted); margin-top: 3px; }
.key-actions { display: flex; gap: 4px; flex-shrink: 0; }

/* ─── SETTINGS PAGE ─────────────────────────────────────────────────────────── */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.settings-card { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px; }
.settings-card-header { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; margin-bottom: 14px; }
.settings-desc { font-size: 12.5px; color: var(--text-secondary); line-height: 1.6; margin-bottom: 12px; }
.settings-rows { display: flex; flex-direction: column; gap: 10px; }
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.settings-row:last-child { border-bottom: none; padding-bottom: 0; }
.settings-key { font-size: 12.5px; color: var(--text-secondary); }
.settings-val { font-size: 12.5px; color: var(--text-primary); text-align: right; }
.settings-note { display: flex; align-items: flex-start; gap: 6px; background: rgba(124,58,237,0.06); border: 1px solid rgba(124,58,237,0.15); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 12px; color: var(--text-secondary); line-height: 1.5; }
.tag-green { color: var(--green); font-weight: 600; }

/* ─── MODALS ───────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-card {
  background: var(--bg-elevated); border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-xl); padding: 28px;
  width: 100%; max-width: 480px;
  box-shadow: var(--shadow-lg), 0 0 40px rgba(124,58,237,0.1);
  animation: modalIn 0.2s cubic-bezier(0.34,1.56,0.64,1);
}
.modal-sm { max-width: 380px; }
@keyframes modalIn { from { opacity:0; transform: scale(0.95) translateY(10px); } to { opacity:1; transform: scale(1) translateY(0); } }

.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-title { font-size: 16px; font-weight: 700; }
.modal-close { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 4px; border-radius: 6px; display: flex; transition: var(--transition); }
.modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }

.modal-form { display: flex; flex-direction: column; gap: 14px; }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 4px; }

/* ─── TOAST ────────────────────────────────────────────────────────────────── */
.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; }
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: var(--radius-md);
  font-size: 13px; font-weight: 500; min-width: 240px; max-width: 360px;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes toastIn { from { opacity:0; transform: translateX(24px); } to { opacity:1; transform: translateX(0); } }
.toast-success { background: rgba(22,197,94,0.12); border: 1px solid rgba(34,197,94,0.3); color: var(--green); }
.toast-error   { background: rgba(239,68,68,0.12); border: 1px solid rgba(239,68,68,0.3); color: var(--red); }
.toast-info    { background: rgba(124,58,237,0.12); border: 1px solid rgba(124,58,237,0.3); color: var(--accent-light); }
.toast-dismiss { margin-left: auto; background: none; border: none; cursor: pointer; opacity: 0.5; color: inherit; font-size: 16px; line-height: 1; padding: 0; }
.toast-dismiss:hover { opacity: 1; }

/* ─── RESPONSIVE ───────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 200; transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .sidebar-overlay.visible { display: block; }
  .sidebar-close-btn { display: flex; }
  .menu-btn { display: flex; }
  .email-list-panel { width: 100%; border-right: none; }
  .email-detail-panel { display: none; }
  .email-detail-panel.active { display: flex; position: absolute; inset: 0; z-index: 10; background: var(--bg-base); }
  .back-btn { display: flex !important; }
  .topbar-center { display: none; }
}
@media (max-width: 600px) {
  .alias-grid { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .modal-card { padding: 20px; }
  .input-row { grid-template-columns: 1fr; }
  .topbar-right .live-text { display: none; }
}
