/* =========================================================================
   ParPhonix — User & Admin Panel
   Neomorphic soft-UI on a dark, matte, gray-green base (distinct from the
   rest of the site's near-black, while keeping the brand gold accent for
   actions). Neomorphism only reads correctly when card and page share the
   same base color — everything here is differentiated by shadow, not fill.
   ========================================================================= */

:root {
  --pnl-bg: #12160f;
  --pnl-surface: #181d17;
  --pnl-surface-2: #1c221a;
  --pnl-shadow-dark: rgba(0, 0, 0, 0.55);
  --pnl-shadow-light: rgba(255, 255, 255, 0.028);
  --pnl-border: rgba(255, 255, 255, 0.045);
  --pnl-text: #e9ede6;
  --pnl-muted: #93a08d;
  --pnl-muted-2: #66715f;
  --pnl-accent: #c5a15b;
  --pnl-accent-bright: #e8c987;
  --pnl-sage: #8fae86;
  --pnl-danger: #e08585;
}

.panel-body {
  background: var(--pnl-bg);
  color: var(--pnl-text);
  min-height: 100vh;
  font-family: 'Poppins', 'Segoe UI', sans-serif;
}

.panel-shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: 100vh;
}

/* موبایل: ستون کناری به یک نوار افقی چسبیده به بالا تبدیل می‌شود. بدون این،
   سایدبار تمام ارتفاع صفحه را می‌گرفت و محتوا به زیر آن رانده می‌شد. */
@media (max-width: 860px) {
  .panel-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }
}

/* ---------- neomorphic primitive ---------- */

.neo {
  background: var(--pnl-surface);
  border-radius: 18px;
  box-shadow: 8px 8px 18px var(--pnl-shadow-dark), -6px -6px 14px var(--pnl-shadow-light);
}

.neo-inset {
  background: var(--pnl-surface);
  border-radius: 14px;
  box-shadow: inset 5px 5px 10px var(--pnl-shadow-dark), inset -4px -4px 8px var(--pnl-shadow-light);
}

.neo-pressable {
  transition: box-shadow 0.18s ease, transform 0.18s ease;
}
.neo-pressable:active {
  box-shadow: inset 4px 4px 9px var(--pnl-shadow-dark), inset -3px -3px 7px var(--pnl-shadow-light);
  transform: translateY(1px);
}

/* ---------- sidebar ---------- */

.pnl-side {
  padding: 26px 18px;
  display: flex;
  flex-direction: column;
  gap: 26px;
  border-right: 1px solid var(--pnl-border);
}

.pnl-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px;
}

.pnl-brand img { width: 30px; height: 30px; }
.pnl-brand span {
  font-family: 'Orbitron', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
}

.pnl-nav { display: flex; flex-direction: column; gap: 6px; }

.pnl-nav button {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: none;
  background: transparent;
  color: var(--pnl-muted);
  font-family: 'Rajdhani', sans-serif;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-radius: 12px;
  cursor: pointer;
  text-align: left;
  transition: all 0.18s ease;
}

html[dir="rtl"] .pnl-nav button { text-align: right; }

.pnl-nav button .ic { width: 18px; height: 18px; flex: none; opacity: 0.8; }

.pnl-nav button:hover { color: var(--pnl-text); }

.pnl-nav button.is-active {
  color: var(--pnl-accent-bright);
  background: var(--pnl-surface);
  box-shadow: inset 4px 4px 9px var(--pnl-shadow-dark), inset -3px -3px 7px var(--pnl-shadow-light);
}

.pnl-nav-spacer { flex: 1; }

.pnl-logout {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border: none;
  background: transparent;
  color: var(--pnl-danger);
  font-family: 'Rajdhani', sans-serif;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  border-radius: 12px;
  cursor: pointer;
}
.pnl-logout:hover { background: rgba(224,133,133,0.08); }

/* ---------- main ---------- */

.pnl-main { padding: 32px 34px 80px; max-width: 900px; }
@media (max-width: 640px) { .pnl-main { padding: 22px 16px 60px; } }

.pnl-header { margin-bottom: 28px; }
.pnl-eyebrow {
  font-family: 'Rajdhani', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--pnl-accent);
  margin-bottom: 6px;
}
.pnl-title {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(20px, 3vw, 26px);
  color: #fff;
  font-weight: 700;
}
.pnl-sub { color: var(--pnl-muted); font-size: 13.5px; margin-top: 6px; max-width: 60ch; }

.pnl-view { display: none; flex-direction: column; gap: 22px; }
.pnl-view.is-active { display: flex; }

/* verification banner */
.pnl-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-radius: 14px;
  background: var(--pnl-surface);
  box-shadow: 5px 5px 12px var(--pnl-shadow-dark), -4px -4px 10px var(--pnl-shadow-light);
  border: 1px solid rgba(232, 201, 135, 0.15);
}
.pnl-banner .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--pnl-accent-bright); flex: none; }
.pnl-banner p { margin: 0; font-size: 13px; color: var(--pnl-text); flex: 1; }
.pnl-banner button {
  flex: none;
  font-family: 'Rajdhani', sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: transparent;
  border: 1px solid var(--pnl-accent);
  color: var(--pnl-accent-bright);
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
}

