:root {
  --bg: #070c18;
  --bg-2: #0a1120;
  --panel: #0f172a;
  --panel-2: #121e34;
  --panel-3: #17243d;
  --border: #1e2c47;
  --border-strong: #2d3d5c;
  --text: #e9eff9;
  --muted: #93a3bc;
  --muted-2: #6e7f9b;
  --brand: #7c6cff;
  --brand-2: #38d5f2;
  --brand-soft: rgba(124, 108, 255, 0.14);
  --success: #34d399;
  --success-soft: rgba(52, 211, 153, 0.12);
  --danger: #fb7185;
  --danger-soft: rgba(251, 113, 133, 0.12);
  --warning: #fbbf24;
  --warning-soft: rgba(251, 191, 36, 0.12);
  --info: #60a5fa;
  --radius: 16px;
  --radius-sm: 11px;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.38);
  --font: Vazirmatn, "Segoe UI", Tahoma, "Iranian Sans", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
html { direction: rtl; }
body {
  margin: 0;
  color: var(--text);
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.8;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  background:
    radial-gradient(1100px 600px at 100% -10%, rgba(124, 108, 255, 0.12), transparent 60%),
    radial-gradient(900px 600px at -10% 20%, rgba(56, 213, 242, 0.08), transparent 55%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }
::selection { background: rgba(124, 108, 255, 0.35); }
:focus-visible { outline: 2px solid var(--brand-2); outline-offset: 2px; }

.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { flex: 0 0 auto; vertical-align: middle; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }

.bg-orbs { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.bg-orbs span { position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.4; }
.bg-orbs span:nth-child(1) { width: 420px; height: 420px; background: #4f46e5; top: -160px; right: -100px; }
.bg-orbs span:nth-child(2) { width: 360px; height: 360px; background: #0891b2; bottom: -160px; left: -120px; opacity: 0.22; }
.bg-orbs span:nth-child(3) { width: 260px; height: 260px; background: #7c3aed; top: 45%; left: 45%; opacity: 0.12; }

.flash-stack { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 120; width: min(680px, calc(100% - 32px)); display: grid; gap: 8px; }
.flash { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 16px; border-radius: 12px; border: 1px solid var(--border-strong); background: rgba(15, 23, 42, 0.96); box-shadow: var(--shadow); backdrop-filter: blur(14px); font-size: 13.5px; }
.flash-success { border-color: rgba(52, 211, 153, 0.4); background: linear-gradient(180deg, rgba(6, 78, 59, 0.55), rgba(15, 23, 42, 0.96)); }
.flash-error { border-color: rgba(251, 113, 133, 0.45); background: linear-gradient(180deg, rgba(76, 5, 25, 0.6), rgba(15, 23, 42, 0.96)); }
.flash-warning { border-color: rgba(251, 191, 36, 0.45); background: linear-gradient(180deg, rgba(69, 48, 6, 0.55), rgba(15, 23, 42, 0.96)); }
.flash-close { border: 0; background: transparent; color: var(--muted); font-size: 22px; line-height: 1; padding: 0 4px; }
.flash-close:hover { color: var(--text); }

.layout { display: flex; min-height: 100vh; min-height: 100dvh; }
.sidebar {
  width: 282px; flex: 0 0 282px; position: sticky; top: 0; height: 100vh; height: 100dvh;
  display: flex; flex-direction: column; gap: 16px; padding: 22px 18px 18px;
  background: linear-gradient(180deg, rgba(17, 28, 49, 0.94), rgba(9, 15, 29, 0.96));
  border-inline-end: 1px solid var(--border); backdrop-filter: blur(18px); z-index: 60;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 2px 6px 10px; }
.brand-mark { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--brand), #3b82f6 55%, var(--brand-2)); box-shadow: 0 10px 26px rgba(124, 108, 255, 0.35); }
.brand-text { display: flex; flex-direction: column; line-height: 1.35; }
.brand-text strong { font-size: 18px; letter-spacing: -0.2px; }
.brand-text small { color: var(--muted); font-size: 11.5px; direction: ltr; text-align: right; }
.brand-account { display: grid; gap: 1px; padding: 0 6px 4px; line-height: 1.7; }
.brand-account strong { font-size: 13px; font-weight: 800; color: #34d399; letter-spacing: -0.1px; text-shadow: 0 0 18px rgba(52, 211, 153, 0.18); }
.brand-account span { font-size: 9.5px; font-weight: 700; color: #6ee7b7; letter-spacing: 0.1px; }
.compose-btn { display: flex; align-items: center; justify-content: center; gap: 9px; padding: 13px 16px; border-radius: 13px; font-weight: 700; color: #fff; background: linear-gradient(135deg, #6d5efc, #5b8cff 60%, #2fc7e8); box-shadow: 0 12px 30px rgba(91, 108, 255, 0.33); transition: transform 0.15s ease, box-shadow 0.15s ease; }
.compose-btn:hover { transform: translateY(-1px); box-shadow: 0 16px 36px rgba(91, 108, 255, 0.42); }
.mailbox-switcher { display: grid; gap: 6px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: rgba(9, 15, 29, 0.6); }
.mailbox-switcher > span { color: var(--muted-2); font-size: 11px; }
.mailbox-switcher select { width: 100%; border: 0; background: transparent; color: var(--text); font-size: 12.5px; outline: none; direction: ltr; text-align: right; }
.active-mailbox { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: rgba(9, 15, 29, 0.6); min-width: 0; }
.active-mailbox div { display: flex; flex-direction: column; min-width: 0; }
.active-mailbox strong { font-size: 12.5px; direction: ltr; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.active-mailbox small { color: var(--muted); font-size: 11px; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.12); flex: 0 0 auto; }
.nav { display: grid; gap: 3px; overflow-y: auto; padding: 2px; }
.nav::-webkit-scrollbar { width: 4px; }
.nav::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 11px; color: var(--muted); font-size: 13.5px; transition: background 0.15s, color 0.15s; position: relative; }
.nav-item:hover { background: rgba(124, 108, 255, 0.08); color: var(--text); }
.nav-item.active { background: linear-gradient(90deg, rgba(124, 108, 255, 0.2), rgba(56, 213, 242, 0.06)); color: #fff; box-shadow: inset 0 0 0 1px rgba(124, 108, 255, 0.22); }
.nav-item.active::before { content: ""; position: absolute; inset-inline-start: 0; top: 22%; bottom: 22%; width: 3px; border-radius: 4px; background: linear-gradient(var(--brand), var(--brand-2)); }
.nav-item span { flex: 1; }
.nav-section-label { color: var(--muted-2); font-size: 10.5px; letter-spacing: 0.4px; padding: 8px 12px 2px; }
.badge { display: inline-grid; place-items: center; min-width: 21px; height: 21px; padding: 0 6px; border-radius: 999px; background: linear-gradient(135deg, var(--brand), #4f8cff); color: #fff; font-size: 11px; font-weight: 700; }
.badge.muted { background: var(--panel-3); color: var(--muted); }
.dot-warn { width: 7px; height: 7px; border-radius: 50%; background: var(--warning); box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.12); }
.sidebar-footer { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 8px; }
.user-mini { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.user-mini-text { display: flex; flex-direction: column; min-width: 0; }
.user-mini-text strong { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-mini-text small { color: var(--muted); font-size: 10.5px; direction: ltr; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-footer-actions { display: flex; gap: 4px; }
.sidebar-footer form { margin: 0; }

.avatar { width: var(--avatar-size, 40px); height: var(--avatar-size, 40px); border-radius: 50%; display: inline-grid; place-items: center; flex: 0 0 auto; font-size: calc(var(--avatar-size, 40px) * 0.32); font-weight: 800; color: #fff; background: linear-gradient(145deg, hsl(var(--h, 250) 62% 42%), hsl(calc(var(--h, 250) + 40) 62% 30%)); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12), 0 6px 18px rgba(0, 0, 0, 0.25); }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 40; min-height: 72px; display: flex; align-items: center; gap: 16px; padding: 12px 28px; background: rgba(7, 12, 24, 0.72); border-bottom: 1px solid var(--border); backdrop-filter: blur(18px); }
.topbar-title { display: flex; flex-direction: column; gap: 1px; min-width: 0; font-weight: 800; font-size: 16px; white-space: nowrap; line-height: 1.45; }
.topbar-title > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.topbar-title small { font-weight: 800; font-size: 12px; color: #34d399; text-shadow: 0 0 16px rgba(52, 211, 153, 0.15); overflow: hidden; text-overflow: ellipsis; }
.topbar-search { margin-inline-start: auto; flex: 1; max-width: 420px; display: flex; align-items: center; gap: 8px; padding: 9px 13px; border: 1px solid var(--border); border-radius: 12px; background: rgba(15, 23, 42, 0.6); color: var(--muted); }
.topbar-search:focus-within { border-color: rgba(56, 213, 242, 0.5); box-shadow: 0 0 0 3px rgba(56, 213, 242, 0.08); }
.topbar-search input { border: 0; background: transparent; outline: 0; width: 100%; color: var(--text); font-size: 13px; }
.topbar-actions { display: flex; align-items: center; gap: 12px; margin-inline-start: auto; }
.pill { padding: 6px 11px; border-radius: 999px; font-size: 11px; font-weight: 700; border: 1px solid transparent; white-space: nowrap; }
.pill-ok { color: #a7f3d0; background: var(--success-soft); border-color: rgba(52, 211, 153, 0.25); }
.pill-warn { color: #fde68a; background: var(--warning-soft); border-color: rgba(251, 191, 36, 0.25); }
.mobile-menu { display: none; }
.sidebar-close-mobile { display: none; }
.content { width: 100%; max-width: 1480px; margin: 0 auto; padding: 26px 28px 30px; flex: 1; }
.app-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 28px 18px; border-top: 1px solid var(--border); color: #6ee7b7; font-size: 10px; line-height: 1.8; }
.app-footer span:first-child { color: #34d399; font-weight: 800; font-size: 12.5px; text-shadow: 0 0 18px rgba(52, 211, 153, 0.16); }
.app-footer span:last-child { color: #6ee7b7; font-weight: 700; }
.sidebar-overlay { display: none; }

.icon-btn { width: 38px; height: 38px; display: inline-grid; place-items: center; border: 1px solid var(--border); border-radius: 11px; background: rgba(15, 23, 42, 0.55); color: var(--muted); transition: 0.15s; }
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); background: var(--panel-2); }
.icon-btn.danger:hover { color: var(--danger); border-color: rgba(251, 113, 133, 0.4); }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { margin: 0; font-size: 24px; letter-spacing: -0.4px; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: 12.5px; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--border-strong); border-radius: 11px; padding: 9px 14px; background: var(--panel-2); color: var(--text); font-size: 13px; font-weight: 600; transition: 0.15s; }
.btn:hover { background: var(--panel-3); transform: translateY(-1px); }
.btn-primary { border-color: transparent; background: linear-gradient(135deg, var(--brand), #4f8cff 60%, var(--brand-2)); color: #fff; box-shadow: 0 10px 24px rgba(95, 108, 255, 0.26); }
.btn-primary:hover { box-shadow: 0 14px 30px rgba(95, 108, 255, 0.36); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--muted); }
.btn-ghost:hover { color: var(--text); }
.btn-danger { background: var(--danger-soft); border-color: rgba(251, 113, 133, 0.35); color: #fecdd3; }
.btn-danger:hover { background: rgba(251, 113, 133, 0.2); }
.btn-sm { padding: 6px 10px; font-size: 12px; border-radius: 9px; }
.btn-block { width: 100%; }
.btn[disabled], .btn.disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.card { background: linear-gradient(180deg, rgba(20, 31, 53, 0.9), rgba(13, 21, 38, 0.92)); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.16); }
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h2, .card-head h3 { margin: 0; font-size: 15.5px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; direction: ltr; }
.ltr { direction: ltr; text-align: right; }

.mail-list { display: grid; gap: 8px; }
.mail-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 13px 15px; border: 1px solid var(--border); border-radius: 14px; background: rgba(15, 23, 42, 0.6); transition: 0.15s; position: relative; }
.mail-row:hover { border-color: var(--border-strong); background: rgba(23, 36, 61, 0.72); transform: translateY(-1px); }
.mail-row.unread { background: linear-gradient(90deg, rgba(124, 108, 255, 0.12), rgba(15, 23, 42, 0.65)); border-color: rgba(124, 108, 255, 0.24); }
.mail-row.unread .mail-sender, .mail-row.unread .mail-subject { color: #fff; font-weight: 800; }
.mail-main { min-width: 0; }
.mail-line { display: flex; align-items: baseline; gap: 9px; min-width: 0; }
.mail-sender { font-weight: 700; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail-address { color: var(--muted-2); font-size: 11px; direction: ltr; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail-subject { font-size: 13.5px; color: #dbe6f7; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail-snippet { color: var(--muted); font-size: 12px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; min-width: 85px; }
.mail-time { color: var(--muted-2); font-size: 11px; white-space: nowrap; }
.mail-flags { display: flex; align-items: center; gap: 5px; color: var(--muted); }
.mail-flags .icon { width: 15px; height: 15px; }
.unread-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand-2); box-shadow: 0 0 0 4px rgba(56, 213, 242, 0.1); }
.star-on { color: var(--warning); fill: var(--warning); }
.star-form { display: inline; }
.star-btn { border: 0; background: transparent; color: var(--muted-2); padding: 3px; display: inline-grid; place-items: center; border-radius: 7px; }
.star-btn:hover { color: var(--warning); background: rgba(251, 191, 36, 0.08); }
.row-actions { display: flex; align-items: center; gap: 3px; }
.row-actions form { margin: 0; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-icon { width: 68px; height: 68px; display: grid; place-items: center; margin: 0 auto 14px; border-radius: 22px; border: 1px solid var(--border); background: var(--panel-2); color: var(--muted); }
.empty-state h3 { margin: 0 0 4px; color: var(--text); font-size: 16px; }
.empty-state p { margin: 0; font-size: 12.5px; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 22px; }
.page-info { color: var(--muted); font-size: 11.5px; }

.message-card { padding: 0; overflow: hidden; }
.message-head { padding: 22px 24px; border-bottom: 1px solid var(--border); background: linear-gradient(180deg, rgba(28, 41, 69, 0.6), transparent); }
.message-subject { margin: 0 0 14px; font-size: 21px; letter-spacing: -0.3px; line-height: 1.5; }
.message-sender { display: flex; align-items: center; gap: 12px; }
.sender-text { display: flex; flex-direction: column; min-width: 0; }
.sender-text strong { font-size: 14px; }
.sender-text small { color: var(--muted); direction: ltr; text-align: right; font-size: 11.5px; }
.message-meta-grid { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 12px; color: var(--muted); font-size: 12px; }
.message-meta-grid b { color: var(--text); font-weight: 600; }
.message-toolbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-inline-start: auto; }
.message-toolbar form { margin: 0; }
.message-body { padding: 22px 24px; }
.message-frame { width: 100%; min-height: 420px; border: 1px solid var(--border); border-radius: 13px; background: #0b1020; display: block; }
.plain-body { white-space: pre-wrap; word-break: break-word; font-family: var(--font); background: #0b1020; border: 1px solid var(--border); border-radius: 13px; padding: 20px; min-height: 220px; line-height: 2; }
.attachments { margin-top: 20px; display: grid; gap: 8px; }
.attachment-item { display: flex; align-items: center; gap: 10px; padding: 10px 13px; border: 1px solid var(--border); border-radius: 11px; background: rgba(9, 15, 29, 0.55); }
.attachment-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; }
.attachment-size { color: var(--muted-2); font-size: 11px; }
.send-error { margin-bottom: 18px; padding: 13px 15px; border-radius: 12px; border: 1px solid rgba(251, 113, 133, 0.35); background: var(--danger-soft); color: #fecdd3; font-size: 12.5px; }

.compose-card { padding: 22px; }
.compose-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.field label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 12px; font-weight: 600; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="search"], input[type="url"], select, textarea {
  width: 100%; border: 1px solid var(--border); border-radius: 11px; background: rgba(8, 14, 27, 0.7); padding: 10px 12px; color: var(--text); font-size: 13px; transition: border 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus { outline: 0; border-color: rgba(56, 213, 242, 0.5); box-shadow: 0 0 0 3px rgba(56, 213, 242, 0.08); }
textarea { resize: vertical; min-height: 120px; line-height: 1.9; }
textarea.editor { min-height: 260px; font-family: var(--font); }
.hint { color: var(--muted-2); font-size: 11.5px; margin-top: 5px; }
.form-error { color: #fecdd3; background: var(--danger-soft); border: 1px solid rgba(251, 113, 133, 0.3); padding: 10px 12px; border-radius: 10px; font-size: 12.5px; }
.form-success { color: #a7f3d0; background: var(--success-soft); border: 1px solid rgba(52, 211, 153, 0.3); padding: 10px 12px; border-radius: 10px; font-size: 12.5px; }
.form-warning { color: #fde68a; background: var(--warning-soft); border: 1px solid rgba(251, 191, 36, 0.3); padding: 10px 12px; border-radius: 10px; font-size: 12.5px; }
.editor-tabs { display: flex; gap: 4px; padding: 4px; border: 1px solid var(--border); border-radius: 10px; width: fit-content; background: rgba(8, 14, 27, 0.5); margin-bottom: 8px; }
.editor-tab { border: 0; background: transparent; color: var(--muted); padding: 5px 12px; border-radius: 7px; font-size: 12px; }
.editor-tab.active { background: var(--panel-3); color: #fff; }
.editor-pane { display: none; }
.editor-pane.active { display: block; }
.html-toolbar { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 6px; }
.html-toolbar button { border: 1px solid var(--border); background: var(--panel-2); color: var(--muted); border-radius: 7px; padding: 3px 9px; font-size: 12px; }
.html-toolbar button:hover { color: var(--text); }
.attachments-box { border: 1px dashed var(--border-strong); border-radius: 12px; padding: 13px; background: rgba(8, 14, 27, 0.35); }
.attachment-check { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 12.5px; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--brand); width: 15px; height: 15px; }
.compose-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }

.list-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.list-head h2 { margin: 0; font-size: 17px; }
.count-chip { color: var(--muted); font-size: 11.5px; padding: 3px 8px; border: 1px solid var(--border); border-radius: 999px; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { padding: 15px 16px; border: 1px solid var(--border); border-radius: 14px; background: rgba(15, 23, 42, 0.55); }
.stat span { color: var(--muted); font-size: 11px; }
.stat strong { display: block; font-size: 22px; margin-top: 2px; }
.stat small { color: var(--muted-2); font-size: 10.5px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 13px; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
thead th { text-align: right; color: var(--muted); font-weight: 600; font-size: 11px; padding: 11px 12px; background: rgba(9, 15, 29, 0.65); border-bottom: 1px solid var(--border); white-space: nowrap; }
tbody td { padding: 11px 12px; border-bottom: 1px solid rgba(30, 44, 71, 0.6); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(124, 108, 255, 0.05); }
.table-address { direction: ltr; text-align: right; font-size: 12px; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 10.5px; border: 1px solid var(--border); color: var(--muted); }
.tag-ok { color: #a7f3d0; border-color: rgba(52, 211, 153, 0.3); background: var(--success-soft); }
.tag-off { color: #fecdd3; border-color: rgba(251, 113, 133, 0.3); background: var(--danger-soft); }
.tag-warn { color: #fde68a; border-color: rgba(251, 191, 36, 0.3); background: var(--warning-soft); }
details { border: 1px solid var(--border); border-radius: 10px; background: rgba(8, 14, 27, 0.35); }
details + details { margin-top: 6px; }
summary { cursor: pointer; padding: 7px 10px; color: var(--muted); font-size: 12px; }
summary:hover { color: var(--text); }
details[open] summary { border-bottom: 1px solid var(--border); color: var(--text); }
.details-body { padding: 11px; display: grid; gap: 9px; }
.inline-form { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.inline-form input[type="password"], .inline-form input[type="text"] { width: 160px; padding: 6px 9px; font-size: 12px; }
.inline-form input[type="number"] { width: 90px; padding: 6px 9px; font-size: 12px; }
.checkbox-row { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); }
.access-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 5px 12px; }
.grid-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-three { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.method-fields { display: none; }
.method-fields.active { display: block; }
.secret-state { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 11px; }
.secret-state .icon { color: var(--success); }
.provider-presets { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.provider-presets button { border: 1px solid var(--border); background: var(--panel-2); color: var(--muted); border-radius: 8px; padding: 4px 10px; font-size: 11px; }
.provider-presets button:hover { color: var(--text); border-color: var(--border-strong); }
.copy-row { display: flex; align-items: center; gap: 6px; direction: ltr; }
.copy-row input { font-size: 11.5px; padding: 7px 9px; }
.copy-btn { border: 1px solid var(--border); background: var(--panel-2); color: var(--muted); border-radius: 8px; padding: 6px 9px; }
.copy-btn:hover { color: var(--text); }
.test-output { margin-top: 10px; font-size: 12px; }
.test-output .step { display: flex; gap: 8px; align-items: flex-start; padding: 5px 0; border-bottom: 1px dashed rgba(45, 61, 92, 0.5); }
.test-output .step:last-child { border-bottom: 0; }
.step-ok { color: var(--success); }
.step-bad { color: var(--danger); }
.info-box { padding: 12px 14px; border-radius: 11px; border: 1px solid var(--border); background: rgba(8, 14, 27, 0.45); color: var(--muted); font-size: 12px; }
.info-box strong { color: var(--text); }
.info-box.warn { border-color: rgba(251, 191, 36, 0.3); background: var(--warning-soft); color: #fde68a; }
.info-box.danger { border-color: rgba(251, 113, 133, 0.3); background: var(--danger-soft); color: #fecdd3; }
.info-box.ok { border-color: rgba(52, 211, 153, 0.3); background: var(--success-soft); color: #a7f3d0; }
.code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; direction: ltr; font-size: 11.5px; background: rgba(8, 14, 27, 0.7); border: 1px solid var(--border); border-radius: 7px; padding: 2px 6px; word-break: break-all; }
.log-detail { max-width: 520px; word-break: break-word; color: var(--muted); font-size: 11.5px; }
.log-time { white-space: nowrap; color: var(--muted-2); font-size: 11px; }
.level { font-size: 10px; padding: 2px 7px; border-radius: 999px; }
.level-info { background: rgba(96, 165, 250, 0.12); color: #93c5fd; }
.level-warning { background: var(--warning-soft); color: #fde68a; }
.level-error { background: var(--danger-soft); color: #fecdd3; }

.guest-shell { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 30px 18px; }
.guest-card { width: 100%; max-width: 440px; min-width: 0; margin-inline: auto; padding: 34px 32px; border: 1px solid var(--border-strong); border-radius: 22px; background: linear-gradient(180deg, rgba(23, 36, 61, 0.9), rgba(10, 17, 32, 0.95)); box-shadow: var(--shadow); backdrop-filter: blur(18px); position: relative; overflow: hidden; }
.guest-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 1px; background: linear-gradient(90deg, transparent, rgba(124, 108, 255, 0.8), rgba(56, 213, 242, 0.8), transparent); }
.guest-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.guest-brand .brand-mark { width: 54px; height: 54px; border-radius: 16px; }
.guest-brand div { display: flex; flex-direction: column; line-height: 1.4; }
.guest-brand strong { font-size: 20px; }
.guest-brand small { color: var(--muted); direction: ltr; text-align: right; font-size: 12px; }
.guest-account { display: grid; gap: 3px; margin: 0 0 20px; padding: 13px 15px; border: 1px solid rgba(52, 211, 153, 0.32); border-radius: 12px; background: linear-gradient(135deg, rgba(6, 78, 59, 0.5), rgba(8, 14, 27, 0.55)); box-shadow: 0 12px 30px rgba(16, 185, 129, 0.08); line-height: 1.8; }
.guest-account strong { font-size: 16px; font-weight: 800; color: #34d399; text-shadow: 0 0 22px rgba(52, 211, 153, 0.22); }
.guest-account span { font-size: 11px; font-weight: 700; color: #6ee7b7; letter-spacing: 0.2px; }
.guest-card h1 { font-size: 22px; margin: 0 0 6px; letter-spacing: -0.3px; }
.guest-card .lead { color: var(--muted); font-size: 13px; margin: 0 0 24px; }
.guest-form { display: grid; gap: 14px; }
.password-wrap { position: relative; }
.password-wrap input { padding-inline-end: 44px; }
.password-toggle { position: absolute; inset-inline-end: 6px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: 8px; background: transparent; color: var(--muted); }
.password-toggle:hover { color: var(--text); background: rgba(124, 108, 255, 0.1); }
.guest-footer { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); color: var(--muted-2); font-size: 11px; display: flex; justify-content: space-between; gap: 10px; }
.login-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; border: 1px solid rgba(52, 211, 153, 0.25); background: var(--success-soft); color: #a7f3d0; border-radius: 999px; font-size: 10.5px; margin-bottom: 16px; }

.error-card { text-align: center; }
.error-code { font-size: 64px; font-weight: 900; line-height: 1; background: linear-gradient(135deg, var(--brand), var(--brand-2)); -webkit-background-clip: text; background-clip: text; color: transparent; margin-bottom: 8px; }
.error-card h1 { margin: 0 0 8px; }
.error-card p { color: var(--muted); margin: 0 0 22px; }

@media (max-width: 1240px) {
  .sidebar { width: 256px; flex-basis: 256px; }
  .content { padding: 22px 22px 42px; }
  .topbar { padding: 12px 22px; }
}
@media (max-width: 1024px) {
  .sidebar { position: fixed; inset-block: 0; inset-inline-end: 0; width: min(320px, 88vw); flex-basis: auto; height: 100vh; height: 100dvh; padding-top: 58px; transform: translateX(100%); transition: transform 0.22s ease; box-shadow: -20px 0 60px rgba(0, 0, 0, 0.4); }
  html[dir="rtl"] .sidebar { transform: translateX(100%); }
  .sidebar.open, html[dir="rtl"] .sidebar.open { transform: translateX(0); }
  .sidebar-close-mobile { display: inline-grid; position: absolute; top: 14px; left: 14px; z-index: 2; }
  .sidebar-overlay { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.55); z-index: 50; opacity: 0; pointer-events: none; transition: opacity 0.2s; }
  .sidebar-overlay.open { opacity: 1; pointer-events: auto; }
  .mobile-menu { display: inline-grid; }
  .main { width: 100%; min-width: 0; }
  .topbar-title { font-size: 14px; }
  .topbar-title small { display: none; }
  .app-footer { padding: 12px 14px 16px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; gap: 8px; padding: 10px 12px; }
  .topbar-title { flex: 1; font-size: 13px; }
  .topbar-search { order: 3; flex-basis: 100%; max-width: none; margin-inline-start: 0; }
  .topbar-actions { gap: 6px; margin-inline-start: 0; }
  .topbar-actions .pill { display: none; }
  .content { padding: 14px 12px 28px; }
  .page-head { align-items: flex-start; gap: 10px; margin-bottom: 14px; }
  .page-head h1 { font-size: 19px; }
  .page-head p { font-size: 11.5px; line-height: 1.7; }
  .page-actions { gap: 6px; width: 100%; }
  .page-actions .btn { padding: 8px 11px; font-size: 12px; }
  .list-head { gap: 8px; }
  .list-head h2 { font-size: 15px; }
  .mail-row { grid-template-columns: 36px minmax(0, 1fr); gap: 10px; padding: 11px 12px; }
  .mail-row .avatar { width: 36px !important; height: 36px !important; }
  .mail-meta { grid-column: 2; flex-direction: row; justify-content: space-between; align-items: center; width: 100%; min-width: 0; }
  .mail-meta .mail-time { order: 2; }
  .mail-address { display: none; }
  .mail-sender { white-space: normal; }
  .mail-snippet { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .grid-two, .grid-three { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .stat { padding: 12px; }
  .stat strong { font-size: 18px; }
  .message-head, .message-body { padding: 14px; }
  .message-subject { font-size: 18px; margin-bottom: 10px; }
  .message-sender { align-items: flex-start; }
  .message-meta-grid { gap: 6px 14px; font-size: 11.5px; }
  .message-meta-grid span { word-break: break-word; }
  .message-toolbar { width: 100%; margin-top: 4px; }
  .message-frame { min-height: 300px; }
  .plain-body { padding: 14px; }
  .attachments { margin-top: 14px; }
  .attachment-item { flex-wrap: wrap; }
  .attachment-name { flex-basis: calc(100% - 30px); }
  .compose-card { padding: 14px; }
  .compose-grid { gap: 10px; }
  .editor-tabs { width: 100%; }
  .editor-tab { flex: 1; }
  textarea.editor { min-height: 220px; }
  .compose-actions { gap: 6px; }
  .compose-actions .btn { flex: 1 1 45%; }
  .guest-shell { padding: 16px 12px; }
  .guest-card { padding: 22px 18px; border-radius: 18px; }
  .guest-brand { margin-bottom: 18px; }
  .guest-brand .brand-mark { width: 46px; height: 46px; border-radius: 14px; }
  .guest-brand strong { font-size: 18px; }
  .guest-card h1 { font-size: 20px; }
  .guest-card .lead { font-size: 12.5px; margin-bottom: 18px; }
  .guest-footer { flex-direction: column; align-items: flex-start; gap: 4px; }
  .flash-stack { top: 10px; width: calc(100% - 20px); }
  .flash { padding: 10px 12px; font-size: 12px; }
  .app-footer { flex-direction: column; align-items: flex-start; gap: 4px; font-size: 9.5px; }
  .app-footer span:first-child { font-size: 11.5px; }
  .table-wrap { -webkit-overflow-scrolling: touch; }
  table { min-width: 620px; }
  .inline-form { align-items: stretch; }
  .inline-form input[type="password"], .inline-form input[type="text"], .inline-form input[type="number"] { width: 100%; }
  .access-list { grid-template-columns: 1fr; }
  input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="search"], input[type="url"], select, textarea { font-size: 16px; }
  .btn, .icon-btn { min-height: 40px; }
  .icon-btn { min-width: 40px; }
}
@media (max-width: 480px) {
  .sidebar { width: min(300px, 88vw); }
  .topbar-title { font-size: 12.5px; }
  .page-head h1 { font-size: 18px; }
  .compose-actions .btn { flex: 1 1 100%; }
  .mail-sender { max-width: 58vw; }
  .mail-subject { font-size: 12.5px; }
  .mark-all-read { display: none; }
  .stats-grid { grid-template-columns: 1fr; }
  .guest-shell { padding: 14px 10px; }
  .guest-card { padding: 20px 15px; }
  .guest-footer { font-size: 10px; }
  .mailbox-switcher select { font-size: 16px; }
  .brand-account strong { font-size: 12px; }
  .brand-account span { font-size: 9px; }
}
