/* ============================================
   RayfazMail - Gmail-Inspired Stylesheet
   ============================================ */

:root {
  --bg: #f6f8fc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #eaf1fb;
  --bg-hover: #f2f6fc;
  --bg-active: #d3e3fd;
  --text: #1f1f1f;
  --text-secondary: #5f6368;
  --text-muted: #80868b;
  --accent: #1a73e8;
  --accent-hover: #1557b0;
  --accent-light: #d2e3fc;
  --border: #e0e0e0;
  --border-light: #f0f0f0;
  --success: #188038;
  --warning: #f9ab00;
  --danger: #d93025;
  --danger-hover: #b3261e;
  --shadow-sm: 0 1px 2px 0 rgba(60,64,67,0.3), 0 1px 3px 1px rgba(60,64,67,0.15);
  --shadow: 0 1px 3px 0 rgba(60,64,67,0.3), 0 4px 8px 3px rgba(60,64,67,0.15);
  --shadow-lg: 0 4px 8px 0 rgba(60,64,67,0.3), 0 8px 16px 4px rgba(60,64,67,0.15);
  --radius: 16px;
  --radius-sm: 8px;
  --radius-xs: 4px;
  --font: 'Google Sans', 'Roboto', system-ui, -apple-system, sans-serif;
  --font-body: 'Roboto', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', 'Fira Code', ui-monospace, monospace;
  --sidebar-width: 256px;
  --header-height: 64px;
}

[data-theme="dark"] {
  --bg: #1a1a2e;
  --bg-secondary: #202124;
  --bg-tertiary: #2d2d3f;
  --bg-hover: #303042;
  --bg-active: #394457;
  --text: #e8eaed;
  --text-secondary: #9aa0a6;
  --text-muted: #71767b;
  --accent: #8ab4f8;
  --accent-hover: #aecbfa;
  --accent-light: #2d3b50;
  --border: #3c4043;
  --border-light: #2d2d2d;
  --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.5);
  --shadow: 0 2px 6px 0 rgba(0,0,0,0.5);
  --shadow-lg: 0 4px 12px 0 rgba(0,0,0,0.5);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow: hidden;
}

#app { display: flex; flex-direction: column; height: 100vh; }

/* ===== HEADER ===== */
header {
  display: flex;
  align-items: center;
  height: var(--header-height);
  padding: 0 8px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-light);
  z-index: 100;
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 4px;
  width: var(--sidebar-width);
  flex-shrink: 0;
  padding-left: 4px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
}

.logo-icon { font-size: 1.5rem; }
.logo-text {
  font-family: var(--font);
  font-size: 1.375rem;
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.25px;
}

.header-center {
  flex: 1;
  max-width: 720px;
  padding: 0 16px;
}

.search-bar {
  display: flex;
  align-items: center;
  background: var(--bg-tertiary);
  border-radius: 28px;
  padding: 0 8px 0 16px;
  height: 48px;
  transition: background 0.2s, box-shadow 0.2s;
}

.search-bar:focus-within {
  background: var(--bg-secondary);
  box-shadow: var(--shadow);
}

.search-icon {
  color: var(--text-secondary);
  font-size: 20px;
  margin-right: 12px;
  flex-shrink: 0;
}

.search-bar input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 1rem;
  font-family: var(--font-body);
  outline: none;
  padding: 8px 0;
}

.search-bar input::placeholder { color: var(--text-muted); }
.search-btn { color: var(--accent); }

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

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.15s;
  flex-shrink: 0;
  font-size: 1rem;
}

.icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.icon-btn.danger:hover {
  background: #fce8e6;
  color: var(--danger);
}

[data-theme="dark"] .icon-btn.danger:hover {
  background: #3c2020;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  margin-left: 8px;
  flex-shrink: 0;
}

/* ===== DOMAIN CHIP ===== */
.domain-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px 4px 8px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--bg-tertiary);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
  margin-right: 4px;
}

.domain-chip:hover {
  background: var(--bg-hover);
  box-shadow: var(--shadow-sm);
}

