@font-face { font-family: "YekanBakh"; src: url("../fonts/YekanBakh-VF.woff2") format("woff2-variations"), url("../fonts/YekanBakh-VF.woff2") format("woff2"); font-weight: 100 1000; font-display: swap; }

/* ═══════════ رنگ‌ها و اندازه‌ها ═══════════ */
:root {
  color-scheme: light;
  --bg: #f4f6fa; --card: #fff; --text: #111827; --muted: #6b7280; --line: #e6e9ef;
  --field: #fff; --field-line: #d4d9e2; --hover: #f1f4f9;
  --primary: #2563eb; --primary-ink: #fff; --primary-soft: #e8efff;
  --ok: #15915a; --bad: #d23b3b; --warn: #b7791f; --info: #2563eb;
  --sent: #2563eb; --fail: #e06363; --open: #15915a; --code: #0f172a; --code-ink: #e2e8f0;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .04);
  --radius: 14px; --radius-sm: 10px;
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme=light]) {
    color-scheme: dark;
    --bg: #0c1018; --card: #141a24; --text: #e7ebf2; --muted: #8d97a8; --line: #222b39;
    --field: #0f141d; --field-line: #2d3848; --hover: #1a2230;
    --primary: #5b8cff; --primary-soft: #1a2747;
    --ok: #34c28b; --bad: #f07272; --warn: #e0a64a; --info: #5b8cff;
    --sent: #5b8cff; --fail: #ef7070; --open: #33c08a; --code: #0a0e15;
    --shadow: none;
    --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238d97a8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  }
}
:root[data-theme=dark] {
    color-scheme: dark;
    --bg: #0c1018; --card: #141a24; --text: #e7ebf2; --muted: #8d97a8; --line: #222b39;
    --field: #0f141d; --field-line: #2d3848; --hover: #1a2230;
    --primary: #5b8cff; --primary-soft: #1a2747;
    --ok: #34c28b; --bad: #f07272; --warn: #e0a64a; --info: #5b8cff;
    --sent: #5b8cff; --fail: #ef7070; --open: #33c08a; --code: #0a0e15;
    --shadow: none;
    --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238d97a8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  }
* { box-sizing: border-box; }
/* جای نوار اسکرول همیشه رزرو شود تا با رفتن به صفحهٔ بلندتر منو و محتوا جابه‌جا نشوند */
html { overflow-y: scroll; scrollbar-gutter: stable; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.75 YekanBakh, Tahoma, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
b, strong, th { font-weight: 600; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: Consolas, "Cascadia Mono", monospace; font-size: 12.5px; background: color-mix(in srgb, var(--line) 70%, transparent); padding: 1px 5px; border-radius: 5px; }
h1 { font-size: 22px; font-weight: 700; margin: 0; line-height: 1.4; }
h2 { font-size: 16px; font-weight: 700; margin: 0 0 12px; }
h3 { font-size: 13.5px; font-weight: 600; margin: 18px 0 10px; color: var(--muted); }

.top { display: flex; align-items: center; gap: 20px; padding: 0 20px; height: 54px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 700; color: var(--text); white-space: nowrap; }

/* ---------- منوی کناری (سمت راست): آیکون بالا، متن زیرش ---------- */
.side { position: fixed; flex: none; box-sizing: border-box; top: 0; bottom: 0; right: 0; width: 96px; z-index: 10; background: var(--card); border-left: 1px solid var(--line);
  display: flex; flex-direction: column; align-items: center; padding: 14px 0 12px; gap: 6px; }
.side .logo { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; color: var(--primary-ink); background: var(--primary); margin-bottom: 10px; }
.side .logo:hover { text-decoration: none; }
.side .logo svg { width: 24px; height: 24px; }
.side nav { display: flex; flex-direction: column; gap: 4px; width: 100%; padding: 0 9px; flex: 1; overflow-y: auto; scrollbar-width: none; }
.side nav a { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 9px 2px 8px; border-radius: 14px; color: var(--muted);
  font-size: 12px; font-weight: 500; line-height: 1.3; text-align: center; transition: background .15s, color .15s; }
.side nav a svg { width: 24px; height: 24px; flex: none; }
.side nav a:hover { background: var(--bg); color: var(--text); text-decoration: none; }
.side nav a.active { background: var(--primary); color: var(--primary-ink); font-weight: 600; box-shadow: 0 4px 14px color-mix(in srgb, var(--primary) 35%, transparent); }
.side .me { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 0; padding-top: 10px; border-top: 1px solid var(--line); width: 64px; }
.side .avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 15px;
  color: var(--primary); background: color-mix(in srgb, var(--primary) 14%, var(--card)); border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent); }
.side .me button { display: flex; flex-direction: column; align-items: center; gap: 2px; border: 0; background: none; padding: 4px; color: var(--muted); font-size: 11px; border-radius: 10px; }
.side .me button:hover { color: var(--bad); background: var(--bg); }
.side .me button svg { width: 18px; height: 18px; }
/* جای منو با padding بدنه؛ محتوا کل عرض باقی‌مانده را می‌گیرد */
body.has-side { padding-right: 96px; }

/* «بیشتر» فقط در موبایل است */
.side .more { display: none; }
.side .more > summary::before { display: none; }

@media (max-width: 760px) {
  .side { top: auto; left: 0; width: auto; height: calc(64px + env(safe-area-inset-bottom)); padding: 0 4px env(safe-area-inset-bottom);
    flex-direction: row; align-items: stretch; border-left: 0; border-top: 1px solid var(--line); gap: 0; }
  .side .logo, .side .me, .side nav a.extra { display: none; }
  .side nav { flex-direction: row; padding: 0; gap: 0; overflow: visible; }
  .side nav a, .side .more > summary { flex: 1 1 0; min-width: 0; margin: 7px 2px; padding: 6px 0 4px; gap: 2px; font-size: 11px; border-radius: 12px; }
  .side nav a svg, .side .more > summary svg { width: 21px; height: 21px; }
  .side nav a span, .side .more > summary span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .side .more { display: flex; flex: 1 1 0; min-width: 0; margin: 0; }
  .side .more > summary { list-style: none; display: flex; flex-direction: column; align-items: center; color: var(--muted); cursor: pointer; font-weight: 500; line-height: 1.3; }
  .side .more > summary::-webkit-details-marker { display: none; }
  .side .more.active > summary, .side .more[open] > summary { background: var(--bg); color: var(--primary); font-weight: 600; }
  .side .sheet { position: fixed; left: 10px; right: 10px; bottom: calc(72px + env(safe-area-inset-bottom)); background: var(--card); border: 1px solid var(--line);
    border-radius: 16px; padding: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.35); display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .side .sheet a, .side .sheet button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 4px; border-radius: 12px; border: 0;
    background: var(--bg); color: var(--text); font-size: 12px; font-weight: 500; text-decoration: none; width: 100%; }
  .side .sheet a.active { background: var(--primary); color: var(--primary-ink); }
  .side .sheet svg { width: 22px; height: 22px; }
  .side .sheet form { margin: 0; display: flex; }
  .side .sheet button { color: var(--bad); }
  .side .sheet .who { grid-column: 1 / -1; color: var(--muted); font-size: 12px; padding: 2px 6px 4px; }
  body.has-side { padding-right: 0; }
  body.has-side main { padding-bottom: 92px; }
}

