/**
 * BilzatWork · 维吾尔语样式（严格对齐 BilzatCRM layout-ug / ug-agent）
 * 铁律：html/壳层 LTR；侧栏靠右；正文 RTL + Alkatip
 */
@font-face {
  font-family: 'alkatip basma';
  font-style: normal;
  font-weight: normal;
  font-display: swap;
  src: url('/fonts/ALKATIPBasmaTom.ttf') format('truetype');
}
@font-face {
  font-family: 'alkatip basma tom';
  font-style: normal;
  font-weight: normal;
  font-display: swap;
  src: url('/fonts/ALKATIPBasmaTom.ttf') format('truetype');
}
@font-face {
  font-family: 'Alkatip tor';
  font-style: normal;
  font-weight: normal;
  font-display: swap;
  src: url('/fonts/ALKATIPBasmaTom.ttf') format('truetype');
}
@font-face {
  font-family: 'ukij tuz tom';
  font-style: normal;
  font-weight: normal;
  font-display: swap;
  src: url('/fonts/ALKATIPBasmaTom.ttf') format('truetype');
}

:root {
  --ug-font: 'alkatip tor', 'ukij tuz tom', 'alkatip basma tom', 'alkatip basma',
    'Alkatip tor', 'Microsoft Uighur', 'UKIJ Tuz Tom', serif;
  --crm-primary: #1890ff;
  --crm-primary-soft: #e6f4ff;
  --crm-primary-deep: #0958d9;
  --crm-border: #e8e8e8;
}

html.lang-ug,
html.lang-ug body,
body.lang-ug,
body.lang-ug .layout {
  direction: ltr !important;
}

/* === 侧栏 → 右侧（对齐 CRM） === */
html.lang-ug .sidebar,
body.lang-ug .sidebar {
  left: auto !important;
  right: 0 !important;
  border-right: none !important;
  border-left: 1px solid var(--crm-border) !important;
  box-shadow: -4px 0 24px rgba(30, 41, 59, 0.04) !important;
  background: #fff !important;
}
html.lang-ug .main-content,
body.lang-ug .main-content {
  margin-left: 0 !important;
  margin-right: 228px !important;
  background: #f0f2f5 !important;
}

@media (max-width: 900px) {
  html.lang-ug .sidebar { transform: translateX(100%); }
  html.lang-ug .sidebar.open { transform: translateX(0); }
  html.lang-ug .main-content { margin-right: 0 !important; }
}

/* 品牌行：标题 + 语言开关同一行（对齐 CRM sidebar-brand-row） */
html.lang-ug .sidebar-logo {
  flex-direction: column !important;
  align-items: stretch !important;
  gap: 6px;
  padding: 14px 14px 12px !important;
  border-bottom: 1px solid #eef0f3;
}
html.lang-ug .sidebar-logo .bw-logo-mark {
  display: none;
}
html.lang-ug .sidebar-brand-col {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch !important;
  gap: 4px;
}
html.lang-ug .sidebar-brand-row {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-direction: row-reverse;
  width: 100%;
}
html.lang-ug .sidebar-brand-row h2,
html.lang-ug .sidebar-brand-row .sidebar-title {
  font-size: 15px;
  font-weight: 700;
  color: #1a1a2e;
  margin: 0;
  flex: 1;
  min-width: 0;
  text-align: right;
  direction: ltr;
  unicode-bidi: isolate;
}
html.lang-ug .sidebar-lang-slot {
  flex-shrink: 0;
}
html.lang-ug .sidebar-brand-sub {
  text-align: right;
  direction: rtl;
  font-family: var(--ug-font) !important;
  color: #8b95a5 !important;
  font-size: 12px;
  margin: 0;
}

