:root {
  --vm-bg: #f4f6f9;
  --vm-surface: #ffffff;
  --vm-surface-soft: #f8fafc;
  --vm-surface-hover: #f1f5f9;
  --vm-surface-active: #eff6ff;
  --vm-border: #e2e8f0;
  --vm-border-strong: #cbd5e1;
  --vm-text: #0f172a;
  --vm-text-secondary: #475569;
  --vm-text-muted: #64748b;
  --vm-primary: #1d4ed8;
  --vm-primary-hover: #1e40af;
  --vm-primary-soft: #dbeafe;
  --vm-success: #059669;
  --vm-warning: #d97706;
  --vm-danger: #dc2626;
  --vm-radius-sm: 8px;
  --vm-radius-md: 12px;
  --vm-radius-lg: 16px;
  --vm-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --vm-shadow-md: 0 10px 30px -8px rgba(15, 23, 42, 0.12);
  --vm-shadow-lg: 0 22px 50px -12px rgba(15, 23, 42, 0.22);
  --vm-header-h: 60px;
  --vm-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 100vw;
  height: 100%;
  overflow-x: hidden;
  font-family: var(--vm-font);
  color: var(--vm-text);
  background: var(--vm-bg);
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea {
  font-family: inherit;
}

/* ==================== AUTH / LOGIN PAGE ==================== */
.vm-auth-page {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  background: var(--vm-surface);
}

.vm-auth-hero {
  background: #0b1324;
  color: #f8fafc;
  padding: 48px 56px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.vm-auth-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 18% 18%, rgba(37, 99, 235, 0.28), transparent 52%),
              radial-gradient(circle at 85% 82%, rgba(14, 165, 233, 0.16), transparent 48%);
  pointer-events: none;
}

.vm-auth-hero > * {
  position: relative;
  z-index: 1;
}

.vm-brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.vm-brand-row img {
  height: 38px;
  width: auto;
  object-fit: contain;
}

.vm-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 12.5px;
  font-weight: 500;
  color: #cbd5e1;
  margin-bottom: 20px;
}

.vm-hero-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.2);
}

.vm-auth-hero h1 {
  font-size: clamp(28px, 3.2vw, 40px);
  line-height: 1.15;
  letter-spacing: -0.025em;
  margin: 0 0 16px;
  font-weight: 700;
}

.vm-auth-hero p {
  font-size: 15.5px;
  line-height: 1.65;
  color: #94a3b8;
  max-width: 500px;
  margin: 0 0 28px;
}

.vm-server-specs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  max-width: 520px;
}

.vm-spec-card {
  padding: 14px 16px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.vm-spec-card .vm-spec-k {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #94a3b8;
  margin-bottom: 4px;
}

.vm-spec-card .vm-spec-v {
  font-size: 13.5px;
  font-weight: 600;
  color: #f8fafc;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.vm-auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 36px 28px;
  background: var(--vm-surface);
}

.vm-auth-card {
  width: 100%;
  max-width: 430px;
}

.vm-auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--vm-surface-soft);
  border: 1px solid var(--vm-border);
  padding: 4px;
  border-radius: 11px;
  margin-bottom: 24px;
}

.vm-auth-tab {
  border: none;
  background: transparent;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--vm-text-secondary);
  cursor: pointer;
  transition: all 0.16s ease;
}

.vm-auth-tab.active {
  background: var(--vm-surface);
  color: var(--vm-text);
  box-shadow: var(--vm-shadow-sm);
}

.vm-field {
  margin-bottom: 15px;
}

.vm-field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--vm-text-secondary);
  margin-bottom: 6px;
}

.vm-input-wrap {
  display: flex;
  align-items: center;
  border: 1px solid var(--vm-border-strong);
  border-radius: 10px;
  background: var(--vm-surface);
  overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.vm-input-wrap:focus-within {
  border-color: var(--vm-primary);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.14);
}

.vm-input-wrap input, .vm-input {
  width: 100%;
  border: none;
  outline: none;
  padding: 11px 13px;
  font-size: 14.5px;
  color: var(--vm-text);
  background: transparent;
}

.vm-input {
  border: 1px solid var(--vm-border-strong);
  border-radius: 10px;
  background: var(--vm-surface);
}

.vm-input:focus {
  border-color: var(--vm-primary);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.14);
}

