/* ==========================================================================
   ماژول G — مرکز پشتیبانی، دستیار هوشمند (کنسیرژ)، تیکت‌ها
   فقط متغیرهای رنگی پوسته؛ روز/شب و راست‌به‌چپ/چپ‌به‌راست خودکار.
   ========================================================================== */

/* ---------------------------------------------------------------- ویجت دستیار */
.gka { --gka-w: 400px; font-family: var(--font); }
.gka-fab { overflow: visible; }
.gka-fab .gka-fab-ring { position: absolute; inset: -6px; border-radius: 50%; border: 1px solid var(--gold-2); opacity: .0; animation: gkaRing 3.2s var(--ease) infinite; pointer-events: none; }
.gka-fab .gka-fab-badge { position: absolute; top: -2px; inset-inline-end: -2px; width: 14px; height: 14px; border-radius: 50%; background: var(--grad-gold); border: 2px solid var(--surface); }
.gka.is-open .gka-fab { transform: scale(.92); }
.gka.is-open .gka-fab .gka-fab-ring, .gka.is-open .gka-fab .gka-fab-badge { display: none; }
@keyframes gkaRing { 0% { transform: scale(.9); opacity: .0; } 30% { opacity: .7; } 100% { transform: scale(1.35); opacity: 0; } }

.gka-panel {
  position: fixed; z-index: 125; bottom: 96px; inset-inline-end: 22px;
  width: min(var(--gka-w), calc(100vw - 32px)); height: min(640px, calc(100vh - 130px));
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--line-strong); border-radius: 28px 28px var(--radius-lg) var(--radius-lg);
  box-shadow: var(--shadow-lg), 0 0 0 1px color-mix(in srgb, var(--gold) 12%, transparent);
  transform-origin: bottom var(--gka-origin, right);
  animation: gkaIn .38s var(--ease);
}
[dir="rtl"] .gka-panel { --gka-origin: left; }
.gka-panel[hidden] { display: none; }
@keyframes gkaIn { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }

