/* داشبورد پیوند — چیدمان ساده‌ی سرمقاله‌ای، بدون کارت‌های تکراری */

.dash { display: grid; grid-template-columns: 232px 1fr; min-height: 100svh; }
@media (max-width: 920px) { .dash { grid-template-columns: 1fr; } }

.dash-nav { border-inline-end: 1px solid var(--line); padding: 26px 18px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; align-self: start; height: 100svh; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line) transparent; overscroll-behavior: contain; }
.dash-nav::-webkit-scrollbar { width: 6px; }
.dash-nav::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }
.dash-nav::-webkit-scrollbar-track { background: transparent; }
@media (max-width: 920px) {
  .dash-nav {
    position: sticky; top: 0; z-index: 40; height: auto;
    flex-direction: row; overflow-x: auto;
    background: color-mix(in srgb, var(--paper) 92%, transparent);
    backdrop-filter: blur(6px);
    border-inline-end: 0;
    border-block-end: 1px solid var(--line);
    padding: 10px 14px;
    gap: 6px;
    -webkit-overflow-scrolling: touch;
  }
}
.dash-nav .nav-label { font-size: 11.5px; color: var(--ink-3); padding: 10px 12px; }
@media (max-width: 920px) { .dash-nav .nav-label, .dash-nav .nav-divider { display: none; } }
.dash-nav .nav-divider { border-block-start: 1px solid var(--line); margin: 12px 4px; }
.dash-nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 9.5px 12px;
  border-radius: var(--radius-s);
  font-size: 14.5px;
  color: var(--ink-2);
  border: 1px solid transparent;
  white-space: nowrap;
  transition: color var(--speed), background-color var(--speed), border-color var(--speed);
}
.dash-nav a .icon { width: 1.15em; height: 1.15em; }
.dash-nav a:hover { color: var(--ink); background: var(--paper-2); }
.dash-nav a.active { color: var(--ink); font-weight: 700; background: var(--paper-2); border-color: var(--line); }
.dash-nav a.active .icon { color: var(--accent); }
.dash-nav form { margin-block-start: auto; }
@media (max-width: 920px) { .dash-nav form { margin: 0; } }
.dash-nav button.nav-logout {
  display: flex; align-items: center; gap: 11px; width: 100%;
  background: none; border: 1px solid transparent; border-radius: var(--radius-s);
  padding: 9.5px 12px; font-size: 14.5px; color: var(--ink-2); cursor: pointer;
  transition: color var(--speed), background-color var(--speed);
}
.dash-nav button.nav-logout:hover { color: var(--accent-strong); background: var(--accent-tint); }

.dash-main { padding: clamp(22px, 4vw, 52px); max-width: 980px; width: 100%; }
.dash-head { display: flex; justify-content: space-between; align-items: end; gap: 18px; flex-wrap: wrap; margin-block-end: clamp(24px, 3vw, 40px); }
.dash-head h1 { font-size: clamp(22px, 3vw, 28px); font-weight: 700; }
.dash-head .sub { font-size: 14px; color: var(--ink-2); margin-block-start: 4px; }

/* نوار لینک عمومی کاربر */
.page-url-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  border: 1px solid var(--line); border-radius: var(--radius-s);
  padding: 12px 16px;
  margin-block-end: 30px;
  background: var(--paper-2);
}
.page-url-bar code { direction: ltr; unicode-bidi: isolate; font-family: ui-monospace, 'Courier New', monospace; font-size: 14px; color: var(--sage-strong); }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: var(--radius-s);
  border: 1px solid var(--line); background: var(--paper); cursor: pointer;
  color: var(--ink-2);
  transition: color var(--speed), border-color var(--speed), background-color var(--speed);
}
.icon-btn:hover { color: var(--ink); border-color: var(--ink); }
.icon-btn.danger:hover { color: var(--accent-strong); border-color: var(--accent); }

/* بخش‌های داشبورد: سطرهای با خط مو */
.dash-section { border-block-start: 1px solid var(--line); padding-block-start: 26px; margin-block-end: 40px; }
.dash-section > .section-title { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 700; margin-block-end: 18px; }
.dash-section > .section-title .icon { color: var(--accent); }
.dash-section > .section-title .count { font-size: 12.5px; color: var(--ink-3); font-weight: 400; }

