/* ===== پوسته ایزی‌میل: روشن، نرم، با آیکون‌های رنگی ===== */
:root {
  --bg: #f3f5fa; --surface: #fff; --surface-2: #f5f7fc; --hover: #f2f4fb; --row-read: #fff; --row-unread: #fff;
  --text: #1f2333; --text-2: #3d4255; --text-3: #7a8095; --border: #e3e6ef; --divider: #edf0f6;
  --primary: #2f6fe4; --primary-soft: #e8ebfa; --selected-row: #eef0ff; --accent: #5b5df0;
  --compose-a: #4f46e5; --compose-b: #5b72f6;
  --nav-active: #e6e9f8; --card-shadow: 0 1px 2px rgba(31,35,51,.04), 0 6px 24px rgba(31,35,51,.06);
  --radius: 22px;
}
:root[data-theme="dark"] {
  --bg: #0f1117; --surface: #171a22; --surface-2: #1d212b; --hover: #222736; --row-read: #171a22; --row-unread: #1d212b;
  --text: #e6e8ef; --text-2: #c5c9d6; --text-3: #8d93a6; --border: #2a2f3d; --divider: #232836;
  --primary: #7aa2ff; --primary-soft: #26304d; --selected-row: #262c47; --accent: #8b8dff;
  --nav-active: #262c47; --card-shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 28px rgba(0,0,0,.35);
}

body { background: var(--bg); }
svg.ci { width: 22px; height: 22px; flex: none; display: block; }