.vm-domain-suffix {
  padding: 0 13px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--vm-text-secondary);
  background: var(--vm-surface-soft);
  border-left: 1px solid var(--vm-border);
  height: 42px;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.vm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
}

.vm-btn-primary {
  background: var(--vm-primary);
  color: #ffffff;
}

.vm-btn-primary:hover {
  background: var(--vm-primary-hover);
}

.vm-btn-outline {
  background: var(--vm-surface);
  border-color: var(--vm-border-strong);
  color: var(--vm-text);
}

.vm-btn-outline:hover {
  background: var(--vm-surface-hover);
}

.vm-btn-ghost {
  background: transparent;
  color: var(--vm-text-secondary);
  padding: 8px 10px;
}

.vm-btn-ghost:hover {
  background: var(--vm-surface-hover);
  color: var(--vm-text);
}

.vm-btn-block {
  width: 100%;
  padding: 12px 16px;
}

.vm-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
  color: var(--vm-text-muted);
  font-size: 12.5px;
}

.vm-divider::before, .vm-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--vm-border);
}

.vm-alert {
  padding: 11px 13px;
  border-radius: 10px;
  font-size: 13.5px;
  margin-bottom: 14px;
  display: none;
}

.vm-alert.error {
  display: block;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

/* ==================== MAIN WEBMAIL APP SHELL ==================== */
.vm-shell {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  width: 100%;
  overflow: hidden;
  background: var(--vm-bg);
}

.vm-topbar {
  height: var(--vm-header-h);
  background: var(--vm-surface);
  border-bottom: 1px solid var(--vm-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  gap: 12px;
  flex-shrink: 0;
  z-index: 30;
}

.vm-topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 210px;
}

.vm-logo-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--vm-text);
}

.vm-logo-mark img {
  height: 30px;
  width: auto;
}

.vm-logo-tag {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--vm-primary);
  background: var(--vm-primary-soft);
  padding: 2px 8px;
  border-radius: 999px;
}

.vm-logo-tag.cenelis {
  color: #0f766e;
  background: #ccfbf1;
}

.vm-mailbox-switcher {
  height: 34px;
  border-radius: 999px;
  border: 1px solid var(--vm-border-strong);
  background: var(--vm-surface-soft);
  color: var(--vm-text);
  font-size: 12.5px;
  font-weight: 600;
  padding: 0 12px;
  cursor: pointer;
  outline: none;
  max-width: 215px;
}

.vm-mailbox-switcher:focus {
  border-color: var(--vm-primary);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.12);
}

.vm-search-box {
  flex: 1;
  max-width: 560px;
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--vm-surface-soft);
  border: 1px solid var(--vm-border);
  border-radius: 10px;
  padding: 0 12px;
  height: 38px;
  transition: all 0.15s ease;
}

.vm-search-box:focus-within {
  background: var(--vm-surface);
  border-color: var(--vm-primary);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.12);
}

.vm-search-box input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 13.5px;
  color: var(--vm-text);
  min-width: 0;
}

.vm-topbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.vm-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--vm-text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.14s ease;
  padding: 0;
}

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

.vm-icon-btn svg, .vm-btn svg {
  width: 18px;
  height: 18px;
  stroke-width: 2;
  flex-shrink: 0;
}

.vm-user-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  border-radius: 999px;
  border: 1px solid var(--vm-border);
  background: var(--vm-surface-soft);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--vm-text);
}

.vm-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #1e293b;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11.5px;
  font-weight: 700;
  object-fit: cover;
  flex-shrink: 0;
}

/* ==================== 3-PANE WORKSPACE ==================== */
.vm-workspace {
  flex: 1;
  display: grid;
  grid-template-columns: 244px 370px minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
}

/* Left Sidebar */
.vm-sidebar {
  background: var(--vm-surface);
  border-right: 1px solid var(--vm-border);
  display: flex;
  flex-direction: column;
  padding: 14px 12px;
  overflow-y: auto;
  min-height: 0;
}

.vm-compose-cta {
  width: 100%;
  padding: 11px 14px;
  border-radius: 11px;
  background: var(--vm-primary);
  color: #fff;
  border: none;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(29, 78, 216, 0.24);
  margin-bottom: 16px;
  transition: transform 0.12s ease, background 0.15s ease;
}

.vm-compose-cta:hover {
  background: var(--vm-primary-hover);
  transform: translateY(-1px);
}

.vm-nav-section-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--vm-text-muted);
  padding: 8px 10px 6px;
}