.gka-head { position: relative; display: flex; align-items: center; gap: 12px; padding: 16px 16px 18px; color: #F4EEDF; background: var(--grad-brand); overflow: hidden; }
.gka-head::after { content: ''; position: absolute; inset-inline: 18px; bottom: 0; height: 1px; background: var(--grad-gold); opacity: .8; }
.gka-head .gka-emblem { position: relative; flex: none; width: 46px; height: 46px; border-radius: 16px; display: grid; place-items: center; background: rgba(255, 255, 255, .08); border: 1px solid rgba(232, 214, 170, .35); }
.gka-head .gka-emblem img { width: 34px; height: 34px; object-fit: contain; }
.gka-head h2 { margin: 0; font-family: var(--font-display); font-size: 1.08rem; color: #FFF8E8; letter-spacing: .01em; }
.gka-head p { margin: 2px 0 0; font-size: .76rem; color: rgba(239, 233, 220, .75); display: flex; align-items: center; gap: 6px; }
.gka-dot { width: 7px; height: 7px; border-radius: 50%; background: #5BD6A0; box-shadow: 0 0 0 3px rgba(91, 214, 160, .2); }
.gka-head .gka-actions { margin-inline-start: auto; display: flex; gap: 4px; }
.gka-head .gka-icon { width: 36px; height: 36px; border-radius: 12px; border: 0; background: transparent; color: #EFE9DC; cursor: pointer; display: grid; place-items: center; transition: background .2s; }
.gka-head .gka-icon:hover, .gka-head .gka-icon:focus-visible { background: rgba(255, 255, 255, .12); }
.gka-head .gka-icon .icon { width: 18px; height: 18px; }

.gka-body { flex: 1; overflow-y: auto; padding: 18px 16px 8px; display: flex; flex-direction: column; gap: 12px; scroll-behavior: smooth;
  background: radial-gradient(420px 220px at 50% 0, var(--gold-soft), transparent 70%), var(--surface); }
[data-theme="dark"] .gka-body { background: radial-gradient(420px 220px at 50% 0, color-mix(in srgb, var(--gold) 10%, transparent), transparent 70%), var(--surface); }

.gka-welcome { text-align: center; padding: 6px 6px 2px; }
.gka-welcome .gka-arch { width: 84px; height: 96px; margin: 0 auto 10px; border-radius: 42px 42px 14px 14px; display: grid; place-items: center; background: var(--grad-brand); box-shadow: var(--shadow); position: relative; }
.gka-welcome .gka-arch::before { content: ''; position: absolute; inset: 6px; border-radius: 36px 36px 10px 10px; border: 1px solid color-mix(in srgb, var(--gold) 55%, transparent); }
.gka-welcome .gka-arch .icon { width: 30px; height: 30px; color: var(--gold-3); }
.gka-welcome h3 { font-family: var(--font-display); font-size: 1.1rem; margin: 0 0 4px; }
.gka-welcome p { margin: 0 auto; max-width: 300px; color: var(--muted); font-size: .86rem; line-height: 1.9; }
.gka-sugg { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 14px; }
.gka-sugg button { font: inherit; font-size: .8rem; font-weight: 600; padding: 7px 12px; border-radius: 999px; cursor: pointer; color: var(--text-2);
  background: var(--surface); border: 1px solid var(--line-strong); transition: border-color .2s, color .2s, transform .2s; }
.gka-sugg button:hover, .gka-sugg button:focus-visible { border-color: var(--gold); color: var(--gold-ink); transform: translateY(-1px); }
[data-theme="dark"] .gka-sugg button:hover { color: var(--gold-2); }

.gka-msg { display: flex; gap: 8px; align-items: flex-end; max-width: 100%; }
.gka-msg .gka-av { flex: none; width: 28px; height: 28px; border-radius: 10px; display: grid; place-items: center; background: var(--grad-brand); color: var(--gold-3); }
.gka-msg .gka-av .icon { width: 15px; height: 15px; }
.gka-bubble { min-width: 0; max-width: 84%; padding: 10px 14px; border-radius: 18px; font-size: .9rem; line-height: 1.85; overflow-wrap: anywhere;
  background: var(--surface-2); border: 1px solid var(--line); border-end-start-radius: 6px; }
.gka-bubble p { margin: 0 0 6px; } .gka-bubble p:last-child { margin: 0; }
.gka-bubble ul { margin: 4px 0 6px; padding-inline-start: 18px; } .gka-bubble li { margin: 2px 0; }
.gka-bubble a { color: var(--brand); font-weight: 600; text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--gold) 60%, transparent); text-underline-offset: 3px; }
.gka-bubble strong { color: var(--text); }
.gka-msg.is-user { flex-direction: row-reverse; }
.gka-msg.is-user .gka-bubble { background: var(--brand); color: var(--on-brand); border-color: transparent; border-end-start-radius: 18px; border-end-end-radius: 6px; }
.gka-msg.is-note .gka-bubble { background: var(--gold-soft); border-color: var(--gold-3); color: var(--text); }
[data-theme="dark"] .gka-msg.is-note .gka-bubble { background: color-mix(in srgb, var(--gold) 12%, transparent); }
.gka-meta { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-size: .72rem; color: var(--muted); flex-wrap: wrap; }
.gka-meta .gka-src { display: inline-flex; align-items: center; gap: 4px; }
.gka-meta .gka-src .icon { width: 12px; height: 12px; }
.gka-fb { margin-inline-start: auto; display: inline-flex; gap: 2px; align-items: center; }
.gka-fb button { width: 26px; height: 26px; border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.gka-fb button .icon { width: 14px; height: 14px; }
.gka-fb button:hover, .gka-fb button:focus-visible { color: var(--gold-ink); border-color: var(--line); }
.gka-fb button[aria-pressed="true"] { color: var(--on-gold); background: var(--grad-gold); }
.gka-cta { margin-top: 8px; display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: .8rem; font-weight: 700; padding: 6px 12px; border-radius: 999px; cursor: pointer;
  color: var(--gold-ink); background: var(--gold-soft); border: 1px solid var(--gold-3); }
[data-theme="dark"] .gka-cta { color: var(--gold-2); background: color-mix(in srgb, var(--gold) 12%, transparent); }
.gka-cta .icon { width: 14px; height: 14px; }

.gka-typing .gka-bubble { display: inline-flex; gap: 5px; align-items: center; padding: 14px 16px; }
.gka-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); opacity: .35; animation: gkaDot 1.2s infinite; }
.gka-typing i:nth-child(2) { animation-delay: .15s; } .gka-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes gkaDot { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.gka-handoff { padding: 14px 16px; border-top: 1px solid var(--line); background: var(--surface-2); display: grid; gap: 10px; }
.gka-handoff[hidden] { display: none; }
.gka-handoff h4 { margin: 0; font-size: .92rem; display: flex; align-items: center; gap: 8px; }
.gka-handoff p { margin: 0; font-size: .8rem; color: var(--muted); }
.gka-handoff .input, .gka-handoff .textarea { min-height: 40px; font-size: .88rem; }
.gka-handoff .row { gap: 8px; }

.gka-foot { border-top: 1px solid var(--line); background: var(--surface); padding: 10px 12px 10px; }
.gka-composer { display: flex; gap: 8px; align-items: flex-end; padding: 6px; border-radius: 20px; background: var(--surface-2); border: 1px solid var(--line); transition: border-color .2s, box-shadow .2s; }
.gka-composer:focus-within { border-color: var(--gold-2); box-shadow: 0 0 0 4px color-mix(in srgb, var(--gold) 16%, transparent); }
.gka-composer textarea { flex: 1; min-width: 0; resize: none; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; font-size: .92rem; line-height: 1.7; padding: 6px 8px; max-height: 120px; }
.gka-send { flex: none; width: 40px; height: 40px; border-radius: 14px; border: 0; cursor: pointer; display: grid; place-items: center; color: var(--on-gold); background: var(--grad-gold); box-shadow: var(--shadow-gold); transition: transform .2s, opacity .2s; }
.gka-send:disabled { opacity: .45; cursor: default; box-shadow: none; }
.gka-send:not(:disabled):hover { transform: translateY(-1px); }
[dir="rtl"] .gka-send .icon { transform: scaleX(-1); }
.gka-links { display: flex; align-items: center; gap: 10px; justify-content: space-between; margin-top: 8px; font-size: .74rem; color: var(--faint); }
.gka-links > span { flex: 1; min-width: 0; text-align: end; font-size: .7rem; line-height: 1.6; }
.gka-links button, .gka-links a { white-space: nowrap; flex: none; font: inherit; font-weight: 700; color: var(--brand); background: none; border: 0; padding: 0; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; }
.gka-links .icon { width: 13px; height: 13px; }

@media (max-width: 560px) {
  .gka-panel { inset: 0; width: 100%; height: 100%; height: 100dvh; border-radius: 0; bottom: 0; inset-inline-end: 0; border: 0; }
  .gka.is-open .gka-fab { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .gka-panel, .gka-fab .gka-fab-ring, .gka-typing i { animation: none; }
}
@media print { .gka { display: none !important; } }

/* ---------------------------------------------------------------- مرکز راهنما */
.help-hero .help-search { position: relative; margin-top: 26px; max-width: 680px; }
.help-hero .help-search .input { min-height: 60px; border-radius: 999px; padding-inline: 58px 150px; font-size: 1rem; background: var(--surface); color: var(--text); border-color: transparent; box-shadow: var(--shadow-lg); }
.help-hero .help-search > .icon { position: absolute; inset-inline-start: 22px; top: 50%; transform: translateY(-50%); color: var(--gold); width: 22px; height: 22px; pointer-events: none; }
.help-hero .help-search .btn { position: absolute; inset-inline-end: 7px; top: 7px; bottom: 7px; border-radius: 999px; }
.help-hero .help-chips { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 8px; }
.help-hero .help-chips a { font-size: .8rem; color: #F4EEDF; padding: 6px 12px; border-radius: 999px; border: 1px solid rgba(232, 214, 170, .35); background: rgba(255, 255, 255, .06); }
.help-hero .help-chips a:hover { border-color: var(--gold-2); color: #FFF8E8; }
.help-tiles { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.help-tiles .iwan-card { padding-top: 30px; }
.help-tiles .iwan-card .num { font-size: .78rem; color: var(--muted); }
.help-cat { scroll-margin-top: 110px; }
.help-cat h3 { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); margin: 0 0 14px; }
.help-cat h3 .icon { color: var(--gold); }
.help-aside { display: grid; gap: 18px; }
.concierge-card { position: relative; overflow: hidden; color: #EFE9DC; background: var(--grad-brand); border: 0; }
.concierge-card h3 { color: #FFF8E8; font-family: var(--font-display); margin: 8px 0 6px; }
.concierge-card p { color: rgba(239, 233, 220, .8); font-size: .9rem; margin: 0 0 16px; line-height: 1.9; }
.concierge-card .gka-arch-sm { width: 54px; height: 62px; border-radius: 27px 27px 10px 10px; display: grid; place-items: center; border: 1px solid rgba(232, 214, 170, .45); color: var(--gold-3); }
.help-steps { counter-reset: hs; display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.help-steps li { counter-increment: hs; display: flex; gap: 12px; align-items: flex-start; font-size: .88rem; color: var(--text-2); }
.help-steps li::before { content: counter(hs); flex: none; width: 26px; height: 26px; border-radius: 9px; display: grid; place-items: center; font-weight: 800; font-size: .8rem; color: var(--on-gold); background: var(--grad-gold); }
.result-mark { background: var(--gold-soft); color: inherit; border-radius: 4px; padding: 0 2px; }

/* ---------------------------------------------------------------- گفت‌وگوی تیکت (سایت، پنل، مدیریت) */
.tk-head { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; }
.tk-code { font-family: var(--font-serif); letter-spacing: .08em; font-weight: 700; direction: ltr; unicode-bidi: isolate; }
.tk-thread { display: flex; flex-direction: column; gap: 18px; padding: 22px; }
.tk-msg { display: flex; gap: 12px; align-items: flex-start; max-width: 860px; }
.tk-msg .tk-av { flex: none; width: 40px; height: 40px; border-radius: 14px; overflow: hidden; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); border: 1px solid var(--line); }
.tk-msg .tk-av img { width: 100%; height: 100%; object-fit: cover; }
.tk-msg.is-staff .tk-av { background: var(--grad-brand); color: var(--gold-3); border-color: transparent; }
.tk-card { flex: 1; min-width: 0; border-radius: 6px var(--radius) var(--radius) var(--radius); background: var(--surface-2); border: 1px solid var(--line); padding: 12px 16px; }
[dir="rtl"] .tk-card { border-radius: var(--radius) 6px var(--radius) var(--radius); }
.tk-msg.is-staff .tk-card { background: var(--surface); border-color: color-mix(in srgb, var(--gold) 38%, var(--line)); box-shadow: var(--shadow-xs); }
.tk-msg.is-internal .tk-card { background: var(--warn-soft); border-style: dashed; border-color: var(--warn); }
[data-theme="dark"] .tk-msg.is-internal .tk-card { background: color-mix(in srgb, var(--warn) 14%, transparent); }
.tk-by { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-size: .8rem; color: var(--muted); margin-bottom: 6px; }
.tk-by strong { color: var(--text); font-size: .88rem; }
.tk-body { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 2; font-size: .93rem; color: var(--text); }
.tk-file { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; font-size: .82rem; padding: 6px 10px; border-radius: 10px; background: var(--surface-3); border: 1px solid var(--line); color: var(--text-2); }
.tk-reply { border-top: 1px solid var(--line); padding: 18px 22px; background: var(--surface); }
.tk-reply .textarea { min-height: 120px; }
.tk-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 12px; }
.tk-tools .grow { flex: 1; }
.tk-closed { text-align: center; padding: 22px; color: var(--muted); border-top: 1px solid var(--line); }

.sla { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 700; white-space: nowrap; }
.sla .icon { width: 14px; height: 14px; }
.sla-ok { color: var(--ok); } .sla-warn { color: var(--warn); } .sla-breach { color: var(--bad); } .sla-none { color: var(--faint); font-weight: 500; }
.sla-bar { height: 4px; border-radius: 4px; background: var(--surface-3); overflow: hidden; margin-top: 4px; width: 90px; }
.sla-bar > i { display: block; height: 100%; border-radius: inherit; background: currentColor; }
.tk-row-summary { display: block; font-size: .78rem; color: var(--muted); margin-top: 2px; max-width: 420px; }
.tk-list-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--line); color: inherit; transition: background .2s; }
.tk-list-item:last-child { border-bottom: 0; }
.tk-list-item:hover { background: var(--surface-2); color: inherit; }
.tk-list-item .tk-ic { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.tk-list-item h3 { margin: 0; font-size: .98rem; }
.tk-list-item .tk-sub { font-size: .8rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 4px; }
.tk-list-item.is-unread .tk-ic { background: var(--grad-gold); color: var(--on-gold); }
@media (max-width: 640px) { .tk-list-item { grid-template-columns: auto minmax(0, 1fr); } .tk-list-item > :last-child { grid-column: 2; } .tk-thread, .tk-reply { padding: 14px; } }

.stars { display: inline-flex; gap: 4px; direction: ltr; }
.stars-input { display: inline-flex; flex-direction: row-reverse; gap: 4px; direction: ltr; }
.stars-input input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.stars-input label { cursor: pointer; color: var(--line-strong); }
.stars-input label .icon { width: 28px; height: 28px; }
.stars-input input:checked ~ label, .stars-input label:hover, .stars-input label:hover ~ label { color: var(--gold); }
.stars-input input:checked ~ label .icon, .stars-input label:hover .icon, .stars-input label:hover ~ label .icon { fill: currentColor; }
.stars-input input:focus-visible + label { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 6px; }
.star-on { color: var(--gold); } .star-on .icon { fill: currentColor; } .star-off { color: var(--line-strong); }

/* ---------------------------------------------------------------- مدیریت دستیار */
.insight { border-radius: var(--radius); padding: 14px 16px; background: linear-gradient(135deg, var(--gold-soft), transparent 70%), var(--surface); border: 1px solid color-mix(in srgb, var(--gold) 40%, var(--line)); }
[data-theme="dark"] .insight { background: linear-gradient(135deg, color-mix(in srgb, var(--gold) 12%, transparent), transparent 70%), var(--surface); }
.insight .eyebrow { margin-bottom: 6px; }
.insight p { margin: 0; line-height: 1.9; }
.chat-log { border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); overflow: hidden; }
.chat-log + .chat-log { margin-top: 10px; }
.chat-log > summary { list-style: none; cursor: pointer; padding: 12px 16px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.chat-log > summary::-webkit-details-marker { display: none; }
.chat-log > summary:hover { background: var(--surface-2); }
.chat-log[open] > summary { border-bottom: 1px solid var(--line); background: var(--surface-2); }
.chat-log .cl-q { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-log .cl-meta { font-size: .76rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 2px; }
.chat-log .cl-body { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; max-height: 460px; overflow-y: auto; }
.console-out { min-height: 120px; border-radius: var(--radius); border: 1px dashed var(--line-strong); padding: 14px 16px; background: var(--surface-2); }
.console-out .gka-bubble { max-width: 100%; }
.canned-row { display: grid; grid-template-columns: 200px minmax(0, 1fr) auto; gap: 10px; align-items: start; }
@media (max-width: 720px) { .canned-row { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- مستندات API */
.apidoc { max-width: 1100px; margin: 0 auto; padding: 32px 16px 80px; }
.apidoc .ep { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin-bottom: 12px; overflow: hidden; }
.apidoc .ep > summary { list-style: none; cursor: pointer; display: flex; gap: 12px; align-items: center; padding: 12px 16px; flex-wrap: wrap; }
.apidoc .ep > summary::-webkit-details-marker { display: none; }
.apidoc .ep[open] > summary { border-bottom: 1px solid var(--line); background: var(--surface-2); }
.apidoc .verb { font: 700 .74rem/1 ui-monospace, Consolas, monospace; padding: 6px 8px; border-radius: 8px; min-width: 52px; text-align: center; color: #fff; }
.apidoc .verb-get { background: var(--info); } .apidoc .verb-post { background: var(--ok); } .apidoc .verb-delete { background: var(--bad); }
.apidoc .path { font: 600 .9rem ui-monospace, Consolas, monospace; direction: ltr; }
.apidoc .ep-body { padding: 14px 16px; display: grid; gap: 12px; }
.apidoc pre { margin: 0; direction: ltr; text-align: left; overflow-x: auto; font: .8rem/1.6 ui-monospace, Consolas, monospace; padding: 12px 14px; border-radius: 12px; background: var(--surface-3); border: 1px solid var(--line); color: var(--text); white-space: pre; }
.apidoc .lock { color: var(--gold-ink); display: inline-flex; gap: 4px; align-items: center; font-size: .78rem; }