/* stat / info tiles */
.pnl-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
}
.pnl-tile { padding: 18px 20px; }
.pnl-tile .k { font-family: 'Orbitron', sans-serif; font-size: 24px; color: #fff; }
.pnl-tile .l { font-family: 'Rajdhani', sans-serif; font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--pnl-muted); margin-top: 4px; }

/* card */
.pnl-card { padding: 24px; }
.pnl-card h3 {
  font-family: 'Rajdhani', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  margin: 0 0 4px;
}
.pnl-card .d { color: var(--pnl-muted); font-size: 12.5px; margin: 0 0 16px; }

/* forms */
.pnl-field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 14px; }
.pnl-field label {
  font-family: 'Rajdhani', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--pnl-accent);
}
.pnl-input {
  border: none;
  padding: 12px 15px;
  border-radius: 12px;
  background: var(--pnl-surface);
  color: var(--pnl-text);
  font-family: inherit;
  font-size: 15px;
  box-shadow: inset 4px 4px 9px var(--pnl-shadow-dark), inset -3px -3px 7px var(--pnl-shadow-light);
}
.pnl-input:focus { outline: none; box-shadow: inset 4px 4px 9px var(--pnl-shadow-dark), inset -3px -3px 7px var(--pnl-shadow-light), 0 0 0 2px rgba(197,161,91,0.4); }
.pnl-input:disabled { opacity: 0.55; }

.pnl-btn {
  border: none;
  padding: 11px 20px;
  border-radius: 12px;
  background: linear-gradient(150deg, var(--pnl-accent-bright), var(--pnl-accent));
  color: #14180f;
  font-family: 'Rajdhani', sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 5px 5px 12px var(--pnl-shadow-dark), -4px -4px 10px var(--pnl-shadow-light);
}
.pnl-btn:active { transform: translateY(1px); }
.pnl-btn:disabled { opacity: 0.55; cursor: not-allowed; }

.pnl-btn--ghost {
  background: transparent;
  color: var(--pnl-text);
  border: 1px solid var(--pnl-border);
  box-shadow: none;
}
.pnl-btn--danger { background: linear-gradient(150deg, #e79b9b, #cc6b6b); color: #2a0e0e; }

.pnl-status { font-size: 12.5px; min-height: 16px; margin-top: 8px; }
.pnl-status--ok { color: var(--pnl-sage); }
.pnl-status--error { color: var(--pnl-danger); }

/* wallet */
.pnl-wallet-address {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 12px;
  font-family: 'Share Tech Mono', monospace;
  font-size: 13px;
  color: var(--pnl-sage);
}
.pnl-wallet-address .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--pnl-sage); box-shadow: 0 0 8px rgba(143,174,134,0.6); flex: none; }

/* locked feature cards */
.pnl-features { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.pnl-feature { padding: 22px; position: relative; overflow: hidden; }
.pnl-feature .ic { width: 26px; height: 26px; color: var(--pnl-accent); opacity: 0.85; margin-bottom: 12px; }
.pnl-feature h4 { font-family: 'Rajdhani', sans-serif; font-size: 15px; font-weight: 700; color: #fff; margin: 0 0 6px; }
.pnl-feature p { font-size: 12.5px; color: var(--pnl-muted); margin: 0; line-height: 1.6; }

.pnl-feature[data-locked="true"] { opacity: 0.6; }
.pnl-feature[data-locked="true"]::after {
  content: '';
  position: absolute; inset: 0;
  background: repeating-linear-gradient(135deg, rgba(0,0,0,0.15) 0 10px, transparent 10px 20px);
  pointer-events: none;
}
.pnl-lock-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: 'Rajdhani', sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--pnl-muted-2);
  border: 1px solid var(--pnl-border);
  border-radius: 999px;
  padding: 3px 10px;
  margin-top: 12px;
}
.pnl-feature[data-locked="false"] .pnl-lock-chip { color: var(--pnl-sage); border-color: rgba(143,174,134,0.3); }

/* admin table */
.pnl-table-wrap { overflow-x: auto; }
table.pnl-table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.pnl-table th {
  text-align: left;
  font-family: 'Rajdhani', sans-serif;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--pnl-muted-2);
  padding: 0 12px 10px;
  white-space: nowrap;
}
html[dir="rtl"] table.pnl-table th, html[dir="rtl"] table.pnl-table td { text-align: right; }
table.pnl-table td {
  padding: 12px;
  border-top: 1px solid var(--pnl-border);
  color: var(--pnl-text);
  white-space: nowrap;
}

.pnl-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
}
.pnl-badge--ok { color: var(--pnl-sage); background: rgba(143,174,134,0.1); }
.pnl-badge--muted { color: var(--pnl-muted-2); background: rgba(255,255,255,0.03); }
.pnl-badge--gold { color: var(--pnl-accent-bright); background: rgba(197,161,91,0.1); }