/* ═══════════ چیدمان ═══════════ */
main { margin: 0; padding: 24px 28px 64px; }
/* صفحه‌های بدون منو (گزارش عمومی، ورود) وسط‌چین با عرض محدود */
body:not(.has-side) main { max-width: 1320px; margin: 0 auto; }
main.center { display: grid; place-items: center; min-height: 100vh; padding-top: 0; }

/* سرِ صفحه: عنوان و توضیح کوتاه در یک طرف، فیلترها یا دکمهٔ اصلی در طرف دیگر */
.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.head h1 small { font-size: 14px; font-weight: 500; }
.head .muted.small, .head .lead { margin-top: 2px; }
.lead { color: var(--muted); font-size: 13.5px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; margin-bottom: 18px; min-width: 0; box-shadow: var(--shadow); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.card-head h2 { margin: 0; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr)); gap: 18px; margin-bottom: 18px; }
.grid2 > .card { margin-bottom: 0; }

/* ═══════════ عددهای خلاصه ═══════════ */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; display: flex; flex-direction: column; gap: 2px; box-shadow: var(--shadow); }
.kpi span { color: var(--muted); font-size: 13px; font-weight: 500; }
.kpi b { font-size: 28px; font-weight: 700; line-height: 1.3; font-variant-numeric: tabular-nums; }
.kpi small { color: var(--muted); font-size: 12px; }
.kpi.bad b { color: var(--bad); } .kpi.ok b { color: var(--ok); }

/* ═══════════ جدول ═══════════ */
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
th, td { text-align: right; padding: 12px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-size: 12.5px; font-weight: 600; white-space: nowrap; background: color-mix(in srgb, var(--bg) 55%, var(--card)); }
thead th:first-child { border-start-start-radius: var(--radius-sm); }
thead th:last-child { border-start-end-radius: var(--radius-sm); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: var(--hover); }
td.num, th.num { text-align: left; font-variant-numeric: tabular-nums; white-space: nowrap; }
.card { overflow-x: auto; }
.card > table:first-child, .card > .table-wrap:first-child { margin-top: -6px; }
.sub { color: var(--muted); font-size: 12px; }
.small { font-size: 12.5px; } .muted { color: var(--muted); }
.t-ok { color: var(--ok); } .t-bad { color: var(--bad); } .warn-text { color: var(--warn); }
.pre { white-space: pre-wrap; }
.cell-title { font-weight: 600; color: var(--text); }
a.cell-title:hover { color: var(--primary); }

/* ═══════════ برچسب وضعیت ═══════════ */
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; line-height: 1.6; padding: 1px 10px; border-radius: 99px; background: color-mix(in srgb, var(--muted) 12%, transparent);
  color: var(--muted); font-weight: 600; vertical-align: middle; white-space: nowrap; border: 0; }
.pill.ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 13%, transparent); }
.pill.bad { color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, transparent); }
.pill.warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); }
.pill.info { color: var(--info); background: color-mix(in srgb, var(--info) 12%, transparent); }

/* ═══════════ فرم‌ها ═══════════ */
label { display: flex; flex-direction: column; gap: 6px; color: var(--text); font-size: 13px; font-weight: 500; margin-bottom: 16px; flex: 1; min-width: 200px; }
label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; min-width: auto; flex: 0 0 auto; margin-left: 16px; cursor: pointer; }
.hint { color: var(--muted); font-size: 12px; font-weight: 400; }

:where(input:not([type=checkbox], [type=radio], [type=file])), select, textarea {
  font: inherit; font-size: 14px; color: var(--text); background: var(--field); width: 100%;
  border: 1px solid var(--field-line); border-radius: var(--radius-sm); height: 42px; padding: 0 12px;
  transition: border-color .15s, box-shadow .15s, background .15s; outline: none; }
textarea { height: auto; min-height: 92px; padding: 10px 12px; line-height: 1.75; resize: vertical; }
:where(input:not([type=checkbox], [type=radio], [type=file])):hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--primary) 35%, var(--field-line)); }
:where(input:not([type=checkbox], [type=radio], [type=file])):focus, select:focus, textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .7; }
input:disabled, select:disabled, textarea:disabled { opacity: .55; cursor: not-allowed; }
input[type=file] { font: inherit; font-size: 13px; color: var(--muted); }
input[type=file]::file-selector-button { font: inherit; margin-left: 10px; border: 1px solid var(--field-line); background: var(--card); color: var(--text); padding: 7px 14px; border-radius: 8px; cursor: pointer; }
/* منوی کشویی با فلش سفارشی (سمت چپ در RTL) */
select { appearance: none; -webkit-appearance: none; background-image: var(--chevron); background-repeat: no-repeat; background-position: left 12px center; background-size: 16px; padding-left: 38px; cursor: pointer; }
select option { background: var(--card); color: var(--text); }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; accent-color: var(--primary); cursor: pointer; flex: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; }
input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type=search]::-webkit-search-cancel-button { cursor: pointer; }
textarea.code, pre.code { font: 12.5px/1.6 Consolas, "Cascadia Mono", monospace; }
pre.code { background: var(--code); color: var(--code-ink); padding: 14px; border-radius: var(--radius-sm); overflow: auto; max-height: 460px; margin: 0; white-space: pre; }
.row { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; }
.row > label { margin-bottom: 16px; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius-sm); margin: 0 0 14px; padding: 12px; display: flex; flex-wrap: wrap; gap: 6px; }
legend { color: var(--muted); font-size: 12.5px; padding: 0 6px; }

