/* بک‌آفیس مدیرک — همان رنگ‌های برنامه (#4F46E5) */
@font-face { font-family: "Vazirmatn"; src: url("fonts/Vazirmatn-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Vazirmatn"; src: url("fonts/Vazirmatn-Medium.ttf") format("truetype"); font-weight: 500 600; font-display: swap; }
@font-face { font-family: "Vazirmatn"; src: url("fonts/Vazirmatn-Bold.ttf") format("truetype"); font-weight: 700 900; font-display: swap; }

:root {
    --brand: #4F46E5;
    --brand-soft: #EEF0FF;
    --ink: #1E293B;
    --muted: #64748B;
    --line: #E9ECF2;
    --bg: #F6F7FB;
    --ok: #16A34A;
    --warn: #D97706;
    --danger: #DC2626;
}

html, body { font-family: "Vazirmatn", Tahoma, sans-serif; background: var(--bg); color: var(--ink); }
body { margin: 0; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted) !important; }
.strong { font-weight: 700; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .82rem; }
bdi { unicode-bidi: isolate; }
.flex-1 { flex: 1 1 160px; }

/* ---------- قالب */
.admin-appbar { border-bottom: 1px solid var(--line); }
.appbar-logo { width: 30px; height: 30px; border-radius: 8px; }
.appbar-title { white-space: nowrap; }
.admin-drawer { border-inline-end: 1px solid var(--line); }
.nav-section { display: block; padding: 14px 20px 4px; color: var(--muted); font-weight: 600; }
.user-chip { cursor: pointer; }
.role-tag { margin-inline-start: 6px; font-size: .72rem; color: var(--muted); }
.logout-form { margin: 0; }
.logout-btn {
    display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 16px;
    background: none; border: 0; font: inherit; color: var(--danger); cursor: pointer; text-align: start;
}
.logout-btn:hover { background: #FEF2F2; }

.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-title { margin: 0; }
h1:focus, h1:focus-visible { outline: none; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.mud-paper { border: 1px solid var(--line); }
.h-100 { height: 100%; }

/* ---------- کارت آمار */
.stat-card { height: 100%; }
.stat-head { display: flex; align-items: center; gap: 10px; }
.stat-icon { padding: 6px; border-radius: 10px; box-sizing: content-box; }
.stat-label { color: var(--muted); }
.stat-value { font-size: 1.9rem; font-weight: 700; margin-top: 8px; line-height: 1.2; }
.stat-hint { color: var(--muted); }

/* ---------- نمودارها */
.daily-chart svg { width: 100%; height: 200px; display: block; }
.daily-chart .grid { stroke: var(--line); stroke-width: 1; }
.daily-chart .bar { fill: #C7D2FE; }
.daily-chart g:hover .bar { fill: var(--brand); }
.daily-chart .bar-new { fill: var(--ok); }
.daily-chart .axis { fill: var(--muted); font-size: 11px; text-anchor: middle; font-family: "Vazirmatn", sans-serif; }
.chart-box { position: relative; }
.chart-max { position: absolute; top: -2px; left: 2px; font-size: 11px; color: var(--muted); }
.chart-axis { position: relative; height: 18px; font-size: 11px; color: var(--muted); }
.chart-axis span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
@media (max-width: 700px) { .chart-axis span.minor { display: none; } }
.chart-legend { display: flex; gap: 18px; margin-top: 6px; font-size: .8rem; color: var(--muted); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-inline-end: 6px; vertical-align: -1px; }
.dot-active { background: #C7D2FE; }
.dot-new { background: var(--ok); }

.share-bars { display: flex; flex-direction: column; gap: 10px; }
.share-row { display: grid; grid-template-columns: 70px 1fr auto; align-items: center; gap: 10px; font-size: .9rem; }
.share-track { height: 10px; background: #F1F3F8; border-radius: 6px; overflow: hidden; }
.share-fill { height: 100%; border-radius: 6px; }
.share-value { white-space: nowrap; }

.impact-track { display: flex; height: 12px; border-radius: 7px; overflow: hidden; background: #F1F3F8; margin: 10px 0 8px; }
.impact-seg.ok, .dot.ok { background: var(--ok); }
.impact-seg.opt, .dot.opt { background: #F59E0B; }
.impact-seg.forced, .dot.forced { background: var(--danger); }
.impact-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: .82rem; color: var(--muted); }

/* ---------- جدول‌ها */
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 12px; }
.filter { min-width: 170px; max-width: 220px; }
.filter-wide { min-width: 240px; max-width: 360px; }
.data-table table { width: 100%; }
.data-table th { font-weight: 600 !important; color: var(--muted) !important; white-space: nowrap; font-size: .82rem !important; }
.data-table td { font-size: .88rem !important; vertical-align: middle; white-space: nowrap; }
.data-table .mud-table-container, .data-table { overflow-x: auto; }
.sep { margin-inline-start: 6px; }
.data-table.clickable tbody tr { cursor: pointer; }
.data-table .actions { white-space: nowrap; text-align: end; }
.data-table td.cell-wrap, .data-table td.notes-cell { white-space: normal; }
.cell-wrap { max-width: 320px; word-break: break-word; }
.draft-row td { background: #FAFAFC; }
.notes-cell { max-width: 380px; }
.notes { margin: 0; padding-inline-start: 18px; }
.notes li { margin: 2px 0; }
.pager { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* ورودی‌های انگلیسی (شماره، نسخه، لینک) */
.ltr-field input { direction: ltr; text-align: left; }

/* ---------- نسخه‌ها */
.big-version { font-size: 2rem; font-weight: 700; color: var(--ok); margin: 4px 0; }
.big-version.danger { color: var(--danger); }
.editor { border: 1px solid #C7D2FE !important; }
.choice-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.choice {
    display: flex; gap: 10px; align-items: flex-start; text-align: start; padding: 12px; cursor: pointer;
    border: 1.5px solid var(--line); border-radius: 12px; background: #fff; font: inherit; color: inherit;
}
.choice b { display: block; margin-bottom: 2px; }
.choice span { font-size: .8rem; color: var(--muted); }
.choice .mud-icon-root { color: #F59E0B; }
.choice.danger .mud-icon-root { color: var(--danger); }
.choice.on { border-color: #F59E0B; background: #FFFBEB; }
.choice.danger.on { border-color: var(--danger); background: #FEF2F2; }
.preview-select { max-width: 140px; }
.probe-input { max-width: 200px; }
.probe-preview { flex: 1 1 320px; max-width: 380px; }

/* پیش‌نمایش صفحه‌ی به‌روزرسانی (شبیه گوشی) */
.phone-preview { max-width: 360px; }
.pp-allowed { display: flex; gap: 10px; align-items: flex-start; padding: 14px; border-radius: 14px; background: #F0FDF4; border: 1px solid #BBF7D0; }
.pp-allowed b { display: block; }
.pp-allowed span { font-size: .85rem; color: var(--muted); }
.pp-screen {
    position: relative; padding: 22px 18px 16px; border-radius: 22px; background: #fff; text-align: center;
    border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(30, 41, 59, .08);
}
.pp-logo { width: 64px; height: 64px; border-radius: 16px; box-shadow: 0 6px 18px rgba(79, 70, 229, .25); }
.pp-title { font-weight: 700; font-size: 1.1rem; margin-top: 10px; }
.pp-sub { color: var(--muted); font-size: .85rem; margin-top: 4px; }
.pp-versions { display: inline-flex; align-items: center; gap: 8px; margin-top: 12px; padding: 6px 12px; border-radius: 999px; background: var(--brand-soft); font-size: .85rem; }
.pp-changes { text-align: start; margin-top: 14px; padding: 12px; border-radius: 12px; background: #F8FAFC; }
.pp-changes-title { font-weight: 700; font-size: .85rem; margin-bottom: 4px; }
.pp-changes ul { margin: 0; padding-inline-start: 18px; font-size: .85rem; }
.pp-btn { margin-top: 14px; padding: 10px; border-radius: 12px; background: var(--brand); color: #fff; font-weight: 600; }
.pp-links { margin-top: 8px; font-size: .8rem; color: var(--brand); }
.pp-later { margin-top: 8px; font-size: .8rem; color: var(--muted); }
.pp-badge { position: absolute; top: 12px; inset-inline-start: 12px; font-size: .72rem; padding: 2px 8px; border-radius: 999px; }
.pp-badge.optional { background: #FFFBEB; color: var(--warn); }
.pp-badge.forced { background: #FEF2F2; color: var(--danger); }

.temp-pass { font-size: 1.05rem; padding: 2px 8px; border-radius: 6px; background: #fff; border: 1px dashed var(--ok); user-select: all; }
.role-select { min-width: 130px; }

/* ---------- صفحه‌های ورود (بدون اتصال زنده) */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; box-sizing: border-box; background: linear-gradient(160deg, #EEF0FF 0%, var(--bg) 55%); }
.auth-card {
    width: 100%; max-width: 380px; background: #fff; border: 1px solid var(--line); border-radius: 20px;
    padding: 28px 26px; box-shadow: 0 12px 40px rgba(30, 41, 59, .08); text-align: center;
}
.auth-logo { width: 72px; height: 72px; border-radius: 18px; box-shadow: 0 8px 22px rgba(79, 70, 229, .25); }
.auth-card h1 { font-size: 1.3rem; margin: 14px 0 4px; }
.auth-muted { color: var(--muted); font-size: .9rem; margin: 0 0 18px; }
.auth-field { display: block; text-align: start; margin-bottom: 14px; font-size: .88rem; }
.auth-field span { display: block; margin-bottom: 6px; font-weight: 600; }
.auth-field input {
    width: 100%; box-sizing: border-box; padding: 11px 12px; border: 1.5px solid var(--line); border-radius: 12px;
    font: inherit; font-size: 1rem; outline: none; background: #FBFCFE; text-align: left;
}
.auth-field input:focus { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px rgba(79, 70, 229, .12); }
.auth-invalid { display: block; color: var(--danger); font-size: .8rem; margin-top: 4px; }
.auth-submit {
    width: 100%; padding: 12px; border: 0; border-radius: 12px; background: var(--brand); color: #fff;
    font: inherit; font-weight: 700; font-size: 1rem; cursor: pointer; margin-top: 4px;
}
.auth-submit:hover { background: #4338CA; }
.auth-error { background: #FEF2F2; color: var(--danger); border: 1px solid #FECACA; border-radius: 12px; padding: 10px 12px; font-size: .88rem; margin-bottom: 16px; text-align: start; }
.auth-link { display: inline-block; margin-top: 16px; font-size: .88rem; }
.auth-code { font-family: ui-monospace, monospace; font-size: .8rem; color: var(--muted); word-break: break-all; }

#blazor-error-ui {
    display: none; position: fixed; bottom: 0; inset-inline: 0; z-index: 2000;
    padding: 10px 16px; background: #FEF3C7; color: #92400E; box-shadow: 0 -1px 4px rgba(0,0,0,.1);
}
#blazor-error-ui .reload { margin-inline-start: 8px; font-weight: 700; }

@media (max-width: 700px) {
    .choice-row { grid-template-columns: 1fr; }
    .stat-value { font-size: 1.5rem; }
}