.domain-chip-icon {
  font-size: 16px;
  color: var(--accent);
}

.domain-chip-label {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.domain-chip-arrow {
  font-size: 18px;
  color: var(--text-muted);
  margin-left: -2px;
}

/* ===== DOMAIN MODAL ===== */
.domain-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 16px;
  max-height: 240px;
  overflow-y: auto;
}

.domain-list:empty::after {
  content: 'No domains configured';
  display: block;
  padding: 12px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.domain-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  transition: background 0.15s;
}

.domain-row:hover {
  background: var(--bg-hover);
}

.domain-row-icon {
  font-size: 18px;
  color: var(--accent);
  flex-shrink: 0;
}

.domain-row-name {
  flex: 1;
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--text);
}

.domain-row-badge {
  font-size: 0.6875rem;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--accent-light);
  color: var(--accent);
  flex-shrink: 0;
}

.domain-row-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}

.domain-row-delete:hover {
  background: #fce8e6;
  color: var(--danger);
}

[data-theme="dark"] .domain-row-delete:hover {
  background: #3c2020;
}

.domain-add-form {
  border-top: 1px solid var(--border-light);
  padding-top: 16px;
}

.domain-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.domain-input-row input {
  flex: 1;
  padding: 10px 12px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  font-family: var(--mono);
  font-size: 0.8125rem;
  outline: none;
  transition: border-color 0.2s;
}

.domain-input-row input:focus {
  border-color: var(--accent);
}

.btn-sm {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 16px;
  font-size: 0.8125rem;
  flex-shrink: 0;
}

/* ===== APP BODY ===== */
.app-body { display: flex; flex: 1; overflow: hidden; }

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  padding: 8px 12px;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width 0.2s;
}

.sidebar.collapsed {
  width: 72px;
}

.sidebar.collapsed .compose-label,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-count,
.sidebar.collapsed .sidebar-section-title,
.sidebar.collapsed .account-list {
  display: none;
}

.sidebar.collapsed .compose-btn {
  width: 48px;
  height: 48px;
  padding: 0;
  border-radius: 50%;
  justify-content: center;
}

.compose-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 6px 24px 6px 16px;
  height: 56px;
  border: none;
  border-radius: var(--radius);
  background: var(--accent-light);
  color: var(--accent);
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.25px;
  cursor: pointer;
  transition: box-shadow 0.2s, background 0.2s;
  margin-bottom: 12px;
}

.compose-btn:hover {
  box-shadow: var(--shadow-sm);
}

.compose-btn .material-icons-outlined { font-size: 20px; }

.sidebar-nav { display: flex; flex-direction: column; gap: 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px 0 16px;
  height: 40px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  font-family: var(--font);
  color: var(--text-secondary);
  text-decoration: none;
  transition: background 0.15s;
  white-space: nowrap;
}

.nav-item:hover { background: var(--bg-hover); }

.nav-item.active {
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 700;
}

.nav-item .material-icons-outlined { font-size: 20px; flex-shrink: 0; }

.nav-count {
  margin-left: auto;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text);
}

.sidebar-divider {
  height: 1px;
  background: var(--border-light);
  margin: 12px 0;
}

.sidebar-section-title {
  padding: 8px 16px 4px;
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.account-list { display: flex; flex-direction: column; gap: 0; }

.account-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 16px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  transition: background 0.15s;
  overflow: hidden;
}

.account-item:hover { background: var(--bg-hover); }

.account-item.active {
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 500;
}

.account-item .acc-email {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-item .acc-badge {
  background: var(--accent);
  color: white;
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  flex-shrink: 0;
}

/* ===== MAIN CONTENT ===== */
main {
  flex: 1;
  overflow-y: auto;
  margin: 0 8px 8px 0;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
}

.screen { display: none; flex: 1; flex-direction: column; }
.screen.active { display: flex; }

/* ===== WELCOME ===== */
.welcome-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
}

.welcome-illustration { margin-bottom: 24px; }