/* toggle switch */
.pnl-toggle { position: relative; display: inline-block; width: 42px; height: 24px; flex: none; }
.pnl-toggle input { opacity: 0; width: 0; height: 0; }
.pnl-toggle .track {
  position: absolute; inset: 0; border-radius: 999px; cursor: pointer;
  background: var(--pnl-surface);
  box-shadow: inset 3px 3px 7px var(--pnl-shadow-dark), inset -2px -2px 5px var(--pnl-shadow-light);
  transition: background 0.2s ease;
}
.pnl-toggle .track::before {
  content: '';
  position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--pnl-muted-2);
  transition: transform 0.2s ease, background 0.2s ease;
}
.pnl-toggle input:checked + .track::before { transform: translateX(18px); background: var(--pnl-accent-bright); }
html[dir="rtl"] .pnl-toggle input:checked + .track::before { transform: translateX(-18px); }

.pnl-feature-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 14px 16px;
}
.pnl-feature-row + .pnl-feature-row { border-top: 1px solid var(--pnl-border); }
.pnl-feature-row .name { font-family: 'Rajdhani', sans-serif; font-weight: 700; font-size: 14px; color: #fff; }
.pnl-feature-row .key { font-family: 'Share Tech Mono', monospace; font-size: 11px; color: var(--pnl-muted-2); }

.pnl-search {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}
.pnl-search .pnl-input { flex: 1; }

/* verify-code inline form */
.pnl-otp-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.pnl-otp-row .pnl-field { flex: 1; min-width: 160px; margin-bottom: 0; }

.pnl-loading { color: var(--pnl-muted); font-size: 13px; padding: 20px 0; }

/* =========================================================================
   موبایل — سایدبار به نوار افقی، جدول‌ها به کارت
   ========================================================================= */

@media (max-width: 860px) {
  .pnl-side {
    position: sticky;
    top: 0;
    z-index: 20;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--pnl-bg);
    border-right: none;
    border-bottom: 1px solid var(--pnl-border);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .pnl-side::-webkit-scrollbar { display: none; }

  .pnl-brand { flex: none; padding: 0 6px 0 0; }
  .pnl-brand span { display: none; }          /* فقط لوگو، برای صرفه‌جویی در عرض */
  .pnl-brand img { width: 26px; height: 26px; }

  .pnl-nav { flex-direction: row; gap: 4px; flex: none; }
  .pnl-nav button { padding: 9px 12px; font-size: 13px; white-space: nowrap; }
  .pnl-nav button .ic { width: 16px; height: 16px; }

  .pnl-nav-link { flex: none; }
  .pnl-nav-spacer { display: none; }           /* در حالت افقی فضای اضافه نمی‌خواهیم */

  .pnl-logout {
    margin-top: 0;
    flex: none;
    padding: 9px 12px;
    font-size: 12px;
    white-space: nowrap;
  }
  .pnl-logout span { display: none; }          /* فقط آیکون */
  .pnl-logout .ic { width: 17px; height: 17px; }

  .pnl-main { padding: 20px 14px 70px; max-width: 100%; }
  .pnl-tiles { grid-template-columns: repeat(auto-fit, minmax(min(140px, 100%), 1fr)); gap: 12px; }
  .pnl-features { grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); }
  .pnl-card { padding: 18px 16px; }
  .pnl-tile { padding: 15px 16px; }
  .pnl-tile .k { font-size: 20px; }

  /* بنر تأیید ایمیل روی موبایل باید بشکند، نه اینکه دکمه بیرون بزند */
  .pnl-banner { flex-wrap: wrap; }
  .pnl-banner p { flex: 1 1 100%; }
  .pnl-banner .dot { order: -1; }

  .pnl-search { flex-wrap: wrap; }
  .pnl-search .pnl-input { min-width: 0; }
}

@media (max-width: 420px) {
  .pnl-nav button span { display: none; }      /* در عرض خیلی کم فقط آیکون‌ها */
  .pnl-nav button { padding: 9px 11px; }
}

/* جدول‌ها: در موبایل هر ردیف یک کارت می‌شود تا اسکرول افقی لازم نباشد */
@media (max-width: 700px) {
  table.pnl-table thead { display: none; }
  table.pnl-table, table.pnl-table tbody, table.pnl-table tr, table.pnl-table td { display: block; width: 100%; }
  table.pnl-table tr {
    border-top: 1px solid var(--pnl-border);
    padding: 12px 4px;
  }
  table.pnl-table td {
    border-top: none;
    padding: 5px 8px;
    white-space: normal;
    word-break: break-word;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
  }
  /* برچسب ستون از data-label می‌آید — JS آن را روی هر سلول می‌گذارد */
  table.pnl-table td::before {
    content: attr(data-label);
    font-family: 'Rajdhani', sans-serif;
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--pnl-muted-2);
    flex: none;
  }
  table.pnl-table td:empty { display: none; }
}

/* =========================================================================
   توکن‌ها
   ========================================================================= */

.pnl-balance {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.pnl-balance .amount {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(30px, 7vw, 42px);
  color: #fff;
  line-height: 1.1;
}
.pnl-balance .unit {
  font-family: 'Rajdhani', sans-serif;
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--pnl-accent);
}

