/* ==========================================================================
   لوح‌ساز (استودیوی تقدیرنامه) — صفحهٔ بومی داخل Choroma
   ساختار: قاب دوستونی (تنظیمات + پیش‌نمایش) با همان توکن‌های ظاهری برنامه.
   استایل خودِ تقدیرنامه در انتهای فایل و با پیشوند .lhy-page محدود شده است
   تا هیچ‌کدام از کلاس‌های عمومی سند (frame/corner/divider/…) به بیرون نشت نکند.
   ========================================================================== */

@font-face {
  font-family: "NotoNaskh";
  src: url("/assets/fonts/NotoNaskh.woff") format("woff");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "ReemKufi";
  src: url("/assets/fonts/ReemKufi.woff") format("woff");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Alef";
  src: url("/assets/fonts/Alef.woff") format("woff");
  font-weight: 400;
  font-display: swap;
}

.lhy-page {
  --lhy-panel: 396px;
  --paper-w: 1122px;
  --paper-h: 793px;
  --preview-scale: .72;
  position: relative;
  display: grid;
  grid-template-columns: var(--lhy-panel) minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  direction: rtl;
  height: calc((100dvh - 64px) / var(--app-zoom, 1));
  min-height: 600px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--paper);
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* صفحهٔ لوح‌ساز تمام ارتفاعِ آزاد را می‌گیرد؛ فاصلهٔ پایین هم کم می‌شود */
.view.lhy-host { padding-bottom: 12px; }

/* ---------- هدر صفحه (هیرو) ---------- */
.lhy-hero {
  grid-column: 1 / -1;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 12px 16px;
  color: #eafff8;
  background:
    radial-gradient(120% 180% at 100% 0%, rgba(245, 158, 11, .24), transparent 55%),
    linear-gradient(120deg, #0d3b34 0%, #116a5a 58%, #0d3b34 100%);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.lhy-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, .12) 1px, transparent 1px);
  background-size: 18px 18px;
  opacity: .32;
  pointer-events: none;
}
.lhy-hero > * { position: relative; z-index: 1; }
.lhy-hero-ic {
  width: 46px;
  height: 46px;
  flex: none;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .22);
}
.lhy-hero-ic svg { width: 24px; height: 24px; }
.lhy-hero-txt { flex: 1 1 240px; min-width: 180px; }
.lhy-hero-txt h2 { margin: 0; font-size: var(--fs-lg); font-weight: 800; letter-spacing: -.01em; }
.lhy-hero-txt p { margin: 3px 0 0; font-size: var(--fs-2xs); color: rgba(234, 255, 248, .78); line-height: 1.9; }
.lhy-hero-stats { display: flex; gap: 6px; flex-wrap: wrap; }
.lhy-kpi {
  min-width: 88px;
  padding: 5px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .16);
}
.lhy-kpi b { display: block; font-size: var(--fs-md); font-weight: 800; color: #fff; line-height: 1.5; }
.lhy-kpi span { display: block; font-size: var(--fs-3xs); color: rgba(234, 255, 248, .72); }
.lhy-kpi.gold { border-color: rgba(233, 185, 73, .5); background: rgba(233, 185, 73, .13); }
.lhy-kpi.gold b { color: #f4d27a; }
.lhy-hero-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.lhy-hero-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 32px;
  padding: 0 10px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, .22);
  background: rgba(255, 255, 255, .1);
  color: #eafff8;
  font: inherit;
  font-size: var(--fs-3xs);
  font-weight: 700;
  cursor: pointer;
  transition: background var(--dur), border-color var(--dur);
}
.lhy-hero-btn:hover { background: rgba(255, 255, 255, .18); border-color: rgba(255, 255, 255, .34); }
.lhy-hero-btn:focus-visible { outline: 2px solid #f4d27a; outline-offset: 2px; }
.lhy-hero-btn svg { width: 14px; height: 14px; }

/* ---------- ستون تنظیمات (سمت راست) ---------- */
.lhy-side {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--paper);
  border-left: 1px solid var(--line);
}

.lhy-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
  padding: 8px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--accent-2) 4%, transparent), transparent),
    var(--surface-2);
  flex: 0 0 auto;
}
.lhy-tab {
  border: 0;
  background: transparent;
  border-radius: var(--radius-sm);
  min-width: 0;
  padding: 6px 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--muted);
  font-size: var(--fs-3xs);
  font-weight: 700;
  cursor: pointer;
  transition: background var(--dur), color var(--dur), box-shadow var(--dur);
}
.lhy-tab svg { width: 17px; height: 17px; }
.lhy-tab:hover { background: color-mix(in srgb, var(--accent-2) 8%, transparent); color: var(--accent-2); }
.lhy-tab.active {
  background: var(--paper);
  color: var(--accent-2);
  box-shadow: var(--shadow-xs), inset 0 0 0 1px color-mix(in srgb, var(--accent-2) 22%, var(--line));
}