/* ---------- مدیریت لینک‌ها ---------- */
.link-list { display: grid; gap: 10px; }
.link-row {
  display: grid;
  grid-template-columns: 30px 40px 1fr auto auto;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  background: var(--paper);
  padding: 10px 12px;
  transition: border-color var(--speed), opacity var(--speed);
}
.link-row:hover { border-color: var(--ink-3); }
.link-row.drag-src { opacity: .4; border-style: dashed; }
.link-row.dragging-over { border-color: var(--accent); }
.drag-handle { cursor: grab; touch-action: none; color: var(--ink-3); display: grid; place-items: center; padding: 8px 4px; border-radius: 4px; }
.drag-handle:active { cursor: grabbing; }
.drag-handle:hover { color: var(--ink); background: var(--paper-2); }
.link-icon-box {
  width: 38px; height: 38px; border: 1px solid var(--line); border-radius: var(--radius-s);
  display: grid; place-items: center; color: var(--sage-strong);
}
.link-row .titles { min-width: 0; }
.link-row .titles b { display: block; font-weight: 500; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.link-row .titles span { display: block; direction: ltr; unicode-bidi: isolate; text-align: end; font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: ui-monospace, 'Courier New', monospace; }
.link-row .row-actions { display: flex; gap: 6px; align-items: center; }
.link-row .row-move { display: flex; flex-direction: column; gap: 2px; }
.link-row .row-move button { border: 1px solid transparent; background: none; color: var(--ink-3); cursor: pointer; border-radius: 4px; padding: 2px; }
.link-row .row-move button:hover { color: var(--ink); background: var(--paper-2); }
.switch { position: relative; display: inline-flex; align-items: center; width: 40px; height: 22px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; cursor: pointer; margin: 0; }
.switch .track { position: absolute; inset: 0; border: 1px solid var(--line); border-radius: 999px; background: var(--paper-2); transition: background-color var(--speed), border-color var(--speed); }
.switch .track::after {
  content: ''; position: absolute; inset-block-start: 2.5px; inset-inline-start: 3px;
  width: 15px; height: 15px; border-radius: 50%; background: var(--ink-2);
  transition: transform var(--speed), background-color var(--speed);
}
.switch input:checked + .track { background: var(--sage); border-color: var(--sage); }
.switch input:checked + .track::after { transform: translateX(-18px); background: #FFF8F2; }
.switch input:focus-visible + .track { box-shadow: var(--focus); }

.link-form { display: grid; grid-template-columns: 1.2fr 1.6fr auto auto; gap: 10px; align-items: start; }
.link-form .field { min-width: 0; }
@media (max-width: 760px) { .link-form { grid-template-columns: 1fr; } }
.link-form-edit { border: 1px solid var(--accent); border-radius: var(--radius-s); padding: 14px; background: color-mix(in srgb, var(--accent-tint) 40%, var(--paper)); }

/* ---------- آمار ---------- */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-block-end: 30px; }
.stat {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px;
  border-inline-start: 3px solid var(--sage);
  background: var(--paper);
}
.stat.accent { border-inline-start-color: var(--accent); }
.stat .num { font-size: clamp(24px, 3vw, 32px); font-weight: 700; line-height: 1.3; }
.stat .lbl { font-size: 13px; color: var(--ink-2); }
.chart-wrap { border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(14px, 2vw, 24px); background: var(--paper); margin-block-end: 30px; }
.chart { width: 100%; height: auto; }
.chart .grid { stroke: var(--line); }
.chart .tick { fill: var(--ink-3); font-size: 11px; font-family: var(--font); }
.chart .bar-views { fill: var(--sage); }
.chart .line-clicks { stroke: var(--accent); stroke-linecap: round; stroke-linejoin: round; }
.chart .dot-clicks { fill: var(--paper); stroke: var(--accent); stroke-width: 2; }
.chart .bar-views:hover { fill: var(--sage-strong); }
.mini-bar-bg { fill: var(--paper-2); }
.mini-bar-fg { fill: var(--accent); }
.per-link-table { display: grid; gap: 12px; }
.per-link-table .plr { display: grid; grid-template-columns: 1fr 84px 150px; gap: 14px; align-items: center; padding-block: 4px; }
.per-link-table .plr b { font-weight: 500; font-size: 14.5px; }
.per-link-table .plr .n { text-align: end; color: var(--ink-2); font-size: 14px; }
@media (max-width: 640px) { .per-link-table .plr { grid-template-columns: 1fr 60px; } .per-link-table .plr .bar-cell { display: none; } }

/* ---------- تم و ظاهر ---------- */
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.theme-option { position: relative; display: block; }
.theme-option input { position: absolute; opacity: 0; pointer-events: none; }
.theme-option .to-card {
  display: block; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px; background: var(--paper); cursor: pointer; height: 100%;
  transition: border-color var(--speed), background-color var(--speed);
}
.theme-option input:checked + .to-card { border-color: var(--accent); background: color-mix(in srgb, var(--accent-tint) 45%, var(--paper)); }
.theme-option input:focus-visible + .to-card { box-shadow: var(--focus); }
.theme-option input:disabled + .to-card { opacity: .55; cursor: not-allowed; }
.theme-option .to-name { display: flex; justify-content: space-between; align-items: center; font-size: 13.5px; font-weight: 500; margin-block-start: 10px; }
.theme-option .to-desc { font-size: 12px; color: var(--ink-3); line-height: 1.7; margin-block-start: 3px; }
.thumb { height: 92px; border: 1px solid var(--line); border-radius: 6px; position: relative; overflow: hidden; }
.t-classic .thumb, .thumb.t-classic { display: grid; place-items: center; gap: 0; }
.appearance-layout { display: grid; grid-template-columns: 380px 1fr; gap: clamp(22px, 3vw, 44px); align-items: start; }
@media (max-width: 980px) { .appearance-layout { grid-template-columns: 1fr; } }
.preview-frame { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--paper-2); position: sticky; top: 18px; }
.preview-frame iframe { display: block; width: 100%; height: 640px; border: 0; background: var(--paper); }
.preview-bar { display: flex; justify-content: space-between; align-items: center; padding: 9px 14px; font-size: 12.5px; color: var(--ink-2); border-block-end: 1px solid var(--line); }

