/* PlusMail design system — flat, warm monochrome, multi-theme, LTR + RTL. */
@font-face { font-family: Vazirmatn; src: url(/assets/vazirmatn-arabic.woff2) format('woff2'); font-weight: 100 900; font-display: swap; unicode-range: U+0600-06FF, U+200C-200F, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: Vazirmatn; src: url(/assets/vazirmatn-latin.woff2) format('woff2'); font-weight: 100 900; font-display: swap; unicode-range: U+0000-00FF, U+2000-206F; }
:root,
[data-theme="paper"] {
  --bg: #f7f6f3;
  --surface: #ffffff;
  --surface-2: #fbfbfa;
  --hover: #f1f0ec;
  --active: #ebe9e4;
  --border: #eaeaea;
  --border-strong: #dcdad5;
  --text: #2f3437;
  --text-strong: #111111;
  --muted: #6b6a66;
  --faint: #72706b;
  --ink: #111111;
  --ink-hover: #333333;
  --on-ink: #ffffff;
  --focus: #1f6c9f;
  --red-bg: #fdebec; --red: #9f2f2d;
  --blue-bg: #e1f3fe; --blue: #1f6c9f;
  --green-bg: #edf3ec; --green: #346538;
  --yellow-bg: #fbf3db; --yellow: #956400;
  --purple-bg: #f1ecfa; --purple: #5b3e96;
  --unread-dot: #1f6c9f;
  --shadow-pop: 0 8px 28px rgba(17, 17, 17, 0.08), 0 0 0 1px rgba(17, 17, 17, 0.04);
  --scrim: rgba(17, 17, 17, 0.28);
  --accent: #4f5fe0; --accent-2: #7b4fe6; --on-accent: #ffffff; --accent-text: #3f4fd0;
  --card-shadow: 0 1px 2px rgba(17, 17, 17, 0.04), 0 4px 14px rgba(17, 17, 17, 0.03);
  color-scheme: light;
}
[data-theme="snow"] {
  --bg: #ffffff; --surface: #ffffff; --surface-2: #fafafa; --hover: #f4f4f5; --active: #ececee;
  --border: #ececec; --border-strong: #dedede; --text: #27282b; --text-strong: #0d0d0e; --muted: #63656a; --faint: #7a7c81;
  --ink: #0d0d0e; --ink-hover: #2c2d30;
}
[data-theme="sepia"] {
  --bg: #f3ede2; --surface: #fbf8f2; --surface-2: #f7f2e9; --hover: #eee6d8; --active: #e6dccb;
  --border: #e5dccb; --border-strong: #d6cab4; --text: #3b3226; --text-strong: #241c12; --muted: #6f6150; --faint: #857660;
  --ink: #3b2f20; --ink-hover: #54442f; --unread-dot: #9a5b1e; --focus: #9a5b1e;
}
[data-theme="graphite"] {
  --bg: #191919; --surface: #202020; --surface-2: #1c1c1c; --hover: #2a2a2a; --active: #323232;
  --border: #343434; --border-strong: #464646; --text: #d4d4d2; --text-strong: #f2f2f0; --muted: #a3a39f; --faint: #8a8a86;
  --ink: #ececea; --ink-hover: #ffffff; --on-ink: #151515; --focus: #6cb4e6;
  --red-bg: #3a2222; --red: #f0a5a3; --blue-bg: #1d2e3a; --blue: #8ac6ef; --green-bg: #213025; --green: #9dcfa2;
  --yellow-bg: #362e1a; --yellow: #e5c06c; --purple-bg: #2c2538; --purple: #c3aef0; --unread-dot: #6cb4e6;
  --shadow-pop: 0 10px 30px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.06); --scrim: rgba(0, 0, 0, 0.55);
  --accent-text: #9aa6ff; --card-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 2px 10px rgba(0, 0, 0, 0.25);
  color-scheme: dark;
}
[data-theme="midnight"] {
  --bg: #0f141c; --surface: #151b25; --surface-2: #121821; --hover: #1c2431; --active: #232d3c;
  --border: #263040; --border-strong: #34415a; --text: #cfd6e0; --text-strong: #f1f4f8; --muted: #9aa6b8; --faint: #7f8b9d;
  --ink: #dbe5f3; --ink-hover: #ffffff; --on-ink: #0f141c; --focus: #7fb2ff;
  --red-bg: #3a1f26; --red: #f3a6b0; --blue-bg: #1a2c45; --blue: #93bfff; --green-bg: #1b3128; --green: #93d3b0;
  --yellow-bg: #362e1b; --yellow: #e8c574; --purple-bg: #29243f; --purple: #bfb0f5; --unread-dot: #7fb2ff;
  --shadow-pop: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05); --scrim: rgba(3, 6, 12, 0.6);
  --accent-text: #9fb4ff; --card-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 2px 10px rgba(0, 0, 0, 0.3);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.6 "SF Pro Text", "SF Pro Display", "Helvetica Neue", "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