/* 语言开关（与 CRM 完全一致） */
.lang-switch {
  display: inline-flex !important;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border-radius: 999px;
  background: #f3f4f6 !important;
  border: 1px solid #e5e7eb !important;
  flex-shrink: 0;
}
.lang-btn {
  border: none !important;
  background: transparent !important;
  color: #6b7280 !important;
  font-size: 12px !important;
  line-height: 1;
  padding: 5px 10px !important;
  border-radius: 999px !important;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: none !important;
}
.lang-btn:hover { color: #111827 !important; }
.lang-btn.active {
  background: #111827 !important;
  color: #fff !important;
}
.lang-btn[data-lang='ug'] {
  font-family: var(--ug-font) !important;
  direction: ltr;
  unicode-bidi: isolate;
}
.lang-btn[data-lang='zh'] {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif !important;
}

/* 导航项对齐 CRM */
html.lang-ug .nav-section-label {
  direction: rtl !important;
  text-align: right !important;
  font-family: var(--ug-font) !important;
  color: #9ca3af !important;
}
html.lang-ug .nav-item {
  direction: rtl !important;
  text-align: right !important;
  justify-content: flex-start !important;
  flex-direction: row !important;
  border-left: none !important;
  border-right: 3px solid transparent !important;
  font-family: var(--ug-font) !important;
  color: #4a5568 !important;
  padding: 10px 14px !important;
  border-radius: 0 !important;
  margin: 0 !important;
  background: transparent !important;
}
html.lang-ug .nav-item .nav-icon {
  order: 2;
  margin-inline-start: 8px;
}
html.lang-ug .nav-item:hover {
  background: var(--crm-primary-soft) !important;
  color: var(--crm-primary-deep) !important;
}
html.lang-ug .nav-item.active {
  background: var(--crm-primary-soft) !important;
  color: var(--crm-primary) !important;
  border-right-color: var(--crm-primary) !important;
  font-weight: 500 !important;
  box-shadow: none !important;
}
html.lang-ug .sidebar-user {
  flex-direction: row-reverse !important;
  text-align: right;
  border-top: 1px solid #f0f0f0;
}
html.lang-ug .sidebar-user .user-info {
  text-align: right;
  font-family: var(--ug-font) !important;
}
html.lang-ug .sidebar-user .logout-btn {
  font-family: var(--ug-font) !important;
}

/* === 主内容 RTL（对齐 CRM content） === */
html.lang-ug .page-content,
html.lang-ug .topbar {
  font-family: var(--ug-font) !important;
}
html.lang-ug .page-content {
  direction: rtl !important;
  text-align: right !important;
}
html.lang-ug .topbar {
  direction: rtl !important;
  background: #fff !important;
}
html.lang-ug .topbar > div:first-child {
  flex-direction: row-reverse;
}
html.lang-ug #page-title {
  font-family: var(--ug-font) !important;
  text-align: right;
}

html.lang-ug .page-content .keep-zh,
html.lang-ug .page-content .keep-zh *,
html.lang-ug .page-content code,
html.lang-ug .page-content pre {
  direction: ltr !important;
  text-align: left !important;
  font-family: ui-monospace, Consolas, monospace !important;
}
html.lang-ug .page-content input,
html.lang-ug .page-content textarea,
html.lang-ug .page-content select,
html.lang-ug .page-content .form-control {
  font-family: var(--ug-font) !important;
  direction: rtl !important;
  text-align: right !important;
}

/* 统计卡：数字大、蓝色（贴近 CRM KPI） */
html.lang-ug .stats-grid .stat-card,
html.lang-ug .stat-info {
  text-align: right !important;
  font-family: var(--ug-font) !important;
}
html.lang-ug .stat-card .num,
html.lang-ug .stat-info .num {
  color: var(--crm-primary) !important;
  font-weight: 700 !important;
}
html.lang-ug .stat-card .label,
html.lang-ug .stat-info .label {
  font-family: var(--ug-font) !important;
  color: #64748b !important;
}

html.lang-ug .card,
html.lang-ug .bw-tab,
html.lang-ug .btn,
html.lang-ug .empty-tip,
html.lang-ug .data-table,
html.lang-ug .bw-drv,
html.lang-ug .bw-okr2,
html.lang-ug .bw-pkb,
html.lang-ug .bw-mrep,
html.lang-ug .bw-brief {
  font-family: var(--ug-font) !important;
}

