:root {
  --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Color Palette - Dark Theme Default */
  --bg-app: #090d16;
  --bg-sidebar: #0f1422;
  --bg-card: #151b2d;
  --bg-card-hover: #1c243c;
  --bg-input: #101626;
  --bg-active: rgba(59, 130, 246, 0.12);

  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: #3b82f6;

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent-primary: #3b82f6;
  --accent-hover: #2563eb;
  --accent-gradient: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
  --accent-glow: rgba(59, 130, 246, 0.25);

  --color-star: #eab308;
  --color-danger: #ef4444;
  --color-success: #10b981;
  --color-warning: #f59e0b;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;

  --sidebar-width: 250px;
  --header-height: 64px;
}

body.theme-light {
  --bg-app: #f8fafc;
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --bg-input: #f1f5f9;
  --bg-active: rgba(59, 130, 246, 0.1);

  --border-color: #e2e8f0;
  --border-focus: #3b82f6;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.12);
}

/* Utilities */
.hidden {
  display: none !important;
}

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

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

/* App Layout */
.app-layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* Header */
.app-header {
  height: var(--header-height);
  background-color: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 20;
  gap: 16px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 220px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  user-select: none;
}

.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 0 16px var(--accent-glow);
}

.brand-name {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.brand-name span {
  color: var(--accent-primary);
}

.brand-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent-primary);
  border: 1px solid rgba(59, 130, 246, 0.3);
}

/* Search Box */
.header-center {
  flex: 1;
  max-width: 720px;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 8px 16px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.search-box:focus-within {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: var(--bg-card);
}

.search-icon {
  color: var(--text-muted);
  margin-right: 10px;
}

.search-box input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 14px;
  outline: none;
}

.search-shortcut {
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--border-color);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
}

.search-clear {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  margin-right: 8px;
}

/* Header Right */
.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

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

/* Account Selector */
.account-selector-container {
  position: relative;
}

.account-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.account-pill:hover {
  border-color: var(--text-muted);
}

.account-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-primary);
}

.account-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  width: 280px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 8px;
  z-index: 50;
  animation: fadeIn 0.15s ease;
}

.dropdown-header {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 6px 10px;
  letter-spacing: 0.5px;
}

.dropdown-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease;
}

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

.dropdown-item.active {
  background: var(--bg-active);
  font-weight: 600;
}

.dropdown-divider {
  height: 1px;
  background: var(--border-color);
  margin: 6px 0;
}

/* App Body */
.app-body {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
}

/* Sidebar */
.app-sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  user-select: none;
  flex-shrink: 0;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.app-sidebar.collapsed {
  transform: translateX(-100%);
  width: 0;
  padding: 0;
  border: none;
}

/* Compose Button */
.sidebar-compose {
  margin-bottom: 18px;
}

.btn-compose {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 14px 20px;
  border-radius: var(--radius-full);
  background: var(--accent-gradient);
  color: white;
  border: none;
  font-family: var(--font-main);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 16px var(--accent-glow);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-compose:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
}

.nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s ease;
}

.nav-item:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--bg-active);
  color: var(--accent-primary);
  font-weight: 600;
}

.nav-count {
  margin-left: auto;
  font-size: 12px;
  font-weight: 700;
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent-primary);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.sidebar-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 16px 12px 8px 12px;
  letter-spacing: 0.5px;
}

.btn-tiny {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
}

.label-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.sidebar-footer {
  padding-top: 14px;
  border-top: 1px solid var(--border-color);
}

.storage-info {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 10px 12px;
  border-radius: var(--radius-md);
}

.storage-text {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 6px;
}

.storage-badge {
  font-size: 10px;
  background: rgba(16, 185, 129, 0.15);
  color: var(--color-success);
  padding: 1px 6px;
  border-radius: var(--radius-full);
}

.storage-bar {
  height: 4px;
  background: var(--bg-input);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 6px;
}

.storage-progress {
  height: 100%;
  background: var(--accent-primary);
  border-radius: 2px;
}

.storage-meta {
  font-size: 10px;
  color: var(--text-muted);
}

/* Center Main Pane */
.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-app);
  overflow: hidden;
}

/* Toolbar */
.mail-toolbar {
  height: 48px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  background: var(--bg-card);
}