/* بخش جمع‌شونده با فلش */
details { margin-top: 10px; }
summary { cursor: pointer; color: var(--primary); font-weight: 500; list-style: none; display: inline-flex; align-items: center; gap: 6px; margin-bottom: 10px; user-select: none; }
summary::-webkit-details-marker { display: none; }
summary::before { content: ""; width: 16px; height: 16px; background: currentColor; flex: none; transition: transform .15s;
  -webkit-mask: var(--chevron) center / 16px no-repeat; mask: var(--chevron) center / 16px no-repeat; transform: rotate(90deg); }
details[open] > summary::before { transform: none; }

/* ═══════════ دکمه ═══════════ */
button, .btn { font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; border: 1px solid var(--field-line); background: var(--card); color: var(--text);
  padding: 8px 16px; border-radius: var(--radius-sm); display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; line-height: 1.5;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s; }
button:hover, .btn:hover { background: var(--hover); text-decoration: none; }
button:focus-visible, .btn:focus-visible { outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 25%, transparent); }
button.primary, .btn.primary { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
button.primary:hover, .btn.primary:hover { background: color-mix(in srgb, var(--primary) 88%, #000); }
button.danger, .btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, var(--field-line)); }
button.danger:hover { background: color-mix(in srgb, var(--bad) 10%, transparent); }
button.link { border: 0; background: none; color: var(--primary); padding: 0; font-weight: 500; }
button.link:hover { background: none; text-decoration: underline; }
button.sm, .btn.sm { padding: 4px 12px; font-size: 12.5px; border-radius: 8px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.actions form { margin: 0; }

/* نوار فیلتر بالای لیست‌ها */
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters select, .filters input { width: auto; min-width: 150px; height: 40px; }
.filters input[name=q] { min-width: 240px; }
.filters a { padding: 6px 12px; border-radius: 8px; color: var(--muted); }
.filters a.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; margin-bottom: 18px; box-shadow: var(--shadow); }
.toolbar .grow { flex: 1; }

/* ═══════════ پیام و راهنما ═══════════ */
.flash { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; border: 1px solid; font-weight: 500; }
.flash.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, transparent); background: color-mix(in srgb, var(--ok) 8%, var(--card)); }
.flash.bad { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, transparent); background: color-mix(in srgb, var(--bad) 8%, var(--card)); }
.flash.warn { color: var(--text); border-color: color-mix(in srgb, var(--warn) 45%, transparent); background: color-mix(in srgb, var(--warn) 10%, var(--card)); }
.secret { display: flex; gap: 8px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.secret code { font-size: 14px; padding: 6px 10px; word-break: break-all; }

.kv { display: grid; grid-template-columns: 150px 1fr; gap: 10px 16px; margin: 0; }
.kv dt { color: var(--muted); font-size: 13px; } .kv dd { margin: 0; word-break: break-word; }

/* ═══════════ نمودار ═══════════ */
.chart { width: 100%; height: 240px; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; }
.chart .s-sent { fill: var(--sent); opacity: .85; }
.chart .s-fail { fill: var(--fail); }
.chart .s-open { stroke: var(--open); stroke-width: 2.5; }
.chart .s-open-bar { fill: var(--open); opacity: .8; }
.card svg.chart[aria-label="ساعت باز شدن"] { height: 140px; }
.legend { display: flex; gap: 14px; align-items: center; color: var(--muted); font-size: 12.5px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-left: 5px; vertical-align: middle; }
.l-sent { background: var(--sent); } .l-fail { background: var(--fail); } .l-open { background: var(--open); }

.hbar { display: grid; grid-template-columns: 160px 1fr 70px; gap: 10px; align-items: center; margin-bottom: 8px; font-size: 13px; }
.hbar > div { background: var(--bg); border-radius: 99px; height: 8px; overflow: hidden; }
.hbar i { display: block; height: 100%; background: var(--primary); border-radius: 99px; }
.hbar i.bad { background: var(--bad); } .hbar i.muted { background: var(--muted); }
.hbar b { font-weight: 600; text-align: left; font-variant-numeric: tabular-nums; }
.hbar span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; margin: -6px 0 16px; }
.progress i { display: block; height: 100%; background: var(--primary); transition: width .5s; }
.pager { display: flex; gap: 14px; justify-content: center; align-items: center; padding-top: 14px; color: var(--muted); }
.pager a { padding: 6px 14px; border: 1px solid var(--field-line); border-radius: 8px; }
.pager a:hover { background: var(--hover); text-decoration: none; }

/* تب‌های صفحه (لینک) */
.page-tabs { display: flex; gap: 4px; padding: 4px; background: color-mix(in srgb, var(--line) 55%, transparent); border-radius: 12px; overflow-x: auto; scrollbar-width: none; margin-bottom: 20px; width: fit-content; max-width: 100%; }
.page-tabs a { padding: 7px 16px; border-radius: 9px; color: var(--muted); font-weight: 500; white-space: nowrap; }
.page-tabs a:hover { color: var(--text); text-decoration: none; }
.page-tabs a.on { background: var(--card); color: var(--text); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.12); }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tab { flex-direction: row; align-items: center; gap: 6px; min-width: auto; flex: 0 0 auto; border: 1px solid var(--field-line); padding: 6px 12px; border-radius: 9px; cursor: pointer; margin: 0; }
.tab:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
[hidden] { display: none !important; }