.pnl-price-note {
  font-size: 12.5px;
  color: var(--pnl-muted);
  margin-top: 10px;
}
.pnl-price-note b { color: var(--pnl-accent-bright); font-weight: 600; }

/* انتخاب شبکه */
.pnl-network-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.pnl-network {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 16px;
  border-radius: 12px;
  border: 1px solid var(--pnl-border);
  background: var(--pnl-surface);
  color: var(--pnl-text);
  font-family: 'Rajdhani', sans-serif;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
}
.pnl-network.is-active {
  border-color: var(--pnl-accent);
  color: var(--pnl-accent-bright);
  box-shadow: inset 3px 3px 8px var(--pnl-shadow-dark), inset -2px -2px 6px var(--pnl-shadow-light);
}
.pnl-network[disabled] { opacity: 0.4; cursor: not-allowed; }
.pnl-network .tag {
  font-size: 9.5px;
  letter-spacing: 0.1em;
  color: var(--pnl-muted-2);
  border: 1px solid var(--pnl-border);
  border-radius: 999px;
  padding: 2px 7px;
}

/* کادر پرداخت */
.pnl-pay-box { display: flex; flex-direction: column; gap: 14px; }

.pnl-copy-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  flex-wrap: wrap;
}
.pnl-copy-row .val {
  font-family: 'Share Tech Mono', monospace;
  font-size: 13px;
  color: var(--pnl-accent-bright);
  word-break: break-all;
  flex: 1;
  min-width: 0;
}
.pnl-copy-row .lbl {
  font-family: 'Rajdhani', sans-serif;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--pnl-muted-2);
  flex: 1 1 100%;
}
.pnl-copy-btn {
  flex: none;
  font-family: 'Rajdhani', sans-serif;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: transparent;
  border: 1px solid var(--pnl-border);
  color: var(--pnl-muted);
  border-radius: 999px;
  padding: 5px 12px;
  cursor: pointer;
}
.pnl-copy-btn:hover { color: var(--pnl-accent-bright); border-color: var(--pnl-accent); }
.pnl-copy-btn.copied { color: var(--pnl-sage); border-color: rgba(143,174,134,0.4); }

.pnl-warn {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 12.5px;
  line-height: 1.6;
  background: rgba(232, 201, 135, 0.06);
  border: 1px solid rgba(232, 201, 135, 0.18);
  color: #e4d3ac;
}
.pnl-warn .glyph { flex: none; font-family: 'Share Tech Mono', monospace; font-weight: 700; }

.pnl-countdown {
  font-family: 'Share Tech Mono', monospace;
  font-size: 13px;
  color: var(--pnl-muted);
}
.pnl-countdown b { color: var(--pnl-accent-bright); }

/* وضعیت سفارش */
.pnl-badge--pending { color: #e8c987; background: rgba(232,201,135,0.1); }
.pnl-badge--paid    { color: var(--pnl-sage); background: rgba(143,174,134,0.1); }
.pnl-badge--expired,
.pnl-badge--cancelled { color: var(--pnl-muted-2); background: rgba(255,255,255,0.03); }

/* =========================================================================
   لاگ‌ها و دسترسی اختصاصی کاربر (پنل مدیریت)
   ========================================================================= */

.pnl-log-action {
  font-family: 'Share Tech Mono', monospace;
  font-size: 11.5px;
  color: var(--pnl-accent-bright);
}
.pnl-log-detail { color: var(--pnl-muted); font-size: 12px; }
.pnl-log-meta { font-family: 'Share Tech Mono', monospace; font-size: 11px; color: var(--pnl-muted-2); }

.pnl-filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.pnl-filters .pnl-input { flex: 1; min-width: 180px; }
.pnl-select {
  border: none;
  padding: 12px 15px;
  border-radius: 12px;
  background: var(--pnl-surface);
  color: var(--pnl-text);
  font-family: inherit;
  font-size: 14px;
  box-shadow: inset 4px 4px 9px var(--pnl-shadow-dark), inset -3px -3px 7px var(--pnl-shadow-light);
}

/* پنجره دسترسی اختصاصی کاربر */
.pnl-modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  display: grid; place-items: center;
  padding: 20px;
  z-index: 60;
}
.pnl-modal {
  width: min(520px, 100%);
  max-height: 85vh;
  overflow-y: auto;
  padding: 26px;
  background: var(--pnl-surface);
  border-radius: 18px;
  box-shadow: 10px 10px 30px rgba(0,0,0,0.7), -6px -6px 16px var(--pnl-shadow-light);
}
.pnl-modal h3 { font-family: 'Rajdhani', sans-serif; font-size: 17px; color: #fff; margin: 0 0 4px; }
.pnl-modal .who { font-size: 12.5px; color: var(--pnl-muted); margin: 0 0 18px; }

.pnl-ovr-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 12px 0; flex-wrap: wrap;
}
.pnl-ovr-row + .pnl-ovr-row { border-top: 1px solid var(--pnl-border); }
.pnl-ovr-row .name { font-family: 'Rajdhani', sans-serif; font-weight: 700; font-size: 14px; color: #fff; }
.pnl-ovr-row .hint { font-size: 11px; color: var(--pnl-muted-2); margin-top: 2px; }

.pnl-tri {
  display: flex; gap: 4px; flex: none;
  background: var(--pnl-surface);
  border-radius: 10px;
  padding: 3px;
  box-shadow: inset 3px 3px 7px var(--pnl-shadow-dark), inset -2px -2px 5px var(--pnl-shadow-light);
}
.pnl-tri button {
  border: none; background: transparent; cursor: pointer;
  font-family: 'Rajdhani', sans-serif; font-size: 11px; font-weight: 700;
  letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--pnl-muted-2); padding: 6px 11px; border-radius: 8px;
}
.pnl-tri button.is-active { background: var(--pnl-surface-2); color: var(--pnl-accent-bright); }
.pnl-tri button.is-active[data-val="false"] { color: var(--pnl-danger); }
.pnl-tri button.is-active[data-val="true"]  { color: var(--pnl-sage); }

