/* ============================================================
   Mail VesinhPC247 — giao diện webmail
   Tông màu theo thương hiệu vesinhpc247.com: xanh dương + navy + cyan
   ============================================================ */
:root {
  /* --- Màu thương hiệu --- */
  --brand:       #2563eb;   /* blue-600 chủ đạo */
  --brand-dark:  #1d4ed8;   /* blue-700 */
  --brand-light: #60a5fa;   /* blue-400 */
  --cyan:        #06b6d4;   /* cyan-500 — điểm nhấn */
  --star:        #f59e0b;   /* vàng hổ phách cho sao đánh dấu */

  /* alias giữ tương thích với code cũ — đừng xoá */
  --gold:        var(--brand);
  --gold-light:  var(--brand-light);
  --gold-dark:   var(--brand-dark);

  --navy:   #0f172a;   /* slate-900 — thanh trên, tiêu đề */
  --navy-2: #1e293b;   /* slate-800 */
  --ink:    #1e293b;
  --muted:  #64748b;   /* slate-500 */
  --line:   #e2e8f0;   /* slate-200 */
  --bg:     #eef2f7;   /* nền xám xanh nhạt */
  --surface:#ffffff;
  --unread: #eff6ff;   /* blue-50 */
  --danger: #dc2626;
  --ok:     #16a34a;
  --shadow: 0 8px 30px rgba(15, 23, 42, .12);
  --radius: 12px;
  font-family: "Be Vietnam Pro", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { background: var(--bg); color: var(--ink); font-size: 14px; }
button { font-family: inherit; cursor: pointer; }
input, textarea { font-family: inherit; font-size: 14px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }

.screen { height: 100vh; width: 100%; }
.center { display: flex; align-items: center; justify-content: center; }

/* --- Spinner --- */
.spinner {
  width: 42px; height: 42px; border-radius: 50%;
  border: 4px solid var(--line); border-top-color: var(--gold);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ Đăng nhập ============ */
#screen-auth {
  background: radial-gradient(1200px 600px at 20% -10%, var(--navy-2), var(--navy));
}
.auth-card {
  width: 380px; max-width: 92vw; background: var(--surface);
  border-radius: 16px; padding: 32px; box-shadow: var(--shadow);
}
.auth-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.logo-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 48px; height: 48px; border-radius: 12px; font-size: 24px;
  background: linear-gradient(135deg, var(--gold-light), var(--gold-dark));
  color: var(--navy);
}
.logo-mark.sm { width: 30px; height: 30px; font-size: 16px; border-radius: 8px; }
.logo-title { font-size: 20px; font-weight: 700; color: var(--navy); }
.logo-sub { font-size: 12px; color: var(--muted); letter-spacing: .5px; }
.auth-card h2 { font-size: 22px; margin-bottom: 4px; color: var(--navy); }
.auth-card p { margin-bottom: 18px; font-size: 13px; }
.auth-card label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.auth-card input {
  width: 100%; margin-top: 6px; padding: 11px 12px;
  border: 1px solid var(--line); border-radius: 9px; background: #fbfcfe;
}
.auth-card input:focus { outline: 2px solid var(--gold-light); border-color: var(--gold); }