html[lang="fa"] body { font-family: Vazirmatn, "Segoe UI", Tahoma, system-ui, sans-serif; font-size: 14.5px; line-height: 1.75; }
html[lang="fa"] .serif { font-family: Vazirmatn, Georgia, serif; letter-spacing: 0; line-height: 1.35; font-weight: 600 !important; }
html[lang="fa"] .badge, html[lang="fa"] .nav-label, html[lang="fa"] .table th, html[lang="fa"] .menu .menu-label { letter-spacing: 0; text-transform: none; }
[dir="rtl"] .icon.flip { transform: scaleX(-1); }
/* Addresses, keys, code and URLs always read left to right. */
.ltr, code, pre, kbd, .mono, input[type="email"], input[type="url"] { direction: ltr; unicode-bidi: isolate; }
[dir="rtl"] pre, [dir="rtl"] pre code { text-align: left; }
[dir="rtl"] input[type="email"], [dir="rtl"] input[type="url"], [dir="rtl"] input.ltr { text-align: right; }
.serif { font-family: "Newsreader", "Lyon Text", "Iowan Old Style", "Charter", Georgia, serif; letter-spacing: -0.02em; line-height: 1.1; }
.mono, code, kbd { font-family: "SF Mono", "JetBrains Mono", "Cascadia Code", Consolas, monospace; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--blue-bg); color: var(--text-strong); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---------- primitives ---------- */
.icon { width: 18px; height: 18px; flex: none; display: inline-block; vertical-align: middle; }
.icon.sm { width: 15px; height: 15px; }
.icon.lg { width: 22px; height: 22px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 34px; padding: 0 14px; border-radius: 6px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-strong);
  font-weight: 500; font-size: 13.5px; cursor: pointer; white-space: nowrap; user-select: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}
.btn:hover { background: var(--hover); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.btn.primary:hover { background: var(--ink-hover); border-color: var(--ink-hover); }
.btn.danger { color: var(--red); }
.btn.danger:hover { background: var(--red-bg); border-color: transparent; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--hover); color: var(--text-strong); }
.btn.icon-only { width: 34px; padding: 0; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn.sm.icon-only { width: 28px; }
.btn.block { width: 100%; }

.input, .select, .textarea {
  width: 100%; height: 36px; padding: 0 11px; border-radius: 6px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-strong);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.textarea { height: auto; min-height: 120px; padding: 10px 11px; resize: vertical; line-height: 1.55; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 18%, transparent); }
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > label, .label { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: 0.02em; }
.field .hint { font-size: 12px; color: var(--faint); }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12.5px; }
.strong { color: var(--text-strong); font-weight: 600; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none !important; }

.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13.5px; }
.check input { width: 15px; height: 15px; accent-color: var(--ink); margin: 0; }

.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 10px; border-radius: 9999px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; white-space: nowrap;
  background: var(--hover); color: var(--muted);
}
.badge.red { background: var(--red-bg); color: var(--red); }
.badge.blue { background: var(--blue-bg); color: var(--blue); }
.badge.green { background: var(--green-bg); color: var(--green); }
.badge.yellow { background: var(--yellow-bg); color: var(--yellow); }
.badge.purple { background: var(--purple-bg); color: var(--purple); }