.lhy-panels {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px 10px 34px;
  scrollbar-width: thin;
}
.lhy-panel { display: none; }
.lhy-panel.active { display: block; animation: lhyPanelIn .22s var(--ease-out); }
@keyframes lhyPanelIn { from { opacity: .5; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.lhy-panel-head { padding: 4px 3px 10px; }
.lhy-panel-head h3 {
  margin: 0 0 3px;
  font-family: Lalezar, Vazirmatn, Tahoma, sans-serif;
  font-size: var(--fs-xl);
  font-weight: 400;
  color: var(--ink);
}
.lhy-panel-head p { margin: 0; color: var(--muted); font-size: var(--fs-2xs); line-height: 1.9; }

/* ---------- کارت‌های آکاردئونی داخل پنل ---------- */
.lhy-page .lhy-card {
  padding: 0;
  margin: 0 0 8px;
  overflow: hidden;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
}
.lhy-page .lhy-card > summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 11px;
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  user-select: none;
}
.lhy-page .lhy-card > summary::-webkit-details-marker { display: none; }
.lhy-page .lhy-card > summary::after {
  content: '▾';
  margin-right: auto;
  font-size: 11px;
  color: var(--muted);
  transition: transform var(--dur) var(--ease);
}
.lhy-page .lhy-card[open] > summary::after { transform: rotate(180deg); }
.lhy-page .lhy-card > summary:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
.lhy-card-body { padding: 0 11px 11px; }
.lhy-sum-ic {
  width: 25px; height: 25px; flex: 0 0 auto;
  display: grid; place-items: center;
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent-2) 10%, transparent);
  color: var(--accent-2);
}
.lhy-sum-ic svg { width: 14px; height: 14px; }

/* ---------- فیلدها ---------- */
.lhy-page .field { min-width: 0; margin-top: 8px; }
.lhy-page .field > span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: var(--fs-2xs);
  font-weight: 600;
  color: var(--muted);
}
.lhy-page .field > span small { font-size: var(--fs-3xs); opacity: .78; font-weight: 500; }
.lhy-page .field input,
.lhy-page .field select,
.lhy-page .field textarea { padding: 8px 10px; font-size: var(--fs-sm); border-radius: var(--radius-xs); }
.lhy-page .field textarea { min-height: 0; line-height: 1.9; resize: vertical; }
.lhy-two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.lhy-two > .field, .lhy-three > .field { margin-top: 8px; }
.lhy-three { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.lhy-help { display: block; margin-top: 4px; font-size: var(--fs-3xs); color: var(--muted); line-height: 1.8; }
.lhy-help.warn { color: var(--warn); }

/* ---------- بازه/اسلایدر ---------- */
.lhy-range { display: grid; grid-template-columns: minmax(0, 1fr) 48px; gap: 7px; align-items: center; }
.lhy-range input[type="range"] {
  width: 100%;
  accent-color: var(--accent-2);
  margin: 0;
  cursor: pointer;
}
.lhy-range output {
  height: 25px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: var(--fs-3xs);
  font-weight: 700;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ---------- سوییچ ---------- */
.lhy-switch-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
  font-size: var(--fs-xs);
  font-weight: 600;
}
.lhy-switch-row:last-child { border-bottom: 0; }
.lhy-switch { position: relative; width: 38px; height: 21px; flex: 0 0 auto; margin-right: auto; }
.lhy-switch input {
  position: absolute; inset: 0; z-index: 2;
  width: 100%; height: 100%; margin: 0; padding: 0;
  opacity: 0; cursor: pointer;
}
.lhy-switch i {
  position: absolute; inset: 0;
  border-radius: 999px;
  background: var(--line);
  transition: background var(--dur) var(--ease);
}
.lhy-switch i::after {
  content: '';
  position: absolute; top: 2px; right: 2px;
  width: 17px; height: 17px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .22);
  transition: transform var(--dur) var(--ease-spring);
}
.lhy-switch input:checked + i { background: var(--accent-2); }
.lhy-switch input:checked + i::after { transform: translateX(-17px); }
.lhy-switch input:focus-visible + i { box-shadow: 0 0 0 3px var(--ring); }

