/* ==================================================================
   پنل مدیریت — سیستم طراحی
   ================================================================== */

:root {
  --primary: #0f766e;
  --accent: #e4572e;
  --footer: #0d1b18;
  --surface: #fbfaf8;
  --font-family: Vazirmatn, Tahoma, sans-serif;

  --primary-dark: color-mix(in srgb, var(--primary) 84%, #000);
  --primary-soft: color-mix(in srgb, var(--primary) 11%, #fff);
  --ink: #10201d;
  --ink-2: #3c4f4b;
  --muted: #7d8b87;
  --line: #e6e4df;
  --line-2: #f1efeb;
  --card: #fff;
  --danger: #c5392d;
  --warn: #b7791f;
  --ok: #0f766e;

  --r-sm: 8px;
  --r: 13px;
  --r-lg: 18px;
  --shadow-1: 0 1px 2px rgba(16,32,29,.05);
  --shadow-2: 0 10px 30px -14px rgba(16,32,29,.24);
  --shadow-3: 0 22px 44px -22px rgba(16,32,29,.4);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; font-family: var(--font-family); background: var(--surface);
  color: var(--ink); font-size: 14.5px; line-height: 1.85;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; line-height: 1.5; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
code { font-family: ui-monospace, Consolas, monospace; font-size: .9em; }
pre { margin: 0; white-space: pre-wrap; word-break: break-word; font-family: inherit; }
svg { display: block; }
.block { display: block; }
.muted { color: var(--muted); font-size: 13px; }
.req { color: var(--danger); }
.rowbtns { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

/* ------------------------------ دکمه ------------------------------ */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding-inline: 20px; border-radius: 999px;
  font-weight: 600; font-size: 14px; white-space: nowrap; cursor: pointer;
  transition: background .18s, color .18s, box-shadow .18s, transform .16s, border-color .18s;
}
.btn--primary { background: var(--primary); color: #fff; }
.btn--primary:hover { background: var(--primary-dark); box-shadow: var(--shadow-2); }
.btn--ghost { border: 1.5px solid var(--primary); color: var(--primary); background: #fff; }
.btn--ghost:hover { background: var(--primary); color: #fff; }
.btn--plain { border: 1.5px solid var(--line); color: var(--ink-2); background: #fff; }
.btn--plain:hover { border-color: var(--primary); color: var(--primary); }
.btn--danger { background: #fff; border: 1.5px solid #e0574b; color: var(--danger); }
.btn--danger:hover { background: #e0574b; color: #fff; }
.btn--sm { height: 36px; padding-inline: 16px; font-size: 13px; }
.btn--xs { height: 29px; padding-inline: 11px; font-size: 12px; border-radius: 9px; }
.btn--block { width: 100%; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .5; pointer-events: none; }

.linkbtn { color: #f0a89b; font-size: 12.5px; font-weight: 700; padding: 4px 6px; border-radius: 7px; }
.linkbtn:hover { color: #fff; background: rgba(255,255,255,.09); }
.linkcell { color: var(--primary); font-size: 12.5px; word-break: break-all; }
.linkcell:hover { text-decoration: underline; }

/* ------------------------------ لوگو ------------------------------ */

.logo__mark {
  width: 42px; height: 42px; border-radius: 13px; flex: none; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 60%, #4fd1c5));
  color: #fff; font-weight: 800; font-size: 20px; overflow: hidden;
  box-shadow: 0 6px 16px -8px var(--primary);
}
.logo__mark--img { background: #fff; }
.logo__mark--img img { width: 100%; height: 100%; object-fit: contain; padding: 3px; }

/* ------------------------------ اسکلت ------------------------------ */

.admin-shell { display: flex; min-height: 100vh; }

.sidenav {
  width: 256px; flex: none; background: var(--footer); color: rgba(255,255,255,.75);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.sidenav__brand { display: flex; align-items: center; gap: 11px; padding: 20px 20px 18px; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidenav__brandtext { line-height: 1.45; min-width: 0; }
.sidenav__brandtext strong { display: block; color: #fff; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidenav__brandtext small { font-size: 11.5px; color: rgba(255,255,255,.45); }

.sidenav__nav { flex: 1; overflow-y: auto; padding: 14px 12px 20px; display: grid; gap: 3px; align-content: start; }
.sidenav__link {
  display: flex; align-items: center; gap: 11px; padding: 10px 14px;
  border-radius: 11px; font-size: 14px; font-weight: 600; color: rgba(255,255,255,.72);
  transition: background .16s, color .16s;
}
.sidenav__link:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidenav__link.is-active { background: var(--primary); color: #fff; box-shadow: 0 8px 20px -12px var(--primary); }
.sidenav__sep { height: 1px; background: rgba(255,255,255,.09); margin: 12px 6px; }

.sidenav__user { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.08); }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--primary); color: #fff; font-weight: 800; font-size: 15px;
}
.sidenav__userinfo { flex: 1; min-width: 0; line-height: 1.4; }
.sidenav__userinfo strong { display: block; color: #fff; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidenav__userinfo small { font-size: 11px; color: rgba(255,255,255,.45); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }

.admin-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 14px;
  background: rgba(255,255,255,.95); backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--line); padding: 13px 26px;
}
.topbar__burger { display: none; width: 38px; height: 38px; border-radius: 11px; background: var(--line-2); place-items: center; flex: none; }
.topbar__title { font-size: 17px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__spacer { flex: 1; }
.topbar__visit {
  font-size: 13px; font-weight: 700; color: var(--primary);
  border: 1.5px solid var(--primary); border-radius: 999px; padding: 6px 16px; white-space: nowrap;
}
.topbar__visit:hover { background: var(--primary); color: #fff; }

/* ستونِ صریح با minmax(0,…) — بدونِ آن، تِرَکِ ضمنیِ grid با min-width:auto
   باد می‌کند و `min-width:640px` جدول‌ها کل صفحه را در موبایل پهن می‌کند
   (اندازه‌گیری‌شده: صفحه‌ی ۳۷۵ پیکسلی ۶۹۱ پیکسل می‌شد و اسکرول افقی می‌خورد). */
.admin-content { padding: 26px; display: grid; gap: 22px; align-content: start; grid-template-columns: minmax(0, 1fr); }

/* ------------------------------ پنل‌ها ------------------------------ */

.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px 22px; box-shadow: var(--shadow-1); }
.panel__head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.panel__title { font-size: 16.5px; font-weight: 800; display: flex; align-items: center; gap: 9px; }
.panel__actions { margin-inline-start: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.panel__link { margin-inline-start: auto; font-size: 13px; font-weight: 700; color: var(--primary); }
.panel__link:hover { text-decoration: underline; }

.badge-soft { background: var(--primary-soft); color: var(--primary); font-size: 12px; font-weight: 800; padding: 2px 10px; border-radius: 999px; }

.split { display: grid; gap: 22px; align-items: start; }
@media (min-width: 1100px) { .split { grid-template-columns: repeat(2, minmax(0,1fr)); } }
.form-grid { display: grid; gap: 22px; align-items: start; }
@media (min-width: 1100px) { .form-grid { grid-template-columns: minmax(0,1fr) 372px; } }
.form-col { display: grid; gap: 22px; align-content: start; }
.form-narrow { max-width: 780px; margin-inline: auto; width: 100%; }
.form__actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.form__actions--sticky { position: sticky; bottom: 14px; background: linear-gradient(transparent, #fff 28%); padding-top: 16px; }

.statgrid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(215px,1fr)); }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 16px 20px 18px; display: grid; gap: 2px; position: relative; overflow: hidden;
}
.stat::after { content: ''; position: absolute; inset-inline-start: 0; inset-block: 0; width: 4px; background: linear-gradient(var(--primary), color-mix(in srgb, var(--primary) 45%, var(--accent))); }
.stat__label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.stat__value { font-size: 28px; font-weight: 800; line-height: 1.35; font-variant-numeric: tabular-nums; }
.stat__sub { font-size: 11.5px; color: var(--primary); font-weight: 600; }

.kv { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; font-size: 13.5px; border-bottom: 1px dashed var(--line-2); }
.kv:last-child { border-bottom: 0; }
.kv span { color: var(--muted); }

.infobox { display: flex; flex-wrap: wrap; gap: 10px 24px; background: var(--primary-soft); border: 1px solid color-mix(in srgb, var(--primary) 18%, var(--line)); padding: 12px 16px; border-radius: var(--r); font-size: 13.5px; }
.infobox b { font-weight: 800; }

.alert { padding: 13px 18px; border-radius: var(--r); font-size: 13.5px; font-weight: 600; border: 1px solid; display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.alert--success { background: color-mix(in srgb, var(--ok) 9%, #fff); border-color: color-mix(in srgb, var(--ok) 26%, var(--line)); color: var(--ok); }
.alert--error { background: color-mix(in srgb, var(--danger) 8%, #fff); border-color: color-mix(in srgb, var(--danger) 26%, var(--line)); color: var(--danger); }
.alert--warn { background: color-mix(in srgb, var(--warn) 10%, #fff); border-color: color-mix(in srgb, var(--warn) 28%, var(--line)); color: var(--warn); }
.alert a { text-decoration: underline; font-weight: 700; }
.alert__close { margin-inline-start: auto; font-size: 18px; line-height: 1; opacity: .55; }
.alert__close:hover { opacity: 1; }

.linkresult { background: var(--footer); color: #fff; border-radius: var(--r); padding: 16px 18px; display: grid; gap: 12px; }
.linkresult__url { font-size: 15px; font-weight: 700; direction: ltr; text-align: left; word-break: break-all; background: rgba(255,255,255,.09); padding: 11px 14px; border-radius: 10px; }
.linkresult__btns { display: flex; gap: 9px; flex-wrap: wrap; }
.linkresult .btn--primary { background: var(--primary); }
.linkresult .btn--plain { background: transparent; color: #fff; border-color: rgba(255,255,255,.3); }
.linkresult .btn--plain:hover { border-color: #fff; color: #fff; }

/* ------------------------------ فرم‌ها ------------------------------ */

.form { display: grid; gap: 16px; }
.form--inline { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; }
.form--inline .field-block { flex: 1 1 190px; margin: 0; }

.field-block { display: grid; gap: 7px; margin-bottom: 16px; }
.form > .field-block, .form--inline > .field-block { margin-bottom: 0; }
.field-block > span { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.field-block small { font-size: 12px; color: var(--muted); line-height: 1.9; }
.field-block input[type=text], .field-block input[type=email],
.field-block input[type=number], .field-block input[type=password],
.field-block input[type=search], .field-block input[type=tel],
.field-block input[type=url], .field-block select, .field-block textarea,
.filterbar input, .filterbar select {
  width: 100%; height: 43px; padding-inline: 13px; border: 1.5px solid var(--line);
  border-radius: 11px; background: #fff; outline: none; font-size: 14px;
  transition: border-color .16s, box-shadow .16s;
}
.field-block textarea { height: auto; min-height: 110px; padding-block: 11px; line-height: 1.9; resize: vertical; }
.field-block input:focus, .field-block select:focus, .field-block textarea:focus,
.filterbar input:focus, .filterbar select:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.field-block input[type=file] { font-size: 13px; color: var(--muted); padding-inline: 4px; }
/* انتخاب فایل: به‌جای کنترلِ بومی مرورگر (که انگلیسی و بدشکل است) یک دکمه‌ی هماهنگ با پنل */
.filepick { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; position: relative; }
.filepick input[type=file] {
  position: absolute; inset-inline-start: 0; top: 0;
  width: 1px; height: 1px; opacity: 0; overflow: hidden;
}
.filepick__btn { cursor: pointer; }
.filepick:focus-within .filepick__btn { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.filepick__name {
  font-size: 12.5px; color: var(--muted); direction: ltr; unicode-bidi: plaintext;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.field-block input[dir=ltr], .filterbar input[dir=ltr] { direction: ltr; text-align: left; }

.row2 { display: grid; gap: 16px; margin-bottom: 16px; }
.row3 { display: grid; gap: 16px; margin-bottom: 16px; }
.form .row2:last-child, .form .row3:last-child { margin-bottom: 0; }
@media (min-width: 720px) { .row2 { grid-template-columns: repeat(2, minmax(0,1fr)); } .row3 { grid-template-columns: repeat(3, minmax(0,1fr)); } }
.row2 .field-block, .row3 .field-block { margin-bottom: 0; }

.checkrow { display: flex; align-items: center; gap: 10px; font-size: 13.5px; font-weight: 600; padding: 7px 0; }
.checkrow input { width: 17px; height: 17px; accent-color: var(--primary); }
.switchrow { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 12px; font-size: 13.5px; font-weight: 600; cursor: pointer; }
.switchrow:hover { border-color: color-mix(in srgb, var(--primary) 35%, var(--line)); }
.switchrow input { width: 18px; height: 18px; accent-color: var(--primary); flex: none; }
.switchrow--top { margin-top: 26px; margin-bottom: 0; align-self: end; }
.row2 > .switchrow--top, .row3 > .switchrow--top { margin-bottom: 0; }

.colorrow { display: grid; gap: 14px; }
.colorrow .field-block { margin-bottom: 0; }
.colorinput { display: flex; align-items: center; gap: 12px; }
.colorinput input[type=color] { width: 54px; height: 40px; padding: 2px; border: 1.5px solid var(--line); border-radius: 11px; background: #fff; cursor: pointer; }
.colorinput code { font-size: 13px; color: var(--muted); direction: ltr; }

.previewbox { margin-top: 18px; padding: 16px; border-radius: var(--r); background: var(--surface); border: 1px dashed var(--line); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.previewbox__btn { background: var(--p); color: #fff; padding: 8px 18px; border-radius: 999px; font-size: 13px; font-weight: 700; }
.previewbox__chip { background: var(--a); color: #fff; padding: 4px 11px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.previewbox__foot { background: var(--f); color: #fff; padding: 8px 16px; border-radius: 11px; font-size: 12.5px; font-weight: 700; }

.logopreview { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.logopreview img { height: 54px; width: auto; border: 1px solid var(--line); border-radius: 11px; background: #fff; padding: 5px; }
.logopreview label { cursor: pointer; }

.permrow { display: flex; flex-wrap: wrap; gap: 9px; margin-bottom: 18px; }
.perm {
  font-size: 13px; font-weight: 700; padding: 6px 15px; border-radius: 999px;
  background: var(--line-2); color: var(--muted); border: 1px solid transparent;
}
.perm.is-on { background: color-mix(in srgb, var(--ok) 12%, #fff); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 28%, var(--line)); }

.filterbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.filterbar input, .filterbar select { width: auto; min-width: 165px; flex: 0 1 auto; }

/* ------------------------------ جداول ------------------------------ */

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); }
.table { width: 100%; border-collapse: collapse; min-width: 640px; }
.table--tight { min-width: 420px; }
.table thead th {
  background: var(--surface); text-align: start; font-size: 12.5px; font-weight: 800;
  color: var(--ink-2); padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line-2); font-size: 13.5px; vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fcfbf9; }
.table .col-actions { text-align: end; white-space: nowrap; }
.table .num { font-variant-numeric: tabular-nums; }
.table form { display: inline; }
.table .msgcell { max-width: 320px; }
.table .msgcell pre { font-size: 12.5px; color: var(--ink-2); background: var(--line-2); padding: 8px 10px; border-radius: 8px; max-height: 84px; overflow: auto; }

.prodcell { display: flex; align-items: center; gap: 12px; min-width: 230px; }
.prodcell__img { width: 50px; height: 50px; border-radius: 12px; overflow: hidden; background: var(--line-2); flex: none; display: grid; place-items: center; }
.prodcell__img--sm { width: 42px; height: 42px; border-radius: 11px; }
.prodcell__img img { width: 100%; height: 100%; object-fit: cover; }
.prodcell__img .ph { font-weight: 800; color: var(--primary); background: var(--primary-soft); width: 100%; height: 100%; display: grid; place-items: center; }
.prodcell__meta { min-width: 0; line-height: 1.6; }
.prodcell__meta strong { display: block; font-size: 13.5px; }
.prodcell__meta small { color: var(--muted); font-size: 11.5px; display: block; }

.oldprice { display: block; font-size: 11.5px; color: var(--muted); text-decoration: line-through; }

.tag { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 800; padding: 3px 10px; border-radius: 999px; white-space: nowrap; margin-inline-end: 4px; }
.tag--ok { background: color-mix(in srgb, var(--ok) 12%, #fff); color: var(--ok); }
.tag--danger { background: color-mix(in srgb, var(--danger) 10%, #fff); color: var(--danger); }
.tag--warn { background: color-mix(in srgb, var(--warn) 14%, #fff); color: var(--warn); }
.tag--info { background: var(--primary-soft); color: var(--primary); }
.tag--off { background: var(--line-2); color: var(--muted); }

.useredit td { background: var(--surface); }
.useredit .form--inline { align-items: flex-end; }

.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 7px; margin-top: 18px; }
.pager__info { width: 100%; text-align: center; font-size: 13px; color: var(--muted); }
.pagebtn { min-width: 36px; height: 36px; padding-inline: 11px; border-radius: 10px; border: 1.5px solid var(--line); background: #fff; font-size: 13.5px; font-weight: 700; display: grid; place-items: center; }
a.pagebtn:hover { border-color: var(--primary); color: var(--primary); }
.pagebtn.is-active { background: var(--primary); border-color: var(--primary); color: #fff; }
.pagebtn.is-disabled { opacity: .4; pointer-events: none; }

/* ---------------------------- آپلود تصویر ---------------------------- */

.dropzone {
  border: 2px dashed var(--line); border-radius: var(--r); background: var(--surface);
  padding: 24px 18px; text-align: center; cursor: pointer; transition: border-color .18s, background .18s;
  position: relative;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--primary); background: var(--primary-soft); }
.dropzone input[type=file] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%;
}
.dropzone__icon { font-size: 30px; display: block; line-height: 1.2; }
.dropzone__inner strong { display: block; font-size: 14.5px; margin-block: 6px 3px; }
.dropzone__inner small { color: var(--muted); font-size: 12.5px; }

.imggrid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(132px,1fr)); margin-top: 14px; }
.imggrid--one { grid-template-columns: 180px; margin-top: 0; }
.imgtile { position: relative; border: 1.5px solid var(--line); border-radius: 13px; overflow: hidden; background: #fff; }
.imgtile > img { aspect-ratio: 1/1; width: 100%; object-fit: cover; }
.imgtile.is-cover { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.imgtile__bar { display: flex; gap: 5px; padding: 7px; background: #fff; border-top: 1px solid var(--line-2); }
.imgtile__bar > * { flex: 1; cursor: pointer; }
.imgtile__bar label { display: inline-flex; }

/* پیش‌نمایشِ بنرِ عریض (اسلایدر صفحه‌ی اصلی) */
.imggrid--wide { grid-template-columns: minmax(240px, 360px); margin-top: 0; }
.imgtile--wide > img { aspect-ratio: 16 / 6; }

/* ------------------------- فهرست اسلایدها ------------------------- */

.slides__hint { margin-bottom: 14px; }
.slidelist { display: grid; gap: 10px; }
.slidelist__item {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 10px; border: 1px solid var(--line); border-radius: var(--r); background: #fff;
  min-width: 0;
}
.slidelist__item.is-off { opacity: .58; }
.slidelist__thumb {
  flex: none; width: 168px; aspect-ratio: 16 / 6;
  border-radius: 9px; overflow: hidden; background: var(--line-2);
}
.slidelist__thumb img { width: 100%; height: 100%; object-fit: cover; }
.slidelist__meta { min-width: 0; flex: 1 1 180px; line-height: 1.7; }
.slidelist__meta strong { display: block; font-size: 13.5px; }
/* باید بشکند نه اینکه nowrap بماند: متنِ یک‌خطه‌ی بلند اینجا min-content را
   بالا می‌برد و کل پنل را در موبایل از سمت چپ بیرون می‌زند.
   line-clamp همان تک‌خطی‌بودن ظاهری را می‌دهد بدون آن مشکل. */
.slidelist__meta small {
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical;
  overflow: hidden; color: var(--muted); font-size: 11.5px;
}
.slidelist__meta code { font-size: 11px; color: var(--ink-2); }
.slidelist__acts { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-inline-start: auto; }
.slidelist__acts form { display: inline-flex; }
.slidelist__acts button:disabled { opacity: .35; cursor: default; }

@media (max-width: 767px) {
  .slidelist__thumb { width: 100%; }
  .slidelist__acts { margin-inline-start: 0; width: 100%; }
}

.speclist:empty { display: none; }
.specrow { display: grid; gap: 10px; grid-template-columns: 1fr 1.4fr auto; align-items: center; margin-bottom: 10px; }
.specrow input { height: 40px; padding-inline: 12px; border: 1.5px solid var(--line); border-radius: 10px; outline: none; width: 100%; }
.specrow input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.specrow__del { width: 34px; height: 34px; border-radius: 9px; background: color-mix(in srgb, var(--danger) 10%, #fff); color: var(--danger); display: grid; place-items: center; font-size: 17px; }
.specrow__del:hover { background: var(--danger); color: #fff; }

/* ------------------------------ حالت خالی ------------------------------ */

.empty { text-align: center; padding: 54px 20px; border: 1px dashed var(--line); border-radius: var(--r-lg); background: var(--surface); }
.empty--sm { padding: 36px 18px; }
.empty__icon { font-size: 38px; opacity: .6; }
.empty h3 { margin-block: 10px 5px; font-size: 17px; }
.empty p { color: var(--muted); font-size: 13.5px; }
.empty__cta { margin-top: 16px; }
.empty-line { padding: 14px; text-align: center; }

/* ------------------------------ صفحه‌ی لاگین ------------------------------ */

.login-page {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(900px 480px at 12% -8%, color-mix(in srgb, var(--primary) 26%, transparent), transparent 60%),
    radial-gradient(760px 460px at 108% 112%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 60%),
    var(--footer);
}
.login-card { width: 100%; max-width: 430px; background: #fff; border-radius: 24px; padding: 32px; box-shadow: var(--shadow-3); }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.login-brand > span:last-child { line-height: 1.45; }
.login-brand strong { display: block; font-size: 17px; font-weight: 800; }
.login-brand small { display: block; color: var(--muted); font-size: 12px; }
.login-card .alert { margin-bottom: 18px; }
.login-card .form { gap: 15px; }
.login-note { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line-2); font-size: 12.5px; color: var(--muted); text-align: center; }
.login-note a { color: var(--primary); font-weight: 700; }

/* ------------------------------ تُست ------------------------------ */

.toast {
  position: fixed; bottom: 24px; inset-inline: 0; margin-inline: auto; width: fit-content; max-width: 92vw;
  z-index: 300; background: var(--footer); color: #fff; font-size: 14px; font-weight: 600;
  padding: 12px 22px; border-radius: 999px; box-shadow: var(--shadow-3);
  opacity: 0; transform: translateY(16px); pointer-events: none; transition: opacity .25s, transform .25s;
}
.toast--show { opacity: 1; transform: translateY(0); }

/* ---------------------------- ریسپانسیو ---------------------------- */

.scrim { position: fixed; inset: 0; background: rgba(13,27,24,.5); opacity: 0; visibility: hidden; transition: .22s; z-index: 50; }

@media (max-width: 1023px) {
  .sidenav {
    position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 60;
    transform: translateX(-100%); transition: transform .26s; box-shadow: var(--shadow-3);
  }
  [dir="rtl"] .sidenav { transform: translateX(100%); }
  body.nav-open .sidenav { transform: translateX(0); }
  body.nav-open .scrim { opacity: 1; visibility: visible; }
  .topbar__burger { display: grid; }
  .admin-content { padding: 18px 16px; }
  .topbar { padding: 12px 16px; }
}

@media (max-width: 719px) {
  body { font-size: 14px; }
  .panel { padding: 16px; }
  .stat__value { font-size: 24px; }
  .login-card { padding: 26px 20px; }
  .topbar__visit { display: none; }
}

/* ==================================================================
   پنل مدیریت در موبایل
   ================================================================== */

.mtabbar { display: none; }

@media (max-width: 767px) {
  /* نوارِ پایین جای خودش را می‌گیرد؛ وگرنه آخرین ردیفِ هر صفحه
     زیرش پنهان می‌ماند و کاربر فکر می‌کند محتوا تمام شده. */
  body.admin { padding-bottom: calc(62px + env(safe-area-inset-bottom, 0px)); }

  /* هدفِ لمسی: ۴۴px کمینه‌ی استاندارد است */
  .btn { height: 44px; }
  .btn--sm { height: 38px; }
  .btn--xs { height: 34px; padding-inline: 13px; font-size: 12.5px; }
  .linkbtn { padding: 8px 10px; }
  .panel__link { padding: 8px 2px; }

  /* ورودی‌های زیر ۱۶px باعث زومِ خودکارِ iOS می‌شوند */
  .field-block input, .field-block select, .field-block textarea,
  .filterbar input, .filterbar select, .specrow input { font-size: 16px; }

  .panel { padding: 15px 14px; border-radius: var(--r); }
  .panel__head { gap: 10px; }
  .panel__title { font-size: 15.5px; }
  .panel__actions { width: 100%; margin-inline-start: 0; }
  .panel__actions .btn { flex: 1; }

  .admin-content { padding: 14px 12px; gap: 16px; }

  .topbar { padding: 10px 12px; gap: 10px; }
  .topbar__title { font-size: 15.5px; }
  .topbar__burger { width: 42px; height: 42px; }

  .statgrid { gap: 10px; grid-template-columns: repeat(2, minmax(0,1fr)); }
  .stat { padding: 13px 14px 14px; border-radius: var(--r); }
  .stat__value { font-size: 21px; }
  .stat__label { font-size: 11.5px; }
  .stat__sub { font-size: 10.5px; }

  .filterbar { gap: 8px; }
  .filterbar input, .filterbar select { min-width: 0; flex: 1 1 100%; width: 100%; height: 42px; }
  .filterbar .btn { flex: 1; }

  .form__actions .btn { flex: 1 1 auto; }
  .form__actions--sticky { position: static; background: none; padding-top: 0; }

  .infobox { gap: 8px 18px; font-size: 12.5px; padding: 11px 13px; }
  .kv { font-size: 12.5px; }
  .pager { gap: 5px; }
  .pagebtn { min-width: 38px; height: 38px; }

  .login-page { padding: 16px; }
  .login-card { border-radius: 20px; }

  /* ---------------- نوارِ پایین ---------------- */

  .mtabbar {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    position: fixed; inset-inline: 0; bottom: 0; z-index: 55;
    background: rgba(255,255,255,.97);
    backdrop-filter: saturate(180%) blur(12px);
    border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-shadow: 0 -6px 20px -12px rgba(16,32,29,.3);
  }
  .mtabbar__item {
    display: grid; justify-items: center; align-content: center; gap: 3px;
    min-height: 56px; padding: 7px 2px 8px; color: var(--muted);
    font-size: 10.5px; font-weight: 700; line-height: 1.3;
    transition: color .16s, background .16s;
  }
  .mtabbar__item:active { background: var(--line-2); }
  .mtabbar__item.is-active { color: var(--primary); }
  .mtabbar__item.is-active svg { transform: translateY(-1px); }
  .mtabbar__item svg { transition: transform .18s; }

  /* ---------------- جدول‌ها ⇒ کارت ----------------
     ستون‌های جدول با data-label برچسب می‌گیرند. ستونِ اول نقش تیتر را
     دارد و ستونِ عملیات به نوارِ دکمه در پایینِ کارت تبدیل می‌شود. */

  .table-wrap { overflow: visible; border: 0; border-radius: 0; }
  .table, .table--tight { min-width: 0; width: 100%; display: block; }
  .table thead { display: none; }
  .table tbody, .table tr, .table td { display: block; width: 100%; }

  .table tr {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
    padding: 13px 14px; margin-bottom: 11px; box-shadow: var(--shadow-1);
  }
  .table tr:last-child { margin-bottom: 0; }
  .table tbody tr:hover { background: var(--card); }
  .table td { border: 0; padding: 0; font-size: 13.5px; }

  /* سطرهای برچسب‌دار: «برچسب ....... مقدار» */
  .table td[data-label] {
    display: flex; align-items: baseline; justify-content: space-between; gap: 14px;
    padding: 5px 0; border-bottom: 1px dashed var(--line-2); text-align: end;
  }
  .table td[data-label]:last-of-type { border-bottom: 0; }
  .table td[data-label]::before {
    content: attr(data-label); flex: none; color: var(--muted);
    font-size: 12px; font-weight: 700; text-align: start;
  }
  .table td[data-label] > * { min-width: 0; }

  /* ستونِ تیترِ کارت (بدون data-label) */
  .table td.cell-title { padding-bottom: 10px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }

  /* ستونِ عملیات ⇒ ردیفِ دکمه‌های تمام‌عرض */
  .table td.col-actions { padding-top: 12px; margin-top: 6px; border-top: 1px solid var(--line); }
  .table .rowbtns { justify-content: stretch; gap: 7px; }
  .table .rowbtns > * { flex: 1 1 0; min-width: 0; }
  .table .rowbtns form { flex: 1 1 0; display: flex; }
  .table .rowbtns form > .btn, .table .rowbtns > .btn { width: 100%; }
  .table .msgcell { max-width: none; }
  .table .msgcell pre { max-height: none; }
  .table .linkcell { word-break: break-all; }

  /* ردیفِ ویرایشِ کاربر که با دکمه باز می‌شود */
  .useredit { background: var(--surface); }
  .useredit td { padding: 4px 0 0; }
  .useredit .form--inline { display: grid; gap: 12px; }
  .useredit .form--inline .btn { width: 100%; }

  /* فهرستِ اسلایدها */
  .slidelist__item { padding: 12px; gap: 11px; }
  .slidelist__thumb { width: 100%; }
  .slidelist__meta { flex: 1 1 100%; }
  .slidelist__acts { margin-inline-start: 0; width: 100%; gap: 7px; }
  .slidelist__acts .btn { flex: 1 1 0; }
  .slidelist__acts form { flex: 1 1 0; display: flex; }
  .slidelist__acts form > .btn { width: 100%; }

  /* شبکه‌ی تصاویر */
  .imggrid { grid-template-columns: repeat(auto-fill, minmax(108px,1fr)); gap: 9px; }
  .imggrid--one { grid-template-columns: minmax(0, 190px); }
  .imggrid--wide { grid-template-columns: minmax(0, 1fr); }
  .imgtile__bar { flex-wrap: wrap; }
  .dropzone { padding: 20px 14px; }
  .specrow { grid-template-columns: 1fr; gap: 8px; }
  .specrow__del { justify-self: end; width: 44px; height: 44px; }

  .colorrow .colorinput { gap: 10px; }
  .permrow { gap: 7px; }
  .perm { font-size: 12px; padding: 5px 12px; }
  .split { gap: 16px; }
  .form-grid { gap: 16px; }
  .logopreview img { height: 46px; }
}
