/* ==========================================================================
   آی‌لاین — سیستم طراحی (ساده، فارسی، RTL)
   ========================================================================== */
:root {
  --navy: #0f2544;
  --navy-2: #17335c;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --blue-soft: #eaf1ff;
  --bg: #f4f6fb;
  --surface: #ffffff;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --text: #0f172a;
  --muted: #64748b;
  --success: #16a34a;
  --success-soft: #e9f8ef;
  --warn: #d97706;
  --warn-soft: #fff6e5;
  --danger: #dc2626;
  --danger-soft: #fdecec;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(15, 37, 68, .06), 0 8px 24px rgba(15, 37, 68, .06);
  --shadow-lg: 0 20px 45px rgba(15, 37, 68, .16);
  --sidebar: 248px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--app-font, 'Vazirmatn', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: 15px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.45; font-weight: 700; }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
img { max-width: 100%; }
:focus-visible { outline: 3px solid rgba(37, 99, 235, .45); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; right: -999px; top: 8px; background: #fff; padding: 8px 14px; border-radius: 8px; z-index: 99; }
.skip:focus { right: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ------------------------------------------------------------------ topbar */
.topbar {
  background: var(--navy);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 40;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .06);
}
.topbar-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; font-size: 1.05rem; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, var(--blue), #3b82f6);
  display: grid; place-items: center; font-size: 1rem; color: #fff;
}
.brand small { display: block; font-size: .68rem; color: #a9c0e6; font-weight: 400; }
.topnav { display: flex; gap: 4px; margin-inline-start: auto; align-items: center; }
.topnav a {
  color: #d7e3f7; padding: 8px 10px; border-radius: 8px; font-size: .9rem;
}
.topnav a:hover, .topnav a.active { background: rgba(255, 255, 255, .1); color: #fff; text-decoration: none; }
.icon-btn {
  background: rgba(255, 255, 255, .1); border: 0; color: #fff; width: 38px; height: 38px;
  border-radius: 10px; display: grid; place-items: center; cursor: pointer; font-size: 1.1rem;
}
.icon-btn:hover { background: rgba(255, 255, 255, .18); }
.menu-btn { display: none; }
.user-chip {
  display: flex; align-items: center; gap: 8px; background: rgba(255, 255, 255, .1);
  border-radius: 999px; padding: 4px 12px 4px 4px; color: #fff; font-size: .85rem;
}
.badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: var(--danger); color: #fff; font-size: .7rem; font-weight: 700;
}

/* ------------------------------------------------------------------ layout */
.main { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 22px 16px 48px; }
.main:focus { outline: none; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head p { color: var(--muted); margin: 0; }
.crumbs { color: var(--muted); font-size: .82rem; margin-bottom: 6px; }
.crumbs a { color: var(--muted); }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stack { display: grid; gap: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row-between { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.center { text-align: center; }
.mt { margin-top: 16px; }
.mt-lg { margin-top: 28px; }

/* ------------------------------------------------------------------- cards */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow);
}
.card.tight { padding: 14px; }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-title h2, .card-title h3 { margin: 0; }
.hero {
  background: radial-gradient(1200px 400px at 90% -10%, rgba(37, 99, 235, .35), transparent 60%), var(--navy);
  color: #fff; border-radius: 20px; padding: 34px 26px; margin-bottom: 22px;
}
.hero h1 { font-size: 1.9rem; margin-bottom: .3em; }
.hero p { color: #cfdcf1; max-width: 620px; margin-bottom: 1.2em; }
.hero .row { gap: 10px; }

.stat { display: flex; flex-direction: column; gap: 4px; }
.stat-value { font-size: 1.45rem; font-weight: 700; line-height: 1.2; }
.stat-label { color: var(--muted); font-size: .82rem; }
.stat.accent .stat-value { color: var(--blue); }
.stat.ok .stat-value { color: var(--success); }
.stat.warn .stat-value { color: var(--warn); }

/* ----------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: 10px; padding: 10px 16px;
  font: inherit; font-size: .92rem; font-weight: 600; cursor: pointer;
  background: var(--blue); color: #fff; transition: background .15s, box-shadow .15s, transform .05s;
  min-height: 42px;
}
.btn:hover { background: var(--blue-dark); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .6; cursor: not-allowed; }
.btn.secondary { background: #fff; color: var(--navy); border-color: var(--line-strong); }
.btn.secondary:hover { background: #f8fafc; }
.btn.ghost { background: transparent; color: var(--blue); }
.btn.ghost:hover { background: var(--blue-soft); }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #b91c1c; }
.btn.success { background: var(--success); }
.btn.success:hover { background: #15803d; }
.btn.sm { padding: 6px 12px; min-height: 34px; font-size: .84rem; border-radius: 8px; }
.btn.block { width: 100%; }
.btn.loading { position: relative; color: transparent !important; }
.btn.loading::after {
  content: ''; position: absolute; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .5); border-top-color: #fff; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------------ forms */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > label { font-size: .86rem; font-weight: 600; color: var(--navy); }
.field .hint { font-size: .76rem; color: var(--muted); }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 10px;
  font: inherit; font-size: .93rem; background: #fff; color: var(--text); min-height: 44px;
}
.field textarea { min-height: 96px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37, 99, 235, .15); outline: none;
}
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--danger); background: #fffafa; }
.field .err { color: var(--danger); font-size: .78rem; }
.req { color: var(--danger); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 6px; flex-wrap: wrap; }
.alert { border-radius: 10px; padding: 10px 14px; font-size: .88rem; margin-bottom: 14px; border: 1px solid transparent; }
.alert.info { background: var(--blue-soft); color: #1e3a8a; border-color: #c7d9ff; }
.alert.warn { background: var(--warn-soft); color: #92400e; border-color: #fbd99a; }
.alert.danger { background: var(--danger-soft); color: #991b1b; border-color: #f6c4c4; }
.alert.success { background: var(--success-soft); color: #14532d; border-color: #bce3ca; }

/* ---------------------------------------- متن‌های بلند و لینک‌ها (بدون به‌هم‌ریختن چیدمان) */
.card, .alert, .modal, .page-head > div, .kv { min-width: 0; }
.card p, .card .small, .card .muted, .alert, .table-wrap td, .kv dd, .step { overflow-wrap: anywhere; }
.source-url {
  direction: ltr; unicode-bidi: isolate; display: inline;
  overflow-wrap: anywhere; word-break: break-word;
}

/* ------------------------------------------------------------------ tables */
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; font-size: .88rem; background: #fff; }
thead th {
  text-align: right; font-weight: 600; color: var(--muted); background: #f8fafc;
  padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
tbody td { padding: 11px 12px; border-bottom: 1px solid #eef2f7; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfcfe; }
.cell-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.table-cards { display: none; }

/* ------------------------------------------------------------------ badges */
.tag {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px;
  font-size: .75rem; font-weight: 600; background: #eef2f7; color: #334155; white-space: nowrap;
}
.tag.blue { background: var(--blue-soft); color: #1d4ed8; }
.tag.green { background: var(--success-soft); color: #15803d; }
.tag.amber { background: var(--warn-soft); color: #b45309; }
.tag.red { background: var(--danger-soft); color: #b91c1c; }
.tag.gray { background: #f1f5f9; color: #475569; }

/* ------------------------------------------------------------------ lists */
.option-list { display: grid; gap: 10px; }
.option {
  border: 1px solid var(--line-strong); border-radius: 12px; padding: 12px 14px;
  display: flex; align-items: center; gap: 12px; cursor: pointer; background: #fff;
}
.option:hover { border-color: var(--blue); background: #fbfdff; }
.option input { accent-color: var(--blue); width: 18px; height: 18px; margin: 0; }
.option.selected { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); background: #f8fbff; }
.option .o-title { font-weight: 600; }
.option .o-meta { color: var(--muted); font-size: .8rem; }
.option .o-price { margin-inline-start: auto; font-weight: 700; color: var(--navy); white-space: nowrap; }

.kv { display: grid; grid-template-columns: 140px 1fr; gap: 8px 12px; font-size: .9rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.empty { text-align: center; padding: 34px 16px; color: var(--muted); }
.empty .e-icon { font-size: 1.8rem; display: block; margin-bottom: 6px; }
.timeline { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.timeline li { padding-inline-start: 14px; border-inline-start: 2px solid var(--line); }
.timeline li:first-child { border-color: var(--blue); }
.timeline .t-meta { font-size: .78rem; color: var(--muted); }

.pagination { display: flex; gap: 6px; align-items: center; justify-content: center; margin-top: 14px; flex-wrap: wrap; }
.pagination button { min-width: 36px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; }
.filters .field { margin: 0; min-width: 140px; }

/* ----------------------------------------- اطلاعات کارت‌به‌کارت (درشت + کپی) */
.card-pay-box {
  background: var(--blue-soft); border: 1px solid #c7d9ff; border-radius: 12px;
  padding: 12px 14px; margin: 10px 0 14px;
}
.card-pay-box .cp-hint { color: #1e3a8a; font-size: .78rem; margin-bottom: 8px; }
.card-pay-box .cp-number {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; background: #fff; border: 1px solid #b9d0ff; border-radius: 10px;
  padding: 10px 12px; cursor: pointer; font: inherit; text-align: inherit;
}
.card-pay-box .cp-number:hover { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.card-pay-box .cp-digits {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 700;
  font-size: 1.35rem; letter-spacing: .06em; color: var(--navy); word-break: break-all;
}
.card-pay-box .cp-copy {
  flex: none; background: var(--blue); color: #fff; border-radius: 8px;
  padding: 5px 12px; font-size: .78rem; font-weight: 600;
}
.card-pay-box .cp-holder { margin-top: 8px; font-size: .84rem; color: #1e3a8a; }
@media (max-width: 640px) {
  .card-pay-box .cp-digits { font-size: 1.2rem; }
}

/* ------------------------------------------------------- مسیر خرید (خانه) */
.buy-steps {
  list-style: none; margin: 0; padding: 0; display: grid; gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.buy-steps li {
  background: #f8fafc; border: 1px solid var(--line); border-radius: 12px;
  padding: 12px; display: grid; gap: 4px;
}
.buy-steps li span { color: var(--muted); font-size: .82rem; }
@media (max-width: 640px) { .buy-steps { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------------ drawer */
.drawer-backdrop {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 45; border: 0;
}
.drawer {
  position: fixed; top: 0; right: 0; height: 100%; width: 272px; background: var(--navy);
  color: #fff; z-index: 46; transform: translateX(100%); transition: transform .22s ease;
  overflow-y: auto; padding: 14px; display: grid; align-content: start; gap: 4px;
}
.drawer.open { transform: translateX(0); }
.drawer .d-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.drawer .d-group { color: #8fa9cf; font-size: .74rem; margin: 14px 8px 4px; letter-spacing: .02em; }
.drawer a {
  color: #d7e3f7; padding: 9px 10px; border-radius: 9px; display: flex; align-items: center; gap: 9px;
  font-size: .9rem;
}
.drawer a:hover, .drawer a.active { background: rgba(255, 255, 255, .1); color: #fff; text-decoration: none; }
.drawer a .badge { margin-inline-start: auto; }

/* --------------------------------------------------------------- admin shell */
.admin-shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); gap: 20px; align-items: start; }
.sidebar {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px; position: sticky; top: 76px; box-shadow: var(--shadow);
}
.sidebar .s-group { color: var(--muted); font-size: .72rem; padding: 10px 10px 4px; }
.sidebar .nav-badge { margin-inline-start: 6px; }
.sidebar a {
  display: flex; align-items: center; gap: 9px; padding: 9px 10px; border-radius: 9px;
  color: #334155; font-size: .89rem; font-weight: 500;
}
.sidebar a:hover { background: #f1f5f9; text-decoration: none; }
.sidebar a.active { background: var(--blue-soft); color: var(--blue-dark); font-weight: 600; }
.admin-content { min-width: 0; }
.admin-topbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.admin-mnav { display: none; margin-bottom: 14px; }
.admin-mnav select { width: 100%; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 10px; font: inherit; background: #fff; }

/* ------------------------------------------------------------------- toast */
.toast {
  position: fixed; inset-inline: 0; bottom: 18px; margin: auto; width: max-content; max-width: 90vw;
  background: var(--navy); color: #fff; padding: 11px 18px; border-radius: 999px;
  box-shadow: var(--shadow-lg); z-index: 80; font-size: .88rem;
}
.toast.error { background: #7f1d1d; }
.toast.success { background: #14532d; }

/* ------------------------------------------------------------------- modal */
[hidden] { display: none !important; }
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .5); z-index: 70;
  display: grid; place-items: center; padding: 16px; overflow-y: auto;
}
.modal { background: #fff; border-radius: 16px; width: min(560px, 100%); padding: 20px; box-shadow: var(--shadow-lg); }
.modal h3 { margin-bottom: 4px; }
.modal .m-body { margin: 12px 0 16px; }
.modal .m-actions { display: flex; gap: 10px; justify-content: flex-start; }

/* --------------------------------------------------------------- utilities */
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
.embed { position: relative; padding-top: 56.25%; border-radius: 12px; overflow: hidden; background: #000; margin: 10px 0; }
.embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* رسانهٔ آموزش: ویدیو و عکس */
.tutorial-card h2 { font-size: 1.02rem; }
.tut-video {
  display: block; width: 100%; aspect-ratio: 16 / 9; margin: 10px 0;
  border-radius: 12px; background: #000; object-fit: contain;
}
.tut-image { display: block; margin: 10px 0; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); }
.tut-image img { display: block; width: 100%; height: auto; max-height: 420px; object-fit: cover; }
@media (max-width: 640px) { .tut-image img { max-height: 260px; } }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; direction: ltr; unicode-bidi: embed; }

.footer {
  border-top: 1px solid var(--line); background: #fff; color: var(--muted); font-size: .83rem;
  padding: 18px 16px; text-align: center;
}
.footer a { color: var(--muted); }

@media (max-width: 980px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .admin-mnav { display: block; }
  .menu-btn { display: grid; }
  .topnav { display: none; }
}
@media (max-width: 640px) {
  body { font-size: 14.5px; }
  .brand small { display: none; }
  .brand { font-size: .98rem; gap: 8px; }
  .topbar-inner { gap: 8px; padding: 8px 12px; }
  .admin-entry { display: none; }
  .user-chip span:first-child { max-width: 88px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .user-chip { padding: 3px 10px 3px 3px; font-size: .8rem; }
  .main { padding: 16px 12px 40px; }
  .hero { padding: 24px 18px; border-radius: 16px; }
  .hero h1 { font-size: 1.5rem; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dt { margin-top: 6px; }
  .card { padding: 14px; }
  h1 { font-size: 1.35rem; }
  .table-wrap { display: none; }
  .table-cards { display: grid; gap: 10px; }
  .table-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: #fff; }
  .table-card .tc-top { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
  .table-card .tc-row { display: flex; justify-content: space-between; gap: 8px; font-size: .82rem; padding: 3px 0; }
  .table-card .tc-row span:first-child { color: var(--muted); }
  .filters .field { flex: 1 1 100%; min-width: 0; }
  .btn { width: auto; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  html { scroll-behavior: auto; }
}

/* ------------------------------------------------------------------- tabs */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin: 0 0 14px; }
.tab {
  padding: 9px 14px; border-radius: 10px 10px 0 0; color: var(--muted);
  font-size: .9rem; font-weight: 600; border: 1px solid transparent; border-bottom: 0;
}
.tab:hover { background: #fff; color: var(--navy); }
.tab.active { background: #fff; color: var(--navy); border-color: var(--line); box-shadow: inset 0 2px 0 var(--navy); }
.tab-panel > .card { max-width: 760px; }
.copy-row { display: flex; gap: 8px; align-items: center; }
.copy-row input { flex: 1; min-width: 0; }
.help-box { margin-top: 14px; border: 1px dashed var(--line); border-radius: 12px; padding: 10px 12px; background: #fbfcfe; }
.help-box summary { cursor: pointer; font-weight: 600; font-size: .9rem; }
.help-box ol { margin: 8px 0 0; padding-inline-start: 18px; font-size: .85rem; line-height: 2; color: var(--muted); }
.help-box a { text-decoration: underline; }

/* --------------------------------------------------------------- login */
.login-divider { display: flex; align-items: center; gap: 10px; margin: 18px 0 10px; color: var(--muted); font-size: .8rem; }
.login-divider::before, .login-divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.login-method-title { font-size: .95rem; margin: 6px 0 8px; }
.google-btn { display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 600; }
.g-mark {
  display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px;
  border-radius: 50%; background: #fff; color: #4285f4; font-weight: 700; font-family: Arial, sans-serif;
  box-shadow: 0 0 0 1px var(--line);
}
@media (max-width: 640px) {
  .tabs { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 1px; }
  .tab { white-space: nowrap; }
}

/* ------------------------------------------------------ تاریخ شمسی (پیکر) */
.jalali-pick { display: grid; grid-template-columns: 1fr 1.25fr .8fr; gap: 6px; }
.jalali-pick select { width: 100%; }
@media (max-width: 420px) { .jalali-pick { grid-template-columns: 1fr; } }

/* -------------------------------------------------- مدیریت سرور (پنل) */
.meter-row { margin: 6px 0 14px; }
.meter { height: 8px; background: #eef2f7; border-radius: 999px; overflow: hidden; margin-top: 5px; }
.meter > span { display: block; height: 100%; border-radius: 999px; background: var(--blue); transition: width .3s; }
.meter.ok > span { background: var(--success); }
.meter.warn > span { background: var(--warn); }
.meter.critical > span { background: var(--danger); }
.progress { height: 10px; background: #eef2f7; border-radius: 999px; overflow: hidden; margin: 10px 0 6px; }
.progress > span { display: block; height: 100%; width: 0; border-radius: 999px; background: var(--blue); transition: width .2s; }
.steps { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.step { display: flex; align-items: center; gap: 8px; font-size: .86rem; color: var(--muted); }
.step .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--line-strong); flex: none; }
.step.running { color: var(--navy); font-weight: 600; }
.step.running .dot { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.step.done .dot { background: var(--success); }
.step.failed .dot { background: var(--danger); }
.log-view { max-height: 520px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; background: #0f172a; padding: 8px; }
.log-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 5px 6px; border-bottom: 1px solid rgba(255, 255, 255, .07); font-size: .78rem; color: #e2e8f0; }
.log-line.error, .log-line.fatal { background: rgba(220, 38, 38, .14); }
.log-line.warn { background: rgba(245, 158, 11, .12); }
.log-time { color: #94a3b8; white-space: nowrap; font-variant-numeric: tabular-nums; }
.log-msg { flex: 1; min-width: 180px; word-break: break-word; }
.log-detail { width: 100%; color: #fca5a5; font-size: .74rem; word-break: break-word; }
.log-pre { direction: ltr; text-align: left; font-size: .72rem; max-height: 320px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; margin: 8px 0 0; }

/* ==========================================================================
   بازطراحی ظاهر (نسخهٔ ۲.۲۱) — عمق، نظم و خوانایی بیشتر بدون تغییر ساختار
   ========================================================================== */
:root {
  --navy: #0a1f3c;
  --navy-2: #123059;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --bg: #f5f7fb;
  --line: #e6ebf3;
  --line-strong: #cdd7e5;
  --text: #0b1526;
  --muted: #5d6b82;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(10, 31, 60, .04), 0 10px 30px rgba(10, 31, 60, .06);
  --shadow-lg: 0 24px 60px rgba(10, 31, 60, .18);
}

body {
  background:
    radial-gradient(900px 420px at 100% -10%, rgba(37, 99, 235, .07), transparent 60%),
    var(--bg);
}

.topbar {
  background: linear-gradient(180deg, #0a1f3c, #0d2749);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .07), 0 10px 30px rgba(10, 31, 60, .16);
}
.topbar-inner { padding: 12px 20px; }
.brand { gap: 12px; letter-spacing: -.01em; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 12px;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  box-shadow: 0 6px 18px rgba(37, 99, 235, .45), inset 0 1px 0 rgba(255, 255, 255, .35);
  font-size: 1.05rem;
}
.brand small { color: #a8bee0; letter-spacing: .01em; }
.topnav { gap: 2px; }
.topnav a {
  padding: 9px 12px; border-radius: 10px; font-size: .88rem; font-weight: 500;
  color: #c6d6ee; transition: background .15s, color .15s;
}
.topnav a:hover { background: rgba(255, 255, 255, .08); }
.topnav a.active {
  background: rgba(255, 255, 255, .13); color: #fff;
  box-shadow: inset 0 -2px 0 #60a5fa;
}
.user-chip { background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .08); }
.icon-btn { border: 1px solid rgba(255, 255, 255, .08); }

/* --------------------------------------------------------------- هدر صفحه */
.hero {
  position: relative; overflow: hidden; border-radius: 24px; padding: 40px 32px;
  background:
    radial-gradient(900px 380px at 88% -25%, rgba(59, 130, 246, .5), transparent 62%),
    radial-gradient(560px 300px at 6% 120%, rgba(16, 185, 129, .18), transparent 62%),
    linear-gradient(135deg, #0a1f3c 10%, #123059 58%, #144178 100%);
  box-shadow: 0 26px 60px rgba(10, 31, 60, .24);
}
.hero::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, .055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .055) 1px, transparent 1px);
  background-size: 46px 46px;
  -webkit-mask-image: radial-gradient(700px 340px at 82% 0%, #000, transparent 78%);
  mask-image: radial-gradient(700px 340px at 82% 0%, #000, transparent 78%);
}
.hero > * { position: relative; z-index: 1; }
.hero h1 {
  font-size: clamp(1.65rem, 3.1vw, 2.3rem); letter-spacing: -.015em;
  margin-bottom: .35em; max-width: 20ch;
}
.hero p { color: #c8d8ee; max-width: 60ch; font-size: 1.01rem; }
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 6px; margin-bottom: 16px;
  padding: 5px 12px; border-radius: 999px; font-size: .76rem; font-weight: 600;
  color: #dbeafe; background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(255, 255, 255, .18);
}
.hero .btn { box-shadow: 0 10px 24px rgba(3, 10, 24, .3); }
.hero .btn.secondary {
  background: rgba(255, 255, 255, .1); color: #fff; border-color: rgba(255, 255, 255, .28);
  box-shadow: none;
}
.hero .btn.secondary:hover { background: rgba(255, 255, 255, .18); }
.hero-points {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 24px;
}
.hero-points > div {
  background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 14px; padding: 12px 14px; backdrop-filter: blur(4px);
}
.hero-points b { display: block; font-size: .86rem; color: #fff; }
.hero-points span { font-size: .76rem; color: #b9cbe6; line-height: 1.7; }
@media (max-width: 640px) {
  .hero { padding: 26px 18px; border-radius: 18px; }
  .hero-points { grid-template-columns: 1fr; }
}

/* ------------------------------------------------------------- کارت‌ها */
.card {
  border-radius: var(--radius); padding: 20px;
  border-color: var(--line);
  transition: box-shadow .18s ease, transform .18s ease, border-color .18s ease;
}
a.card:hover {
  transform: translateY(-2px); box-shadow: 0 16px 40px rgba(10, 31, 60, .1);
  border-color: #d8e2f1; text-decoration: none;
}
.card-title { margin-bottom: 14px; }
.card-title h2, .card-title h3 { letter-spacing: -.01em; }
h1, h2, h3 { letter-spacing: -.012em; }
.stat-value { font-size: 1.55rem; letter-spacing: -.02em; }
.stat-label { font-weight: 500; }
.card.tight { padding: 16px; }

/* ------------------------------------------------------------- دکمه‌ها */
.btn {
  border-radius: 11px; font-weight: 600; letter-spacing: 0;
  background: linear-gradient(180deg, #2f6df0, #1d4ed8);
  box-shadow: 0 6px 16px rgba(37, 99, 235, .22);
  transition: filter .15s, box-shadow .15s, transform .05s, background .15s;
}
.btn:hover { background: linear-gradient(180deg, #2a63e0, #1a45c4); filter: none; }
.btn.secondary {
  background: #fff; box-shadow: 0 1px 2px rgba(10, 31, 60, .06);
  color: var(--navy); border-color: var(--line-strong);
}
.btn.secondary:hover { background: #f7f9fd; border-color: #b9c8dc; }
.btn.ghost { background: transparent; box-shadow: none; }
.btn.ghost:hover { background: var(--blue-soft); }
.btn.danger, .btn.success { box-shadow: none; }
.btn.sm { border-radius: 9px; }

/* ------------------------------------------------------------- فرم‌ها */
.field input, .field select, .field textarea {
  border-color: var(--line-strong); border-radius: 11px; background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.field > label { color: #1e2f4d; }

/* ------------------------------------------------------------- جدول‌ها */
.table-wrap { border-radius: 12px; }
thead th { background: #f7f9fd; font-size: .8rem; }
tbody td { border-bottom-color: #eff3f9; }

/* ------------------------------------------------------------- پابرگ */
.footer {
  background: #fff; border-top: 1px solid var(--line);
  padding: 26px 16px 30px; color: var(--muted);
}
.footer-inner {
  max-width: 1180px; margin: 0 auto; display: flex; flex-wrap: wrap;
  gap: 18px 32px; align-items: center; justify-content: space-between; text-align: right;
}
.f-brand { display: flex; align-items: center; gap: 10px; }
.f-brand .brand-mark { width: 34px; height: 34px; border-radius: 10px; font-size: .95rem; }
.f-brand strong { display: block; color: var(--text); font-size: .95rem; }
.f-brand span { font-size: .78rem; }
.f-links { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .85rem; }
.f-links a { color: #33415c; }
.f-links a:hover { color: var(--blue); }
.f-meta { font-size: .78rem; color: var(--muted); }
@media (max-width: 640px) {
  .footer-inner { flex-direction: column; align-items: flex-start; gap: 12px; }
}

/* --------------------------------------------------- صفحهٔ پشتیبانی (کاربر) */
.support-intro { display: flex; gap: 18px; align-items: flex-start; }
.support-intro h1 { font-size: 1.4rem; }
.si-icon {
  flex: none; width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center;
  font-size: 1.55rem; background: var(--blue-soft); border: 1px solid #d3e2ff;
}
@media (max-width: 640px) { .support-intro { flex-direction: column; gap: 10px; } }

/* ---------------------------------------------------- ویجت چت (سمت کاربر) */
.sc { position: fixed; inset-inline-start: 18px; bottom: 18px; z-index: 60; }
.sc-launch {
  position: relative; display: inline-flex; align-items: center; gap: 10px;
  border: 0; cursor: pointer; font: inherit; font-weight: 700; font-size: .9rem; color: #fff;
  padding: 9px 18px 9px 10px; border-radius: 999px;
  background: linear-gradient(135deg, #2f6df0, #1d4ed8);
  box-shadow: 0 16px 34px rgba(37, 99, 235, .38);
  transition: transform .15s, box-shadow .15s;
}
.sc-launch:hover { transform: translateY(-1px); box-shadow: 0 20px 40px rgba(37, 99, 235, .45); }
.sc-ico {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  font-size: 1rem; background: rgba(255, 255, 255, .18);
}
.sc-badge {
  position: absolute; top: -5px; inset-inline-end: -3px; min-width: 20px; height: 20px;
  padding: 0 5px; border-radius: 999px; display: grid; place-items: center;
  background: var(--danger); color: #fff; font-size: .7rem; font-weight: 700;
  border: 2px solid #fff;
}
.sc-panel {
  width: min(372px, calc(100vw - 24px)); height: min(548px, calc(100vh - 120px));
  display: flex; flex-direction: column; overflow: hidden;
  background: #fff; border: 1px solid var(--line); border-radius: 18px;
  box-shadow: var(--shadow-lg);
}
.sc-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 14px; color: #fff;
  background: linear-gradient(135deg, #0a1f3c, #123059);
}
.sc-id { display: flex; align-items: center; gap: 10px; }
.sc-dot {
  width: 9px; height: 9px; border-radius: 50%; background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, .18);
}
.sc-head strong { font-size: .92rem; display: block; }
.sc-head small { display: block; font-size: .71rem; color: #b9cbe6; }
.sc-x { background: transparent; border: 0; color: #cbd8ea; font-size: 1rem; cursor: pointer; }
.sc-body {
  flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px;
  background: linear-gradient(180deg, #f8fafc, #fff);
}
.sc-welcome {
  background: #eff6ff; border: 1px solid #dbeafe; border-radius: 12px;
  padding: 10px 12px; font-size: .8rem; color: #1e3a8a;
}
.sc-welcome p { margin: 4px 0 0; }
.sc-msg { display: flex; flex-direction: column; max-width: 88%; }
.sc-msg.user { align-self: flex-start; }
.sc-msg.admin { align-self: flex-end; }
.sc-bubble {
  padding: 9px 12px; font-size: .85rem; line-height: 1.75;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.sc-msg.user .sc-bubble {
  background: linear-gradient(135deg, #2f6df0, #1d4ed8); color: #fff;
  border-radius: 14px 14px 4px 14px;
}
.sc-msg.admin .sc-bubble {
  background: #fff; border: 1px solid var(--line); border-radius: 14px 14px 14px 4px;
  box-shadow: 0 2px 8px rgba(10, 31, 60, .05);
}
.sc-meta { font-size: .68rem; color: var(--muted); margin-top: 3px; padding: 0 2px; }
.sc-form {
  display: flex; gap: 8px; align-items: flex-end; padding: 10px;
  border-top: 1px solid var(--line); background: #fff;
}
.sc-form textarea {
  flex: 1; min-height: 42px; max-height: 110px; resize: none; font: inherit;
  font-size: .85rem; padding: 9px 11px; border: 1px solid var(--line-strong);
  border-radius: 12px; background: #fff;
}
.sc-form .btn { min-height: 42px; padding: 8px 16px; box-shadow: none; }
.sc-closed {
  padding: 10px 14px; font-size: .78rem; color: #92400e;
  background: var(--warn-soft); border-top: 1px solid #fbd99a;
}
@media (max-width: 640px) {
  .sc { inset-inline-start: 12px; bottom: 12px; }
  .sc-launch { padding: 9px; }
  .sc-launch-label { display: none; }
  .sc-panel { width: calc(100vw - 24px); height: min(560px, calc(100dvh - 96px)); }
}

/* ------------------------------------------------------ چت پشتیبانی (مدیر) */
.support-admin {
  display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; align-items: start;
}
.support-list {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden auto; max-height: 72vh;
}
.chat-item {
  display: block; padding: 12px 14px; border-bottom: 1px solid var(--line); color: inherit;
}
.chat-item:last-child { border-bottom: 0; }
.chat-item:hover { background: #f8fafc; text-decoration: none; }
.chat-item.active { background: #eff6ff; box-shadow: inset 3px 0 0 var(--blue); }
.ci-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.ci-name { font-size: .79rem; color: var(--muted); margin-top: 2px; }
.ci-last {
  font-size: .78rem; color: #334155; margin-top: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ci-time { font-size: .68rem; color: var(--muted); margin-top: 2px; }
.support-chat { padding: 0; display: flex; flex-direction: column; min-height: 440px; overflow: hidden; }
.chat-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
}
.chat-body {
  height: min(56vh, 520px); overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 10px; background: #f8fafc;
}
.chat-msg { display: flex; flex-direction: column; gap: 3px; max-width: 80%; }
.chat-msg.user { align-self: flex-start; }
.chat-msg.admin { align-self: flex-end; }
.chat-msg .cm-body {
  padding: 9px 12px; font-size: .86rem; line-height: 1.75;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.chat-msg.user .cm-body {
  background: #fff; border: 1px solid var(--line); border-radius: 14px 14px 14px 4px;
}
.chat-msg.admin .cm-body {
  background: linear-gradient(135deg, #2f6df0, #1d4ed8); color: #fff;
  border-radius: 14px 14px 4px 14px;
}
.cm-meta { font-size: .68rem; color: var(--muted); }
.chat-empty { margin: auto; color: var(--muted); font-size: .84rem; }
.chat-compose {
  display: flex; gap: 8px; align-items: flex-end; padding: 12px; border-top: 1px solid var(--line);
}
.chat-compose textarea {
  flex: 1; min-height: 46px; resize: vertical; font: inherit; font-size: .86rem;
  padding: 9px 11px; border: 1px solid var(--line-strong); border-radius: 12px;
}
.chat-compose .btn { min-height: 46px; }
.chat-closed {
  padding: 12px 16px; font-size: .8rem; color: #92400e;
  background: var(--warn-soft); border-top: 1px solid #fbd99a;
}
@media (max-width: 900px) {
  .support-admin { grid-template-columns: 1fr; }
  .support-list { display: flex; overflow-x: auto; overflow-y: hidden; max-height: none; }
  .chat-item { min-width: 230px; border-bottom: 0; border-inline-end: 1px solid var(--line); }
  .chat-body { height: min(50vh, 420px); }
}

/* ------------------------------------------------ تنظیمات اعلان تلگرام */
.input-with-btn { display: flex; gap: 8px; align-items: stretch; }
.input-with-btn input { flex: 1; min-width: 0; }
.input-with-btn .btn { white-space: nowrap; }
.notify-result {
  margin-top: 14px; border-radius: 12px; padding: 12px 14px; font-size: .86rem; line-height: 1.8;
  border: 1px solid transparent; overflow-wrap: anywhere;
}
.notify-result.ok { background: var(--success-soft); border-color: #bce3ca; color: #14532d; }
.notify-result.err { background: var(--danger-soft); border-color: #f6c4c4; color: #991b1b; }
.chat-pick-list { display: grid; gap: 8px; margin-top: 10px; }
.chat-pick {
  display: grid; gap: 3px; text-align: right; width: 100%; cursor: pointer; font: inherit;
  background: #fff; border: 1px solid var(--line-strong); border-radius: 12px; padding: 10px 12px;
}
.chat-pick:hover { border-color: var(--blue); background: #f8fbff; }
@media (max-width: 640px) {
  .input-with-btn { flex-direction: column; }
  .input-with-btn .btn { width: 100%; }
}

/* ------------------------------------------------------------ آیکون‌های منو */
.topnav a { display: inline-flex; align-items: center; gap: 6px; }
.topnav a svg { width: 15px; height: 15px; flex: 0 0 auto; opacity: .92; }
.drawer a svg { width: 16px; height: 16px; flex: 0 0 auto; opacity: .92; }
.sidebar a svg { width: 16px; height: 16px; flex: 0 0 auto; color: #64748b; }
.sidebar a.active svg { color: var(--blue-dark); }
@media (max-width: 1120px) { .topnav a svg { display: none; } }