.pnl-link-btn {
  background: none; border: none; padding: 0; cursor: pointer;
  font-family: 'Rajdhani', sans-serif; font-size: 12px; font-weight: 700;
  letter-spacing: 0.04em; color: var(--pnl-accent); text-decoration: underline;
}
.pnl-link-btn:hover { color: var(--pnl-accent-bright); }

.pnl-empty { color: var(--pnl-muted-2); font-size: 13px; padding: 26px 4px; text-align: center; }

/* =========================================================================
   لاگ روزانه — نوار انتخاب روز
   ========================================================================= */

.pnl-days {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 10px;
  margin-bottom: 16px;
  scrollbar-width: thin;
}
.pnl-days:empty { display: none; }

.pnl-day {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 9px 14px;
  border-radius: 11px;
  border: 1px solid var(--pnl-border);
  background: var(--pnl-surface);
  color: var(--pnl-muted);
  cursor: pointer;
  font-family: inherit;
  text-align: center;
  min-width: 92px;
}
.pnl-day .d { font-family: 'Share Tech Mono', monospace; font-size: 12px; }
.pnl-day .c { font-size: 10.5px; color: var(--pnl-muted-2); }
.pnl-day:hover { color: var(--pnl-text); border-color: var(--pnl-muted-2); }
.pnl-day.is-active {
  color: var(--pnl-accent-bright);
  border-color: var(--pnl-accent);
  box-shadow: inset 3px 3px 8px var(--pnl-shadow-dark), inset -2px -2px 6px var(--pnl-shadow-light);
}
.pnl-day.is-active .c { color: var(--pnl-accent); }

/* =========================================================================
   مدیریت اتوماسیون‌ها
   ========================================================================= */

.pnl-ws-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  font-size: 12.5px;
  color: var(--pnl-muted);
}
.pnl-ws-meta span { white-space: nowrap; }

/* =========================================================================
   صفحه‌ی معرفی اتوماسیون (سمت کاربر)
   ========================================================================= */

.pnl-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
  gap: 14px;
  margin-top: 6px;
}

.pnl-step {
  padding: 18px;
  border-radius: 14px;
  background: var(--pnl-surface);
  box-shadow: 5px 5px 12px var(--pnl-shadow-dark), -4px -4px 10px var(--pnl-shadow-light);
}
.pnl-step .n {
  font-family: 'Share Tech Mono', monospace;
  font-size: 11px;
  color: var(--pnl-accent);
  letter-spacing: 0.1em;
}
.pnl-step h4 {
  font-family: 'Rajdhani', sans-serif;
  font-size: 14.5px;
  font-weight: 700;
  color: #fff;
  margin: 6px 0 5px;
}
.pnl-step p { font-size: 12.5px; color: var(--pnl-muted); margin: 0; line-height: 1.7; }

.pnl-cmd-list { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.pnl-cmd {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 11px;
  flex-wrap: wrap;
}
.pnl-cmd code {
  font-family: 'Share Tech Mono', monospace;
  font-size: 13px;
  color: var(--pnl-accent-bright);
  flex: none;
}
.pnl-cmd span { font-size: 12.5px; color: var(--pnl-muted); flex: 1; min-width: 180px; }

.pnl-cta {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 20px 22px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(197,161,91,0.10), rgba(143,174,134,0.06));
  border: 1px solid rgba(197,161,91,0.22);
}
.pnl-cta .txt { flex: 1; min-width: 220px; }
.pnl-cta h3 { margin: 0 0 5px; }
.pnl-cta p { margin: 0; font-size: 12.5px; color: var(--pnl-muted); line-height: 1.7; }

@media (prefers-reduced-motion: reduce) {
  .neo-pressable, .pnl-toggle .track::before { transition: none; }
}

/* =========================================================================
   انتشار زمان‌بندی‌شده
   ========================================================================= */

.pnl-targets { display: flex; flex-direction: column; gap: 8px; }