.phone { background: linear-gradient(160deg, #3a4a6b, #1d2433); border-radius: 18px; padding: 24px 14px; min-height: 160px; }
.notif { background: rgba(255,255,255,.94); color: #111; border-radius: 14px; padding: 10px 14px; box-shadow: 0 4px 14px rgba(0,0,0,.25); }
.notif b { display: block; min-height: 1.4em; } .notif p { margin: 2px 0 0; font-size: 13px; color: #333; white-space: pre-wrap; }
.notif { display: flex; align-items: flex-start; gap: 12px; }
.notif-text { flex: 1; min-width: 0; }
.notif-text p { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
/* مثل large icon اندروید: مربع، روبه‌روی متن */
.notif img { flex: none; width: 46px; height: 46px; object-fit: cover; border-radius: 8px; background: #e6e8ec; }

.login { width: min(400px, 92vw); padding: 28px; }
.login h1 { text-align: center; margin-bottom: 20px; }
.login button { width: 100%; padding: 10px; }
.center-text { text-align: center; }
.share-box { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.share-box input { flex: 1; min-width: 240px; direction: ltr; }
.login .sso { display: flex; text-align: center; padding: 11px; margin-bottom: 8px; }
.login details { margin-top: 14px; }

/* ═══════════ موبایل: محتوا ═══════════ */
@media (max-width: 760px) {
  main { padding: 16px 12px 60px; }
  .head { align-items: stretch; flex-direction: column; margin-bottom: 14px; }
  .card { padding: 14px; border-radius: 12px; }
  h1 { font-size: 19px; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 12px; } .kpi b { font-size: 22px; }
  table { font-size: 13px; }
  th, td { white-space: nowrap; padding: 10px 10px; }
  .filters { gap: 8px; }
  .filters select, .filters input { flex: 1 1 140px; min-width: 0; }
  .filters input[name=q] { flex-basis: 100%; min-width: 0; }
  .filters button { flex: 1 1 100%; }
  label { min-width: 0; flex-basis: 100%; }
  .kv { grid-template-columns: 1fr; gap: 0; }
  .kv dt { margin-top: 10px; font-size: 12px; }
  .hbar { grid-template-columns: 100px 1fr 54px; }
  .page-tabs { width: 100%; }
  .page-tabs a { flex: 1 0 auto; text-align: center; padding: 7px 12px; }
}

/* ---------- صفحهٔ اپ‌ها ---------- */
.empty { text-align: center; color: var(--muted); padding: 32px; }
.app-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 440px), 1fr)); gap: 16px; margin-bottom: 16px; align-items: start; }
.app-grid > .card { margin: 0; }
.app-card { display: flex; flex-direction: column; gap: 14px; padding: 18px; overflow: visible; }
.app-card.off { opacity: .7; }
.app-top { display: flex; align-items: center; gap: 12px; }
.app-ico { width: 46px; height: 46px; border-radius: 13px; flex: none; display: grid; place-items: center; font-size: 20px; font-weight: 700;
  color: var(--primary); background: color-mix(in srgb, var(--primary) 13%, var(--card)); }
.app-ico.p-ios { color: var(--text); background: color-mix(in srgb, var(--muted) 18%, var(--card)); }
.app-ico.p-web { color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, var(--card)); }
.app-title { flex: 1; min-width: 0; }
.app-title h2 { margin: 0; font-size: 16px; }
.app-pkg { color: var(--muted); font-size: 12.5px; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-badges { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.app-stats { display: grid; grid-template-columns: 1fr 1.6fr; gap: 10px; }
.app-stat { background: var(--bg); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; min-width: 0; color: var(--text); }
a.app-stat:hover { text-decoration: none; outline: 1px solid var(--primary); }
.app-stat b { font-size: 22px; line-height: 1.2; }
.app-stat b.txt { font-size: 15px; padding-top: 4px; }
.app-stat span { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; margin: 0; }
.facts .wide { grid-column: 1 / -1; }
.facts dt { color: var(--muted); font-size: 12px; }
.facts dd { margin: 0; text-align: right; word-break: break-word; }
.keys { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.key-row { display: flex; align-items: center; gap: 8px; padding: 8px 12px; flex-wrap: wrap; }
.key-row + .key-row { border-top: 1px solid var(--line); }
.key-row form { margin: 0; }
.key-label { width: 110px; flex: none; font-size: 12.5px; }
.key-label small { display: block; color: var(--muted); font-size: 11px; line-height: 1.2; }
.key-row code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 3px 8px; text-align: left; }
.app-foot { display: flex; flex-direction: column; gap: 4px; border-top: 1px solid var(--line); padding-top: 8px; }
.app-foot details { margin: 0; }
.app-foot summary { margin: 4px 0; }
.app-foot .toggle { margin-top: 6px; }
.add-app summary { color: var(--text); margin: 0; }
.add-app[open] summary { margin-bottom: 12px; }
@media (max-width: 520px) {
  .app-top { flex-wrap: wrap; }
  .app-badges { width: 100%; justify-content: flex-start; }
  .facts { grid-template-columns: 1fr; }
  .key-label { width: 100%; }
}

/* ---------- صفحهٔ ارسال پیام ---------- */
.send .step { overflow: visible; }
.step-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.step-head h2 { margin: 0; }
.step-no { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700;
  background: color-mix(in srgb, var(--primary) 15%, var(--card)); color: var(--primary); flex: none; }
.send svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* اپ‌ها */
.app-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 10px; }
label.app-pick { position: relative; display: flex; flex-direction: row; align-items: center; gap: 10px; margin: 0; min-width: 0; flex: none; padding: 10px 12px;
  border: 1.5px solid var(--line); border-radius: 12px; cursor: pointer; color: var(--text); font-size: 14px; background: var(--card); transition: border-color .15s, background .15s; }
label.app-pick:hover { border-color: color-mix(in srgb, var(--primary) 50%, var(--line)); }
label.app-pick input { position: absolute; opacity: 0; pointer-events: none; }
.app-pick .app-ico { width: 38px; height: 38px; font-size: 16px; border-radius: 10px; }
.app-pick-text { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.4; }
.app-pick-text small { color: var(--muted); font-size: 12px; }
.app-pick .tick { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--line); flex: none; display: grid; place-items: center; }
label.app-pick:has(input:checked) { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 7%, var(--card)); }
label.app-pick:has(input:checked) .tick { background: var(--primary); border-color: var(--primary); }
label.app-pick:has(input:checked) .tick::after { content: ""; width: 9px; height: 5px; border: 2px solid var(--primary-ink); border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
label.app-pick:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; }

/* کنترل بخش‌بندی‌شده (تب‌ها) */
.seg { display: flex; gap: 4px; padding: 4px; background: var(--bg); border-radius: 12px; overflow-x: auto; scrollbar-width: none; margin-bottom: 14px; }
.seg button { flex: 1 0 auto; display: flex; align-items: center; justify-content: center; gap: 6px; border: 0; background: none; color: var(--muted);
  padding: 8px 12px; border-radius: 9px; font-weight: 500; white-space: nowrap; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--card); color: var(--primary); font-weight: 600; box-shadow: 0 1px 4px rgba(0,0,0,.12); }
.seg button small { color: var(--muted); font-weight: 400; margin-right: 2px; }
.small-seg { display: inline-flex; margin-bottom: 10px; }
.small-seg button { flex: 0 0 auto; padding: 5px 12px; font-size: 13px; }

.pane { min-height: 60px; }
.callout { padding: 12px 14px; border-radius: 10px; background: color-mix(in srgb, var(--warn) 10%, var(--card)); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); }