kbd { display: inline-block; min-width: 20px; padding: 0 5px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; background: var(--surface-2); font-size: 11px; line-height: 17px; text-align: center; color: var(--muted); }
code { padding: 1px 5px; border-radius: 4px; background: var(--hover); font-size: 0.9em; color: var(--text-strong); }
pre.code { margin: 0; padding: 14px 16px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); overflow: auto; font-size: 12.5px; line-height: 1.6; color: var(--text-strong); }
pre.code code { background: none; padding: 0; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
.card-pad { padding: 22px 24px; }
.card-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-head h3 { margin: 0; font-size: 14px; font-weight: 600; color: var(--text-strong); }

.avatar {
  width: 32px; height: 32px; border-radius: 8px; flex: none; display: grid; place-items: center;
  font-size: 12.5px; font-weight: 600; letter-spacing: 0.02em; color: var(--avatar-fg, var(--blue)); background: var(--avatar-bg, var(--blue-bg));
}
.avatar.lg { width: 40px; height: 40px; font-size: 14px; }

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

/* tables */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: start; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); padding: 10px 16px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background-color 0.12s ease; }
.table tbody tr:hover { background: var(--surface-2); }
.table .actions { text-align: end; white-space: nowrap; }

/* empty state */
.empty { display: grid; place-items: center; align-content: center; text-align: center; gap: 10px; padding: 56px 24px; color: var(--muted); }
.empty .glyph { width: 52px; height: 52px; border-radius: 12px; display: grid; place-items: center; background: var(--hover); color: var(--faint); }
.empty h4 { margin: 4px 0 0; color: var(--text-strong); font-size: 15px; font-weight: 600; }
.empty p { margin: 0; max-width: 340px; font-size: 13px; }

/* skeleton */
.skel { background: linear-gradient(90deg, var(--hover) 0%, var(--active) 50%, var(--hover) 100%); background-size: 200% 100%; animation: skel 1.4s ease-in-out infinite; border-radius: 4px; height: 12px; }
@keyframes skel { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- overlays ---------- */
.scrim { position: fixed; inset: 0; background: var(--scrim); display: grid; place-items: center; padding: 24px; z-index: 100; animation: fade 0.18s ease; }
.modal { width: min(560px, 100%); max-height: calc(100dvh - 48px); display: flex; flex-direction: column; background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-pop); animation: rise 0.24s cubic-bezier(0.16, 1, 0.3, 1); }
.modal.wide { width: min(760px, 100%); }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 18px 22px 0; }
.modal-head h2 { margin: 0; font-size: 18px; color: var(--text-strong); }
.modal-body { padding: 18px 22px; overflow: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--border); }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px) scale(0.99); } }

.menu { position: fixed; z-index: 120; min-width: 200px; padding: 5px; background: var(--surface); border-radius: 8px; box-shadow: var(--shadow-pop); animation: rise 0.16s cubic-bezier(0.16, 1, 0.3, 1); }
.menu button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 7px 10px; border: 0; background: none; border-radius: 5px; font-size: 13px; text-align: start; cursor: pointer; color: var(--text); }
.menu button:hover { background: var(--hover); color: var(--text-strong); }
.menu .sep { height: 1px; background: var(--border); margin: 5px 2px; }
.menu .menu-label { padding: 6px 10px 4px; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); }

.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 200; display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-radius: 8px; background: var(--ink); color: var(--on-ink); font-size: 13px; box-shadow: var(--shadow-pop); animation: rise 0.22s cubic-bezier(0.16, 1, 0.3, 1); }
.toast.error { background: var(--red-bg); color: var(--red); }
.toast button { border: 0; background: none; color: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; padding: 0; }