/* ---------- سفارش‌ها و کارت ---------- */
.orders-list { display: grid; gap: 12px; }
.order-row { display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: center; border: 1px solid var(--line); border-radius: var(--radius-s); padding: 14px 16px; transition: border-color var(--speed); }
.order-row:hover { border-color: var(--ink-3); }
.order-row .o-title { font-weight: 500; }
.order-row .o-meta { font-size: 12.5px; color: var(--ink-2); margin-block-start: 2px; }
.status-badge { font-size: 12px; padding: 3px 10px; border-radius: 999px; border: 1px solid; white-space: nowrap; }
.status-pending { color: var(--ink-2); border-color: var(--line); background: var(--paper-2); }
.status-paid, .status-delivered { color: var(--sage-strong); border-color: var(--sage); background: var(--sage-tint); }
.status-printed { color: var(--accent-strong); border-color: var(--accent); background: var(--accent-tint); }
.status-shipped { color: var(--accent-strong); border-color: var(--accent); background: var(--paper); }

.timeline { display: grid; gap: 0; margin-block: 30px; }
.timeline .step { display: grid; grid-template-columns: 30px 1fr; gap: 14px; }
.timeline .step .rail { display: grid; justify-items: center; }
.timeline .step .dot { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--line); background: var(--paper); z-index: 1; }
.timeline .step .rail::after { content: ''; width: 1.5px; flex: 1; background: var(--line); }
.timeline .step:last-child .rail::after { display: none; }
.timeline .step.done .dot { background: var(--sage); border-color: var(--sage); }
.timeline .step.current .dot { background: var(--accent); border-color: var(--accent); }
.timeline .step.current .rail::after { background: repeating-linear-gradient(180deg, var(--line) 0 4px, transparent 4px 8px); }
.timeline .step .st-body { padding-block-end: 22px; }
.timeline .step .st-label { font-weight: 500; font-size: 15px; }
.timeline .step:not(.done):not(.current) .st-label { color: var(--ink-3); }
.timeline .step .st-date { font-size: 12.5px; color: var(--ink-2); }

/* ---------- صورتحساب ---------- */
.invoice-table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.invoice-table th { text-align: start; font-size: 12.5px; font-weight: 500; color: var(--ink-3); border-block-end: 1px solid var(--line); padding-block: 10px; padding-inline: 8px; }
.invoice-table td { border-block-end: 1px solid var(--line); padding: 13px 8px; vertical-align: top; }
.invoice-table .num { direction: ltr; unicode-bidi: isolate; }

.barload {
  /* علامت بارگذاری سبک */
}

/* بندانگشتی تم‌ها در داشبورد */
.thumb { background: var(--paper); }
.theme-thumb { display: block; height: 92px; }
.theme-thumb::before, .theme-thumb::after { content: ''; position: absolute; inset-inline: 12px; }
.theme-thumb-classic::before { inset-block: 10px 14px; display: grid; }
.theme-thumb-classic { background:
  radial-gradient(circle at 50% 26%, var(--ink) 0 9px, transparent 10px),
  linear-gradient(transparent 38%, var(--ink) 38% 42%, transparent 43%),
  linear-gradient(transparent 52%, var(--ink) 52% 56%, transparent 57%),
  linear-gradient(transparent 66%, var(--ink) 66% 70%, transparent 71%);
  background-size: 60% 100%, 70% 100%, 70% 100%, 70% 100%;
  background-position: center, center, center, center;
  background-repeat: no-repeat; }
.theme-thumb-editorial { background:
  linear-gradient(var(--ink), var(--ink)) 12% 16% / 55% 3px no-repeat,
  linear-gradient(var(--line), var(--line)) 12% 30% / 38% 2px no-repeat,
  linear-gradient(var(--accent), var(--accent)) 12% 44% / 70% 2px no-repeat,
  linear-gradient(var(--line), var(--line)) 12% 60% / 62% 2px no-repeat,
  linear-gradient(var(--line), var(--line)) 12% 74% / 45% 2px no-repeat; }
.theme-thumb-minimal { background:
  radial-gradient(circle at 50% 22%, var(--ink-3) 0 5px, transparent 6px),
  linear-gradient(var(--line), var(--line)) 20% 42% / 60% 1px no-repeat,
  linear-gradient(var(--line), var(--line)) 20% 56% / 60% 1px no-repeat,
  linear-gradient(var(--line), var(--line)) 20% 70% / 60% 1px no-repeat; }
.theme-thumb-side { background:
  linear-gradient(90deg, transparent 0 40%, var(--line) 40% 41%, transparent 41%),
  radial-gradient(circle at 18% 24%, var(--ink) 0 8px, transparent 9px),
  linear-gradient(var(--ink-3), var(--ink-3)) 10% 44% / 22% 2px,
  linear-gradient(var(--ink-3), var(--ink-3)) 10% 54% / 22% 2px,
  linear-gradient(var(--ink), var(--ink)) 52% 24% / 34% 8px,
  linear-gradient(var(--ink), var(--ink)) 52% 40% / 34% 8px,
  linear-gradient(var(--ink), var(--ink)) 52% 56% / 34% 8px;
  background-repeat: no-repeat; }