/* انتخاب‌شده‌ها و chip */
.picked { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 10px; border: 1px dashed var(--line); border-radius: 12px; margin-bottom: 12px; min-height: 48px; }
.picked-head { flex-basis: 100%; display: flex; justify-content: space-between; align-items: center; font-size: 13px; margin-bottom: 2px; }
.picked-empty { color: var(--muted); font-size: 13px; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--card); color: var(--text);
  border-radius: 99px; padding: 4px 12px; font-size: 13px; line-height: 1.5; white-space: nowrap; cursor: pointer; max-width: 100%; }
.chip small { color: var(--muted); font-size: 11.5px; }
.chip:hover { border-color: var(--primary); }
.chip.on { background: color-mix(in srgb, var(--primary) 13%, var(--card)); border-color: var(--primary); color: var(--primary); font-weight: 600; }
.chip.on small { color: color-mix(in srgb, var(--primary) 70%, var(--muted)); }
span.chip { cursor: default; padding-left: 4px; }
.chip > button { border: 0; background: none; padding: 0 6px; font-size: 16px; line-height: 1; color: inherit; border-radius: 50%; }
.chip > button:hover { background: color-mix(in srgb, var(--primary) 20%, transparent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* جست‌وجو و لیست */
.search { position: relative; }
.search svg { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input { padding-right: 38px; height: 42px; border-radius: 10px; }
.list-tools { display: flex; justify-content: space-between; align-items: center; margin: 8px 2px; }
.pick-list { max-height: 360px; overflow-y: auto; border: 1px solid var(--line); border-radius: 12px; }
label.pick { display: flex; flex-direction: row; align-items: center; gap: 10px; margin: 0; min-width: 0; flex: none; padding: 9px 12px;
  color: var(--text); font-size: 14px; cursor: pointer; border-bottom: 1px solid var(--line); transition: background .12s; }
label.pick:last-child { border-bottom: 0; }
label.pick:hover { background: var(--bg); }
label.pick.on { background: color-mix(in srgb, var(--primary) 8%, var(--card)); }
label.pick input { width: 18px; height: 18px; accent-color: var(--primary); flex: none; }
.pick .avatar { width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 700; text-transform: uppercase;
  color: var(--primary); background: color-mix(in srgb, var(--primary) 12%, var(--card)); }
.pick .avatar.dev { border-radius: 9px; }
.pick-main { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.45; }
.pick-main b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; }
.pick-main small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-side { white-space: nowrap; }
.empty-list { padding: 22px; text-align: center; color: var(--muted); }
details.paste { margin-top: 10px; }
details.paste textarea { margin-bottom: 8px; }

/* فیلترها */
.facets { display: flex; flex-direction: column; }
.facet { padding: 12px 0; border-bottom: 1px solid var(--line); }
.facet:first-child { padding-top: 0; }
.facet:last-of-type { border-bottom: 0; }
.facet-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; margin-bottom: 8px; }
.facet-sub { font-size: 12px; color: var(--muted); margin: 6px 0 5px; }
.sdk-range { margin-top: 10px; }
.sdk-range label { flex: 0 1 220px; margin: 0; }
.facet-row { align-items: center; }
.facet-row label { margin: 0; }
#filterReset { margin-top: 10px; }

/* تعداد مخاطب */
.reach { display: flex; align-items: center; gap: 16px; margin-top: 16px; padding: 14px 16px; border-radius: 12px;
  background: color-mix(in srgb, var(--primary) 9%, var(--card)); border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent); transition: opacity .2s; }
