:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef3f9;
  --text: #182433;
  --muted: #66758c;
  --border: #dce3ec;
  --border-strong: #c8d2df;
  --primary: #206bc4;
  --primary-hover: #1957a3;
  --success: #2fb344;
  --danger: #d63939;
  --warning: #f59f00;
  --info: #4299e1;
  --shadow-sm: 0 1px 2px rgba(24, 36, 51, .05);
  --shadow-md: 0 8px 24px rgba(24, 36, 51, .08);
  --shadow-lg: 0 24px 64px rgba(24, 36, 51, .18);
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

html,
body,
#root {
  min-height: 100%;
}

html,
body {
  margin: 0;
}

body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  transition: background .2s ease, color .2s ease;
}

a {
  color: inherit;
  text-decoration: none;
}

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

button {
  cursor: pointer;
}

[data-theme="dark"] {
  --bg: #0e1621;
  --surface: #111b29;
  --surface-2: #162233;
  --surface-3: #1a293d;
  --text: #edf2f8;
  --muted: #9aa9bc;
  --border: #223246;
  --border-strong: #31455d;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .32);
  --shadow-md: 0 16px 40px rgba(0, 0, 0, .32);
  --shadow-lg: 0 32px 80px rgba(0, 0, 0, .42);
}

.ui-shell {
  min-height: 100vh;
}

.ui-page {
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px;
}

.ui-stack-gap {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.ui-stack-gap-sm,
.ui-stack-mini {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ui-muted {
  color: var(--muted);
  font-size: 13px;
}

.ui-strong {
  font-weight: 700;
}

/* top header */
.ui-topbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 24px;
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.ui-topbar-primary,
.ui-topbar-secondary,
.ui-header-tools,
.ui-inline-actions,
.ui-card-actions,
.page-header-actions,
.ui-table-actions,
.ui-avatar-row,
.ui-setting-row,
.ui-activity-item,
.ui-profile-actions,
.ui-profile-statuses,
.ui-profile-title-row,
.ui-profile-copy-top,
.ui-avatar-upload-row,
.ui-modal-footer,
.ui-modal-header,
.ui-pagination,
.ui-pagination-wrap,
.ui-user-view-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ui-topbar-primary {
  flex: 1 1 auto;
  min-width: 0;
}

.ui-topbar-secondary {
  flex: 0 0 auto;
}

.ui-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: max-content;
}

.ui-brand-link {
  color: inherit;
  text-decoration: none;
}

.ui-brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, #206bc4 0%, #4299e1 100%);
}

.ui-brand h1 {
  margin: 0;
  font-size: 15px;
}

.ui-brand p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.ui-topnav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  min-width: 0;
  margin-inline-start: 16px;
}

.ui-topnav-item {
  padding: 10px 12px;
  border-radius: 12px;
  color: var(--muted);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.ui-topnav-item:hover,
.ui-topnav-item.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* shared buttons */
.ui-btn {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 600;
  transition: .18s ease;
}

.ui-btn:hover {
  transform: translateY(-1px);
}

.ui-btn-primary {
  background: var(--primary);
  color: #fff;
}

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

.ui-btn-secondary {
  border-color: var(--border);
}

.ui-btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--muted);
  box-shadow: none;
}

.ui-btn-danger {
  background: rgba(214, 57, 57, .08);
  color: var(--danger);
  border-color: rgba(214, 57, 57, .16);
  box-shadow: none;
}

.ui-btn-plain {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: var(--muted);
}

.ui-btn-plain:hover {
  color: var(--text);
  transform: none;
}

.ui-btn-sm {
  min-height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  font-size: 13px;
}

.ui-btn-icononly {
  width: 40px;
  padding: 0;
}

.ui-btn-icon {
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ui-btn-plain.ui-btn-icononly {
  width: 44px;
  min-height: 44px;
}

.ui-btn-plain .ui-btn-icon svg {
  width: 24px;
  height: 24px;
}

/* menus */
.ui-dropdown {
  position: relative;
}

.ui-user-trigger,
.ui-lang-trigger {
  min-height: 44px;
  padding: 0 4px 0 8px;
  border-radius: 12px;
  border: 0;
  background: transparent;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.ui-user-trigger-text {
  white-space: nowrap;
}

.ui-lang-flag {
  font-size: 18px;
  line-height: 1;
}

.ui-caret-icon {
  color: var(--muted);
}

.ui-dropdown-menu {
  position: absolute;
  inset-block-start: calc(100% + 10px);
  min-width: 220px;
  max-width: min(280px, calc(100vw - 24px));
  padding: 8px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  display: none;
  z-index: 30;
}

.ui-dropdown-menu.align-end {
  inset-inline-end: 0;
  inset-inline-start: auto;
}

.ui-dropdown-menu.align-start {
  inset-inline-start: 0;
  inset-inline-end: auto;
}

.ui-dropdown.open .ui-dropdown-menu {
  display: block;
}

.ui-dropdown-item {
  width: 100%;
  min-height: 40px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 0;
  background: transparent;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: start;
}

.ui-dropdown-item:hover,
.ui-lang-option.active {
  background: var(--surface-2);
}

.ui-dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 4px;
}

.ui-lang-check {
  margin-inline-start: auto;
}

/* page header */
.page-header-ui {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.page-header-copy {
  max-width: 820px;
}

.page-header-ui h2 {
  margin: 14px 0 0;
  font-size: 28px;
  line-height: 1.1;
}

.page-header-ui p {
  margin: 8px 0 0;
  color: var(--muted);
}

.page-header-actions {
  flex-wrap: wrap;
}

/* cards */
.ui-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.ui-card-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.ui-card-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.ui-card-subtitle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.ui-card-body {
  padding: 20px;
}

.ui-card-footer {
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

.ui-alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  background: #eef6ff;
  border: 1px solid #cfe4ff;
  color: #154377;
}

[data-theme="dark"] .ui-alert {
  background: rgba(32, 107, 196, .14);
  border-color: rgba(66, 153, 225, .24);
  color: #dbeafc;
}

.ui-metrics-grid,
.ui-quick-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.ui-content-grid {
  display: grid;
  grid-template-columns: 1.45fr .9fr;
  gap: 20px;
}

.ui-content-grid-profile-v2 {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 20px;
}

.ui-stat-card .ui-card-body {
  padding: 20px;
}

.ui-stat-label {
  color: var(--muted);
  font-size: 13px;
}

.ui-stat-value {
  margin-top: 10px;
  font-size: 28px;
  font-weight: 800;
}

.ui-stat-meta {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

/* table */
.ui-table-wrap {
  overflow: auto;
}

.ui-table {
  width: 100%;
  border-collapse: collapse;
}

.ui-table th,
.ui-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  white-space: nowrap;
  text-align: start;
}

.ui-table th {
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-weight: 700;
}

.ui-table tr:hover td {
  background: color-mix(in srgb, var(--surface-2) 55%, transparent);
}

.ui-table-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
}

.ui-avatar-row {
  gap: 12px;
}

.ui-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 800;
  flex: 0 0 auto;
  color: #1a4b85;
  background: linear-gradient(135deg, #dfe8f5, #b9cce7);
  background-size: cover;
  background-position: center;
}

.ui-avatar-sm {
  width: 28px;
  height: 28px;
  font-size: 11px;
}

.ui-avatar-lg {
  width: 56px;
  height: 56px;
  font-size: 18px;
}

.ui-avatar-hero {
  width: 88px;
  height: 88px;
  font-size: 28px;
  box-shadow: 0 14px 30px rgba(32, 107, 196, .18);
}

.ui-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid transparent;
}

.ui-badge-success {
  background: rgba(47, 179, 68, .10);
  color: #217a31;
  border-color: rgba(47, 179, 68, .18);
}

.ui-badge-warning {
  background: rgba(245, 159, 0, .12);
  color: #9a6500;
  border-color: rgba(245, 159, 0, .18);
}

.ui-badge-danger {
  background: rgba(214, 57, 57, .10);
  color: #a32b2b;
  border-color: rgba(214, 57, 57, .18);
}

.ui-badge-info {
  background: rgba(32, 107, 196, .10);
  color: #1957a3;
  border-color: rgba(32, 107, 196, .18);
}