html.lang-ug .data-table th,
html.lang-ug .data-table td,
html.lang-ug .bw-drv-table th,
html.lang-ug .bw-drv-table td {
  text-align: right !important;
  font-family: var(--ug-font) !important;
}

html.lang-ug .bw-tabs,
html.lang-ug .bw-team-tabs {
  direction: rtl !important;
}
html.lang-ug .bw-tab {
  font-family: var(--ug-font) !important;
}
html.lang-ug .bw-tab.active {
  background: var(--crm-primary-soft) !important;
  color: var(--crm-primary) !important;
}

html.lang-ug .card-header,
html.lang-ug .bw-okr2-top,
html.lang-ug .bw-okr2-toolbar,
html.lang-ug .actions {
  flex-direction: row-reverse !important;
}

/*
 * 网盘：DOM 为 [side, main]；direction:rtl → 树在右、列表在左（对齐截图）
 * 壳层仍 LTR，仅网盘容器 RTL
 */
html.lang-ug .bw-drv {
  flex-direction: row !important;
  direction: rtl !important;
}
html.lang-ug .bw-drv-side {
  border-left: 1px solid #e2e8f0 !important;
  border-right: none !important;
  text-align: right !important;
}
html.lang-ug .bw-drv-main {
  text-align: right !important;
  min-width: 0;
}
html.lang-ug .bw-drv-tree li,
html.lang-ug .bw-drv-link,
html.lang-ug .bw-drv-nav button,
html.lang-ug .bw-drv-group-title,
html.lang-ug .bw-drv-crumb,
html.lang-ug .bw-drv-side-title,
html.lang-ug .bw-drv-search,
html.lang-ug .bw-drv-exp,
html.lang-ug .bw-drv-bar {
  text-align: right !important;
  direction: rtl !important;
  font-family: var(--ug-font) !important;
}
html.lang-ug .bw-drv-bar {
  flex-direction: row !important; /* 已在 rtl 容器内，勿再 row-reverse */
  direction: rtl !important;
}
html.lang-ug .bw-drv-actions {
  flex-direction: row !important;
  direction: rtl !important;
}
html.lang-ug .bw-drv-tree li.active,
html.lang-ug .bw-drv-tree li.is-active,
html.lang-ug .bw-drv-nav button.active {
  background: var(--crm-primary-soft) !important;
  color: var(--crm-primary) !important;
}

html.lang-ug .bw-okr2 {
  flex-direction: row !important;
  direction: rtl !important;
}
html.lang-ug .bw-okr2-side {
  text-align: right;
  border-left: 1px solid #eef0f3 !important;
  border-right: none !important;
}
html.lang-ug .bw-okr2-main {
  text-align: right;
}
html.lang-ug .bw-okr2-nav button,
html.lang-ug .bw-okr2-side-title,
html.lang-ug .bw-okr2-crumb {
  text-align: right !important;
  direction: rtl !important;
  font-family: var(--ug-font) !important;
}

html.lang-ug .bw-brief {
  flex-direction: row !important;
  direction: rtl !important;
}
html.lang-ug .bw-brief-nav {
  text-align: right;
  border-left: 1px solid #e2e8f0 !important;
  border-right: none !important;
}
html.lang-ug .bw-brief-list {
  text-align: right;
}
html.lang-ug .bw-brief-nav button {
  text-align: right !important;
  direction: rtl !important;
  font-family: var(--ug-font) !important;
}

/* 团队顶栏按钮区：RTL 下靠起始边 */
html.lang-ug .card-header .actions {
  flex-direction: row !important;
  direction: rtl !important;
}
html.lang-ug .card-header {
  flex-direction: row !important;
  direction: rtl !important;
}

html.lang-ug .bw-pkb-board {
  direction: ltr; /* 看板列保持左→右流程 */
}
html.lang-ug .bw-pkb-card,
html.lang-ug .bw-pkb-col-head {
  font-family: var(--ug-font) !important;
  text-align: right;
  direction: rtl;
}