.theme-thumb-grid { background:
  linear-gradient(var(--ink), var(--ink)) 12% 20% / 34% 22%,
  linear-gradient(var(--ink), var(--ink)) 56% 20% / 34% 22%,
  linear-gradient(var(--ink), var(--ink)) 12% 52% / 34% 22%,
  linear-gradient(var(--accent), var(--accent)) 56% 52% / 34% 22%;
  background-repeat: no-repeat; }
.theme-thumb-ink { background: #161616; position: relative; }
.theme-thumb-ink::after { content: ''; position: absolute; inset-inline: 12px; inset-block: 16px;
  background:
  linear-gradient(#EDE7DC, #EDE7DC) 0 0 / 100% 2px,
  linear-gradient(#EDE7DC, #EDE7DC) 0 12px / 100% 2px,
  linear-gradient(#EDE7DC, #EDE7DC) 0 24px / 100% 2px,
  linear-gradient(#E4572E, #E4572E) 0 36px / 45% 3px;
  background-repeat: no-repeat; }
.theme-thumb-card { background:
  linear-gradient(#E4572E, #E4572E) 0 0 / 100% 42%,
  linear-gradient(#FFF8F2, #FFF8F2) 50% 34% / 62% 14px,
  linear-gradient(var(--ink), var(--ink)) 12% 56% / 60% 3px,
  linear-gradient(var(--ink), var(--ink)) 12% 66% / 60% 3px,
  linear-gradient(var(--ink), var(--ink)) 12% 76% / 60% 3px;
  background-repeat: no-repeat; }
.theme-thumb-frame { background: transparent; border: 1px solid var(--ink); margin: 8px; height: 76px; width: calc(100% - 16px); }
.theme-thumb-frame::after { content: ''; position: absolute; inset-inline: 10px; inset-block: 10px;
  background:
  linear-gradient(var(--accent), var(--accent)) 0 4px / 10px 10px,
  linear-gradient(var(--ink), var(--ink) ) 0 26px / 55% 3px,
  linear-gradient(var(--ink-3), var(--ink-3)) 0 38px / 40% 2px;
  background-repeat: no-repeat; }

/* علامت قفل روی تم‌های حرفه‌ای برای کاربران رایگان */
.theme-option input:disabled + .to-card .thumb { position: relative; }
.theme-option input:disabled + .to-card .thumb::before {
  content: 'مخصوص طرح حرفه‌ای';
  position: absolute; inset: 0; z-index: 2;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--paper) 55%, transparent);
  font-size: 10px; color: var(--accent-strong); font-weight: 500;
}

/* ---------- بارگذاری HTMX ---------- */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: inline-flex; }

/* ---------- ظاهر صفحه (v2) ---------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 760px) { .grid-2 { grid-template-columns: 1fr; } }
.check-row { display: flex; gap: 10px; align-items: center; cursor: pointer; }
.check-row input { width: 17px; height: 17px; accent-color: var(--accent); }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px;
  background: var(--paper); font-size: .84rem;
}
.chip .icon { width: 15px; height: 15px; }
.chip-form { display: inline-flex; align-items: center; gap: 6px; }
.tag-sage { background: var(--sage-tint); color: var(--sage-strong); border-color: var(--sage); }
.tag-warn { background: #F8E8D8; color: #9A5B21; border-color: #E0A668; }
.input { border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; font: inherit; background: var(--paper); }
.input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.dash-head { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-block-end: 22px; }
.dash-head h1 { margin: 0; font-size: 1.35rem; }
.dash-sub { margin: 6px 0 0; color: var(--ink-2); font-size: .92rem; }

/* ---------- انتخابگر آیکون (فرم لینک) ---------- */
.icon-picker {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(74px, 1fr));
  gap: 8px; padding: 10px;
  border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--paper-2);
}
.ip-option { display: grid; gap: 5px; justify-items: center; cursor: pointer; }
.ip-option input { position: absolute; opacity: 0; pointer-events: none; }
.ip-box {
  width: 100%; aspect-ratio: 1; display: grid; place-items: center;
  border: 1.5px solid var(--line); border-radius: 9px; background: var(--paper);
  color: var(--ink-2); transition: border-color var(--speed), color var(--speed), background-color var(--speed);
}
.ip-box .icon { width: 20px; height: 20px; }
.ip-box img { width: 24px; height: 24px; object-fit: contain; }
.ip-name {
  font-size: 10.5px; color: var(--ink-3); max-width: 100%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ip-option input:checked + .ip-box { border-color: var(--accent); color: var(--accent-strong); background: var(--accent-tint); }
.ip-option input:focus-visible + .ip-box { box-shadow: var(--focus); }
.ip-option:hover .ip-box { border-color: var(--ink-3); }

/* ---------- مارکت آیکون‌ها ---------- */
.icon-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 12px;
}
.icon-tile {
  position: relative; border: 1px solid var(--line); border-radius: var(--radius-s);
  background: var(--paper); padding: 14px 8px 10px;
  display: grid; gap: 8px; justify-items: center;
}
.icon-tile-box {
  width: 46px; height: 46px; border-radius: 10px; display: grid; place-items: center;
  background: var(--paper-2); color: var(--sage-strong);
}
.icon-tile-box .icon { width: 22px; height: 22px; }
.icon-tile-box img { width: 34px; height: 34px; object-fit: contain; }
.icon-tile-name {
  font-size: 11px; color: var(--ink-2); max-width: 100%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center;
}
.icon-tile .icon-del { position: absolute; inset-block-start: 6px; inset-inline-start: 6px; }
.icon-tile .icon-del .icon-btn { width: 26px; height: 26px; }
.icon-form { align-items: end; }

/* ---------- جدول‌های اسکرول‌پذیر ---------- */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ---------- موبایل ---------- */
@media (max-width: 920px) {
  .dash-nav a { font-size: 13.5px; padding: 8px 10px; gap: 7px; }
  .dash-nav a .icon { width: 1.05em; height: 1.05em; }
  .dash-nav { gap: 4px; }
}
@media (max-width: 700px) {
  .dash-main { padding: 18px 14px 40px; }
  .dash-head { align-items: start; flex-direction: column; }
  .link-row {
    grid-template-columns: 26px 36px 1fr;
    grid-template-rows: auto auto;
    row-gap: 10px; align-items: center;
  }
  .link-row .drag-handle { grid-row: 1 / span 2; }
  .link-row .link-icon-box { grid-row: 1 / span 2; width: 36px; height: 36px; }
  .link-row .row-actions { grid-column: 3; justify-content: flex-start; flex-wrap: wrap; }
  .link-row .row-move { order: 2; }
  .icon-picker { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); }
  .stat-row { grid-template-columns: 1fr 1fr; }
  .preview-frame iframe { height: 520px; }
  .preview-frame { position: static; }
}
@media (max-width: 430px) {
  .stat-row { grid-template-columns: 1fr; }
  .cluster.icon-form { flex-direction: column; align-items: stretch; }
  .cluster.icon-form .field { min-width: 0 !important; }
}

/* جلوگیری از زوم خودکار iOS روی فیلدها */
@media (pointer: coarse) {
  .input, .field :is(input, textarea, select) { font-size: 16px; }
}

/* ---------- بازخورد (v5) ---------- */
.feedback-form { max-width: 640px; }
.feedback-form .label { font-size: 13.5px; font-weight: 500; color: var(--ink-2); }

/* انتخابگر ستاره: ورودی‌ها نامرئی‌اند ولی با صفحه‌کلید قابل دسترس‌اند.
   چیدمان راست‌به‌چپ (ستارهٔ ۱ سمت راست) مطابق جهت خواندن فارسی. */
.star-picker { display: inline-flex; gap: 4px; }
.star-picker input {
  position: absolute; width: 1px; height: 1px; opacity: 0;
  margin: 0; pointer-events: none;
}
.star-picker label {
  cursor: pointer; font-size: 30px; line-height: 1;
  color: var(--line-strong); user-select: none;
  transition: color .14s, transform .14s;
}
.star-picker label:hover { transform: scale(1.18); }
.star-picker label:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.star-picker input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
/* ستاره‌های انتخاب‌شده (از data-value که جاوااسکریپت می‌گذارد) */
.star-picker[data-value] label { color: var(--line-strong); }
.star-picker[data-value="1"] label[data-star="1"],
.star-picker[data-value="2"] label[data-star="1"], .star-picker[data-value="2"] label[data-star="2"],
.star-picker[data-value="3"] label[data-star="1"], .star-picker[data-value="3"] label[data-star="2"],
.star-picker[data-value="3"] label[data-star="3"],
.star-picker[data-value="4"] label[data-star="1"], .star-picker[data-value="4"] label[data-star="2"],
.star-picker[data-value="4"] label[data-star="3"], .star-picker[data-value="4"] label[data-star="4"],
.star-picker[data-value="5"] label { color: #E0A668; }

/* فهرست بازخوردهای خودِ کاربر */
.feedback-list { display: grid; gap: 12px; max-width: 720px; }
.feedback-item {
  border: 1px solid var(--line); border-radius: var(--radius-s);
  background: var(--paper); padding: 14px 16px;
}
.feedback-item .fb-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-block-end: 8px; }
.fb-stars { color: #E0A668; letter-spacing: 2px; font-size: 15px; }
.fb-stars .off { color: var(--line-strong); }
.fb-date { font-size: 12px; color: var(--ink-3); }
.fb-message { margin: 0; white-space: pre-line; line-height: 1.9; }

/* ============================================================
   v7 — آواتار گرد، دکمهٔ انتخاب فایل، انتخابگر آیکون مُدالی، سقف لینک
   ============================================================ */

/* ---------- آواتار (همیشه مربعِ ذخیره‌شده، اینجا دایره دیده می‌شود) ---------- */
.p-avatar {
  display: inline-grid; place-items: center;
  width: 76px; height: 76px; flex: none;
  border-radius: 50%; overflow: hidden;
  border: 1px solid var(--line-strong);
  background: var(--sage-tint); color: var(--sage-strong);
  font-size: 26px; font-weight: 700;
}
.p-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------- دکمهٔ انتخاب فایل ---------- */
.file-btn { position: relative; display: inline-flex; max-width: 100%; }
.file-btn input[type="file"] {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; cursor: pointer; margin: 0;
}
.file-btn input[type="file"]:focus-visible + .file-btn-label { box-shadow: var(--focus); }
.file-btn input[type="file"]:disabled { cursor: not-allowed; }
.file-btn-label {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 10px 18px; border-radius: var(--radius-s);
  border: 1.5px dashed var(--ink-3);
  background: var(--paper-2); color: var(--ink);
  font-size: 14px; font-weight: 500; cursor: pointer; user-select: none;
  transition: border-color var(--speed), background-color var(--speed), transform var(--speed);
}
.file-btn-label .icon { width: 17px; height: 17px; color: var(--accent-strong); flex: none; }
.file-btn:hover .file-btn-label { border-color: var(--accent); background: var(--accent-tint); }
.file-btn:hover .file-btn-label .icon { transform: translateY(-2px); }
.file-btn.filled .file-btn-label { border-style: solid; border-color: var(--sage); background: var(--sage-tint); }
.file-btn .file-name {
  display: inline-block; max-width: 200px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  direction: ltr; unicode-bidi: isolate;
  font-size: 12.5px; color: var(--ink-2); font-weight: 400;
}
.file-btn .file-size { font-size: 11.5px; color: var(--ink-3); font-weight: 400; }
.file-btn.is-disabled .file-btn-label { opacity: .5; }

/* ---------- انتخابگر آیکون: دکمهٔ فشرده + مُدال ---------- */
button.icon-pick {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; width: 100%;
  text-align: start; font: inherit;
  border: 1px solid var(--line); border-radius: var(--radius-s);
  background: var(--paper-2); padding: 10px 12px; cursor: pointer;
  transition: border-color var(--speed), background-color var(--speed), box-shadow var(--speed);
}
button.icon-pick:hover { border-color: var(--ink-3); background: var(--paper); }
button.icon-pick:focus-visible { box-shadow: var(--focus); outline: none; }
.icon-pick-cta {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--line-strong); border-radius: 999px;
  padding: 7px 14px; font-size: 13px; color: var(--ink); background: var(--paper);
  white-space: nowrap;
}
.icon-pick-cta .icon { width: 15px; height: 15px; color: var(--accent-strong); }
.icon-pick-current {
  width: 44px; height: 44px; flex: none;
  display: grid; place-items: center;
  border: 1.5px solid var(--line); border-radius: 10px;
  background: var(--paper); color: var(--ink-2);
}
.icon-pick-current .icon { width: 21px; height: 21px; }
.icon-pick-current img { width: 26px; height: 26px; object-fit: contain; }
.icon-pick-info { flex: 1; min-width: 140px; }
.icon-pick-info b { display: block; font-size: 13.5px; font-weight: 600; }
.icon-pick-info span { display: block; font-size: 12px; color: var(--ink-3); margin-block-start: 2px; }
.icon-pick-note {
  font-size: 11.5px; color: var(--ink-3);
  border-inline-start: 2px solid var(--line-strong); padding-inline-start: 10px;
}

/* مُدال عمومی داشبورد (المان dialog بومی) */
dialog.pv-modal {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--paper); color: var(--ink);
  padding: 0; max-width: 640px; width: min(94vw, 640px);
  max-height: min(84svh, 760px);
  box-shadow: 0 30px 80px #1616163d;
}
dialog.pv-modal::backdrop { background: #16161666; backdrop-filter: blur(3px); }
.pv-modal-head {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px; border-block-end: 1px solid var(--line);
  position: sticky; inset-block-start: 0; background: var(--paper); z-index: 2;
}
.pv-modal-head h2 { font-size: 16px; font-weight: 700; margin: 0; flex: 1; }
.pv-modal-head .icon { color: var(--accent); }
.pv-modal-body { padding: 18px 20px 22px; overflow-y: auto; max-height: calc(84svh - 70px); }
.pv-modal-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-block-end: 16px; }
.pv-tab {
  border: 1px solid var(--line); background: var(--paper); color: var(--ink-2);
  border-radius: 999px; padding: 7px 15px; font-size: 13px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px;
  transition: color var(--speed), border-color var(--speed), background-color var(--speed);
}
.pv-tab .icon { width: 15px; height: 15px; }
.pv-tab:hover { color: var(--ink); border-color: var(--ink-3); }
.pv-tab[aria-selected="true"] { color: var(--paper); background: var(--ink); border-color: var(--ink); }
.pv-panel[hidden] { display: none; }

