/* codex.css — فاز ۱۰۴: تم «کدکس گلس» (طراحی ارسالی کاربر، Archive.zip)
   شیشهٔ گرافیتی روی پس‌زمینهٔ کاشی‌های سه‌بعدی مورب، تأکید مرجانی (#ff9677 → #f66c58)، متن روشن.
   این فایل آخر از همه بارگذاری می‌شود و فقط توکن‌ها و ظاهر سطح‌ها را عوض می‌کند؛ ساختار صفحه‌ها همان است.
   تم تیره همان طراحی اصلی است؛ تم روشن نسخهٔ هم‌خانوادهٔ آن (شیشهٔ سفید مات روی کاشی‌های روشن، همان رنگ مرجانی). */

/* ===================== توکن‌ها: تیره (طرح اصلی) ===================== */
:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #09090c;
  --bg-image: none;
  --bg-filter: none;
  --card-hi: rgba(93, 90, 99, 0.34);
  --card: rgba(62, 60, 68, 0.5);
  --card-lo: rgba(38, 37, 44, 0.66);
  --surface-2: rgba(255, 255, 255, 0.045);
  --surface-3: rgba(255, 255, 255, 0.085);
  --border: rgba(255, 255, 255, 0.14);
  --border-strong: rgba(255, 255, 255, 0.26);
  --input-bg: rgba(14, 14, 18, 0.55);
  --glass-blur: blur(23px) saturate(130%);
  --glass-edge: inset 0 1px 0 rgba(255, 255, 255, 0.07);
  --glass-solid: rgba(32, 31, 37, 0.96);
  --text: #f6f3f6;
  --text-muted: #b3adb9;
  --muted: #b3adb9;
  --primary: #f66c58;
  --primary-dark: #e2533f;
  --primary-light: rgba(255, 119, 95, 0.12);
  --primary-glow: rgba(246, 108, 88, 0.35);
  --accent-2: #ff9677;
  --neon: #ff8c7c;
  --neon-soft: rgba(255, 140, 124, 0.26);
  --success: #46da91;
  --warning: #f5b84a;
  --danger: #ff6b6b;
  --side-glass: linear-gradient(120deg, rgba(93, 90, 99, 0.3), rgba(38, 37, 44, 0.66));
  --side-text: #cfc9d4;
  --side-strong: #ffffff;
  --side-muted: #a39cab;
  --side-hover: rgba(255, 255, 255, 0.05);
  --side-line: rgba(255, 255, 255, 0.09);
  --shadow: inset 0 1px 0 rgba(255, 255, 255, 0.045), 0 12px 24px rgba(0, 0, 0, 0.16);
  --shadow-lift: inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 18px 34px rgba(0, 0, 0, 0.3);
  --shadow-pop: 0 24px 60px -12px rgba(0, 0, 0, 0.6);
  --overlay: rgba(4, 4, 6, 0.55);
  --radius: 17px;
  --cx-tile: linear-gradient(145deg, #555559 0%, #232326 14%, #19191c 65%, #39393e 100%);
  --cx-tile-3: linear-gradient(135deg, #17171b, #050507 70%, #303035);
  --cx-tile-7: linear-gradient(145deg, #8a8a90, #313136 22%, #18181c);
  --cx-tile-border: #656569;
  --cx-tile-shadow: inset 2px 2px 2px rgba(161, 161, 161, 0.29), inset -3px -3px 3px #000, 0 8px 0 #030305;
  --cx-scene-bg: radial-gradient(ellipse at 70% 10%, #4e4e53 0, transparent 48%), #09090c;
  --cx-scene-veil: linear-gradient(110deg, rgba(16, 16, 20, 0.13), rgba(21, 21, 28, 0) 50%, rgba(3, 3, 6, 0.38));
}

/* ===================== توکن‌ها: روشن (هم‌خانوادهٔ طرح) ===================== */
:root,
:root[data-theme='light'] {
  --bg: #ecebef;
  --bg-image: none;
  --bg-filter: none;
  --card-hi: rgba(255, 255, 255, 0.78);
  --card: rgba(255, 255, 255, 0.66);
  --card-lo: rgba(246, 245, 248, 0.72);
  --surface-2: rgba(20, 18, 26, 0.04);
  --surface-3: rgba(20, 18, 26, 0.075);
  --border: rgba(30, 26, 38, 0.12);
  --border-strong: rgba(30, 26, 38, 0.22);
  --input-bg: rgba(255, 255, 255, 0.85);
  --glass-blur: blur(23px) saturate(140%);
  --glass-edge: inset 0 1px 0 rgba(255, 255, 255, 0.95);
  --glass-solid: rgba(252, 251, 253, 0.97);
  --text: #141218;
  --text-muted: #4e4856;
  --muted: #4e4856;
  --primary: #f05c47;
  --primary-dark: #d8472f;
  --primary-light: rgba(246, 108, 88, 0.1);
  --primary-glow: rgba(246, 108, 88, 0.3);
  --accent-2: #ff8a6b;
  --neon: #f0634e;
  --neon-soft: rgba(240, 99, 78, 0.2);
  --success: #17985d;
  --warning: #c98515;
  --danger: #d93b3b;
  --side-glass: linear-gradient(120deg, rgba(255, 255, 255, 0.8), rgba(244, 242, 247, 0.7));
  --side-text: #2c2833;
  --side-strong: #0d0b10;
  --side-muted: #5c5664;
  --side-hover: rgba(20, 18, 26, 0.05);
  --side-line: rgba(20, 18, 26, 0.08);
  --shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 12px 26px -12px rgba(30, 24, 40, 0.22);
  --shadow-lift: inset 0 1px 0 rgba(255, 255, 255, 0.95), 0 20px 36px -16px rgba(30, 24, 40, 0.3);
  --radius: 17px;
  --cx-tile: linear-gradient(145deg, #ffffff 0%, #e4e3e8 14%, #d7d6dc 65%, #f1f0f4 100%);
  --cx-tile-3: linear-gradient(135deg, #dcdbe1, #c9c8cf 70%, #eceaf0);
  --cx-tile-7: linear-gradient(145deg, #ffffff, #e9e8ee 22%, #d3d2d9);
  --cx-tile-border: #ffffff;
  --cx-tile-shadow: inset 2px 2px 2px rgba(255, 255, 255, 0.9), inset -3px -3px 3px rgba(120, 116, 130, 0.25), 0 8px 0 rgba(150, 146, 160, 0.35);
  --cx-scene-bg: radial-gradient(ellipse at 70% 10%, #ffffff 0, transparent 50%), #e3e2e7;
  --cx-scene-veil: linear-gradient(110deg, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0) 50%, rgba(200, 198, 206, 0.35));
}

/* ===================== پس‌زمینه: کاشی‌های مورب سه‌بعدی ===================== */
html { background: var(--bg); }
/* فاز ۱۰۶: پس‌زمینهٔ قابل انتخاب (html[data-bg]، scene.js). لایهٔ body::before تصویر را نگه می‌دارد. */
body::before { display: none; }
html[data-bg='circuit'] body::before,
html[data-bg='neon'] body::before,
html[data-bg='custom'] body::before { display: block; filter: none; background-position: center; background-size: cover; background-repeat: no-repeat; }
html[data-bg='circuit'] body::before { background-image: url('/img/bg/circuit-dark.jpg'); }
html[data-bg='circuit'][data-theme='light'] body::before,
:root:not([data-theme='dark'])[data-bg='circuit'] body::before { background-image: url('/img/bg/circuit-light.jpg'); }
html[data-bg='neon'] body::before { background-image: url('/img/bg/bg-dark.webp'); background-position: center bottom; }
html[data-bg='neon'][data-theme='light'] body::before { background-image: url('/img/bg/bg-light.webp'); }
html[data-bg='custom'] body::before { background-image: var(--user-bg); }
html[data-bg='circuit'],
html[data-theme='dark'][data-bg='neon'] { --bg: #050506; }
html[data-theme='light'][data-bg='circuit'] { --bg: #f4f4f6; }
html:not([data-bg='tiles']) .cx-scene { display: none; }
.cx-scene {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  pointer-events: none;
  background: var(--cx-scene-bg);
}
.cx-scene::after { content: ''; position: absolute; inset: 0; background: var(--cx-scene-veil); }
.cx-tiles {
  position: absolute;
  inset: -55%;
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 12px;
  transform: rotate(-34deg) skew(8deg);
  filter: drop-shadow(0 15px 10px rgba(0, 0, 0, 0.55));
}
.cx-tile {
  min-height: 155px;
  border-radius: 15px;
  background: var(--cx-tile);
  border: 1px solid var(--cx-tile-border);
  box-shadow: var(--cx-tile-shadow);
}
.cx-tile:nth-child(3n) { background: var(--cx-tile-3); }
.cx-tile:nth-child(7n) { background: var(--cx-tile-7); }
:root[data-theme='light'] .cx-tiles { filter: drop-shadow(0 12px 10px rgba(80, 76, 90, 0.18)); }

/* ===================== سطح‌های شیشه‌ای ===================== */
.panel,
.stat-card,
.table-wrap,
.delivery-photo-card,
.kanban-col,
.chat-sidebar,
.chat-main,
.auth-card,
.lock-screen-card,
.modal,
.call-dialer-panel,
.otp-card,
.ss-col,
.ss-stat {
  background: linear-gradient(120deg, var(--card-hi), var(--card-lo));
  border: 1px solid var(--border);
  border-top-color: var(--border-strong);
  border-radius: 17px;
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--shadow);
}
.panel:hover,
.stat-card:hover { border-color: var(--border-strong); }
.deal-card,
.ss-card {
  background: linear-gradient(120deg, var(--surface-3), var(--surface-2));
  border: 1px solid var(--border);
  border-top-color: var(--border-strong);
  border-radius: 13px;
}
.sidebar {
  background: var(--side-glass) !important;
  border: 1px solid var(--border) !important;
  border-top-color: var(--border-strong) !important;
  border-radius: 17px;
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
}
thead th { background: linear-gradient(180deg, var(--surface-3), var(--surface-2)); color: var(--text); }

/* ===================== منوی کناری ===================== */
.nav-glider {
  background: linear-gradient(110deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.045));
  border: 1px solid var(--border-strong);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.08);
}
:root[data-theme='light'] .nav-glider {
  background: linear-gradient(110deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.7));
  box-shadow: 0 6px 14px -8px rgba(30, 24, 40, 0.3);
}
.nav-glider::after { background: var(--neon); box-shadow: 0 0 10px var(--neon-soft); }
.nav-item.active { color: var(--side-strong); }
.nav-item.active .ic img.ic3d { filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.35)) drop-shadow(0 0 8px var(--neon-soft)); }

/* ===================== دکمه‌ها و فیلدها ===================== */
.btn-primary,
.btn.btn-primary {
  background: linear-gradient(135deg, #ff9677, #f66c58) !important;
  border: 1px solid rgba(255, 180, 155, 0.35) !important;
  color: #fff !important;
  box-shadow: 0 3px 16px rgba(244, 110, 83, 0.13), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.btn-primary:hover { background: #ff9677 !important; }
.btn-outline {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-outline:hover { background: var(--surface-3); border-color: var(--border-strong); }
input,
select,
textarea {
  background: var(--input-bg);
  border-color: var(--border);
  color: var(--text);
}
input:focus,
select:focus,
textarea:focus { border-color: var(--neon); box-shadow: 0 0 0 3px var(--neon-soft); outline: none; }
:focus-visible { outline-color: #79d9ed; }

/* نشان‌ها و جزئیات رنگی با تأکید مرجانی */
.badge,
.nav-badge,
.chat-summary-badge { background: linear-gradient(135deg, #ff9677, #f66c58); color: #fff; }
.chat-summary-new { background: var(--neon); color: #fff; }
.softphone-chip[data-state='registered'] .sp-dot { background: #46da91; box-shadow: 0 0 9px rgba(75, 221, 145, 0.5); }

@media (prefers-reduced-motion: reduce) {
  .cx-tiles { transform: rotate(-34deg) skew(8deg); }
}
@media (max-width: 760px) {
  .cx-tile { min-height: 110px; }
}

/* دکمه‌های پایین سایدبار (جمع‌کردن، تم، پروفایل) با رنگ تأکید تم */
.tt-btn { --c: var(--neon); }
.tt-dark { --c: #ff8c7c; }
.tt-light { --c: #f5a524; }
.sb-actions .sidebar-collapse-btn,
.sb-actions .user-menu-trigger { --c: var(--neon); }
:root[data-theme='light'] .tt-btn { background: linear-gradient(145deg, #ffffff, #ebeaef); box-shadow: 4px 4px 9px rgba(30, 24, 40, 0.14), -4px -4px 9px #ffffff; }
:root[data-theme='light'] .tt-btn.active { box-shadow: inset 2px 2px 5px rgba(30, 24, 40, 0.16), inset -2px -2px 5px #fff, 0 0 0 1.5px var(--c), 0 0 16px -4px var(--c); }
:root[data-theme='light'] .theme-tray-btns { background: rgba(232, 231, 236, 0.75); box-shadow: inset 3px 3px 7px rgba(30, 24, 40, 0.12), inset -3px -3px 7px rgba(255, 255, 255, 0.95); }
:root[data-theme='light'] .sb-actions .user-menu-trigger:hover { background: linear-gradient(145deg, #ffffff, #ebeaef); }
/* دکمهٔ شناور تماس */
.call-dialer-btn { box-shadow: var(--glass-edge), 0 0 0 4px rgba(255, 140, 124, 0.06), 0 14px 32px -12px var(--neon-soft), 0 0 22px -6px var(--neon) !important; }

/* ===================== فاز ۱۰۵: نوار ابزار پایین سایدبار به سبک «منیسک» ===================== */
.sb-actions.mn-on {
  --mn-a: rgba(36, 34, 42, 0.92);
  --mn-b: rgba(18, 17, 22, 0.95);
  --mn-rim-a: rgba(190, 182, 200, 0.55);
  --mn-rim-b: rgba(96, 83, 111, 0.15);
  position: relative;
  height: 78px;
  padding: 0;
  gap: 0;
  border-top: 0;
  isolation: isolate;
  user-select: none;
  -webkit-user-select: none;
}
:root[data-theme='light'] .sb-actions.mn-on {
  --mn-a: rgba(255, 255, 255, 0.96);
  --mn-b: rgba(224, 222, 229, 0.98);
  --mn-rim-a: rgba(255, 255, 255, 1);
  --mn-rim-b: rgba(120, 112, 132, 0.4);
}
.sb-actions.mn-on .mn-surface { position: absolute; inset: 0; width: 100%; height: 78px; overflow: visible; pointer-events: none; filter: drop-shadow(0 8px 10px rgba(0, 0, 0, 0.22)); z-index: 0; }
.sb-actions.mn-on .mn-stop-a { stop-color: var(--mn-a); }
.sb-actions.mn-on .mn-stop-b { stop-color: var(--mn-b); }
.sb-actions.mn-on .mn-rim-a { stop-color: var(--mn-rim-a); }
.sb-actions.mn-on .mn-rim-b { stop-color: var(--mn-rim-b); }
.sb-actions.mn-on .mn-ambient { position: absolute; width: 120px; height: 80px; left: var(--bead-x, 50%); top: 30px; transform: translateX(-50%); background: radial-gradient(ellipse, rgba(255, 104, 81, 0.17), rgba(235, 96, 80, 0.08) 40%, transparent 70%); filter: blur(14px); pointer-events: none; z-index: -1; }
.sb-actions.mn-on .mn-bead {
  position: absolute;
  left: 0;
  top: 2px;
  width: 40px;
  height: 40px;
  border: 1.4px solid rgba(255, 192, 165, 0.67);
  border-radius: 50%;
  background: linear-gradient(140deg, #ff9d80 0%, #ff7c6b 38%, #f66a5b 80%, #df554d 100%);
  box-shadow: inset 0 2px 3px rgba(255, 211, 183, 0.33), inset 0 -3px 5px rgba(179, 62, 58, 0.22), 0 0 0 4px rgba(244, 120, 104, 0.06), 0 0 22px rgba(255, 115, 91, 0.17), 0 6px 12px rgba(0, 0, 0, 0.2);
  will-change: transform;
  pointer-events: none;
  z-index: 1;
}
.sb-actions.mn-on .mn-bead-sheen { position: absolute; inset: 3px; border-radius: inherit; background: linear-gradient(145deg, rgba(255, 255, 255, 0.13), transparent 50%); }
/* دکمه‌ها شفاف روی سطح نوار؛ آیکن روی بدنهٔ نوار می‌نشیند و گزینهٔ فعال بالا می‌رود داخل گوی */
.sb-actions.mn-on .sb-act {
  flex: 1 1 0;
  height: 78px;
  padding: 26px 0 0;
  background: transparent !important;
  box-shadow: none !important;
  border: 0 !important;
  border-radius: 0;
  position: relative;
  z-index: 2;
  color: var(--side-muted);
  transform: none !important;
}
.sb-actions.mn-on .sb-act:hover { color: var(--side-strong); }
.sb-actions.mn-on .sb-act svg,
.sb-actions.mn-on .sb-act .profile-avatar-ring { will-change: transform; transition: color 0.25s, filter 0.25s; animation: none !important; filter: none !important; }
.sb-actions.mn-on .sb-act.mn-lifted { color: #693731; }
.sb-actions.mn-on .sb-act.mn-lifted svg { filter: none !important; }
.sb-actions.mn-on .sb-act::after { bottom: calc(100% - 18px); }
.sb-actions.mn-on .sb-act:focus-visible { outline: none; }
.sb-actions.mn-on:has(.sb-act:focus-visible) .mn-bead::after { content: ''; position: absolute; inset: -5px; border-radius: 50%; border: 1px solid rgba(245, 216, 206, 0.67); }
.sb-actions.mn-on .user-menu-trigger .profile-avatar-ring { box-shadow: none; }
@media (prefers-reduced-motion: reduce) {
  .sb-actions.mn-on .sb-act svg, .sb-actions.mn-on .sb-act .profile-avatar-ring { transition: none; }
}

/* ===================== فاز ۱۰۶: تنظیمات ← پس‌زمینه ===================== */
.bg-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin: 14px 0; }
.bg-option { display: flex; flex-direction: column; align-items: stretch; gap: 6px; padding: 8px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer; text-align: right; font: inherit; transition: border-color 0.2s, transform 0.2s; }
.bg-option:hover:not(:disabled) { border-color: var(--border-strong); transform: translateY(-2px); }
.bg-option.is-active { border-color: var(--neon); box-shadow: 0 0 0 3px var(--neon-soft); }
.bg-option:disabled { opacity: 0.55; cursor: not-allowed; }
.bg-thumb { display: grid; place-items: center; height: 96px; border-radius: 10px; background: var(--surface-3) center / cover no-repeat; font-size: 26px; border: 1px solid var(--border); }
.bg-thumb-tiles { background: radial-gradient(ellipse at 70% 10%, #4e4e53 0, transparent 55%), repeating-linear-gradient(56deg, #2b2b30 0 22px, #0d0d10 22px 26px), #09090c; }
:root[data-theme='light'] .bg-thumb-tiles { background: radial-gradient(ellipse at 70% 10%, #fff 0, transparent 55%), repeating-linear-gradient(56deg, #e6e5ea 0 22px, #c9c8cf 22px 26px), #e3e2e7; }
.bg-thumb-plain { background: var(--bg); }
.bg-option-label { font-weight: 700; }
.bg-option-note { font-size: 12px; }
.bg-upload { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ۱۰۶.۲: منوی پروفایل روی چیپ تلفن و بقیهٔ سایدبار قرار بگیرد (همپوشانی نداشته باشد) */
.sb-actions { position: relative; z-index: 40; }
.sb-actions .user-menu-dropdown { z-index: 60; }
.softphone-chip.in-sidebar { position: static; flex-shrink: 0; margin: 8px 0 8px; }

/* ۱۰۶.۲: خود عکس پروفایل ثابت است؛ فقط قاب رنگی دورش می‌چرخد */
.profile-avatar-ring,
.sb-actions.mn-on .sb-act .profile-avatar-ring { background: none !important; animation: none !important; isolation: isolate; }
.profile-avatar-ring::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: 50%;
  background: conic-gradient(from 0deg, var(--neon), transparent 30%, var(--primary) 55%, transparent 80%, var(--neon));
  animation: ringSpin 6s linear infinite;
}
.profile-avatar-ring .avatar { animation: none !important; transform: none !important; }
@media (prefers-reduced-motion: reduce) { .profile-avatar-ring::before { animation: none !important; } }

/* ۱۰۶.۲: سفارش‌های سایت کادر آبی دارند؛ هشدار قرمز ۲۴ ساعته اولویت دارد */
.deal-card.deal-card-site:not(.deal-card-24h-countdown):not(.deal-card-24h-expired) {
  border: 1.5px solid #3b82f6 !important;
  border-top-width: 4px !important;
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.18), 0 6px 18px rgba(59, 130, 246, 0.16) !important;
}
.deal-card-origin {
  flex: none;
  max-width: 45%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  padding: 3px 7px;
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.deal-card-origin-site { color: #1d4ed8; background: rgba(59, 130, 246, 0.14); border-color: rgba(59, 130, 246, 0.35); }
:root[data-theme='dark'] .deal-card-origin-site { color: #93c5fd; }