.reach.loading { opacity: .6; }
.reach.zero { background: color-mix(in srgb, var(--warn) 10%, var(--card)); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.reach.bad { background: color-mix(in srgb, var(--bad) 8%, var(--card)); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.reach.bad #reachDesc { color: var(--bad); }
.reach-num { display: flex; flex-direction: column; align-items: center; min-width: 74px; line-height: 1.1; }
.reach-num b { font-size: 30px; color: var(--primary); }
.reach.zero .reach-num b { color: var(--warn); }
.reach-num span { font-size: 12px; color: var(--muted); }
.reach-text { flex: 1; min-width: 0; }

/* ارسال */
.send-bar .row { align-items: flex-end; }
.send-actions { flex: 1; display: flex; justify-content: flex-end; min-width: 220px; margin-bottom: 10px; }
button.big { padding: 11px 28px; font-size: 15px; font-weight: 600; border-radius: 10px; min-width: 220px; }

@media (max-width: 760px) {
  .seg button { flex: 0 0 auto; padding: 8px 10px; font-size: 13px; }
  .pick-side { display: none; }
  .reach-num b { font-size: 24px; }
  .send-actions, button.big { width: 100%; min-width: 0; }
  .sdk-range label { flex: 1 1 140px; }
}

/* ---------- داشبورد: نصب و فعالیت ---------- */
:root { --c0: #2f6fed; --c1: #12a594; --c2: #e8833a; --c3: #8e5bd8; --c4: #d6487e; --c5: #8a9199; --line-c: #1d2433; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme=light]) { --c0: #5b8cff; --c1: #2cc2ad; --c2: #f0a060; --c3: #a985ec; --c4: #ec6d9c; --c5: #8b93a5; --line-c: #e5e9f0; }
}
:root[data-theme=dark] { --c0: #5b8cff; --c1: #2cc2ad; --c2: #f0a060; --c3: #a985ec; --c4: #ec6d9c; --c5: #8b93a5; --line-c: #e5e9f0; }
.kpi-group { margin: 6px 2px 8px; color: var(--muted); font-size: 13px; font-weight: 600; }
.chart .c0 { fill: var(--c0); } .chart .c1 { fill: var(--c1); } .chart .c2 { fill: var(--c2); }
.chart .c3 { fill: var(--c3); } .chart .c4 { fill: var(--c4); } .chart .c5 { fill: var(--c5); }
.chart .hit { fill: transparent; }
.chart .hit:hover { fill: color-mix(in srgb, var(--text) 6%, transparent); }
.chart .s-line { stroke: var(--line-c); stroke-width: 2; stroke-linejoin: round; opacity: .85; }
.chart .mark { fill: var(--bad); stroke: var(--card); stroke-width: 1.5; }
.legend { flex-wrap: wrap; }
.legend span { white-space: nowrap; }
.lc0 { background: var(--c0); } .lc1 { background: var(--c1); } .lc2 { background: var(--c2); }
.lc3 { background: var(--c3); } .lc4 { background: var(--c4); } .lc5 { background: var(--c5); }
.legend i.l-line { height: 3px; border-radius: 2px; background: var(--line-c); }
.legend i.l-mark { border-radius: 50%; background: var(--bad); width: 9px; height: 9px; }
.table-wrap { overflow-x: auto; }
table.versions { margin-bottom: 8px; }
table.versions td { vertical-align: middle; }
.share { display: inline-block; width: calc(100% - 52px); height: 8px; background: var(--bg); border-radius: 99px; overflow: hidden; vertical-align: middle; margin-left: 6px; }
.share i { display: block; height: 100%; background: var(--c0); border-radius: 99px; }

/* چیدمان صفحهٔ ارسال: قدم‌ها در ستون اصلی، خلاصه و دکمهٔ ارسال در ستون کناری ثابت */
.send-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 18px; align-items: start; }
.send-main { min-width: 0; }
.send-aside { position: sticky; top: 20px; }
.summary { display: flex; flex-direction: column; gap: 14px; overflow: visible; }
.summary h2 { margin: 0; }
.summary .reach { margin-top: 0; }
.summary .phone { min-height: 0; padding: 18px 12px; }
.summary .when { display: flex; flex-direction: column; gap: 10px; }
.summary .when .small-seg { margin: 0; width: 100%; }
.summary .when .small-seg button { flex: 1; }
.summary .when label { margin: 0; }
.summary button.big { width: 100%; min-width: 0; }
.summary details { margin: 0; }
details.more-opts { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 4px; }
details.more-opts > summary { margin-bottom: 0; }
details.more-opts[open] > summary { margin-bottom: 14px; }
details.more-opts summary .hint { margin-right: 6px; }
@media (max-width: 1150px) {
  .send-layout { grid-template-columns: 1fr; }
  .send-aside { position: static; }
}
.toolbar input[name=q] { flex: 1 1 260px; }
.empty .small { margin-top: 6px; }
/* ردیف فرم‌هایی که زیر بعضی فیلدها راهنما دارند: برچسب‌ها هم‌تراز بمانند */
.more-opts .row, .form-grid { align-items: flex-start; }
.notif .ph { color: #9aa1ad; font-weight: 400; }

/* با زدن روی اعلان */
.field-label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 8px; }
.tap { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px; margin-bottom: 16px; background: color-mix(in srgb, var(--bg) 45%, var(--card)); }
.tap .seg { margin-bottom: 12px; background: var(--card); }
.tap .seg button.on { background: var(--primary-soft); box-shadow: none; }
.tap-pane > label:last-child, .tap-pane .row > label { margin-bottom: 0; }
.tap-pane label.check { margin: 6px 0 0; flex-wrap: wrap; }
.tap-pane .callout { margin: 0; }
#screenParams { margin-top: 12px; }
#screenParams:empty { display: none; }
.tap-text { font-size: 12.5px; color: var(--primary); text-align: center; font-weight: 500; }

/* دادهٔ اضافه: کلید و مقدار */
.kv-editor { margin-bottom: 16px; }
.kv-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.kv-head .field-label { margin: 0; }
.kv-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr) 42px; gap: 8px; margin-bottom: 8px; align-items: center; }
.kv-del { padding: 0; height: 42px; font-size: 18px; color: var(--muted); }
.kv-del:hover { color: var(--bad); }
.kv-warn { grid-column: 1 / -1; margin-top: -4px; }
#kvAdd { margin-top: 2px; }
#kvRaw { margin-top: 8px; }
label.dest-editor { flex-basis: 100%; }
label.dest-editor textarea { min-height: 160px; }
label.dest-editor details { margin-top: 4px; font-weight: 400; }

