@font-face {
  font-family: "Vazirmatn";
  src: url("../fonts/Vazirmatn.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --ink: #0B2A2E;
  --ink-2: #12393D;
  --ink-3: #1D5A57;
  --gold: #E3A23B;
  --gold-2: #F2D49B;
  --teal: #146B66;
  --rose: #e05d5d;
  --bg: #F4F6F5;
  --card: #ffffff;
  --line: #DCE3E1;
  --text: #1d2635;
  --muted: #6b7486;
  --radius: 16px;
  --shadow: 0 10px 30px -12px rgba(14, 26, 43, .18);
  --shadow-lg: 0 30px 60px -20px rgba(14, 26, 43, .35);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Vazirmatn", Tahoma, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.8;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
.ltr { direction: ltr; unicode-bidi: plaintext; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }

/* ---------- دکمه‌ها و فرم ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 12px; padding: 10px 20px; cursor: pointer;
  font-weight: 600; transition: transform .15s, box-shadow .2s, background .2s; white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-gold { background: linear-gradient(135deg, var(--gold), #C98A22); color: #1b1407; box-shadow: 0 8px 20px -8px rgba(227,162,59,.7); }
.btn-gold:hover { box-shadow: 0 12px 24px -8px rgba(227,162,59,.9); }
.btn-ink { background: var(--ink); color: #fff; }
.btn-ink:hover { background: var(--ink-3); }
.btn-ghost { background: transparent; border: 1px solid var(--line); }
.btn-ghost:hover { background: #fff; }
.btn-light { background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.25); }
.btn-light:hover { background: rgba(255,255,255,.2); }
.btn-danger { background: #fde8e8; color: #b42318; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 9px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.input, select.input, textarea.input {
  width: 100%; border: 1px solid var(--line); background: #fff; border-radius: 11px;
  padding: 10px 14px; outline: none; transition: border .2s, box-shadow .2s;
}
.input:focus { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(227,162,59,.15); }
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; font-weight: 500; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { width: 40px; height: 22px; appearance: none; background: #d6d1c4; border-radius: 30px; position: relative; cursor: pointer; transition: .2s; }
.switch input::after { content: ""; position: absolute; top: 3px; right: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: .2s; }
.switch input:checked { background: var(--teal); }
.switch input:checked::after { right: 21px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.badge { white-space: nowrap; display: inline-block; padding: 2px 10px; border-radius: 30px; font-size: 12px; font-weight: 600; background: #eee9dd; color: #5d5440; }
.badge.ok { background: #e3f4ef; color: #17725f; }
.badge.warn { background: #fff4dc; color: #8a5a00; }
.badge.err { background: #fde8e8; color: #b42318; }
.badge.info { background: #e6eefb; color: #2350a0; }

/* ---------- نوار بالا ---------- */
.nav {
  position: sticky; top: 0; z-index: 50; display: flex; align-items: center; justify-content: space-between;
  padding: 12px 5vw; background: rgba(14,26,43,.86); backdrop-filter: blur(12px); color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--gold), #9b6b17); color: var(--ink); font-size: 18px;
}
.nav-links { display: flex; gap: 6px; align-items: center; }
.nav-links a { padding: 7px 14px; border-radius: 10px; opacity: .85; font-size: 14px; }
.nav-links a:hover, .nav-links a.active { background: rgba(255,255,255,.1); opacity: 1; }

/* ---------- اسلایدر صفحه اصلی ---------- */
.hero { position: relative; background: var(--ink); color: #fff; overflow: hidden; }
.slides { position: relative; height: min(620px, 82vh); min-height: 520px; }
.slide {
  position: absolute; inset: 0; display: grid; grid-template-columns: 1.1fr .9fr; align-items: center;
  gap: 40px; padding: 0 7vw; opacity: 0; visibility: hidden; transition: opacity .9s ease, visibility .9s;
}
.slide.active { opacity: 1; visibility: visible; }
.slide-bg { position: absolute; inset: 0; z-index: 0; }
.slide-bg img { width: 100%; height: 100%; object-fit: cover; opacity: .35; }
.slide > *:not(.slide-bg) { position: relative; z-index: 1; }
.slide .eyebrow { color: var(--gold-2); font-weight: 700; letter-spacing: .5px; font-size: 14px; margin-bottom: 10px; display: inline-flex; gap: 8px; align-items: center; }
.slide .eyebrow::before { content: ""; width: 28px; height: 2px; background: var(--gold); display: inline-block; }
.slide h1 { font-size: clamp(28px, 4.2vw, 52px); line-height: 1.35; margin: 0 0 18px; font-weight: 900; }
.slide h1 em { font-style: normal; color: var(--gold-2); }
.slide p { font-size: clamp(15px, 1.4vw, 18px); opacity: .82; margin: 0 0 28px; max-width: 560px; }
.slide .art { display: grid; place-items: center; }
.slide .art svg { width: min(440px, 100%); height: auto; filter: drop-shadow(0 30px 40px rgba(0,0,0,.35)); }
.slide.active .text > * { animation: rise .8s both; }
.slide.active .text > *:nth-child(2) { animation-delay: .1s; }
.slide.active .text > *:nth-child(3) { animation-delay: .2s; }
.slide.active .text > *:nth-child(4) { animation-delay: .3s; }
.slide.active .art { animation: float 1.1s both; }
@keyframes rise { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@keyframes float { from { opacity: 0; transform: translateX(-30px) scale(.96); } to { opacity: 1; transform: none; } }

.hero-glow { position: absolute; width: 600px; height: 600px; border-radius: 50%; filter: blur(110px); opacity: .35; pointer-events: none; }
.slider-ctrl { position: absolute; bottom: 78px; left: 0; right: 0; display: flex; justify-content: center; align-items: center; gap: 14px; z-index: 5; }
.dots { display: flex; gap: 8px; }
.dot { width: 10px; height: 10px; border-radius: 10px; background: rgba(255,255,255,.3); border: 0; cursor: pointer; transition: .3s; padding: 0; }
.dot.active { width: 34px; background: var(--gold); }
.arrow { width: 40px; height: 40px; border-radius: 50%; border: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.06); color: #fff; cursor: pointer; font-size: 18px; }
.arrow:hover { background: rgba(255,255,255,.16); }
.progress { position: absolute; bottom: 0; right: 0; height: 3px; background: var(--gold); z-index: 5; width: 0; }

/* ---------- بخش‌های صفحه اصلی ---------- */
.section { padding: 80px 7vw; }
.section-head { text-align: center; max-width: 680px; margin: 0 auto 46px; }
.section-head h2 { font-size: clamp(24px, 3vw, 34px); margin: 0 0 10px; font-weight: 900; }
.section-head p { color: var(--muted); margin: 0; }
.stats-band { margin: -54px 7vw 0; position: relative; z-index: 10; display: grid; grid-template-columns: repeat(4, 1fr); padding: 26px; }
.stat { text-align: center; border-left: 1px solid var(--line); }
.stat:last-child { border-left: 0; }
.stat b { display: block; font-size: 30px; font-weight: 900; color: var(--ink); }
.stat span { color: var(--muted); font-size: 13px; }
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.feature { padding: 28px; transition: transform .25s, box-shadow .25s; }
.feature:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); }
.feature .ic { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; font-size: 24px; margin-bottom: 16px; }
.feature h3 { margin: 0 0 8px; font-size: 18px; }
.feature p { margin: 0; color: var(--muted); font-size: 14px; }
.langs { display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; }
.lang-pill { padding: 14px 26px; font-size: 20px; font-weight: 700; display: flex; gap: 12px; align-items: center; }
.lang-pill small { font-size: 12px; color: var(--muted); font-weight: 500; }
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; counter-reset: s; }
.step { padding: 24px; position: relative; }
.step::before { counter-increment: s; content: counter(s, persian); position: absolute; top: -16px; right: 22px; width: 34px; height: 34px; border-radius: 50%; background: var(--ink); color: var(--gold-2); display: grid; place-items: center; font-weight: 800; }
.step h4 { margin: 8px 0 6px; }
.step p { margin: 0; font-size: 14px; color: var(--muted); }
.cta { background: linear-gradient(135deg, var(--ink), var(--ink-3)); color: #fff; border-radius: 26px; padding: 50px; display: flex; justify-content: space-between; align-items: center; gap: 30px; flex-wrap: wrap; }
.cta h2 { margin: 0 0 8px; }
footer { padding: 30px 7vw; color: var(--muted); font-size: 13px; text-align: center; border-top: 1px solid var(--line); }

/* ---------- ورود ---------- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-side { background: var(--ink); color: #fff; padding: 60px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-form { display: grid; place-items: center; padding: 40px; }
.auth-box { width: min(400px, 100%); }
.tabs { display: flex; background: #ece7db; border-radius: 12px; padding: 4px; margin-bottom: 24px; }
.tabs button { flex: 1; border: 0; background: transparent; padding: 9px; border-radius: 9px; cursor: pointer; font-weight: 600; color: var(--muted); }
.tabs button.active { background: #fff; color: var(--text); box-shadow: 0 2px 8px rgba(0,0,0,.06); }

/* ---------- چت ---------- */
.app { display: grid; grid-template-columns: 290px 1fr; height: 100vh; }
.sidebar { background: var(--ink); color: #dfe6f1; display: flex; flex-direction: column; min-height: 0; }
.sidebar .top { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.conv-list { flex: 1; overflow-y: auto; padding: 0 10px 10px; }
.conv { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 10px; cursor: pointer; font-size: 14px; color: #c5cfdd; }
.conv:hover { background: rgba(255,255,255,.06); }
.conv.active { background: rgba(227,162,59,.16); color: #fff; }
.conv .t { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.conv .x { opacity: 0; border: 0; background: none; color: #f2a4a4; cursor: pointer; }
.conv:hover .x { opacity: 1; }
.side-foot { padding: 14px; border-top: 1px solid rgba(255,255,255,.08); display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.side-foot a { padding: 7px 10px; border-radius: 9px; opacity: .8; }
.side-foot a:hover { background: rgba(255,255,255,.06); opacity: 1; }
.main { display: flex; flex-direction: column; min-height: 0; min-width: 0; overflow-x: hidden; }
.chat-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 24px; border-bottom: 1px solid var(--line); background: #fbfaf6; flex-wrap: wrap; }
.provider-pick { display: flex; gap: 6px; background: #efebe1; padding: 4px; border-radius: 12px; }
.provider-pick button { border: 0; background: transparent; padding: 6px 14px; border-radius: 9px; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.provider-pick button.active { background: #fff; color: var(--text); box-shadow: 0 2px 6px rgba(0,0,0,.08); }
.provider-pick button:disabled { opacity: .4; cursor: not-allowed; }
.provider-pick .led { width: 7px; height: 7px; border-radius: 50%; background: #bbb; }
.provider-pick .led.on { background: #22b07d; }
.messages { flex: 1; overflow-y: auto; padding: 30px max(24px, calc((100% - 860px) / 2)); scroll-behavior: smooth; }
.msg { display: flex; gap: 14px; margin-bottom: 26px; }
.avatar { width: 36px; height: 36px; border-radius: 11px; flex-shrink: 0; display: grid; place-items: center; font-weight: 800; }
.msg.user .avatar { background: #e8e2d3; color: var(--ink); }
.msg.assistant .avatar { background: var(--ink); color: var(--gold); }
.bubble { flex: 1; min-width: 0; }
.msg.user .bubble .content { background: #fff; border: 1px solid var(--line); padding: 12px 16px; border-radius: 4px 16px 16px 16px; display: inline-block; max-width: 100%; white-space: pre-wrap; }
.content { unicode-bidi: plaintext; text-align: start; overflow-wrap: anywhere; }
.content p { margin: 0 0 10px; }
.content pre { background: #0e1a2b; color: #e8eef7; padding: 12px; border-radius: 10px; overflow-x: auto; direction: ltr; }
.content table { border-collapse: collapse; margin: 10px 0; }
.content td, .content th { border: 1px solid var(--line); padding: 6px 10px; }
.content blockquote { margin: 8px 0; padding: 6px 14px; border-right: 3px solid var(--gold); background: #faf6ec; border-radius: 6px; }
.cite { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 6px; background: #f3e6c4; color: #7a5410; font-size: 11px; font-weight: 800; cursor: pointer; vertical-align: 2px; margin: 0 1px; border: 0; }
.cite:hover { background: var(--gold); color: #fff; }
.status-line { color: var(--muted); font-size: 13px; display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.spinner { width: 14px; height: 14px; border: 2px solid #ddd3bd; border-top-color: var(--gold); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.caret::after { content: "▍"; animation: blink 1s infinite; color: var(--gold); }
@keyframes blink { 50% { opacity: 0; } }
.sources { margin-top: 14px; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.src { padding: 11px 13px; border-radius: 12px; border: 1px solid var(--line); background: #fff; cursor: pointer; transition: .2s; font-size: 13px; position: relative; }
.src:hover { border-color: var(--gold); transform: translateY(-2px); box-shadow: var(--shadow); }
.src.cited { border-color: #e9cf8d; background: #fffbf1; }
.src .n { position: absolute; top: 10px; left: 10px; }
.src .title { font-weight: 700; padding-left: 30px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; unicode-bidi: plaintext; }
.src .meta { color: var(--muted); font-size: 12px; margin-top: 4px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.src.knowledge { border-style: dashed; border-color: var(--teal); }
.msg-actions { display: flex; gap: 6px; margin-top: 10px; }
.icon-btn { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 3px 10px; cursor: pointer; font-size: 13px; color: var(--muted); }
.icon-btn:hover { color: var(--text); border-color: #cfc6b2; }
.icon-btn.on { background: #e3f4ef; color: #17725f; border-color: #b5e2d4; }
.icon-btn.off { background: #fde8e8; color: #b42318; border-color: #f4c2c2; }
.composer { padding: 14px max(24px, calc((100% - 860px) / 2)) 20px; }
.composer-box { display: flex; gap: 10px; align-items: flex-end; background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 10px 10px 10px 10px; box-shadow: var(--shadow); }
.composer-box:focus-within { border-color: var(--gold); }
.composer textarea { flex: 1; border: 0; outline: 0; resize: none; max-height: 200px; padding: 8px 6px; background: transparent; unicode-bidi: plaintext; }
.send { width: 44px; height: 44px; border-radius: 13px; padding: 0; font-size: 18px; transform: scaleX(-1); }
.filter-chip { display: inline-flex; gap: 6px; align-items: center; background: #efe8d6; border-radius: 30px; padding: 3px 10px; font-size: 12px; margin: 0 0 8px 6px; }
.empty-state { text-align: center; padding: 8vh 20px 0; }
.empty-state h2 { margin: 16px 0 6px; font-weight: 900; }
.suggestions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; max-width: 680px; margin: 26px auto 0; }
.suggestions button { text-align: start; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px; cursor: pointer; transition: .2s; unicode-bidi: plaintext; }
.suggestions button:hover { border-color: var(--gold); transform: translateY(-2px); }

/* ---------- بسته‌ها و پرداخت ---------- */
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.plan { padding: 18px; text-align: center; transition: .2s; }
.plan:hover { border-color: var(--gold); transform: translateY(-3px); }
.plan-name { font-weight: 800; font-size: 16px; }
.plan-price { font-size: 26px; font-weight: 900; color: var(--ink); margin: 6px 0; }
.plan-price small { font-size: 13px; color: var(--muted); font-weight: 500; }
.card-num { font-size: 22px; font-weight: 800; letter-spacing: 2px; background: #fff; border: 1px dashed var(--gold); border-radius: 12px; padding: 10px 14px; display: flex; justify-content: space-between; align-items: center; margin: 6px 0; }
.model-row { display: grid; grid-template-columns: 1.1fr 1fr 1.3fr .6fr auto; gap: 8px; align-items: center; margin-bottom: 8px; }
@media (max-width: 700px) { .model-row { grid-template-columns: 1fr 1fr; } }

/* ---------- مودال ---------- */
.modal { position: fixed; inset: 0; background: rgba(10,18,30,.55); backdrop-filter: blur(4px); display: grid; place-items: center; z-index: 100; padding: 20px; animation: fade .2s; }
.modal-card { background: #fff; border-radius: 20px; width: min(900px, 100%); max-height: 90vh; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); overflow: hidden; }
.modal-head { padding: 16px 22px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.page-preview { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.page-preview img { border: 1px solid var(--line); border-radius: 10px; width: 100%; background: #fff; }
.page-text { white-space: pre-wrap; unicode-bidi: plaintext; font-size: 14px; background: #faf8f2; padding: 14px; border-radius: 10px; max-height: 60vh; overflow-y: auto; }
mark { background: #f7e1a6; padding: 0 2px; border-radius: 3px; }
@keyframes fade { from { opacity: 0; } }

/* ---------- toast ---------- */
#toasts { position: fixed; bottom: 22px; left: 22px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 12px; box-shadow: var(--shadow-lg); font-size: 14px; animation: rise .3s; max-width: 380px; }
.toast.err { background: #8f1d1d; }
.toast.ok { background: #145c4c; }

/* ---------- پنل مدیریت ---------- */
.admin { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.admin .sidebar { position: sticky; top: 0; height: 100vh; }
.admin-nav { padding: 8px 12px; display: flex; flex-direction: column; gap: 3px; flex: 1; overflow-y: auto; }
.admin-nav button { text-align: start; border: 0; background: none; color: #c5cfdd; padding: 10px 14px; border-radius: 10px; cursor: pointer; display: flex; gap: 10px; align-items: center; font-size: 14px; }
.admin-nav button:hover { background: rgba(255,255,255,.06); }
.admin-nav button.active { background: rgba(227,162,59,.16); color: #fff; }
.admin-nav .cnt { margin-inline-start: auto; background: var(--gold); color: var(--ink); border-radius: 20px; font-size: 11px; padding: 0 7px; font-weight: 800; }
.admin-main { padding: 26px 32px 60px; min-width: 0; }
.page-title { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 22px; flex-wrap: wrap; }
.page-title h1 { margin: 0; font-size: 24px; font-weight: 900; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { padding: 18px; position: relative; overflow: hidden; }
.kpi .lbl { color: var(--muted); font-size: 13px; }
.kpi .val { font-size: 28px; font-weight: 900; color: var(--ink); line-height: 1.4; }
.kpi .sub { font-size: 12px; color: var(--muted); }
.kpi::after { content: ""; position: absolute; left: -20px; bottom: -20px; width: 70px; height: 70px; border-radius: 50%; background: var(--accent, #f3e6c4); opacity: .55; }
.charts { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; margin-bottom: 16px; }
.panel { padding: 20px; min-width: 0; }
.panel h3 { margin: 0 0 14px; font-size: 16px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.chart-box { position: relative; height: 260px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: start; color: var(--muted); font-weight: 600; font-size: 12px; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 11px 12px; border-bottom: 1px solid #f0ece2; vertical-align: top; }
.tbl tr:hover td { background: #fcfaf5; }
.tbl .q { unicode-bidi: plaintext; max-width: 420px; }
.table-wrap { overflow-x: auto; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.toolbar .input { width: auto; min-width: 140px; }
.pager { display: flex; gap: 8px; justify-content: center; margin-top: 16px; align-items: center; }
.kw-cloud { display: flex; flex-wrap: wrap; gap: 8px; }
.kw-cloud span { background: #f2ecdd; border-radius: 30px; padding: 3px 12px; unicode-bidi: plaintext; }
.bar-list { display: flex; flex-direction: column; gap: 10px; }
.bar-item .lab { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; gap: 10px; }
.bar-item .lab span:first-child { unicode-bidi: plaintext; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-item .track { height: 8px; background: #f1ede3; border-radius: 10px; overflow: hidden; }
.bar-item .fill { height: 100%; background: linear-gradient(90deg, var(--gold), var(--teal)); border-radius: 10px; }
.dropzone { border: 2px dashed #d7cdb5; border-radius: 16px; padding: 34px; text-align: center; cursor: pointer; transition: .2s; background: #fdfbf6; }
.dropzone.over, .dropzone:hover { border-color: var(--gold); background: #fff8e6; }
.insight-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.insight-card { padding: 18px; }
.insight-card h4 { margin: 0 0 6px; }
.insight-card .why { background: #f7f3ea; border-radius: 10px; padding: 10px 12px; font-size: 13px; margin-top: 8px; }
.ev { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ev span { font-size: 12px; background: #eef2f8; border-radius: 6px; padding: 2px 8px; unicode-bidi: plaintext; }
.goal-share { height: 6px; border-radius: 10px; background: #f1ede3; margin-top: 8px; overflow: hidden; }
.goal-share div { height: 100%; background: var(--teal); }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 16px; }
.prov-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.prov-logo { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; font-weight: 900; color: #fff; }
.test-out { font-size: 12px; margin-top: 8px; padding: 8px 10px; border-radius: 8px; background: #f5f2ea; white-space: pre-wrap; direction: ltr; text-align: left; }
.kn-item { padding: 16px; margin-bottom: 12px; }
.kn-item .qq { font-weight: 700; unicode-bidi: plaintext; }
.kn-item .aa { margin-top: 6px; white-space: pre-wrap; unicode-bidi: plaintext; font-size: 14px; color: #3a4456; max-height: 160px; overflow: auto; }
.menu-toggle { display: none; }

/* ---------- واکنش‌گرا ---------- */
@media (max-width: 960px) {
  .slide { grid-template-columns: 1fr; text-align: center; padding: 60px 6vw 90px; align-content: center; }
  .slide .art { display: none; }
  .slide p { margin-inline: auto; }
  .slide .eyebrow::before { display: none; }
  .features, .steps { grid-template-columns: 1fr 1fr; }
  .stats-band { grid-template-columns: 1fr 1fr; gap: 16px; }
  .stat:nth-child(2) { border-left: 0; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .charts, .insight-grid, .page-preview, .acc-grid { grid-template-columns: 1fr !important; }
  .app, .admin { grid-template-columns: 1fr; }
  .sidebar { position: fixed !important; top: 0; bottom: 0; right: 0; width: 280px; height: 100vh; z-index: 90; transform: translateX(105%); transition: transform .3s; }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .menu-toggle { display: inline-flex; }
  .admin-main { padding: 18px 16px 60px; }
  .suggestions { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .chat-head { padding: 8px 10px; gap: 8px; }
  .chat-head > .row { flex-wrap: nowrap; min-width: 0; gap: 6px; }
  .chat-head > .row:first-child { width: 100%; order: 2; }
  .chat-head > .row:last-child { width: 100%; justify-content: space-between; }
  .provider-pick { overflow-x: auto; flex: 1; min-width: 0; scrollbar-width: none; }
  .provider-pick button { padding: 5px 9px; font-size: 12px; white-space: nowrap; }
  #filterLbl { display: none; }
  .messages { padding: 18px 12px; }
  .msg { gap: 8px; }
  .avatar { width: 30px; height: 30px; border-radius: 9px; font-size: 13px; }
  .sources { grid-template-columns: 1fr 1fr; gap: 6px; }
  .src { padding: 8px 9px; font-size: 12px; }
  .src .title { padding-left: 22px; }
  .src .badge.info { display: none; }
  .composer { padding: 8px 10px 12px; }
  .composer .small { display: none; }
  .kpi .val { font-size: 22px; }
  .features, .steps { grid-template-columns: 1fr; }
  .nav-links a.hide-sm { display: none; }
  .section { padding: 60px 5vw; }
  .cta { padding: 30px; }
}

.contrib-bar { height: 10px; border-radius: 10px; background: #eef1ec; overflow: hidden; }
.contrib-bar > div { height: 100%; background: linear-gradient(90deg, var(--gold), var(--teal)); border-radius: 10px; transition: width .6s; }

.gpreview { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: #fff; font-family: Arial, Vazirmatn, sans-serif; }
.g-url { font-size: 12px; color: #4d5156; }
.g-title { color: #1a0dab; font-size: 18px; line-height: 1.5; }
.g-desc { color: #4d5156; font-size: 13.5px; line-height: 1.7; }

.kpi .btn { white-space: normal; text-align: center; line-height: 1.5; }

/* ===== نسخه ۳.۳: ورود پیامکی، کتابخانه شخصی ===== */
.otp-input { letter-spacing: .5em; text-align: center; font-size: 20px; font-weight: 700; }
.tabs button { font-size: 13px; padding: 9px 6px; }
.scope-bar { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.scope-seg { display: inline-flex; background: #e9eeec; border-radius: 999px; padding: 3px; }
.scope-seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 999px; cursor: pointer; font: inherit; font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.scope-seg button.active { background: #fff; color: var(--text); box-shadow: 0 1px 6px rgba(0,0,0,.08); }
.scope-seg button[data-scope="main"].active { color: #146B66; }
.scope-seg button[data-scope="mine"].active { color: #9a6413; }
.scope-shelf { width: auto !important; max-width: 260px; height: 36px !important; min-height: 0 !important; border-radius: 999px; padding: 0 12px !important; font-size: 13px; line-height: 34px; }
.scope-bar { flex-wrap: nowrap; }
.scope-bar .btn { white-space: nowrap; }
.scope-note { font-size: 12px; color: var(--muted); }
.shelf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin: 10px 0 16px; }
.shelf-card { border: 1px solid var(--line, #e3e6e4); border-radius: 14px; padding: 12px; background: #fff; cursor: pointer; text-align: start; font: inherit; }
.shelf-card.active { border-color: #146B66; box-shadow: 0 0 0 2px rgba(20,107,102,.15); }
.shelf-card b { display: block; margin-bottom: 2px; }
.shelf-card .small { color: var(--muted); }
.shelf-card.add { border-style: dashed; color: var(--muted); display: flex; align-items: center; justify-content: center; }
.dest-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.dest-pick label { border: 1px solid var(--line, #e3e6e4); border-radius: 14px; padding: 12px; cursor: pointer; display: block; }
.dest-pick input { margin-inline-end: 6px; }
.dest-pick label:has(input:checked) { border-color: #146B66; background: #f1f8f7; }
.topic-meta-row { display: grid; grid-template-columns: 96px 1fr auto; gap: 12px; align-items: start; padding: 12px 0; border-bottom: 1px solid var(--line, #eee); }
.topic-meta-row img, .topic-meta-row .ph { width: 96px; height: 64px; object-fit: cover; border-radius: 10px; background: #e9eeec; display: flex; align-items: center; justify-content: center; font-size: 22px; }
@media (max-width: 640px) {
  .dest-pick { grid-template-columns: 1fr; }
  .topic-meta-row { grid-template-columns: 72px 1fr; }
  .topic-meta-row img, .topic-meta-row .ph { width: 72px; height: 52px; }
  .topic-meta-row > :last-child { grid-column: 1 / -1; }
}
.scope-strip { padding: 10px 24px; border-bottom: 1px solid var(--line); background: #fff; display: flex; align-items: center; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; }
@media (max-width: 760px) { .scope-strip { padding: 8px 10px; } .scope-note { display: none; } .scope-seg button { padding: 6px 10px; } .scope-bar { flex-wrap: wrap; } .scope-shelf { max-width: 100%; flex: 1; } }
.quota-pill { display: inline-flex; align-items: center; gap: 4px; padding: 4px 12px; border-radius: 999px; background: #eef3f2; font-size: 13px; font-weight: 600; color: #24413f; }
.quota-pill.full { background: #fde8e8; color: #b42318; }
.meter { height: 5px; border-radius: 9px; background: #e9eeec; margin: 4px 0; max-width: 140px; overflow: hidden; }
.meter > div { height: 100%; background: linear-gradient(90deg, #146B66, #E3A23B); border-radius: 9px; }
@media (max-width: 600px) {
  .shelf-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .shelf-card { padding: 10px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 10px !important; }
  .kpi { padding: 14px !important; min-height: 0 !important; }
  .kpi .val { font-size: 22px !important; }
  .page-title { flex-wrap: wrap; gap: 8px; }
  .page-title .row { flex-wrap: wrap; }
  .modal-card { width: 100% !important; max-height: 92vh; }
  .modal-body .row { flex-wrap: wrap !important; }
  .toolbar { flex-wrap: wrap; }
  .toolbar .input { min-width: 0; }
}
.mode-bar { display: flex; align-items: center; gap: 6px 12px; flex-wrap: wrap; margin-bottom: 8px; }
.mode-seg { display: inline-flex; background: #e9eeec; border-radius: 999px; padding: 3px; }
.mode-seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 999px; cursor: pointer; font: inherit; font-size: 13px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.mode-seg button.active { background: #fff; color: var(--text); box-shadow: 0 1px 6px rgba(0,0,0,.08); }
.mode-seg button[data-mode="apply"].active { background: #0B2A2E; color: #E3A23B; }
.mode-hint { font-size: 12px; color: var(--muted); line-height: 1.8; }
.mode-badge { display: inline-block; font-size: 12px; font-weight: 700; color: #9a6413; background: #fbf0dc; border-radius: 999px; padding: 2px 10px; margin-bottom: 6px; }
@media (max-width: 600px) { .mode-seg button { padding: 6px 9px; font-size: 12px; } .mode-hint { flex-basis: 100%; } }
@media (max-width: 600px) { .mh-long { display: none; } .mode-hint b { font-weight: 600; } }
.icon-btn { text-decoration: none; display: inline-flex; align-items: center; }
pre.code { background: #0B2A2E; color: #E6F2EF; border-radius: 10px; padding: 12px 14px; font-size: 12.5px; line-height: 1.7; overflow-x: auto; white-space: pre-wrap; word-break: break-all; direction: ltr; text-align: left; margin: 6px 0 12px; }

@media (max-width: 600px) { .api-grid { grid-template-columns: 1fr !important; } }

.diagram { background: #fff; border: 1px solid #dde5e3; border-radius: 14px; padding: 12px; margin: 10px 0; overflow-x: auto; direction: ltr; text-align: center; }
.diagram svg { max-width: 100%; height: auto; }
.diagram .icon-btn { margin-top: 6px; direction: rtl; }