.pnl-target {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--pnl-surface);
  box-shadow: inset 3px 3px 8px var(--pnl-shadow-dark), inset -2px -2px 6px var(--pnl-shadow-light);
  cursor: pointer;
}
.pnl-target input { width: 17px; height: 17px; accent-color: var(--pnl-accent); flex: none; cursor: pointer; }
.pnl-target input:disabled { cursor: not-allowed; }
.pnl-target .info { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.pnl-target .name { font-size: 14px; color: var(--pnl-text); }
.pnl-target .meta { font-size: 11.5px; color: var(--pnl-muted-2); }
.pnl-target:has(input:disabled) { opacity: 0.55; }

textarea.pnl-input { resize: vertical; line-height: 1.8; min-height: 120px; font-size: 14px; }

.pnl-charcount {
  font-family: 'Share Tech Mono', monospace;
  font-size: 11px;
  color: var(--pnl-muted-2);
  align-self: flex-end;
}

.pnl-post { padding: 14px 16px; border-radius: 12px; margin-bottom: 10px; }
.pnl-post .head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.pnl-post .body {
  font-size: 13px;
  color: var(--pnl-muted);
  line-height: 1.8;
  white-space: pre-wrap;
  word-break: break-word;
}
.pnl-post .err { font-size: 12px; color: var(--pnl-danger); margin-top: 8px; }

.pnl-badge--danger { color: var(--pnl-danger); background: rgba(224,133,133,0.1); }

/* خروجی اکسل سرنخ‌ها */
.pnl-export {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-radius: 14px;
  flex-wrap: wrap;
}
.pnl-export .txt { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 200px; }
.pnl-export .ttl {
  font-family: 'Rajdhani', sans-serif;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--pnl-text);
}
.pnl-export .sub { font-size: 12px; color: var(--pnl-muted); }
.pnl-export .ctl { display: flex; align-items: center; gap: 10px; flex: none; }
.pnl-export .ctl .pnl-input { width: 90px; padding: 10px 12px; font-size: 14px; text-align: center; }

/* =========================================================================
   نگهبان نشست — پیام تغییر IP / قفل حساب
   ========================================================================= */

.session-guard {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(6, 8, 5, 0.82);
  backdrop-filter: blur(6px);
}

.session-guard__box {
  width: min(440px, 100%);
  padding: 32px 28px;
  border-radius: 20px;
  text-align: center;
  background: var(--pnl-surface);
  box-shadow: 10px 10px 30px rgba(0, 0, 0, 0.7), -6px -6px 16px var(--pnl-shadow-light);
  border: 1px solid rgba(232, 201, 135, 0.16);
}

.session-guard__icon { font-size: 34px; line-height: 1; margin-bottom: 14px; }

.session-guard__box h2 {
  font-family: 'Rajdhani', sans-serif;
  font-size: 19px;
  font-weight: 700;
  color: #fff;
  margin: 0 0 10px;
}

.session-guard__box p {
  font-size: 13.5px;
  line-height: 1.9;
  color: var(--pnl-muted);
  margin: 0 0 22px;
}

.session-guard__btn {
  border: none;
  padding: 11px 26px;
  border-radius: 12px;
  background: linear-gradient(150deg, var(--pnl-accent-bright), var(--pnl-accent));
  color: #14180f;
  font-family: 'Rajdhani', sans-serif;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
}

.session-guard__count {
  display: block;
  margin-top: 14px;
  font-family: 'Share Tech Mono', monospace;
  font-size: 11.5px;
  color: var(--pnl-muted-2);
}


/* ═══════════════════════════════════════════════════════════════════════
   پشتیبانی — گفتگوی کاربر با اپراتور
   موبایل‌اول نوشته شده: پیش‌فرض یک ستون، و از ۹۰۰px به بالا دو ستون.
   ═══════════════════════════════════════════════════════════════════════ */

.tk {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: start;
}

/* روی موبایل هر بار فقط یکی از دو ستون دیده می‌شود */
.tk--pane-open .tk__list { display: none; }
.tk:not(.tk--pane-open) .tk__pane { display: none; }

.tk__list {
  background: var(--pnl-surface);
  border: 1px solid var(--pnl-border);
  border-radius: 16px;
  padding: 14px;
  box-shadow: 6px 6px 14px var(--pnl-shadow-dark), -4px -4px 10px var(--pnl-shadow-light);
}

.tk__listhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--pnl-muted);
}

.tk__new {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 8px 14px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--pnl-bg);
  background: linear-gradient(150deg, var(--pnl-accent-bright), var(--pnl-accent));
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: filter 0.2s ease, transform 0.12s ease;
}
.tk__new:hover { filter: brightness(1.08); }
.tk__new:active { transform: translateY(1px); }
.tk__new:focus-visible { outline: 2px solid var(--pnl-accent-bright); outline-offset: 2px; }

.tk__items { display: flex; flex-direction: column; gap: 8px; }

.tk__item {
  display: block;
  width: 100%;
  text-align: start;          /* منطقی، تا در راست‌چین هم درست بیفتد */
  font: inherit;
  color: var(--pnl-text);
  background: var(--pnl-surface-2);
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.tk__item:hover { border-color: rgba(197, 161, 91, 0.3); }
.tk__item:focus-visible { outline: 2px solid var(--pnl-accent); outline-offset: 2px; }
.tk__item.is-active {
  border-color: var(--pnl-accent);
  background: rgba(197, 161, 91, 0.08);
}

.tk__itemtop {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tk__itemsubject {
  font-weight: 600;
  font-size: 14px;
  /* موضوع‌های بلند نباید کارت را بترکانند */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.tk__dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--pnl-accent-bright);
  box-shadow: 0 0 6px rgba(232, 201, 135, 0.8);
}

.tk__itemmeta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 7px;
  font-size: 11px;
  color: var(--pnl-muted-2);
}