/* ---------- بارگذاری فایل ---------- */
.lhy-upload {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 62px;
  margin-top: 8px;
  padding: 9px;
  border: 1.5px dashed color-mix(in srgb, var(--accent-2) 34%, var(--line));
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--muted);
  cursor: pointer;
  text-align: right;
  transition: border-color var(--dur), background var(--dur);
}
.lhy-upload:hover { border-color: var(--accent-2); background: color-mix(in srgb, var(--accent-2) 7%, var(--surface-2)); }
.lhy-upload > input[type="file"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.lhy-upload .lhy-up-ic {
  width: 32px; height: 32px; flex: 0 0 auto;
  display: grid; place-items: center;
  border-radius: 9px;
  background: color-mix(in srgb, var(--accent-2) 12%, transparent);
  color: var(--accent-2);
}
.lhy-upload .lhy-up-ic svg { width: 16px; height: 16px; }
.lhy-upload b { display: block; font-size: var(--fs-xs); color: var(--ink); }
.lhy-upload small { display: block; font-size: var(--fs-3xs); color: var(--muted); margin-top: 2px; }
.lhy-file-btn { position: relative; display: inline-flex; overflow: hidden; }
.lhy-file-btn input[type="file"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }

/* ---------- دکمه‌های تکه‌ای/بخش‌بندی ---------- */
.lhy-seg {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.lhy-seg button {
  border: 0; background: transparent; cursor: pointer;
  border-radius: 7px; padding: 6px 7px;
  font-family: inherit; font-size: var(--fs-2xs); font-weight: 700;
  color: var(--muted);
  transition: background var(--dur), color var(--dur), box-shadow var(--dur);
}
.lhy-seg button:hover { color: var(--accent-2); }
.lhy-seg button.active { background: var(--paper); color: var(--accent-2); box-shadow: var(--shadow-xs); }

/* ---------- توکن‌های متن ---------- */
.lhy-tokens { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.lhy-token {
  border: 1px dashed color-mix(in srgb, var(--accent-2) 42%, var(--line));
  background: color-mix(in srgb, var(--accent-2) 6%, transparent);
  color: var(--accent-2);
  border-radius: 999px;
  padding: 3px 9px;
  font-family: inherit;
  font-size: var(--fs-3xs);
  font-weight: 700;
  cursor: pointer;
}
.lhy-token:hover { background: color-mix(in srgb, var(--accent-2) 14%, transparent); }

/* ---------- قالب‌ها ---------- */
.lhy-template-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 6px; }
.lhy-template-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 6px;
  cursor: pointer;
  text-align: right;
  font-family: inherit;
  color: var(--ink);
  transition: border-color var(--dur), box-shadow var(--dur), transform var(--dur);
}
.lhy-template-card:hover { transform: translateY(-1px); border-color: color-mix(in srgb, var(--accent-2) 40%, var(--line)); }
.lhy-template-card.active {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 2px var(--ring);
  background: var(--paper);
}
.lhy-template-preview {
  height: 42px;
  border-radius: 5px;
  border: 2px solid var(--mini-accent, #b9903d);
  background:
    radial-gradient(circle at 50% 0%, color-mix(in srgb, var(--mini-accent, #b9903d) 18%, transparent), transparent 60%),
    var(--mini-paper, #fffdf7);
  box-shadow: inset 0 0 0 3px var(--mini-paper, #fffdf7), inset 0 0 0 4px color-mix(in srgb, var(--mini-accent, #b9903d) 55%, transparent);
  position: relative;
  margin-bottom: 5px;
}
.lhy-template-preview::before,
.lhy-template-preview::after {
  content: '';
  position: absolute;
  right: 50%;
  transform: translateX(50%);
  background: var(--mini-ink, #0d6a61);
  opacity: .42;
  border-radius: 2px;
}
.lhy-template-preview::before { width: 46%; height: 3px; top: 12px; }
.lhy-template-preview::after { width: 62%; height: 2px; top: 20px; opacity: .24; }
.lhy-template-card b { display: block; font-size: var(--fs-3xs); line-height: 1.6; }
.lhy-template-card small { display: block; font-size: 8.5px; color: var(--muted); }

/* ---------- رنگ‌ها ---------- */
.lhy-colors { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 6px; }
.lhy-color {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  background: var(--surface-2);
  font-size: var(--fs-3xs);
  color: var(--muted);
  font-weight: 600;
}
.lhy-color input[type="color"] {
  width: 24px; height: 24px; flex: 0 0 auto;
  padding: 0; border: 0; border-radius: 6px;
  background: none; cursor: pointer;
}
.lhy-color input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.lhy-color input[type="color"]::-webkit-color-swatch { border: 1px solid var(--line); border-radius: 6px; }

/* ---------- هشدار/توضیح ---------- */
.lhy-notice {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-xs);
  border: 1px solid color-mix(in srgb, var(--gold) 35%, var(--line));
  background: color-mix(in srgb, var(--gold) 9%, var(--paper));
  color: color-mix(in srgb, var(--warn) 70%, var(--ink));
  font-size: var(--fs-3xs);
  line-height: 1.9;
}
.lhy-page .lhy-note-list { margin: 0; padding: 0 16px 0 0; }

/* ---------- امضاکنندگان ---------- */
.lhy-sign-editor {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 8px;
  margin-bottom: 8px;
}
.lhy-sign-head { display: flex; align-items: center; gap: 7px; margin-bottom: 2px; }
.lhy-sign-head b { font-size: var(--fs-2xs); }
.lhy-sign-head .lhy-switch { margin-right: auto; }
.lhy-sign-actions { display: flex; align-items: center; gap: 6px; margin-top: 8px; }

/* ---------- گیرندگان ---------- */
.lhy-recipient-tools { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.lhy-search-row { display: flex; align-items: center; gap: 6px; margin-bottom: 7px; }
.lhy-search { position: relative; flex: 1 1 auto; display: flex; align-items: center; min-width: 0; }
.lhy-search svg { position: absolute; right: 9px; width: 14px; height: 14px; color: var(--muted); pointer-events: none; }
.lhy-search input {
  width: 100%;
  height: 31px;
  padding: 0 30px 0 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: var(--fs-2xs);
}
.lhy-search input:focus { outline: none; border-color: var(--accent-2); box-shadow: 0 0 0 2px var(--ring); }
.lhy-search-count { font-size: var(--fs-3xs); color: var(--muted); white-space: nowrap; }
.lhy-list-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 2px 0 5px; font-size: var(--fs-3xs); color: var(--muted); }
.lhy-clear-link { display: inline-flex; align-items: center; gap: 4px; border: 0; background: transparent; color: #b91c1c; font: inherit; font-size: var(--fs-3xs); cursor: pointer; padding: 2px 0; }
.lhy-clear-link:hover { text-decoration: underline; }
.lhy-clear-link svg { width: 12px; height: 12px; }
[data-theme="dark"] .lhy-clear-link { color: #fca5a5; }
.lhy-recipient-list { display: flex; flex-direction: column; gap: 5px; max-height: 258px; overflow: auto; padding: 1px; scrollbar-width: thin; }
.lhy-recipient {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
  padding: 5px 7px;
  cursor: pointer;
  transition: border-color var(--dur), box-shadow var(--dur), background var(--dur);
}
.lhy-recipient:hover { border-color: color-mix(in srgb, var(--accent-2) 40%, var(--line)); }
.lhy-recipient.active {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 2px var(--ring);
  background: color-mix(in srgb, var(--accent-2) 5%, var(--paper));
}
.lhy-recipient .avatar {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent-2) 12%, var(--surface-2));
  color: var(--accent-2);
  font-weight: 800;
  font-size: var(--fs-xs);
}
.lhy-recipient b { display: block; font-size: var(--fs-2xs); line-height: 1.7; }
.lhy-recipient small { display: block; font-size: var(--fs-3xs); color: var(--muted); }
.lhy-recipient .lhy-row-del {
  width: 25px; height: 25px;
  display: grid; place-items: center;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.lhy-recipient .lhy-row-del:hover { color: var(--bad); background: color-mix(in srgb, var(--bad) 9%, transparent); }
.lhy-recipient .lhy-row-del svg { width: 13px; height: 13px; }
.lhy-row-actions { display: flex; align-items: center; gap: 1px; }
.lhy-recipient .lhy-row-btn {
  width: 24px; height: 24px;
  display: grid; place-items: center;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.lhy-recipient .lhy-row-btn:hover:not(:disabled) { color: var(--accent-2); background: color-mix(in srgb, var(--accent-2) 9%, transparent); }
.lhy-recipient .lhy-row-btn:disabled { opacity: .28; cursor: default; }
.lhy-recipient .lhy-row-btn svg { width: 13px; height: 13px; }
.lhy-empty {
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
  color: var(--muted);
  font-size: var(--fs-2xs);
  background: var(--surface-2);
}

/* ---------- پیش‌تنظیم‌های طراحی ---------- */
.lhy-preset-row { display: flex; align-items: center; gap: 6px; }
.lhy-preset-row .select { flex: 1 1 auto; min-width: 0; }

/* ---------- کلیدهای میان‌بر ---------- */
.lhy-keys { display: grid; gap: 9px; }
.lhy-modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 0 22px 18px; }
.lhy-key-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: var(--fs-2xs); color: var(--ink); }
.lhy-key-row kbd {
  font-family: inherit;
  font-size: var(--fs-3xs);
  font-weight: 700;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--ink);
  direction: ltr;
  white-space: nowrap;
}

/* ---------- خروجی ---------- */
.lhy-output-hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-md);
  padding: 13px 14px;
  margin-bottom: 9px;
  color: #fff;
  background:
    radial-gradient(140px 100px at 10% 0%, rgba(251, 191, 36, .26), transparent 70%),
    linear-gradient(145deg, #0f4f45, #0a2f2b);
}
.lhy-output-hero::after {
  content: '';
  position: absolute;
  width: 96px; height: 96px;
  left: -26px; bottom: -42px;
  border: 15px solid rgba(255, 255, 255, .07);
  border-radius: 50%;
}
.lhy-output-hero h3 { margin: 0 0 3px; font-family: Lalezar, Vazirmatn, sans-serif; font-size: var(--fs-xl); font-weight: 400; }
.lhy-output-hero p { margin: 0; font-size: var(--fs-3xs); line-height: 1.9; color: rgba(255, 255, 255, .82); }
.lhy-output-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.lhy-output-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink);
  padding: 9px 10px;
  font-family: inherit;
  text-align: right;
  cursor: pointer;
  transition: border-color var(--dur), box-shadow var(--dur), transform var(--dur);
}
.lhy-output-btn:hover { transform: translateY(-1px); border-color: color-mix(in srgb, var(--accent-2) 42%, var(--line)); box-shadow: var(--shadow-xs); }
.lhy-output-btn svg { width: 16px; height: 16px; color: var(--accent-2); margin-bottom: 2px; }
.lhy-output-btn b { font-size: var(--fs-2xs); }
.lhy-output-btn small { color: var(--muted); font-size: var(--fs-3xs); line-height: 1.7; }
.lhy-output-btn.wide { grid-column: 1 / -1; }

/* ---------- نوار ابزار پیش‌نمایش ---------- */
.lhy-stage {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at 50% -20%, color-mix(in srgb, var(--accent-2) 8%, transparent), transparent 52%),
    radial-gradient(color-mix(in srgb, var(--muted) 17%, transparent) .7px, transparent .7px) 0 0 / 19px 19px,
    var(--surface-2);
}
.lhy-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 78%, transparent);
  backdrop-filter: blur(8px);
  z-index: 2;
  flex: 0 0 auto;
}
.lhy-toolbar .lhy-spacer { margin-right: auto; }
.lhy-recipient-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 150px;
  max-width: 240px;
  height: 31px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
}
.lhy-recipient-pill span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lhy-recipient-pill svg { width: 14px; height: 14px; flex: 0 0 auto; color: var(--accent-2); }
.lhy-zoom { display: flex; align-items: center; gap: 6px; height: 31px; padding: 0 8px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--paper); }
.lhy-zoom input { width: 82px; accent-color: var(--accent-2); margin: 0; }
.lhy-zoom output { min-width: 30px; font-size: var(--fs-3xs); color: var(--muted); font-variant-numeric: tabular-nums; }
.lhy-badge-offline {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 31px;
  padding: 0 9px;
  border-radius: var(--radius-sm);
  border: 1px solid color-mix(in srgb, var(--good) 24%, var(--line));
  background: color-mix(in srgb, var(--good) 8%, var(--paper));
  color: var(--good);
  font-size: var(--fs-3xs);
  font-weight: 700;
  white-space: nowrap;
}
.lhy-badge-offline svg { width: 13px; height: 13px; }
.lhy-save { display: flex; align-items: center; gap: 5px; font-size: var(--fs-3xs); color: var(--muted); white-space: nowrap; }
.lhy-save i { width: 6px; height: 6px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 3px color-mix(in srgb, var(--good) 14%, transparent); }
.lhy-save.saving i { background: var(--warn); box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 16%, transparent); animation: lhyPulse 1s infinite; }
@keyframes lhyPulse { 50% { opacity: .35; } }

