/* ==========================================================================
   excel.css — اکسل آنلاین آپ‌سئو
   ========================================================================== */
.xl-page-fix .main-container, .xl-page-fix .container.main-container { max-width: none !important; width: 100% !important; padding: 0 8px !important; margin: 0 !important; }
.xl-page-fix .main-index { padding: 0 !important; }
.xl-page-fix .upseo-main-panel { padding-top: 8px; }
.xl-app { --g: #107c41; --g2: #0b5a2e; --gl: #e6f3ec; --bd: #d6d6d6; --bg: #f3f3f3; --tx: #222; position: relative; display: flex; flex-direction: column; height: calc(100vh - 18px); min-height: 520px; background: #fff; border: 1px solid var(--bd); border-radius: 10px; overflow: hidden; font-family: 'YekanBakhFaNum-Light', Tahoma, 'Segoe UI', sans-serif; font-size: 13px; color: var(--tx); direction: rtl; box-sizing: border-box; }
.xl-app *, .xl-app *::before, .xl-app *::after { box-sizing: border-box; }
.xl-app button { font-family: inherit; cursor: pointer; }
.xl-app.xl-full { position: fixed; inset: 0; height: 100vh; z-index: 99999; border-radius: 0; }
.xl-spacer { flex: 1; }

/* نوار عنوان */
.xl-titlebar { display: flex; align-items: center; gap: 8px; background: var(--g); color: #fff; padding: 5px 10px; min-height: 40px; }
.xl-logo .lg { display: inline-flex; width: 28px; height: 28px; background: #fff; color: var(--g); border-radius: 6px; font-weight: bold; align-items: center; justify-content: center; font-size: 18px; }
.xl-doc-title { background: transparent; border: 1px solid transparent; color: #fff; font: inherit; font-size: 15px; padding: 3px 8px; border-radius: 5px; width: 220px; max-width: 40vw; }
.xl-doc-title:hover, .xl-doc-title:focus { background: rgba(255,255,255,.15); border-color: rgba(255,255,255,.4); outline: none; }
.xl-save-state { font-size: 11.5px; opacity: .85; }
.xl-save-state.err { color: #ffd2d2; }
.xl-tb-btn { background: rgba(255,255,255,.14); color: #fff; border: 0; border-radius: 6px; padding: 5px 10px; font-size: 13px; }
.xl-tb-btn:hover { background: rgba(255,255,255,.28); }
.xl-tb-btn:disabled { opacity: .45; cursor: default; }
.xl-tb-btn.ai { background: linear-gradient(135deg, #7c4dff, #00b0ff); font-weight: bold; }

/* تب‌ها */
.xl-tabs { display: flex; align-items: flex-end; background: #fff; border-bottom: 1px solid var(--bd); padding: 0 6px; overflow-x: auto; scrollbar-width: none; flex: 0 0 auto; }
.xl-tab { background: none; border: 0; padding: 7px 14px 6px; font-size: 13.5px; color: #333; border-bottom: 3px solid transparent; white-space: nowrap; }
.xl-tab:hover { background: #f0f0f0; }
.xl-tab.on { color: var(--g2); border-bottom-color: var(--g); font-weight: bold; }
.xl-tab.file { background: var(--g); color: #fff; border-radius: 6px 6px 0 0; margin-inline-end: 6px; }
.xl-tab.file:hover { background: var(--g2); }
.xl-tab.aitab { color: #6a3ed8; }
.xl-tab-col { margin-inline-start: auto; background: none; border: 0; color: #666; padding: 4px 8px; font-size: 14px; }

/* ریبون */
.xl-ribbon { display: flex; align-items: stretch; gap: 0; background: #fbfbfb; border-bottom: 1px solid var(--bd); padding: 4px 6px; overflow-x: auto; overflow-y: hidden; min-height: 92px; flex: 0 0 auto; scrollbar-width: thin; }
.xl-ribbon.collapsed { display: none; }
.xl-grp { display: flex; flex-direction: column; padding: 0 8px; border-inline-end: 1px solid #e3e3e3; flex: 0 0 auto; }
.xl-grp-b { display: flex; flex: 1; align-items: stretch; gap: 2px; flex-wrap: wrap; align-content: flex-start; max-width: 520px; }
.xl-grp-b:has(.xl-grp-row) { flex-direction: column; flex-wrap: nowrap; justify-content: center; gap: 4px; }
.xl-grp-row { display: flex; align-items: center; gap: 2px; }
.xl-grp-n { text-align: center; font-size: 11px; color: #666; padding-top: 2px; }
.xl-sub { display: flex; flex-direction: column; gap: 1px; }
.xl-vsep { width: 1px; background: #ddd; height: 22px; margin: 0 3px; }
.xl-rb { display: inline-flex; align-items: center; gap: 4px; background: transparent; border: 1px solid transparent; border-radius: 5px; padding: 3px 6px; min-width: 28px; height: 28px; color: #222; font-size: 12.5px; white-space: nowrap; justify-content: center; }
.xl-rb:hover { background: #e9f3ee; border-color: #cfe5d8; }
.xl-rb.on { background: #cde5d7; border-color: #a9d3bb; }
.xl-rb.big { flex-direction: column; height: auto; min-width: 54px; padding: 4px 6px; gap: 1px; }
.xl-rb.big .xi { font-size: 22px; line-height: 26px; }
.xl-rb .xi { font-size: 15px; line-height: 1; display: inline-block; min-width: 14px; text-align: center; }
.xl-rb .rl { font-size: 11.5px; }
.xl-rb .car { font-size: 9px; opacity: .7; }
.xl-rb.ai { color: #6a3ed8; }
.xl-rb .clr { padding-bottom: 1px; }
.xl-rsel { height: 26px; border: 1px solid #ccc; border-radius: 4px; background: #fff; font: inherit; font-size: 12px; padding: 0 3px; max-width: 160px; }

/* نوار فرمول */
.xl-formulabar { display: flex; align-items: stretch; border-bottom: 1px solid var(--bd); background: #fff; flex: 0 0 auto; }
.xl-namebox-wrap { position: relative; width: 120px; border-inline-end: 1px solid var(--bd); }
.xl-namebox { width: 100%; height: 100%; border: 0; padding: 4px 8px; font: inherit; direction: ltr; text-align: center; background: transparent; }
.xl-namebox:focus, .xl-fbar:focus { outline: 2px solid var(--g); outline-offset: -2px; }
.xl-fxbtn { border: 0; background: transparent; font-style: italic; font-weight: bold; color: #555; padding: 0 12px; border-inline-end: 1px solid var(--bd); }
.xl-fxbtn:hover { color: var(--g); }
.xl-fbar-wrap { flex: 1; display: flex; }
.xl-fbar { flex: 1; border: 0; resize: none; padding: 5px 8px; font: inherit; font-size: 13.5px; min-height: 28px; line-height: 1.5; background: #fff; overflow: hidden; direction: auto; unicode-bidi: plaintext; }
.xl-fbar-open .xl-fbar { overflow: auto; }
.xl-fbar-exp { border: 0; background: transparent; padding: 0 10px; color: #666; }

/* ناحیه اصلی */
.xl-main { flex: 1; display: flex; min-height: 0; position: relative; }
.xl-gridwrap { flex: 1; position: relative; min-width: 0; overflow: hidden; background: #fff; }
.xl-view { position: absolute; top: 0; overflow: hidden; }
.xl-cv, .xl-ov { position: absolute; top: 0; left: 0; pointer-events: none; }
.xl-layer { position: absolute; inset: 0; pointer-events: none; }
.xl-layer > * { pointer-events: auto; }
.xl-scroller { position: absolute; inset: 0; overflow: auto; outline: none; background: transparent; cursor: cell; overscroll-behavior: contain; }
.xl-sizer { width: 1px; height: 1px; pointer-events: none; }
.xl-cap { position: absolute; width: 1px; height: 1px; opacity: 0; left: 0; top: 0; border: 0; padding: 0; resize: none; z-index: -1; }
.xl-editor { position: absolute; display: none; border: 2px solid var(--g); background: #fff; padding: 1px 4px; resize: none; outline: none; z-index: 20; overflow: hidden; line-height: 1.35; box-shadow: 0 2px 8px rgba(0,0,0,.2); unicode-bidi: plaintext; pointer-events: auto; }
.xl-resize-guide { position: absolute; background: var(--g); z-index: 30; pointer-events: none; }
.xl-side { display: none; width: 360px; border-inline-start: 1px solid var(--bd); background: #fafafa; flex-direction: column; flex: 0 0 360px; }
.xl-side.open { display: flex; }

/* اشیای شناور */
.xl-float { position: absolute; background: #fff; border: 1px solid #bbb; box-shadow: 0 2px 8px rgba(0,0,0,.18); cursor: move; z-index: 10; }
.xl-float.sel { outline: 2px solid var(--g); }
.xl-float .xl-fc { width: 100%; height: 100%; overflow: hidden; pointer-events: none; }
.xl-float .xl-fh { position: absolute; bottom: -5px; width: 11px; height: 11px; background: var(--g); border: 2px solid #fff; cursor: nwse-resize; display: none; border-radius: 2px; }
.xl-rtl-sheet .xl-float .xl-fh { left: -5px; cursor: nesw-resize; }
.xl-app:not(.xl-rtl-sheet) .xl-float .xl-fh { right: -5px; }
.xl-float.sel .xl-fh { display: block; }

/* نوار برگه‌ها و وضعیت */
.xl-sheetbar { display: flex; align-items: flex-end; background: #f3f3f3; border-top: 1px solid var(--bd); padding: 0 6px; min-height: 32px; flex: 0 0 auto; }
.xl-sb-nav { display: flex; align-items: center; gap: 2px; padding: 3px 0; }
.xl-sb-nav button { border: 0; background: transparent; width: 28px; height: 26px; border-radius: 4px; font-size: 15px; }
.xl-sb-nav button:hover { background: #ddd; }
.xl-sb-tabs { display: flex; align-items: flex-end; overflow-x: auto; scrollbar-width: none; flex: 1; }
.xl-stab { padding: 6px 16px 5px; background: #e6e6e6; border: 1px solid #d0d0d0; border-bottom: 0; margin-inline-start: 2px; border-radius: 5px 5px 0 0; cursor: pointer; font-size: 12.5px; white-space: nowrap; user-select: none; }
.xl-stab.on { background: #fff; color: var(--g2); font-weight: bold; box-shadow: inset 0 -3px 0 var(--g); }
.xl-stab:hover:not(.on) { background: #efefef; }
.xl-status { display: flex; align-items: center; gap: 16px; background: #f3f3f3; border-top: 1px solid #e0e0e0; padding: 3px 12px; font-size: 12px; color: #444; flex: 0 0 auto; }
.xl-st-stats { display: flex; gap: 16px; }
.xl-st-zoom { display: flex; align-items: center; gap: 6px; direction: ltr; }
.xl-st-zoom button { border: 0; background: transparent; font-size: 16px; width: 22px; }
.xl-st-zoom input { width: 110px; accent-color: var(--g); }
.xl-st-zoom .zv { min-width: 38px; text-align: center; }

/* منوها و پاپ‌آپ‌ها */
.xl-popups { position: static; }
.xl-popup, .xl-ctx { position: fixed; z-index: 100000; background: #fff; border: 1px solid #c9c9c9; border-radius: 8px; box-shadow: 0 6px 24px rgba(0,0,0,.22); padding: 4px; min-width: 190px; max-height: 80vh; overflow-y: auto; direction: rtl; font-size: 13px; }
.xl-mi { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 5px; cursor: pointer; white-space: nowrap; position: relative; }
.xl-mi:hover { background: var(--gl); }
.xl-mi.dis { opacity: .4; cursor: default; }
.xl-mi .ic { width: 18px; text-align: center; color: var(--g); }
.xl-mi .lb { flex: 1; }
.xl-mi .ky { color: #888; font-size: 11px; direction: ltr; }
.xl-mi .sb { color: #888; }
.xl-menu-head { padding: 6px 10px 2px; font-size: 11px; color: #888; font-weight: bold; }
.xl-sep { height: 1px; background: #e5e5e5; margin: 4px 2px; }
.xl-colors { width: 232px; }
.xl-cgrid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; padding: 6px; }
.xl-cs { height: 26px; border: 1px solid #ccc; border-radius: 4px; cursor: pointer; padding: 0; }
.xl-cs:hover { outline: 2px solid var(--g); }
.xl-filter { width: 260px; }
.xl-filter .xl-in { width: calc(100% - 8px); margin: 4px; }
.xl-fvals { max-height: 200px; overflow: auto; border: 1px solid #e5e5e5; margin: 4px; padding: 4px; }
.xl-fvals label { display: block; padding: 2px 4px; cursor: pointer; }
.xl-fbtn { display: flex; gap: 6px; padding: 4px; justify-content: flex-end; }
.xl-ac { position: fixed; z-index: 100001; background: #fff; border: 1px solid #bbb; border-radius: 6px; box-shadow: 0 4px 16px rgba(0,0,0,.2); min-width: 260px; max-height: 260px; overflow: auto; direction: ltr; }
.xl-ac-i { padding: 4px 10px; cursor: pointer; display: flex; justify-content: space-between; gap: 16px; }
.xl-ac-i small { color: #777; direction: rtl; }
.xl-ac-i.on, .xl-ac-i:hover { background: var(--gl); }
.xl-hint { z-index: 100001; background: #fffbe6; border: 1px solid #e6d98c; border-radius: 6px; padding: 4px 10px; font-size: 12px; box-shadow: 0 2px 8px rgba(0,0,0,.15); direction: rtl; }
.xl-hint em { color: var(--g2); font-style: normal; }
.xl-note-tip { position: absolute; z-index: 40; background: #ffffe1; border: 1px solid #999; padding: 6px 10px; max-width: 280px; font-size: 12px; box-shadow: 2px 2px 6px rgba(0,0,0,.25); pointer-events: none; white-space: pre-wrap; display: none; }
.xl-toast { position: absolute; bottom: 48px; left: 50%; transform: translateX(-50%) translateY(20px); background: #323232; color: #fff; padding: 8px 18px; border-radius: 8px; opacity: 0; transition: .25s; pointer-events: none; z-index: 100002; font-size: 13px; }
.xl-toast.show { opacity: .96; transform: translateX(-50%) translateY(0); }
.xl-toast.warn { background: #b3261e; }

/* دیالوگ */
.xl-modal { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 100010; display: flex; align-items: flex-start; justify-content: center; padding-top: 8vh; }
.xl-dlg { background: #fff; border-radius: 10px; width: 420px; max-width: 94vw; max-height: 84vh; display: flex; flex-direction: column; box-shadow: 0 12px 40px rgba(0,0,0,.35); direction: rtl; }
.xl-dlg-h { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid #e5e5e5; font-weight: bold; font-size: 14.5px; }
.xl-x { background: transparent; border: 0; font-size: 15px; color: #666; border-radius: 4px; padding: 2px 6px; }
.xl-x:hover { background: #eee; }
.xl-dlg-b { padding: 14px 16px; overflow: auto; display: flex; flex-direction: column; gap: 8px; }
.xl-dlg-f { display: flex; gap: 8px; padding: 10px 16px; border-top: 1px solid #e5e5e5; justify-content: flex-start; }
.xl-btn { border: 1px solid #c6c6c6; background: #fff; border-radius: 6px; padding: 6px 16px; font-size: 13px; }
.xl-btn:hover { background: #f0f0f0; }
.xl-btn.primary { background: var(--g); color: #fff; border-color: var(--g); }
.xl-btn.primary:hover { background: var(--g2); }
.xl-btn:disabled { opacity: .5; cursor: default; }
.xl-in { width: 100%; padding: 6px 9px; border: 1px solid #c6c6c6; border-radius: 6px; font: inherit; background: #fff; }
.xl-in:focus { outline: 2px solid var(--g); outline-offset: -1px; border-color: var(--g); }
select.xl-in[size] { height: auto; }
.xl-fl { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: #444; }
.xl-rad { display: flex; align-items: center; gap: 6px; padding: 3px 0; cursor: pointer; }
.xl-two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.xl-tabs2 { display: flex; gap: 2px; border-bottom: 1px solid #ddd; margin-bottom: 6px; }
.xl-tabs2 button { border: 0; background: none; padding: 6px 12px; border-bottom: 3px solid transparent; }
.xl-tabs2 button.on { border-bottom-color: var(--g); color: var(--g2); font-weight: bold; }
.xl-prev { background: #f6f6f6; border: 1px solid #e2e2e2; border-radius: 6px; padding: 8px; margin: 6px 0; min-height: 34px; }
.xl-nrow { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px dashed #e5e5e5; }
.xl-nrow b { min-width: 90px; }
.xl-nrow code { flex: 1; color: #555; overflow: hidden; text-overflow: ellipsis; }
.xl-nrow small { flex: 1; color: #777; }
.xl-sortrow { display: grid; grid-template-columns: auto 1fr 1fr; gap: 8px; align-items: center; margin: 4px 0; }
.xl-kb { width: 100%; border-collapse: collapse; }
.xl-kb td { padding: 5px 4px; border-bottom: 1px solid #eee; }
kbd { background: #f1f1f1; border: 1px solid #ccc; border-radius: 4px; padding: 1px 6px; font-size: 11.5px; }

/* جستجو */
.xl-find { position: absolute; top: 6px; inset-inline-start: 56px; z-index: 50; background: #fff; border: 1px solid #bbb; border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,.2); padding: 8px; display: flex; flex-direction: column; gap: 6px; width: 340px; }
.xl-find-r { display: flex; gap: 4px; align-items: center; }
.xl-find-r.opt { flex-wrap: wrap; font-size: 11.5px; gap: 8px; color: #444; }
.xl-find-c { font-size: 11.5px; color: #666; min-width: 54px; text-align: center; }
.xl-find .xl-btn { padding: 4px 9px; }

/* پنل هوش مصنوعی */
.xl-ai-h { display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: linear-gradient(135deg, #7c4dff, #00b0ff); color: #fff; font-weight: bold; }
.xl-ai-h .xl-x { color: #fff; margin-inline-start: auto; }
.xl-ai-credit { font-size: 11px; background: rgba(255,255,255,.25); border-radius: 10px; padding: 1px 8px; font-weight: normal; }
.xl-ai-msgs { flex: 1; overflow: auto; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.xl-ai-m { max-width: 94%; }
.xl-ai-m.user { align-self: flex-start; }
.xl-ai-m.assistant { align-self: flex-end; }
.xl-ai-m .b { padding: 8px 11px; border-radius: 10px; line-height: 1.8; font-size: 13px; word-break: break-word; }
.xl-ai-m.user .b { background: var(--g); color: #fff; border-end-start-radius: 2px; }
.xl-ai-m.assistant .b { background: #fff; border: 1px solid #e0e0e0; border-end-end-radius: 2px; }
.xl-ai-m code { background: #f1f1f1; padding: 0 4px; border-radius: 3px; font-size: 12px; }
.xl-ai-m ul { margin: 4px 0; padding-inline-start: 18px; }
.xl-ai-act { margin-top: 6px; background: #f0eafe; border: 1px solid #d9ccff; border-radius: 8px; padding: 8px; font-size: 12px; }
.xl-ai-al div { padding: 1px 0; }
.xl-ai-act .xl-btn { margin-top: 6px; width: 100%; }
.xl-ai-chips { display: flex; flex-wrap: wrap; gap: 5px; padding: 6px 10px; border-top: 1px solid #eee; max-height: 92px; overflow: auto; }
.xl-chip { border: 1px solid #d9ccff; background: #f6f2ff; color: #5a35c7; border-radius: 14px; padding: 3px 10px; font-size: 11.5px; }
.xl-chip:hover { background: #ebe3ff; }
.xl-ai-in { padding: 8px 10px; border-top: 1px solid #e0e0e0; background: #fff; }
.xl-ai-ctx { font-size: 11.5px; color: #555; display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.xl-ai-row { display: flex; gap: 6px; align-items: stretch; }
.xl-ai-row textarea { flex: 1; resize: none; border: 1px solid #c6c6c6; border-radius: 8px; padding: 6px 9px; font: inherit; }
.xl-ai-row textarea:focus { outline: 2px solid #7c4dff; border-color: #7c4dff; }
.dots i { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #7c4dff; margin: 0 1px; animation: xlb 1s infinite; }
.dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes xlb { 0%, 80%, 100% { opacity: .2; transform: scale(.7); } 40% { opacity: 1; transform: scale(1.1); } }

@media (max-width: 800px) {
  .xl-side.open { position: absolute; inset: 0; width: 100%; z-index: 60; }
  .xl-doc-title { width: 120px; }
  .xl-tb-btn { padding: 4px 7px; }
}
@media print { .xl-app > :not(.xl-main) { display: none; } }