.vm-folder-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.vm-folder-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 9px;
  border: none;
  background: transparent;
  color: var(--vm-text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: all 0.12s ease;
}

.vm-folder-item:hover {
  background: var(--vm-surface-hover);
  color: var(--vm-text);
}

.vm-folder-item.active {
  background: var(--vm-surface-active);
  color: var(--vm-primary);
  font-weight: 600;
}

.vm-folder-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.vm-folder-item-left span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vm-folder-badge {
  font-size: 11.5px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--vm-primary-soft);
  color: var(--vm-primary);
}

.vm-folder-count-muted {
  font-size: 11.5px;
  color: var(--vm-text-muted);
}

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

.vm-quota-bar {
  height: 6px;
  border-radius: 999px;
  background: var(--vm-surface-hover);
  overflow: hidden;
  margin: 6px 0;
}

.vm-quota-fill {
  height: 100%;
  background: var(--vm-primary);
  border-radius: 999px;
}

.vm-quota-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--vm-text-muted);
}

/* Middle Message List */
.vm-list-pane {
  background: var(--vm-surface);
  border-right: 1px solid var(--vm-border);
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}

.vm-list-header {
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--vm-border);
}

.vm-list-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.vm-list-title-row h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.vm-filter-chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}

.vm-filter-chips::-webkit-scrollbar {
  display: none;
}

.vm-chip {
  border: 1px solid var(--vm-border);
  background: var(--vm-surface-soft);
  color: var(--vm-text-secondary);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.12s ease;
}

.vm-chip.active {
  background: var(--vm-text);
  border-color: var(--vm-text);
  color: #fff;
}

.vm-messages-scroll {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.vm-msg-row {
  padding: 12px 14px;
  border-bottom: 1px solid var(--vm-border);
  cursor: pointer;
  display: flex;
  gap: 11px;
  position: relative;
  transition: background 0.12s ease;
}

.vm-msg-row:hover {
  background: var(--vm-surface-soft);
}

.vm-msg-row.selected {
  background: var(--vm-surface-active);
}

.vm-msg-row.unread .vm-msg-sender,
.vm-msg-row.unread .vm-msg-subject {
  font-weight: 700;
  color: var(--vm-text);
}

.vm-unread-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--vm-primary);
  flex-shrink: 0;
  margin-top: 6px;
}

.vm-msg-row-body {
  flex: 1;
  min-width: 0;
}

.vm-msg-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 3px;
}

.vm-msg-sender {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--vm-text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vm-msg-date {
  font-size: 11.5px;
  color: var(--vm-text-muted);
  flex-shrink: 0;
}

.vm-msg-subject {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--vm-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 3px;
}

.vm-msg-snippet {
  font-size: 12.5px;
  color: var(--vm-text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}

.vm-msg-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}

.vm-mini-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--vm-surface-hover);
  color: var(--vm-text-secondary);
}

.vm-mini-tag.vip {
  background: #fef3c7;
  color: #b45309;
}

.vm-mini-tag.high {
  background: #fee2e2;
  color: #b91c1c;
}

/* Right Reading Pane */
.vm-reader-pane {
  background: var(--vm-surface-soft);
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

.vm-reader-toolbar {
  height: 52px;
  background: var(--vm-surface);
  border-bottom: 1px solid var(--vm-border);
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
}

.vm-reader-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
  overflow-x: auto;
}

.vm-reader-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
}

.vm-reader-empty {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--vm-text-muted);
  padding: 32px;
}

.vm-reader-subject-card {
  background: var(--vm-surface);
  border: 1px solid var(--vm-border);
  border-radius: var(--vm-radius-md);
  padding: 20px 22px;
  box-shadow: var(--vm-shadow-sm);
  margin-bottom: 14px;
}

.vm-reader-subject-card h1 {
  margin: 0 0 14px;
  font-size: 20px;
  line-height: 1.3;
  letter-spacing: -0.015em;
  word-break: break-word;
}

.vm-sender-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--vm-border);
  margin-bottom: 16px;
}

.vm-sender-meta {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.vm-sender-meta .vm-avatar {
  width: 40px;
  height: 40px;
  font-size: 14px;
}

.vm-sender-lines {
  min-width: 0;
}

.vm-sender-lines strong {
  display: block;
  font-size: 14.5px;
  color: var(--vm-text);
}

.vm-sender-lines span {
  display: block;
  font-size: 12.5px;
  color: var(--vm-text-muted);
  word-break: break-all;
}

.vm-att-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.vm-att-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--vm-surface-soft);
  border: 1px solid var(--vm-border);
  color: var(--vm-text);
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 500;
  max-width: 100%;
}