.lhy-canvas {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  display: block;
  padding: 26px 18px 46px;
  scrollbar-width: thin;
}
.lhy-page .paper-sizer { margin: 0 auto; }

/* ---------- نوار پایین صفحه ---------- */
.lhy-foot {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  padding: 8px 10px 10px;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--accent-2) 4%, var(--paper));
  flex: 0 0 auto;
}
.lhy-foot .lhy-foot-title { font-size: var(--fs-2xs); font-weight: 700; color: var(--ink); margin-left: auto; }
.lhy-foot .lhy-proj {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1 1 220px;
  min-width: 0;
  max-width: 360px;
}
.lhy-foot .lhy-proj > span {
  flex: 0 0 auto;
  font-size: var(--fs-3xs);
  color: var(--muted);
  white-space: nowrap;
}
.lhy-foot .lhy-proj input {
  flex: 1 1 auto;
  min-width: 0;
  height: 31px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink);
  font-family: inherit;
  font-size: var(--fs-xs);
  transition: border-color var(--dur), box-shadow var(--dur);
}
.lhy-foot .lhy-proj input:focus {
  outline: none;
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-2) 16%, transparent);
}

/* ---------- لایهٔ پیشرفت ---------- */
.lhy-progress {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: blur(7px);
}
.lhy-progress.show { display: flex; }
.lhy-progress-card {
  width: min(330px, 90%);
  padding: 18px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--paper);
  box-shadow: var(--shadow-lg);
}
.lhy-ring {
  width: 42px; height: 42px;
  margin: 0 auto 11px;
  border-radius: 50%;
  border: 3px solid color-mix(in srgb, var(--accent-2) 18%, transparent);
  border-top-color: var(--accent-2);
  animation: lhySpin .8s linear infinite;
}
@keyframes lhySpin { to { transform: rotate(360deg); } }
.lhy-progress-card b { display: block; font-size: var(--fs-sm); }
.lhy-progress-card p { margin: 4px 0 10px; font-size: var(--fs-3xs); color: var(--muted); }
.lhy-progress-bar { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.lhy-progress-bar i { display: block; height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--accent-2), var(--gold)); transition: width .2s; }