.ui-badge-muted {
  background: var(--surface-2);
  color: #576779;
  border-color: var(--border);
}

/* pagination */
.ui-pagination-wrap {
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

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

.ui-pagination {
  flex-wrap: wrap;
}

.ui-page-btn {
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 700;
}

.ui-page-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* --- FORM SECTIONS (NEW) --- */
.ui-form-grid {
  display: grid;
  gap: 16px;
}

.ui-form-grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ui-field-span-2 {
  grid-column: 1 / -1;
}

.ui-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ui-field-label {
  font-size: 13px;
  color: var(--muted);
  font-weight: 700;
}

.ui-input,
.ui-textarea {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 12px;
  padding: 12px 14px;
  transition: border-color .2s;
}

.ui-input:focus,
.ui-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(32, 107, 196, 0.15);
}

.ui-input {
  min-height: 44px;
}

.ui-textarea {
  min-height: 120px;
  resize: vertical;
}

.ui-form-section-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
  margin: 24px 0 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ui-form-section-title:first-child {
  margin-top: 0;
}

.ui-form-section-title svg {
  color: var(--primary);
}

.ui-avatar-upload-row {
  align-items: center;
  flex-wrap: wrap;
}

/* --- MODAL UPDATES (NEW SOLID COLORS) --- */
.ui-modal-backdrop {
  position: fixed;
  inset: 0;
  padding: 24px;
  background: rgba(11, 18, 28, .5);
  display: grid;
  place-items: center;
  z-index: 80;
  backdrop-filter: blur(4px);
}