/* جست‌وجوی آیکون */
.pv-search { margin-block-end: 14px; width: 100%; }

/* شبکهٔ آیکون‌ها داخل مُدال */
.pv-icon-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 8px;
}
.pv-icon-opt { position: relative; }
.pv-icon-opt input { position: absolute; opacity: 0; pointer-events: none; }
.pv-icon-opt .pv-box {
  aspect-ratio: 1; display: grid; place-items: center; gap: 0;
  border: 1.5px solid var(--line); border-radius: 10px; background: var(--paper);
  cursor: pointer; color: var(--ink-2);
  transition: border-color var(--speed), color var(--speed), background-color var(--speed), transform var(--speed);
}
.pv-icon-opt .pv-box .icon { width: 22px; height: 22px; }
.pv-icon-opt .pv-box img { width: 28px; height: 28px; object-fit: contain; }
.pv-icon-opt:hover .pv-box { border-color: var(--ink-3); transform: translateY(-2px); }
.pv-icon-opt input:checked + .pv-box { border-color: var(--accent); color: var(--accent-strong); background: var(--accent-tint); }
.pv-icon-opt input:focus-visible + .pv-box { box-shadow: var(--focus); }
.pv-icon-opt .pv-name {
  display: block; text-align: center; font-size: 10.5px; color: var(--ink-3);
  margin-block-start: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pv-icon-opt.is-hidden { display: none; }
.pv-icon-opt.pv-icon-mine > label { display: grid; gap: 4px; }
.pv-icon-opt .pv-del {
  position: absolute; inset-block-start: -6px; inset-inline-start: -6px; z-index: 1;
  width: 22px; height: 22px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--paper);
  display: grid; place-items: center; cursor: pointer; color: var(--ink-3);
}
.pv-icon-opt .pv-del:hover { color: var(--accent-strong); border-color: var(--accent); }
.pv-icon-opt .pv-del .icon { width: 11px; height: 11px; }
.pv-empty { padding: 26px 10px; text-align: center; color: var(--ink-3); font-size: 13.5px; }