/* ---------- واکنش‌گرایی ---------- */
@media (max-width: 1180px) {
  .lhy-page { --lhy-panel: 352px; }
  .lhy-badge-offline { display: none; }
}
@media (max-width: 980px) {
  .lhy-page {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    height: auto;
    min-height: 0;
    overflow: visible;
  }
  .lhy-hero { order: 0; }
  .lhy-stage { order: 1; min-height: 62vh; }
  .lhy-side { order: 2; border-left: 0; border-top: 1px solid var(--line); }
  .lhy-canvas { max-height: 66vh; }
  .lhy-panels { overflow: visible; }
}
@media (max-width: 560px) {
  .lhy-hero { padding: 10px 12px; gap: 10px; }
  .lhy-hero-txt p { display: none; }
  .lhy-hero-stats { width: 100%; }
  .lhy-kpi { flex: 1 1 auto; min-width: 0; }
  .lhy-hero-actions { width: 100%; }
  .lhy-hero-actions .lhy-hero-btn { flex: 1 1 auto; justify-content: center; }
  .lhy-toolbar { gap: 4px; }
  .lhy-zoom { display: none; }
  .lhy-recipient-pill { min-width: 0; flex: 1; }
  .lhy-templates, .lhy-two { grid-template-columns: 1fr; }
  .lhy-output-grid { grid-template-columns: 1fr; }
  .lhy-color { font-size: 8.5px; }
}

/* ---------- چاپ: فقط خودِ تقدیرنامه ---------- */
/* فقط وقتی لوح‌ساز باز است، چاپ را به خودِ تقدیرنامه محدود می‌کند؛
   بقیهٔ صفحه‌ها چاپ عادی خودشان را دارند. */