.welcome-icon-big {
  font-size: 96px;
  color: var(--accent);
  opacity: 0.7;
}

.welcome-content h2 {
  font-family: var(--font);
  font-size: 1.5rem;
  font-weight: 400;
  margin-bottom: 8px;
}

.welcome-content p {
  color: var(--text-secondary);
  max-width: 420px;
  font-size: 0.875rem;
  line-height: 1.5;
  margin-bottom: 32px;
}

.welcome-features {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
}

.feature-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.feature-card .material-icons-outlined {
  font-size: 20px;
  color: var(--accent);
}

/* ===== INBOX TOOLBAR ===== */
.inbox-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px 4px 16px;
  height: 48px;
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.checkbox-wrap {
  display: flex;
  align-items: center;
  cursor: pointer;
}

.checkbox-wrap input { display: none; }

.checkbox-icon {
  font-size: 20px;
  color: var(--text-secondary);
  cursor: pointer;
}

.checkbox-wrap input:checked ~ .checkbox-icon { color: var(--accent); }

.toolbar-actions { display: flex; gap: 0; }

.toolbar-info {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.toolbar-email {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toolbar-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 0;
  flex-shrink: 0;
}

/* ===== EMAIL LIST ===== */
.email-list { flex: 1; overflow-y: auto; }

.email-item {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background 0.1s;
  position: relative;
}

.email-item:hover {
  background: var(--bg-hover);
  box-shadow: inset 3px 0 0 var(--accent);
}

.email-item.selected { background: var(--accent-light); }

.email-check {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  margin-right: 12px;
}

.email-check input { display: none; }
.email-check .checkbox-icon { font-size: 18px; }
.email-check input:checked ~ .checkbox-icon { color: var(--accent); }

.email-star {
  flex-shrink: 0;
  margin-right: 12px;
  cursor: pointer;
}

.email-star .material-icons-outlined {
  font-size: 20px;
  color: var(--text-muted);
  transition: color 0.15s;
}

.email-star:hover .material-icons-outlined,
.email-star.starred .material-icons-outlined {
  color: #f4b400;
}

.email-content {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0;
  min-width: 0;
  padding: 8px 0;
}

.email-from {
  width: 200px;
  flex-shrink: 0;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.email-subject-line {
  flex: 1;
  display: flex;
  align-items: baseline;
  gap: 4px;
  min-width: 0;
  overflow: hidden;
}

.email-subject {
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
  max-width: 50%;
}

.email-separator {
  color: var(--text-muted);
  flex-shrink: 0;
  font-size: 0.75rem;
}

.email-preview {
  font-size: 0.8125rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.email-meta-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: 12px;
}

.email-attachment-icon { color: var(--text-muted); font-size: 18px; }

.email-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  min-width: 60px;
  text-align: right;
}

.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  color: var(--text-muted);
}

.empty-icon { font-size: 64px; opacity: 0.3; margin-bottom: 16px; }

.empty-state p {
  font-size: 1rem;
  font-family: var(--font);
  margin-bottom: 4px;
  color: var(--text-secondary);
}

.empty-sub { font-size: 0.8125rem; }

.auto-refresh-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

/* ===== DETAIL TOOLBAR ===== */
.detail-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px;
  height: 48px;
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}

.detail-toolbar-right { display: flex; gap: 0; }

/* ===== EMAIL DETAIL ===== */
.email-detail {
  flex: 1;
  overflow-y: auto;
  padding: 24px 48px;
}

.email-detail-subject {
  font-family: var(--font);
  font-size: 1.375rem;
  font-weight: 400;
  color: var(--text);
  margin-bottom: 24px;
  line-height: 1.3;
  word-break: break-word;
}

.email-detail-card { margin-bottom: 16px; }

.email-detail-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 0;
}

.sender-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 500;
  font-family: var(--font);
  flex-shrink: 0;
}

.sender-info { flex: 1; min-width: 0; }

.sender-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
}