/* ---------- سقف لینک طرح رایگان ---------- */
.limit-meter {
  display: grid; gap: 7px;
  border: 1px solid var(--line); border-radius: var(--radius-s);
  background: var(--paper-2); padding: 13px 16px;
  margin-block-end: 22px;
}
.limit-meter .lm-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.limit-meter .lm-label { font-size: 13.5px; font-weight: 500; }
.limit-meter .lm-count { font-size: 13px; color: var(--ink-2); }
.limit-meter .lm-count b { font-size: 16px; color: var(--ink); font-weight: 700; }
.limit-meter .lm-bar { height: 6px; border-radius: 999px; background: var(--paper); border: 1px solid var(--line); overflow: hidden; }
.limit-meter .lm-bar i { display: block; height: 100%; border-radius: inherit; background: var(--sage); transition: width .4s var(--ease, ease); }
.limit-meter.at-limit .lm-bar i { background: var(--accent); }
.limit-meter .lm-hint { font-size: 12px; color: var(--ink-3); }
.limit-meter .lm-hint a { color: var(--accent-strong); font-weight: 500; }

/* ---------- کارت طرح (تم مارکت) ---------- */
.mkt-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-block-end: 24px; }
.mkt-filter { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; background: var(--paper); flex-wrap: wrap; }
.mkt-filter a {
  padding: 7px 16px; border-radius: 999px; font-size: 13.5px; color: var(--ink-2);
  text-decoration: none; white-space: nowrap;
  transition: color var(--speed), background-color var(--speed);
}
.mkt-filter a:hover { color: var(--ink); }
.mkt-filter a[aria-current="page"] { color: var(--paper); background: var(--ink); font-weight: 500; }
.mkt-count { font-size: 13px; color: var(--ink-3); margin-inline-start: auto; }

