/* ===================== صفحات مدیریت ===================== */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-5); }
.page-head h1 { font-size: var(--text-2xl); margin: var(--space-1) 0 0; }
.page-head p { margin: var(--space-1) 0 0; color: var(--color-text-muted); font-size: var(--text-sm); }
.toolbar { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; margin-bottom: var(--space-3); }
.toolbar .search { flex: 1 1 220px; max-width: 360px; }
.toolbar .select { width: auto; min-height: 40px; max-width: 100%; }
.toolbar .field { flex: 1 1 140px; min-width: 0; }
.kpis { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); margin-bottom: var(--space-5); }
.dash-grid { display: grid; gap: var(--space-4); grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
@media (max-width: 1000px) { .dash-grid { grid-template-columns: minmax(0, 1fr); } }
.urgent { display: grid; gap: var(--space-2); }
.urgent a { display: flex; gap: var(--space-2); align-items: center; padding: var(--space-3); border-radius: var(--radius-sm); background: var(--color-warning-soft); color: var(--color-text); text-decoration: none; font-size: var(--text-sm); }
.line-chart { width: 100%; height: 200px; display: block; }
.line-chart__grid { stroke: var(--color-border); stroke-width: 1; }
.line-chart__line { fill: none; stroke: var(--color-primary); stroke-width: 3; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.line-chart__area { fill: var(--color-primary); opacity: 0.1; }
.line-chart__dot { fill: var(--color-surface); stroke: var(--color-primary); stroke-width: 2; vector-effect: non-scaling-stroke; }
.line-chart__axis { display: flex; justify-content: space-between; font-size: var(--text-xs); color: var(--color-text-muted); margin-top: var(--space-1); }
.bar-chart { display: grid; gap: var(--space-2); }
.bar-chart__row { display: grid; grid-template-columns: minmax(80px, 160px) 1fr auto; gap: var(--space-3); align-items: center; font-size: var(--text-sm); }
.bar-chart__track { height: 14px; background: var(--color-surface-2); border-radius: var(--radius-pill); overflow: hidden; }
.bar-chart__bar { display: block; height: 100%; background: var(--color-primary); border-radius: var(--radius-pill); }
.bar-chart__value { min-width: 9ch; text-align: end; font-size: var(--text-xs); color: var(--color-text-muted); }
@media (max-width: 520px) { .bar-chart__row { grid-template-columns: 1fr auto; } .bar-chart__track { grid-column: 1 / -1; grid-row: 2; } }
.mcard-list { display: none; }
@media (max-width: 640px) { .table-wrap.has-cards, .table-wrap.has-cards + .scroll-hint { display: none; } .mcard-list { display: grid; gap: var(--space-2); } }
.mcard { padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); background: var(--color-surface); border: 1px solid var(--color-border); display: grid; gap: var(--space-1); }
.mcard__row { display: flex; justify-content: space-between; gap: var(--space-2); font-size: var(--text-sm); }
.mcard__row span:first-child { color: var(--color-text-muted); }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: var(--space-2) var(--space-4); font-size: var(--text-sm); }
.dl dt { color: var(--color-text-muted); }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: var(--space-2); }
.perm { display: flex; gap: var(--space-2); align-items: center; padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); background: var(--color-surface-2); font-size: var(--text-sm); }
.perm.is-granted { background: var(--color-success-soft); }
.perm.is-granted .icon { color: var(--color-success); }
.perm:not(.is-granted) { color: var(--color-text-subtle); }
.qr-grid { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.chat { display: grid; gap: var(--space-3); max-height: 50dvh; overflow-y: auto; padding: var(--space-2); }
.chat__msg { max-width: 80%; padding: var(--space-3); border-radius: var(--radius-md); background: var(--color-surface-2); font-size: var(--text-sm); }
.chat__msg.is-me { justify-self: start; background: var(--color-primary-soft); }
.chat__msg.is-them { justify-self: end; }
.theme-cards { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); }
.theme-card { border-radius: var(--radius-card); border: 2px solid var(--color-border); overflow: hidden; background: var(--color-bg); color: var(--color-text); text-align: start; padding: 0; }
.theme-card[aria-pressed="true"] { border-color: var(--color-focus); }
.theme-card__preview { padding: var(--space-4); display: grid; gap: var(--space-2); }
.theme-card__bar { height: 10px; border-radius: 6px; background: var(--color-primary); }
.theme-card__label { padding: var(--space-2) var(--space-4); background: var(--color-surface); font-weight: var(--weight-bold); font-size: var(--text-sm); display: flex; justify-content: space-between; }
.locked-feature { display: grid; justify-items: center; text-align: center; gap: var(--space-2); padding: var(--space-10) var(--space-4); }
/* تلویزیون و دستگاه‌ها */
.tvp { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: var(--space-4); align-items: start; }
@media (max-width: 1100px) { .tvp { grid-template-columns: minmax(0, 1fr); } }
.tvp__pair { display: grid; gap: var(--space-4); --card-pad: var(--space-8); background: radial-gradient(70% 60% at 80% 0%, rgb(210 165 76 / 0.22), transparent 70%), var(--grad-ink); }
.tvp__pair h2 { color: #fff; margin: 0; }
.tvp__otp input { background: rgb(255 255 255 / 0.06); color: #f6dfa4; border-color: rgb(210 165 76 / 0.4); }
.tvp__form { padding: var(--space-5); border-radius: var(--radius-card); background: var(--color-surface); color: var(--color-text); }
.tvp__device { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3); border-radius: var(--radius-md); background: var(--color-surface-2); }
.tvp__device small { display: block; color: var(--color-text-muted); font-size: var(--text-xs); }
.tvp__device .badge { margin-inline-start: auto; }
.tvp__ok { text-align: center; padding: var(--space-6); border-radius: var(--radius-card); background: rgb(95 211 147 / 0.1); color: #fff; }
.tvp__ok .au__icon { width: 64px; height: 64px; margin: 0 auto var(--space-3); display: grid; place-items: center; border-radius: 20px; background: linear-gradient(135deg, #7ee2a1, #11713a); color: #fff; }
.tvp__list { display: grid; gap: var(--space-2); }
.tvp__item { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3); border-radius: var(--radius-md); border: 1px solid var(--color-border); flex-wrap: wrap; }
.tvp__item.is-revoked { opacity: 0.55; }
.tvp__screen { width: 64px; height: 44px; border-radius: 10px; display: grid; place-items: center; background: #14110d; color: #f0cf86; border: 4px solid #2a251d; flex: none; }
.tvp__screen[data-mode="ready"] { color: #5fd393; }
/* نقشه حرارتی و sparkline */
.heat { display: grid; grid-template-columns: auto repeat(24, minmax(0, 1fr)); gap: 3px; font-size: 10px; color: var(--color-text-muted); direction: ltr; }
.heat__row { direction: rtl; text-align: end; padding-inline-end: 6px; white-space: nowrap; align-self: center; }
.heat__col { text-align: center; }
.heat__cell { aspect-ratio: 1; border-radius: 4px; background: color-mix(in srgb, var(--color-primary) calc(var(--v) * 100%), var(--color-surface-2)); }
.spark { color: var(--color-primary); }
.donut-legend { display: grid; gap: var(--space-2); }
.donut-legend > div { display: grid; grid-template-columns: 1fr auto; gap: var(--space-2); align-items: center; }
/* ---------- فاکتورساز ---------- */
.ie { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-4); align-items: start; }
@media (max-width: 1200px) { .ie { grid-template-columns: minmax(0, 1fr); } }
.ie__preview { position: sticky; top: calc(var(--header-h) + var(--space-4)); max-height: calc(100dvh - var(--header-h) - var(--space-8)); overflow: auto; border-radius: var(--radius-card); background: var(--color-surface-3); padding: var(--space-4); }
@media (max-width: 1200px) { .ie__preview { position: static; max-height: none; } }
.ie-head, .ie-row { display: grid; grid-template-columns: minmax(0, 3fr) 70px minmax(0, 1.6fr) 84px 52px 44px; gap: var(--space-2); align-items: center; }
.ie-items { display: grid; gap: var(--space-2); }
.ie-row .input { min-height: 42px; padding-inline: var(--space-2); }
.ie-row .input-group__addon { padding-inline: var(--space-2); }
@media (max-width: 640px) { .ie-head { display: none; } .ie-row { grid-template-columns: 1fr 1fr; padding: var(--space-3); border-radius: var(--radius-md); background: var(--color-surface-2); } .ie-row .ie-desc { grid-column: 1 / -1; } }
.ie-totals { border-top: 1px solid var(--color-border); padding-top: var(--space-2); }
/* سند فاکتور (همیشه روشن تا چاپ دقیق باشد) */
.inv { --inv-accent: #a8650f; background: #fff; color: #1b1612; width: 100%; max-width: 210mm; min-height: 280mm; margin-inline: auto; padding: 14mm 12mm; border-radius: 6px; box-shadow: var(--shadow-raised); font-size: 13px; line-height: 1.75; display: flex; flex-direction: column; gap: 6mm; }
.inv[data-paper="a5"] { max-width: 148mm; min-height: 200mm; padding: 9mm 8mm; font-size: 11.5px; }
.inv__head { display: flex; justify-content: space-between; gap: 6mm; padding-bottom: 4mm; border-bottom: 3px solid var(--inv-accent); }
.inv__brand { display: flex; gap: 3mm; align-items: flex-start; }
.inv__brand strong { font-size: 1.4em; display: block; }
.inv__brand small { display: block; color: #645a4f; }
.inv__logo { width: 16mm; height: 16mm; border-radius: 4mm; display: grid; place-items: center; background: var(--inv-accent); color: #fff; font-weight: 900; font-size: 1.8em; flex: none; }
.inv__title { text-align: end; }
.inv__title h2 { font-size: 1.6em; margin: 0 0 2mm; color: var(--inv-accent); }
.inv__title dl, .inv__totals { display: grid; grid-template-columns: auto auto; gap: 1mm 4mm; justify-content: end; margin: 0; }
.inv__title dt, .inv__totals dt { color: #645a4f; }
.inv__parties { display: grid; grid-template-columns: 1fr 1fr; gap: 4mm; }
.inv__parties > div { padding: 3mm 4mm; border-radius: 3mm; background: #f7f2ea; }
.inv__parties h3 { font-size: 0.95em; color: var(--inv-accent); margin: 0 0 1mm; }
.inv__parties p { margin: 0; }
.inv__table { border-collapse: collapse; width: 100%; }
.inv__table th { background: var(--inv-accent); color: #fff; font-weight: 700; padding: 2mm; text-align: start; }
.inv__table td { padding: 2mm; border-bottom: 1px solid #ebe1d2; }
.inv__table .num { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
.inv__table tbody tr:nth-child(even) td { background: #fbf8f3; }
.inv__sum { display: grid; grid-template-columns: 1.2fr 1fr; gap: 6mm; align-items: start; }
.inv__words { padding: 3mm 4mm; border: 1px dashed #d6c8b4; border-radius: 3mm; }
.inv__words span { display: block; color: #645a4f; font-size: 0.9em; }
.inv__words p { margin: 2mm 0 0; color: #645a4f; }
.inv__terms { font-size: 0.9em; }
.inv__totals { justify-content: stretch; grid-template-columns: 1fr auto; padding: 3mm 4mm; border-radius: 3mm; background: #f7f2ea; }
.inv__totals dd { margin: 0; text-align: end; font-variant-numeric: tabular-nums; }
.inv__grand { font-weight: 900; font-size: 1.15em; color: var(--inv-accent) !important; border-top: 1px solid #d6c8b4; padding-top: 1mm; }
.inv__foot { margin-top: auto; display: grid; grid-template-columns: 1fr auto; gap: 4mm; align-items: end; }
.inv__sign { display: grid; grid-template-columns: 1fr 1fr; gap: 6mm; }
.inv__sign span { border-top: 1px solid #8b8072; padding-top: 2mm; text-align: center; color: #645a4f; font-size: 0.9em; margin-top: 16mm; }
.inv__qr { display: grid; justify-items: center; color: #645a4f; font-size: 0.8em; }
.inv__qr svg { width: 22mm; height: 22mm; }
.inv__note, .inv__demo { grid-column: 1 / -1; margin: 0; text-align: center; color: #645a4f; font-size: 0.9em; }
.inv__demo { display: flex; gap: 2mm; justify-content: center; align-items: center; color: #955800; border: 1px dashed #e0c48a; border-radius: 2mm; padding: 1.5mm; }
/* ---------- چاپ فیش ---------- */
.pr { display: grid; grid-template-columns: 280px minmax(0, 1fr) 320px; gap: var(--space-4); align-items: start; }
@media (max-width: 1280px) { .pr { grid-template-columns: minmax(0, 1fr) 320px; } .pr__orders { grid-column: 1 / -1; } }
@media (max-width: 860px) { .pr { grid-template-columns: minmax(0, 1fr); } }
.pr__orders { display: grid; gap: var(--space-3); }
.pr__list { display: grid; gap: var(--space-2); max-height: 60dvh; overflow-y: auto; }
@media (max-width: 1280px) { .pr__list { grid-auto-flow: column; grid-auto-columns: minmax(180px, 220px); overflow-x: auto; max-height: none; } }
.pr__order { display: grid; gap: 2px; text-align: start; padding: var(--space-3); border-radius: var(--radius-md); border: 1px solid var(--color-border); background: var(--color-surface); }
.pr__order[aria-selected="true"] { border-color: var(--color-primary); background: var(--color-primary-soft); }
.pr__order .badge { justify-self: start; }
.pr__stage { display: grid; gap: var(--space-2); padding: var(--space-6); border-radius: var(--radius-card); background: repeating-linear-gradient(45deg, var(--color-surface-2), var(--color-surface-2) 10px, var(--color-surface-3) 10px, var(--color-surface-3) 20px); min-height: 420px; place-content: start center; }
.pr__paper { display: grid; justify-items: center; }
.pr__paper .receipt { box-shadow: 0 18px 40px -16px rgb(0 0 0 / 0.4); animation: page-in 300ms var(--motion-ease-out); }
.pr__paper[data-paper="58"] .receipt { width: 58mm; } .pr__paper[data-paper="80"] .receipt { width: 80mm; } .pr__paper[data-paper="a4"] .receipt { width: min(190mm, 100%); }
.pr__jobs { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--space-1); font-size: var(--text-sm); }
.pr__jobs li { display: flex; justify-content: space-between; gap: var(--space-2); }
.pr__ruler { display: flex; direction: ltr; border: 1px solid #111; }
.pr__ruler span { flex: 1; text-align: center; border-inline-end: 1px solid #111; font-size: 10px; }
/* ---------- پیامک ---------- */
.sms { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: var(--space-4); align-items: start; }
@media (max-width: 1000px) { .sms { grid-template-columns: minmax(0, 1fr); } }
.sms__aud { display: grid; gap: var(--space-2); grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); }
.sms__text { font-size: var(--text-md); min-height: 130px; }
.sms__meter { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; font-size: var(--text-xs); color: var(--color-text-muted); }
.sms__side { position: sticky; top: calc(var(--header-h) + var(--space-4)); display: grid; gap: var(--space-4); }
@media (max-width: 1000px) { .sms__side { position: static; } }
.sms__phone { padding: var(--space-4); border-radius: 36px; background: linear-gradient(160deg, #1f1b16, #0f0d0a); border: 8px solid #2a251d; color: #f5efe4; display: grid; gap: var(--space-3); min-height: 300px; align-content: start; box-shadow: var(--shadow-raised); }
.sms__phone-top { display: flex; align-items: center; gap: var(--space-2); padding-bottom: var(--space-2); border-bottom: 1px solid rgb(255 255 255 / 0.08); }
.sms__phone-top small { display: block; color: #8a7f6d; font-size: 11px; }
.sms__phone-top .avatar { background: var(--grad-gold); color: #1b1408; width: 34px; height: 34px; }
.sms__bubble { justify-self: start; max-width: 92%; padding: var(--space-3) var(--space-4); border-radius: 18px 18px 18px 4px; background: #2b261e; white-space: pre-wrap; font-size: var(--text-sm); line-height: 1.8; animation: page-in 300ms; }
.sms__time { color: #6f6555; font-size: 11px; }
/* ---------- استودیوی ظاهر ---------- */
.st { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: var(--space-4); align-items: start; }
@media (max-width: 1100px) { .st { grid-template-columns: minmax(0, 1fr); } }
.st__themes { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.st__themes .theme-card { cursor: pointer; }
.st__themes .theme-card:has(input:checked) { border-color: var(--color-focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-focus) 25%, transparent); }
.st__themes .theme-card:has(input:focus-visible) { outline: 3px solid var(--color-focus); }
.st__colors { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: var(--space-3); }
.st__color .input { max-width: 120px; font-family: var(--font-mono); }
.st__contrast { display: grid; gap: var(--space-2); }
.st__check { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); font-size: var(--text-sm); }
.st__check.is-ok { background: var(--color-success-soft); color: var(--color-success); }
.st__check.is-mid { background: var(--color-warning-soft); color: var(--color-warning); }
.st__check.is-bad { background: var(--color-danger-soft); color: var(--color-danger); }
.st__check span.grow { color: var(--color-text); }
.st__sec { width: 100%; }
.st__preview { position: sticky; top: calc(var(--header-h) + var(--space-4)); display: grid; gap: var(--space-3); justify-items: center; }
@media (max-width: 1100px) { .st__preview { position: static; } }
.st__frame { width: min(390px, 100%); height: min(76dvh, 780px); overflow: auto; border-radius: 40px; border: 10px solid #1d1915; background: var(--color-bg); box-shadow: var(--shadow-overlay); }
.st__frame .menu-root { padding-bottom: 0; min-height: 100%; }
.st__frame .m-bottom { position: sticky; }
.st__frame .skip-link { display: none; }
.st__frame .m-bottom { display: grid; grid-template-columns: repeat(4, 1fr); inset-inline: var(--space-2); bottom: var(--space-2); padding: 6px; border-radius: 26px; background: color-mix(in srgb, var(--color-accent) 92%, transparent); }
.st__frame .m-bottom__item:not(.m-bottom__cart) { display: flex; }
.st__frame .m-bottom__cart { flex-direction: column; gap: 2px; min-height: 52px; padding: 0; border-radius: 20px; background: none; color: color-mix(in srgb, var(--color-on-accent) 70%, transparent); box-shadow: none; font-size: 11px; }
/* ---------- وضعیت سرورها ---------- */
.ss-overall { display: flex; align-items: center; gap: var(--space-4); padding: var(--space-5); border-radius: var(--radius-card); border: 1px solid var(--color-border); background: var(--color-surface); }
.ss-overall strong { display: block; font-size: var(--text-lg); }
.ss-overall small { color: var(--color-text-muted); }
.ss-overall__dot { width: 18px; height: 18px; border-radius: 50%; flex: none; background: currentColor; box-shadow: 0 0 0 6px color-mix(in srgb, currentColor 20%, transparent); animation: pulse 2s infinite; }
.ss-overall--success { color: var(--color-success); background: var(--color-success-soft); border-color: transparent; }
.ss-overall--warning { color: var(--color-warning); background: var(--color-warning-soft); border-color: transparent; }
.ss-overall--danger { color: var(--color-danger); background: var(--color-danger-soft); border-color: transparent; }
.ss-overall strong, .ss-overall small { color: var(--color-text); }
.ss-list { display: grid; gap: var(--space-4); }
.ss-svc { display: grid; gap: var(--space-2); }
.ss-svc__head { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.ss-svc__name { font-weight: var(--weight-bold); }
.ss-svc__lat { display: inline-flex; align-items: center; gap: var(--space-1); margin-inline-start: auto; font-size: var(--text-xs); color: var(--color-text-muted); }
.ss-svc__lat b { color: var(--color-text); font-variant-numeric: tabular-nums; }
.ss-svc__up { font-size: var(--text-xs); font-weight: var(--weight-bold); color: var(--color-success); min-width: 6ch; text-align: end; }
.ss-bars { display: grid; grid-template-columns: repeat(90, minmax(0, 1fr)); gap: 2px; height: 30px; direction: ltr; }
.ss-bars i { border-radius: 2px; background: var(--color-success); opacity: 0.85; }
.ss-bars i[data-s="degraded"] { background: var(--color-warning); }
.ss-bars i[data-s="down"] { background: var(--color-danger); }
.ss-bars i:hover { opacity: 1; transform: scaleY(1.15); }
.ss-svc__axis { display: flex; justify-content: space-between; flex-direction: row-reverse; }
.ss-nodes { display: grid; gap: var(--space-4); }
.ss-node { display: grid; gap: var(--space-2); }
.ss-gauges { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-2); }
.ss-gauge { display: grid; justify-items: center; gap: 4px; font-size: var(--text-xs); color: var(--color-text-muted); }
.ss-gauge__ring { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--g, var(--color-success)) calc(var(--v) * 1%), var(--color-surface-3) 0); position: relative; }
.ss-gauge__ring::before { content: ""; position: absolute; inset: 7px; border-radius: 50%; background: var(--color-surface); }
.ss-gauge__ring b { position: relative; color: var(--color-text); font-size: var(--text-xs); }
.ss-gauge[data-level="mid"] { --g: var(--color-warning); } .ss-gauge[data-level="bad"] { --g: var(--color-danger); }
.an-bar { position: relative; height: 26px; border-radius: 8px; background: var(--color-surface-2); overflow: hidden; }
.an-bar span { position: absolute; inset-block: 0; inset-inline-start: 0; background: linear-gradient(90deg, var(--color-primary-soft), color-mix(in srgb, var(--color-primary) 35%, transparent)); }
.an-bar b { position: relative; padding-inline: var(--space-2); line-height: 26px; font-size: var(--text-xs); font-variant-numeric: tabular-nums; }

/* لاگ اجرای به‌روزرسانی */
.code-log { background: var(--color-ink, #14110d); color: #e9e2d6; font: 0.8rem/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; padding: var(--space-4); border-radius: var(--radius-md, 12px); max-height: 360px; overflow: auto; white-space: pre-wrap; text-align: left; margin: 0; }