/* theme swatches */
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.swatch { border: 1px solid var(--border); border-radius: 8px; padding: 8px; background: var(--surface); cursor: pointer; text-align: start; transition: border-color 0.15s ease; }
.swatch:hover { border-color: var(--border-strong); }
.swatch[aria-pressed="true"] { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.swatch .preview { height: 54px; border-radius: 5px; display: grid; grid-template-columns: 28% 1fr; overflow: hidden; border: 1px solid rgba(0, 0, 0, 0.06); margin-bottom: 8px; }
.swatch .preview i { display: block; }
.swatch span { font-size: 12.5px; font-weight: 500; }

/* segmented control */
.seg { display: inline-flex; padding: 3px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface-2); }
.seg button { height: 28px; padding: 0 12px; border: 0; border-radius: 5px; background: none; color: var(--muted); cursor: pointer; font-size: 13px; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text-strong); box-shadow: 0 0 0 1px var(--border); }
.seg button[lang="fa"] { font-family: Vazirmatn, Tahoma, sans-serif; }

/* ---------- app shell ---------- */
.shell { display: grid; grid-template-columns: 236px 1fr; height: 100dvh; }
.sidebar { display: flex; flex-direction: column; min-height: 0; padding: 14px 10px; border-inline-end: 1px solid var(--border); overflow-y: auto; overflow-x: hidden; background: var(--surface-2); }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; }
.brand .mark { width: 28px; height: 28px; border-radius: 7px; background: var(--ink); color: var(--on-ink); display: grid; place-items: center; }
.brand .name { font-weight: 650; font-size: 14.5px; color: var(--text-strong); letter-spacing: -0.01em; }
.brand .sub { font-size: 12px; color: var(--muted); margin-top: -3px; }
.nav { display: grid; gap: 1px; }
.nav-label { padding: 14px 10px 6px; font-size: 11px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--faint); }
.nav a, .nav button.nav-item {
  display: flex; align-items: center; gap: 10px; height: 32px; padding: 0 10px; border-radius: 6px; border: 0; background: none; width: 100%;
  font-size: 13.5px; color: var(--muted); text-decoration: none; cursor: pointer; text-align: start; transition: background-color 0.12s ease, color 0.12s ease;
}
.nav a:hover, .nav button.nav-item:hover { background: var(--hover); color: var(--text-strong); }
.nav a[aria-current="page"], .nav button.nav-item[aria-current="page"] { background: var(--active); color: var(--text-strong); font-weight: 550; }
.nav .count { margin-inline-start: auto; font-size: 11.5px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.nav a[aria-current="page"] .count { color: var(--text-strong); }
.sidebar-foot { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--border); display: grid; gap: 6px; }
.me { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 6px; cursor: pointer; border: 0; background: none; text-align: start; width: 100%; }
.me:hover { background: var(--hover); }
.me .who { min-width: 0; }
.me .who b { display: block; font-size: 13px; font-weight: 600; color: var(--text-strong); }
.me .who small { display: block; font-size: 11.5px; color: var(--faint); }

.main { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 10px; height: 56px; padding: 0 24px; border-bottom: 1px solid var(--border); background: var(--surface); flex: none; }
.topbar h1 { margin: 0; font-size: 15px; font-weight: 600; color: var(--text-strong); }
.content { flex: 1; overflow: auto; }
.page { max-width: 1120px; margin: 0 auto; padding: 32px 28px 64px; }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 24px; }
.page-head h2 { margin: 0; font-size: 30px; font-weight: 400; color: var(--text-strong); }
.page-head p { margin: 6px 0 0; color: var(--muted); }