/* مالک تم روی کارت */
.mkt-author { font-size: 11.5px; color: var(--ink-3); }

/* ---------- مارکت تم‌ها (v7) ---------- */
.mk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(252px, 1fr)); gap: 18px; }
.mk-card { border: 1px solid var(--line); border-radius: 16px; background: var(--paper); overflow: hidden; display: grid; grid-template-rows: auto 1fr; transition: border-color var(--speed), box-shadow var(--speed), transform var(--speed); }
.mk-card:hover { border-color: var(--ink-3); box-shadow: 0 14px 34px #16161617; transform: translateY(-3px); }
button.mk-preview {
  display: grid; gap: 8px; align-content: center;
  padding: 18px 30px 16px; width: 100%;
  font: inherit; border: 0; cursor: pointer;
  background: var(--m-bg, var(--paper-2)); color: var(--m-text, var(--ink));
  justify-items: center;
}
.mk-preview:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }
.mkp-avatar { width: 42px; height: 42px; border-radius: 50%; background: var(--m-accent, var(--sage)); }
.mkp-text { display: grid; gap: 6px; justify-items: inherit; width: 100%; }
.mkp-name { width: 58%; height: 8px; border-radius: 4px; background: color-mix(in srgb, var(--m-text, var(--ink)) 45%, transparent); }
.mkp-bio { width: 38%; height: 6px; border-radius: 3px; background: color-mix(in srgb, var(--m-text, var(--ink)) 24%, transparent); }
.mkp-btn {
  width: 100%; height: 16px; border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--m-text, var(--ink)) 28%, transparent);
  background: color-mix(in srgb, var(--m-text, var(--ink)) 7%, transparent);
}
.mkp-btn-accent { background: color-mix(in srgb, var(--m-accent, var(--accent)) 82%, transparent); border-color: transparent; }
/* چیدمان‌ها: تصویر کنار متن */
.mk-preview.pos-start { grid-template-columns: 42px 1fr; grid-template-areas: 'avatar text' 'btn btn' 'btn2 btn2'; align-content: center; column-gap: 12px; text-align: start; }
.mk-preview.pos-start .mkp-avatar { grid-area: avatar; align-self: center; }
.mk-preview.pos-start .mkp-text { grid-area: text; justify-items: start; }
.mk-preview.pos-start .mkp-btn:first-of-type { grid-area: btn; }
.mk-preview.pos-start .mkp-btn-accent { grid-area: btn2; }
.mk-preview.pos-end { grid-template-columns: 1fr 42px; grid-template-areas: 'text avatar' 'btn btn' 'btn2 btn2'; align-content: center; column-gap: 12px; }
.mk-preview.pos-end .mkp-avatar { grid-area: avatar; align-self: center; }
.mk-preview.pos-end .mkp-text { grid-area: text; justify-items: end; }
.mk-preview.pos-end .mkp-btn:first-of-type { grid-area: btn; }
.mk-preview.pos-end .mkp-btn-accent { grid-area: btn2; }
.mk-preview.pos-hero .mkp-avatar { width: 58px; height: 58px; }
.mk-preview.pos-hero .mkp-name { width: 70%; }
.mk-preview.align-start { text-align: start; }
.mk-info { padding: 13px 16px 16px; display: grid; gap: 8px; align-content: start; }
.mk-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mk-title h2 { margin: 0; font-size: 1rem; }
.mk-desc { margin: 0; color: var(--ink-2); font-size: .83rem; line-height: 1.75; min-height: 2.9em; }
.mk-meta { display: flex; gap: 6px 12px; flex-wrap: wrap; font-size: .73rem; color: var(--ink-3); }