.toolbar-left, .toolbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-tool {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-tool:hover:not(:disabled) {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.btn-tool:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.pagination-info {
  font-size: 12px;
  color: var(--text-muted);
}

.pagination-buttons {
  display: flex;
  gap: 4px;
}

/* Category Tabs */
.category-tabs {
  display: flex;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: 0 12px;
}

.cat-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-family: var(--font-main);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.cat-tab:hover {
  color: var(--text-primary);
}

.cat-tab.active {
  color: var(--accent-primary);
  border-bottom-color: var(--accent-primary);
}

/* Messages List */
.messages-container {
  flex: 1;
  overflow-y: auto;
}

.message-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  background: var(--bg-app);
  position: relative;
  transition: background 0.15s ease;
}

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

.message-row.unread {
  background: var(--bg-card);
  font-weight: 700;
}

.message-row.unread .msg-subject {
  color: var(--text-primary);
  font-weight: 700;
}

.message-row.unread .msg-from {
  color: var(--text-primary);
  font-weight: 700;
}

.message-row.active {
  background: var(--bg-active);
  border-left: 3px solid var(--accent-primary);
}

.msg-checkbox {
  flex-shrink: 0;
}

.msg-star {
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s ease, transform 0.1s ease;
}

.msg-star:hover {
  transform: scale(1.15);
}

.msg-star.starred {
  color: var(--color-star);
  fill: var(--color-star);
}

.msg-from {
  width: 190px;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 14px;
  color: var(--text-secondary);
}

.msg-content {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  overflow: hidden;
  font-size: 13.5px;
}

.msg-subject {
  color: var(--text-primary);
  font-weight: 500;
}

.msg-snippet {
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 400;
}

.msg-labels {
  display: flex;
  gap: 6px;
}

.msg-label-pill {
  font-size: 10.5px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
}

.msg-attachment-icon {
  color: var(--text-muted);
}

.msg-date {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  width: 75px;
  text-align: right;
  flex-shrink: 0;
}

/* Hover Quick Actions */
.msg-quick-actions {
  display: none;
  position: absolute;
  right: 18px;
  background: var(--bg-card-hover);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  gap: 4px;
}

.message-row:hover .msg-quick-actions {
  display: flex;
}

.message-row:hover .msg-date {
  opacity: 0;
}

/* Custom Checkbox */
.custom-checkbox {
  position: relative;
  display: inline-block;
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.custom-checkbox input {
  opacity: 0;
  width: 0;
  height: 0;
}

.checkmark {
  position: absolute;
  top: 0;
  left: 0;
  height: 16px;
  width: 16px;
  background-color: transparent;
  border: 1.5px solid var(--text-muted);
  border-radius: 4px;
  transition: all 0.15s ease;
}

.custom-checkbox:hover input ~ .checkmark {
  border-color: var(--accent-primary);
}

.custom-checkbox input:checked ~ .checkmark {
  background-color: var(--accent-primary);
  border-color: var(--accent-primary);
}

.checkmark:after {
  content: "";
  position: absolute;
  display: none;
}

.custom-checkbox input:checked ~ .checkmark:after {
  display: block;
  left: 5px;
  top: 2px;
  width: 4px;
  height: 8px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* Reading Pane */
.reading-pane {
  flex: 1.2;
  background: var(--bg-card);
  border-left: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 10;
}

.reading-pane.hidden {
  display: none;
}

.reading-header {
  height: 48px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 0 16px;
}

.reading-toolbar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.reading-actions {
  display: flex;
  gap: 8px;
}

.reading-content-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.reading-subject {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}

.reading-labels {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
}

.sender-info-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.sender-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
}

.sender-details {
  flex: 1;
}

.sender-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.sender-name {
  font-size: 15px;
  color: var(--text-primary);
}

.sender-address {
  font-size: 13px;
  color: var(--text-muted);
}

.security-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  background: rgba(16, 185, 129, 0.12);
  color: var(--color-success);
  border-radius: var(--radius-full);
}

.recipient-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
}

.reading-attachments {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
}

.attachments-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.attachments-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.attachment-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  text-decoration: none;
  color: var(--text-primary);
  transition: all 0.15s ease;
}

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

.email-body-wrapper {
  min-height: 250px;
  background: white;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.reading-iframe {
  width: 100%;
  height: 500px;
  border: none;
  display: block;
}

.quick-reply-box {
  margin-top: 10px;
  border-top: 1px solid var(--border-color);
  padding-top: 16px;
}

.reply-actions {
  display: flex;
  gap: 10px;
}

.btn-reply-action {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-reply-action:hover {
  border-color: var(--accent-primary);
  background: var(--bg-active);
  color: var(--accent-primary);
}

/* Floating Compose Modal */
.compose-modal {
  position: fixed;
  bottom: 0;
  right: 32px;
  width: 580px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-bottom: none;
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: height 0.2s ease, width 0.2s ease;
}

.compose-modal.hidden {
  display: none;
}

.compose-modal.minimized {
  height: 48px !important;
  overflow: hidden;
}

.compose-modal.maximized {
  width: 85vw;
  height: 90vh;
  bottom: 5vh;
  right: 7.5vw;
  border-radius: var(--radius-lg);
}

.compose-header {
  height: 48px;
  background: var(--bg-sidebar);
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid var(--border-color);
  user-select: none;
  cursor: pointer;
}

.compose-title {
  font-size: 14px;
  font-weight: 700;
}

.compose-controls {
  display: flex;
  gap: 8px;
}

.btn-ctrl {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
}

.btn-ctrl:hover {
  color: var(--text-primary);
}

.compose-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 12px 16px;
  overflow-y: auto;
  gap: 8px;
}

.compose-row {
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border-color);
  padding: 6px 0;
}