.search { position: relative; }
.search .icon { position: absolute; inset-inline-start: 10px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.search .input { padding-inline-start: 34px; background: var(--surface-2); }

.mobile-only { display: none; }

/* reveal */
.reveal { animation: reveal 0.6s cubic-bezier(0.16, 1, 0.3, 1) both; animation-delay: calc(var(--i, 0) * 60ms); }
@keyframes reveal { from { opacity: 0; transform: translateY(10px); } }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; top: 0; bottom: 0; inset-inline-start: 0; width: 268px; z-index: 90; transform: translateX(-100%); transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1); box-shadow: var(--shadow-pop); background: var(--surface); }
  [dir="rtl"] .sidebar { transform: translateX(100%); }
  .shell.nav-open .sidebar { transform: none; }
  .shell.nav-open::after { content: ""; position: fixed; inset: 0; background: var(--scrim); z-index: 80; }
  .mobile-only { display: inline-flex; }
  .topbar { padding: 0 12px; }
  .page { padding: 22px 16px 48px; }
  .page-head { flex-wrap: wrap; }
  .page-head h2 { font-size: 24px; }
}

/* ---------- refresh: accent, depth, borders ---------- */
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--on-accent); border-color: transparent; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18), 0 4px 14px color-mix(in srgb, var(--accent) 28%, transparent); }
.btn.primary:hover { background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 88%, #000), color-mix(in srgb, var(--accent-2) 88%, #000)); border-color: transparent; }
.btn { border-radius: 8px; }
.input, .select, .textarea { border-radius: 8px; }
.card { border-radius: 14px; border-color: var(--border-strong); box-shadow: var(--card-shadow); }
.card-head { border-bottom-color: var(--border-strong); }
.modal { border-radius: 16px; border: 1px solid var(--border-strong); }
.sidebar { border-inline-end-color: var(--border-strong); }
.topbar { border-bottom-color: var(--border-strong); }
.nav a[aria-current="page"], .nav button.nav-item[aria-current="page"] { position: relative; background: color-mix(in srgb, var(--accent) 14%, var(--surface)); color: var(--text-strong); }
.nav a[aria-current="page"]::before, .nav button.nav-item[aria-current="page"]::before { content: ""; position: absolute; inset-inline-start: -10px; top: 7px; bottom: 7px; width: 3px; border-radius: 3px; background: linear-gradient(var(--accent), var(--accent-2)); }
.nav a[aria-current="page"] .icon { color: var(--accent-text); }
.brand .mark { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; box-shadow: 0 4px 12px color-mix(in srgb, var(--accent) 35%, transparent); }
.check input, .scope input { accent-color: var(--accent); }
a.link { color: var(--accent-text); text-decoration: none; }
a.link:hover { text-decoration: underline; }

/* liquid: soft, slowly morphing colour blobs behind a surface (sign-in, About) */
.liquid { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.liquid i { position: absolute; display: block; width: 46%; aspect-ratio: 1; filter: blur(42px); opacity: 0.55;
  border-radius: 42% 58% 63% 37% / 41% 44% 56% 59%; animation: liquid-morph 14s ease-in-out infinite alternate, liquid-drift 22s ease-in-out infinite alternate; }
.liquid .b1 { background: radial-gradient(circle at 30% 30%, var(--accent), transparent 70%); top: -18%; inset-inline-start: -10%; }
.liquid .b2 { background: radial-gradient(circle at 60% 40%, var(--accent-2), transparent 70%); bottom: -22%; inset-inline-end: -12%; animation-delay: -6s, -9s; animation-duration: 17s, 26s; }
.liquid .b3 { width: 34%; background: radial-gradient(circle at 50% 50%, #19b8a6, transparent 70%); top: 38%; inset-inline-start: 38%; opacity: 0.32; animation-delay: -3s, -14s; animation-duration: 12s, 19s; }
[data-theme="paper"] .liquid i, [data-theme="snow"] .liquid i, [data-theme="sepia"] .liquid i { opacity: 0.3; }
@keyframes liquid-morph {
  0% { border-radius: 42% 58% 63% 37% / 41% 44% 56% 59%; }
  50% { border-radius: 63% 37% 38% 62% / 58% 63% 37% 42%; }
  100% { border-radius: 36% 64% 52% 48% / 38% 52% 48% 62%; }
}
@keyframes liquid-drift {
  0% { transform: translate(0, 0) rotate(0deg) scale(1); }
  50% { transform: translate(8%, 6%) rotate(40deg) scale(1.08); }
  100% { transform: translate(-6%, 10%) rotate(80deg) scale(0.95); }
}
.chip-icon { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex: none; color: var(--accent-text); background: color-mix(in srgb, var(--accent) 14%, var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); }

/* footer (copyright + developer) */
.app-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 10px; padding: 18px 16px; font-size: 12px; color: var(--muted); }
.app-foot .dot { opacity: 0.5; }
.app-foot a { color: inherit; text-decoration: none; }
.app-foot a:hover { color: var(--text-strong); }
.app-foot .about-btn { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--border-strong); background: var(--surface); color: var(--muted); cursor: pointer; transition: color 0.15s, border-color 0.15s, transform 0.15s; }
.app-foot .about-btn:hover { color: var(--accent-text); border-color: var(--accent); transform: translateY(-1px); }
.app-foot .about-btn .icon { width: 14px; height: 14px; }
.sidebar .app-foot { padding: 10px 4px 0; justify-content: flex-start; font-size: 11.5px; }

/* timeline (changelog) */
html[lang] ol.timeline { list-style: none; }
.timeline { position: relative; display: grid; gap: 18px; margin: 0; padding: 0; list-style: none; }
.timeline::before { content: ""; position: absolute; inset-inline-start: 15px; top: 6px; bottom: 6px; width: 2px; background: linear-gradient(var(--accent), color-mix(in srgb, var(--accent-2) 30%, transparent)); border-radius: 2px; }
.timeline > li { position: relative; padding-inline-start: 46px; }
.timeline .node { position: absolute; inset-inline-start: 6px; top: 4px; width: 20px; height: 20px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); display: grid; place-items: center; }
.timeline .node::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: linear-gradient(var(--accent), var(--accent-2)); }
.timeline li.current .node { box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 20%, transparent); }
.timeline .rel { border: 1px solid var(--border-strong); border-radius: 14px; background: var(--surface); padding: 16px 18px; box-shadow: var(--card-shadow); }
.timeline .rel-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 10px; }
.timeline .ver { font-weight: 700; font-size: 15px; color: var(--text-strong); direction: ltr; unicode-bidi: isolate; }
.timeline .rel-title { color: var(--text-strong); font-weight: 600; }
.timeline .rel-date { margin-inline-start: auto; font-size: 12px; color: var(--muted); }
.timeline .changes { margin: 0; padding: 0; list-style: none; display: grid; gap: 7px; }
.timeline .changes li { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; }
.timeline .changes .badge { flex: none; min-width: 64px; justify-content: center; margin-top: 1px; }