/* ============ Nút ============ */
.btn {
  border: none; border-radius: 9px; padding: 10px 16px;
  font-size: 14px; font-weight: 600; transition: .15s;
}
.btn-primary { background: linear-gradient(135deg, var(--brand), var(--brand-dark)); color: #fff; }
.btn-primary:hover { filter: brightness(1.06); }
.btn-ghost { background: transparent; color: var(--navy); }
.btn-ghost:hover { background: #eef1f5; }
.btn-block { width: 100%; margin-top: 6px; }
.form-error { background: #fdecec; color: var(--danger); padding: 9px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 12px; }

/* ============ Thanh trên cùng ============ */
.topbar {
  height: 56px; background: linear-gradient(90deg, #0f172a 0%, #17294a 60%, #1e3a8a 100%); color: #fff;
  display: flex; align-items: center; gap: 16px; padding: 0 16px;
  box-shadow: 0 2px 12px rgba(15,23,42,.18);
}
.brand { font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.search { flex: 1; max-width: 560px; }
.search input {
  width: 100%; padding: 9px 14px; border-radius: 20px; border: none;
  background: rgba(255,255,255,.14); color: #fff;
}
.search input::placeholder { color: rgba(255,255,255,.6); }
.search input:focus { outline: 2px solid var(--gold); background: rgba(255,255,255,.2); }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  background: transparent; border: none; color: inherit; font-size: 18px;
  width: 38px; height: 38px; border-radius: 8px;
}
.icon-btn:hover { background: rgba(255,255,255,.12); }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; border: 2px solid var(--gold);
  background: var(--gold); color: var(--navy); font-weight: 700; font-size: 15px;
  background-size: cover; background-position: center; overflow: hidden;
}
.user-menu { position: relative; }
.dropdown {
  position: absolute; right: 0; top: 46px; width: 240px; background: #fff; color: var(--ink);
  border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; z-index: 40;
}
.dd-head { padding: 14px 16px; background: #f7f9fc; border-bottom: 1px solid var(--line); }
.dd-name { font-weight: 700; }
.dd-email { font-size: 12px; color: var(--muted); }
.dd-item { display: block; width: 100%; text-align: left; padding: 12px 16px; background: none; border: none; font-size: 14px; }
.dd-item:hover { background: #f2f5f9; }

/* ============ Bố cục 3 cột ============ */
.layout { display: flex; height: calc(100vh - 56px); }
.sidebar {
  width: 220px; background: #fff; border-right: 1px solid var(--line);
  padding: 16px 12px; flex-shrink: 0; overflow-y: auto;
}
.btn-compose { width: 100%; margin-bottom: 16px; padding: 12px; }
.folders { display: flex; flex-direction: column; gap: 2px; }
.folder {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: 9px; border: none; background: none; text-align: left;
  font-size: 14px; color: var(--ink); width: 100%;
}
.folder:hover { background: #f2f5f9; }
.folder.active { background: var(--unread); color: var(--navy); font-weight: 600; }
.folder .f-icon { width: 20px; text-align: center; }
.folder .f-name { flex: 1; }
.folder .f-badge {
  background: var(--gold); color: var(--navy); font-size: 11px; font-weight: 700;
  padding: 1px 8px; border-radius: 10px;
}

/* --- Danh sách thư --- */
.list-pane {
  width: 380px; flex-shrink: 0; background: #fff;
  border-right: 1px solid var(--line); display: flex; flex-direction: column;
}
.list-head {
  padding: 14px 18px; border-bottom: 1px solid var(--line); font-weight: 700;
  color: var(--navy); display: flex; justify-content: space-between; align-items: baseline;
}
.list-count { font-size: 12px; color: var(--muted); font-weight: 400; }
.msg-list { flex: 1; overflow-y: auto; }
.msg-item {
  padding: 12px 18px; border-bottom: 1px solid var(--line); cursor: pointer;
  display: flex; flex-direction: row; align-items: flex-start; gap: 10px;
  border-left: 3px solid transparent;
}
.mi-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.mi-check { margin-top: 3px; width: 16px; height: 16px; flex-shrink: 0; accent-color: var(--gold); cursor: pointer; }
.msg-item.selected { background: #eef5ff; }
.mi-folder { margin-right: 5px; }
.msg-item:hover { background: #f7f9fc; }
.msg-item.active { background: var(--unread); border-left-color: var(--gold); }
.msg-item.unread { background: #fbfdff; }
.msg-item.unread .mi-from, .msg-item.unread .mi-subject { font-weight: 700; }
.mi-row1 { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.mi-from { color: var(--ink); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mi-date { font-size: 11px; color: var(--muted); flex-shrink: 0; }
.mi-subject { font-size: 13px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mi-preview { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mi-tags { display: flex; gap: 6px; align-items: center; }
.mi-star { color: var(--star); }
.mi-clip { color: var(--muted); font-size: 12px; }
.empty-list { padding: 40px 20px; text-align: center; color: var(--muted); }

/* --- Khung đọc --- */
.read-pane { flex: 1; background: #fff; overflow-y: auto; }
.read-empty { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); gap: 12px; }
.read-empty-icon { width: 84px; height: 84px; object-fit: contain; opacity: .3; }
.read-content { padding: 24px 32px; max-width: 900px; }
.read-subject { font-size: 22px; color: var(--navy); margin-bottom: 16px; font-weight: 700; }
.read-meta { display: flex; align-items: center; gap: 12px; padding-bottom: 16px; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.read-avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--gold); color: var(--navy); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 18px; flex-shrink: 0; }
.read-from-name { font-weight: 700; }
.read-from-addr { font-size: 12px; color: var(--muted); }
.read-to { font-size: 12px; color: var(--muted); margin-top: 2px; }
.read-date { margin-left: auto; font-size: 12px; color: var(--muted); }
.read-actions { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.read-body { line-height: 1.6; color: #222; word-wrap: break-word; }
.read-body img { max-width: 100%; height: auto; }
.read-body a { color: var(--gold-dark); }
.read-atts { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); }
.read-atts h4 { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.att-chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; margin: 0 8px 8px 0;
  background: #f4f6f9; border: 1px solid var(--line); border-radius: 8px; font-size: 13px;
  color: var(--ink); text-decoration: none;
}
.att-chip:hover { background: #eaeef3; }

/* ============ Modal soạn thư ============ */
.modal-overlay { position: fixed; inset: 0; background: rgba(16,35,58,.4); z-index: 60; display: flex; align-items: flex-end; justify-content: flex-end; padding: 0 24px 0 0; }
.compose {
  width: 620px; max-width: 96vw; height: 560px; max-height: 90vh; background: #fff;
  border-radius: 14px 14px 0 0; box-shadow: var(--shadow); display: flex; flex-direction: column;
  margin-bottom: 0;
}
.compose.minimized { height: 48px; }
.compose-head { background: var(--navy); color: #fff; padding: 12px 16px; border-radius: 14px 14px 0 0; display: flex; justify-content: space-between; align-items: center; font-weight: 600; }
.compose-head .icon-btn { width: 30px; height: 30px; font-size: 16px; }
.compose-body { flex: 1; padding: 8px 16px; overflow-y: auto; display: flex; flex-direction: column; }
.compose.minimized .compose-body, .compose.minimized .compose-foot { display: none; }
.field { display: flex; align-items: center; border-bottom: 1px solid var(--line); }
.field label { width: 56px; color: var(--muted); font-size: 13px; }
.field input { flex: 1; border: none; padding: 11px 4px; }
.field input:focus { outline: none; }
#c-body { flex: 1; border: none; padding: 14px 4px; resize: none; line-height: 1.6; min-height: 160px; }
#c-body:focus { outline: none; }
.compose-foot { padding: 12px 16px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 8px; }
.compose-status { font-size: 12px; color: var(--muted); margin-left: 4px; }
.btn-discard { margin-left: auto; color: var(--danger); }
.attach-list { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 0; }
.attach-item { display: inline-flex; align-items: center; gap: 6px; background: #f4f6f9; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: 12px; }
.attach-item button { border: none; background: none; color: var(--danger); font-size: 14px; }

/* ============ Panel cài đặt / quản trị ============ */
.panel { width: 640px; max-width: 96vw; max-height: 86vh; margin: auto; background: #fff; border-radius: 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden; }
.modal-overlay.center-modal { align-items: center; justify-content: center; padding: 24px; }
.panel-head { background: var(--navy); color: #fff; padding: 14px 20px; display: flex; justify-content: space-between; align-items: center; font-weight: 700; }
.panel-body { padding: 20px; overflow-y: auto; }
.panel-body h3 { font-size: 15px; margin: 4px 0 12px; color: var(--navy); }
.panel-body label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.panel-body input, .panel-body textarea { width: 100%; margin-top: 5px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; }
.panel-body textarea { min-height: 90px; resize: vertical; }
.user-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.user-row .u-info { flex: 1; }
.user-row .u-email { font-weight: 600; }
.user-row .u-name { font-size: 12px; color: var(--muted); }
.badge-admin { background: var(--gold); color: var(--navy); font-size: 11px; padding: 2px 8px; border-radius: 10px; font-weight: 700; }
.mini-btn { padding: 6px 10px; font-size: 12px; border-radius: 7px; border: 1px solid var(--line); background: #fff; }
.mini-btn.danger { color: var(--danger); border-color: #f2c9c9; }
.add-user-form { background: #f7f9fc; border-radius: 10px; padding: 16px; margin-top: 16px; }
.row2 { display: flex; gap: 12px; }
.row2 > * { flex: 1; }

/* ============ Toast ============ */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 12px 22px; border-radius: 10px; box-shadow: var(--shadow); z-index: 90; font-size: 14px; }
.toast.error { background: var(--danger); }
.toast.ok { background: var(--ok); }

/* ============ Ảnh đại diện / ảnh chữ ký trong Cài đặt ============ */
.avatar-edit { display: flex; align-items: center; gap: 16px; margin: 8px 0 4px; }
.avatar-preview {
  width: 72px; height: 72px; border-radius: 50%; flex-shrink: 0; overflow: hidden;
  background: var(--gold); color: var(--navy); font-weight: 700; font-size: 24px;
  display: flex; align-items: center; justify-content: center;
}
.avatar-preview img { width: 100%; height: 100%; object-fit: cover; }
.sig-preview {
  min-width: 72px; max-width: 220px; min-height: 56px; padding: 6px; flex-shrink: 0;
  border: 1px solid var(--line); border-radius: 8px; background: #f4f6f9;
  display: flex; align-items: center; justify-content: center;
}
.sig-preview img { max-width: 200px; max-height: 80px; object-fit: contain; }

/* ---- Trình soạn chữ ký giàu định dạng ---- */
.sig-toolbar {
  display: flex; align-items: center; gap: 2px; flex-wrap: wrap;
  padding: 6px 4px; background: #fafbfd;
  border: 1px solid var(--line); border-bottom: none; border-radius: 8px 8px 0 0;
}
.sig-editor {
  min-height: 150px; padding: 12px; line-height: 1.6; overflow-y: auto;
  border: 1px solid var(--line); border-radius: 0 0 8px 8px; background: #fff;
}
.sig-editor:focus { outline: none; border-color: var(--gold); }
.sig-editor:empty::before { content: attr(data-placeholder); color: var(--muted); pointer-events: none; }
.sig-editor img { max-width: 100%; height: auto; border-radius: 4px; cursor: move; }
.sig-editor img.sig-sel { outline: 3px solid var(--gold); outline-offset: 2px; }
.sig-img-tools {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 10px; padding: 10px 12px; background: #f7f9fc;
  border: 1px solid var(--line); border-radius: 8px;
}
.sig-img-tools input[type=range] { flex: 1; min-width: 120px; accent-color: var(--gold); }

/* ============ Thanh dung lượng ============ */
.storage { margin-top: 18px; padding: 10px 12px 4px; border-top: 1px solid var(--line); }
.storage-bar { height: 6px; background: var(--line); border-radius: 4px; overflow: hidden; }
.storage-bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--gold-light), var(--gold-dark)); }
.storage-txt { font-size: 11px; color: var(--muted); margin-top: 6px; }

/* ============ Logo ảnh (logomail.png) ============ */
.logo-img { object-fit: cover; border-radius: 10px; display: block; flex-shrink: 0; }
.logo-img.lg { width: 54px; height: 54px; border-radius: 14px; box-shadow: 0 6px 18px rgba(37,99,235,.35); }
.logo-img.sm { width: 30px; height: 30px; border-radius: 8px; box-shadow: 0 2px 6px rgba(0,0,0,.25); }

/* ============ Nút nhấn: canh icon + chữ ============ */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn-primary { box-shadow: 0 4px 14px rgba(37,99,235,.35); }

/* ============ Soạn thư: thanh định dạng + ô soạn thảo ============ */
.c-toolbar {
  display: flex; align-items: center; gap: 2px; flex-wrap: wrap;
  padding: 6px 2px; border-bottom: 1px solid var(--line);
}
.tb-btn {
  border: none; background: none; min-width: 30px; height: 30px; padding: 0 6px;
  border-radius: 6px; color: var(--ink); font-size: 14px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.tb-btn:hover { background: #eef1f5; }
.tb-btn:active { background: #e2e7ee; }
.tb-sep { width: 1px; height: 18px; background: var(--line); margin: 0 5px; }

#c-body { overflow-y: auto; }
#c-body:empty::before { content: attr(data-placeholder); color: var(--muted); pointer-events: none; }
#c-body img { max-width: 100%; height: auto; border-radius: 4px; }
#c-body blockquote { margin: 6px 0 6px 6px; padding-left: 12px; border-left: 2px solid #d5d9e0; color: #555; }

.compose-foot { flex-wrap: wrap; }

/* ============ Ngôi sao trên danh sách thư (kiểu Gmail) ============ */
.mi-star-btn {
  border: none; background: none; font-size: 16px; line-height: 1;
  color: #c7cdd6; padding: 0 2px; transition: color .12s, transform .12s;
}
.mi-star-btn:hover { color: var(--star); transform: scale(1.15); }
.mi-star-btn.on { color: var(--star); }
.msg-item.starred { background: #fffaf0; border-left-color: var(--star); }
.msg-item.starred .mi-subject { font-weight: 700; color: #b45309; }
.msg-item.starred.active { background: var(--unread); }

/* ============ Đọc thư trong iframe an toàn ============ */
.read-frame { width: 100%; border: none; min-height: 120px; background: #fff; }

/* ============ Thanh chọn nhiều thư ============ */
.bulk-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 16px; background: #f7f9fc; border-bottom: 1px solid var(--line);
}
.bulk-n { font-size: 13px; font-weight: 600; color: var(--navy); margin-right: 4px; }
.load-more { display: block; width: calc(100% - 24px); margin: 12px; border: 1px dashed var(--line); }

/* ============ Nút "Bcc" trong ô Đến ============ */
.bcc-toggle { border: none; background: none; color: var(--muted); font-size: 12px; font-weight: 600; padding: 4px 6px; border-radius: 6px; }
.bcc-toggle:hover { background: #eef1f5; color: var(--navy); }

/* ============ Gợi ý người nhận (autocomplete) ============ */
.field { position: relative; }
.ac-box {
  position: absolute; left: 56px; right: 4px; top: 100%; z-index: 70;
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  box-shadow: var(--shadow); overflow: hidden; max-height: 220px; overflow-y: auto;
}
.ac-item { padding: 8px 12px; font-size: 13px; cursor: pointer; }
.ac-item:hover, .ac-item.sel { background: var(--unread); }

/* ============================================================
   NHÃN PHÂN LOẠI
   ============================================================ */
.mi-labels { display: flex; flex-wrap: wrap; gap: 4px; margin: 3px 0 1px; }
.lbl-chip {
  font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 10px;
  color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--c) 32%, transparent); line-height: 1.5;
}
.labels-nav { margin-top: 6px; display: flex; flex-direction: column; gap: 2px; }
.labels-head { font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .5px; padding: 8px 12px 4px; }
.lbl-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.label-item { gap: 10px; }

/* Menu gắn nhãn trong khung đọc thư */
.lbl-wrap { position: relative; display: inline-block; }
.lbl-menu {
  position: absolute; top: 110%; left: 0; z-index: 50; min-width: 190px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow); padding: 6px;
}
.lbl-opt { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 6px; font-size: 13px; cursor: pointer; white-space: nowrap; }
.lbl-opt:hover { background: color-mix(in srgb, var(--ink) 8%, transparent); }

/* Bảng chọn màu khi tạo nhãn */
.color-pick { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.color-dot { width: 28px; height: 28px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; }
.color-dot.sel { border-color: var(--ink); }

/* ============================================================
   MẪU TRẢ LỜI NHANH
   ============================================================ */
.tb-template { font-weight: 600; color: var(--brand); white-space: nowrap; width: auto; }
.tpl-menu {
  position: absolute; top: 100%; left: 8px; z-index: 50; min-width: 210px; max-height: 260px; overflow: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow); padding: 6px; margin-top: 4px;
}
.tpl-item { display: block; width: 100%; text-align: left; padding: 8px 10px; border: none; background: none; border-radius: 6px; font-size: 13px; color: var(--ink); cursor: pointer; }
.tpl-item:hover { background: color-mix(in srgb, var(--ink) 8%, transparent); }
.c-toolbar { position: relative; }

/* ============================================================
   TINH CHỈNH MƯỢT
   ============================================================ */
.msg-item, .folder, .dd-item, .tb-btn { transition: background .12s; }
.btn { transition: filter .15s, background .15s, transform .05s; }
.btn:active { transform: translateY(1px); }
.avatar, .mi-star-btn { transition: transform .1s, background .15s; }

/* ============================================================
   CHẾ ĐỘ TỐI (DARK MODE)
   ============================================================ */
[data-theme="dark"] {
  --ink: #e6eaf2;
  --muted: #93a1b8;
  --line: #28324c;
  --bg: #0b1220;
  --surface: #141d33;
  --unread: #1b2b4c;
  --shadow: 0 10px 34px rgba(0,0,0,.55);
}
[data-theme="dark"] .sidebar,
[data-theme="dark"] .list-pane,
[data-theme="dark"] .read-pane,
[data-theme="dark"] .read-content,
[data-theme="dark"] .compose,
[data-theme="dark"] .panel,
[data-theme="dark"] .dropdown,
[data-theme="dark"] .auth-card { background: var(--surface); color: var(--ink); }
[data-theme="dark"] .read-body { color: var(--ink); }
[data-theme="dark"] .folder:hover,
[data-theme="dark"] .dd-item:hover,
[data-theme="dark"] .msg-item:hover,
[data-theme="dark"] .tb-btn:hover,
[data-theme="dark"] .btn-ghost:hover,
[data-theme="dark"] .att-chip:hover { background: rgba(255,255,255,.06); }
[data-theme="dark"] .msg-item.unread { background: #16213b; }
[data-theme="dark"] .msg-item.selected { background: #1c2c4d; }
[data-theme="dark"] .msg-item.starred { background: #2a2410; }
[data-theme="dark"] .dd-head,
[data-theme="dark"] .add-user-form,
[data-theme="dark"] .bulk-bar,
[data-theme="dark"] .att-chip,
[data-theme="dark"] .attach-item,
[data-theme="dark"] .sig-img-tools,
[data-theme="dark"] .sig-toolbar { background: rgba(255,255,255,.04); color: var(--ink); }
[data-theme="dark"] .ac-box,
[data-theme="dark"] .lbl-menu,
[data-theme="dark"] .tpl-menu { background: #10192e; }
[data-theme="dark"] input,
[data-theme="dark"] textarea,
[data-theme="dark"] .auth-card input,
[data-theme="dark"] .panel-body input,
[data-theme="dark"] .panel-body textarea,
[data-theme="dark"] .sig-editor { background: #0e1728; color: var(--ink); border-color: var(--line); }
[data-theme="dark"] .read-subject,
[data-theme="dark"] .list-head,
[data-theme="dark"] .panel-body h3,
[data-theme="dark"] .auth-card h2,
[data-theme="dark"] .auth-card .logo-title,
[data-theme="dark"] .bulk-n,
[data-theme="dark"] .folder.active,
[data-theme="dark"] .mi-from,
[data-theme="dark"] .mi-subject,
[data-theme="dark"] .msg-item,
[data-theme="dark"] .folder,
[data-theme="dark"] .dd-item,
[data-theme="dark"] .read-from-name { color: var(--ink); }
[data-theme="dark"] #screen-auth { background: radial-gradient(1200px 600px at 20% -10%, #16233f, #070b14); }

/* ============ Responsive ============ */
.only-mobile { display: none; }
@media (max-width: 900px) {
  .only-mobile { display: inline-flex; }
  .search { display: none; }
  .sidebar { position: fixed; top: 56px; left: 0; bottom: 0; z-index: 30; transform: translateX(-100%); transition: .2s; box-shadow: var(--shadow); }
  .sidebar.open { transform: translateX(0); }
  .list-pane { width: 100%; }
  .read-pane { position: fixed; inset: 56px 0 0 0; z-index: 20; transform: translateX(100%); transition: .2s; }
  .read-pane.open { transform: translateX(0); }
  .compose { width: 100vw; height: 100vh; max-height: 100vh; border-radius: 0; }
  .modal-overlay { padding: 0; }
}