/* مُدال پیش‌نمایش تم — آی‌فریم موبایل‌شکل */
dialog.pv-modal.pv-modal-wide { max-width: 460px; width: min(94vw, 460px); }
.showcase-frame-wrap {
  border: 1px solid var(--line); border-radius: 18px; overflow: hidden;
  background: var(--paper-2);
  max-height: 62svh;
}
.showcase-frame-wrap iframe { display: block; width: 100%; height: 62svh; border: 0; }

/* ---------- فیلتر رنگ نشانگر (رفع CSP: فقط جاوااسکریپت خارجی) ---------- */
.color-pair { display: flex; align-items: center; gap: 8px; }
.color-pair input[type="color"] {
  width: 52px; height: 40px; padding: 3px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--paper); cursor: pointer;
}

/* ---------- v7.2 — دکمهٔ شناور ذخیره ----------
   فرم‌های بلند داشبورد: ذخیره بدون اسکرول تا پایین صفحه.
   در چیدمان راست‌به‌چپ روی لبهٔ چپ (inline-end) می‌نشیند، با اسکرول
   همراه می‌ماند و هدفی درشت و خوانا برای همهٔ کاربران است. */
.save-fab {
  position: fixed;
  inset-block-end: 22px;
  inset-inline-end: 22px;
  z-index: 90;
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 24px;
  font: inherit; font-size: 16px; font-weight: 700;
  color: #FFF8F2; background: var(--accent);
  border: 1px solid var(--accent-strong);
  border-radius: 999px;
  box-shadow: 0 14px 34px rgba(22, 22, 22, .30), 0 3px 8px rgba(22, 22, 22, .18);
  cursor: pointer;
  transition: transform .16s ease, opacity .16s ease, background-color .16s ease;
}
.save-fab:hover { background: var(--accent-strong); transform: translateY(-2px); }
.save-fab:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.save-fab:active { transform: translateY(0); }
.save-fab[disabled] { opacity: .7; cursor: progress; transform: none; }
.save-fab .icon { width: 1.2em; height: 1.2em; flex: none; }
.save-fab.is-hidden { opacity: 0; pointer-events: none; transform: translateY(14px); }
.save-fab-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: #FFF8F2; opacity: 0; flex: none;
  transition: opacity .2s ease;
}
.save-fab.has-changes .save-fab-dot { opacity: 1; animation: save-fab-pulse 1.5s ease-in-out infinite; }
@keyframes save-fab-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 248, 242, .55); }
  55% { box-shadow: 0 0 0 7px rgba(255, 248, 242, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .save-fab.has-changes .save-fab-dot { animation: none; }
  .save-fab { transition: none; }
}
/* موبایل: نوار تمام‌عرض پایین صفحه — هدف بزرگ و در دسترس شست */
@media (max-width: 640px) {
  .save-fab {
    inset-inline: 12px; inset-block-end: 12px;
    justify-content: center; padding: 17px 20px; font-size: 17px;
  }
  /* چون دکمهٔ شناور همیشه نمایان است، پایینِ فرم جای خالی می‌گیرد تا
     دکمهٔ اصلی زیر نوار تمام‌عرض پنهان نماند */
  .has-save-fab .dash-main { padding-block-end: 104px; }
}