@media (max-width: 640px) {
  /* Tables become stacked cards on phones: one bordered card per row, each value labelled. */
  table.table.stack thead { display: none; }
  table.table.stack, table.table.stack tbody, table.table.stack tr, table.table.stack td { display: block; width: 100%; }
  table.table.stack tbody { padding: 10px; display: grid; gap: 10px; }
  table.table.stack tr { border: 1px solid var(--border-strong); border-radius: 12px; background: var(--surface); padding: 6px 0; }
  table.table.stack td { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 14px; border: 0; text-align: end; min-width: 0; }
  table.table.stack td > * { min-width: 0; }
  table.table.stack td[data-label]::before { content: attr(data-label); flex: none; font-size: 11.5px; font-weight: 600; color: var(--faint); text-align: start; }
  table.table.stack td.actions { justify-content: flex-end; border-top: 1px solid var(--border); margin-top: 4px; padding-top: 10px; }
  table.table.stack td.hide-sm { display: none; }
  table.table.stack td:first-child { text-align: start; }
  table.table.stack td:first-child[data-label]::before { display: none; }
  .table-wrap { overflow: visible; }
  .modal-foot { flex-wrap: wrap; }
  .modal-foot .btn { flex: 1; }
  .scrim { padding: 12px; align-items: end; }
  .modal { max-height: calc(100dvh - 24px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
html[lang="fa"] ol { list-style-type: persian; }