.tk__preview {
  margin-top: 7px;
  font-size: 12px;
  color: var(--pnl-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tk__empty {
  padding: 22px 6px;
  text-align: center;
  font-size: 13px;
  color: var(--pnl-muted-2);
  line-height: 1.7;
}

/* ── چیپ وضعیت ─────────────────────────────────────────────────────── */
.tk__chip {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.7;
  white-space: nowrap;
}
.tk__chip--open     { color: #e8c987; background: rgba(232, 201, 135, 0.13); }
.tk__chip--answered { color: var(--pnl-sage); background: rgba(143, 174, 134, 0.13); }
.tk__chip--closed   { color: var(--pnl-muted-2); background: rgba(255, 255, 255, 0.05); }

.tk__cat { white-space: nowrap; }
.tk__cat--staff { color: var(--pnl-accent); }
.tk__time { margin-inline-start: auto; white-space: nowrap; }

/* ── ستون گفتگو ────────────────────────────────────────────────────── */
.tk__pane {
  background: var(--pnl-surface);
  border: 1px solid var(--pnl-border);
  border-radius: 16px;
  padding: 18px;
  box-shadow: 6px 6px 14px var(--pnl-shadow-dark), -4px -4px 10px var(--pnl-shadow-light);
  min-height: 320px;
  display: flex;
  flex-direction: column;
}

.tk__placeholder {
  margin: auto;
  text-align: center;
  color: var(--pnl-muted-2);
  font-size: 13px;
  padding: 30px 10px;
}
.tk__placeholder svg {
  width: 44px;
  height: 44px;
  opacity: 0.35;
  margin-bottom: 12px;
}

.tk__back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 6px 10px;
  font: inherit;
  font-size: 13px;
  color: var(--pnl-muted);
  background: none;
  border: none;
  cursor: pointer;
  border-radius: 8px;
}
.tk__back:hover { color: var(--pnl-text); }
.tk__back:focus-visible { outline: 2px solid var(--pnl-accent); outline-offset: 2px; }
[dir="rtl"] .tk__back > span[aria-hidden="true"] { transform: scaleX(-1); display: inline-block; }

.tk__title {
  font-size: 17px;
  font-weight: 700;
  color: var(--pnl-text);
  margin: 0;
  line-height: 1.5;
  overflow-wrap: anywhere;      /* موضوع بلندِ بدون فاصله صفحه را نکشد */
}

.tk__threadhead {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex-wrap: wrap;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--pnl-border);
}
.tk__threadmeta { flex: 1 1 200px; min-width: 0; }
.tk__chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; font-size: 11px; color: var(--pnl-muted-2); }

.tk__close {
  min-height: 38px;
  padding: 8px 14px;
  font: inherit;
  font-size: 12px;
  color: var(--pnl-muted);
  background: var(--pnl-surface-2);
  border: 1px solid var(--pnl-border);
  border-radius: 9px;
  cursor: pointer;
}
.tk__close:hover { color: var(--pnl-danger); border-color: rgba(224, 133, 133, 0.4); }
.tk__close:focus-visible { outline: 2px solid var(--pnl-accent); outline-offset: 2px; }