.sender-email-line {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.sender-to {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.email-detail-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.email-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 0 12px 52px;
  border-top: 1px solid var(--border-light);
}

.attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  color: var(--text-secondary);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.attachment-chip:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
  color: var(--accent);
}

.attachment-chip .material-icons-outlined { font-size: 18px; }
.att-size { color: var(--text-muted); font-size: 0.75rem; }

.email-body {
  padding: 16px 0 16px 52px;
  line-height: 1.6;
  word-break: break-word;
  overflow-x: auto;
  font-size: 0.875rem;
}

.email-body iframe {
  width: 100%;
  border: none;
  min-height: 300px;
  border-radius: var(--radius-xs);
}

.email-body-text {
  white-space: pre-wrap;
  font-family: var(--font-body);
  font-size: 0.875rem;
  color: var(--text);
  line-height: 1.6;
}

/* ===== MODALS ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal {
  background: var(--bg-secondary);
  border-radius: var(--radius);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal-wide { max-width: 720px; }

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-light);
}

.modal-header h3 {
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 500;
}

.modal-close { color: var(--text-muted); }

.modal-body { padding: 16px 24px; }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid var(--border-light);
}

.form-group { margin-bottom: 16px; }

.form-group label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-group input,
.form-group textarea {
  display: block;
  width: 100%;
  padding: 10px 12px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  font-family: var(--mono);
  font-size: 0.8125rem;
  outline: none;
  transition: border-color 0.2s;
  resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus { border-color: var(--accent); }

.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  cursor: pointer;
  font-size: 0.875rem;
}

.hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 24px;
  border: none;
  border-radius: var(--radius-xs);
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}

.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); }

.btn-text { background: transparent; color: var(--danger); }
.btn-text:hover { background: #fce8e6; }
[data-theme="dark"] .btn-text:hover { background: #3c2020; }

.raw-content {
  background: var(--bg);
  padding: 16px;
  border-radius: var(--radius-xs);
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
  overflow-x: auto;
  white-space: pre-wrap;
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid var(--border-light);
}

/* ===== SNACKBAR ===== */
.snackbar {
  position: fixed;
  bottom: -60px;
  left: 50%;
  transform: translateX(-50%);
  background: #323232;
  color: #fff;
  padding: 12px 24px;
  border-radius: var(--radius-xs);
  font-size: 0.875rem;
  font-family: var(--font-body);
  z-index: 2000;
  transition: bottom 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow);
  white-space: nowrap;
}

.snackbar.show { bottom: 24px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .email-from { width: 160px; }
  .email-detail { padding: 24px; }
  .email-body { padding-left: 0; }
  .email-attachments { padding-left: 0; }
}

@media (max-width: 768px) {
  :root { --sidebar-width: 0px; }

  .sidebar {
    position: fixed;
    left: -280px;
    top: var(--header-height);
    bottom: 0;
    width: 280px;
    background: var(--bg-secondary);
    z-index: 200;
    box-shadow: var(--shadow-lg);
    transition: left 0.2s ease;
  }

  .sidebar.mobile-open { left: 0; }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    top: var(--header-height);
    background: rgba(0,0,0,0.3);
    z-index: 199;
    display: none;
  }

  .sidebar-backdrop.show { display: block; }

  main { margin: 4px; border-radius: var(--radius-sm); }
  .header-left { width: auto; }
  .logo-text { display: none; }
  .domain-chip-label { display: none; }
  .domain-chip { padding: 4px 6px; }
  .domain-chip-arrow { display: none; }
  .search-bar { height: 40px; }

  .email-content {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }

  .email-from { width: auto; }
  .email-subject-line { flex-direction: column; gap: 0; }
  .email-separator { display: none; }
  .email-detail { padding: 16px; }
  .email-body { padding-left: 0; }
  .email-attachments { padding-left: 0; }
  .email-detail-subject { font-size: 1.125rem; }
}

@media (max-width: 480px) {
  header { padding: 0 4px; height: 56px; }
  .header-center { padding: 0 8px; }
  .email-meta-right { margin-left: 4px; }
  .email-detail { padding: 12px; }
}