.ui-modal {
  width: min(100%, 760px);
  max-height: calc(100vh - 48px);
  overflow: auto;
  border-radius: 24px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.ui-modal-sm {
  width: min(100%, 460px);
}

.ui-modal-md {
  width: min(100%, 760px);
}

.ui-modal-lg {
  width: min(100%, 960px);
}

.ui-modal-header {
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.ui-modal-title {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
}

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

.ui-modal-footer {
  justify-content: flex-end;
  flex-wrap: wrap;
  padding: 20px 24px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

/* --- DELETE MODAL STYLES (NEW) --- */
.ui-delete-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 10px 0 20px;
}

.ui-delete-icon-wrap {
  width: 72px;
  height: 72px;
  border-radius: 36px;
  background: rgba(214, 57, 57, 0.1);
  color: var(--danger);
  display: grid;
  place-items: center;
  margin-bottom: 20px;
}

.ui-delete-icon-wrap svg {
  width: 36px;
  height: 36px;
}

.ui-delete-center h3 {
  margin: 0 0 10px;
  font-size: 20px;
  color: var(--text);
}

.ui-delete-copy {
  color: var(--muted);
  line-height: 1.6;
  font-size: 15px;
}


/* states */
.ui-state-empty,
.ui-state-loading,
.ui-state-error,
.ui-state-success {
  display: grid;
  gap: 10px;
}

.ui-spin {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

/* auth */
.ui-auth-wrap {
  max-width: 460px;
  margin: 48px auto;
}

.ui-form-error {
  color: var(--danger);
  font-size: 13px;
  line-height: 1.5;
  padding: 10px 14px;
  background: rgba(214, 57, 57, 0.1);
  border-radius: 10px;
  border: 1px solid rgba(214, 57, 57, 0.2);
}

.ui-code-block {
  white-space: pre-wrap;
  word-break: break-word;
  margin: 12px 0 0;
  padding: 14px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-family: monospace;
  font-size: 13px;
}

/* --- TOAST SYSTEM (FIXED) --- */
.ui-toast-stack {
  position: fixed;
  top: 24px;
  inset-inline-end: 24px;
  z-index: 9999;
  /* Brought way up */
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(360px, calc(100vw - 48px));
  pointer-events: none;
  /* Allows clicking behind toasts */
}

.ui-toast {
  pointer-events: auto;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  min-height: 60px;
  padding: 12px 16px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  animation: toast-slide-in 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes toast-slide-in {
  from {
    opacity: 0;
    transform: translateX(40px) scale(0.95);
  }

  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

/* Flips the animation start direction for Arabic/RTL */
html[dir="rtl"] .ui-toast {
  animation: toast-slide-in-rtl 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes toast-slide-in-rtl {
  from {
    opacity: 0;
    transform: translateX(-40px) scale(0.95);
  }

  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

.ui-toast-success {
  border-color: rgba(47, 179, 68, .3);
}

.ui-toast-danger {
  border-color: rgba(214, 57, 57, .3);
}

.ui-toast-info {
  border-color: rgba(32, 107, 196, .3);
}

.ui-toast-icon {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--surface-2);
}

.ui-toast-success .ui-toast-icon {
  background: rgba(47, 179, 68, .15);
  color: var(--success);
}

.ui-toast-danger .ui-toast-icon {
  background: rgba(214, 57, 57, .15);
  color: var(--danger);
}

.ui-toast-content {
  line-height: 1.45;
  font-size: 14px;
  font-weight: 500;
}

.ui-toast-close {
  width: 28px;
  height: 28px;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.ui-toast-close:hover {
  background: var(--surface-2);
  color: var(--text);
}


/* btn utilities */
.ui-btn.is-loading {
  opacity: .9;
}

.ui-btn:disabled,
.ui-page-btn:disabled {
  opacity: .65;
  cursor: not-allowed;
}

.ui-inline-actions a {
  text-decoration: none;
}


/* --- PREMIUM USER VIEW MODAL --- */
.ui-user-view-modal {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.ui-user-view-hero {
  background: linear-gradient(135deg, var(--primary) 0%, #4299e1 100%);
  border-radius: 20px;
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  color: #fff;
}

.ui-user-view-avatar {
  width: 84px;
  height: 84px;
  border-radius: 20px;
  border: 4px solid rgba(255, 255, 255, 0.2);
  background-color: rgba(255, 255, 255, 0.1);
  background-size: cover;
  background-position: center;
  display: grid;
  place-items: center;
  font-size: 28px;
  font-weight: 700;
  flex: 0 0 auto;
  color: #fff;
}

.ui-user-view-hero-main {
  min-width: 0;
  flex: 1 1 auto;
}

.ui-user-view-hero-main h3 {
  margin: 0 0 4px;
  font-size: 24px;
  font-weight: 700;
  color: #fff;
}

.ui-user-view-hero-main p {
  margin: 0 0 12px;
  color: rgba(255, 255, 255, 0.85);
  font-size: 14px;
}

.ui-user-view-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.ui-user-view-hero .ui-badge {
  background: rgba(255, 255, 255, 0.15);
  border-color: transparent;
  color: #fff;
}

.ui-user-view-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.ui-user-view-stat {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.ui-user-view-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(32, 107, 196, 0.08);
  color: var(--primary);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.ui-user-view-stat-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.ui-user-view-stat-copy span {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ui-user-view-stat-copy strong {
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ui-user-view-panel {
  padding: 20px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.ui-user-view-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 12px;
}

.ui-user-view-label svg {
  color: var(--primary);
}

/* --- INBOX LAYOUT (PREMIUM SPLIT PANE) --- */
.inbox-wrapper {
  display: grid;
  grid-template-columns: 400px minmax(0, 1fr);
  gap: 20px;
  height: calc(100vh - 150px);
  min-height: 600px;
}

.inbox-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.inbox-list-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.inbox-list-scroll {
  flex: 1;
  overflow-y: auto;
}

/* Enhanced Inbox List Item */
.inbox-item {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  border-inline-start: 3px solid transparent;
  position: relative;
}

.inbox-item:hover {
  background: var(--surface-2);
}

.inbox-item.is-selected {
  background: color-mix(in srgb, var(--primary) 8%, transparent);
  border-inline-start-color: var(--primary);
}

.inbox-item.is-unread .inbox-item-sender,
.inbox-item.is-unread .inbox-item-subject {
  font-weight: 800;
  color: var(--text);
}

.inbox-item-avatar-wrap {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 16px;
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
}

.inbox-item-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.inbox-item-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.inbox-item-sender {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inbox-item-subject {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Hover Quick Actions Wrapper */
.inbox-item-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

.inbox-item-time {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  transition: opacity 0.2s ease;
}

.inbox-item:hover .inbox-item-time {
  opacity: 0;
}

.inbox-item-quick-actions {
  position: absolute;
  inset-inline-end: 0;
  /* Automatically handles RTL */
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  gap: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.inbox-item:hover .inbox-item-quick-actions {
  opacity: 1;
  pointer-events: auto;
}

.inbox-quick-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 0;
  background: var(--surface);
  color: var(--muted);
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-sm);
  transition: .2s ease;
}

.inbox-quick-btn:hover {
  color: var(--primary);
  background: var(--surface-2);
  transform: scale(1.05);
}

.inbox-quick-btn.is-active {
  color: var(--warning);
}

/* Email Viewer Pane */
.inbox-view {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.inbox-view-toolbar {
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 65px;
}

.inbox-view-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.inbox-view-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--muted);
  gap: 16px;
  background: var(--surface-2);
}

.inbox-view-empty-icon {
  width: 80px;
  height: 80px;
  border-radius: 40px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  color: var(--muted);
}

.mobile-back-btn {
  display: none;
}

/* Email Message Components inside Viewer */
.ui-email-reader {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ui-email-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.ui-email-subject {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  margin: 0;
  line-height: 1.3;
}

.ui-email-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

.ui-email-sender {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ui-email-avatar {
  width: 44px;
  height: 44px;
  border-radius: 22px;
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 16px;
  font-weight: 700;
}

.ui-email-sender-info {
  display: flex;
  flex-direction: column;
}

.ui-email-sender-name {
  font-weight: 700;
  color: var(--text);
  font-size: 15px;
}

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

.ui-email-date {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.ui-email-body-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  /* min-height: 150px; */
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  /* overflow-x: auto; */
}

.ui-email-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}

.ui-email-attachment-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: .2s ease;
}

.ui-email-attachment-pill:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(32, 107, 196, 0.05);
}

/* logical RTL general settings */
html[dir="rtl"] body {
  text-align: start;
}

@media (max-width: 1200px) {

  .ui-content-grid,
  .ui-content-grid-profile-v2,
  .ui-userview-shell,
  .ui-profile-v2-grid,
  .ui-userview-grid {
    grid-template-columns: 1fr;
  }

  .ui-metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .ui-topbar {
    padding: 12px 16px;
    align-items: stretch;
    flex-direction: column;
  }

  .ui-topbar-primary,
  .ui-topbar-secondary {
    width: 100%;
    justify-content: space-between;
  }

  .ui-topnav {
    margin-inline: 0;
  }

  .ui-page {
    padding: 16px;
  }

  .inbox-wrapper {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 70vh;
  }

  .inbox-wrapper.view-active .inbox-list {
    display: none;
  }

  .inbox-wrapper.list-active .inbox-view {
    display: none;
  }

  .mobile-back-btn {
    display: inline-flex;
  }

  .inbox-view-scroll {
    padding: 16px;
  }

  .inbox-view-toolbar {
    padding: 12px 16px;
  }
}

@media (max-width: 760px) {

  .ui-form-grid-2,
  .ui-user-view-grid {
    grid-template-columns: 1fr;
  }

  .page-header-ui,
  .ui-card-header {
    flex-direction: column;
    align-items: stretch;
  }

  .page-header-actions,
  .ui-card-actions {
    width: 100%;
  }

  .ui-metrics-grid,
  .ui-quick-grid {
    grid-template-columns: 1fr;
  }

  .ui-user-view-hero {
    flex-direction: column;
    text-align: center;
  }

  .ui-user-view-badges {
    justify-content: center;
  }

  .ui-email-meta-row {
    flex-direction: column;
    gap: 12px;
  }
}

/* Modern Split Auth Layout */
.auth-split-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  min-height: 100vh;
  background: var(--surface);
  border-radius: 50px;
  overflow: hidden;
}

.auth-sidebar {
  background: linear-gradient(135deg, var(--primary) 0%, #4299e1 100%);
  color: #fff;
  padding: 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
}

.auth-sidebar-content {
  position: relative;
  z-index: 2;
  max-width: 480px;
  margin: 0 auto;
}

.auth-sidebar h1 {
  font-size: 42px;
  margin: 0 0 16px;
  line-height: 1.1;
}

.auth-sidebar p {
  font-size: 18px;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.6;
}

.auth-form-container {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}

.auth-form-box {
  width: 100%;
  max-width: 400px;
}

.auth-form-head {
  margin-bottom: 32px;
}

.auth-form-head h2 {
  font-size: 28px;
  margin: 0 0 8px;
}

.auth-form-head p {
  color: var(--muted);
  margin: 0;
}

.auth-switch-text {
  text-align: center;
  margin-top: 24px;
  color: var(--muted);
  font-size: 14px;
}

.auth-switch-text a {
  color: var(--primary);
  font-weight: 700;
  margin-inline-start: 6px;
}

.auth-switch-text a:hover {
  text-decoration: underline;
}

@media (max-width: 900px) {
  .auth-split-layout {
    grid-template-columns: 1fr;
  }

  .auth-sidebar {
    display: none;
  }
}

/* EXACT PROFILE MATCH CLEANED */
.profile-exact-page {
  display: grid;
  gap: 24px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px;
}

.profile-exact-headbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.profile-exact-headbar-title,
.profile-exact-headbar-actions,
.profile-exact-hero-meta,
.profile-exact-contact-item,
.profile-exact-inline-danger,
.profile-exact-inline-link,
.profile-exact-device-cell,
.profile-exact-role-badge {
  display: flex;
  align-items: center;
  gap: 12px;
}

.profile-exact-headbar-title h1 {
  margin: 0;
  font-size: 32px;
  font-weight: 600;
  color: var(--text);
}

.profile-exact-headbar-icon {
  width: 36px;
  height: 36px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--primary);
  font-size: 18px;
}

.profile-exact-btn {
  min-height: 46px;
  padding: 0 18px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  transition: .18s ease;
}

.profile-exact-btn:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.profile-exact-btn.danger-hover:hover {
  border-color: rgba(214, 57, 57, .3);
  background: rgba(214, 57, 57, .05);
  color: var(--danger);
}

.profile-exact-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 28px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.profile-exact-hero {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) 180px;
  align-items: center;
  gap: 24px;
  padding: 36px 32px;
  background: linear-gradient(90deg, #3b82f6, #1e40af);
  color: #fff;
}

.profile-exact-avatar-wrap {
  position: relative;
  flex: 0 0 auto;
}

.profile-exact-avatar {
  width: 112px;
  height: 112px;
  border-radius: 24px;
  overflow: hidden;
  border: 4px solid rgba(255, 255, 255, 0.3);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, .18);
  background: rgba(255, 255, 255, .18);
  background-size: cover;
  background-position: center;
  display: grid;
  place-items: center;
  font-size: 36px;
  font-weight: 700;
}

.profile-exact-avatar-status {
  position: absolute;
  bottom: 4px;
  inset-inline-end: 4px;
  width: 22px;
  height: 22px;
  border-radius: 12px;
  border: 3px solid #fff;
  background: #34d399;
}

.profile-exact-hero-main {
  flex: 1 1 auto;
  min-width: 0;
  text-align: start;
}

.profile-exact-hero-main h2 {
  margin: 0 0 6px;
  font-size: 38px;
  font-weight: 600;
}

.profile-exact-hero-main p {
  margin: 14px 0 0;
  color: #dbeafe;
  font-size: 18px;
}

.profile-exact-role-badge {
  min-height: 34px;
  padding: 0 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
}

.profile-exact-role-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #34d399;
}

.profile-exact-meta-sep,
.profile-exact-country-meta {
  color: #dbeafe;
  font-size: 14px;
}

.profile-exact-last-login {
  min-width: 180px;
  padding: 20px 24px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.1);
  text-align: center;
}

.profile-exact-last-login span {
  display: block;
  margin-bottom: 6px;
  color: #dbeafe;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .16em;
}

.profile-exact-last-login strong {
  display: block;
  font-size: 28px;
  font-weight: 600;
}

.profile-exact-last-login p {
  margin: 6px 0 0;
  color: #dbeafe;
  font-size: 14px;
}

.profile-exact-contact-grid {
  padding: 32px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 28px;
  border-bottom: 1px solid var(--border);
}

.profile-exact-contact-icon {
  width: 36px;
  height: 36px;
  border-radius: 18px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  background: rgba(32, 107, 196, 0.1);
  color: var(--primary);
}

.profile-exact-contact-copy p {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
}

.profile-exact-contact-copy strong {
  color: var(--text);
  font-weight: 500;
}

.profile-exact-section {
  padding: 32px;
}

.profile-exact-section+.profile-exact-section {
  padding-top: 0;
}

.profile-exact-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.profile-exact-section-head h3 {
  margin: 0 0 6px;
  color: var(--text);
  font-size: 22px;
  font-weight: 600;
}

.profile-exact-section-head p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.profile-exact-inline-danger,
.profile-exact-inline-link {
  border: 0;
  background: transparent;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 13px;
  font-weight: 500;
}

.profile-exact-inline-danger {
  color: var(--danger);
}

.profile-exact-inline-danger:hover {
  background: rgba(214, 57, 57, .1);
}

.profile-exact-inline-link {
  color: var(--primary);
}

.profile-exact-inline-link:hover {
  background: rgba(32, 107, 196, .1);
}

.profile-exact-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 24px;
}

.profile-exact-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 760px;
}

.profile-exact-table thead th {
  padding: 18px 24px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .06em;
  text-align: start;
}

.profile-exact-table .is-center {
  text-align: center !important;
}

.profile-exact-table tbody td {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
  text-align: start;
}

.profile-exact-table tbody tr:last-child td {
  border-bottom: 0;
}

.profile-exact-table tbody tr:hover td {
  background: var(--surface-2);
}

.profile-exact-table tbody tr.is-current td {
  background: rgba(32, 107, 196, 0.08);
}

.profile-exact-device-icon {
  width: 32px;
  height: 32px;
  border-radius: 16px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
}

.profile-exact-device-icon.is-desktop {
  background: rgba(32, 107, 196, 0.1);
  color: var(--primary);
}

.profile-exact-device-icon.is-mobile {
  background: rgba(147, 51, 234, 0.1);
  color: #a855f7;
}

.profile-exact-device-copy strong {
  color: var(--text);
  font-weight: 500;
}

.profile-exact-device-copy span {
  color: var(--success);
  font-size: 12px;
}

.profile-exact-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.profile-exact-pill-btn {
  min-height: 30px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
}

.profile-exact-pill-btn:hover {
  background: var(--surface-2);
}

.profile-exact-status-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}

.profile-exact-status-chip.is-success {
  background: rgba(47, 179, 68, .10);
  color: var(--success);
}

.profile-exact-status-chip.is-danger {
  background: rgba(214, 57, 57, .10);
  color: var(--danger);
}

.profile-exact-empty {
  text-align: center !important;
  color: var(--muted) !important;
}

@media (max-width: 980px) {
  .profile-exact-hero {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .profile-exact-hero-main {
    justify-self: center;
    text-align: center;
  }

  .profile-exact-hero-meta {
    justify-content: center;
    flex-wrap: wrap;
  }

  .profile-exact-contact-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {

  .profile-exact-headbar,
  .profile-exact-section-head {
    flex-direction: column;
    align-items: stretch;
  }

  .profile-exact-headbar-actions {
    width: 100%;
    flex-direction: column;
  }

  .profile-exact-btn {
    width: 100%;
    justify-content: center;
  }

  .profile-exact-card,
  .profile-exact-section,
  .profile-exact-contact-grid,
  .profile-exact-hero {
    padding-left: 16px;
    padding-right: 16px;
  }

  .profile-exact-hero {
    padding-top: 24px;
    padding-bottom: 24px;
  }
}
/* Inbox page */
.nexus-page {
  --nexus-primary: #00d4ff;
  --nexus-primary-strong: #00b8ff;
  --nexus-shell-bg: #eef4f9;
  --nexus-bg: #f7fbff;
  --nexus-sidebar-bg: #f4f9fd;
  --nexus-panel-bg: #ffffff;
  --nexus-hover: #f6fbff;
  --nexus-selected: #eef8ff;
  --nexus-border: rgba(19, 31, 53, 0.09);
  --nexus-border-soft: rgba(19, 31, 53, 0.06);
  --nexus-text: #0f172a;
  --nexus-text-soft: rgba(15, 23, 42, 0.72);
  --nexus-text-muted: rgba(15, 23, 42, 0.48);
  --nexus-toast-bg: #111111;
  --nexus-toast-text: #ffffff;
  --nexus-danger: #ef4444;
  width: 100vw;
  margin: -24px calc(50% - 50vw);
  min-height: calc(100vh - 72px);
  background: var(--nexus-shell-bg);
  color: var(--nexus-text);
  overflow: hidden;
}

[data-theme="dark"] .nexus-page {
  --nexus-shell-bg: #050505;
  --nexus-bg: #050505;
  --nexus-sidebar-bg: #0a0a0a;
  --nexus-panel-bg: #050505;
  --nexus-hover: #0a0a0a;
  --nexus-selected: #111111;
  --nexus-border: rgba(255, 255, 255, 0.1);
  --nexus-border-soft: rgba(255, 255, 255, 0.05);
  --nexus-text: #ffffff;
  --nexus-text-soft: rgba(255, 255, 255, 0.8);
  --nexus-text-muted: rgba(255, 255, 255, 0.4);
  --nexus-toast-bg: #111111;
  --nexus-toast-text: #ffffff;
}

.nexus-page * {
  box-sizing: border-box;
}

.nexus-app-shell {
  display: flex;
  min-height: inherit;
  background: var(--nexus-bg);
}

.nexus-sidebar {
  width: 18rem;
  background: var(--nexus-sidebar-bg);
  border-right: 1px solid var(--nexus-border);
  display: flex;
  flex-direction: column;
}

.nexus-sidebar-head {
  padding: 24px;
  border-bottom: 1px solid var(--nexus-border);
}

.nexus-folder-chip,
.nexus-nav-item,
.nexus-label-pill,
.nexus-text-action,
.nexus-icon-button,
.nexus-star-button,
.nexus-reply-button,
.nexus-forward-button,
.nexus-preview-star,
.nexus-compose-close,
.nexus-compose-tool,
.nexus-summary-dismiss,
.nexus-tip-chip,
.nexus-send-button {
  border: 0;
  background: transparent;
  color: inherit;
}

.nexus-folder-chip {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-radius: 24px;
  cursor: pointer;
}

.nexus-folder-chip:hover,
.nexus-folder-chip.is-active {
  background: rgba(255, 255, 255, 0.04);
}

[data-theme="light"] .nexus-folder-chip:hover,
[data-theme="light"] .nexus-folder-chip.is-active {
  background: rgba(19, 31, 53, 0.04);
}

.nexus-folder-chip-left,
.nexus-list-heading,
.nexus-list-actions,
.nexus-preview-sender,
.nexus-preview-actions,
.nexus-preview-footer,
.nexus-preview-footer-links,
.nexus-compose-head,
.nexus-compose-footer,
.nexus-compose-tools,
.nexus-summary-label,
.nexus-sidebar-footer,
.nexus-email-row-inner,
.nexus-email-row-top {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nexus-folder-count {
  font-size: 12px;
  font-weight: 700;
  min-width: 32px;
  height: 24px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--nexus-primary);
  color: #000000;
}

.nexus-sidebar-nav {
  flex: 1 1 auto;
  padding: 8px 12px 12px;
  overflow-y: auto;
}

.nexus-nav-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.nexus-nav-list li + li {
  margin-top: 4px;
}

.nexus-nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 24px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 500;
  color: var(--nexus-text-soft);
  cursor: pointer;
  text-align: left;
}

.nexus-nav-item:hover,
.nexus-nav-item.is-active {
  color: var(--nexus-text);
  background: rgba(255, 255, 255, 0.04);
}

[data-theme="light"] .nexus-nav-item:hover,
[data-theme="light"] .nexus-nav-item.is-active {
  background: rgba(19, 31, 53, 0.04);
}

.nexus-sidebar-divider {
  margin: 24px;
  border-top: 1px solid var(--nexus-border);
}

.nexus-labels-title {
  padding: 0 24px;
  margin-bottom: 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--nexus-text-muted);
  letter-spacing: 0.08em;
}

.nexus-label-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nexus-label-pill {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 24px;
  cursor: pointer;
  text-align: left;
}

.nexus-label-pill:hover,
.nexus-label-pill.is-active {
  background: rgba(255, 255, 255, 0.04);
}

[data-theme="light"] .nexus-label-pill:hover,
[data-theme="light"] .nexus-label-pill.is-active {
  background: rgba(19, 31, 53, 0.04);
}

.nexus-label-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  flex: 0 0 auto;
}

.nexus-label-dot.tone-work {
  background: #34d399;
}

.nexus-label-dot.tone-personal {
  background: #fbbf24;
}

.nexus-label-dot.tone-finance {
  background: #c084fc;
}

.nexus-label-dot.tone-travel {
  background: #fb7185;
}

.nexus-sidebar-footer {
  justify-content: center;
  gap: 4px;
  padding: 16px;
  font-size: 10px;
  color: var(--nexus-text-muted);
  border-top: 1px solid var(--nexus-border);
}

.nexus-sidebar-footer-ai {
  color: var(--nexus-primary);
}

.nexus-list-pane {
  flex: 1 1 auto;
  max-width: 460px;
  min-width: 360px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--nexus-border);
  background: var(--nexus-panel-bg);
}

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

.nexus-list-heading {
  gap: 16px;
}

.nexus-list-heading h2,
.nexus-preview-meta h1,
.nexus-empty-state h3,
.nexus-compose-head h2 {
  margin: 0;
}

.nexus-list-heading h2 {
  font-size: 24px;
  font-weight: 600;
}

.nexus-list-heading span,
.nexus-preview-email,
.nexus-preview-meta p,
.nexus-preview-footer-links,
.nexus-compose-row span,
.nexus-sidebar-footer,
.nexus-empty-state p,
.nexus-labels-title,
.nexus-email-date,
.nexus-email-snippet {
  color: var(--nexus-text-muted);
}

.nexus-text-action {
  padding: 0 16px;
  height: 32px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}

.nexus-text-action:hover,
.nexus-icon-button:hover,
.nexus-preview-star:hover,
.nexus-compose-close:hover,
.nexus-compose-tool:hover,
.nexus-summary-dismiss:hover {
  background: rgba(255, 255, 255, 0.06);
}

[data-theme="light"] .nexus-text-action:hover,
[data-theme="light"] .nexus-icon-button:hover,
[data-theme="light"] .nexus-preview-star:hover,
[data-theme="light"] .nexus-compose-close:hover,
[data-theme="light"] .nexus-compose-tool:hover,
[data-theme="light"] .nexus-summary-dismiss:hover {
  background: rgba(19, 31, 53, 0.05);
}

.nexus-icon-button,
.nexus-preview-star {
  width: 36px;
  height: 36px;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.nexus-icon-button.is-danger {
  color: var(--nexus-danger);
}

.nexus-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.nexus-icon svg {
  display: block;
  width: 100%;
  height: 100%;
}

.nexus-icon-sm {
  width: 16px;
  height: 16px;
}

.nexus-icon-md {
  width: 20px;
  height: 20px;
}

.nexus-icon-lg {
  width: 22px;
  height: 22px;
}

.nexus-icon-xl {
  width: 36px;
  height: 36px;
}

.nexus-email-list {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 8px 0;
}

.nexus-list-empty,
.nexus-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.nexus-list-empty {
  height: 256px;
  color: var(--nexus-text-muted);
  text-align: center;
}

.nexus-list-empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.nexus-list-empty-title {
  margin: 0;
  font-weight: 500;
}

.nexus-email-row {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--nexus-border-soft);
  background: transparent;
  padding: 16px 24px;
  cursor: pointer;
  text-align: left;
  color: inherit;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.nexus-email-row:hover {
  background: var(--nexus-hover);
  transform: translateX(2px);
}

.nexus-email-row.is-selected {
  background: var(--nexus-selected);
  box-shadow: inset 4px 0 0 var(--nexus-primary);
}

.nexus-email-row-inner {
  align-items: flex-start;
  width: 100%;
}

.nexus-email-checkbox {
  margin-top: 3px;
  accent-color: var(--nexus-primary);
}

.nexus-star-button {
  padding: 0;
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fbbf24;
  cursor: pointer;
}

.nexus-email-copy {
  flex: 1 1 auto;
  min-width: 0;
}

.nexus-email-row-top {
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.nexus-email-from,
.nexus-email-subject,
.nexus-email-snippet,
.nexus-preview-body {
  overflow: hidden;
}

.nexus-email-from,
.nexus-email-subject,
.nexus-email-snippet {
  margin: 0;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.nexus-email-from.is-read,
.nexus-email-subject.is-read {
  color: var(--nexus-text-soft);
  font-weight: 500;
}

.nexus-email-from.is-unread,
.nexus-email-subject.is-unread {
  color: var(--nexus-text);
  font-weight: 600;
}

.nexus-email-subject {
  font-size: 14px;
  margin-top: 2px;
}

.nexus-email-snippet {
  font-size: 12px;
  margin-top: 2px;
}

.nexus-email-date {
  font-size: 12px;
  white-space: nowrap;
  margin: 0;
}

.nexus-preview-pane {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  background: var(--nexus-panel-bg);
  min-width: 0;
}

.nexus-empty-state {
  flex: 1 1 auto;
  gap: 0;
  text-align: center;
  padding: 40px 24px;
}

.nexus-empty-icon {
  width: 64px;
  height: 64px;
  margin-bottom: 24px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--nexus-text-muted);
}

[data-theme="light"] .nexus-empty-icon {
  background: rgba(19, 31, 53, 0.04);
}

.nexus-empty-state h3 {
  font-size: 24px;
  font-weight: 500;
  color: var(--nexus-text-soft);
}

.nexus-empty-state p {
  max-width: 220px;
  margin: 8px 0 0;
  font-size: 14px;
}

.nexus-tip-chip {
  margin-top: 48px;
  padding: 0 16px;
  height: 28px;
  border-radius: 24px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--nexus-primary);
  background: linear-gradient(90deg, color-mix(in srgb, var(--nexus-primary) 10%, transparent) 0%, transparent 100%);
  border: 1px solid color-mix(in srgb, var(--nexus-primary) 20%, transparent);
  cursor: pointer;
}

.nexus-tip-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--nexus-primary);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--nexus-primary) 80%, transparent);
  animation: nexus-pulse 1.7s infinite;
}