/* ---------- نوار بالا ---------- */
.topbar { padding: 10px 16px 10px 18px; gap: 14px; height: 68px; }
.shell { grid-template-rows: 68px 1fr; }
.brand { gap: 8px; }
.brand .toggle-nav { color: var(--text-2); }
.brand-link { display: flex; align-items: center; gap: 8px; text-decoration: none; }
.brand img { width: 40px; height: 40px; }
.brand b { font-size: 24px; font-weight: 800; letter-spacing: -.3px; margin: 0;
  background: linear-gradient(90deg, #4338ca, #5b4fd6); -webkit-background-clip: text; background-clip: text; color: transparent; }
:root[data-theme="dark"] .brand b { background: linear-gradient(90deg, #a5b4fc, #c4b5fd); -webkit-background-clip: text; background-clip: text; }

.search { max-width: 640px; height: 46px; margin-inline: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 23px; padding: 0 6px; box-shadow: 0 1px 2px rgba(31,35,51,.03); }
:root[data-theme="dark"] .search { background: var(--surface-2); }
.search:focus-within { border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 10%, transparent); background: var(--surface); }
.search input { font-size: 15px; }
.search input::placeholder { color: var(--text-3); }
.search .icon-btn { width: 36px; height: 36px; }
.search svg.ci { width: 20px; height: 20px; }

.top-actions { gap: 10px; margin-inline-start: 0; }
.sq-btn { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); display: inline-grid; place-items: center; position: relative; color: var(--text-2); transition: background .15s, box-shadow .15s; }
.sq-btn:hover { background: var(--hover); box-shadow: 0 2px 8px rgba(31,35,51,.06); }
.sq-btn svg.ci { width: 21px; height: 21px; }
.sq-btn svg.i { width: 20px; height: 20px; }
:root[data-theme="dark"] .sq-btn svg.ci path, :root[data-theme="dark"] .sq-btn svg.ci circle { stroke: #c5c9d6; }
.sq-btn .dot { position: absolute; top: 7px; inset-inline-end: 8px; width: 8px; height: 8px; border-radius: 50%; background: #ef4444; box-shadow: 0 0 0 2px var(--surface); }
.acct { position: relative; border-radius: 50%; display: inline-grid; }
.acct .avatar { width: 42px; height: 42px; font-size: 17px; box-shadow: 0 0 0 2px var(--surface), 0 2px 6px rgba(31,35,51,.15); }
.acct .online { position: absolute; bottom: 1px; inset-inline-end: 1px; width: 11px; height: 11px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 2px var(--surface); }
:root[data-theme="dark"] .search svg.ci path, :root[data-theme="dark"] .search svg.ci circle { stroke: #aab0c2; }

/* ---------- نوار کناری ---------- */
.sidebar { padding: 6px 12px 16px 0; }
.compose-btn { width: calc(100% - 4px); justify-content: center; height: 54px; margin: 2px 0 18px; border-radius: 27px; color: #fff; font-size: 16px; font-weight: 700;
  background: linear-gradient(90deg, var(--compose-b), var(--compose-a)); box-shadow: 0 6px 18px rgba(79,70,229,.32); }
.compose-btn:hover { background: linear-gradient(90deg, var(--compose-b), var(--compose-a)); filter: brightness(1.06); box-shadow: 0 8px 22px rgba(79,70,229,.4); }
.compose-btn svg.ci { width: 24px; height: 24px; }
.nav-collapsed .compose-btn { width: 54px; margin-inline: auto; border-radius: 50%; }
.nav-item { height: 40px; gap: 14px; padding: 0 14px; margin: 2px 0; border-radius: 20px; color: var(--text); font-size: 15px; }
.nav-item:hover { background: var(--hover); }
.nav-item.active { background: var(--nav-active); color: var(--text); font-weight: 700; }
.nav-item.unread { font-weight: 700; }
.nav-item .ni { width: 24px; height: 24px; display: grid; place-items: center; flex: none; }
.nav-item .count { font-size: 12.5px; color: var(--text-2); }
.nav-item .ldot { width: 12px; height: 12px; border-radius: 50%; display: block; }
.nav-item.indent { padding-inline-start: calc(14px + var(--depth, 0) * 16px); }
.nav-section { padding: 18px 14px 8px; font-size: 17px; font-weight: 800; color: var(--text); }
.nav-section .icon-btn { color: var(--text-2); }
.ldots { display: grid; grid-template-columns: repeat(2, 12px); gap: 18px 22px; padding: 8px 14px 4px; width: max-content; margin-inline-start: auto; margin-inline-end: 14px; }
.ldots i { width: 12px; height: 12px; border-radius: 50%; display: block; }
.storage { margin: 26px 14px 0; font-size: 12.5px; color: var(--text-2); }
.storage .bar { height: 5px; border-radius: 3px; background: #dfe3ec; margin-bottom: 10px; }
:root[data-theme="dark"] .storage .bar { background: #2a2f3d; }
.storage .bar i { background: linear-gradient(90deg, var(--compose-b), var(--compose-a)); border-radius: 3px; }

/* ---------- بخش اصلی ---------- */
.main { border-radius: var(--radius); margin: 0 0 16px 16px; border: 1px solid var(--border); box-shadow: var(--card-shadow); }
.toolbar { padding: 12px 16px; min-height: 60px; gap: 8px; }
.toolbar .icon-btn { border-radius: 12px; }
.sel-wrap { gap: 6px; padding: 0; }
.sel-wrap:hover { background: none; }
.sel-pill { height: 36px; padding: 0 12px 0 10px; border-radius: 11px; border: 1px solid var(--border); background: var(--surface); display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 14px; }
.sel-pill:hover { background: var(--hover); }
.sel-pill svg.i { width: 18px; height: 18px; }
.toolbar .sq-btn { width: 36px; height: 36px; border-radius: 11px; }
.toolbar .pager .icon-btn { color: var(--text-3); }

.tabs { border-bottom: 1px solid var(--divider); padding: 0 6px; }
.tab { height: 52px; gap: 10px; justify-content: center; color: var(--text); font-weight: 500; font-size: 15px; flex: 1 1 0; min-width: 130px; }
.tab:hover { background: var(--hover); }
.tab.active { color: var(--primary); font-weight: 700; }
.tab.active::after { inset-inline: 0; height: 3px; background: var(--primary); border-radius: 3px 3px 0 0; }
.tab svg.ci { width: 21px; height: 21px; }
.tab .badge { background: color-mix(in srgb, var(--tab-c, var(--primary)) 85%, #fff); }

/* کارت صندوق خالی */
.empty-card { margin: 22px 18px; min-height: calc(100% - 44px); background: var(--surface); border-radius: 18px; box-shadow: 0 1px 2px rgba(31,35,51,.05), 0 10px 30px rgba(31,35,51,.07); border: 1px solid var(--divider);
  display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 20px; text-align: center; }
.empty-card .empty-art { width: min(330px, 80%); height: auto; }
.empty-card p { margin: 18px 0 0; font-size: 17px; font-weight: 500; color: var(--text); }
:root[data-theme="dark"] .empty-card { background: var(--surface-2); }
.list:has(.empty-card) { display: flex; flex-direction: column; }
.list:has(.empty-card) .empty-card { flex: 1; }

/* ردیف‌های فهرست */
.row { border-bottom-color: var(--divider); background: var(--row-read); }
.row.unread { background: var(--row-unread); }
.row:not(.unread) .from, .row:not(.unread) .subject { color: var(--text-2); }
.row:hover { box-shadow: inset 0 0 0 1px var(--border), 0 2px 10px rgba(31,35,51,.06); }
.row.selected, .row.open { background: var(--selected-row); }
.row.focused::before { background: var(--accent); }
.checkbox { border-radius: 5px; border-color: #b6bccc; }
.checkbox.on, .checkbox.some { background: var(--accent); border-color: var(--accent); }

/* دکمه‌ها و ورودی‌ها هماهنگ با پوسته */
.btn.primary { background: linear-gradient(90deg, var(--compose-b), var(--compose-a)); color: #fff; }
:root[data-theme="dark"] .btn.primary { color: #fff; }
.btn.tonal { background: var(--primary-soft); }
.input { border-radius: 12px; }
.menu { border-radius: 14px; }

@media (max-width: 720px) {
  .topbar { padding: 8px; gap: 8px; height: 60px; }
  .shell { grid-template-rows: 60px 1fr; }
  .top-actions .sq-btn { display: none; }
  .search { height: 42px; }
  .search .filter-btn { display: none; }
  .main { border-radius: 18px 18px 0 0; margin: 0; border-bottom: 0; }
  .tab { min-width: 110px; flex: 0 0 auto; padding: 0 12px; }
  .empty-card { margin: 12px; }
}

/* ترتیب دکمه‌های نوار ابزار مثل طرح: «بیشتر»، «تازه‌سازی»، سپس «انتخاب» */
.toolbar [data-act="moreAll"] { order: -2; }
.toolbar [data-act="refresh"] { order: -1; }
.toolbar .pager { order: 5; }
/* فضای ذخیره‌سازی پایین نوار کناری */
.sidebar { display: flex; flex-direction: column; }
.sidebar .storage { margin-top: auto; padding-top: 24px; }