/* فیلد تصویر پیام، با پیش‌نمایش مربعی کنارش */
.img-field { display: flex; gap: 12px; align-items: flex-start; }
.img-field > label { flex: 1; min-width: 0; }
.img-thumb { flex: none; width: 64px; height: 64px; margin-top: 24px; border-radius: 10px; border: 1px dashed var(--line, #d0d4dc);
  display: grid; place-items: center; overflow: hidden; position: relative; color: var(--muted, #9aa1ad); }
.img-thumb svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.img-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.img-thumb.bad { border-color: var(--bad, #d64545); color: var(--bad, #d64545); }
.img-input { display: flex; gap: 8px; align-items: stretch; margin-top: 6px; }
.img-input input { flex: 1; min-width: 0; margin: 0; }
.img-input button { flex: none; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.img-input button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.img-input button.ghost { border-color: transparent; background: none; font-size: 20px; line-height: 1; padding: 0 10px; color: var(--muted); }
.img-thumb[role=button] { cursor: pointer; }
.img-thumb[role=button]:hover, .img-thumb.drop { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.img-thumb.busy img { opacity: .35; }
.img-progress { position: absolute; width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--primary-soft); border-top-color: var(--primary); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 560px) { .img-input { flex-wrap: wrap; } .img-input input { flex-basis: 100%; } }

/* ═══════════ حالت نمایش ═══════════ */
/* فقط هنگام عوض کردن حالت، رنگ‌ها نرم جابه‌جا شوند (نه هنگام باز شدن صفحه) */
.theme-anim, .theme-anim *, .theme-anim *::before, .theme-anim *::after {
  transition: background-color .3s, color .3s, border-color .3s, fill .3s, stroke .3s !important; }
.theme-btn svg + svg { display: none; }
:root[data-theme=dark] .theme-btn svg:first-of-type { display: none; }
:root[data-theme=dark] .theme-btn svg + svg { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme=light]) .theme-btn svg:first-of-type { display: none; }
  :root:not([data-theme=light]) .theme-btn svg + svg { display: block; }
}

/* پایین منوی کناری: حالت نمایش، پروفایل، خروج */
.side .me { gap: 8px; }
.side .me form { margin: 0; }
.side .me .theme-btn { width: 40px; height: 40px; padding: 0; border-radius: 12px; border: 0; background: none; color: var(--muted); }
.side .me .theme-btn:hover { background: var(--bg); color: var(--text); }
.side .me .theme-btn svg { width: 20px; height: 20px; }
.side a.avatar { transition: box-shadow .15s, transform .15s; }
.side a.avatar:hover { text-decoration: none; transform: translateY(-1px); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent); }
.side a.avatar.active { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.side .me button.out:hover { color: var(--bad); }
.side nav a:focus-visible, .side a.avatar:focus-visible, .side .me button:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

@media (max-width: 760px) {
  .side .sheet a.who { grid-column: 1 / -1; flex-direction: row; justify-content: flex-start; gap: 10px; padding: 10px 12px; text-align: right; }
  .side .sheet a.who .avatar { width: 38px; height: 38px; font-size: 15px; flex: none; }
  .side .sheet a.who > span:last-child { display: flex; flex-direction: column; line-height: 1.4; min-width: 0; }
  .side .sheet a.who b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .side .sheet a.who small { color: var(--muted); font-size: 11.5px; }
  .side .sheet a.who.active { background: var(--primary-soft); color: var(--text); }
  .side .sheet button.theme-btn { color: var(--text); }
  .side .sheet button.out { color: var(--bad); }
}

/* ═══════════ پیام‌های بالای صفحه ═══════════ */
.flash { display: flex; align-items: flex-start; gap: 10px; }
.flash > span { flex: 1; min-width: 0; }
.flash-x { border: 0; background: none; padding: 0 6px; font-size: 20px; line-height: 1.2; color: inherit; opacity: .6; border-radius: 6px; }
.flash-x:hover { opacity: 1; background: color-mix(in srgb, currentColor 10%, transparent); }
.flash.toast { animation: flash-in .25s ease-out; transition: opacity .35s, transform .35s; }
.flash.toast.hide { opacity: 0; transform: translateY(-6px); }
@keyframes flash-in { from { opacity: 0; transform: translateY(-6px); } }

/* آیکون داخل دکمه‌ها */
button svg.ico, .btn svg.ico { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
a:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
::selection { background: color-mix(in srgb, var(--primary) 28%, transparent); }

/* ═══════════ صفحهٔ پروفایل ═══════════ */
.profile { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr)); gap: 18px; align-items: start; }
.profile > .card { margin: 0; }
.profile h3 { margin-top: 22px; }
.hero-top { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.avatar { display: grid; place-items: center; border-radius: 50%; font-weight: 700; color: var(--primary);
  background: color-mix(in srgb, var(--primary) 14%, var(--card)); border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent); }
.avatar.xl { width: 72px; height: 72px; font-size: 28px; flex: none;
  background: linear-gradient(140deg, color-mix(in srgb, var(--primary) 26%, var(--card)), color-mix(in srgb, var(--primary) 8%, var(--card))); }
.hero-name { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.hero-name h2 { margin: 0; font-size: 19px; }
.hero-name .chips { margin-top: 4px; }
.chip.static { cursor: default; }
.chip.static:hover { border-color: var(--line); }
.profile-hero .facts > div { min-width: 0; }

.theme-picks { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 10px; }
label.theme-pick { position: relative; display: flex; flex-direction: column; gap: 8px; margin: 0; min-width: 0; padding: 10px; border: 1.5px solid var(--line);
  border-radius: 14px; cursor: pointer; transition: border-color .15s, background .15s; }
label.theme-pick:hover { border-color: color-mix(in srgb, var(--primary) 50%, var(--line)); }
label.theme-pick input { position: absolute; opacity: 0; pointer-events: none; }
label.theme-pick:has(input:checked) { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 7%, var(--card)); }
label.theme-pick:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; }
.theme-text { display: flex; flex-direction: column; line-height: 1.45; }
.theme-text b { font-weight: 600; } .theme-text small { color: var(--muted); font-size: 11.5px; font-weight: 400; }
/* نقاشی کوچک هر حالت: یک پنل با منو و دو کارت */
.theme-art { position: relative; height: 64px; border-radius: 9px; overflow: hidden; border: 1px solid rgba(127,127,127,.25); background: #f4f6fa; }
.theme-art i { position: absolute; border-radius: 4px; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.theme-art i:nth-child(1) { top: 0; bottom: 0; right: 0; width: 16%; border-radius: 0; background: #fff; }
.theme-art i:nth-child(2) { top: 10px; right: 24%; left: 10px; height: 16px; }
.theme-art i:nth-child(3) { top: 32px; right: 24%; width: 38%; height: 22px; background: #2563eb; opacity: .85; }
.theme-art.t-dark { background: #0c1018; }
.theme-art.t-dark i { background: #1b2230; box-shadow: none; }
.theme-art.t-dark i:nth-child(3) { background: #5b8cff; }
.theme-art.t-system { background: linear-gradient(115deg, #f4f6fa 50%, #0c1018 50%); }
.theme-art.t-system i:nth-child(1) { background: #1b2230; }
.theme-art.t-system i:nth-child(2) { background: linear-gradient(115deg, #fff 55%, #1b2230 55%); }

.pw-form .row > label { min-width: 180px; }
.form-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.profile .row > .form-actions { align-self: flex-end; }

.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline li { position: relative; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 9px 22px 9px 0; border-bottom: 1px solid var(--line); }
.timeline li:last-child { border-bottom: 0; }
.timeline li::before { content: ""; position: absolute; right: 4px; top: 17px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
.timeline li.bad::before { background: var(--bad); box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad) 18%, transparent); }
.timeline b { font-weight: 500; }

@media (max-width: 560px) {
  .theme-picks { grid-template-columns: 1fr; }
  label.theme-pick { flex-direction: row; align-items: center; }
  .theme-art { width: 84px; height: 54px; flex: none; }
  .hero-top { align-items: flex-start; }
  .avatar.xl { width: 56px; height: 56px; font-size: 22px; }
}

/* ═══════════ صفحهٔ ورود ═══════════ */
.login { width: min(420px, 92vw); padding: 32px 28px 26px; box-shadow: 0 10px 40px rgba(16, 24, 40, .08); }
.login .login-logo { width: 56px; height: 56px; border-radius: 16px; margin: 0 auto 14px; display: grid; place-items: center; color: var(--primary-ink);
  background: var(--primary); box-shadow: 0 8px 22px color-mix(in srgb, var(--primary) 35%, transparent); }
.login .login-logo svg { width: 30px; height: 30px; }
.login h1 { margin-bottom: 4px; }
.login .login-sub { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 22px; }
.login-theme { position: fixed; top: 16px; left: 16px; width: 42px; height: 42px; padding: 0; border-radius: 12px; }
.login-theme svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ═══════════ راهنمای جمع‌شونده بالای صفحه‌ها ═══════════ */
details.guide { padding: 14px 18px; }
details.guide > summary { margin: 0; color: var(--text); font-weight: 600; }
details.guide[open] > summary { margin-bottom: 10px; }
details.guide p { margin: 0; }
.guide-list { margin: 0; padding-right: 20px; color: var(--muted); display: flex; flex-direction: column; gap: 6px; }
.guide-list b { color: var(--text); }
details.card > summary.add-head { margin: 0; color: var(--text); font-weight: 600; font-size: 15px; }
details.card[open] > summary.add-head { margin-bottom: 16px; }
summary.add-head::before { display: none; }
summary.add-head svg { color: var(--primary); }
.steps-hint { margin: 0 0 16px; padding-right: 20px; display: flex; flex-direction: column; gap: 4px; }

/* ═══════════ کاربران ═══════════ */
.user-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 400px), 1fr)); gap: 16px; margin-bottom: 18px; align-items: start; }
.user-grid > .card { margin: 0; }
.user-card { display: flex; flex-direction: column; gap: 14px; overflow: visible; }
.user-card.off { opacity: .65; }
.user-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.user-top .avatar { width: 44px; height: 44px; font-size: 17px; flex: none; }
.user-name { flex: 1; min-width: 120px; display: flex; flex-direction: column; line-height: 1.45; }
.user-name b { font-weight: 600; font-size: 15px; }
.user-name span[dir=ltr] { text-align: right; }
.user-edit { margin: 0; border-top: 1px solid var(--line); padding-top: 8px; }
.user-edit > summary { margin: 4px 0; }
.user-edit[open] > summary { margin-bottom: 14px; }
.switches { display: flex; flex-wrap: wrap; gap: 6px 0; margin: -4px 0 14px; }
.app-toggles { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; transition: opacity .15s; }
.app-toggles .tab { font-size: 13px; }
.app-toggles.disabled { opacity: .4; pointer-events: none; }

/* ═══════════ استایل‌ها ═══════════ */
.style-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 16px; }
.style-grid > .card { margin: 0; }
a.style-card { display: flex; flex-direction: column; gap: 10px; color: var(--text); transition: border-color .15s, transform .15s, box-shadow .15s; }
a.style-card:hover { text-decoration: none; border-color: color-mix(in srgb, var(--primary) 50%, var(--line)); transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(16, 24, 40, .08); }
.style-top { display: flex; align-items: center; gap: 12px; }
.style-ico { width: 40px; height: 40px; border-radius: 11px; flex: none; display: grid; place-items: center; color: var(--c3, #8e5bd8);
  background: color-mix(in srgb, var(--c3, #8e5bd8) 13%, var(--card)); }
.style-ico svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.style-name { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.style-name b { font-weight: 600; font-size: 15px; }
.style-desc { margin: 0; color: var(--muted); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.9em; }
.style-card .chip { font-size: 12px; padding: 1px 10px; }
.style-foot { display: flex; gap: 12px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 10px; margin-top: auto; }
.style-foot .go { margin-right: auto; color: var(--primary); font-weight: 500; }

/* ═══════════ لاگ ═══════════ */
.audit-details { max-width: 360px; color: var(--muted); word-break: break-word; white-space: normal; }
.toolbar .search { min-width: 220px; }
.toolbar .search input { height: 40px; }

/* وضعیت آپلود و بارگذاری عکس پیام */
.img-bar { display: block; height: 4px; border-radius: 99px; background: var(--primary-soft); overflow: hidden; margin: 2px 0 2px; position: relative; }
.img-bar i { display: block; height: 100%; width: 0; background: var(--primary); border-radius: 99px; transition: width .2s; }
.img-bar.indeterminate i { position: absolute; width: 35% !important; animation: img-bar 1.1s ease-in-out infinite; }
@keyframes img-bar { from { right: -35%; } to { right: 100%; } }
.img-thumb.busy { border-style: solid; border-color: var(--primary); }
.img-thumb.busy img { opacity: .4; filter: saturate(.6); }
.img-thumb.ok { border-style: solid; border-color: color-mix(in srgb, var(--ok) 55%, transparent); }
.img-pct { position: absolute; inset: auto 0 0 0; text-align: center; font-size: 12px; font-weight: 700; color: var(--primary-ink);
  background: color-mix(in srgb, var(--primary) 85%, transparent); line-height: 20px; font-variant-numeric: tabular-nums; }
.img-thumb.busy svg { opacity: 0; }
#imgHint.t-ok { color: var(--ok); }
#nImg.loading { opacity: .45; background: linear-gradient(90deg, #e6e8ec 25%, #f3f4f6 50%, #e6e8ec 75%) 0 0 / 200% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
button[type=submit]:disabled { opacity: .6; cursor: progress; }

/* ═══════════ پنجرهٔ تأیید (به‌جای confirm مرورگر) ═══════════ */
dialog.ask { border: 0; padding: 0; background: transparent; color: var(--text); max-width: min(460px, calc(100vw - 32px)); width: 100%; }
dialog.ask::backdrop { background: rgba(8, 12, 20, .55); backdrop-filter: blur(2px); }
dialog.ask[open] { animation: ask-in .18s ease-out; }
@keyframes ask-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.ask-box { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 22px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.ask-title { margin: 0 0 10px; font-size: 17px; }
.ask-body { color: var(--muted); font-size: 13.5px; margin-bottom: 20px; max-height: 60vh; overflow-y: auto; }
.ask-actions { display: flex; gap: 10px; }
.ask-actions button { flex: 1; padding: 10px 16px; }
button.danger-fill { background: var(--bad); border-color: var(--bad); color: #fff; }
button.danger-fill:hover { background: color-mix(in srgb, var(--bad) 88%, #000); }
.send-confirm { display: flex; flex-direction: column; gap: 14px; color: var(--text); }
.send-confirm .phone { padding: 14px 10px; min-height: 0; }
.send-confirm .facts { grid-template-columns: 1fr 1fr; }
.send-confirm .facts dd { font-weight: 500; }

/* اعلان با عکس بزرگ: ردیف بسته (متن + عکس کوچک) و بنر وقتی باز شود */
.notif { flex-direction: column; align-items: stretch; gap: 0; }
.notif-row { display: flex; align-items: flex-start; gap: 12px; }
.notif-big-cap { display: block; margin-top: 10px; font-size: 11px; color: #6b7280; }
.notif img.notif-big { width: 100%; height: auto; aspect-ratio: 2 / 1; object-fit: cover; border-radius: 10px; margin-top: 4px; background: #e6e8ec; }
.img-thumb.wide { width: 112px; height: 56px; }
.img-thumb.wide img { object-fit: cover; }
.detail-img { display: inline-block; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); line-height: 0; }
.detail-img img { width: 72px; height: 72px; object-fit: cover; }
.detail-img.wide img { width: 240px; height: 120px; }

/* عنوان فیلد و توضیح کوتاهش در یک ردیف (label خودش ستونی است) */
.label-head { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.label-head .hint { font-weight: 400; }
.img-field .img-thumb { margin-top: 27px; }