.compose-label {
  font-size: 13px;
  color: var(--text-muted);
  width: 45px;
}

.compose-input, .compose-select {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 14px;
  outline: none;
}

.compose-select {
  cursor: pointer;
}

.compose-select option {
  background: var(--bg-card);
  color: var(--text-primary);
}

.compose-subject {
  font-size: 15px;
  font-weight: 600;
}

.compose-cc-toggle {
  display: flex;
  gap: 6px;
}

.compose-cc-toggle button {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
}

.compose-cc-toggle button:hover {
  color: var(--accent-primary);
}

.compose-editor {
  flex: 1;
  min-height: 220px;
  outline: none;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  padding: 8px 0;
  overflow-y: auto;
}

.compose-editor:empty:before {
  content: attr(placeholder);
  color: var(--text-muted);
}

.compose-attachments-tray {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 0;
}

.compose-footer {
  height: 56px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: var(--bg-sidebar);
}

.compose-footer-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-send {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 20px;
  border-radius: var(--radius-full);
  background: var(--accent-gradient);
  color: white;
  border: none;
  font-family: var(--font-main);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 10px var(--accent-glow);
  transition: all 0.2s ease;
}

.btn-send:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.4);
}

.format-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  border-left: 1px solid var(--border-color);
  padding-left: 10px;
}

.fmt-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  font-family: var(--font-main);
  font-size: 13px;
  cursor: pointer;
}

.fmt-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.btn-attach {
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 6px;
  border-radius: var(--radius-sm);
}

.btn-attach:hover {
  color: var(--text-primary);
  background: var(--bg-card-hover);
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  animation: fadeIn 0.2s ease;
}

.modal-overlay.hidden {
  display: none;
}

.modal-card {
  width: 100%;
  max-width: 640px;
  max-height: 85vh;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

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

.modal-header h2 {
  font-size: 18px;
  font-weight: 700;
}

.btn-close-modal {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
}

.modal-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.accounts-modal-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.tab-btn {
  padding: 8px 16px;
  border-radius: var(--radius-md);
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-family: var(--font-main);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tab-btn.active {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
}

.tab-view.hidden {
  display: none;
}

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

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

.form-group input, .form-group textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.15s ease;
}

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

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

.btn-primary {
  width: 100%;
  padding: 12px;
  border-radius: var(--radius-md);
  background: var(--accent-gradient);
  color: white;
  border: none;
  font-family: var(--font-main);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px var(--accent-glow);
}

/* Account Cards */
.accounts-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.account-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 18px;
}

.account-card-info h4 {
  font-size: 15px;
  margin-bottom: 4px;
}

.account-card-info p {
  font-size: 12.5px;
  color: var(--text-muted);
}

.account-card-actions {
  display: flex;
  gap: 8px;
}

.btn-test-conn {
  padding: 6px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

/* Plugins List */
.plugins-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.plugin-card {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
}

.plugin-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.plugin-name {
  font-size: 15px;
  font-weight: 700;
}

.plugin-version {
  font-size: 11px;
  font-family: var(--font-mono);
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent-primary);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.plugin-desc {
  font-size: 13px;
  color: var(--text-secondary);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 300;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  box-shadow: var(--shadow-lg);
  color: var(--text-primary);
  font-size: 13.5px;
  animation: slideIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.toast-success {
  border-left: 4px solid var(--color-success);
}

.toast.toast-error {
  border-left: 4px solid var(--color-danger);
}

/* Spinner */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 0;
  gap: 16px;
  color: var(--text-muted);
  font-size: 14px;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border-color);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Responsive adjustments */
@media (max-width: 900px) {
  .app-sidebar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 40;
    box-shadow: var(--shadow-lg);
  }

  .compose-modal {
    width: 100vw;
    right: 0;
    border-radius: 0;
  }
}

kbd {
  display: inline-block;
  padding: 2px 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  color: var(--text-color);
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  box-shadow: 0 1px 1px rgba(0,0,0,0.1);
}