@media print {
  body:has(.lhy-page) { background: #fff !important; zoom: 1 !important; overflow: visible !important; }
  body:has(.lhy-page) > *:not(.main) { display: none !important; }
  body:has(.lhy-page) .topbar,
  body:has(.lhy-page) .crumbs,
  body:has(.lhy-page) #sys-alert-bar,
  body:has(.lhy-page) #api-progress,
  body:has(.lhy-page) #toast-wrap,
  body:has(.lhy-page) #modal-root,
  body:has(.lhy-page) .skip-link { display: none !important; }
  body:has(.lhy-page) .main { margin: 0 !important; display: block !important; }
  body:has(.lhy-page) .view { padding: 0 !important; }
  .lhy-page {
    display: block !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }
  .lhy-hero, .lhy-side, .lhy-toolbar, .lhy-foot, .lhy-progress { display: none !important; }
  .lhy-stage { display: block !important; background: #fff !important; }
  .lhy-canvas { display: block !important; overflow: visible !important; max-height: none !important; padding: 0 !important; }
  .lhy-page .paper-sizer { width: var(--paper-w) !important; height: var(--paper-h) !important; margin: 0 !important; }
  .lhy-page .paper-shadow { position: static !important; transform: none !important; filter: none !important; }
  .lhy-page .certificate { page-break-inside: avoid; break-inside: avoid; }
}

/* ---------- استایل خود سند (محدودشده به .lhy-page) ---------- */
.lhy-page .paper-sizer{width:calc(var(--paper-w) * var(--preview-scale));height:calc(var(--paper-h) * var(--preview-scale));position:relative;direction:ltr;flex:0 0 auto;transition:width .2s,height .2s}
.lhy-page [hidden]{display:none!important}
.lhy-page .paper-shadow{position:absolute;top:0;left:0;right:auto;bottom:auto;width:var(--paper-w);height:var(--paper-h);direction:rtl;transform:scale(var(--preview-scale));transform-origin:top left;filter:drop-shadow(0 22px 34px rgba(21,54,50,.17));transition:transform .2s}
.lhy-page .certificate{--accent:#b9903d;--accent2:#0d6a61;--paper:#fffdf7;--cert-ink:#263332;--frame:2px;--frame-inset:22px;--title-size:58px;--name-size:37px;--body-size:22px;--line-height:2;--content-shift:0px;--logo-size:82px;--logo-gap:5px;--name-line-width:1px;--body-width:88%;--paragraph-gap:0px;--watermark-opacity:.045;width:1122px;height:793px;position:relative;overflow:hidden;background:var(--paper);color:var(--cert-ink);font-family:var(--cert-font);isolation:isolate;print-color-adjust:exact;-webkit-print-color-adjust:exact}
.lhy-page .certificate.portrait{width:793px;height:1122px}
.lhy-page .certificate .paper-wash{position:absolute;inset:0;z-index:-4;background:
      radial-gradient(circle at 50% 0%,color-mix(in srgb,var(--accent) 8%,transparent),transparent 35%),
      linear-gradient(130deg,transparent 42%,color-mix(in srgb,var(--accent2) 3%,transparent),transparent 58%)}
.lhy-page .certificate[data-texture="dots"] .paper-wash:after{content:"";position:absolute;inset:0;opacity:.25;background-image:radial-gradient(color-mix(in srgb,var(--accent) 22%,transparent) .8px,transparent .8px);background-size:17px 17px}
.lhy-page .certificate[data-texture="lines"] .paper-wash:after{content:"";position:absolute;inset:0;opacity:.20;background:repeating-linear-gradient(135deg,transparent 0 12px,color-mix(in srgb,var(--accent) 9%,transparent) 12px 13px)}
.lhy-page .frame{position:absolute;pointer-events:none;z-index:2}
.lhy-page .frame.outer{inset:var(--frame-inset);border:calc(var(--frame) + 1px) solid var(--accent)}
.lhy-page .frame.mid{inset:calc(var(--frame-inset) + 9px);border:1px solid color-mix(in srgb,var(--accent) 72%,transparent)}
.lhy-page .frame.inner{inset:calc(var(--frame-inset) + 17px);border:1px solid color-mix(in srgb,var(--accent) 42%,transparent)}
.lhy-page .certificate[data-border="double"] .frame.inner{display:none}
.lhy-page .certificate[data-border="minimal"] .frame.mid,
.lhy-page .certificate[data-border="minimal"] .frame.inner{display:none}
.lhy-page .certificate[data-border="minimal"] .frame.outer{border-width:1px}
.lhy-page .certificate[data-border="minimal"] .corner-dot{display:none}
.lhy-page .corner{position:absolute;width:62px;height:62px;border:2px solid var(--accent);z-index:3;background:var(--paper);transform:rotate(45deg)}
.lhy-page .corner:before{content:"";position:absolute;inset:9px;border:1px solid var(--accent)}
.lhy-page .corner.tl{top:31px;left:31px}
.lhy-page .corner.tr{top:31px;right:31px}
.lhy-page .corner.bl{bottom:31px;left:31px}
.lhy-page .corner.br{bottom:31px;right:31px}
.lhy-page .corner-dot{position:absolute;width:10px;height:10px;border:2px solid var(--accent);transform:rotate(45deg);z-index:3}
.lhy-page .corner-dot.tl{top:57px;left:112px}
.lhy-page .corner-dot.tr{top:57px;right:112px}
.lhy-page .corner-dot.bl{bottom:57px;left:112px}
.lhy-page .corner-dot.br{bottom:57px;right:112px}
.lhy-page .doc-meta{position:absolute;top:var(--meta-y,52px);left:var(--meta-x,134px);z-index:4;display:flex;flex-direction:column;gap:var(--meta-gap,3px);font-size:var(--meta-size,13px);color:color-mix(in srgb,var(--cert-ink) 64%,transparent);letter-spacing:.2px}
.lhy-page .doc-meta>div{white-space:nowrap}
.lhy-page .certificate-content{position:absolute;z-index:4;inset:50px 78px 45px;display:flex;flex-direction:column;align-items:center;text-align:center;transform:translateY(var(--content-shift))}
.lhy-page .logo-wrap{height:calc(var(--logo-size) + 5px);display:grid;place-items:center;margin-bottom:var(--logo-gap)}
.lhy-page .logo-wrap[data-shape="square"] .logo-image,
.lhy-page .logo-wrap[data-shape="square"] .logo-fallback{border-radius:10px}
.lhy-page .logo-wrap[data-shape="circle"] .logo-image,
.lhy-page .logo-wrap[data-shape="circle"] .logo-fallback{border-radius:50%}
.lhy-page .logo-wrap[data-shape="square"] .logo-image,
.lhy-page .logo-wrap[data-shape="square"] .logo-fallback{border-radius:10px}
.lhy-page .logo-wrap[data-shape="circle"] .logo-image,
.lhy-page .logo-wrap[data-shape="circle"] .logo-fallback{border-radius:50%}
.lhy-page .logo-image{width:var(--logo-size);height:var(--logo-size);object-fit:contain;display:none}
.lhy-page .logo-fallback{width:var(--logo-size);height:var(--logo-size);border-radius:50%;border:1px solid color-mix(in srgb,var(--accent) 72%,transparent);display:grid;place-items:center;position:relative;color:var(--accent)}
.lhy-page .logo-fallback:before{content:"";position:absolute;inset:7px;border:1px solid color-mix(in srgb,var(--accent) 45%,transparent);border-radius:50%}
.lhy-page .logo-fallback span{font-weight:900;font-size:calc(var(--logo-size) * .34)}
.lhy-page .organization{font-size:20px;color:var(--accent2);font-weight:900;margin-top:2px}
.lhy-page .department{font-size:12px;letter-spacing:.1px;color:color-mix(in srgb,var(--cert-ink) 62%,transparent);margin-top:3px;min-height:18px}
.lhy-page .cert-title{font-family:var(--cert-title-font);font-size:var(--title-size);font-weight:var(--title-weight,400);color:color-mix(in srgb,var(--accent) 73%,#4a3000);line-height:1.12;margin:14px 0 5px;white-space:nowrap}
.lhy-page .divider{display:flex;align-items:center;gap:10px;width:48%;max-width:470px;color:var(--accent);margin:1px 0 12px}
.lhy-page .divider:before,
.lhy-page .divider:after{content:"";height:1px;flex:1;background:linear-gradient(90deg,transparent,var(--accent))}
.lhy-page .divider:after{background:linear-gradient(90deg,var(--accent),transparent)}
.lhy-page .divider i{width:9px;height:9px;background:var(--accent);transform:rotate(45deg)}
.lhy-page .addressing{font-size:var(--addressing-size,16px);font-weight:650;margin-top:2px}
.lhy-page .body-text{width:min(850px,var(--body-width));font-size:var(--body-size);line-height:var(--line-height);white-space:pre-line;text-align:var(--body-align,center);margin:4px 0 7px;word-spacing:0;color:color-mix(in srgb,var(--cert-ink) 94%,transparent)}
.lhy-page .recipient-name{font-size:var(--name-size);font-weight:950;color:var(--accent2);line-height:1.35;margin:2px 0 3px;border-bottom:1px solid color-mix(in srgb,var(--accent) 80%,transparent);padding:0 36px 6px;min-width:320px;border-bottom-width:var(--name-line-width)}
.lhy-page .achievement{display:inline-flex;align-items:center;justify-content:center;min-height:26px;padding:3px 15px;border-radius:99px;font-size:12px;font-weight:750;color:color-mix(in srgb,var(--accent2) 85%,#000);background:color-mix(in srgb,var(--accent2) 9%,transparent);border:1px solid color-mix(in srgb,var(--accent2) 18%,transparent);margin-top:4px}
.lhy-page .certificate-footer{width:100%;margin-top:auto;position:relative;display:grid;grid-template-columns:1fr auto 1fr;align-items:end;min-height:115px;transform:translateY(var(--signature-shift,0px))}
.lhy-page .date-place{font-size:12px;color:color-mix(in srgb,var(--cert-ink) 64%,transparent);align-self:center;padding:0 14px;white-space:nowrap}
.lhy-page .signatures{grid-column:1/-1;display:flex;align-items:end;justify-content:center;gap:26px;width:100%;padding:0 24px}
.lhy-page .signature{position:relative;min-width:150px;max-width:210px;flex:1;text-align:center}
.lhy-page .signature-image{display:block;position:absolute;width:105px;height:55px;object-fit:contain;left:50%;bottom:39px;transform:translateX(-50%)}
.lhy-page .signature-line{height:1px;background:color-mix(in srgb,var(--accent) 58%,transparent);margin-bottom:7px}
.lhy-page .signature strong{display:block;font-size:13px;color:var(--accent2)}
.lhy-page .signature small{display:block;font-size:10px;color:color-mix(in srgb,var(--cert-ink) 60%,transparent);margin-top:2px}
.lhy-page .stamp-image{position:absolute;width:108px;height:108px;object-fit:contain;bottom:4px;left:50%;transform:translateX(-50%) rotate(-4deg);opacity:.83;z-index:2;pointer-events:none}
.lhy-page .watermark{position:absolute;z-index:-2;left:50%;top:51%;transform:translate(-50%,-50%);width:330px;height:330px;border:5px double var(--accent);border-radius:50%;opacity:var(--watermark-opacity);display:grid;place-items:center;font-size:78px;font-weight:950;color:var(--accent);overflow:hidden}
.lhy-page .watermark img{width:85%;height:85%;object-fit:contain}
.lhy-page .watermark span{max-width:80%;text-align:center}
.lhy-page .certificate[data-template="teal"]{--accent:#0b8b7b;--accent2:#084f4a;--paper:#fbfffd}
.lhy-page .certificate[data-template="teal"] .frame.outer{border-width:5px;border-color:var(--accent2)}
.lhy-page .certificate[data-template="teal"] .frame.mid{border-width:2px}
.lhy-page .certificate[data-template="teal"] .corner{border-radius:7px;background:#fbfffd}
.lhy-page .certificate[data-template="blue"]{--accent:#caa64e;--accent2:#173d7c;--paper:#fcfdff;--cert-ink:#15243d}
.lhy-page .certificate[data-template="blue"] .paper-wash{background:radial-gradient(circle at 50% 0%,rgba(40,91,166,.08),transparent 34%),linear-gradient(145deg,transparent 45%,rgba(202,166,78,.06),transparent 60%)}
.lhy-page .certificate[data-template="burgundy"]{--accent:#b39157;--accent2:#6a1d2d;--paper:#fffaf3;--cert-ink:#3a2927}
.lhy-page .certificate[data-template="burgundy"] .frame.outer{border:6px double var(--accent2)}
.lhy-page .certificate[data-template="burgundy"] .corner{background:var(--accent2);border-color:var(--accent);width:46px;height:46px}
.lhy-page .certificate[data-template="modern"]{--accent:#b56f45;--accent2:#172528;--paper:#faf9f6;--cert-ink:#172528}
.lhy-page .certificate[data-template="modern"] .frame.outer{border:10px solid var(--accent2)}
.lhy-page .certificate[data-template="modern"] .frame.mid{border:3px solid var(--accent)}
.lhy-page .certificate[data-template="modern"] .frame.inner,
.lhy-page .certificate[data-template="modern"] .corner-dot{display:none}
.lhy-page .certificate[data-template="modern"] .corner{width:30px;height:30px;background:var(--accent);border:0}
.lhy-page .certificate[data-template="modern"] .corner:before{display:none}
.lhy-page .certificate[data-template="violet"]{--accent:#8c64c8;--accent2:#235f91;--paper:#fdfbff;--cert-ink:#2b2840}
.lhy-page .certificate[data-template="violet"] .paper-wash{background:radial-gradient(circle at 15% 15%,rgba(68,169,194,.12),transparent 25%),radial-gradient(circle at 85% 85%,rgba(140,100,200,.11),transparent 28%)}
.lhy-page .certificate[data-template="violet"] .corner{border-radius:14px;background:#fdfbff}
.lhy-page .certificate.portrait .certificate-content{inset:72px 68px 60px}
.lhy-page .certificate.portrait .logo-wrap{margin-bottom:10px}
.lhy-page .certificate.portrait .organization{font-size:21px}
.lhy-page .certificate.portrait .department{font-size:13px;margin-top:5px}
.lhy-page .certificate.portrait .cert-title{margin:34px 0 10px;line-height:1.08}
.lhy-page .certificate.portrait .divider{width:68%;margin-bottom:22px}
.lhy-page .certificate.portrait .addressing{font-size:calc(var(--addressing-size,16px) + 2px);margin-top:4px}
.lhy-page .certificate.portrait .body-text{width:92%;margin:18px 0 12px;line-height:calc(var(--line-height) + .1)}
.lhy-page .certificate.portrait .recipient-name{min-width:72%;margin:15px 0 8px;padding-bottom:9px}
.lhy-page .certificate.portrait .achievement{margin-top:7px}
.lhy-page .certificate.portrait .certificate-footer{display:flex;flex-direction:column;justify-content:flex-end;align-items:center;gap:26px;min-height:250px;margin:22px 0 10px}
.lhy-page .certificate.portrait .date-place{order:1;align-self:center}
.lhy-page .certificate.portrait .signatures{order:2;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:48px 28px;width:100%;max-width:610px;padding:0 22px}
.lhy-page .certificate.portrait .signature{min-width:0;max-width:none;width:100%}
.lhy-page .certificate.portrait .stamp-image{bottom:92px}
.lhy-page .certificate.portrait .watermark{width:390px;height:390px}