@keyframes nexus-pulse {
  0% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--nexus-primary) 45%, transparent);
  }

  70% {
    box-shadow: 0 0 0 8px transparent;
  }

  100% {
    box-shadow: 0 0 0 0 transparent;
  }
}

.nexus-preview-content {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

.nexus-preview-header,
.nexus-preview-meta {
  padding: 20px 32px;
  border-bottom: 1px solid var(--nexus-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.nexus-preview-avatar {
  width: 36px;
  height: 36px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 600;
  color: #ffffff;
  background: linear-gradient(135deg, #22d3ee 0%, #3b82f6 100%);
}

.nexus-preview-name {
  font-size: 18px;
  font-weight: 600;
}

.nexus-preview-email {
  font-size: 14px;
}

.nexus-reply-button {
  padding: 0 20px;
  height: 36px;
  border-radius: 24px;
  border: 1px solid var(--nexus-border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.nexus-reply-button:hover,
.nexus-forward-button:hover {
  border-color: var(--nexus-primary);
}

.nexus-preview-meta {
  align-items: baseline;
}

.nexus-preview-meta h1 {
  font-size: 32px;
  line-height: 1.2;
  font-weight: 600;
}

.nexus-preview-meta p {
  margin: 4px 0 0;
  font-size: 14px;
}

.nexus-preview-star.is-starred {
  color: #fbbf24;
}

.nexus-preview-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 32px;
  color: var(--nexus-text-soft);
  line-height: 1.7;
  font-size: 15.2px;
}

.nexus-preview-body > div > *:first-child,
.nexus-summary-card > *:first-child {
  margin-top: 0;
}

.nexus-preview-body > div > *:last-child,
.nexus-summary-card > *:last-child {
  margin-bottom: 0;
}

.nexus-preview-body ul {
  padding-left: 20px;
  margin: 16px 0;
}

.nexus-preview-body li + li {
  margin-top: 8px;
}

.nexus-summary-card {
  border: 1px solid color-mix(in srgb, var(--nexus-primary) 30%, transparent);
  border-radius: 24px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.05);
  font-size: 14px;
}

[data-theme="light"] .nexus-summary-card {
  background: rgba(19, 31, 53, 0.03);
}

.nexus-summary-label {
  margin-bottom: 12px;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  color: var(--nexus-primary);
  letter-spacing: 0.08em;
}

.nexus-summary-dismiss {
  margin-top: 24px;
  padding: 0;
  font-size: 12px;
  color: var(--nexus-primary);
  text-decoration: underline;
  cursor: pointer;
}

.nexus-preview-footer {
  justify-content: space-between;
  padding: 20px 32px;
  border-top: 1px solid var(--nexus-border);
  background: rgba(255, 255, 255, 0.05);
}

[data-theme="light"] .nexus-preview-footer {
  background: rgba(19, 31, 53, 0.03);
}

.nexus-forward-button {
  padding: 0 24px;
  height: 36px;
  border-radius: 24px;
  border: 1px solid var(--nexus-border);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.nexus-preview-footer-links {
  gap: 20px;
  font-size: 12px;
}

.nexus-preview-footer-links button {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 0;
}

.nexus-preview-dot {
  color: color-mix(in srgb, var(--nexus-text) 20%, transparent);
}

.nexus-ai-link {
  color: var(--nexus-primary) !important;
}

.nexus-compose-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.nexus-compose-modal {
  width: min(100%, 768px);
  background: var(--nexus-sidebar-bg);
  color: var(--nexus-text);
  border-radius: 24px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  animation: nexus-modal-pop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.nexus-compose-head {
  justify-content: space-between;
  padding: 24px 32px 16px;
  border-bottom: 1px solid var(--nexus-border);
}

.nexus-compose-close {
  width: 32px;
  height: 32px;
  border-radius: 16px;
  font-size: 18px;
  cursor: pointer;
}

.nexus-compose-form {
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.nexus-compose-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--nexus-border);
}

.nexus-compose-row span {
  width: 64px;
  font-size: 14px;
}

.nexus-compose-row input,
.nexus-compose-form textarea {
  width: 100%;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--nexus-text);
}

.nexus-compose-row input::placeholder,
.nexus-compose-form textarea::placeholder {
  color: color-mix(in srgb, var(--nexus-text) 30%, transparent);
}

.nexus-compose-form textarea {
  resize: none;
  font-size: 15px;
}

.nexus-compose-footer {
  justify-content: space-between;
}

.nexus-compose-tools {
  gap: 16px;
}

.nexus-compose-tool {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  color: var(--nexus-text-soft);
  cursor: pointer;
}

.nexus-send-button {
  min-width: 132px;
  height: 48px;
  padding: 0 24px;
  border-radius: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 600;
  color: #000000;
  background: var(--nexus-primary);
  cursor: pointer;
}

.nexus-send-button:hover {
  background: #00e6ff;
}

.nexus-toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 110;
  border: 0;
  border-radius: 24px;
  padding: 16px 24px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: var(--nexus-toast-bg);
  color: var(--nexus-toast-text);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.24);
  font-size: 14px;
  cursor: pointer;
}

@keyframes nexus-modal-pop {
  0% {
    opacity: 0;
    transform: scale(0.95) translateY(20px);
  }

  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@media (max-width: 1200px) {
  .nexus-sidebar {
    width: 260px;
  }

  .nexus-list-pane {
    min-width: 320px;
    max-width: 400px;
  }

  .nexus-preview-meta h1 {
    font-size: 26px;
  }
}


/* === Rebuilt inbox design === */
.mailhub-page {
  width: 100vw;
  margin: -24px calc(50% - 50vw);
  min-height: calc(100vh - 72px);
  background: var(--surface);
  color: var(--text);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.mailhub-shell {
  display: grid;
  grid-template-columns: minmax(340px, 460px) minmax(0, 1fr);
  min-height: inherit;
}

.mailhub-list-pane,
.mailhub-view-pane {
  min-width: 0;
  background: var(--surface);
}

.mailhub-list-pane {
  border-inline-end: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.mailhub-top {
  padding: 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--surface);
}

.mailhub-head,
.mailhub-toolbar,
.mailhub-email-row,
.mailhub-search,
.mailhub-chip-row,
.mailhub-msg-head,
.mailhub-msg-toolbar,
.mailhub-msg-meta,
.mailhub-msg-actions,
.mailhub-empty,
.mailhub-pill,
.mailhub-attachment {
  display: flex;
  align-items: center;
}

.mailhub-head {
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.mailhub-title-wrap {
  min-width: 0;
  flex: 1 1 240px;
}

.mailhub-title {
  margin: 0;
  font-size: 28px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.mailhub-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.mailhub-toolbar {
  gap: 10px;
  flex-wrap: wrap;
}

.mailhub-btn {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 600;
  transition: background .16s ease, color .16s ease, border-color .16s ease;
}

.mailhub-btn:hover {
  background: var(--surface-2);
}

.mailhub-btn-icon {
  width: 40px;
  padding: 0;
}

.mailhub-email-row {
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.mailhub-email-main {
  min-width: 0;
  flex: 1 1 260px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.mailhub-email-chip {
  display: inline-flex;
  align-items: center;
  max-width: min(100%, 420px);
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mailhub-copy-btn,
.mailhub-expiry {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
}

.mailhub-copy-btn:hover {
  color: var(--text);
  background: var(--surface-2);
}

.mailhub-expiry {
  background: color-mix(in srgb, var(--warning) 10%, var(--surface));
  color: #9a6500;
  border-color: color-mix(in srgb, var(--warning) 18%, var(--border));
}

[data-theme="dark"] .mailhub-expiry {
  color: #ffd87c;
  background: rgba(245, 159, 0, .12);
  border-color: rgba(245, 159, 0, .22);
}

.mailhub-search {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  gap: 10px;
  padding: 0 14px;
  color: var(--muted);
}

.mailhub-search input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  outline: none;
}

.mailhub-search input::placeholder {
  color: var(--muted);
}

.mailhub-chip-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mailhub-chip-row {
  flex-wrap: wrap;
  gap: 8px;
}

.mailhub-pill {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  transition: background .16s ease, color .16s ease, border-color .16s ease;
}

.mailhub-pill:hover,
.mailhub-pill.is-active {
  color: var(--text);
  background: var(--surface-2);
  border-color: var(--border-strong);
}

.mailhub-pill-count {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: color-mix(in srgb, var(--primary) 14%, transparent);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
}

.mailhub-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  flex: 0 0 auto;
}

.mailhub-dot-work { background: #34d399; }
.mailhub-dot-personal { background: #fbbf24; }
.mailhub-dot-finance { background: #a855f7; }
.mailhub-dot-travel { background: #fb7185; }

.mailhub-list-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

.mailhub-item {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  text-align: start;
  color: inherit;
  transition: background .16s ease;
}

.mailhub-item:hover {
  background: var(--surface-2);
}

.mailhub-item.is-selected {
  background: color-mix(in srgb, var(--primary) 7%, var(--surface));
  box-shadow: inset 2px 0 0 var(--primary);
}

.mailhub-avatar {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  flex: 0 0 auto;
}

.mailhub-item-main {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mailhub-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.mailhub-item-from,
.mailhub-item-subject,
.mailhub-item-snippet {
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mailhub-item-from {
  font-size: 14px;
  font-weight: 700;
}

.mailhub-item-subject {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.mailhub-item-snippet,
.mailhub-item-date {
  font-size: 12px;
  color: var(--muted);
}

.mailhub-item.read .mailhub-item-from,
.mailhub-item.read .mailhub-item-subject {
  font-weight: 600;
}

.mailhub-item-meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.mailhub-icon-btn {
  width: 28px;
  height: 28px;
  border: 0;
  background: transparent;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.mailhub-icon-btn:hover,
.mailhub-icon-btn.is-active {
  color: var(--primary);
}

.mailhub-view-pane {
  display: flex;
  min-width: 0;
  min-height: 0;
}

.mailhub-empty {
  width: 100%;
  min-height: inherit;
  justify-content: center;
  flex-direction: column;
  gap: 10px;
  color: var(--muted);
  padding: 36px 24px;
  text-align: center;
}

.mailhub-empty-icon {
  width: 72px;
  height: 72px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  background: var(--surface-2);
  margin-bottom: 4px;
}

.mailhub-empty h3 {
  margin: 0;
  font-size: 22px;
  color: var(--text);
}

.mailhub-empty p {
  margin: 0;
  max-width: 260px;
}

.mailhub-view {
  width: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.mailhub-msg-head,
.mailhub-msg-meta {
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.mailhub-msg-head {
  align-items: center;
}

.mailhub-msg-from {
  min-width: 0;
  flex: 1 1 auto;
}

.mailhub-msg-name {
  font-size: 16px;
  font-weight: 800;
  margin: 0;
}

.mailhub-msg-email,
.mailhub-msg-date {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.mailhub-msg-actions {
  gap: 8px;
  flex-wrap: wrap;
}

.mailhub-msg-subject {
  margin: 0;
  font-size: 28px;
  line-height: 1.15;
  font-weight: 800;
}

.mailhub-msg-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 24px;
  color: var(--text);
  line-height: 1.7;
  font-size: 14px;
}

.mailhub-msg-body > div {
  max-width: 860px;
}

.mailhub-msg-body ul {
  padding-inline-start: 20px;
}

.mailhub-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.mailhub-attachment {
  min-height: 38px;
  padding: 0 12px;
  gap: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.mailhub-attachment small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.mailhub-summary {
  border: 1px solid color-mix(in srgb, var(--primary) 30%, var(--border));
  background: color-mix(in srgb, var(--primary) 6%, var(--surface));
  padding: 16px;
}

.mailhub-summary-label {
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  margin-bottom: 10px;
}

.mailhub-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.mailhub-footer-links {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.mailhub-link {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.mailhub-link:hover,
.mailhub-link.is-ai {
  color: var(--primary);
}

.mailhub-compose-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11, 18, 28, .46);
  display: grid;
  place-items: center;
  padding: 24px;
  z-index: 80;
}

.mailhub-compose {
  width: min(100%, 760px);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}

.mailhub-compose-head,
.mailhub-compose-foot,
.mailhub-compose-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mailhub-compose-head,
.mailhub-compose-foot {
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}

.mailhub-compose-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.mailhub-compose-row {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.mailhub-compose-row span {
  width: 64px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.mailhub-compose input,
.mailhub-compose textarea {
  width: 100%;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
}

.mailhub-compose textarea {
  min-height: 220px;
  resize: vertical;
}

.mailhub-compose-tools {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.mailhub-toast {
  position: fixed;
  inset-inline-end: 24px;
  bottom: 24px;
  z-index: 90;
  background: var(--text);
  color: var(--surface);
  padding: 14px 18px;
  font-size: 14px;
  font-weight: 700;
  box-shadow: var(--shadow-lg);
}

@media (max-width: 980px) {
  .mailhub-page {
    width: 100%;
    margin: 0;
    min-height: calc(100vh - 72px);
  }

  .mailhub-shell {
    grid-template-columns: 1fr;
  }

  .mailhub-list-pane {
    border-inline-end: 0;
    border-bottom: 1px solid var(--border);
  }

  .mailhub-view-pane {
    min-height: 56vh;
  }

  .mailhub-top,
  .mailhub-msg-head,
  .mailhub-msg-meta,
  .mailhub-msg-body,
  .mailhub-footer {
    padding-inline: 16px;
  }
}

@media (max-width: 720px) {
  .mailhub-title {
    font-size: 24px;
  }

  .mailhub-head,
  .mailhub-email-row,
  .mailhub-msg-head,
  .mailhub-msg-meta,
  .mailhub-footer,
  .mailhub-compose-head,
  .mailhub-compose-foot {
    align-items: stretch;
    flex-direction: column;
  }

  .mailhub-toolbar,
  .mailhub-msg-actions,
  .mailhub-footer-links {
    width: 100%;
    justify-content: flex-start;
  }

  .mailhub-btn,
  .mailhub-reply-wide {
    width: 100%;
  }

  .mailhub-btn-icon {
    width: 40px;
  }

  .mailhub-search {
    min-height: 44px;
  }

  .mailhub-msg-subject {
    font-size: 22px;
  }

  .mailhub-compose-overlay {
    padding: 0;
  }

  .mailhub-compose {
    width: 100%;
    min-height: 100vh;
  }
}


/* Inbox page - messages redesign */
.messages-react-page,
.messages-react-page *,
.messages-react-page *::before,
.messages-react-page *::after {
  box-sizing: border-box;
}

.messages-react-page {
  --messages-surface: var(--surface);
  --messages-surface-2: var(--surface-2);
  --messages-text: var(--text);
  --messages-muted: var(--muted);
  --messages-border: var(--border);
  --messages-border-strong: var(--border-strong);
  --messages-primary: var(--primary);
  --messages-danger: var(--danger);
  --messages-warning: var(--warning);
  --messages-shadow: var(--shadow-sm);
  --messages-shadow-2: var(--shadow-md);
  --messages-accent-bg: color-mix(in srgb, var(--primary) 10%, var(--surface));
  --messages-accent-text: color-mix(in srgb, var(--primary) 88%, black 12%);
  --messages-warning-bg: color-mix(in srgb, var(--warning) 12%, var(--surface));
  --messages-warning-text: color-mix(in srgb, var(--warning) 78%, black 22%);
  width: 100vw;
  height: calc(100vh - 72px);
  min-height: calc(100vh - 72px);
  margin: -24px calc(50% - 50vw) 0;
  background: transparent;
  font-family: 'DM Sans', system-ui, sans-serif;
  color: var(--messages-text);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

.messages-react-page .shell {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 20px 24px 16px;
  overflow: hidden;
}

.messages-react-page .messages-loading-shell {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  font-size: 14px;
  color: var(--messages-muted);
}

.messages-react-page .subheader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0 14px;
  flex-shrink: 0;
  gap: 12px;
  flex-wrap: wrap;
}

.messages-react-page .subheader-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.messages-react-page .email-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--messages-surface);
  border: 1px solid var(--messages-border);
  border-radius: 22px;
  padding: 6px 6px 6px 16px;
  box-shadow: var(--messages-shadow);
}

.messages-react-page .email-addr {
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  color: var(--messages-text);
  letter-spacing: -0.2px;
}

.messages-react-page .copy-btn {
  height: 28px;
  padding: 0 12px;
  background: var(--messages-accent-bg);
  color: var(--messages-accent-text);
  border: 0;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  font-family: 'DM Sans', system-ui, sans-serif;
  cursor: pointer;
  transition: background 0.15s ease;
  display: flex;
  align-items: center;
  gap: 5px;
}

.messages-react-page .copy-btn:hover {
  background: color-mix(in srgb, var(--primary) 16%, var(--surface));
}

.messages-react-page .copy-btn svg {
  width: 12px;
  height: 12px;
}

.messages-react-page .timer-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 12px;
  background: var(--messages-warning-bg);
  border-radius: 999px;
}

.messages-react-page .timer-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--messages-warning);
  animation: messagesBlink 1.4s infinite;
}

@keyframes messagesBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.2; }
}

.messages-react-page .timer-val {
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  font-weight: 500;
  color: var(--messages-warning-text);
}

.messages-react-page .filters {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.messages-react-page .filter-btn {
  height: 32px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  font-family: 'DM Sans', system-ui, sans-serif;
  border: 1px solid transparent;
  background: none;
  color: var(--messages-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.messages-react-page .filter-btn:hover {
  background: var(--messages-surface);
  border-color: var(--messages-border);
  color: var(--messages-text);
}

.messages-react-page .filter-btn.active {
  background: var(--messages-text);
  color: var(--messages-surface);
  border-color: var(--messages-text);
}

.messages-react-page .filter-count {
  font-size: 11px;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 999px;
}

.messages-react-page .filter-btn.active .filter-count {
  background: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.85);
}

.messages-react-page .filter-btn:not(.active) .filter-count {
  background: var(--messages-surface-2);
  color: var(--messages-muted);
}

.messages-react-page .split {
  display: flex;
  flex: 1;
  min-height: 0;
  gap: 12px;
  overflow: hidden;
}

.messages-react-page .msg-list-panel,
.messages-react-page .preview-panel {
  background: var(--messages-surface);
  border: 1px solid var(--messages-border);
  border-radius: 22px;
  box-shadow: var(--messages-shadow);
}

.messages-react-page .msg-list-panel {
  width: 300px;
  min-width: 300px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.messages-react-page .msg-list-inner {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px;
}

.messages-react-page .msg-list-inner::-webkit-scrollbar,
.messages-react-page .preview-body-wrap::-webkit-scrollbar {
  width: 4px;
}

.messages-react-page .msg-list-inner::-webkit-scrollbar-thumb,
.messages-react-page .preview-body-wrap::-webkit-scrollbar-thumb {
  background: var(--messages-border-strong);
  border-radius: 999px;
}

.messages-react-page .msg-item {
  display: flex;
  gap: 10px;
  padding: 10px 10px 10px 12px;
  border-radius: 16px;
  cursor: pointer;
  transition: background 0.12s ease;
  position: relative;
  border: 0;
  border-inline-start: 3px solid transparent;
  animation: messagesItemIn 0.2s ease both;
  width: 100%;
  text-align: initial;
  background: transparent;
}

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

.messages-react-page .msg-item:hover {
  background: var(--messages-surface-2);
}

.messages-react-page .msg-item.active {
  background: var(--messages-accent-bg);
  border-inline-start-color: var(--messages-primary);
}

.messages-react-page .msg-item.unread .msg-sender {
  font-weight: 700;
}

.messages-react-page .msg-avatar,
.messages-react-page .preview-avatar,
.messages-react-page .attach-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.messages-react-page .msg-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.messages-react-page .msg-content {
  flex: 1;
  min-width: 0;
}

.messages-react-page .msg-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 2px;
}

.messages-react-page .msg-sender {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--messages-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.messages-react-page .msg-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.messages-react-page .msg-time {
  font-size: 11px;
  font-family: 'DM Mono', monospace;
  color: var(--messages-muted);
  white-space: nowrap;
}

.messages-react-page .msg-unread-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--messages-primary);
  flex: 0 0 auto;
}

.messages-react-page .msg-attachment-icon {
  width: 14px;
  height: 14px;
  color: var(--messages-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.messages-react-page .msg-attachment-icon svg {
  width: 14px;
  height: 14px;
}

.messages-react-page .msg-subject {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--messages-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.messages-react-page .msg-preview {
  font-size: 12px;
  color: var(--messages-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.messages-react-page .msg-item.active .msg-sender,
.messages-react-page .msg-item.active .msg-subject {
  color: var(--messages-accent-text);
}

.messages-react-page .msg-item.active .msg-preview,
.messages-react-page .msg-item.active .msg-time,
.messages-react-page .msg-item.active .msg-attachment-icon {
  color: color-mix(in srgb, var(--primary) 72%, var(--muted));
}

.messages-react-page .preview-panel {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.messages-react-page .preview-empty-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--messages-muted);
  text-align: center;
  padding: 48px;
}

.messages-react-page .preview-empty-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1.5px dashed var(--messages-border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 6px;
}

.messages-react-page .preview-empty-icon svg {
  color: var(--messages-muted);
  width: 22px;
  height: 22px;
}

.messages-react-page .preview-empty-title,
.messages-react-page .list-empty-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--messages-text);
}

.messages-react-page .preview-empty-sub,
.messages-react-page .list-empty-copy {
  font-size: 13px;
  color: var(--messages-muted);
}

.messages-react-page .preview-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--messages-border);
  flex-shrink: 0;
}

.messages-react-page .preview-top-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.messages-react-page .preview-avatar {
  width: 42px;
  height: 42px;
  border-radius: 16px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.messages-react-page .preview-sender-block {
  flex: 1;
  min-width: 0;
}

.messages-react-page .preview-sender-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--messages-text);
}

.messages-react-page .preview-sender-email,
.messages-react-page .preview-time-inline {
  font-size: 12px;
  font-family: 'DM Mono', monospace;
  color: var(--messages-muted);
}

.messages-react-page .preview-time-inline {
  margin-top: 3px;
}

.messages-react-page .preview-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.messages-react-page .action-btn {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: 1px solid var(--messages-border);
  background: var(--messages-surface);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--messages-muted);
  transition: all 0.15s ease;
}

.messages-react-page .action-btn svg {
  width: 15px;
  height: 15px;
}

.messages-react-page .action-btn:hover {
  background: var(--messages-surface-2);
  border-color: var(--messages-border-strong);
  color: var(--messages-text);
}

.messages-react-page .action-btn.star-active {
  color: var(--messages-warning);
  background: var(--messages-warning-bg);
  border-color: transparent;
}

.messages-react-page .action-btn.danger:hover {
  color: var(--messages-danger);
  background: color-mix(in srgb, var(--danger) 10%, var(--surface));
  border-color: transparent;
}

.messages-react-page .preview-subject-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.messages-react-page .preview-subject {
  font-size: 18px;
  font-weight: 600;
  color: var(--messages-text);
  letter-spacing: -0.3px;
  line-height: 1.3;
}

.messages-react-page .tag {
  font-size: 11px;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 999px;
}

.messages-react-page .tag-attachment {
  background: var(--messages-warning-bg);
  color: var(--messages-warning-text);
}

.messages-react-page .tag-unread {
  background: var(--messages-accent-bg);
  color: var(--messages-accent-text);
}

.messages-react-page .preview-body-wrap {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px;
}

.messages-react-page .preview-body {
  font-size: 14.5px;
  line-height: 1.75;
  color: var(--messages-text);
}

.messages-react-page .preview-body p {
  margin-bottom: 14px;
}

.messages-react-page .preview-body p:last-child {
  margin-bottom: 0;
}

.messages-react-page .preview-loading {
  color: var(--messages-muted);
  font-size: 14px;
}

.messages-react-page .attachments {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--messages-border);
}

.messages-react-page .attach-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--messages-muted);
  margin-bottom: 10px;
}

.messages-react-page .attach-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.messages-react-page .attach-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--messages-surface-2);
  border: 1px solid var(--messages-border);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
}

.messages-react-page .attach-icon {
  width: 32px;
  height: 32px;
  border-radius: 6px;
}

.messages-react-page .attach-icon svg {
  width: 16px;
  height: 16px;
}

.messages-react-page .attach-name {
  font-weight: 500;
  color: var(--messages-text);
}

.messages-react-page .attach-meta {
  font-size: 11.5px;
  color: var(--messages-muted);
  margin-top: 1px;
}

.messages-react-page .list-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 48px 20px;
  text-align: center;
  color: var(--messages-muted);
  font-size: 13px;
  min-height: 100%;
}

.messages-react-page .list-empty-icon {
  width: 28px;
  height: 28px;
  opacity: 0.5;
}

.messages-react-page .list-empty-icon svg {
  width: 100%;
  height: 100%;
}

@media (max-width: 980px) {
  .messages-react-page {
    width: 100%;
    margin: 0;
    height: calc(100vh - 72px);
    min-height: calc(100vh - 72px);
  }

  .messages-react-page .shell {
    padding: 16px;
  }

  .messages-react-page .split {
    flex-direction: column;
  }

  .messages-react-page .msg-list-panel {
    width: 100%;
    min-width: 0;
    min-height: 220px;
    max-height: 42%;
  }

  .messages-react-page .preview-panel {
    min-height: 0;
  }

  .messages-react-page .preview-body-wrap {
    padding: 16px;
  }
}

@media (max-width: 720px) {
  .messages-react-page .subheader,
  .messages-react-page .preview-top-row,
  .messages-react-page .preview-subject-row {
    align-items: stretch;
    flex-direction: column;
  }

  .messages-react-page .filters,
  .messages-react-page .preview-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .messages-react-page .email-strip {
    width: 100%;
    flex-wrap: wrap;
  }

  .messages-react-page .email-addr {
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}