.vm-att-chip:hover {
  border-color: var(--vm-primary);
  background: var(--vm-surface-active);
}

.vm-mail-iframe {
  width: 100%;
  border: none;
  min-height: 220px;
  display: block;
  background: transparent;
}

.vm-quick-reply-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--vm-border);
}

/* ==================== COMPOSER MODAL ==================== */
.vm-composer-dock {
  position: fixed;
  right: 24px;
  bottom: 0;
  width: 580px;
  max-width: calc(100vw - 24px);
  background: var(--vm-surface);
  border: 1px solid var(--vm-border-strong);
  border-bottom: none;
  border-radius: 14px 14px 0 0;
  box-shadow: var(--vm-shadow-lg);
  z-index: 80;
  display: none;
  flex-direction: column;
  max-height: 86dvh;
}

.vm-composer-dock.open {
  display: flex;
}

.vm-composer-head {
  background: #0f172a;
  color: #f8fafc;
  padding: 11px 16px;
  border-radius: 13px 13px 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13.5px;
  font-weight: 600;
}

.vm-composer-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--vm-border);
  font-size: 13.5px;
}

.vm-composer-row label {
  color: var(--vm-text-muted);
  font-weight: 600;
  min-width: 46px;
}

.vm-composer-row input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 13.5px;
  color: var(--vm-text);
  background: transparent;
  min-width: 0;
}

.vm-editor-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--vm-border);
  background: var(--vm-surface-soft);
}

.vm-composer-editor {
  flex: 1;
  min-height: 210px;
  max-height: 360px;
  overflow-y: auto;
  padding: 14px 16px;
  outline: none;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--vm-text);
}

.vm-composer-atts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 14px;
}

.vm-composer-foot {
  padding: 10px 14px;
  border-top: 1px solid var(--vm-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--vm-surface-soft);
}

/* ==================== MODALS & TOAST ==================== */
.vm-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(3px);
  z-index: 90;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.vm-modal-backdrop.open {
  display: flex;
}

.vm-modal {
  width: 100%;
  max-width: 580px;
  max-height: 90dvh;
  overflow-y: auto;
  background: var(--vm-surface);
  border-radius: 16px;
  box-shadow: var(--vm-shadow-lg);
  border: 1px solid var(--vm-border);
  padding: 22px 24px;
}

.vm-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.vm-modal-head h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
}

.vm-code-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0 18px;
}

.vm-code-box {
  background: var(--vm-surface-soft);
  border: 1px solid var(--vm-border);
  border-radius: 10px;
  padding: 10px 12px;
}

.vm-code-box small {
  display: block;
  font-size: 11px;
  color: var(--vm-text-muted);
  margin-bottom: 3px;
}

.vm-code-box code {
  font-size: 13px;
  font-weight: 600;
  color: var(--vm-text);
  word-break: break-all;
}

.vm-toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #0f172a;
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--vm-shadow-md);
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s ease;
  z-index: 120;
  max-width: calc(100vw - 32px);
  text-align: center;
}

.vm-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.vm-mobile-only {
  display: none;
}

