/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body { font-family: 'Roboto', sans-serif; color: #202124; background: #fff; overflow: hidden; }
a { text-decoration: none; color: inherit; }
h1, h2, h3 { font-family: 'Google Sans', 'Roboto', sans-serif; }
button { font-family: inherit; }
input, textarea, select { font-family: inherit; }

/* ===== TOPBAR ===== */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: 64px; z-index: 100;
  background: #fff; border-bottom: 1px solid #e0e0e0;
  display: flex; align-items: center; padding: 0 8px;
}
.hamburger { display: none; background: none; border: none; padding: 8px; cursor: pointer; color: #5f6368; border-radius: 50%; }
.hamburger:hover { background: #e8eaed; }
.topbar-logo { font-family: 'Google Sans', sans-serif; font-size: 22px; color: #202124; padding: 0 16px; white-space: nowrap; }
.topbar-search { flex: 1; max-width: 720px; margin: 0 auto; position: relative; }
.topbar-search form { display: flex; align-items: center; position: relative; }
.topbar-search .search-icon { position: absolute; left: 16px; color: #5f6368; font-size: 20px; pointer-events: none; }
.topbar-search input {
  width: 100%; height: 46px; background: #eaf1fb; border: none; border-radius: 28px;
  padding: 0 16px 0 48px; font-size: 16px; outline: none;
}
.topbar-search input:focus { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.topbar-right { display: flex; align-items: center; gap: 8px; padding-right: 8px; }
.topbar-avatar {
  width: 32px; height: 32px; border-radius: 50%; background: #1a73e8; color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 500;
}
.topbar-avatar-img { width: 32px; height: 32px; border-radius: 50%; }
.topbar-logout { color: #5f6368; padding: 8px; border-radius: 50%; display: flex; }
.topbar-logout:hover { background: #e8eaed; }

/* ===== SIDEBAR ===== */
.sidebar {
  position: fixed; top: 64px; left: 0; width: 256px; height: calc(100vh - 64px);
  background: #f6f8fc; overflow-y: auto; padding: 8px 12px; z-index: 90;
}
.compose-btn {
  display: flex; align-items: center; gap: 12px; background: #c2e7ff; color: #001d35;
  border: none; border-radius: 16px; height: 56px; padding: 0 24px;
  font-family: 'Google Sans', sans-serif; font-size: 14px; font-weight: 500;
  cursor: pointer; margin-bottom: 16px; white-space: nowrap;
}
.compose-btn:hover { box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.sidebar-item {
  display: flex; align-items: center; height: 32px; padding: 0 12px 0 24px;
  border-radius: 0 16px 16px 0; cursor: pointer; font-size: 14px; color: #202124; gap: 16px;
}
.sidebar-item:hover { background: #e8eaed; }
.sidebar-item.active { background: #d3e3fd; font-weight: 500; }
.sidebar-item .material-icons-outlined { font-size: 20px; width: 24px; text-align: center; }
.sidebar-item .badge { margin-left: auto; font-size: 12px; font-weight: 500; }
.sidebar-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-divider { height: 1px; background: #e0e0e0; margin: 8px 0; }
.sidebar-section-title { font-size: 12px; color: #5f6368; padding: 8px 24px; text-transform: uppercase; letter-spacing: .5px; }
.sidebar-label .dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.inbox-item { height: 28px; font-size: 13px; }

/* ===== MAIN CONTENT ===== */
.app-container { display: flex; margin-top: 64px; }
.main-content { flex: 1; margin-left: 256px; min-height: calc(100vh - 64px); overflow-y: auto; height: calc(100vh - 64px); }

/* ===== TOOLBAR ===== */
.toolbar {
  position: sticky; top: 0; z-index: 50; background: #fff;
  height: 48px; display: flex; align-items: center; padding: 0 8px;
  border-bottom: 1px solid #e0e0e0;
}
.toolbar-checkbox { padding: 4px 16px; }
.toolbar-checkbox input { cursor: pointer; }
.toolbar-actions { display: flex; gap: 2px; }
.toolbar-btn {
  background: none; border: none; padding: 8px; border-radius: 50%; cursor: pointer;
  color: #5f6368; display: flex; align-items: center; justify-content: center;
}
.toolbar-btn:hover { background: #e8eaed; }
.toolbar-pagination { margin-left: auto; font-size: 12px; color: #5f6368; display: flex; align-items: center; gap: 4px; }
.toolbar-pagination button {
  background: none; border: none; padding: 4px 8px; cursor: pointer; color: #5f6368; border-radius: 50%;
}
.toolbar-pagination button:hover { background: #e8eaed; }
.toolbar-pagination button:disabled { opacity: .3; cursor: default; }

/* ===== EMAIL LIST ===== */
.email-list { list-style: none; }
.email-row {
  display: flex; align-items: center; height: 40px; padding: 0 8px;
  border-bottom: 1px solid #f1f3f4; cursor: pointer; color: inherit;
}
.email-row:hover { background: #f5f5f5; box-shadow: inset 3px 0 0 #1a73e8; }
.email-row.unread { background: #f2f6fc; }
.email-row.unread .sender { font-weight: 700; }
.email-row.unread .subject { font-weight: 700; }
.email-row .checkbox { padding: 0 8px; flex-shrink: 0; display: flex; align-items: center; }
.email-row .checkbox input { cursor: pointer; }
.email-row .star { padding: 0 4px; flex-shrink: 0; color: #dadce0; cursor: pointer; display: flex; }
.email-row .star:hover { color: #5f6368; }
.email-row .star.active { color: #f4b400; }
.email-row .star .material-icons-outlined { font-size: 20px; }
.email-row .sender { width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; padding: 0 8px; }
.email-row .subject-preview { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; min-width: 0; }
.email-row .subject-preview .subject { color: #202124; }
.email-row .subject-preview .preview { color: #5f6368; font-weight: 300; }
.email-row .date { flex-shrink: 0; font-size: 12px; color: #5f6368; padding: 0 16px; white-space: nowrap; }

/* ===== MAIL VIEW ===== */
.mail-view { padding: 24px; max-width: 900px; }
.mail-back { display: inline-flex; align-items: center; gap: 4px; color: #5f6368; padding: 8px 0; cursor: pointer; font-size: 14px; }
.mail-back:hover { color: #202124; }
.mail-subject { font-size: 22px; font-family: 'Google Sans', sans-serif; font-weight: 400; color: #202124; margin: 8px 0 16px; }
.mail-meta { display: flex; align-items: center; gap: 12px; padding: 16px 0; border-bottom: 1px solid #e0e0e0; }
.sender-avatar {
  width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center;
  justify-content: center; font-size: 18px; color: #fff; flex-shrink: 0;
}
.sender-info { flex: 1; min-width: 0; }
.sender-info .sender-name { font-weight: 500; font-size: 14px; }
.sender-info .sender-email { font-size: 12px; color: #5f6368; }
.mail-date { font-size: 12px; color: #5f6368; white-space: nowrap; }
.mail-body { padding: 16px 0; }
.mail-body iframe { width: 100%; border: none; min-height: 200px; }
.mail-body pre { white-space: pre-wrap; word-wrap: break-word; font-family: 'Roboto', sans-serif; font-size: 14px; line-height: 1.6; }
.mail-actions { display: flex; gap: 8px; padding: 16px 0; border-top: 1px solid #e0e0e0; flex-wrap: wrap; }
.action-btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px;
  border: 1px solid #e0e0e0; border-radius: 18px; font-size: 14px; cursor: pointer;
  background: #fff; color: #202124;
}
.action-btn:hover { background: #f6f8fc; }
.action-btn .material-icons-outlined { font-size: 18px; }

/* ===== ATTACHMENTS ===== */
.attachments { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 0; }
.attachment-item {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px;
  border: 1px solid #e0e0e0; border-radius: 8px; font-size: 13px; color: #202124;
}
.attachment-item:hover { background: #f6f8fc; }
.attachment-size { color: #5f6368; font-size: 11px; }

/* ===== COMPOSE MODAL ===== */
.compose-modal {
  position: fixed; bottom: 0; right: 24px; width: 500px; background: #fff;
  border-radius: 8px 8px 0 0; box-shadow: 0 8px 24px rgba(0,0,0,.2);
  display: none; flex-direction: column; z-index: 200; max-height: 80vh;
}
.compose-modal.open { display: flex; }
.compose-header {
  height: 40px; background: #404040; color: #fff; display: flex; align-items: center;
  padding: 0 12px; border-radius: 8px 8px 0 0; font-size: 14px; flex-shrink: 0;
}
.compose-header .close-btn { margin-left: auto; background: none; border: none; color: #fff; cursor: pointer; font-size: 18px; padding: 4px; }
.compose-fields { padding: 4px 12px; flex-shrink: 0; }
.compose-field { display: flex; align-items: center; padding: 4px 0; font-size: 14px; border-bottom: 1px solid #f1f3f4; }
.compose-field label { width: 60px; color: #5f6368; flex-shrink: 0; font-size: 13px; }
.compose-field input, .compose-field select { flex: 1; border: none; outline: none; font-size: 14px; padding: 4px; }
.compose-subject { padding: 8px 12px; border-bottom: 1px solid #e0e0e0; flex-shrink: 0; }
.compose-subject input { width: 100%; border: none; outline: none; font-size: 14px; }
.compose-body { flex: 1; min-height: 200px; overflow: hidden; }
.compose-body textarea { width: 100%; height: 100%; border: none; outline: none; resize: none; padding: 12px; font-size: 14px; }
.compose-footer { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-top: 1px solid #e0e0e0; flex-shrink: 0; }
.compose-send-btn { background: #1a73e8; color: #fff; border: none; border-radius: 18px; padding: 8px 24px; font-size: 14px; font-weight: 500; cursor: pointer; }
.compose-send-btn:hover { background: #1557b0; }
.compose-draft-btn { background: none; border: 1px solid #e0e0e0; border-radius: 18px; padding: 8px 16px; font-size: 13px; cursor: pointer; color: #5f6368; }

/* ===== CONTACTS ===== */
.contacts-page { padding: 24px; max-width: 900px; }
.contacts-page h1 { font-family: 'Google Sans', sans-serif; font-size: 22px; margin-bottom: 16px; }
.contacts-search { margin-bottom: 16px; }
.contacts-search input { width: 100%; max-width: 400px; padding: 8px 12px; border: 1px solid #e0e0e0; border-radius: 4px; font-size: 14px; }
.contacts-table { width: 100%; border-collapse: collapse; }
.contacts-table th { text-align: left; padding: 8px 12px; border-bottom: 2px solid #e0e0e0; font-size: 12px; color: #5f6368; text-transform: uppercase; }
.contacts-table td { padding: 8px 12px; border-bottom: 1px solid #f1f3f4; font-size: 14px; }
.contacts-table tr:hover { background: #f6f8fc; }
.contacts-table .actions { display: flex; gap: 4px; }

/* ===== SETTINGS ===== */
.settings-page { padding: 24px; max-width: 800px; }
.settings-page h1 { font-family: 'Google Sans', sans-serif; font-size: 22px; margin-bottom: 24px; }
.settings-section { margin-bottom: 32px; }
.settings-section h2 { font-family: 'Google Sans', sans-serif; font-size: 18px; margin-bottom: 12px; color: #202124; }
.settings-form textarea { width: 100%; min-height: 100px; border: 1px solid #e0e0e0; border-radius: 4px; padding: 8px; font-size: 14px; }
.settings-form .save-btn { margin-top: 8px; background: #1a73e8; color: #fff; border: none; border-radius: 4px; padding: 8px 24px; font-size: 14px; cursor: pointer; }
.settings-form .save-btn:hover { background: #1557b0; }

/* ===== LOGIN ===== */
.login-page { display: flex; justify-content: center; align-items: center; min-height: 100vh; background: #f6f8fc; }
.login-card { background: #fff; border-radius: 8px; padding: 48px; box-shadow: 0 1px 3px rgba(0,0,0,.1); max-width: 400px; width: 100%; text-align: center; }
.login-card h1 { font-family: 'Google Sans', sans-serif; font-size: 24px; margin-bottom: 8px; }
.login-card p { color: #5f6368; font-size: 14px; margin-bottom: 24px; }
.login-card input { width: 100%; padding: 12px; border: 1px solid #e0e0e0; border-radius: 4px; font-size: 14px; margin: 8px 0; }
.login-card input:focus { border-color: #1a73e8; outline: none; }
.login-btn { width: 100%; padding: 12px; background: #1a73e8; color: #fff; border: none; border-radius: 4px; font-size: 14px; cursor: pointer; margin-top: 8px; font-weight: 500; }
.login-btn:hover { background: #1557b0; }
.login-btn.discord { background: #5865f2; }
.login-btn.discord:hover { background: #4752c4; }
.login-btn.passkey { background: #202124; }
.login-btn.passkey:hover { background: #3c4043; }
.login-divider { display: flex; align-items: center; gap: 16px; margin: 16px 0; color: #5f6368; font-size: 12px; }
.login-divider::before, .login-divider::after { content: ''; flex: 1; height: 1px; background: #e0e0e0; }
.login-error { color: #d93025; font-size: 13px; margin: 8px 0; }

/* ===== EMPTY STATE ===== */
.empty-state { text-align: center; padding: 60px 24px; color: #5f6368; }
.empty-state .material-icons-outlined { font-size: 64px; margin-bottom: 16px; color: #dadce0; }
.empty-state p { font-size: 16px; }

/* ===== UTILITIES ===== */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border: 1px solid #e0e0e0; border-radius: 4px; font-size: 14px; cursor: pointer; background: #fff; }
.btn:hover { background: #f6f8fc; }
.btn-primary { background: #1a73e8; color: #fff; border-color: #1a73e8; }
.btn-primary:hover { background: #1557b0; }
.btn-danger { color: #d93025; }
.btn-danger:hover { background: #fce8e6; }
.hidden { display: none !important; }
.reply-zone { padding: 16px 0; margin-top: 16px; border-top: 1px solid #e0e0e0; }
.reply-zone textarea { width: 100%; min-height: 100px; border: 1px solid #e0e0e0; border-radius: 4px; padding: 8px; font-size: 14px; margin-bottom: 8px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .sidebar { width: 56px; padding: 8px 4px; }
  .sidebar-text, .sidebar-section-title, .compose-btn span:not(.material-icons-outlined) { display: none; }
  .compose-btn { padding: 0; width: 48px; height: 48px; justify-content: center; border-radius: 50%; }
  .sidebar-item { padding: 0; justify-content: center; gap: 0; height: 40px; border-radius: 50%; }
  .sidebar-item .badge { display: none; }
  .sidebar-divider { margin: 4px 0; }
  .main-content { margin-left: 56px; }
}
@media (max-width: 768px) {
  .sidebar { display: none; width: 256px; padding: 8px 12px; position: fixed; z-index: 150; box-shadow: 2px 0 8px rgba(0,0,0,.2); }
  .sidebar.open { display: block; }
  .sidebar-text, .sidebar-section-title, .compose-btn span:not(.material-icons-outlined) { display: inline; }
  .compose-btn { width: auto; height: 56px; border-radius: 16px; padding: 0 24px; }
  .sidebar-item { padding: 0 12px 0 24px; justify-content: flex-start; gap: 16px; height: 32px; border-radius: 0 16px 16px 0; }
  .sidebar-item .badge { display: inline; }
  .hamburger { display: flex; }
  .main-content { margin-left: 0; }
  .email-row .sender { width: 120px; }
  .compose-modal { width: 100%; right: 0; left: 0; border-radius: 8px 8px 0 0; }
}
.sidebar-overlay { display: none; position: fixed; top: 64px; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,.3); z-index: 140; }
.sidebar-overlay.open { display: block; }

/* ===== ANIMATIONS ===== */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.fade-in { animation: fadeIn .3s ease; }

/* ===== BILAL MAIL REDESIGN ===== */
:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --ink: #111827;
  --muted: #64748b;
  --subtle: #94a3b8;
  --border: #dbe3ee;
  --border-soft: #edf2f7;
  --accent: #0f7cff;
  --accent-2: #07a6b8;
  --success: #16a34a;
  --danger: #dc2626;
  --shadow: 0 18px 45px rgba(15, 23, 42, .08);
}

html { font-size: 14px; }
body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
}
h1, h2, h3, .topbar-logo, .compose-btn, .mail-subject { font-family: inherit; }

.topbar {
  height: 68px;
  background: rgba(255, 255, 255, .92);
  border-bottom: 1px solid var(--border);
  padding: 0 18px;
  backdrop-filter: blur(18px);
}
.topbar-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 220px;
  color: var(--ink);
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0;
  padding: 0;
}
.logo-mark {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: linear-gradient(135deg, #0f7cff, #07a6b8);
  color: #fff;
  font-size: 12px;
  letter-spacing: .04em;
}
.topbar-search { max-width: 760px; margin: 0 24px; }
.topbar-search input {
  height: 44px;
  background: #f1f5f9;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
}
.topbar-search input:focus {
  background: #fff;
  border-color: #b7d4ff;
  box-shadow: 0 0 0 4px rgba(15, 124, 255, .10);
}
.domain-chip {
  display: inline-flex;
  align-items: center;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 10px;
  color: #334155;
  background: #fff;
  font-size: 12px;
  font-weight: 700;
}
.topbar-icon,
.topbar-logout {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  border-radius: 8px;
}
.topbar-icon:hover,
.topbar-logout:hover { background: #eef4fb; color: var(--ink); }
.topbar-avatar,
.topbar-avatar-img { width: 34px; height: 34px; border-radius: 8px; font-weight: 800; }

.app-container { margin-top: 68px; }
.domain-rail {
  position: fixed;
  top: 68px;
  left: 0;
  bottom: 0;
  width: 74px;
  z-index: 95;
  background: #0f172a;
  color: #fff;
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}
.domain-brand,
.domain-pill {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  font-weight: 800;
}
.domain-brand {
  background: linear-gradient(135deg, #0f7cff, #07a6b8);
  font-size: 12px;
}
.domain-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  align-items: center;
}
.domain-pill {
  color: #cbd5e1;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .08);
  font-size: 11px;
}
.domain-pill:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.domain-pill.active {
  color: #fff;
  background: #1e293b;
  box-shadow: inset 3px 0 0 var(--accent-2);
}
.domain-pill b {
  position: absolute;
  right: -4px;
  top: -4px;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--success);
  color: #fff;
  font-size: 10px;
  line-height: 18px;
  text-align: center;
  border: 2px solid #0f172a;
}

.sidebar {
  top: 68px;
  width: 282px;
  height: calc(100vh - 68px);
  padding: 16px 14px;
  background: #eef3f9;
  border-right: 1px solid var(--border);
}
.sidebar.with-domain-rail { left: 74px; }
.compose-btn {
  width: 100%;
  height: 46px;
  justify-content: center;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  margin-bottom: 12px;
}
.compose-btn:hover { box-shadow: var(--shadow); background: #020617; }
.domain-card {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
}
.domain-card span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.domain-card strong {
  display: block;
  margin-top: 3px;
  color: var(--ink);
  font-size: 14px;
}
.sidebar-item {
  height: 34px;
  border-radius: 8px;
  padding: 0 10px;
  gap: 10px;
  color: #334155;
  font-size: 13px;
  font-weight: 600;
}
.sidebar-item:hover { background: #fff; }
.sidebar-item.active {
  background: #fff;
  color: #0f5ed7;
  font-weight: 800;
  box-shadow: 0 1px 0 rgba(15, 23, 42, .04);
}
.sidebar-item .material-icons-outlined { font-size: 18px; width: 22px; }
.sidebar-item .badge {
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #dcecff;
  color: #0757c2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.sidebar-section-title {
  color: #64748b;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  padding: 12px 10px 6px;
}
.sidebar-divider { background: var(--border); margin: 12px 0; }
.inbox-item { height: 32px; font-size: 12px; }

.main-content {
  margin-left: 282px;
  height: calc(100vh - 68px);
  background: var(--bg);
  padding: 18px;
}
.sidebar.with-domain-rail + .main-content,
.domain-rail ~ .sidebar + .main-content { margin-left: 356px; }

.mail-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.mail-summary > div {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
}
.mail-summary span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.mail-summary strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 20px;
  line-height: 1;
}

.toolbar {
  position: sticky;
  top: 0;
  height: 46px;
  border: 1px solid var(--border);
  border-radius: 8px 8px 0 0;
  background: rgba(255, 255, 255, .94);
  padding: 0 12px;
  backdrop-filter: blur(12px);
}
.toolbar-btn,
.toolbar-pagination button {
  border-radius: 7px;
  color: var(--muted);
}
.toolbar-btn:hover,
.toolbar-pagination button:hover { background: #eef4fb; color: var(--ink); }
.toolbar-pagination { font-size: 12px; font-weight: 700; color: var(--muted); }

.email-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 0;
  border-radius: 0 0 8px 8px;
  overflow: hidden;
}
.email-row {
  min-height: 48px;
  height: 48px;
  padding: 0 12px;
  border-bottom: 1px solid var(--border-soft);
  background: #fff;
  outline: none;
}
.email-row:hover {
  background: #f8fbff;
  box-shadow: inset 3px 0 0 var(--accent);
}
.email-row.unread { background: #f7fbff; }
.email-row .sender {
  width: 220px;
  font-size: 13px;
  font-weight: 700;
  color: #1f2937;
}
.email-row .subject-preview {
  font-size: 13px;
  color: #334155;
}
.email-row .subject-preview .subject { font-weight: 700; color: #111827; }
.email-row .subject-preview .preview { color: #64748b; font-weight: 500; }
.email-row .date {
  width: 78px;
  text-align: right;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
  padding-right: 2px;
}
.email-row .star.active { color: #eab308; }

.mail-view {
  max-width: 1080px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 24px;
}
.mail-back {
  height: 34px;
  color: var(--muted);
  font-weight: 700;
}
.mail-subject {
  font-size: 26px;
  line-height: 1.2;
  font-weight: 800;
  color: var(--ink);
  margin: 10px 0 18px;
}
.mail-meta {
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 8px;
  padding: 14px;
}
.sender-avatar { border-radius: 8px; font-weight: 800; }
.sender-info .sender-name { font-size: 14px; font-weight: 800; }
.sender-info .sender-email { color: var(--muted); font-weight: 600; }
.mail-date { color: var(--muted); font-weight: 700; }
.mail-body iframe {
  min-height: 520px;
  background: #fff;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
}
.action-btn,
.btn,
.compose-draft-btn,
.compose-send-btn {
  border-radius: 8px;
  font-weight: 800;
}
.action-btn:hover,
.btn:hover { background: #f1f7ff; }
.btn-primary,
.compose-send-btn {
  background: var(--accent);
  border-color: var(--accent);
}

.contacts-page,
.settings-page,
.main-content[style] {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  margin: 18px;
}
.compose-field,
.compose-subject {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 8px;
  padding: 7px 12px;
}
.compose-field label { font-weight: 800; color: var(--muted); }
.compose-body textarea {
  border: 1px solid var(--border);
  border-radius: 8px;
  min-height: 360px;
}

.login-page { background: linear-gradient(135deg, #f4f7fb, #eaf2fb); }
.login-card {
  border-radius: 8px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

@media (max-width: 1180px) {
  .mail-summary { grid-template-columns: repeat(2, minmax(120px, 1fr)); }
  .email-row .sender { width: 160px; }
}

@media (max-width: 768px) {
  .topbar { padding: 0 10px; gap: 8px; }
  .topbar-logo { min-width: auto; font-size: 0; }
  .topbar-search { margin: 0; }
  .domain-chip { display: none; }
  .domain-rail { display: none; }
  .sidebar,
  .sidebar.with-domain-rail {
    top: 68px;
    left: 0;
    width: 290px;
    height: calc(100vh - 68px);
    padding: 14px;
  }
  .main-content,
  .sidebar.with-domain-rail + .main-content,
  .domain-rail ~ .sidebar + .main-content {
    margin-left: 0;
    padding: 10px;
  }
  .mail-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mail-summary > div { padding: 10px; }
  .email-row {
    height: auto;
    min-height: 62px;
    align-items: flex-start;
    padding: 10px 8px;
  }
  .email-row .sender { width: 95px; white-space: normal; line-height: 1.25; }
  .email-row .subject-preview { white-space: normal; line-height: 1.35; }
  .email-row .date { width: 48px; }
  .mail-view { padding: 16px; }
  .mail-subject { font-size: 21px; }
}
