@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700;800&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --ink: #0b0f1a;
  --ink-2: #131a2b;
  --ink-3: #1d2740;
  --line: #e4e8f0;
  --line-dark: #222d47;
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #0d1526;
  --muted: #667089;
  --muted-2: #8b93a7;
  --brand: #0bae70;
  --brand-600: #08915c;
  --brand-50: #e8f9f1;
  --rail: #f2f5fd;
  --rail-w: 52px;
  --sub-w: 216px;
  --green: #12b76a;
  --green-50: #e7f8f0;
  --amber: #f79009;
  --amber-50: #fef4e6;
  --red: #f04438;
  --red-50: #feeceb;
  --purple: #7a5af8;
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow: 0 4px 16px rgba(16, 24, 40, .08);
  --shadow-lg: 0 18px 48px rgba(16, 24, 40, .16);
  --sidebar: 232px;
  --t: 180ms cubic-bezier(.4, 0, .2, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Tajawal', 'Inter', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #cfd5e2; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #b6bfd2; }
::-webkit-scrollbar-track { background: transparent; }
.num { font-family: 'Inter', sans-serif; font-feature-settings: 'tnum'; direction: ltr; unicode-bidi: isolate; }

/* ------------------------------- الهيكل العام ------------------------------ */

#app { display: flex; height: 100vh; overflow: hidden; }

/* الشريط الأيقوني */
.rail {
  width: var(--rail-w); flex: 0 0 var(--rail-w);
  background: var(--rail); border-inline-start: 1px solid #e3e8f6;
  display: flex; flex-direction: column; align-items: center;
  padding: 10px 0 12px; gap: 4px; z-index: 30;
}
.rail-logo {
  width: 32px; height: 32px; border-radius: 9px; margin-bottom: 10px;
  display: grid; place-items: center; flex: 0 0 auto;
  box-shadow: 0 5px 14px rgba(11, 174, 112, .38);
}
.rail-logo img { width: 100%; height: 100%; border-radius: 9px; }
.rail-btn {
  position: relative; width: 38px; height: 38px; border-radius: 10px;
  display: grid; place-items: center; color: #6b7691; flex: 0 0 auto;
  transition: background var(--t), color var(--t);
}
.rail-btn svg { width: 21px; height: 21px; }
.rail-btn:hover { background: #e7effe; color: var(--brand); }
.rail-btn.active { background: #d9e7ff; color: var(--brand); }
.rail-btn.active::before {
  content: ''; position: absolute; inset-inline-end: -10px; inset-block: 8px;
  width: 3px; border-radius: 3px; background: var(--brand);
}
.rail-btn .rail-dot {
  position: absolute; inset-block-start: 4px; inset-inline-start: 4px;
  min-width: 16px; height: 16px; padding: 0 4px; border-radius: 9px;
  background: var(--red); color: #fff; font-size: 10px; font-weight: 700;
  display: grid; place-items: center; font-family: 'Inter', sans-serif;
}
.rail-sep { flex: 1; }
.rail-tip {
  position: absolute; inset-inline-end: calc(100% + 10px); white-space: nowrap;
  background: var(--ink); color: #fff; font-size: 12.5px; font-weight: 600;
  padding: 5px 10px; border-radius: 7px; opacity: 0; pointer-events: none;
  transition: opacity var(--t); z-index: 60;
}
.rail-btn:hover .rail-tip { opacity: 1; }

/* اللوحة الجانبية للقسم */
.subnav {
  width: var(--sub-w); flex: 0 0 var(--sub-w); background: #fff;
  border-inline-start: 1px solid var(--line);
  display: flex; flex-direction: column; overflow-y: auto; padding-bottom: 10px;
}
.subnav.hidden { display: none; }
.subnav-head {
  padding: 16px 16px 10px; display: flex; align-items: center; gap: 8px;
}
.subnav-head h2 { margin: 0; font-size: 17px; font-weight: 800; letter-spacing: -.3px; }
.sub-group {
  margin: 14px 16px 5px; font-size: 11.5px; font-weight: 700; color: var(--muted-2);
  letter-spacing: .3px; display: flex; align-items: center; gap: 6px;
}
.sub-group .grow { flex: 1; }
.sub-item {
  display: flex; align-items: center; gap: 9px; width: calc(100% - 16px);
  margin: 1px 8px; padding: 8px 10px; border-radius: 8px;
  color: #3c455c; font-size: 14px; font-weight: 500; text-align: start;
  transition: background var(--t), color var(--t);
}
.sub-item svg { width: 18px; height: 18px; flex: 0 0 auto; color: #6b7691; }
.sub-item .emo { width: 18px; text-align: center; flex: 0 0 auto; font-size: 14px; }
.sub-item:hover { background: #f2f5fb; }
.sub-item.active { background: var(--brand-50); color: var(--brand); font-weight: 700; }
.sub-item.active svg { color: var(--brand); }
.sub-count { margin-inline-start: auto; font-size: 12px; color: var(--muted-2); font-family: 'Inter', sans-serif; font-weight: 700; }
.sub-item.active .sub-count { color: var(--brand); }
.sub-empty { padding: 4px 18px 8px; font-size: 12.5px; color: var(--muted-2); }
.sub-divider { height: 1px; background: var(--line); margin: 10px 16px; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: 58px; flex: 0 0 58px; background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 14px; padding: 0 20px;
}
.topbar h1 { font-size: 17.5px; font-weight: 800; margin: 0; letter-spacing: -.3px; }
.topbar .sub { font-size: 12.5px; color: var(--muted); }
.topbar-actions { margin-inline-start: auto; display: flex; align-items: center; gap: 9px; }
.menu-btn { display: none; }

.view { flex: 1; overflow: auto; }
.pad { padding: 22px; }

/* -------------------------------- عناصر عامة ------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 15px; border-radius: var(--r-sm); font-weight: 600; font-size: 14px;
  background: #fff; border: 1px solid var(--line); color: var(--text);
  transition: background var(--t), border-color var(--t), transform var(--t), box-shadow var(--t);
  white-space: nowrap;
}
.btn svg { width: 17px; height: 17px; }
.btn:hover { background: #f7f9fc; border-color: #cfd6e4; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 4px 14px rgba(11, 174, 112, .24); }
.btn-primary:hover { background: var(--brand-600); border-color: var(--brand-600); }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover { background: #d92d20; border-color: #d92d20; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: #eff2f7; }
.btn-sm { padding: 6px 11px; font-size: 13px; }
.btn-icon { padding: 8px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.input, .select, .textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: #fff; transition: border-color var(--t), box-shadow var(--t); outline: none;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(11, 174, 112, .15); }
.textarea { resize: vertical; min-height: 92px; line-height: 1.7; }
.field { margin-bottom: 14px; }
.label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: #3a445c; }
.hint { font-size: 12px; color: var(--muted); margin-top: 5px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
.card-head { padding: 15px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.card-head h3 { margin: 0; font-size: 15.5px; font-weight: 700; }
.card-body { padding: 18px; }

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 700;
  background: #eef1f6; color: #4a5470; white-space: nowrap;
}
.pill.green { background: var(--green-50); color: #067647; }
.pill.amber { background: var(--amber-50); color: #b54708; }
.pill.red { background: var(--red-50); color: #b42318; }
.pill.blue { background: var(--brand-50); color: #1730d9; }
.pill.purple { background: #f1ecff; color: #5b34e0; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.avatar {
  width: 38px; height: 38px; border-radius: 50%; flex: 0 0 auto;
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 14px;
}
.avatar.sm { width: 28px; height: 28px; font-size: 11.5px; }
.avatar.lg { width: 54px; height: 54px; font-size: 19px; }
.avatar-wrap { position: relative; flex: 0 0 auto; }
.ch-badge {
  position: absolute; inset-block-end: -3px; inset-inline-start: -3px;
  width: 18px; height: 18px; border-radius: 50%; background: #fff;
  display: grid; place-items: center; box-shadow: 0 0 0 2px #fff;
}
.ch-badge svg { width: 12px; height: 12px; }
.status-dot {
  position: absolute; inset-block-start: -1px; inset-inline-end: -1px;
  width: 11px; height: 11px; border-radius: 50%; box-shadow: 0 0 0 2px #fff;
}
.st-online { background: var(--green); }
.st-busy { background: var(--red); }
.st-break { background: var(--amber); }
.st-offline { background: #b3bbcc; }

.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: start; font-size: 12px; color: var(--muted); font-weight: 700;
  padding: 10px 14px; background: #fafbfd; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table td { padding: 12px 14px; border-bottom: 1px solid #f0f2f7; font-size: 14px; vertical-align: middle; }
.table tbody tr { transition: background var(--t); }
.table tbody tr:hover { background: #fafbfd; }
.table-wrap { overflow-x: auto; border-radius: var(--r-lg); }

.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty svg { width: 42px; height: 42px; opacity: .35; margin-bottom: 10px; }

.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }
.row { display: flex; align-items: center; gap: 10px; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.wrap { flex-wrap: wrap; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.grow { flex: 1; min-width: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ------------------------------- بطاقات KPI ------------------------------- */

.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px 18px; box-shadow: var(--shadow-sm); }
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi-label { font-size: 13px; color: var(--muted); font-weight: 600; }
.kpi-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; }
.kpi-icon svg { width: 18px; height: 18px; }
.kpi-value { font-size: 27px; font-weight: 800; letter-spacing: -.6px; margin-top: 6px; font-family: 'Inter', sans-serif; direction: ltr; text-align: start; }
.kpi-foot { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.trend-up { color: #067647; font-weight: 700; }
.trend-down { color: #b42318; font-weight: 700; }

/* ------------------------------ صندوق الوارد ------------------------------ */

.inbox { display: flex; height: 100%; overflow: hidden; }
.conv-list { width: 330px; flex: 0 0 330px; background: #fff; border-inline-start: 1px solid var(--line); display: flex; flex-direction: column; }
.conv-list-head { padding: 12px; border-bottom: 1px solid var(--line); }
.search-box { position: relative; }
.search-box svg { position: absolute; inset-inline-start: 10px; inset-block-start: 10px; width: 17px; height: 17px; color: var(--muted-2); }
.search-box .input { padding-inline-start: 34px; }
.filters {
  display: flex; gap: 6px; margin-top: 10px; overflow-x: auto; padding-bottom: 2px;
  scrollbar-width: thin; scrollbar-color: #d5dbe7 transparent;
  /* تلاشٍ عند الحافة المقطوعة يوضّح أن الصف قابل للتمرير أفقيًا */
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 22px);
  mask-image: linear-gradient(to right, transparent 0, #000 22px);
}
[dir='ltr'] .filters {
  -webkit-mask-image: linear-gradient(to left, transparent 0, #000 22px);
  mask-image: linear-gradient(to left, transparent 0, #000 22px);
}
.filters::-webkit-scrollbar { height: 4px; }
.filters::-webkit-scrollbar-thumb { background: #d5dbe7; border-radius: 4px; }
.chip {
  padding: 5px 11px; border-radius: 20px; font-size: 12.5px; font-weight: 600;
  background: #f1f4f9; color: #566079; white-space: nowrap; transition: all var(--t);
}
.chip:hover { background: #e6eaf2; }
.chip.active { background: var(--ink); color: #fff; }

.conv-items { flex: 1; overflow-y: auto; }
.conv-item {
  display: flex; gap: 11px; padding: 13px 14px; width: 100%; text-align: start;
  border-bottom: 1px solid #f2f4f8; transition: background var(--t); position: relative;
}
.conv-item:hover { background: #fafbfd; }
.conv-item.active { background: var(--brand-50); }
.conv-item.active::after { content: ''; position: absolute; inset-inline-end: 0; inset-block: 0; width: 3px; background: var(--brand); }
.conv-name { font-weight: 700; font-size: 14.5px; }
.conv-time { font-size: 11.5px; color: var(--muted-2); white-space: nowrap; }
.conv-preview { font-size: 13px; color: var(--muted); margin-top: 2px; }
.unread-badge { background: var(--brand); color: #fff; font-size: 11px; font-weight: 700; min-width: 19px; height: 19px; border-radius: 20px; display: grid; place-items: center; padding: 0 5px; }

.thread { flex: 1; display: flex; flex-direction: column; min-width: 0; background: #f7f9fc; }
.thread-head { background: #fff; border-bottom: 1px solid var(--line); padding: 11px 18px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.thread-head .grow { min-width: 130px; }
.thread-head .select { max-width: 130px; }
.thread-body { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 4px; }
.day-sep { text-align: center; margin: 12px 0; }
.day-sep span { background: #e7ebf3; color: #5c6680; font-size: 11.5px; font-weight: 700; padding: 3px 12px; border-radius: 20px; }

.msg { max-width: 72%; margin-bottom: 8px; }
.msg.out { align-self: flex-start; }
.msg.in { align-self: flex-end; }
.bubble {
  padding: 10px 14px; border-radius: 16px; font-size: 14.5px; line-height: 1.65;
  box-shadow: var(--shadow-sm); word-break: break-word; white-space: pre-wrap;
}
.msg.in .bubble { background: #fff; border: 1px solid var(--line); border-end-end-radius: 4px; }
.msg.out .bubble { background: var(--brand); color: #fff; border-end-start-radius: 4px; }
.msg.note .bubble { background: #fff8e6; border: 1px solid #f5d98e; color: #8a5a00; }
.msg.ai .bubble { background: #f3efff; border: 1px solid #ddd2ff; color: #4c2fc7; }
.msg-meta { font-size: 11px; color: var(--muted-2); margin-top: 4px; display: flex; gap: 6px; align-items: center; }
.msg.out .msg-meta { justify-content: flex-start; }
.msg.in .msg-meta { justify-content: flex-end; }
.sys-msg { align-self: center; background: #e7ebf3; color: #5c6680; font-size: 12px; padding: 4px 13px; border-radius: 20px; margin: 6px 0; font-weight: 600; }

.composer { background: #fff; border-top: 1px solid var(--line); padding: 10px 14px 12px; }
.composer-tabs { display: flex; gap: 4px; margin-bottom: 8px; }
.ctab { padding: 5px 12px; border-radius: 7px; font-size: 13px; font-weight: 600; color: var(--muted); }
.ctab.active { background: #eef1f6; color: var(--text); }
.ctab.note.active { background: #fff3d6; color: #8a5a00; }
.composer-box { display: flex; align-items: flex-end; gap: 8px; }
.composer textarea {
  flex: 1; border: 1px solid var(--line); border-radius: var(--r); padding: 10px 13px;
  resize: none; max-height: 140px; min-height: 42px; outline: none; line-height: 1.6; transition: border-color var(--t);
}
.composer textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(11, 174, 112, .12); }
.composer.note-mode textarea { background: #fffaf0; border-color: #f0d9a0; }
.composer-tools { display: flex; gap: 2px; margin-top: 8px; align-items: center; }
/* انتهت نافذة الـ 24 ساعة: بديل مربّع الكتابة */
.win-locked {
  background: #fffbf2; border: 1px solid #f3dfb5; border-radius: var(--r);
  padding: 13px 14px; font-size: 13.5px;
}
.msg.out .bubble .pill.green { background: rgba(255, 255, 255, .22); color: #fff; border-color: transparent; }

.ctx-panel { width: 300px; flex: 0 0 300px; background: #fff; border-inline-end: 1px solid var(--line); overflow-y: auto; }
.ctx-sec { padding: 16px; border-bottom: 1px solid var(--line); }
.ctx-title { font-size: 11.5px; font-weight: 700; color: var(--muted); letter-spacing: .3px; margin-bottom: 10px; }
.kv { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; font-size: 13.5px; flex-wrap: wrap; }
.kv .k { color: var(--muted); }
.kv .v { font-weight: 600; text-align: end; min-width: 0; flex-wrap: wrap; justify-content: flex-end; }
.tag-chip { background: #eef1f6; color: #4a5470; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 6px; }

/* -------------------------------- الكول سنتر ------------------------------- */

.call-live {
  border: 1px solid var(--line); border-radius: var(--r-lg); background: #fff;
  padding: 14px 16px; display: flex; align-items: center; gap: 13px; box-shadow: var(--shadow-sm);
  transition: box-shadow var(--t);
}
.call-live.active { border-color: #a7f0c8; background: linear-gradient(180deg, #f4fdf8, #fff); }
.call-live.queued { border-color: #fcd9a6; background: linear-gradient(180deg, #fffaf2, #fff); }
.call-live.ringing { border-color: #bcc6ff; background: linear-gradient(180deg, #f5f7ff, #fff); }
.ring { animation: ring 1.1s ease-in-out infinite; }
@keyframes ring { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-11deg); } 75% { transform: rotate(11deg); } }
.pulse::before {
  content: ''; position: absolute; inset: -4px; border-radius: 50%;
  border: 2px solid var(--green); animation: pulse 1.6s ease-out infinite;
}
@keyframes pulse { 0% { transform: scale(.9); opacity: .9; } 100% { transform: scale(1.35); opacity: 0; } }
.timer { font-family: 'Inter', sans-serif; font-variant-numeric: tabular-nums; direction: ltr; font-weight: 700; }

.dialpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.dial-key {
  aspect-ratio: 1.45; border-radius: var(--r); background: #f5f7fb; border: 1px solid var(--line);
  font-size: 20px; font-weight: 700; font-family: 'Inter', sans-serif;
  display: grid; place-items: center; transition: all var(--t);
}
.dial-key:hover { background: #eaeef6; transform: translateY(-1px); }
.dial-key:active { transform: scale(.96); }

/* --------------------------------- رسوم --------------------------------- */

.bars { display: flex; align-items: flex-end; gap: 6px; height: 170px; padding-top: 8px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.bar {
  width: 100%; max-width: 34px; background: linear-gradient(180deg, #1b6e79, var(--brand));
  border-radius: 6px 6px 0 0; min-height: 3px; transition: height 500ms cubic-bezier(.4, 0, .2, 1);
}
.bar.alt { background: linear-gradient(180deg, #9d8bff, var(--purple)); }
.bar-label { font-size: 10.5px; color: var(--muted-2); font-family: 'Inter', sans-serif; }

.hbar { height: 9px; background: #eef1f6; border-radius: 20px; overflow: hidden; }
.hbar > span { display: block; height: 100%; border-radius: 20px; background: var(--brand); transition: width 500ms; }

/* ------------------------------ نافذة منبثقة ------------------------------ */

.overlay {
  position: fixed; inset: 0; background: rgba(11, 15, 26, .5); backdrop-filter: blur(3px);
  display: grid; place-items: center; z-index: 60; padding: 20px; animation: fade 160ms ease;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  background: #fff; border-radius: var(--r-lg); width: 100%; max-width: 520px;
  max-height: 88vh; overflow: auto; box-shadow: var(--shadow-lg); animation: pop 180ms cubic-bezier(.3, 1.3, .6, 1);
}
@keyframes pop { from { transform: translateY(14px) scale(.98); opacity: 0; } }
.modal-head { padding: 17px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.modal-head h3 { margin: 0; font-size: 17px; font-weight: 800; }
.modal-body { padding: 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 9px; justify-content: flex-start; background: #fafbfd; }

.toasts { position: fixed; inset-block-end: 20px; inset-inline-start: 20px; z-index: 90; display: flex; flex-direction: column; gap: 9px; }
.toast {
  background: var(--ink); color: #fff; padding: 11px 16px; border-radius: var(--r);
  box-shadow: var(--shadow-lg); font-size: 14px; font-weight: 500; display: flex; align-items: center; gap: 9px;
  animation: slide 220ms cubic-bezier(.3, 1.2, .6, 1); max-width: 360px;
}
@keyframes slide { from { transform: translateY(14px); opacity: 0; } }
.toast.ok { background: #067647; }
.toast.err { background: #b42318; }

/* --------------------------------- موبايل -------------------------------- */

@media (max-width: 1400px) {
  .ctx-panel { display: none; }
}

@media (max-width: 1180px) {
  .g4 { grid-template-columns: repeat(2, 1fr); }
  .conv-list { width: 290px; flex: 0 0 290px; }
  #callGrid, .pad > .grid[style*="1.5fr"], .pad > .grid[style*="1.6fr"] { grid-template-columns: 1fr !important; }
}

@media (max-width: 900px) {
  .rail, .subnav {
    position: fixed; top: 0; bottom: 0; z-index: 70;
    transform: translateX(100%); transition: transform var(--t);
  }
  .rail { right: 0; left: auto; }
  .subnav {
    right: var(--rail-w); left: auto; width: 240px; flex-basis: 240px; box-shadow: var(--shadow-lg);
    /* لازم تخرج بعرضها + عرض الشريط الأيقوني وإلا بقي طرفها ظاهرًا فوق المحتوى */
    transform: translateX(calc(100% + var(--rail-w)));
  }
  .nav-open .rail, .nav-open .subnav { transform: translateX(0); }
  #backBtn { display: inline-flex !important; }
  .menu-btn { display: inline-flex; }
  .scrim { position: fixed; inset: 0; background: rgba(11, 15, 26, .45); z-index: 65; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .conv-list { width: 100%; flex: 1 1 auto; }
  .inbox.has-thread .conv-list { display: none; }
  .inbox:not(.has-thread) .thread { display: none; }
  .pad { padding: 14px; }
  .topbar { padding: 0 14px; gap: 10px; }
  .topbar h1 { font-size: 16.5px; }
  .topbar .sub { display: none; }
  .msg { max-width: 88%; }
  .hide-sm { display: none !important; }
}

/* ------------------------- تبويبات + كتل الكود ------------------------- */
.tabs { display: flex; gap: 4px; background: #eef1f7; padding: 4px; border-radius: 12px; width: fit-content; max-width: 100%; overflow-x: auto; }
.tab {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 16px; border-radius: 9px; font-size: 13.5px; font-weight: 600;
  color: #5d6884; white-space: nowrap; transition: all var(--t);
}
.tab svg { width: 15px; height: 15px; flex: 0 0 auto; }
.tab:hover { color: var(--ink); }
.tab.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(15, 23, 42, .1); }

.chip .dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; margin-inline-end: 5px; }
.chip { display: inline-flex; align-items: center; gap: 5px; }

.code {
  background: #0f172a; color: #d7e0f2; border-radius: 11px; padding: 12px 14px; margin: 0;
  font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; line-height: 1.7;
  direction: ltr; text-align: start; overflow-x: auto; white-space: pre;
}

/* ------------------------- الوضع الإنجليزي (LTR) ------------------------- */
/* الرسائل الصادرة دائمًا على جهة الفريق مهما كان اتجاه الواجهة */
html[dir="ltr"] .msg.out { align-self: flex-end; }
html[dir="ltr"] .msg.in { align-self: flex-start; }
html[dir="ltr"] .msg.out .msg-meta { justify-content: flex-end; }
html[dir="ltr"] .msg.in .msg-meta { justify-content: flex-start; }
/* نصوص العملاء تُعرض باتجاهها الطبيعي حتى داخل واجهة إنجليزية */
[data-raw] { unicode-bidi: plaintext; }

/* الشريط الجانبي على الموبايل في الوضع الإنجليزي — ينزلق من اليسار */
@media (max-width: 900px) {
  html[dir="ltr"] .rail { left: 0; right: auto; transform: translateX(-100%); }
  html[dir="ltr"] .subnav {
    left: var(--rail-w); right: auto;
    transform: translateX(calc(-100% - var(--rail-w)));
  }
  html[dir="ltr"] .nav-open .rail, html[dir="ltr"] .nav-open .subnav { transform: translateX(0); }
}

/* ---------- عرض تقويم الحملات ---------- */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-head { text-align: center; padding: 6px 0; font-weight: 600; }
.cal-cell {
  min-height: 84px; border: 1px solid var(--line); border-radius: 10px;
  padding: 6px; display: flex; flex-direction: column; gap: 4px; background: #fff;
}
.cal-cell.cal-muted { background: var(--bg, #f7f8fa); border-style: dashed; }
.cal-day { font-size: 12px; color: var(--muted); font-weight: 600; }
.cal-item {
  display: block; width: 100%; text-align: start; cursor: pointer; border: 0;
  font-size: 11px; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  transition: filter .15s ease;
}
.cal-item:hover { filter: brightness(.94); }
@media (max-width: 720px) {
  .cal-grid { grid-template-columns: repeat(7, minmax(44px, 1fr)); overflow-x: auto; }
  .cal-cell { min-height: 62px; }
}

/* صفوف فلاتر صندوق الوارد تلتف بدل التمرير — الفلاتر كترت بعد إضافة المراحل */
.conv-list-head .filters {
  flex-wrap: wrap; overflow-x: visible;
  -webkit-mask-image: none; mask-image: none;
}
.inbox-toolbar { margin-top: 10px; }
.inbox-toolbar .select { flex: 1 1 0; min-width: 0; }
.more-filters { display: contents; }
.more-filters[hidden] { display: none; }
#moreBtn .num { margin-inline-start: 4px; }

/* ---------- اللوحة الجانبية كدليل كامل لكل الخصائص ---------- */
.sub-mod { padding-bottom: 2px; }
.sub-mod + .sub-mod { border-top: 1px solid #f0f2f7; }
.sub-mod .sub-group {
  color: var(--ink); font-size: 12px; font-weight: 800; text-transform: none;
}
.sub-mod.open .sub-group { color: var(--brand); }
.sub-subgroup {
  margin: 9px 16px 3px; font-size: 10.5px; font-weight: 700;
  color: var(--muted-2); letter-spacing: .3px; opacity: .85;
}

/* ============================ شاشة الدخول والحساب =========================== */

body.auth-mode #app, body.auth-mode .toasts { display: none; }
body.auth-mode { overflow: hidden; }

#auth {
  position: fixed; inset: 0; z-index: 90; overflow: auto;
  background:
    radial-gradient(1100px 620px at 88% -8%, #e8f0ff 0%, transparent 62%),
    radial-gradient(760px 520px at -6% 108%, #eef3ff 0%, transparent 60%),
    var(--bg);
}
.auth-wrap {
  min-height: 100%; display: grid; grid-template-columns: 1.05fr .95fr;
  align-items: stretch; gap: 0;
}
.auth-wrap.single { grid-template-columns: 1fr; place-items: center; padding: 24px; }

/* العمود التعريفي */
.auth-brand {
  display: flex; flex-direction: column; justify-content: center; gap: 30px;
  padding: 56px clamp(28px, 5vw, 76px);
  background: linear-gradient(155deg, var(--ink) 0%, #12203f 55%, #16306a 100%);
  color: #fff;
}
.auth-brand-top { display: flex; align-items: center; gap: 14px; }
.auth-logo {
  width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center;
  box-shadow: 0 10px 26px rgba(11, 174, 112, .38); flex: 0 0 auto;
}
.auth-logo img { width: 100%; height: 100%; border-radius: 14px; }
.auth-logo.big { width: 54px; height: 54px; margin: 0 auto 18px; }
.auth-logo.big img { width: 100%; height: 100%; }
.auth-brand-name { font-size: 25px; font-weight: 800; letter-spacing: -.3px; }
.auth-brand-sub { font-size: 13.5px; color: #9fb3d9; margin-top: 3px; }
.auth-points { list-style: none; margin: 0; padding: 0; display: grid; gap: 15px; }
.auth-points li { display: flex; align-items: center; gap: 12px; font-size: 14.5px; color: #dbe6fb; }
.auth-points svg { width: 19px; height: 19px; flex: 0 0 auto; color: #6fa3ff; }
.auth-brand-foot {
  font-size: 12.5px; color: #8fa4cc; border-top: 1px solid rgba(255, 255, 255, .11);
  padding-top: 18px; line-height: 1.7; max-width: 42ch;
}

/* بطاقة النموذج */
.auth-card {
  position: relative; align-self: center; justify-self: center;
  width: min(100%, 410px); margin: 40px clamp(20px, 5vw, 56px);
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg); padding: 34px 30px 28px;
}
.auth-wrap.single .auth-card { margin: 0; text-align: center; }
.auth-wrap.single .auth-card .field { text-align: start; }
.auth-card h1 { font-size: 22px; margin: 0 0 6px; letter-spacing: -.3px; }
.auth-sub { color: var(--muted); font-size: 13.5px; margin: 0 0 22px; line-height: 1.7; }
.auth-card .field span { display: block; font-size: 12.5px; font-weight: 700; margin-bottom: 6px; }
.auth-card input[type="email"], .auth-card input[type="password"], .auth-card input[type="text"] {
  width: 100%; height: 44px;
}
.pw-wrap { position: relative; display: block; }
.pw-eye {
  position: absolute; inset-inline-end: 6px; top: 50%; transform: translateY(-50%);
  background: none; border: 0; cursor: pointer; color: var(--muted-2);
  padding: 7px; border-radius: 8px; line-height: 0; transition: color var(--t), background var(--t);
}
.pw-eye:hover { color: var(--brand); background: var(--brand-50); }
.pw-eye svg { width: 17px; height: 17px; }
.btn-block { width: 100%; justify-content: center; height: 44px; font-size: 14.5px; margin-top: 4px; }
.auth-err {
  background: var(--red-50); color: #b42318; border: 1px solid #fbd3cf;
  border-radius: var(--r-sm); padding: 10px 12px; font-size: 13px; margin-bottom: 14px; line-height: 1.6;
}
.auth-note {
  background: var(--amber-50); color: #b54708; border: 1px solid #f7d9a8;
  border-radius: var(--r-sm); padding: 10px 12px; font-size: 13px; margin-bottom: 16px; line-height: 1.6;
}
.auth-help {
  margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line);
  font-size: 12.5px; color: var(--muted); line-height: 1.75;
}
.auth-lang {
  position: absolute; top: 14px; inset-inline-end: 14px;
  background: none; border: 1px solid var(--line); color: var(--muted);
  border-radius: 999px; padding: 5px 12px; font-size: 12px; font-weight: 700;
  cursor: pointer; font-family: inherit; transition: all var(--t);
}
.auth-lang:hover { color: var(--brand); border-color: var(--brand); background: var(--brand-50); }
.auth-note.warn { background: var(--red-50); color: #b42318; border-color: #fbd3cf; }
.auth-link { color: var(--brand); font-weight: 700; text-decoration: none; }
.auth-link:hover { text-decoration: underline; }
.auth-icon {
  width: 52px; height: 52px; border-radius: 15px; display: grid; place-items: center;
  background: var(--brand-50); color: var(--brand); margin-bottom: 16px;
}
.auth-icon svg { width: 25px; height: 25px; }
.auth-icon.ok { background: var(--green-50); color: #067647; }
.auth-icon.bad { background: var(--red-50); color: #b42318; }

@media (max-width: 900px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-brand { padding: 32px 24px; gap: 22px; }
  .auth-points { display: none; }
  .auth-brand-foot { border: 0; padding-top: 0; }
  .auth-card { margin: 22px auto 40px; }
}

/* قائمة الحساب في الشريط العلوي */
button.avatar-wrap { background: none; border: 0; padding: 0; cursor: pointer; line-height: 0; }
.acct-menu {
  position: fixed; z-index: 70; width: 248px; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-lg);
  padding: 6px; animation: acctIn 140ms cubic-bezier(.4, 0, .2, 1);
}
@keyframes acctIn { from { opacity: 0; transform: translateY(-6px); } }
.acct-head {
  display: flex; align-items: center; gap: 10px; padding: 10px;
  border-bottom: 1px solid var(--line); margin-bottom: 6px;
}
.acct-head strong { display: block; font-size: 13.5px; }
.acct-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: start;
  background: none; border: 0; padding: 9px 10px; border-radius: var(--r-sm);
  font: inherit; font-size: 13.5px; color: var(--text); cursor: pointer; transition: background var(--t);
}
.acct-item:hover { background: var(--bg); }
.acct-item.danger { color: #b42318; }
.acct-item.danger:hover { background: var(--red-50); }
.acct-item svg { width: 16px; height: 16px; flex: 0 0 auto; color: var(--muted); }
.acct-item.danger svg { color: #b42318; }

/* ============================== الصلاحيات ================================= */

.perm-tbl td:first-child { max-width: 420px; }
.perm-tbl tr.perm-group td {
  background: #f7f9fc; font-weight: 800; font-size: 12px; color: var(--ink);
  padding: 9px 14px; border-bottom: 1px solid var(--line);
}
.perm-tbl input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--brand); cursor: pointer; }
.perm-tbl input[type="checkbox"]:disabled { cursor: default; opacity: .55; }

.perm-edit { max-height: 58vh; overflow-y: auto; padding-inline-end: 4px; }
.perm-sec + .perm-sec { margin-top: 16px; }
.perm-sec-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 12px; font-weight: 800; color: var(--ink);
  border-bottom: 1px solid var(--line); padding-bottom: 6px; margin-bottom: 4px;
}
.perm-row {
  display: flex; align-items: flex-start; gap: 10px; padding: 9px 8px;
  border-radius: var(--r-sm); cursor: pointer; transition: background var(--t);
}
.perm-row:hover { background: var(--bg); }
.perm-row input[type="checkbox"] {
  width: 17px; height: 17px; margin-top: 2px; accent-color: var(--brand); flex: 0 0 auto; cursor: pointer;
}
.perm-def {
  flex: 0 0 auto; font-size: 10.5px; font-weight: 700; color: var(--muted-2);
  background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 3px 9px; white-space: nowrap;
}
.perm-def.on { color: #067647; background: var(--green-50); border-color: #bbe9d1; }
.perm-chips { display: flex; flex-wrap: wrap; gap: 6px; }

@media (max-width: 720px) {
  .perm-def { display: none; }
  .perm-tbl td:first-child { min-width: 200px; }
}

/* ========================== المساعد الإرشادي ============================== */

.gv-pad { padding: 0 !important; height: 100%; }
.gv { display: grid; grid-template-columns: 1fr 292px; gap: 0; height: 100%; min-height: 0; }
.gv[data-compact] { grid-template-columns: 1fr; }
.gv-main { display: flex; flex-direction: column; min-height: 0; background: var(--bg); }
.gv-thread {
  flex: 1; min-height: 0; overflow-y: auto; padding: 18px 18px 8px;
  display: flex; flex-direction: column; gap: 12px;
}
.gv-msg { max-width: 760px; font-size: 13.5px; line-height: 1.75; }
.gv-msg.bot {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  padding: 14px 16px; box-shadow: var(--shadow); align-self: flex-start;
  animation: gvIn 180ms cubic-bezier(.4, 0, .2, 1);
}
.gv-msg.me {
  align-self: flex-end; background: var(--brand); color: #fff; border-radius: var(--r);
  border-end-end-radius: 4px; padding: 10px 14px; font-weight: 600; max-width: 78%;
}
@keyframes gvIn { from { opacity: 0; transform: translateY(6px); } }

.gv-answer { display: block; }
.gv-a-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.gv-a-head svg { width: 19px; height: 19px; flex: 0 0 auto; color: var(--brand); margin-top: 1px; }
.gv-a-head strong { font-size: 14.5px; color: var(--ink); display: block; }
.gv-steps { margin: 0; padding: 0; list-style: none; counter-reset: gvs; }
.gv-steps li {
  counter-increment: gvs; position: relative; padding-inline-start: 32px; padding-block: 7px;
  border-top: 1px dashed var(--line);
}
.gv-steps li:first-child { border-top: 0; }
.gv-steps li::before {
  content: counter(gvs); position: absolute; inset-inline-start: 0; top: 7px;
  width: 22px; height: 22px; border-radius: 50%; background: var(--brand-50); color: var(--brand-600);
  font-family: 'Inter', sans-serif; font-size: 11.5px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.gv-open { margin-top: 12px; }
.gv-open svg { transform: rotate(180deg); }
[dir="rtl"] .gv-open svg { transform: none; }

.gv-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.gv-chip {
  background: var(--bg); border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 12px; font: inherit; font-size: 12.5px; color: var(--ink);
  cursor: pointer; transition: all var(--t); text-align: start;
}
.gv-chip:hover { background: var(--brand-50); border-color: #bcd6ff; color: var(--brand-600); }

.gv-input {
  display: flex; gap: 8px; padding: 12px 18px 16px; background: var(--bg);
  border-top: 1px solid var(--line);
}
.gv-input input {
  flex: 1; height: 42px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--card); padding: 0 18px; font: inherit; font-size: 13.5px; color: var(--text);
  transition: border-color var(--t), box-shadow var(--t);
}
.gv-input input:focus { outline: 0; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-50); }
.gv-input .gv-send { width: 42px; height: 42px; border-radius: 50%; flex: 0 0 auto; }

.gv-browse {
  border-inline-start: 1px solid var(--line); background: var(--card);
  overflow-y: auto; padding: 14px 10px 24px;
}
.gv-browse-head {
  display: flex; align-items: center; gap: 8px; padding: 2px 8px 12px;
  font-size: 13px; color: var(--ink);
}
.gv-browse-head svg { width: 17px; height: 17px; color: var(--muted); }
.gv-cat + .gv-cat { margin-top: 14px; }
.gv-cat-head {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px;
  font-size: 11.5px; font-weight: 800; color: var(--muted-2); text-transform: none;
}
.gv-cat-head svg { width: 15px; height: 15px; }
.gv-cat-head .sub-count { margin-inline-start: auto; }
.gv-link {
  display: block; width: 100%; text-align: start; background: none; border: 0;
  padding: 7px 10px; border-radius: var(--r-sm); font: inherit; font-size: 12.5px;
  color: var(--text); cursor: pointer; transition: background var(--t), color var(--t); line-height: 1.5;
}
.gv-link:hover { background: var(--brand-50); color: var(--brand-600); }

/* اللوحة المنزلقة فوق أي شاشة */
.gv-panel {
  position: fixed; inset-block: 0; inset-inline-end: 0; width: min(440px, 100%);
  background: var(--card); border-inline-start: 1px solid var(--line); box-shadow: var(--shadow-lg);
  z-index: 70; display: flex; flex-direction: column;
  animation: gvSlide 200ms cubic-bezier(.4, 0, .2, 1);
}
@keyframes gvSlide { from { transform: translateX(var(--gv-from, 100%)); opacity: .5; } }
[dir="rtl"] .gv-panel { --gv-from: -100%; }
.gv-panel-head {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  border-bottom: 1px solid var(--line); flex: 0 0 auto;
}
.gv-panel-head > svg { width: 20px; height: 20px; color: var(--brand); flex: 0 0 auto; }
.gv-panel .gv { height: auto; flex: 1; min-height: 0; }

@media (max-width: 960px) {
  .gv { grid-template-columns: 1fr; }
  .gv-browse { display: none; }
}
.view:has(> .gv-pad) { overflow: hidden; }
.gv-denied {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--amber-50); border: 1px solid #f7d9a8; border-radius: var(--r-sm); padding: 12px 14px;
}
.gv-denied svg { width: 18px; height: 18px; flex: 0 0 auto; color: #b54708; margin-top: 2px; }
.gv-denied strong { font-size: 13.5px; color: var(--ink); }

/* ============================== لنبدأ (Onboarding) ======================== */

.ob { display: grid; grid-template-columns: minmax(0, 1fr) 268px; gap: 26px; align-items: start; }
/* زر «لنبدأ» في الشريط العلوي */
.ob-chip { gap: 7px; border-color: #f7d9a8; background: var(--amber-50); color: #b54708; font-weight: 700; }
.ob-chip:hover { border-color: #e8b574; background: #fdf1de; color: #92400e; }
.ob-chip svg { width: 15px; height: 15px; }
.ob-chip-num {
  background: #b54708; color: #fff; border-radius: 999px; padding: 1px 7px;
  font-size: 11.5px; font-weight: 800; line-height: 1.7;
}
.ob-chip.full { border-color: #a6ddb8; background: var(--green-50); color: #067647; }
.ob-chip.full .ob-chip-num { background: #067647; }

.ob-main { min-width: 0; }
.ob-hero { margin-bottom: 18px; }
.ob-hero h2 { font-size: 22px; font-weight: 800; color: var(--ink); margin: 0 0 12px; }
.ob-progress { display: flex; align-items: center; gap: 12px; max-width: 520px; }
.ob-track { flex: 1; height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
.ob-fill { height: 100%; border-radius: 999px; background: var(--brand); transition: width .45s cubic-bezier(.4, 0, .2, 1); }

.ob-donebar {
  display: flex; align-items: center; gap: 12px; margin-bottom: 16px; padding: 14px 16px;
  background: var(--green-50); border: 1px solid #bbe9d1; border-radius: var(--r);
}
.ob-donebar svg { width: 20px; height: 20px; color: #067647; flex: 0 0 auto; }

.ob-steps { display: flex; flex-direction: column; gap: 12px; }
.ob-step { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.ob-head {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: start;
  background: none; border: 0; padding: 18px 20px; font: inherit; cursor: pointer; color: var(--ink);
}
.ob-head strong { font-size: 14.5px; font-weight: 800; }
.ob-check {
  width: 24px; height: 24px; border-radius: 50%; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--line); color: var(--muted-2); background: var(--card);
}
.ob-check svg { width: 14px; height: 14px; }
.ob-step.done .ob-check { background: var(--green); border-color: var(--green); color: #fff; }
.ob-chev { color: var(--muted); display: flex; transition: transform var(--t); }
.ob-chev svg { width: 18px; height: 18px; }
.ob-step.open .ob-chev { transform: rotate(180deg); }
.ob-body { display: none; padding: 0 20px 20px; border-top: 1px solid var(--line); }
.ob-step.open .ob-body { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 22px; padding-top: 18px; }
.ob-art {
  border-radius: var(--r); aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center;
}
.ob-art-badge {
  width: 74px; height: 74px; border-radius: 50%; background: #fff;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 8px 22px rgba(11, 15, 26, .18);
}
.ob-art-badge svg { width: 32px; height: 32px; color: var(--brand); }
.ob-text p { margin: 0 0 14px; font-size: 13.5px; line-height: 1.85; color: var(--muted); }
.ob-state {
  display: flex; align-items: flex-start; gap: 8px; font-size: 12.5px; line-height: 1.7;
  background: var(--amber-50); border: 1px solid #f7d9a8; color: #7a4a06;
  border-radius: var(--r-sm); padding: 9px 12px;
}
.ob-state.ok { background: var(--green-50); border-color: #bbe9d1; color: #05603a; }
.ob-state svg { width: 16px; height: 16px; flex: 0 0 auto; margin-top: 2px; }

.ob-res { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 10px; }
.ob-res h3 { font-size: 13px; font-weight: 800; color: var(--ink); margin: 0 0 8px; padding-inline: 8px; }
.ob-res-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: start;
  background: none; border: 0; padding: 9px 10px; border-radius: var(--r-sm);
  font: inherit; font-size: 13px; color: var(--text); cursor: pointer; transition: background var(--t), color var(--t);
}
.ob-res-item:hover { background: var(--brand-50); color: var(--brand-600); }
.ob-res-item svg { width: 16px; height: 16px; color: var(--muted); flex: 0 0 auto; }
.ob-res-item:hover svg { color: var(--brand-600); }
.ob-res-tip {
  display: flex; gap: 10px; margin-top: 12px; padding: 12px; border-radius: var(--r-sm);
  background: var(--bg); border: 1px solid var(--line);
}
.ob-res-tip > svg { width: 17px; height: 17px; color: var(--brand); flex: 0 0 auto; margin-top: 2px; }
.ob-res-tip strong { font-size: 12.5px; display: block; margin-bottom: 2px; }

.ob-card-ring {
  width: 48px; height: 48px; border-radius: 50%; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; color: var(--brand-600);
  background: conic-gradient(var(--brand) calc(var(--pct) * 1%), var(--line) 0);
  position: relative;
}
.ob-card-ring::before { content: ''; position: absolute; inset: 4px; border-radius: 50%; background: var(--card); }
.ob-card-ring .num { position: relative; }

@media (max-width: 1080px) {
  .ob { grid-template-columns: 1fr; }
  .ob-res { order: -1; }
}
@media (max-width: 720px) {
  .ob-step.open .ob-body { grid-template-columns: 1fr; }
  .ob-art { aspect-ratio: 16 / 9; }
}