/* ==================== MOBILE RESPONSIVE (<= 960px) ==================== */
@media (max-width: 960px) {
  .vm-auth-page {
    grid-template-columns: 1fr;
  }

  .vm-auth-hero {
    padding: 28px 22px;
  }

  .vm-auth-hero p, .vm-server-specs {
    display: none;
  }

  .vm-auth-hero h1 {
    font-size: 22px;
    margin: 0;
  }

  .vm-auth-panel {
    padding: 24px 18px 36px;
  }

  .vm-mobile-only {
    display: inline-flex;
  }

  .vm-desktop-only {
    display: none !important;
  }

  .vm-topbar {
    padding: 0 10px;
    gap: 8px;
  }

  .vm-topbar-left {
    min-width: auto;
  }

  .vm-logo-mark img {
    height: 25px;
  }

  .vm-logo-tag {
    display: none;
  }

  .vm-user-pill span {
    display: none;
  }

  .vm-user-pill {
    padding: 3px;
  }

  .vm-workspace {
    grid-template-columns: 1fr;
    position: relative;
  }

  .vm-sidebar {
    position: fixed;
    top: var(--vm-header-h);
    left: 0;
    bottom: 0;
    width: 276px;
    max-width: 84vw;
    z-index: 60;
    transform: translateX(-104%);
    transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: var(--vm-shadow-lg);
  }

  .vm-sidebar.open {
    transform: translateX(0);
  }

  .vm-drawer-mask {
    position: fixed;
    inset: var(--vm-header-h) 0 0 0;
    background: rgba(15, 23, 42, 0.4);
    z-index: 55;
    display: none;
  }

  .vm-drawer-mask.open {
    display: block;
  }

  .vm-list-pane {
    border-right: none;
    width: 100%;
  }

  .vm-reader-pane {
    position: fixed;
    inset: var(--vm-header-h) 0 0 0;
    z-index: 50;
    transform: translateX(102%);
    transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    background: var(--vm-surface);
  }

  .vm-reader-pane.mobile-open {
    transform: translateX(0);
  }

  .vm-reader-scroll {
    padding: 12px;
  }

  .vm-reader-subject-card {
    padding: 14px;
    border: none;
    box-shadow: none;
  }

  .vm-composer-dock {
    inset: 0;
    width: 100vw;
    max-width: 100vw;
    max-height: 100dvh;
    border-radius: 0;
    border: none;
  }

  .vm-composer-head {
    border-radius: 0;
    padding: 14px 16px;
  }

  .vm-code-grid {
    grid-template-columns: 1fr;
  }

  .vm-fab-compose {
    position: fixed;
    right: 18px;
    bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    width: 54px;
    height: 54px;
    border-radius: 16px;
    background: var(--vm-primary);
    color: #fff;
    border: none;
    box-shadow: 0 10px 24px rgba(29, 78, 216, 0.36);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    z-index: 40;
    cursor: pointer;
  }
}


/* ==================== @viplemail.fr CHAT / MAIL TOGGLE & CHAT VIEW ==================== */
.vm-mode-toggle {
  display: inline-flex;
  align-items: center;
  background: var(--vm-surface-soft);
  border: 1px solid var(--vm-border);
  border-radius: 999px;
  padding: 2px;
  gap: 2px;
  flex-shrink: 0;
}

.vm-mode-pill {
  border: none;
  background: transparent;
  color: var(--vm-text-secondary);
  font-size: 11.5px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.14s ease;
  white-space: nowrap;
}

.vm-mode-pill.active {
  background: var(--vm-primary);
  color: #fff;
  box-shadow: 0 2px 6px rgba(29, 78, 216, 0.28);
}

.vm-chat-mode-banner {
  padding: 7px 14px;
  font-size: 12px;
  color: var(--vm-primary);
  background: var(--vm-primary-soft);
  border-bottom: 1px solid var(--vm-border);
}

.vm-chat-pane {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--vm-surface);
}

.vm-chat-head {
  padding: 12px 18px;
  border-bottom: 1px solid var(--vm-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.vm-chat-stream {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f8fafc;
}

.vm-chat-bubble-row {
  display: flex;
  flex-direction: column;
  max-width: 74%;
}

.vm-chat-bubble-row.mine {
  align-self: flex-end;
  align-items: flex-end;
}

.vm-chat-bubble-row.peer {
  align-self: flex-start;
  align-items: flex-start;
}

.vm-chat-bubble {
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.48;
  word-wrap: break-word;
}

.vm-chat-bubble-row.mine .vm-chat-bubble {
  background: linear-gradient(135deg, #0078D4, #0359b8);
  color: #fff;
  border-bottom-right-radius: 5px;
}

.vm-chat-bubble-row.peer .vm-chat-bubble {
  background: #fff;
  color: var(--vm-text);
  border: 1px solid var(--vm-border);
  border-bottom-left-radius: 5px;
}

.vm-chat-meta {
  font-size: 11px;
  color: var(--vm-text-muted);
  margin-top: 3px;
  padding: 0 4px;
}

.vm-chat-input-bar {
  padding: 12px 16px;
  border-top: 1px solid var(--vm-border);
  background: var(--vm-surface);
  display: flex;
  gap: 10px;
  align-items: center;
}

.vm-chat-input-bar input {
  flex: 1;
  border: 1px solid var(--vm-border);
  background: var(--vm-surface-soft);
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 14px;
  outline: none;
}