/* ── پیام‌ها ───────────────────────────────────────────────────────── */
.tk__messages {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 2px;
  max-height: 46vh;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.tk__msg {
  max-width: 88%;
  padding: 11px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.75;
}
/* پیام کاربر سمت پایانِ خط، پیام پشتیبانی سمت آغاز — در هر دو جهت درست */
.tk__msg--user {
  margin-inline-start: auto;
  background: rgba(197, 161, 91, 0.12);
  border: 1px solid rgba(197, 161, 91, 0.22);
}
.tk__msg--staff {
  margin-inline-end: auto;
  background: var(--pnl-surface-2);
  border: 1px solid var(--pnl-border);
}

.tk__msghead {
  display: flex;
  gap: 10px;
  align-items: baseline;
  margin-bottom: 5px;
  font-size: 11px;
  color: var(--pnl-muted-2);
}
.tk__who { font-weight: 600; color: var(--pnl-muted); }

.tk__body {
  color: var(--pnl-text);
  white-space: pre-wrap;        /* خطوط پیام همان‌طور که نوشته شده بماند */
  overflow-wrap: anywhere;
}

.tk__system {
  align-self: center;
  font-size: 11px;
  color: var(--pnl-muted-2);
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
}

/* ── نوشتن ─────────────────────────────────────────────────────────── */
.tk__reply {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  padding-top: 14px;
  border-top: 1px solid var(--pnl-border);
}
.tk__reply .pnl-input { flex: 1; }
.tk__reply .pnl-btn { flex: none; }

.tk__textarea {
  resize: vertical;
  min-height: 76px;
  font: inherit;
  line-height: 1.7;
}

.tk__composefoot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.tk__count { font-size: 12px; color: var(--pnl-muted-2); }

.tk__closed {
  padding: 14px 4px 4px;
  font-size: 12px;
  color: var(--pnl-muted-2);
  text-align: center;
  line-height: 1.7;
}

/* نشان تعداد نخوانده کنار آیتم منو */
.pnl-nav .pnl-badge {
  margin-inline-start: auto;
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  color: var(--pnl-bg);
  background: var(--pnl-accent-bright);
}

/* ── دو ستونی از تبلت به بالا ──────────────────────────────────────── */
@media (min-width: 900px) {
  .tk {
    grid-template-columns: minmax(240px, 320px) 1fr;
  }
  /* در دسکتاپ هر دو ستون همیشه دیده می‌شوند. هر دو انتخابگر باید هم‌وزنِ
     قاعده‌های موبایلِ بالا باشند، وگرنه آن‌ها برنده می‌شوند و ستون گم می‌شود. */
  .tk--pane-open .tk__list { display: block; }
  .tk:not(.tk--pane-open) .tk__pane,
  .tk--pane-open .tk__pane { display: flex; }
  .tk__back { display: none; }   /* بازگشت فقط روی موبایل معنی دارد */
  .tk__messages { max-height: 52vh; }
}

@media (max-width: 480px) {
  .tk__pane { padding: 14px; }
  .tk__msg { max-width: 96%; }
  .tk__reply { flex-direction: column; align-items: stretch; }
  .tk__reply .pnl-btn { width: 100%; }
  .tk__messages { max-height: none; }
}

@media (prefers-reduced-motion: reduce) {
  .tk__item, .tk__new { transition: none; }
}

/* ── ظرف گفتگو ─────────────────────────────────────────────────────── */
/* دقت: .tk__compose و .tk__thread هر دو با صفت hidden پنهان می‌شوند. یک
   قاعده‌ی display روی همان عنصر، صفت hidden را بی‌اثر می‌کند (چون هر دو
   با تخصیص برابر می‌جنگند و قاعده‌ی دیرتر برنده می‌شود) — یعنی فرم و
   گفتگو هم‌زمان دیده می‌شدند. :not([hidden]) این را قطعی می‌کند. */
.tk__thread:not([hidden]) {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}
.tk__compose:not([hidden]) { display: flex; flex-direction: column; }
.tk__thread[hidden],
.tk__compose[hidden],
.tk__placeholder[hidden],
.tk__empty[hidden],
.tk__closed[hidden],
.tk__reply[hidden],
.pnl-badge[hidden] { display: none; }

/* ── صف پشتیبانی در پنل ادمین ──────────────────────────────────────── */
.tk-admin__bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.tk-admin__bar .pnl-input { flex: 1 1 170px; min-width: 0; }
.tk-admin__bar .pnl-btn { flex: 0 0 auto; }

.tk-admin__who {
  margin-top: 6px;
  font-size: 12px;
  color: var(--pnl-muted);
  overflow-wrap: anywhere;
}

.tk-admin__controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px 0;
  border-bottom: 1px solid var(--pnl-border);
}
.tk-admin__ctl {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1 1 130px;
  min-width: 0;
  font-size: 11px;
  color: var(--pnl-muted-2);
}
.tk-admin__ctl .pnl-input { padding: 8px 10px; font-size: 13px; }

.tk-admin__reply {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--pnl-border);
}
.tk-admin__replyfoot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.tk-admin__closeafter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--pnl-muted);
  cursor: pointer;
}
.tk-admin__closeafter input { width: 16px; height: 16px; accent-color: var(--pnl-accent); }

.tk-admin__results { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.tk-admin__result {
  text-align: start;
  font: inherit;
  font-size: 12px;
  color: var(--pnl-text);
  background: var(--pnl-surface-2);
  border: 1px solid var(--pnl-border);
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tk-admin__result:hover { border-color: var(--pnl-accent); }
.tk-admin__result:focus-visible { outline: 2px solid var(--pnl-accent); outline-offset: 2px; }

/* اولویت — فقط وقتی از حالت عادی خارج شده نشان داده می‌شود */
.tk__chip--prio-low    { color: var(--pnl-muted-2); background: rgba(255,255,255,0.05); }
.tk__chip--prio-high   { color: #e8c987; background: rgba(232,201,135,0.14); }
.tk__chip--prio-urgent { color: var(--pnl-danger); background: rgba(224,133,133,0.15); }

@media (max-width: 480px) {
  .tk-admin__bar .pnl-btn { width: 100%; }
  .tk-admin__ctl { flex: 1 1 100%; }
}

/* هدف لمسی در پنل و ادمین — همان دلیل main.css */
@media (pointer: coarse) {
  .pnl-nav > button,
  .pnl-nav-link > button,
  .pnl-logout,
  .tk__back,
  .tk__new,
  .tk__close,
  .tk-admin__result {
    min-height: 44px;
  }
  .pnl-nav > button,
  .pnl-nav-link > button {
    min-width: 44px;
  }
}
