/* ============================================================
   منصة أولى للمراسلة — ورقة الأنماط الرئيسية
   تصميم فاتح هادئ: خلفية رمادية مزرقة، أسطح بيضاء، كحلي للنصوص،
   لون الشركة للأفعال (يتغيّر من الإعدادات)، وأخضر واتساب للحالات الإيجابية.
   الخطوط مستضافة داخل المنصة (لا تعتمد على خدمات خارجية).
   ============================================================ */

@font-face { font-family: "Alexandria"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("../fonts/alexandria-arabic-wght-normal.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "Alexandria"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("../fonts/alexandria-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Reem Kufi"; font-style: normal; font-weight: 500; font-display: swap;
  src: url("../fonts/reem-kufi-arabic-500-normal.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "Reem Kufi"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("../fonts/reem-kufi-arabic-600-normal.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "Reem Kufi"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("../fonts/reem-kufi-arabic-700-normal.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "Reem Kufi"; font-style: normal; font-weight: 500; font-display: swap;
  src: url("../fonts/reem-kufi-latin-500-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Reem Kufi"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("../fonts/reem-kufi-latin-600-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Reem Kufi"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("../fonts/reem-kufi-latin-700-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  /* أسطح محايدة، ونص فحمي من شعار أولى، وبرونزي للأفعال */
  --page: #F1F1F0;
  --surface: #FFFFFF;
  --surface-2: #F7F7F6;
  --surface-3: #EDEDEB;
  --line: #E4E3E0;
  --line-2: #D5D3CF;
  --ink: #1E1D1B;
  --ink-2: #4A4743;
  --ink-3: #85817A;
  --charcoal: #252525;
  --charcoal-2: #2F2F2F;
  --charcoal-3: #3A3A3A;
  --brand: #8C6239;
  --brand-2: #704E2E;
  --brand-soft: #F4EFEA;
  --brand-line: #E2D2C2;
  --brand-ink: #5E4229;
  --bronze-1: #A07850;
  --bronze-2: #C09868;
  --bronze-3: #D8B080;
  --bronze-grad: linear-gradient(135deg, #9E7650 0%, #C59D6D 55%, #DDB98C 100%);
  --saffron: #C98A1B;
  --saffron-soft: #FBF1DE;
  --green: #1E8E5A;
  --green-soft: #E4F3EB;
  --red: #C8463D;
  --red-soft: #FBE9E7;
  --info: #3D5A80;
  --info-soft: #E8EEF6;
  --wa-bg: #E9E4DC;
  --wa-out: #F3E9DB;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(30, 29, 27, .05), 0 2px 10px rgba(30, 29, 27, .045);
  --shadow-lg: 0 10px 34px rgba(30, 29, 27, .16);
  --sidebar-w: 252px;
  --font: "Alexandria", "Segoe UI", Tahoma, sans-serif;
  --font-display: "Reem Kufi", "Alexandria", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
/* العناصر المخفية تبقى مخفية مهما كان تنسيق صنفها */
[hidden] { display: none !important; }
html { font-size: 15px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--page);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); font-weight: 600; line-height: 1.3; letter-spacing: 0; }
h1 { font-size: 1.55rem; }
h1:focus, h1:focus-visible { outline: none; }
h2 { font-size: 1.1rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .5rem; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img, video { max-width: 100%; }
code, .mono { font-family: var(--mono); font-size: .9em; }
code { background: var(--surface-3); padding: .05em .35em; border-radius: 4px; direction: ltr; unicode-bidi: embed; }
mark { background: var(--saffron-soft); color: #8A5A00; border-radius: 3px; padding: 0 .15em; }
small { font-size: .82em; }
.small { font-size: .85rem; }
.muted { color: var(--ink-3); }
.block { display: block; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; }
.row.gap, .gap { gap: .5rem; }
.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.center { align-self: center; }
.pad { padding: 1rem 1.25rem; }
.text-bad { color: var(--red); }
.rot180 { transform: rotate(180deg); }
.icon { display: inline-block; vertical-align: -0.18em; flex-shrink: 0; }
::selection { background: var(--brand-soft); }

/* ---------- حقول الإدخال ---------- */
input, select, textarea, button { font: inherit; color: inherit; }
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]), select, textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  padding: .55rem .8rem;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-3); color: var(--ink-3); cursor: not-allowed; }
input::placeholder, textarea::placeholder { color: #A5AEBF; }
textarea { resize: vertical; min-height: 2.6rem; }
select { appearance: none; -webkit-appearance: none; padding-inline-end: 2rem; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%237A869C' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: left .7rem center; }
input[type="checkbox"] { width: 1.05rem; height: 1.05rem; accent-color: var(--brand); cursor: pointer; }
input[type="range"] { width: 100%; accent-color: var(--brand); }
input[type="color"] { width: 2.2rem; height: 2.2rem; padding: 0; border: 1px solid var(--line-2); border-radius: 6px; background: none; cursor: pointer; }
.select-sm, .input-sm { padding: .35rem .6rem !important; font-size: .88rem; width: auto !important; }
.select-sm { padding-inline-end: 1.8rem !important; }
.field { display: flex; flex-direction: column; gap: .35rem; margin-bottom: .9rem; }
.field > span, .field > label { font-size: .86rem; font-weight: 500; color: var(--ink-2); }
.field small { color: var(--ink-3); }
.field.inline { flex-direction: row; align-items: center; gap: .6rem; margin: 0; }
.field.inline > span { white-space: nowrap; }
.field-foot { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.form-grid .span-2 { grid-column: span 2; }
.check, .check-row { display: flex; align-items: flex-start; gap: .55rem; cursor: pointer; margin: .4rem 0 .8rem; font-size: .92rem; }
.check input, .check-row input { margin-top: .2rem; }
.check.small { font-size: .84rem; margin: .3rem 0; }
.form-actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: .5rem; }
.form-error, .form-alert.bad { background: var(--red-soft); color: #9A2B2B; border: 1px solid #F3C5C5; border-radius: var(--radius-sm); padding: .6rem .8rem; font-size: .9rem; margin: .5rem 0; }
.form-alert.ok { background: var(--green-soft); color: #176B48; border: 1px solid #BDE6D1; border-radius: var(--radius-sm); padding: .6rem .8rem; font-size: .9rem; margin: .5rem 0; display: flex; gap: .4rem; align-items: center; }
.form-alert.bad { display: flex; gap: .4rem; align-items: center; }
.validation-message { color: var(--red); font-size: .82rem; }
.hint { font-size: .82rem; color: var(--ink-3); }

/* ---------- الأزرار ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  padding: .55rem 1rem; border-radius: var(--radius-sm); border: 1px solid transparent;
  background: var(--surface-3); color: var(--ink); font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: background .15s, box-shadow .15s, transform .05s; text-decoration: none !important; line-height: 1.3;
}
.btn:hover { background: #E2E7EF; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-2); }
.btn-primary.danger { background: var(--red); }
.btn-ghost { background: transparent; border-color: var(--line-2); }
.btn-ghost:hover { background: var(--surface-2); }
.btn.danger { color: var(--red); }
.btn-ghost.danger:hover { background: var(--red-soft); }
.btn-sm { padding: .35rem .7rem; font-size: .86rem; }
.btn-block { width: 100%; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 2.25rem; height: 2.25rem;
  border-radius: var(--radius-sm); border: 0; background: transparent; color: var(--ink-2); cursor: pointer; position: relative;
}
.icon-btn:hover { background: var(--surface-3); color: var(--ink); }
.icon-btn.active { background: var(--brand-soft); color: var(--brand); }
.icon-btn.danger:hover { background: var(--red-soft); color: var(--red); }
.icon-btn.disabled, .icon-btn:disabled { opacity: .4; pointer-events: none; }
.icon-btn input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.link { font-size: .88rem; }
.link-btn { background: none; border: 0; color: var(--brand); cursor: pointer; font-size: .85rem; padding: 0; }
.back-link { display: inline-flex; align-items: center; gap: .25rem; font-size: .85rem; color: var(--ink-3); margin-bottom: .25rem; }
.back-link:hover { color: var(--brand); text-decoration: none; }

/* ---------- الهيكل العام ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0; background: var(--surface); border-inline-end: 1px solid var(--line);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: .65rem; padding: 1.1rem 1.1rem .9rem; color: var(--ink); text-decoration: none !important; }
.brand img { border-radius: 9px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text b { font-family: var(--font-display); font-size: 1.15rem; letter-spacing: .01em; direction: ltr; text-align: start; }
.brand-text small { color: var(--ink-3); font-size: .74rem; }
.brand-lg img { border-radius: 12px; }
.brand-lg .brand-text b { font-size: 1.45rem; }
.tenant-chip {
  margin: 0 .9rem .6rem; padding: .45rem .7rem; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line);
  font-size: .84rem; font-weight: 500; display: flex; align-items: center; gap: .45rem; color: var(--ink-2); overflow: hidden;
}
.tenant-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav { display: flex; flex-direction: column; padding: .25rem .6rem; gap: 2px; flex: 1; }
.nav a {
  display: flex; align-items: center; gap: .65rem; padding: .55rem .7rem; border-radius: var(--radius-sm);
  color: var(--ink-2); font-weight: 500; font-size: .93rem; text-decoration: none !important; position: relative;
}
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a.active { background: var(--brand-soft); color: var(--brand); }
.nav a.active::before { content: ""; position: absolute; inset-inline-start: -0.6rem; top: 20%; height: 60%; width: 3px; border-radius: 3px; background: var(--brand); }
.nav-badge { margin-inline-start: auto; background: var(--green); color: #fff; font-size: .72rem; font-weight: 600; border-radius: 999px; padding: 0 .45rem; min-width: 1.35rem; text-align: center; line-height: 1.35rem; font-style: normal; }
.nav-sep { font-size: .72rem; color: var(--ink-3); font-weight: 600; letter-spacing: .04em; padding: .9rem .7rem .3rem; }
.sidebar-foot { border-top: 1px solid var(--line); padding: .7rem .9rem; display: flex; align-items: center; gap: .4rem; }
.user-row { display: flex; align-items: center; gap: .6rem; flex: 1; min-width: 0; color: var(--ink); text-decoration: none !important; padding: .3rem; border-radius: var(--radius-sm); }
.user-row:hover { background: var(--surface-2); }
.user-meta { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.user-meta b { font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-meta small { color: var(--ink-3); font-size: .74rem; }
.logout-form { margin: 0; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 56px; display: flex; align-items: center; gap: .5rem; padding: 0 1.5rem; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar-spacer { flex: 1; }
.menu-toggle { display: none; }
.content { padding: 1.5rem; max-width: 1400px; width: 100%; margin: 0 auto; flex: 1; }
.nav-scrim { display: none; }
.alerts-wrap { position: relative; }
.dot-badge { position: absolute; top: 4px; inset-inline-start: 4px; background: var(--red); color: #fff; font-size: .66rem; font-weight: 600; font-style: normal; border-radius: 999px; min-width: 1.1rem; height: 1.1rem; line-height: 1.1rem; text-align: center; padding: 0 .25rem; }
.alerts-panel { position: absolute; top: calc(100% + .5rem); inset-inline-start: 0; width: 360px; max-width: 90vw; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); z-index: 50; max-height: 70vh; overflow-y: auto; }
.alerts-head { display: flex; justify-content: space-between; align-items: center; padding: .8rem 1rem; border-bottom: 1px solid var(--line); }
.alerts-empty { padding: 1.5rem; text-align: center; color: var(--ink-3); font-size: .9rem; }
.alert-row { padding: .7rem 1rem; border-bottom: 1px solid var(--line); border-inline-start: 3px solid var(--line-2); font-size: .88rem; }
.alert-row.sev-warn { border-inline-start-color: var(--saffron); }
.alert-row.sev-bad { border-inline-start-color: var(--red); }
.alert-row.sev-info { border-inline-start-color: var(--brand); }
.alert-row p { color: var(--ink-2); margin: .15rem 0; }
.alert-row small { color: var(--ink-3); }

/* ---------- الرؤوس والبطاقات ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.page-head h1 { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.page-head p { margin: .2rem 0 0; font-size: .92rem; }
.head-actions { display: flex; gap: .6rem; flex-wrap: wrap; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); margin-bottom: 1.25rem; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.card-head h2 { display: flex; align-items: center; gap: .5rem; }
.table-card { padding: 0; overflow: hidden; position: relative; }
.table-card .card-head { padding: 1rem 1.25rem 0; }
.table-card .pad { padding: 1.25rem; }
.sec-title { margin: 1.25rem 0 .6rem; font-size: .95rem; }
.sec-title:first-child { margin-top: 0; }
.page-loading, .page-center { display: flex; align-items: center; justify-content: center; min-height: 50vh; color: var(--ink-3); }
.grid-main { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 1.25rem; }
.grid-main .card { margin: 0; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.25rem; margin-bottom: 1.25rem; }
.grid-2 .card { margin: 0; }
.callout { display: flex; align-items: center; gap: 1rem; padding: 1rem 1.25rem; border-radius: var(--radius); background: var(--brand-soft); border: 1px solid var(--brand-line); color: var(--ink); margin-bottom: 1.25rem; }
.callout > .icon { color: var(--brand); }
.callout > div { flex: 1; }
.callout b { display: block; margin-bottom: .15rem; }
.callout p { margin: 0; color: var(--ink-2); font-size: .92rem; }
.callout.warn { background: var(--saffron-soft); border-color: #F3DFAE; }
.callout.warn > .icon { color: #B57A00; }
.callout.soft { background: var(--surface-2); border-color: var(--line); }
.callout.soft > .icon { color: var(--ink-3); }
.callout.small { padding: .6rem .9rem; font-size: .88rem; margin: .5rem 0 1rem; }
.callout ul { margin: .3rem 0 0; padding-inline-start: 1.1rem; font-size: .9rem; }

/* ---------- المؤشرات ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.stats-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stats-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.15rem; display: flex; flex-direction: column; gap: .15rem; color: var(--ink); text-decoration: none !important; box-shadow: var(--shadow); min-width: 0; }
a.stat:hover { border-color: var(--line-2); }
.stat-label { font-size: .8rem; color: var(--ink-3); font-weight: 500; }
.stat b { font-size: 1.65rem; font-family: var(--font-display); font-weight: 600; line-height: 1.2; }
.stat small { color: var(--ink-3); }
.mini-stats { display: flex; gap: .5rem; flex-wrap: wrap; margin: .5rem 0 1rem; }
.mini-stats > div { flex: 1; min-width: 90px; background: var(--surface-2); border-radius: var(--radius-sm); padding: .7rem .8rem; display: flex; flex-direction: column; }
.mini-stats b { font-size: 1.2rem; font-family: var(--font-display); }
.mini-stats span { font-size: .78rem; color: var(--ink-3); }
.pill { display: inline-flex; align-items: center; gap: .25rem; padding: .1rem .55rem; border-radius: 999px; font-size: .76rem; font-weight: 600; white-space: nowrap; background: var(--surface-3); color: var(--ink-2); line-height: 1.5; }
.pill-ok { background: var(--green-soft); color: #176B48; }
.pill-warn { background: var(--saffron-soft); color: #8A5A00; }
.pill-bad { background: var(--red-soft); color: #9A2B2B; }
.pill-info { background: var(--info-soft); color: var(--info); }
.pill-brand { background: var(--brand-soft); color: var(--brand-ink); }
.pill-muted { background: var(--surface-3); color: var(--ink-3); }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--line-2); flex-shrink: 0; display: inline-block; }
.status-dot.ok { background: var(--green); }
.status-dot.warn { background: var(--saffron); }
.status-dot.bad { background: var(--red); }
.status-dot.info { background: var(--info); }
.status-dot.muted { background: var(--line-2); }
.status-dot.big { width: 14px; height: 14px; }
.progress { height: 6px; background: var(--surface-3); border-radius: 999px; overflow: hidden; display: flex; margin: .3rem 0; }
.progress-bar { height: 100%; background: var(--green); transition: width .4s; }
.progress-bar.bad { background: var(--red); }
.progress.big { height: 14px; margin: .5rem 0 1rem; }
.legend { display: flex; align-items: center; gap: .4rem; font-size: .8rem; color: var(--ink-3); }
.sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-inline-start: .5rem; }
.sw-in { background: var(--charcoal-3); }
.sw-out { background: var(--bronze-2); }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 190px; padding-top: .5rem; }
.bars.tall { height: 240px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; min-width: 0; }
.bar-stack { flex: 1; width: 100%; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; border-bottom: 1px solid var(--line); }
.bar { width: 100%; border-radius: 4px 4px 2px 2px; min-height: 2px; transition: height .4s; }
.bar-in { background: var(--charcoal-3); }
.bar-out { background: var(--bronze-2); }
.bar-label { font-size: .7rem; color: var(--ink-3); margin-top: .35rem; white-space: nowrap; height: 1rem; }
.bar-col::after { content: ""; display: block; height: 1rem; margin-top: .35rem; }
.bar-col:has(.bar-label)::after { display: none; }
.list { list-style: none; margin: 0; padding: 0; }
.list-row { display: flex; align-items: center; gap: .8rem; padding: .65rem 0; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.list-row b { display: block; font-size: .92rem; }
.list-row small { color: var(--ink-3); display: block; }
.rank { list-style: none; margin: 0; padding: 0; }
.rank li { display: flex; align-items: center; gap: .8rem; padding: .4rem 0; font-size: .9rem; }
.rank li > span { width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-bar { flex: 1; height: 8px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.rank-bar i { display: block; height: 100%; background: var(--brand); border-radius: 999px; }
.rank em { font-style: normal; font-weight: 600; min-width: 2.5rem; text-align: end; }
.rank.wide li > span { width: 170px; }
.heat { display: grid; grid-template-columns: repeat(12, 1fr); gap: 4px; margin: .5rem 0; }
.heat-cell { aspect-ratio: 1; border-radius: 6px; background: var(--surface-3); display: flex; align-items: center; justify-content: center; font-size: .66rem; color: var(--ink-2); position: relative; overflow: hidden; }
.heat-cell::before { content: ""; position: absolute; inset: 0; background: var(--brand); opacity: calc(.05 + var(--a, 0) * .9); }
.heat-cell span { position: relative; }
.heat-cell.hot span { color: #fff; }

.reasons { margin-top: 1rem; font-size: .9rem; }
.reasons ul { list-style: none; margin: .4rem 0 0; padding: 0; }
.reasons li { display: flex; justify-content: space-between; gap: 1rem; padding: .35rem 0; border-bottom: 1px dashed var(--line); }
.reasons em { font-style: normal; font-weight: 600; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: .35rem 1rem; margin: 0; font-size: .9rem; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; word-break: break-word; }
.kv.review { font-size: 1rem; gap: .6rem 1.2rem; margin-bottom: 1rem; }

/* ---------- الجداول ---------- */
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: start; font-weight: 600; font-size: .78rem; color: var(--ink-3); padding: .75rem 1.25rem; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.table td { padding: .7rem 1.25rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #FAFBFD; }
.table.compact th, .table.compact td { padding: .45rem .75rem; }
.table.hours td { padding: .4rem .5rem; border-bottom: 0; }
.table.hours input[type="time"] { width: 120px; }
.row-muted td { opacity: .55; }
.row-bad td { background: #FFF7F7; }
.w-check { width: 2.5rem; }
.w-progress { min-width: 160px; }
.cell-person { display: flex; align-items: center; gap: .6rem; }
.cell-person small { display: block; }
.row-actions { white-space: nowrap; text-align: end; }
.pager { display: flex; justify-content: space-between; align-items: center; padding: .75rem 1.25rem; border-top: 1px solid var(--line); font-size: .88rem; }
.toolbar { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: 1rem; }
.toolbar .search { max-width: 340px; }
.bulk { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; background: var(--brand-soft); border-radius: var(--radius-sm); padding: .35rem .6rem; font-size: .86rem; }
.search { position: relative; display: flex; align-items: center; flex: 1; min-width: 180px; }
.search .icon { position: absolute; inset-inline-start: .7rem; color: var(--ink-3); pointer-events: none; }
.search input { padding-inline-start: 2.2rem !important; }
.chips { display: flex; gap: .35rem; flex-wrap: wrap; }
.chip { border: 1px solid var(--line-2); background: var(--surface); border-radius: 999px; padding: .25rem .75rem; font-size: .84rem; cursor: pointer; display: inline-flex; align-items: center; gap: .35rem; color: var(--ink-2); }
.chip:hover { background: var(--surface-2); }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip em { font-style: normal; font-size: .74rem; background: rgba(0,0,0,.08); border-radius: 999px; padding: 0 .4rem; }
.chip.on em { background: rgba(255,255,255,.2); }
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: 1.25rem; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: .7rem .9rem; cursor: pointer; color: var(--ink-2); font-weight: 500; display: inline-flex; align-items: center; gap: .4rem; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button:hover { color: var(--ink); }
.tabs button.on { color: var(--brand); border-bottom-color: var(--brand); }
.tabs em { font-style: normal; font-size: .74rem; background: var(--surface-3); border-radius: 999px; padding: 0 .4rem; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--radius-sm); overflow: hidden; margin-bottom: .75rem; }
.seg button { border: 0; background: var(--surface); padding: .45rem .9rem; cursor: pointer; color: var(--ink-2); font-size: .88rem; border-inline-end: 1px solid var(--line); }
.seg button:last-child { border-inline-end: 0; }
.seg button:hover { background: var(--surface-2); }
.seg button.on { background: var(--ink); color: #fff; }
.seg button.on.ok { background: var(--green); }
.seg button.on.bad { background: var(--red); }
.seg-cat { width: 100%; }
.seg-cat button { flex: 1; display: flex; flex-direction: column; align-items: flex-start; gap: .1rem; padding: .6rem .9rem; text-align: start; }
.seg-cat button small { font-size: .74rem; opacity: .8; }
.tags { display: flex; flex-wrap: wrap; gap: .3rem; }
.tags.big { gap: .45rem; margin: .5rem 0 1rem; }
.tags.small .tag { font-size: .72rem; padding: 0 .45rem; }
.tag { --lc: var(--brand); display: inline-flex; align-items: center; gap: .25rem; border: 1px solid var(--line-2); border-radius: 999px; padding: .05rem .55rem; font-size: .78rem; background: var(--surface); color: var(--ink-2); cursor: default; }
button.tag { cursor: pointer; }
button.tag:hover { border-color: var(--lc); }
.tag.on { background: color-mix(in srgb, var(--lc) 12%, white); border-color: color-mix(in srgb, var(--lc) 40%, white); color: color-mix(in srgb, var(--lc) 80%, black); }
.tag-x { border: 0; background: none; cursor: pointer; padding: 0 .1rem; color: inherit; opacity: .6; }
.tag-x:hover { opacity: 1; }
.switch { display: inline-flex; align-items: center; gap: .5rem; cursor: pointer; font-size: .86rem; color: var(--ink-2); }
.switch input { appearance: none; width: 2.4rem; height: 1.35rem; border-radius: 999px; background: var(--line-2); position: relative; cursor: pointer; transition: background .2s; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 2px; inset-inline-start: 2px; width: 1.05rem; height: 1.05rem; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked { background: var(--brand); }
.switch input:checked::after { transform: translateX(-1.05rem); }

/* ---------- الحالة الفارغة ---------- */
.empty { text-align: center; padding: 2.5rem 1.5rem; color: var(--ink-2); display: flex; flex-direction: column; align-items: center; gap: .4rem; }
.empty-icon { width: 60px; height: 60px; border-radius: 18px; background: var(--brand-soft); color: var(--brand); display: flex; align-items: center; justify-content: center; margin-bottom: .5rem; }
.empty h3 { font-size: 1.1rem; }
.empty p { max-width: 420px; color: var(--ink-3); font-size: .92rem; }
.empty .btn { margin-top: .5rem; }
.how { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin-top: 1.5rem; text-align: start; width: 100%; }
.how > div { display: flex; gap: .6rem; align-items: flex-start; }
.how span { width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: #fff; font-weight: 600; font-size: .8rem; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.how b { display: block; font-size: .88rem; }
.how small { color: var(--ink-3); }

/* ---------- الصورة الرمزية ---------- */
.avatar { --av-bg: var(--brand); display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--av-bg); color: #fff; font-weight: 600; flex-shrink: 0; letter-spacing: 0; }

/* ---------- التنبيهات المنبثقة ---------- */
.toast-host { position: fixed; bottom: 1.25rem; inset-inline-start: 1.25rem; display: flex; flex-direction: column; gap: .5rem; z-index: 1000; max-width: 380px; }
.toast { display: flex; align-items: center; gap: .6rem; background: var(--ink); color: #fff; padding: .7rem 1rem; border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); font-size: .9rem; cursor: pointer; animation: toast-in .25s ease-out; }
.toast-ok { background: #176B48; }
.toast-bad { background: #9A2B2B; }
.toast-warn { background: #8A5A00; }
.toast-info { background: var(--ink); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- النوافذ ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(30, 30, 30, .5); display: flex; align-items: center; justify-content: center; z-index: 500; padding: 1rem; animation: fade .15s; }
.modal { background: var(--surface); border-radius: 16px; width: 100%; max-width: 560px; max-height: 92vh; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: pop .18s ease-out; }
.modal-wide { max-width: 900px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); }
.modal-body { padding: 1.25rem; overflow-y: auto; }
.modal-foot { padding: 1rem 1.25rem; border-top: 1px solid var(--line); }
.modal-actions { display: flex; justify-content: flex-end; align-items: center; gap: .6rem; margin-top: 1rem; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: none; } }
.cred-box { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .6rem 1rem; margin: .75rem 0; }
.cred-box > div { display: flex; gap: 1rem; align-items: center; padding: .35rem 0; border-bottom: 1px dashed var(--line); font-size: .9rem; }
.cred-box > div:last-child { border-bottom: 0; }
.cred-box span { color: var(--ink-3); min-width: 110px; }
.cred-box code { background: var(--surface); border: 1px solid var(--line); padding: .25rem .6rem; border-radius: 6px; word-break: break-all; user-select: all; }
.code-sample, .code { background: #262626; color: #E6ECF5; border-radius: var(--radius-sm); padding: .9rem 1rem; font-family: var(--mono); font-size: .8rem; line-height: 1.6; overflow-x: auto; direction: ltr; text-align: left; margin: .5rem 0 1rem; white-space: pre; }
.file-drop { display: flex; flex-direction: column; align-items: center; gap: .35rem; border: 2px dashed var(--line-2); border-radius: var(--radius); padding: 1.25rem; cursor: pointer; position: relative; color: var(--ink-2); margin: .5rem 0; }
.file-drop:hover { border-color: var(--brand); background: var(--surface-2); }
.file-drop input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file-drop.has-file { border-style: solid; border-color: var(--green); background: var(--green-soft); }
/* حقل ملف مدمج: أيقونة + اسم الملف + تلميح (الشعار، ترويسة القالب) */
.receipt-drop { display: flex; align-items: center; gap: .75rem; position: relative; border: 1.5px dashed var(--line-2); border-radius: var(--radius-sm);
  padding: .8rem 1rem; margin: .3rem 0 .8rem; background: var(--surface); color: var(--ink-2); cursor: pointer; transition: border-color .15s, background .15s; }
.receipt-drop > span { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.receipt-drop b { font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.receipt-drop small { color: var(--ink-3); font-size: .8rem; }
.receipt-drop input[type="file"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.receipt-drop.has-file { border-style: solid; border-color: var(--green); background: var(--green-soft); }
.import-result { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-top: .75rem; font-size: .9rem; }
.import-result details { width: 100%; }
.import-result ul { font-size: .82rem; color: var(--red); margin: .3rem 0 0; }

/* ---------- صفحات الدخول ---------- */
.auth-shell { display: flex; min-height: 100vh; }
.auth-pitch { position: relative; z-index: 1; max-width: 460px; }
.auth-pitch h2 { font-size: 2rem; margin-bottom: .75rem; line-height: 1.35; }
.auth-pitch p { color: rgba(255,255,255,.85); font-size: 1rem; margin-bottom: 1.25rem; }
.auth-foot { font-size: .8rem; color: rgba(255,255,255,.65); position: relative; z-index: 1; }
.auth-main { flex: 1; display: flex; align-items: center; justify-content: center; padding: 2rem 1.5rem; }
.auth-card { width: 100%; max-width: 440px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 2rem; box-shadow: var(--shadow); }
.auth-card h1 { margin-bottom: .25rem; }
.auth-card > .muted { margin-bottom: 1.25rem; font-size: .92rem; }
.auth-card .btn-block { margin-top: .5rem; padding: .7rem; }
.auth-card .grid-2 { gap: 0 1rem; margin: 0; }
.auth-switch { margin-top: 1.25rem; text-align: center; font-size: .9rem; color: var(--ink-2); }
/* تلميح الموظف الجديد في صفحة الدخول + رابط العودة للصفحة العامة */
.auth-hint { display: flex; gap: .55rem; align-items: flex-start; margin-top: 1.1rem; padding: .7rem .85rem; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); font-size: .86rem; line-height: 1.7; }
.auth-hint .icon { color: var(--green); margin-top: .2rem; }
.auth-hint b { color: var(--ink); }
.auth-back { margin: .9rem 0 0; text-align: center; font-size: .86rem; }
.auth-back a { display: inline-flex; align-items: center; gap: .35rem; color: var(--ink-3); }
.auth-back a:hover { color: var(--brand); }

/* ---------- صندوق المحادثات ---------- */
.inbox { display: grid; grid-template-columns: 360px minmax(0, 1fr); height: calc(100vh - 56px - 3rem); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); margin: -0.25rem 0 0; }
.inbox-list { border-inline-end: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--surface); }
.inbox-list-head { display: flex; gap: .5rem; padding: .85rem .85rem .5rem; flex-wrap: wrap; }
.inbox-list-head .search { min-width: 160px; }
.inbox-list .chips { padding: 0 .85rem .6rem; border-bottom: 1px solid var(--line); }
.inbox-list .chip { padding: .15rem .6rem; font-size: .8rem; }
.conv-list { flex: 1; overflow-y: auto; min-height: 0; }
.conv { display: flex; gap: .7rem; padding: .75rem .85rem; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none !important; transition: background .1s; }
.conv:hover { background: var(--surface-2); }
.conv.active { background: var(--brand-soft); }
.conv-body { flex: 1; min-width: 0; }
.conv-top { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.conv-name { font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-top time { font-size: .74rem; color: var(--ink-3); white-space: nowrap; }
.conv-bottom { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.conv-preview { font-size: .84rem; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv.unread .conv-preview { color: var(--ink-2); font-weight: 500; }
.conv.unread .conv-name { font-weight: 700; }
.unread-badge { font-style: normal; background: var(--green); color: #fff; font-size: .72rem; font-weight: 600; border-radius: 999px; min-width: 1.3rem; height: 1.3rem; line-height: 1.3rem; text-align: center; padding: 0 .35rem; flex-shrink: 0; }
.conv-meta { display: flex; gap: .3rem; flex-wrap: wrap; margin-top: .3rem; }
.meta-chip { --lc: var(--brand); display: inline-flex; align-items: center; gap: .2rem; font-size: .7rem; color: var(--ink-3); background: var(--surface-3); border-radius: 4px; padding: 0 .4rem; }
.meta-chip.warn { background: var(--saffron-soft); color: #8A5A00; }
.meta-chip.label { background: color-mix(in srgb, var(--lc) 14%, white); color: color-mix(in srgb, var(--lc) 75%, black); }
.inbox-thread { min-width: 0; display: flex; flex-direction: column; min-height: 0; background: var(--surface-2); }
.thread-empty { flex: 1; display: flex; align-items: center; justify-content: center; }
.thread { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.thread-head { display: flex; align-items: center; gap: .75rem; padding: .6rem 1rem; background: var(--surface); border-bottom: 1px solid var(--line); }
.thread-head .back-link { display: none; margin: 0; }
.thread-head b { display: block; font-size: .95rem; }
.thread-head small { color: var(--ink-3); display: block; font-size: .78rem; }
.thread-actions { display: flex; align-items: center; gap: .35rem; }
.thread-split { display: flex; flex: 1; min-height: 0; }
.thread-main { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; }
.messages { flex: 1; overflow-y: auto; padding: 1rem 1.25rem; display: flex; flex-direction: column; gap: .35rem; background: var(--surface-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Ccircle cx='20' cy='20' r='1.2' fill='%23D9D4CB'/%3E%3Ccircle cx='80' cy='60' r='1.2' fill='%23D9D4CB'/%3E%3Ccircle cx='40' cy='100' r='1.2' fill='%23D9D4CB'/%3E%3C/svg%3E"); }
.messages > :first-child { margin-top: auto; }
.day-sep { align-self: center; margin: .6rem 0 .4rem; }
.day-sep span { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: .1rem .7rem; font-size: .74rem; color: var(--ink-3); }
.msg { max-width: min(68%, 560px); background: var(--surface); border-radius: 14px; padding: .5rem .75rem .35rem; box-shadow: 0 1px 1px rgba(0,0,0,.05); position: relative; font-size: .93rem; }
.msg.in { align-self: flex-start; border-start-start-radius: 4px; }
.msg.out { align-self: flex-end; background: var(--wa-out); border-start-end-radius: 4px; }
.msg.failed { border: 1px solid #F3C5C5; background: #FFF4F4; }
.msg-text { white-space: pre-wrap; word-wrap: break-word; line-height: 1.55; }
.msg-meta { display: flex; justify-content: flex-end; align-items: center; gap: .35rem; font-size: .7rem; color: var(--ink-3); margin-top: .15rem; }
.msg-meta time { font-variant-numeric: tabular-nums; }
.ticks { display: inline-flex; }
.tick-read { color: #2F8DE4; }
.tick-failed { color: var(--red); }
.msg-error { font-size: .76rem; color: var(--red); margin-top: .25rem; }
.quote { border-inline-start: 3px solid var(--brand); background: rgba(0,0,0,.04); border-radius: 6px; padding: .3rem .6rem; font-size: .8rem; color: var(--ink-2); margin-bottom: .35rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.msg-img { max-width: 100%; max-height: 320px; border-radius: 10px; display: block; margin-bottom: .25rem; }
.msg-video { max-width: 100%; max-height: 320px; border-radius: 10px; display: block; }
.msg-sticker { width: 140px; height: 140px; object-fit: contain; }
.media-missing { display: flex; align-items: center; gap: .4rem; color: var(--ink-3); font-size: .85rem; padding: .3rem 0; }
.doc { display: flex; align-items: center; gap: .6rem; background: rgba(0,0,0,.04); border-radius: 8px; padding: .5rem .7rem; color: var(--ink); text-decoration: none !important; }
.doc span { display: flex; flex-direction: column; font-size: .88rem; }
.doc small { color: var(--ink-3); }
.tpl-tag { display: inline-flex; align-items: center; gap: .25rem; font-size: .72rem; color: var(--ink-3); background: rgba(0,0,0,.05); border-radius: 4px; padding: 0 .4rem; margin-bottom: .25rem; }
.reaction { font-size: 1.3rem; }
.note-msg { align-self: center; max-width: 80%; display: flex; gap: .5rem; align-items: flex-start; background: var(--saffron-soft); border: 1px dashed #E9CB7A; border-radius: 10px; padding: .5rem .8rem; font-size: .85rem; color: #6B4A00; margin: .25rem 0; }
.note-msg small { color: #9A7320; display: block; font-size: .72rem; }
.note-text { white-space: pre-wrap; }
.composer { background: var(--surface); border-top: 1px solid var(--line); padding: .6rem .9rem; position: static; }
.composer.note-mode { background: var(--saffron-soft); }
.composer-row { display: flex; align-items: flex-end; gap: .5rem; }
.composer-tools { display: flex; gap: .15rem; align-items: center; padding-bottom: .15rem; }
.composer textarea { resize: none; max-height: 160px; min-height: 2.6rem; border-radius: 14px; }
.send-btn { width: 2.7rem; height: 2.7rem; padding: 0; border-radius: 50%; flex-shrink: 0; }
.window-banner { display: flex; align-items: center; gap: .6rem; background: var(--saffron-soft); border: 1px solid #F3DFAE; color: #6B4A00; border-radius: var(--radius-sm); padding: .5rem .8rem; font-size: .86rem; margin-bottom: .6rem; }
.window-banner span { flex: 1; }
.window-banner.soft { background: var(--surface-2); border-color: var(--line); color: var(--ink-3); padding: .3rem .7rem; font-size: .78rem; }
.quick-pop { position: absolute; bottom: calc(100% - .25rem); inset-inline-start: 4rem; inset-inline-end: 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); overflow: hidden; z-index: 10; }
.quick-pop button { display: flex; gap: .6rem; width: 100%; border: 0; background: none; padding: .55rem .9rem; text-align: start; cursor: pointer; font-size: .88rem; border-bottom: 1px solid var(--line); }
.quick-pop button:last-child { border-bottom: 0; }
.quick-pop button:hover { background: var(--surface-2); }
.quick-pop button b { color: var(--brand); font-family: var(--mono); font-size: .8rem; white-space: nowrap; }
.quick-pop button span { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact-panel { width: 300px; border-inline-start: 1px solid var(--line); background: var(--surface); overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: 1rem; }
.panel-sec > label:first-child, .panel-sec label:not(.check) { display: block; font-size: .78rem; color: var(--ink-3); font-weight: 600; margin-bottom: .35rem; }
.panel-sec .seg { width: 100%; margin: 0; }
.panel-sec .seg button { flex: 1; font-size: .8rem; padding: .35rem .3rem; }
.panel-sec input, .panel-sec textarea { font-size: .88rem; }
.panel-sec .tags { margin-bottom: .4rem; }

/* ---------- معاينة واتساب ---------- */
.wa-preview { background: var(--wa-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'%3E%3Ccircle cx='20' cy='20' r='1' fill='%23cbc2b8'/%3E%3Ccircle cx='60' cy='50' r='1' fill='%23cbc2b8'/%3E%3C/svg%3E"); border-radius: 14px; padding: 1.25rem 1rem; }
.wa-screen { max-width: 340px; margin: 0 auto; }
.wa-bubble { background: #fff; border-radius: 10px; border-start-start-radius: 2px; padding: .5rem .7rem .3rem; box-shadow: 0 1px 1px rgba(0,0,0,.1); font-size: .9rem; color: #111; }
.wa-media { display: flex; flex-direction: column; align-items: center; gap: .25rem; background: #EEE; border-radius: 8px; height: 120px; justify-content: center; color: #777; font-size: .8rem; margin-bottom: .4rem; }
.wa-header { font-weight: 700; margin-bottom: .25rem; }
.wa-body { white-space: pre-wrap; line-height: 1.5; }
.wa-body .ph { color: #9AA3B2; }
.wa-footer { color: #888; font-size: .78rem; margin-top: .3rem; }
.wa-time { text-align: end; font-size: .7rem; color: #999; display: flex; justify-content: flex-end; align-items: center; gap: .2rem; margin-top: .15rem; }
.wa-time .icon { color: #53BDEB; }
.wa-buttons { display: flex; flex-direction: column; gap: 3px; margin-top: 3px; }
.wa-btn { background: #fff; border-radius: 8px; text-align: center; padding: .45rem; color: #00A5F4; font-size: .88rem; font-weight: 500; display: flex; align-items: center; justify-content: center; gap: .3rem; }
.wa-list { background: #fff; border-radius: 8px; margin-top: 6px; overflow: hidden; }
.wa-list-row { padding: .45rem .7rem; border-bottom: 1px solid #EEE; display: flex; flex-direction: column; font-size: .86rem; }
.wa-list-row:last-child { border-bottom: 0; }
.wa-list-row small { color: #777; }

/* ---------- القوالب ---------- */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 1rem; }
.tpl-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; cursor: pointer; box-shadow: var(--shadow); transition: border-color .15s, transform .1s; text-align: start; display: flex; flex-direction: column; gap: .5rem; font: inherit; color: inherit; }
.tpl-card:hover { border-color: var(--brand); transform: translateY(-1px); }
.tpl-card.rejected { border-color: #F3C5C5; }
.tpl-card.on { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.tpl-card.small { padding: .75rem .9rem; gap: .3rem; }
.tpl-card-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.tpl-card-head b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: ltr; text-align: start; }
.tpl-card-body { font-size: .88rem; color: var(--ink-2); white-space: pre-wrap; line-height: 1.5; max-height: 6.5em; overflow: hidden; }
.tpl-card-meta { display: flex; gap: .6rem; flex-wrap: wrap; font-size: .76rem; color: var(--ink-3); }
.tpl-reject { font-size: .8rem; color: var(--red); }
.tpl-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.tpl-send { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 1.5rem; }
.hint-row { margin-bottom: .75rem; }
.builder { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 1.25rem; align-items: start; }
.builder-form { margin: 0; }
.builder-actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.sticky { position: sticky; top: 1.25rem; }
.tips { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; margin-top: 1rem; font-size: .86rem; }
.tips ul { margin: .4rem 0 0; padding-inline-start: 1.1rem; color: var(--ink-2); }
.examples { background: var(--surface-2); border-radius: var(--radius-sm); padding: .75rem .9rem; display: flex; flex-direction: column; gap: .5rem; margin-bottom: .75rem; }
.examples .field.inline span { min-width: 3rem; }
.btn-row { display: flex; gap: .5rem; align-items: center; margin-bottom: .5rem; }
.btn-row select { width: 130px; flex-shrink: 0; }

/* ---------- الحملات ---------- */
.wizard-steps { display: flex; list-style: none; margin: 0 0 1.25rem; padding: 0; gap: .25rem; counter-reset: step; overflow-x: auto; }
.wizard-steps li { flex: 1; display: flex; align-items: center; gap: .5rem; padding: .6rem .8rem; background: var(--surface); border: 1px solid var(--line); font-size: .86rem; color: var(--ink-3); white-space: nowrap; cursor: default; }
.wizard-steps li:first-child { border-start-start-radius: var(--radius); border-end-start-radius: var(--radius); }
.wizard-steps li:last-child { border-start-end-radius: var(--radius); border-end-end-radius: var(--radius); }
.wizard-steps li span { width: 24px; height: 24px; border-radius: 50%; background: var(--surface-3); display: inline-flex; align-items: center; justify-content: center; font-size: .76rem; font-weight: 600; flex-shrink: 0; }
.wizard-steps li.on { color: var(--ink); font-weight: 600; border-color: var(--brand); }
.wizard-steps li.on span { background: var(--brand); color: #fff; }
.wizard-steps li.done { color: var(--ink-2); cursor: pointer; }
.wizard-steps li.done span { background: var(--green); color: #fff; }
.wizard { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 1.25rem; align-items: start; }
.wizard-body { margin: 0; min-height: 420px; display: flex; flex-direction: column; }
.wizard-body h2 { margin-bottom: 1rem; }
.wizard-nav { display: flex; justify-content: space-between; margin-top: auto; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.radio-cards { display: flex; flex-direction: column; gap: .5rem; }
.radio-card { display: flex; align-items: center; gap: .8rem; border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: .7rem .9rem; background: var(--surface); cursor: pointer; text-align: start; font: inherit; color: inherit; }
.radio-card:hover { border-color: var(--brand); }
.radio-card.on { border-color: var(--brand); background: var(--brand-soft); }
.radio-card.disabled { opacity: .55; }
.radio-card b { display: block; }
.radio-card small { display: block; color: var(--ink-3); }
.var-row { display: grid; grid-template-columns: 3.5rem 180px 1fr; gap: .6rem; align-items: center; margin-bottom: .6rem; }
.var-label { font-weight: 600; color: var(--brand); }
.audience-box { display: flex; align-items: center; gap: .8rem; background: var(--green-soft); border: 1px solid #BDE6D1; border-radius: var(--radius-sm); padding: .8rem 1rem; margin: .5rem 0 1rem; flex-wrap: wrap; }
.audience-box .icon { color: var(--green); }
.audience-box b { font-size: 1.3rem; }
.test-send .row { gap: .5rem; }

/* ---------- الأرقام ---------- */
.waba-card .card-head h2 { font-size: 1.05rem; }
.phones { display: flex; flex-direction: column; gap: .6rem; }
.phone-row { display: grid; grid-template-columns: auto 1fr auto auto; gap: 1rem; align-items: center; padding: .9rem 1rem; background: var(--surface-2); border-radius: var(--radius-sm); border: 1px solid var(--line); }
.phone-main b { font-size: 1.05rem; display: block; }
.phone-edit { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.phone-edit input:not([type="checkbox"]) { width: 150px; }
.phone-edit .check { margin: 0; }
.phone-actions { display: flex; gap: .2rem; }
.info-card h3 { margin-bottom: 1rem; }
.info-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.info-grid > div { display: flex; gap: .6rem; align-items: flex-start; }
.info-grid .icon { color: var(--brand); margin-top: .15rem; }
.info-grid b { display: block; font-size: .9rem; }
.info-grid small { color: var(--ink-3); }

/* ---------- الأتمتة ---------- */
.rule-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.rule-item { display: flex; align-items: center; gap: .8rem; padding: .75rem 1rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.rule-item.off { opacity: .6; }
.rule-order { display: flex; flex-direction: column; }
.rule-order .icon-btn { width: 1.6rem; height: 1.3rem; }
.rule-icon { width: 38px; height: 38px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.rule-item b { display: block; font-size: .95rem; }
.rule-item .tags { margin: .2rem 0; }
.rule-meta { display: flex; align-items: center; gap: .5rem; }
.rule-editor { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1.5rem; }
.rule-editor-preview .wa-preview { position: sticky; top: 0; }
.options-editor { background: var(--surface-2); border-radius: var(--radius-sm); padding: .9rem; margin-bottom: 1rem; display: flex; flex-direction: column; gap: .6rem; }
.option-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .6rem; display: flex; flex-direction: column; gap: .4rem; }
.option-card input, .option-card textarea { font-size: .88rem; }

/* ---------- الفريق والإعدادات ---------- */
.roles-help { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; margin-bottom: 1.25rem; }
.roles-help > div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .7rem .9rem; font-size: .86rem; }
.roles-help b { display: block; }
.roles-help small { color: var(--ink-3); }
.labels-grid { display: flex; flex-direction: column; gap: .5rem; max-width: 520px; }
.label-row { display: flex; gap: .5rem; align-items: center; }
.label-row.new { margin-top: .5rem; padding-top: .75rem; border-top: 1px dashed var(--line); }
.plan-box { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.plan-box h2 { font-size: 1.5rem; }
.plan-status { display: flex; flex-direction: column; align-items: flex-end; gap: .3rem; }
.plans-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.25rem; }
.plan-card { margin: 0; display: flex; flex-direction: column; }
.plan-card.off { opacity: .6; }
.price { font-family: var(--font-display); margin: .25rem 0 .5rem; }
.price b { font-size: 2rem; }
.price span { color: var(--ink-3); font-size: .85rem; }
.plan-features { list-style: none; margin: .5rem 0 1rem; padding: 0; display: flex; flex-direction: column; gap: .4rem; font-size: .9rem; }
.plan-features li { display: flex; align-items: center; gap: .5rem; }
.plan-features .icon { color: var(--green); }
.docs { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.docs-nav { position: sticky; top: calc(56px + 1.5rem); display: flex; flex-direction: column; gap: .15rem; }
.docs-nav a { padding: .45rem .7rem; border-radius: var(--radius-sm); color: var(--ink-2); font-size: .9rem; }
.docs-nav a:hover { background: var(--surface); text-decoration: none; }
.docs-body .card h2 { margin-bottom: .5rem; }
.docs-body .card p { font-size: .92rem; }

/* ---------- الاستجابة ---------- */
@media (max-width: 1200px) {
  .stats-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-main { grid-template-columns: 1fr; }
  .grid-main > .card:first-child { grid-row: auto; }
  .builder, .wizard { grid-template-columns: 1fr; }
  .sticky { position: static; }
  .info-grid, .how { grid-template-columns: repeat(2, 1fr); }
  .contact-panel { width: 260px; }
}
@media (max-width: 960px) {
  .sidebar { position: fixed; inset-inline-start: 0; top: 0; z-index: 100; transform: translateX(100%); transition: transform .2s; box-shadow: none; }
  [dir="ltr"] .sidebar { transform: translateX(-100%); }
  .nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  .nav-open .nav-scrim { display: block; position: fixed; inset: 0; background: rgba(20,20,20,.5); z-index: 90; }
  .menu-toggle { display: inline-flex; }
  .content { padding: 1rem; }
  .stats, .stats-6, .stats-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .tpl-send, .rule-editor { grid-template-columns: 1fr; }
  .docs { grid-template-columns: 1fr; }
  .docs-nav { position: static; flex-direction: row; flex-wrap: wrap; }
  .auth-side { display: none; }
  .inbox { grid-template-columns: minmax(0, 1fr); height: calc(100vh - 56px - 2rem); }
  .inbox.no-selection .inbox-thread { display: none; }
  .inbox:not(.no-selection) .inbox-list { display: none; }
  .thread-head .back-link { display: inline-flex; }
  .contact-panel { position: absolute; inset: 0; width: auto; z-index: 5; }
  .thread-split { position: relative; }
  .phone-row { grid-template-columns: auto 1fr; }
  .phone-edit, .phone-actions { grid-column: span 2; }
  .roles-help { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .var-row { grid-template-columns: 3rem 1fr; }
  .var-row > :last-child { grid-column: span 2; }
  .msg { max-width: 85%; }
  .page-head { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 600px) {
  .stats, .stats-6, .stats-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .heat { grid-template-columns: repeat(8, 1fr); }
  .table th, .table td { padding: .55rem .75rem; }
  .how, .info-grid { grid-template-columns: 1fr; }
  .modal { border-radius: 12px; }
  .wizard-steps li { padding: .5rem; }
  .wizard-steps li:not(.on) { flex: 0; }
  .wizard-steps li:not(.on) { font-size: 0; gap: 0; }
  .wizard-steps li:not(.on) span { font-size: .76rem; }
}
@media print {
  .sidebar, .topbar, .head-actions, .toast-host { display: none !important; }
  .content { padding: 0; }
  .card { box-shadow: none; break-inside: avoid; }
}

/* شريط الاشتراك أعلى المحتوى */
.sub-banner { margin-bottom: 1rem; padding: .6rem 1rem; font-size: .9rem; }
.sub-banner > div { flex: 1; }


/* =====================================================================
   المحادثة الاحترافية: الوسائط، الصوت، المرفقات، التفاعلات
   ===================================================================== */
.composer-inner { position: relative; }
.msg { transition: box-shadow .2s; }
.msg:focus { outline: none; }
.msg.has-media { padding: .25rem .25rem .3rem; }
.msg.has-media .msg-text, .msg.has-media .msg-meta, .msg.has-media .quote, .msg.has-media .msg-error { margin-inline: .45rem; }
.msg.has-media .msg-text { margin-top: .3rem; }
.msg.sticker { background: transparent !important; box-shadow: none; padding: 0; }
.msg.sticker .msg-meta { background: rgba(255,255,255,.85); border-radius: 999px; padding: 0 .45rem; width: fit-content; margin-inline-start: auto; }
.msg.has-reactions { margin-bottom: 1rem; }
.msg.flash { animation: nb-flash 1.5s ease; }
@keyframes nb-flash { 0%, 45% { box-shadow: 0 0 0 3px rgba(140, 98, 57, .45); } 100% { box-shadow: 0 1px 1px rgba(0,0,0,.05); } }
.msg-text a { color: var(--brand); text-decoration: underline; word-break: break-all; }
.msg-text code { font-size: .85em; background: rgba(0,0,0,.06); }

/* أزرار سريعة فوق الرسالة */
.msg-actions {
  position: absolute; top: -14px; inset-inline-end: 8px; display: flex; gap: 1px; padding: 2px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: opacity .12s; z-index: 3;
}
.msg:hover .msg-actions, .msg:focus .msg-actions, .msg:focus-within .msg-actions { opacity: 1; pointer-events: auto; }
.msg-actions button, .msg-actions a {
  width: 28px; height: 28px; border-radius: 50%; border: 0; background: none; color: var(--ink-2);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; text-decoration: none !important;
}
.msg-actions button:hover, .msg-actions a:hover, .msg-actions .on { background: var(--surface-3); color: var(--brand); }
.react-pop {
  position: absolute; bottom: calc(100% + 18px); inset-inline-end: 0; display: flex; gap: 2px; padding: .3rem .4rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--shadow-lg); z-index: 4; animation: pop .14s ease-out;
}
.react-pop button { font-size: 1.35rem; width: 2.3rem; height: 2.3rem; border: 0; background: none; border-radius: 50%; cursor: pointer; transition: transform .12s; line-height: 1; }
.react-pop button:hover { transform: scale(1.22); background: var(--surface-2); }
.react-pop button.on { background: var(--brand-soft); }
.msg-reactions {
  position: absolute; bottom: -13px; inset-inline-start: 10px; display: flex; gap: 2px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 0 .35rem; font-size: .92rem; line-height: 1.55; box-shadow: 0 1px 2px rgba(0,0,0,.06);
}
.msg.out .msg-reactions { inset-inline-start: auto; inset-inline-end: 10px; }
/* الرسائل الواردة: أزرار الرسالة وقائمة التفاعل تمتد نحو وسط المحادثة — لا نحو حافتها.
   (كانت على الرسائل القصيرة مثل «تم» تتجاوز حافة المحادثة فيختفي زر «رد» تحت قائمة المحادثات
   على الكمبيوتر أو خارج الشاشة على الجوال، فيضغط المستخدم ولا يحدث شيء) */
.msg.in .msg-actions { inset-inline-end: auto; inset-inline-start: 8px; }
.msg.in .react-pop { inset-inline-end: auto; inset-inline-start: 0; }

/* لوحة بيانات العميل: عمود جانبي على الكمبيوتر، وطبقة كاملة على الجوال (تبدأ مغلقة) */
.only-mobile { display: none !important; }
.panel-back { align-self: flex-start; }
@media (min-width: 961px) {
  .contact-panel:not(.desk-open) { display: none; }
}
@media (max-width: 960px) {
  .only-desktop { display: none !important; }
  .only-mobile { display: inline-flex !important; }
  .contact-panel:not(.mob-open) { display: none; }
}

/* الاقتباس */
.quote { display: flex; align-items: stretch; gap: .5rem; width: 100%; text-align: start; font: inherit; cursor: pointer; white-space: normal; }
button.quote:hover { background: rgba(0,0,0,.07); }
.quote-body { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.quote-body b { color: var(--brand); font-size: .78rem; }
.quote-body span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quote img { width: 42px; height: 42px; object-fit: cover; border-radius: 4px; flex-shrink: 0; }

/* الصور والفيديو */
.media-img { display: block; padding: 0; border: 0; background: none; cursor: zoom-in; width: 100%; border-radius: 10px; overflow: hidden; }
.media-img img { display: block; width: 100%; max-width: 330px; max-height: 360px; min-height: 60px; object-fit: cover; border-radius: 10px; background: var(--surface-3); }
.msg-video { width: 330px; max-width: 100%; max-height: 360px; border-radius: 10px; display: block; background: #000; }
.media-missing .btn { margin-inline-start: auto; }

/* مشغّل الصوت */
.vp { display: flex; align-items: center; gap: .6rem; width: 290px; max-width: 100%; padding: .2rem .1rem; }
.vp-play {
  width: 38px; height: 38px; border-radius: 50%; border: 0; flex-shrink: 0; cursor: pointer;
  background: var(--brand); color: #fff; display: inline-flex; align-items: center; justify-content: center; transition: transform .1s;
}
.vp-play:active { transform: scale(.94); }
.msg.out .vp-play { background: var(--ink-2); }
.vp .i-pause { display: none; }
.vp.playing .i-play { display: none; }
.vp.playing .i-pause { display: inline; }
.vp.error .vp-play { background: var(--red); }
.vp-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .35rem; }
.vp-bar { position: relative; height: 4px; border-radius: 4px; background: rgba(37, 37, 37, .14); cursor: pointer; margin: .45rem 0 0; }
.vp-bar::before { content: ""; position: absolute; inset: -8px 0; }
.vp-bar i { position: absolute; inset-block: 0; inset-inline-start: 0; width: 0; border-radius: 4px; background: var(--brand); }
.msg.out .vp-bar i { background: var(--ink-2); }
.vp-bar b { position: absolute; top: 50%; inset-inline-start: 0; width: 12px; height: 12px; margin-top: -6px; margin-inline-start: -6px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 2px var(--surface); }
.msg.out .vp-bar b { background: var(--ink-2); box-shadow: 0 0 0 2px var(--wa-out); }
.vp-row { display: flex; align-items: center; gap: .5rem; font-size: .74rem; color: var(--ink-3); }
.vp-time { font-variant-numeric: tabular-nums; }
.vp-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vp-speed { margin-inline-start: auto; border: 0; background: rgba(37, 37, 37, .08); color: var(--ink-2); font-size: .72rem; font-weight: 600; border-radius: 999px; padding: 0 .45rem; cursor: pointer; line-height: 1.5; }
.vp-badge { width: 34px; height: 34px; border-radius: 50%; background: var(--surface-3); color: var(--ink-3); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.vp.voice .vp-badge { background: var(--brand-soft); color: var(--brand); }
.vp audio { display: none; }

/* المستندات */
.doc-card { display: flex; align-items: center; gap: .65rem; background: rgba(37, 37, 37, .05); border-radius: 10px; padding: .55rem .6rem; min-width: 240px; max-width: 330px; }
.doc-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.doc-info b { font-size: .88rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-info small { color: var(--ink-3); font-size: .74rem; }
.doc-card .icon-btn { width: 2rem; height: 2rem; flex-shrink: 0; }
.doc-ico {
  width: 38px; height: 46px; border-radius: 5px 12px 5px 5px; flex-shrink: 0; display: inline-flex; align-items: flex-end; justify-content: center;
  padding-bottom: 6px; font-size: .58rem; font-weight: 700; letter-spacing: .02em; color: #fff; background: #7A869C; direction: ltr;
}
.doc-ico.pdf { background: #D64545; }
.doc-ico.word { background: #2B579A; }
.doc-ico.excel { background: #1E7B45; }
.doc-ico.ppt { background: #C4501E; }
.doc-ico.sm { width: 26px; height: 32px; font-size: .48rem; padding-bottom: 4px; border-radius: 4px 8px 4px 4px; }
.doc-ico.lg { width: 74px; height: 92px; font-size: .9rem; padding-bottom: 12px; border-radius: 8px 22px 8px 8px; }

/* الموقع */
.loc-card { display: flex; flex-direction: column; width: 290px; max-width: 100%; border-radius: 10px; overflow: hidden; background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-decoration: none !important; }
.loc-map {
  height: 118px; display: flex; align-items: center; justify-content: center; color: #D64545;
  background:
    linear-gradient(115deg, transparent 46%, rgba(255,255,255,.95) 46%, rgba(255,255,255,.95) 50%, transparent 50%),
    linear-gradient(25deg, transparent 60%, rgba(255,214,120,.9) 60%, rgba(255,214,120,.9) 63%, transparent 63%),
    repeating-linear-gradient(0deg, transparent 0 22px, rgba(255,255,255,.55) 22px 24px),
    repeating-linear-gradient(90deg, transparent 0 30px, rgba(255,255,255,.55) 30px 32px),
    #DDE8D5;
}
.loc-map .icon { filter: drop-shadow(0 2px 2px rgba(0,0,0,.25)); fill: #fff; }
.loc-info { display: flex; flex-direction: column; padding: .5rem .65rem; gap: .1rem; }
.loc-info b { font-size: .88rem; }
.loc-info small { color: var(--ink-3); font-size: .75rem; }
.loc-card:hover .loc-info b { color: var(--brand); }
.loc-card.preview { width: 100%; margin-top: .25rem; }

/* بطاقة جهة اتصال */
.vcard { display: flex; align-items: center; gap: .6rem; background: rgba(37, 37, 37, .05); border-radius: 10px; padding: .5rem .6rem; min-width: 230px; margin-bottom: .3rem; }
.vcard-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.vcard-info b { font-size: .9rem; }
.vcard-info span { font-size: .78rem; color: var(--ink-2); text-align: start; }

/* الرسائل التفاعلية */
.ia-head { font-weight: 600; margin-bottom: .2rem; }
.ia-foot { font-size: .76rem; color: var(--ink-3); margin-top: .2rem; }
.ia-buttons { display: flex; flex-direction: column; margin: .45rem -.75rem -.1rem; border-top: 1px solid rgba(37, 37, 37, .1); }
.ia-buttons span { display: flex; align-items: center; justify-content: center; gap: .3rem; padding: .4rem; color: var(--brand); font-size: .86rem; font-weight: 500; border-bottom: 1px solid rgba(37, 37, 37, .08); }
.ia-buttons span:last-child { border-bottom: 0; }
.ia-reply { display: inline-flex; align-items: center; gap: .25rem; font-size: .72rem; color: var(--ink-3); background: rgba(37, 37, 37, .06); border-radius: 4px; padding: 0 .4rem; margin-bottom: .2rem; }
.msg-error { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.msg-error .link-btn { display: inline-flex; align-items: center; gap: .2rem; font-size: .76rem; font-weight: 600; }

/* إفلات الملفات على المحادثة */
.thread-main.dropping::after {
  content: "أفلت الملفات هنا لإرسالها"; position: absolute; inset: 12px; z-index: 40; pointer-events: none;
  display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 1.05rem; color: var(--brand);
  border: 2px dashed var(--brand); border-radius: 18px; background: rgba(244, 239, 234, .94);
}

/* المحرر */
.reply-bar { display: flex; align-items: center; gap: .6rem; background: var(--surface-2); border-inline-start: 3px solid var(--brand); border-radius: 8px; padding: .4rem .5rem .4rem .7rem; margin-bottom: .5rem; color: var(--ink-2); }
.reply-body { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: .82rem; }
.reply-body b { color: var(--brand); font-size: .78rem; }
.reply-body span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reply-bar img { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; }
.pop-backdrop { position: fixed; inset: 0; z-index: 15; }
/* صف الكتابة فوق الخلفية أثناء فتح القوائم: «إرسال» يرسل مباشرة بدل أن تُغلق القائمة فقط بأول ضغطة */
.composer-row.over-pop { position: relative; z-index: 16; }
.emoji-pop, .attach-menu {
  position: absolute; bottom: calc(100% + .35rem); inset-inline-start: 0; z-index: 16; background: var(--surface);
  border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); animation: pop .14s ease-out;
}
.emoji-pop { width: min(360px, calc(100vw - 2rem)); overflow: hidden; }
.emoji-tabs { display: flex; gap: 2px; padding: .35rem; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.emoji-tabs button { flex: 1; border: 0; background: none; font-size: 1.15rem; padding: .25rem 0; border-radius: 8px; cursor: pointer; filter: grayscale(.6); opacity: .75; }
.emoji-tabs button.on, .emoji-tabs button:hover { background: var(--surface); filter: none; opacity: 1; }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; padding: .4rem; max-height: 230px; overflow-y: auto; }
.emoji-grid button { border: 0; background: none; font-size: 1.4rem; line-height: 1; padding: .3rem 0; border-radius: 8px; cursor: pointer; }
.emoji-grid button:hover { background: var(--surface-3); }
.attach-menu { padding: .35rem; min-width: 210px; display: flex; flex-direction: column; }
.attach-menu button { display: flex; align-items: center; gap: .7rem; border: 0; background: none; padding: .45rem .55rem; border-radius: 9px; cursor: pointer; font: inherit; font-size: .9rem; color: var(--ink); text-align: start; }
.attach-menu button:hover { background: var(--surface-2); }
.am-ico { width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; flex-shrink: 0; }
.am-ico.img { background: #7C5CE0; }
.am-ico.doc { background: #2B7BD6; }
.am-ico.lib { background: #8C6239; }
.am-ico.aud { background: #E0663A; }
.am-ico.loc { background: #1E9E6A; }
.am-ico.con { background: #2493B5; }
.mic-btn { background: var(--green); }
.mic-btn:hover { background: #17855A; }
.char-count { text-align: end; font-size: .72rem; color: var(--ink-3); margin-top: .2rem; font-variant-numeric: tabular-nums; }
.char-count.over { color: var(--red); font-weight: 600; }

/* شريط التسجيل */
.rec-bar { display: flex; align-items: center; gap: .6rem; min-height: 2.7rem; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--red); animation: rec-pulse 1.1s ease-in-out infinite; flex-shrink: 0; }
@keyframes rec-pulse { 50% { opacity: .25; } }
.rec-time { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink); min-width: 3rem; }
.rec-level { flex: 1; height: 30px; display: flex; align-items: center; gap: 3px; overflow: hidden; direction: ltr; }
.rec-level i { flex: 1; max-width: 4px; min-width: 2px; height: 12%; border-radius: 3px; background: var(--brand); opacity: .8; transition: height .08s linear; }
.rec-preview { flex: 1; width: auto; }
.rec-sending { flex: 1; display: inline-flex; align-items: center; gap: .5rem; color: var(--ink-3); font-size: .88rem; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--brand); animation: nb-spin .8s linear infinite; display: inline-block; }
@keyframes nb-spin { to { transform: rotate(360deg); } }

/* نافذة المرفقات (تغطي المحادثة) */
.attach-panel { position: absolute; inset: 0; z-index: 25; background: var(--surface-2); display: flex; flex-direction: column; animation: fade .15s; }
.ap-head { display: flex; align-items: center; gap: .6rem; padding: .6rem .9rem; background: var(--surface); border-bottom: 1px solid var(--line); }
.ap-head b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 50%; }
.ap-head .muted { margin-inline-start: auto; font-size: .82rem; }
.ap-stage { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .8rem; padding: 1.25rem; }
.ap-stage > img, .ap-stage > video {
  max-width: 100%; max-height: calc(100% - 3rem); object-fit: contain; border-radius: 10px; box-shadow: var(--shadow);
  background: repeating-conic-gradient(#E9EDF3 0% 25%, #fff 0% 50%) 50% / 18px 18px;
}
.ap-file { display: flex; flex-direction: column; align-items: center; gap: .5rem; text-align: center; max-width: 80%; }
.ap-file b { word-break: break-all; }
.ap-file small { color: var(--ink-3); }
.ap-progress { width: min(320px, 90%); display: flex; flex-direction: column; gap: .35rem; align-items: center; font-size: .82rem; color: var(--ink-3); }
.ap-bar { width: 100%; height: 5px; border-radius: 5px; background: var(--line); overflow: hidden; }
.ap-bar i { display: block; height: 100%; background: var(--brand); transition: width .2s; }
.ap-msg { display: flex; align-items: center; gap: .4rem; font-size: .85rem; color: var(--ink-2); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: .4rem .7rem; max-width: 90%; }
.ap-msg.bad { color: #9A2B2B; background: var(--red-soft); border-color: #F3C5C5; }
.ap-caption { padding: 0 1rem .6rem; display: flex; justify-content: center; }
.ap-caption input { max-width: 620px; border-radius: 12px; background: var(--surface); }
.ap-foot { display: flex; align-items: center; gap: .8rem; padding: .7rem 1rem; background: var(--surface); border-top: 1px solid var(--line); }
.ap-thumbs { flex: 1; display: flex; gap: .5rem; overflow-x: auto; padding: .3rem .1rem; }
.ap-thumb {
  position: relative; width: 56px; height: 56px; border-radius: 10px; flex-shrink: 0; cursor: pointer; overflow: visible;
  background: var(--surface-3); border: 2px solid transparent; display: flex; align-items: center; justify-content: center; color: var(--ink-3);
}
.ap-thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }
.ap-thumb.on { border-color: var(--brand); }
.ap-thumb.failed { border-color: var(--red); }
.ap-ext { font-size: .62rem; font-weight: 700; direction: ltr; }
.ap-ring {
  position: absolute; inset: 0; border-radius: 8px; background: rgba(30, 30, 30, .5);
  mask: radial-gradient(circle at center, transparent 9px, #000 10px); -webkit-mask: radial-gradient(circle at center, transparent 9px, #000 10px);
}
.ap-ring::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 50%;
  background: conic-gradient(#fff calc(var(--p) * 1%), rgba(255,255,255,.3) 0);
  -webkit-mask: radial-gradient(circle, transparent 7px, #000 8px); mask: radial-gradient(circle, transparent 7px, #000 8px);
}
.ap-bad { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(214, 69, 69, .55); color: #fff; border-radius: 8px; }
.ap-x {
  position: absolute; top: -7px; inset-inline-end: -7px; width: 20px; height: 20px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--ink); color: #fff; display: none; align-items: center; justify-content: center; padding: 0;
}
.ap-thumb:hover .ap-x, .ap-thumb.on .ap-x { display: inline-flex; }
.ap-add { width: 56px; height: 56px; border-radius: 10px; border: 2px dashed var(--line-2); background: none; color: var(--ink-3); cursor: pointer; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; }
.ap-add:hover { border-color: var(--brand); color: var(--brand); }

/* اختيار جهة اتصال */
.pick-list { display: flex; flex-direction: column; gap: 2px; margin: -.3rem 0 .8rem; border: 1px solid var(--line); border-radius: 10px; padding: .25rem; max-height: 220px; overflow-y: auto; }
.pick-list button { display: flex; align-items: center; gap: .6rem; border: 0; background: none; padding: .4rem .5rem; border-radius: 8px; cursor: pointer; font: inherit; text-align: start; }
.pick-list button:hover { background: var(--surface-2); }
.pick-list span { display: flex; flex-direction: column; min-width: 0; }
.pick-list b { font-size: .88rem; font-weight: 500; }
.pick-list small { color: var(--ink-3); font-size: .76rem; text-align: start; }

/* وسائط المحادثة في لوحة العميل */
.media-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-bottom: .4rem; }
.media-grid > * { position: relative; aspect-ratio: 1; border-radius: 6px; overflow: hidden; border: 0; padding: 0; background: var(--surface-3); cursor: pointer; display: block; }
.media-grid img, .media-grid video { width: 100%; height: 100%; object-fit: cover; display: block; }
.mg-video .icon { position: absolute; left: 50%; top: 50%; margin: -9px 0 0 -9px; color: #fff; filter: drop-shadow(0 1px 2px rgba(0,0,0,.5)); }
.media-doc { display: flex; align-items: center; gap: .5rem; padding: .3rem .2rem; font-size: .82rem; color: var(--ink-2); text-decoration: none !important; border-radius: 6px; }
.media-doc:hover { background: var(--surface-2); color: var(--brand); }
.media-doc span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* عارض الصور */
.lightbox { position: fixed; inset: 0; z-index: 1000; background: rgba(10, 16, 30, .92); display: flex; align-items: center; justify-content: center; animation: fade .15s; }
.lightbox img { max-width: 94vw; max-height: 86vh; object-fit: contain; border-radius: 6px; box-shadow: 0 10px 40px rgba(0,0,0,.5); }
.lb-bar { position: absolute; top: 0; inset-inline: 0; display: flex; justify-content: flex-end; gap: .5rem; padding: .8rem 1rem; }
.lb-btn { width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(255,255,255,.12); color: #fff; font-size: 1.15rem; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; text-decoration: none !important; }
.lb-btn:hover { background: rgba(255,255,255,.24); }

@media (max-width: 960px) {
  .msg-video, .media-img img, .vp, .loc-card, .doc-card { width: 100%; max-width: 280px; min-width: 0; }
  .msg-actions { opacity: 0; }
  .emoji-grid { grid-template-columns: repeat(7, 1fr); }
  .ap-stage { padding: .75rem; }
}

/* وسائط ترويسة القالب */
.hm-picker { display: flex; flex-direction: column; gap: .35rem; }
.hm-row { display: flex; gap: .5rem; }
.hm-row input { flex: 1; min-width: 0; }
.hm-ok { color: var(--green); display: inline-flex; align-items: center; gap: .3rem; }
.hm-error { color: var(--red); display: inline-flex; align-items: center; gap: .3rem; }
.hm-thumb { max-width: 160px; max-height: 110px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }

/* المحادثة على الجوال */
@media (max-width: 600px) {
  .thread-head { flex-wrap: wrap; row-gap: .45rem; padding: .5rem .75rem; }
  .thread-head .grow b, .thread-head .grow small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .thread-actions { order: 3; width: 100%; }
  .thread-actions .select-sm { flex: 1; width: auto !important; }
  .messages { padding: .75rem .6rem; }
  .composer { padding: .5rem .55rem; }
  .composer-row { gap: .3rem; }
  .composer-tools { gap: 0; }
  .composer-tools .icon-btn { width: 2rem; height: 2rem; }
  .send-btn { width: 2.5rem; height: 2.5rem; }
  .ap-foot { padding: .6rem; gap: .5rem; }
}
.wa-media-img { display: block; width: 100%; max-height: 180px; object-fit: cover; border-radius: 6px; margin-bottom: .35rem; }


/* ---------- أدوات عامة ---------- */
/* زر بشكل رابط داخل فقرة نصية */
.link-btn.inline { font-size: inherit; text-decoration: underline; text-underline-offset: 3px; }

/* سبب تعطيل زر الحفظ/التالي — بجانب الزر حتى لا يبدو أنه لا يستجيب */
.action-hint { color: #8A5A00; font-size: .84rem; line-height: 1.4; align-self: center; margin-inline-end: auto; }
.wizard-nav .action-hint { margin-inline-start: auto; margin-inline-end: .75rem; }
.builder-actions { display: flex; align-items: center; gap: .6rem; }

.callout.ok { background: var(--green-soft); border-color: #BFE6D2; }
.callout.ok > .icon { color: var(--green); }
.callout.bad { background: var(--red-soft); border-color: #F2C9C9; }
.callout.bad > .icon { color: var(--red); }
.callout b.inline { display: inline; margin: 0; }
.text-warn { color: #B57A00; }
.nowrap { white-space: nowrap; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; position: relative; }
.table-scroll .table { min-width: 640px; }
.spinner.light { border-color: rgba(255, 255, 255, .35); border-top-color: #fff; }

.stat-btn { font: inherit; text-align: start; cursor: pointer; }
.stat-btn:hover { border-color: var(--brand); }
.stat-btn.on { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(140, 98, 57, .14); }

/* أزرار تصفية كثيرة على شاشة ضيقة: تُمرَّر أفقياً بدل أن تُقص */
.seg-scroll { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg-scroll::-webkit-scrollbar { display: none; }
.seg-scroll button { white-space: nowrap; flex-shrink: 0; }
/* شبكة أمان للجداول القديمة على الجوال: تمرير أفقي بدل قص الأعمدة */
@media (max-width: 960px) {
  .table-card { overflow-x: auto; }
}


/* =====================================================================
   هوية أولى: القائمة الفحمية، الشعار، والأوجه المائلة المأخوذة من حرف A في الشعار
   ===================================================================== */
body { background: var(--page); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.text-ok { color: var(--green); }
.block { display: block; }
.inline-form { display: inline; margin: 0; }
.row.gap { gap: .5rem; }
h1, h2, h3 { letter-spacing: 0; }
.page-head h1 .pill { font-family: var(--font); font-size: .74rem; }

/* ---------- القائمة الجانبية ---------- */
.sidebar { background: var(--charcoal); border-inline-end: 0; color: #E9E6E1; scrollbar-width: thin; scrollbar-color: #444 transparent; }
.brand { padding: 1.25rem 1.15rem .35rem; gap: .6rem; }
.brand-full { display: block; height: 46px; width: auto; max-width: 100%; }
.brand-emblem { display: block; flex-shrink: 0; }
.brand-tile { display: inline-flex; align-items: center; justify-content: center; background: #fff; border-radius: 10px; padding: 4px; flex-shrink: 0; }
.brand-tile img { max-width: 100%; max-height: 100%; object-fit: contain; }
.sidebar .brand-text b { color: #fff; direction: rtl; }
.sidebar .brand-text small { color: #9E988F; }
.brand-caption { margin: 0 1.15rem .9rem; font-size: .74rem; color: #A39D94; display: flex; align-items: center; gap: .5rem; }
.brand-caption::after { content: ""; flex: 1; height: 1px; background: linear-gradient(to left, rgba(216, 176, 128, .5), transparent); }
.nav { padding: .25rem .65rem; }
.nav a { color: #CFCAC3; font-weight: 500; }
.nav a .icon { color: #A39D94; }
.nav a:hover { background: var(--charcoal-2); color: #fff; }
.nav a:hover .icon { color: var(--bronze-3); }
.nav a.active { background: rgba(197, 157, 109, .15); color: #F6E9D8; }
.nav a.active .icon { color: var(--bronze-3); }
/* علامة القسم الحالي: وجه مائل برونزي مثل أرجل حرف A في الشعار */
.nav a.active::before { inset-inline-start: -.65rem; top: 16%; height: 68%; width: 6px; border-radius: 0; background: var(--bronze-grad); clip-path: polygon(0 14%, 100% 0, 100% 86%, 0 100%); }
.nav-sep { color: #77726B; padding-top: 1.1rem; }
.nav-badge { background: var(--green); }
.sidebar-foot { border-top: 1px solid #353535; }
.sidebar .user-row { color: #F1EEE9; }
.sidebar .user-row:hover { background: var(--charcoal-2); }
.sidebar .user-meta small { color: #9E988F; }
.sidebar .icon-btn { color: #B9B3AB; }
.sidebar .icon-btn:hover { background: var(--charcoal-3); color: #fff; }
.credit { margin: 0 1.15rem .9rem; font-size: .7rem; color: #6F6A63; }

/* ---------- الشريط العلوي (للجوال فقط — على الكمبيوتر القائمة الجانبية تكفي) ---------- */
.topbar { height: 56px; gap: .75rem; }
@media (min-width: 961px) {
  .topbar { display: none; }
}
.topbar-title { font-family: var(--font-display); font-weight: 600; font-size: 1.02rem; color: var(--ink); }
.net-state { position: fixed; top: .8rem; left: 50%; transform: translateX(-50%); z-index: 900; display: inline-flex; align-items: center; gap: .35rem; background: #9A322B; color: #fff; font-size: .82rem; border-radius: 999px; padding: .35rem .9rem; box-shadow: var(--shadow-lg); }
.net-state[hidden] { display: none; }

/* ---------- البطاقات والرسائل ---------- */
.card { border-radius: var(--radius); }
.callout { border-radius: var(--radius); }
.callout.flash, .callout.health { margin-bottom: .9rem; }
.callout.flash .icon-btn { width: 1.9rem; height: 1.9rem; }
.callout.fade-out { opacity: 0; transition: opacity .35s; }
.callout.info { background: var(--info-soft); border-color: #CFDBEA; }
.callout.info > .icon { color: var(--info); }
.form-error { white-space: pre-line; }
.btn { border-radius: var(--radius-sm); }
.btn-primary { background: var(--brand); }
.btn-primary:hover { background: var(--brand-2); }
.btn.danger, .btn-ghost.danger { color: var(--red); }
.link-btn { color: var(--brand); }
a { color: var(--brand); }
.code { white-space: pre-wrap; word-break: break-all; width: 100%; border: 0; resize: vertical; min-height: 12rem; }
.empty.compact { padding: 1rem; text-align: start; align-items: flex-start; }
.empty.compact p { max-width: none; }
.small-empty { padding: 2rem 1.25rem; }
.small-empty h3 { font-size: 1rem; }
.empty-icon { background: var(--brand-soft); color: var(--brand); border-radius: 16px; }
.stat b { color: var(--ink); }
.stats-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.stats.flat .stat { box-shadow: none; background: var(--surface-2); border-color: transparent; }
.mini-bar { display: inline-block; width: 70px; height: 6px; border-radius: 6px; background: var(--surface-3); overflow: hidden; vertical-align: middle; margin-inline-end: .4rem; }
.mini-bar i { display: block; height: 100%; background: var(--green); }
.progress-bar { background: var(--brand); }
.hint { margin: .3rem 0 0; }
.field small { line-height: 1.5; }
details.more { margin: .25rem 0 1rem; }
details.more > summary { cursor: pointer; color: var(--brand); font-size: .88rem; margin-bottom: .6rem; }
.copy-field { display: flex; gap: .5rem; align-items: center; margin: .4rem 0; }
.copy-field input { font-family: var(--mono); font-size: .82rem; background: var(--surface-2) !important; }
.steps-guide { margin: .5rem 0 0; padding-inline-start: 1.3rem; display: flex; flex-direction: column; gap: .7rem; font-size: .9rem; color: var(--ink-2); }
.steps-guide li::marker { color: var(--brand); font-weight: 700; font-family: var(--font-display); }
.steps-guide b { color: var(--ink); }
.steps-guide code { font-size: .78rem; }
.field-list { display: flex; flex-wrap: wrap; gap: .3rem; }
.field-list code { font-size: .74rem; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.inline-panel { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 1rem; margin-bottom: 1rem; }
.inline-panel h3 { margin-bottom: .3rem; }
.seg { background: var(--surface); }
.seg-link { display: inline-flex; align-items: center; gap: .35rem; padding: .45rem .9rem; color: var(--ink-2); font-size: .88rem; border-inline-end: 1px solid var(--line); text-decoration: none !important; white-space: nowrap; }
.seg-link:last-child { border-inline-end: 0; }
.seg-link:hover { background: var(--surface-2); }
.seg-link.on { background: var(--charcoal); color: #fff; }
.seg-link em { font-style: normal; font-size: .74rem; background: rgba(0, 0, 0, .07); border-radius: 999px; padding: 0 .4rem; }
.seg-link.on em { background: rgba(255, 255, 255, .18); }
.tabs { gap: .1rem; }
.tab-link { display: inline-flex; align-items: center; gap: .4rem; padding: .7rem .95rem; color: var(--ink-2); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; text-decoration: none !important; white-space: nowrap; }
.tab-link:hover { color: var(--ink); }
.tab-link.on { color: var(--brand); border-bottom-color: var(--brand); }
.tab-link em { font-style: normal; font-size: .72rem; background: var(--surface-3); border-radius: 999px; padding: 0 .45rem; }
.radio-card { position: relative; }
.radio-card input { position: absolute; opacity: 0; pointer-events: none; }
.radio-card:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }
.radio-card > .icon { color: var(--brand); flex-shrink: 0; }
.radio-card.on { border-color: var(--brand); background: var(--brand-soft); }
.radio-cards.two { display: grid; grid-template-columns: 1fr 1fr; }
.prefix-input { display: flex; align-items: center; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--surface); overflow: hidden; }
.prefix-input b { padding: 0 .7rem; color: var(--brand); font-family: var(--mono); background: var(--surface-2); align-self: stretch; display: flex; align-items: center; border-inline-end: 1px solid var(--line); }
.prefix-input input { border: 0 !important; box-shadow: none !important; }
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-inline-end: 2.6rem !important; }
.pw-wrap .icon-btn { position: absolute; inset-inline-end: .2rem; top: 50%; transform: translateY(-50%); width: 2rem; height: 2rem; }
.confirm-text { margin: 0; color: var(--ink-2); line-height: 1.8; }
.modal { border-radius: 14px; }
.modal-head h2 { font-size: 1.05rem; }
.toast-host { inset-inline-start: auto; inset-inline-end: 1.25rem; }
.toast { background: var(--charcoal); }
.toast-ok { background: #1E6B47; }
.toast-bad { background: #9A322B; }
.toast-warn { background: #8A5E12; }

/* ---------- صفحات الخطأ والتركيب ---------- */
.plain-page { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; background: var(--page); }
.plain-card { width: 100%; max-width: 460px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 2.2rem 2rem; text-align: center; box-shadow: var(--shadow); }
.plain-code { display: block; font-family: var(--font-display); font-size: 3rem; line-height: 1; margin-bottom: .6rem; background: var(--bronze-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.plain-card h1 { margin-bottom: .5rem; font-size: 1.3rem; }
.plain-card p { margin-bottom: 1rem; }
.setup-page { background: var(--page); }
.setup { max-width: 780px; margin: 0 auto; padding: 2rem 1rem 3rem; }
.setup-head { display: flex; align-items: center; gap: 1.25rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.setup-head .brand-full { height: 48px; }
.setup-head h1 { font-size: 1.35rem; }
.setup-head p { margin: .15rem 0 0; font-size: .92rem; }
.setup .wizard-steps li.on span { background: var(--brand); }
.setup-foot { display: flex; flex-wrap: wrap; gap: .4rem 1.25rem; justify-content: center; font-size: .8rem; margin-top: 1.5rem; }
.req-list { list-style: none; margin: 0 0 1rem; padding: 0; }
.req { display: grid; grid-template-columns: auto 1fr auto; gap: .2rem .8rem; align-items: center; padding: .65rem 0; border-bottom: 1px solid var(--line); font-size: .92rem; }
.req:last-child { border-bottom: 0; }
.req-value { color: var(--ink-3); font-size: .86rem; }
.req-fix { grid-column: 2 / -1; font-size: .82rem; color: #8A5E12; background: var(--saffron-soft); border-radius: 6px; padding: .35rem .6rem; }
.req.is-bad .req-fix { color: #8E2E27; background: var(--red-soft); }
.soft-card { background: var(--surface-2); box-shadow: none; }
.setup-done { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .5rem; padding: 1rem 0; }
.setup-done .empty-icon { background: var(--green-soft); color: var(--green); }

/* ---------- صفحة الدخول: لحظة الهوية ---------- */
.auth-shell { background: var(--page); }
.auth-side { width: 44%; background: #1E1E1E; color: #fff; padding: 2.2rem 2.6rem; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; isolation: isolate; }
/* حرف A مجرّد من أوجه برونزية وفحمية — مثل الشعار — يخرج من أسفل اللوحة بعيداً عن النص */
.auth-facets { position: absolute; z-index: -1; pointer-events: none; bottom: 0; inset-inline-end: 0; width: 64%; height: 46%; }
.auth-facets i { position: absolute; display: block; inset: 0; }
.auth-facets i:nth-child(1) { background: var(--bronze-grad); clip-path: polygon(46% 0, 60% 0, 100% 100%, 84% 100%); }
.auth-facets i:nth-child(2) { background: #3A3A3A; clip-path: polygon(38% 24%, 50% 24%, 22% 100%, 8% 100%); }
.auth-facets i:nth-child(3) { background: linear-gradient(135deg, #8E6A46, #C59D6D); clip-path: polygon(30% 64%, 80% 64%, 84% 74%, 26% 74%); opacity: .9; }
.auth-logo .brand-full { height: 64px; }
.auth-pitch { position: relative; max-width: 440px; margin-bottom: 34%; }
.auth-pitch h2 { font-size: 2rem; line-height: 1.35; margin-bottom: .8rem; }
.auth-pitch p { color: rgba(255, 255, 255, .78); font-size: 1rem; line-height: 1.9; margin: 0; }
.auth-pitch .rule { display: block; width: 72px; height: 6px; margin: 1.1rem 0 0; background: var(--bronze-grad); clip-path: polygon(0 0, 88% 0, 100% 100%, 12% 100%); }
.auth-foot { color: rgba(255, 255, 255, .55); }
.auth-card { border-radius: 16px; }
.auth-card h1 { font-size: 1.45rem; }
.auth-mobile-brand { display: none; margin-bottom: 1.25rem; }
.auth-mobile-brand .brand-full { height: 44px; }
.auth-hint .icon { color: var(--brand); }

/* =====================================================================
   صندوق المحادثات
   ===================================================================== */
.content-full { padding: 1rem 1.1rem; max-width: none; }
.content-full .inbox { height: calc(100vh - 2rem); height: calc(100dvh - 2rem); margin: 0; }
.inbox { border-radius: var(--radius); grid-template-columns: 370px minmax(0, 1fr); }
.inbox-list-head { align-items: center; flex-wrap: nowrap; }
.inbox-list-head .search { min-width: 0; }
#phone-filter { max-width: 120px; flex-shrink: 0; }
.chips-scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.chips-scroll::-webkit-scrollbar { display: none; }
.chips-scroll .chip { flex-shrink: 0; }
.chip.on { background: var(--charcoal); border-color: var(--charcoal); }
.chip em[hidden] { display: none; }
.notif-ask { display: flex; align-items: center; gap: .5rem; margin: .5rem .85rem 0; padding: .45rem .6rem; border-radius: var(--radius-sm); background: var(--brand-soft); border: 1px solid var(--brand-line); font-size: .78rem; color: var(--brand-ink); }
.notif-ask[hidden] { display: none; }
.notif-ask > .icon { color: var(--brand); flex-shrink: 0; }
.notif-ask span { flex: 1; line-height: 1.5; }
.notif-ask .icon-btn { width: 1.7rem; height: 1.7rem; }
.list-loading { display: flex; justify-content: center; padding: 2rem; }
.list-more { width: 100%; border: 0; background: none; padding: .9rem; color: var(--brand); cursor: pointer; font: inherit; font-size: .88rem; }
.list-more:hover { background: var(--surface-2); }
.conv { border-bottom-color: #EFEEEB; position: relative; }
.conv.active { background: var(--brand-soft); }
.conv.active::before { content: ""; position: absolute; inset-inline-start: 0; top: 0; bottom: 0; width: 3px; background: var(--brand); }
.conv.unread .conv-name { color: var(--ink); }
.conv-out { display: inline-flex; vertical-align: -2px; color: var(--ink-3); margin-inline-end: .2rem; }
.meta-chip.live { background: var(--brand-soft); color: var(--brand-ink); }
.meta-chip .icon { flex-shrink: 0; }
.thread-head { min-height: 58px; }
.thread-who { flex: 1; min-width: 0; border: 0; background: none; padding: 0; text-align: start; cursor: pointer; font: inherit; color: inherit; }
.thread-who b, .thread-who small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-who small { display: flex !important; gap: .6rem; align-items: center; }
.tw-line { display: inline-flex; align-items: center; gap: .2rem; }
.thread-actions .select-sm { max-width: 170px; }
.viewers-bar { display: flex; align-items: center; gap: .45rem; padding: .35rem 1rem; font-size: .8rem; background: var(--info-soft); color: var(--info); border-bottom: 1px solid #D6E0EC; }
.viewers-bar[hidden] { display: none; }
.viewers-bar.typing { background: var(--saffron-soft); color: #7A5410; border-bottom-color: #F0DDB4; }
.viewers-bar .dots { display: inline-flex; gap: 3px; margin-inline-start: .35rem; vertical-align: middle; }
.viewers-bar .dots i { width: 4px; height: 4px; border-radius: 50%; background: currentColor; animation: aw-dot 1.2s infinite ease-in-out; }
.viewers-bar .dots i:nth-child(2) { animation-delay: .15s; }
.viewers-bar .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes aw-dot { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-2px); } }
.messages { background-color: #EEECE8; background-image: repeating-linear-gradient(120deg, transparent 0 26px, rgba(160, 120, 80, .035) 26px 27px); }
.msg { border-radius: 12px; box-shadow: 0 1px 1px rgba(30, 29, 27, .06); }
.msg.out { background: var(--wa-out); }
.msg.pending { opacity: .75; }
.msg.failed { background: #FFF6F5; border-color: #F0C7C2; }
.msg-meta { color: #8F8A82; }
.fwd, .ad-chip { display: inline-flex; align-items: center; gap: .25rem; font-size: .72rem; color: var(--ink-3); margin-bottom: .2rem; font-style: italic; }
.ad-chip { font-style: normal; background: var(--brand-soft); color: var(--brand-ink); border-radius: 4px; padding: 0 .4rem; }
.sys-line { align-self: center; margin: .4rem 0; max-width: 90%; }
.sys-line span { display: inline-block; background: rgba(255, 255, 255, .85); border: 1px solid var(--line); color: var(--ink-3); font-size: .74rem; border-radius: 999px; padding: .12rem .75rem; text-align: center; }
.sys-line time { margin-inline-start: .25rem; opacity: .8; }
.day-sep span { background: rgba(255, 255, 255, .92); }
.load-older { align-self: center; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: .25rem .8rem; font: inherit; font-size: .78rem; color: var(--ink-2); cursor: pointer; display: inline-flex; align-items: center; gap: .3rem; margin-bottom: .4rem; }
.jump-new { position: absolute; bottom: 90px; inset-inline-end: 1.2rem; z-index: 8; border: 0; background: var(--charcoal); color: #fff; border-radius: 999px; padding: .4rem .85rem; font: inherit; font-size: .8rem; display: inline-flex; align-items: center; gap: .3rem; cursor: pointer; box-shadow: var(--shadow-lg); }
.jump-new[hidden] { display: none; }
.video-box { position: relative; }
.vp-play { background: var(--brand); }
.vp.loading .vp-play { opacity: .6; cursor: progress; }
.vp-bar i, .vp-bar b { background: var(--brand); }
.vp.voice .vp-badge { background: var(--brand-soft); color: var(--brand); }
.quote { border-inline-start-color: var(--brand); }
.quote-body b, .reply-body b { color: var(--brand); }
.reply-bar { border-inline-start-color: var(--brand); }
.am-ico.tpl { background: var(--charcoal-3); }
.am-ico.img { background: #8C6239; }
.am-ico.doc { background: #4A5F7A; }
.am-ico.aud { background: #A0522D; }
.am-ico.loc { background: #3F6E5A; }
.am-ico.con { background: #2F6F73; }
.attach-menu button:disabled { opacity: .45; cursor: not-allowed; }
.mic-btn { background: var(--brand); }
.mic-btn:hover { background: var(--brand-2); }
.note-toggle.active { background: var(--saffron-soft); color: #8A5E12; }
.composer.note-mode textarea { background: #FFFDF6; border-color: #EBD7A6; }
.window-banner { background: var(--saffron-soft); border-color: #F0DDB4; color: #6E4C0F; }
.window-banner .btn { flex-shrink: 0; }
.rec-level i { background: var(--brand); }
.tpl-send { grid-template-columns: minmax(0, 1fr) minmax(0, 320px); }
.tpl-prev .wa-preview { padding: 1rem .8rem; }
.tpl-fill { display: flex; flex-direction: column; gap: .1rem; }
.var-row { grid-template-columns: 4.2rem 150px minmax(0, 1fr); }
.var-row.no-mode { grid-template-columns: 4.2rem minmax(0, 1fr); }
.var-label { color: var(--brand); font-family: var(--mono); font-size: .82rem; }
.tpl-media { margin: 0; }
.receipt-drop:hover { border-color: var(--brand); background: var(--brand-soft); }
.receipt-drop > .icon { color: var(--brand); }
.receipt-drop:focus-within { outline-color: var(--brand); }
.contact-panel { width: 310px; gap: 1.05rem; }
.panel-id { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .25rem; padding-bottom: .9rem; border-bottom: 1px solid var(--line); }
.panel-id b { font-size: 1.02rem; margin-top: .35rem; }
.panel-id span { color: var(--ink-3); font-size: .86rem; }
.panel-sec .seg button.on { background: var(--charcoal); }
.others { display: flex; flex-direction: column; gap: .3rem; }
.others a { display: flex; align-items: center; gap: .45rem; padding: .45rem .6rem; border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--ink); font-size: .85rem; text-decoration: none !important; }
.others a:hover { border-color: var(--brand); background: var(--brand-soft); }
.others a span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.others a small { color: var(--ink-3); font-size: .74rem; }
.lb-btn { text-decoration: none !important; }

/* =====================================================================
   جهات الاتصال
   ===================================================================== */
.add-card { padding: 0; }
.add-card > summary { list-style: none; cursor: pointer; padding: .9rem 1.25rem; font-weight: 600; display: flex; align-items: center; gap: .5rem; color: var(--brand); }
.add-card > summary::-webkit-details-marker { display: none; }
.add-card[open] > summary { border-bottom: 1px solid var(--line); }
.add-form { display: grid; grid-template-columns: 1fr 1fr 1.3fr auto; gap: 0 1rem; align-items: end; padding: 1rem 1.25rem .25rem; }
.add-form .btn { margin-bottom: .9rem; }
.bulk-bar { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; padding: .6rem 1rem; background: var(--brand-soft); border-bottom: 1px solid var(--brand-line); font-size: .86rem; }
.bulk-bar[hidden] { display: none; }
.bulk-bar .input-sm { max-width: 160px; }
.edit-contact .modal-actions { margin-top: 1.25rem; }
.cell-person b { display: block; }
.cell-person small { display: block; }
a.tag { text-decoration: none !important; }
a.tag:hover { border-color: var(--brand); color: var(--brand); }

/* =====================================================================
   القوالب والحملات
   ===================================================================== */
.tpl-card { cursor: default; }
.tpl-card:hover { transform: none; border-color: var(--line-2); }
.tpl-card-title { font-weight: 700; font-size: .9rem; }
.tpl-card-media { display: inline-flex; align-items: center; gap: .3rem; font-size: .78rem; color: var(--ink-3); background: var(--surface-2); border-radius: 6px; padding: .15rem .5rem; width: fit-content; }
.tpl-card-btns { display: flex; flex-wrap: wrap; gap: .3rem; }
.tpl-card-btns span { font-size: .76rem; border: 1px solid var(--line); border-radius: 6px; padding: .05rem .5rem; color: var(--info); }
.tpl-card-meta { align-items: center; }
.tpl-del { margin-inline-start: auto; }
.tpl-reject { display: flex; gap: .3rem; align-items: flex-start; }
.wa-body .ph { color: #A39D94; }
@media (min-width: 1201px) { .builder { grid-template-columns: minmax(0, 1fr) 360px; } }
.builder-actions .action-hint { color: var(--ink-3); }
.btn-row { flex-wrap: wrap; }
.btn-row input { flex: 1; min-width: 120px; }
.audience-box { background: var(--brand-soft); border-color: var(--brand-line); }
.audience-box .icon { color: var(--brand); }
.audience-box b { font-family: var(--font-display); font-size: 1.5rem; color: var(--brand-ink); }
.audience-box.empty-aud { background: var(--surface-2); border-color: var(--line); }
.tags.big .tag { padding: .25rem .7rem; font-size: .84rem; cursor: pointer; }
.tags.big .tag small { opacity: .7; }
.tags.big .tag.on { --lc: var(--brand); }
/* رقم الخطوة: شارة مائلة بنفس زوايا شعار «A» */
.bill-step-head { display: flex; align-items: center; gap: .75rem; margin-bottom: 1.1rem; }
.bill-step-head h2 { margin: 0; }
.bill-step { flex: none; display: inline-grid; place-items: center; width: 38px; height: 30px; padding-inline: 4px;
  background: var(--charcoal); color: var(--bronze-3); font-family: var(--font-display); font-weight: 600; font-size: 1rem; line-height: 1;
  clip-path: polygon(22% 0, 100% 0, 78% 100%, 0 100%); }
.test-send .row input { max-width: 260px; }

/* =====================================================================
   نظرة عامة
   ===================================================================== */
.live-note { display: inline-flex; align-items: center; gap: .4rem; font-size: .8rem; color: var(--ink-3); }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.now-strip { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.9fr); gap: 1rem; margin-bottom: 1.4rem; }
.now-main { position: relative; overflow: hidden; isolation: isolate; background: var(--charcoal); color: #fff; border-radius: var(--radius); padding: 1.35rem 1.5rem; display: flex; flex-direction: column; gap: .15rem; min-height: 168px; text-decoration: none !important; box-shadow: var(--shadow); }
.now-main:hover { background: #2B2B2B; }
.now-facet { position: absolute; z-index: -1; top: 0; bottom: 0; inset-inline-end: -12%; width: 58%; background: var(--bronze-grad); clip-path: polygon(46% 0, 63% 0, 100% 100%, 83% 100%); opacity: .9; }
.now-label { color: #BEB8AF; font-size: .9rem; }
.now-num { font-family: var(--font-display); font-size: 3.7rem; line-height: 1.05; color: #fff; font-weight: 600; }
.now-sub { margin-top: auto; color: var(--bronze-3); font-size: .88rem; }
.now-main.has-wait .now-sub { color: #F0C98F; }
.now-side { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.now-side .stat { justify-content: center; }
.now-side .stat small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-live { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.team-live li { display: flex; align-items: center; gap: .7rem; padding: .6rem 0; border-bottom: 1px solid var(--line); }
.team-live li:last-child { border-bottom: 0; }
.team-live li:not(.on) { opacity: .72; }
.team-live b { display: block; font-size: .9rem; }
.team-live small { display: block; font-size: .74rem; }
.tl-num { display: flex; flex-direction: column; align-items: center; min-width: 3.2rem; }
.tl-num b { font-family: var(--font-display); font-size: .98rem; }
.tl-num small { color: var(--ink-3); font-size: .68rem; }
.av-wrap { position: relative; display: inline-flex; flex-shrink: 0; }
.online-dot { position: absolute; bottom: 0; inset-inline-end: 0; width: 10px; height: 10px; border-radius: 50%; background: var(--green); border: 2px solid var(--surface); }

/* =====================================================================
   التقارير
   ===================================================================== */
.bars.dense { gap: 2px; }
.bars.dense .bar { border-radius: 2px 2px 0 0; }
.bar-label { font-size: .66rem; }
.legend .sw { margin-inline-start: .3rem; }

/* =====================================================================
   الأرقام
   ===================================================================== */
.connect-card { border-top: 3px solid var(--brand); }
.connect-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2rem; }
.connect-grid h2 { margin-bottom: .35rem; display: flex; align-items: center; gap: .5rem; }
.guide { background: var(--surface-2); border-radius: var(--radius-sm); padding: 1rem 1.15rem; }
.guide h3 { margin-bottom: .2rem; }
.waba-card .card-head { align-items: flex-start; }
.waba-meta { display: flex; flex-wrap: wrap; gap: .25rem 1rem; margin: .3rem 0 0; }
.waba-meta .mono { font-size: .82rem; }
.phones { gap: .7rem; }
.phone-row { grid-template-columns: auto minmax(0, 1fr) auto; gap: .6rem 1rem; background: var(--surface); border-color: var(--line); }
.phone-row.off { opacity: .6; }
.phone-main { display: flex; flex-direction: column; gap: .2rem; min-width: 0; }
.phone-main > b { font-size: 1.08rem; font-family: var(--font-display); text-align: start; align-self: flex-start; } /* الرقم (ltr) فوق الاسم من جهة البداية — لا ينجرف لطرف العمود */
.phone-name { font-size: .86rem; color: var(--ink-2); }
.phone-facts { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .9rem; font-size: .8rem; color: var(--ink-3); }
.q-ok { color: var(--green); }
.q-warn { color: #9A6A14; }
.q-bad { color: var(--red); }
.phone-edit input:not([type="checkbox"]) { width: 170px; }
.activate { grid-column: 2 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; background: var(--saffron-soft); border: 1px solid #F0DDB4; border-radius: var(--radius-sm); padding: .6rem .8rem; margin: 0; font-size: .85rem; }
.activate-step { flex: 1; min-width: 220px; color: #6E4C0F; }
.code-input { width: 120px !important; text-align: center; letter-spacing: .3em; font-family: var(--mono); }
.danger-zone { margin-top: 1rem; border-top: 1px dashed var(--line); padding-top: .7rem; }
.danger-zone summary { cursor: pointer; color: var(--ink-3); font-size: .82rem; }
.danger-zone form { margin-top: .6rem; }
.secret-form { margin-top: 1rem; }
.cred-box { border-radius: var(--radius-sm); }
.cred-box > div { flex-wrap: wrap; }
.cred-box code { flex: 1; min-width: 0; }

/* =====================================================================
   الفريق والإعدادات
   ===================================================================== */
.cred-card { border-top: 3px solid var(--green); }
.roles-help > div b { display: flex; align-items: center; gap: .35rem; margin-bottom: .15rem; }
.roles-help .icon { color: var(--brand); }
fieldset.scope { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .6rem 1rem .9rem; margin: .25rem 0 1rem; }
fieldset.scope[hidden] { display: none; }
fieldset.scope legend { font-size: .86rem; font-weight: 500; color: var(--ink-2); padding: 0 .3rem; }
.phone-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .5rem; margin-top: .3rem; }
.phone-checks[hidden] { display: none; }
.chk-card { display: flex; align-items: center; gap: .55rem; border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: .5rem .65rem; cursor: pointer; }
.chk-card:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.chk-card span { display: flex; flex-direction: column; line-height: 1.35; }
.chk-card b { font-size: .86rem; }
.chk-card small { color: var(--ink-3); font-size: .74rem; text-align: start; }
.swatches { display: flex; flex-wrap: wrap; gap: .45rem; align-items: center; }
.swatch { --sw: #8C6239; position: relative; width: 30px; height: 30px; cursor: pointer; }
.swatch input[type=radio] { position: absolute; opacity: 0; }
.swatch span { display: block; width: 100%; height: 100%; border-radius: 8px; background: var(--sw); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08); }
.swatch input:checked + span { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--sw); }
.swatch input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 3px; }
.swatch.custom input[type=color] { width: 30px; height: 30px; border-radius: 8px; }
.switch-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: .8rem 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.switch-row:last-child { border-bottom: 0; }
.switch-row > span:first-child { display: flex; flex-direction: column; gap: .15rem; }
.switch-row b { font-size: .92rem; font-weight: 600; }
.switch-row small { color: var(--ink-3); font-size: .8rem; line-height: 1.6; }
.switch-row .switch { flex-shrink: 0; margin-top: .2rem; }
.sticky-actions { position: sticky; bottom: 0; z-index: 5; background: linear-gradient(to top, var(--page) 70%, transparent); padding: 1rem 0 .5rem; margin-bottom: 1rem; }
.logo-preview { display: flex; align-items: center; gap: .9rem; padding: .8rem; border-radius: var(--radius-sm); background: var(--surface-2); margin: .5rem 0 1rem; }
.logo-preview span { display: flex; flex-direction: column; }
.label-row input[name=name] { flex: 1; }
.mono-note { font-family: var(--mono); font-size: .78rem; word-break: break-word; }
.table-scroll .table.compact { min-width: 560px; }
.row-actions .inline-form { display: inline-flex; }
.table td .pill + .pill { margin-inline-start: .25rem; }
.rule-reply { color: var(--ink-2); margin: .2rem 0; white-space: pre-line; }
.rule-meta { flex-wrap: wrap; gap: .2rem 1rem; }
.rule-icon { background: var(--brand-soft); color: var(--brand); }
.table.hours tr.off input[type=time] { opacity: .4; }

/* =====================================================================
   الاستجابة للشاشات
   ===================================================================== */
@media (max-width: 1200px) {
  .now-strip { grid-template-columns: 1fr; }
  .stats-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .connect-grid { grid-template-columns: 1fr; }
}
@media (max-width: 960px) {
  .content-full { padding: 0; }
  .content-full .inbox { height: calc(100vh - 56px); height: calc(100dvh - 56px); border-radius: 0; border: 0; }
  .inbox { grid-template-columns: minmax(0, 1fr); }
  .add-form { grid-template-columns: 1fr; }
  .add-form .btn { margin-bottom: 1rem; }
  .form-grid.three { grid-template-columns: 1fr; }
  .radio-cards.two { grid-template-columns: 1fr; }
  .tpl-send { grid-template-columns: 1fr; }
  .now-side { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .phone-row { grid-template-columns: auto minmax(0, 1fr); }
  .phone-edit, .activate { grid-column: 1 / -1; }
  .auth-mobile-brand { display: block; }
  .auth-side { display: none; }
  .auth-main { padding: 1.25rem 1rem; align-items: flex-start; padding-top: max(1.5rem, 6vh);
    background: linear-gradient(180deg, #1E1E1E 0, #1E1E1E 150px, var(--page) 150px); }
  .auth-card { padding: 1.5rem 1.25rem; }
  .thread-actions .select-sm { max-width: 130px; }
  .sidebar { width: min(86vw, 290px); }
}
@media (max-width: 600px) {
  .stats-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .now-side { grid-template-columns: 1fr 1fr; }
  .now-num { font-size: 3rem; }
  .var-row, .var-row.no-mode { grid-template-columns: 1fr; gap: .3rem; }
  .var-row > :last-child { grid-column: auto; }
  .phone-edit input:not([type="checkbox"]) { width: 100%; }
  .topbar { padding: 0 .75rem; }
  .content { padding: .85rem; }
  .content-full { padding: 0; }
  .page-head h1 { font-size: 1.3rem; }
  .toast-host { inset-inline: .75rem; bottom: .75rem; max-width: none; }
}
@media (max-width: 600px) {
  .table.hours, .table.hours tbody { display: block; }
  .table.hours tr { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: .35rem .5rem; padding: .55rem 0; border-bottom: 1px solid var(--line); }
  .table.hours td { display: block; padding: 0; }
  .table.hours td:first-child { grid-column: 1 / -1; }
  .table.hours td[data-off-label] { grid-column: 1 / -1; }
  .table.hours input[type="time"] { width: 100%; min-width: 0; }
  .builder-actions { flex-wrap: wrap; }
  .builder-actions .action-hint { flex-basis: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
.phone-facts b { display: inline; font-size: inherit; font-family: var(--font); }
.cred-box .field-list code { flex: none; word-break: normal; white-space: nowrap; background: var(--surface); }

/* ---------- خطوات التشغيل (صفحة الأرقام): يكمل بها مدير الشركة الربط وحده ---------- */
.connect-forms { min-width: 0; }
.manual-connect { margin-top: 1rem; padding-top: .9rem; border-top: 1px dashed var(--line); }
.manual-connect form { margin-top: .4rem; }
.setup-card { border-top: 3px solid var(--brand); }
.setup-card .card-head { align-items: flex-start; margin-bottom: .5rem; }
.setup-card .card-head p { margin: .2rem 0 0; }
.setup-steps { list-style: none; margin: 0; padding: 0; }
.setup-steps li { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: .85rem; padding: .8rem 0; border-top: 1px solid var(--line); }
.setup-steps li:first-child { border-top: 0; }
.setup-mark { width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  border: 2px solid var(--line-2); color: var(--ink-3); background: var(--surface); font-family: var(--font-display); font-weight: 700; font-size: .92rem; line-height: 1; }
.setup-steps li.done .setup-mark { background: var(--green); border-color: var(--green); color: #fff; }
.setup-steps li.current .setup-mark { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-ink); }
.setup-steps b { display: block; font-size: .95rem; margin: .25rem 0 .15rem; }
.setup-steps li.done b { color: var(--ink-2); }
.setup-steps p { margin: 0; font-size: .88rem; color: var(--ink-3); max-width: 70ch; }
.setup-steps li.current p { color: var(--ink-2); }
.setup-steps .btn { margin-top: .55rem; }
/* أسماء القوائم الإنجليزية (App settings، Use cases) لا تنكسر بين سطرين */
.steps-guide bdi, p b bdi { white-space: nowrap; }


/* ---------- حسابي ← التنبيهات: اختيار الصوت، مستوى الصوت، إشعارات المتصفح ---------- */
.notify-card { margin-top: 1.25rem; }
.notify-card .card-head { align-items: flex-start; }
.notify-card .card-head p { margin: .2rem 0 0; }
.notify-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 1.5rem 2.25rem; margin-top: .5rem; }
.notify-sec h3 { font-size: .95rem; margin: 0 0 .6rem; color: var(--ink-2); }
.notify-sec h3.mt { margin-top: 1.4rem; }
.sound-list { display: flex; flex-direction: column; gap: .4rem; margin-bottom: 1rem; }
.sound-opt { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .7rem; padding: .55rem .75rem;
  border: 1px solid var(--line); border-radius: var(--radius-sm, 10px); background: var(--surface); cursor: pointer; transition: border-color .15s, background .15s; }
.sound-opt:hover { border-color: var(--line-2); }
.sound-opt.on { border-color: var(--brand); background: var(--brand-soft); }
.sound-opt input[type="radio"] { margin: 0; accent-color: var(--brand); }
.sound-text { display: flex; flex-direction: column; min-width: 0; }
.sound-text b { font-size: .92rem; }
.sound-text small { color: var(--ink-3); font-size: .8rem; }
.sound-upload { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .9rem; margin-top: .45rem; }
.sound-upload input[type="file"] { font-size: .8rem; max-width: 100%; }
.sound-upload .check.small { margin: 0; }
.file-pick { position: relative; overflow: hidden; cursor: pointer; }
.file-pick input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }
.master-switch { margin-bottom: .9rem; font-size: .92rem; color: var(--ink); }
.notify-card.sound-off .sound-list, .notify-card.sound-off .volume-field, .notify-card.sound-off .repeat-field { opacity: .45; }
.sound-opt.custom .sound-text { align-self: start; }
.sound-play { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--surface-2, var(--surface)); color: var(--ink-2); }
.sound-play:hover { color: var(--brand-ink); border-color: var(--brand); }
.sound-play.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.volume-field span { display: flex; justify-content: space-between; align-items: baseline; }
.volume-field output { font-family: var(--font-display); font-weight: 700; color: var(--brand-ink); font-variant-numeric: tabular-nums; }
.volume-field input[type="range"] { width: 100%; accent-color: var(--brand); margin: .35rem 0 .2rem; }
.push-box { border: 1px dashed var(--line-2); border-radius: var(--radius-sm, 10px); padding: .85rem .95rem; background: var(--surface); }
.push-status { display: flex; align-items: center; gap: .55rem; font-weight: 600; font-size: .92rem; margin-bottom: .6rem; }
.status-dot.big { width: 12px; height: 12px; }
.status-dot.muted { background: var(--line-2); }
.push-actions { display: flex; flex-wrap: wrap; gap: .45rem; }
.push-box .hint { margin: .6rem 0 0; }
@media (max-width: 860px) {
  .notify-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- صندوق المحادثات: مرشّحات تلتف على الشاشة الكبيرة (المغلقة والكل ظاهرتان دائماً) ---------- */
@media (min-width: 961px) {
  .inbox-list .chips-scroll { flex-wrap: wrap; overflow: visible; row-gap: .3rem; }
}
.panel-empty { margin: 0 0 .4rem; }
.label-add { display: flex; gap: .35rem; margin-top: .45rem; }
.label-add input { flex: 1; min-width: 0; font-size: .86rem; padding: .35rem .6rem; }
.mt-s { margin-top: .5rem; }
.panel-sec .btn.mt-s { width: 100%; justify-content: center; }

/* ---------- نافذة «محادثة جديدة»: عميل موجود / رقم جديد ---------- */
.nc-tabs { margin-bottom: .9rem; }
.nc-tabs button { display: inline-flex; align-items: center; gap: .35rem; }
.nc-search { width: 100%; margin-bottom: .5rem; }
.pick-list.tall { max-height: 260px; overflow-y: auto; display: block; }
.pick-list.tall button { width: 100%; justify-content: flex-start; }
.pick-list button.on { background: var(--brand-soft); border-color: var(--brand); }
.pick-list button .icon { margin-inline-start: auto; color: var(--brand-ink); }
.nc-chosen { display: flex; align-items: center; gap: .4rem; font-size: .9rem; margin-top: .6rem; color: var(--ink-2); }
.nc-chosen .icon { color: var(--green); }
.nc-window { margin-top: .8rem; margin-bottom: .4rem; padding: .75rem 1rem; }
.callout.ok { background: var(--green-soft); border-color: #BDE6D1; }
.callout.ok > .icon { color: var(--green); }
.callout.info { background: var(--info-soft); border-color: #CFDCEC; }
.callout.info > .icon { color: var(--info); }
.nc-window p { margin: .15rem 0 0; }

/* ---------- الأقسام (فرق الموظفين): شارة بلون القسم ---------- */
.team-pill { --tc: var(--brand); background: color-mix(in srgb, var(--tc) 14%, #fff); color: color-mix(in srgb, var(--tc) 70%, #000); border: 1px solid color-mix(in srgb, var(--tc) 35%, #fff); }
.groups-list { display: flex; flex-direction: column; margin-bottom: .6rem; }
.group-row { display: flex; align-items: center; gap: .7rem; padding: .55rem 0; border-bottom: 1px solid var(--line); }
.group-row:last-child { border-bottom: 0; }
.group-row .group-actions { margin-inline-start: auto; display: flex; gap: .2rem; }
.group-row input[type="color"] { width: 34px; height: 30px; padding: 2px; border: 1px solid var(--line-2); border-radius: 7px; background: var(--surface); cursor: pointer; }
.group-row input[name="name"] { flex: 1; min-width: 0; max-width: 360px; }
.group-new { margin-top: .4rem; padding-top: .8rem; border-top: 1px dashed var(--line-2); }
.groups-list + .group-new { border-top: 1px dashed var(--line-2); }

/* ---------- الردود الآلية: إعداد عام أو خاص بكل رقم ---------- */
.scope-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1.5rem; margin-bottom: 1rem; padding: .7rem .9rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.scope-pick { margin: 0; display: flex; flex-direction: row; align-items: center; gap: .6rem; }
.scope-pick > span { margin: 0; white-space: nowrap; }
.scope-pick select { min-width: 220px; }
.custom-switch { font-weight: 600; color: var(--ink); }
.auto-fields.dimmed { opacity: .5; pointer-events: none; }

/* ---------- مكتبة الملفات ---------- */
.lib-drop { padding: 1.1rem 1.2rem; }
.lib-drop > span b { white-space: normal; }
.lib-picked { position: absolute; inset-inline-end: 1rem; bottom: .5rem; }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: .9rem; margin-bottom: .8rem; }
.lib-card { padding: 0; display: flex; flex-direction: column; overflow: hidden; }
.lib-preview { display: flex; align-items: center; justify-content: center; height: 130px; background: var(--surface-2); border-bottom: 1px solid var(--line); text-decoration: none; overflow: hidden; }
.lib-preview img { width: 100%; height: 100%; object-fit: cover; }
.lib-preview .doc-ico { width: 64px; height: 64px; font-size: .95rem; border-radius: 12px; }
.lib-body { padding: .75rem .9rem .4rem; display: flex; flex-direction: column; gap: .2rem; min-width: 0; }
.lib-body small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-title { font-size: .98rem; }
.lib-name { display: flex; align-items: center; gap: .3rem; }
.lib-name input { font-weight: 600; font-size: .98rem; padding: .25rem .45rem; border-color: transparent; background: transparent; min-width: 0; flex: 1; }
.lib-name input:hover, .lib-name input:focus { border-color: var(--line-2); background: var(--surface); }
.lib-actions { display: flex; gap: .2rem; padding: .25rem .6rem .55rem; margin-top: auto; }

/* ---------- اختيار ملف من المكتبة داخل المحادثة ---------- */
.lib-pick { display: flex; flex-direction: column; gap: .35rem; max-height: 320px; overflow-y: auto; margin: .2rem 0 .8rem; }
.lib-pick button { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; align-items: center; gap: .7rem; width: 100%; text-align: start; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-sm); padding: .5rem .65rem; cursor: pointer; font: inherit; }
.lib-pick button:hover { background: var(--surface-2); }
.lib-pick button.on { border-color: var(--brand); background: var(--brand-soft); }
.lib-pick .lp-thumb { width: 42px; height: 42px; border-radius: 8px; object-fit: cover; background: var(--surface-2); }
.lib-pick .doc-ico.sm { width: 42px; height: 42px; font-size: .7rem; }
.lib-pick .lp-text { display: flex; flex-direction: column; min-width: 0; }
.lib-pick .lp-text b { font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-pick .lp-text small { color: var(--ink-3); font-size: .78rem; }
.lib-pick .icon { color: var(--brand-ink); }

/* ---------- القنوات الخارجية (شات التطبيق) في صفحة الأرقام ---------- */
.channels-card .card-head { align-items: flex-start; }
.channel-secret { margin: .4rem 0 1rem; padding: 1rem 1.1rem; border: 1px solid var(--brand-line); border-radius: var(--radius); background: var(--brand-soft); }
.channel-secret .card-head { margin-bottom: .2rem; }
.channel-secret h3 { font-size: 1rem; margin: 0; }
.channel-secret .cred-box { margin: .6rem 0; }
.channel-list { display: flex; flex-direction: column; gap: .6rem; margin-bottom: .8rem; }
.channel-row { border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem .95rem; background: var(--surface); }
.channel-row.off { opacity: .7; }
.channel-main { display: flex; gap: .8rem; align-items: flex-start; }
.channel-ico { width: 38px; height: 38px; }
.channel-meta { display: flex; flex-wrap: wrap; gap: .25rem 1rem; margin-top: .3rem; }
.channel-meta code { font-size: .8rem; background: var(--surface-2); padding: 0 .35rem; border-radius: 5px; }
.channel-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; margin-top: .6rem; padding-top: .6rem; border-top: 1px dashed var(--line); }
.channel-actions .inline-form { display: inline; }
.channel-new summary { cursor: pointer; font-weight: 600; color: var(--brand-ink); display: inline-flex; align-items: center; gap: .3rem; }
.channel-new form { margin-top: .8rem; }

/* ---------- صفحة تعليمات ربط شات التطبيق ---------- */
.api-docs .card { margin-bottom: 1rem; }
.api-docs h2 { font-size: 1.08rem; margin-bottom: .6rem; }
.api-docs p, .api-docs li { font-size: .93rem; }
.api-docs pre { direction: ltr; text-align: left; background: #1F1F1F; color: #F1F1F0; padding: .9rem 1rem; border-radius: var(--radius-sm); overflow-x: auto; font-size: .82rem; line-height: 1.55; margin: .5rem 0 .9rem; }
.api-docs pre code { background: none; padding: 0; color: inherit; font-size: inherit; }
.api-docs table.small td, .api-docs table.small th { font-size: .86rem; vertical-align: top; }
.api-docs table.small td:first-child { white-space: nowrap; }
.api-docs ol, .api-docs ul { padding-inline-start: 1.3rem; }
.api-docs li { margin: .25rem 0; }
.meta-chip.app, .tw-line.app { color: var(--brand-ink); }

/* =====================================================================
   1.3.0 — التحديد المتعدد والإجراءات الجماعية
   ===================================================================== */
.inbox.selecting .conv { cursor: default; }
.conv-check { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 6px; border: 2px solid var(--line-2); background: var(--surface); color: transparent; flex-shrink: 0; align-self: center; transition: background .12s, border-color .12s; }
.conv:hover .conv-check { border-color: var(--brand); }
.conv.sel { background: var(--brand-soft); }
.conv.sel .conv-check { background: var(--brand); border-color: var(--brand); color: #fff; }
.inbox.selecting .conv.active:not(.sel) { background: var(--surface); }
#select-mode.active { background: var(--brand); color: #fff; }
.bulk-bar { position: relative; border-top: 1px solid var(--line); background: var(--surface); padding: .55rem .85rem .7rem; box-shadow: 0 -6px 18px rgba(30, 29, 27, .06); animation: fade .15s; }
.bulk-bar[hidden] { display: none; }
.bulk-top { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; font-size: .82rem; color: var(--ink-2); margin-bottom: .5rem; }
.bulk-count { flex: 1; min-width: 0; }
.bulk-count b { font-size: 1rem; color: var(--ink); }
.bulk-top .link-btn { font-size: .8rem; }
.bulk-top .icon-btn { width: 1.8rem; height: 1.8rem; }
.bulk-actions { display: flex; gap: .35rem; flex-wrap: wrap; }
.bulk-btn { display: inline-flex; align-items: center; gap: .3rem; border: 1px solid var(--line-2); background: var(--surface); border-radius: 999px; padding: .3rem .7rem; font: inherit; font-size: .82rem; color: var(--ink); cursor: pointer; }
.bulk-btn:hover:not(:disabled) { background: var(--brand-soft); border-color: var(--brand-line); color: var(--brand-ink); }
.bulk-btn:disabled { opacity: .45; cursor: default; }
.bulk-btn .icon:last-child { opacity: .6; }

/* قائمة منبثقة عامة (تُستخدم في شريط الإجراءات الجماعية) */
.pop-menu { position: fixed; z-index: 900; min-width: 220px; max-width: 300px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: .3rem; animation: pop .14s ease-out; }
.pop-menu.pm-scroll { max-height: 320px; overflow-y: auto; }
.pop-menu button { display: flex; align-items: center; gap: .55rem; width: 100%; border: 0; background: none; padding: .45rem .6rem; border-radius: 8px; cursor: pointer; font: inherit; font-size: .88rem; color: var(--ink); text-align: start; }
.pop-menu button:hover:not(:disabled), .pop-menu button:focus-visible { background: var(--surface-2); outline: none; }
.pop-menu button:disabled { opacity: .55; cursor: default; }
.pop-menu button.muted { color: var(--ink-3); }
.pop-menu button span { display: flex; flex-direction: column; min-width: 0; }
.pop-menu button small { color: var(--ink-3); font-size: .74rem; }
.pop-menu .pm-head { font-size: .72rem; font-weight: 600; color: var(--ink-3); padding: .45rem .6rem .2rem; }
.pop-menu .pm-sep { border-top: 1px solid var(--line); margin: .3rem 0; }
.pm-dot { --lc: var(--brand); width: 12px; height: 12px; border-radius: 50%; background: var(--lc); flex-shrink: 0; }

/* نافذة سبب الإغلاق */
.reason-pick { display: flex; flex-wrap: wrap; gap: .4rem; margin: .2rem 0 1rem; }
.reason-pick button { --lc: var(--brand); display: inline-flex; align-items: center; gap: .4rem; border: 1px solid var(--line-2); background: var(--surface); border-radius: 999px; padding: .35rem .8rem .35rem .6rem; font: inherit; font-size: .88rem; color: var(--ink); cursor: pointer; transition: border-color .12s, background .12s; }
.reason-pick button i { width: 11px; height: 11px; border-radius: 50%; background: var(--lc); flex-shrink: 0; }
.reason-pick button.plain i { background: var(--line-2); }
.reason-pick button:hover { border-color: color-mix(in srgb, var(--lc) 60%, white); }
.reason-pick button.on { border-color: var(--lc); background: color-mix(in srgb, var(--lc) 12%, white); color: color-mix(in srgb, var(--lc) 70%, black); font-weight: 600; }
.reason-pick button.plain.on { border-color: var(--ink-2); background: var(--surface-3); color: var(--ink); }
.close-info { display: flex; gap: .4rem; align-items: flex-start; margin-top: .55rem; padding: .5rem .65rem; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line); font-size: .78rem; color: var(--ink-2); line-height: 1.6; }
.close-info .icon { color: var(--green); flex-shrink: 0; margin-top: .2rem; }
.close-info b { font-weight: 600; color: var(--ink); }

/* السمات المخصصة في لوحة العميل */
.cf-list { display: flex; flex-direction: column; gap: .55rem; }
.cf-row { display: flex; flex-direction: column; gap: .2rem; position: relative; }
.cf-row > label { font-size: .76rem !important; color: var(--ink-3) !important; font-weight: 500 !important; margin: 0 !important; }
.cf-row input, .cf-row select, .cf-row textarea { font-size: .86rem; padding: .4rem .6rem; }
.cf-row textarea { resize: vertical; min-height: 2.4rem; }
.cf-row .cf-open { position: absolute; inset-inline-end: .5rem; bottom: .5rem; color: var(--brand); display: inline-flex; }
.cf-row input[type="url"] { padding-inline-end: 1.8rem; }

/* =====================================================================
   1.3.0 — المساعد الذكي داخل المحادثة
   ===================================================================== */
.ai-btn { color: var(--brand); }
.ai-btn.busy { animation: ai-pulse 1s ease-in-out infinite; }
@keyframes ai-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.ai-menu { min-width: 280px; max-width: min(360px, calc(100vw - 2rem)); }
.ai-menu .am-title { display: flex; align-items: center; gap: .35rem; padding: .35rem .6rem .45rem; font-size: .8rem; font-weight: 600; color: var(--brand-ink); border-bottom: 1px solid var(--line); margin-bottom: .25rem; }
.ai-menu .am-title small { font-weight: 400; color: var(--ink-3); font-family: var(--mono); font-size: .7rem; margin-inline-start: auto; direction: ltr; }
.ai-menu .am-title .icon { color: var(--brand); }
.am-ico.ai { background: var(--bronze-grad); }
.ai-menu button > span:last-child, .ai-menu .am-group > span:nth-child(2) { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.ai-menu small { color: var(--ink-3); font-size: .74rem; font-weight: 400; }
.ai-menu button:disabled { opacity: .5; cursor: default; }
.ai-menu button:disabled:hover { background: none; }
.am-group { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: .25rem .7rem; align-items: center; padding: .45rem .55rem; font-size: .9rem; color: var(--ink); }
.am-group.off { opacity: .55; }
.am-opts { grid-column: 2; display: flex; gap: .3rem; flex-wrap: wrap; }
.am-opts button { width: auto !important; padding: .15rem .6rem !important; border: 1px solid var(--line-2) !important; border-radius: 999px !important; font-size: .78rem !important; background: var(--surface) !important; }
.am-opts button:hover:not(:disabled) { background: var(--brand-soft) !important; border-color: var(--brand-line) !important; color: var(--brand-ink); }
.am-opts button:disabled { opacity: .6; }
.ai-draft { margin-bottom: .6rem; border: 1px solid var(--brand-line); border-radius: var(--radius); background: linear-gradient(180deg, #FBF8F4, var(--surface)); box-shadow: var(--shadow); animation: fade .15s; }
.ai-draft[hidden] { display: none; }
.ad-head { display: flex; align-items: center; gap: .4rem; padding: .45rem .7rem .3rem; font-size: .82rem; color: var(--brand-ink); }
.ad-head .icon { color: var(--brand); }
.ad-head .muted { flex: 1; }
.ad-head .icon-btn { width: 1.7rem; height: 1.7rem; }
.ad-body { padding: 0 .7rem .4rem; }
.ad-body.loading { display: flex; align-items: center; gap: .5rem; padding: .3rem .7rem .7rem; color: var(--ink-3); font-size: .86rem; }
.ad-body.error { display: flex; align-items: center; gap: .4rem; color: var(--red); font-size: .86rem; padding-bottom: .4rem; }
.ad-text { width: 100%; resize: none; border-radius: var(--radius-sm); font-size: .92rem; line-height: 1.55; background: var(--surface); max-height: 220px; }
.ad-actions { display: flex; gap: .35rem; flex-wrap: wrap; padding: 0 .7rem .6rem; }
.ai-summary { white-space: pre-wrap; line-height: 1.7; font-size: .95rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .8rem 1rem; max-height: 50vh; overflow-y: auto; }

/* صفحة إعدادات المساعد الذكي */
.ai-grid { align-items: start; }
.ai-side { display: flex; flex-direction: column; gap: 1.25rem; }
.ai-side .card { margin: 0; }
.ai-side .stats.compact { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .6rem; margin-bottom: .9rem; }
.ai-side .stats.compact .stat { padding: .7rem .8rem; }
.ai-side .stats.compact .stat b { font-size: 1.3rem; }
.ai-side .stats.compact .stat span { font-size: .74rem; color: var(--ink-3); }
.plain-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .55rem; }
.plain-list li { display: flex; flex-direction: column; gap: .1rem; font-size: .9rem; }
.plain-list li small { color: var(--ink-3); line-height: 1.5; }
.mt { margin-top: 1.25rem; }
.ai-link-card .card-head { margin-bottom: 0; }
.link-btn.danger { color: var(--red); }

/* =====================================================================
   1.3.0 — الإعدادات: الإغلاق التلقائي، أسباب الإغلاق، سمات العملاء
   ===================================================================== */
.idle-card .card-head { align-items: flex-start; }
.scope-bar { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; padding: .6rem .9rem; margin-bottom: 1rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.scope-pick { flex-direction: row !important; align-items: center; gap: .6rem !important; margin: 0 !important; }
.scope-pick > span { white-space: nowrap; }
.idle-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .25rem 1.5rem; }
.idle-grid .span-2 { grid-column: span 2; }
.idle-grid .switch-row { border-bottom: 0; padding: .4rem 0; }
.idle-amount input[type="number"] { width: 90px !important; }
.idle-amount select { width: auto !important; }
.idle-remind { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 0 1rem; padding: .6rem .9rem .1rem; background: var(--surface-2); border-radius: var(--radius-sm); border: 1px dashed var(--line-2); }
.idle-remind[hidden] { display: none; }
[data-idle-fields].dimmed { opacity: .5; pointer-events: none; }
.label-row.off input[name=name], .field-row.off input[name=label] { color: var(--ink-3); text-decoration: line-through; }
.fields-list { display: flex; flex-direction: column; gap: .5rem; }
.field-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto auto auto; gap: .4rem .5rem; align-items: center; }
.field-row.new { grid-template-columns: minmax(0, 1fr) auto auto; margin-top: .5rem; padding-top: .75rem; border-top: 1px dashed var(--line); }
.field-row input[name=label] { min-width: 0; }
.field-row .field-options { grid-column: 1 / -1; font-size: .85rem; }
.field-row .field-options[hidden] { display: none; }
@media (max-width: 600px) {
  .field-row, .field-row.new { grid-template-columns: minmax(0, 1fr) auto; }
}
.check.small { font-size: .82rem; }
.nowrap { white-space: nowrap; }

/* سجل التنبيهات (حسابي) */
.nlog { display: flex; flex-direction: column; }
.nlog-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: .75rem; padding: .55rem 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.nlog-row:last-child { border-bottom: 0; }
.nlog-body { display: flex; flex-direction: column; min-width: 0; }
.nlog-body b { font-size: .9rem; font-weight: 600; }
.nlog-body small { color: var(--ink-3); line-height: 1.5; }
.pill-muted { background: var(--surface-3); color: var(--ink-3); }

@media (max-width: 960px) {
  .idle-grid { grid-template-columns: 1fr; }
  .idle-grid .span-2 { grid-column: auto; }
  .idle-remind { grid-template-columns: 1fr; }
  .nlog-row { grid-template-columns: auto minmax(0, 1fr); }
  .nlog-row time { grid-column: 2; font-size: .76rem; }
  .ai-menu { inset-inline-start: .5rem; inset-inline-end: .5rem; max-width: none; }
}
@media (max-width: 600px) {
  .bulk-actions { gap: .25rem; }
  .bulk-btn { padding: .3rem .55rem; font-size: .78rem; }
  .pop-menu { max-width: calc(100vw - 2rem); }
}

/* تنبيه رسالة جديدة داخل الصفحة (محادثة غير المفتوحة) */
.toast-msg { background: var(--surface); color: var(--ink); border: 1px solid var(--brand-line); border-inline-start: 4px solid var(--brand); min-width: 260px; }
.toast-msg-body { display: flex; flex-direction: column; min-width: 0; }
.toast-msg-body b { font-size: .9rem; }
.toast-msg-body small { color: var(--ink-3); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 280px; }

/* =====================================================================
   1.4.0 — الرد الآلي بالذكاء الاصطناعي
   ===================================================================== */
.ai-pill { display: inline-flex; align-items: center; gap: .3rem; border: 1px solid var(--brand-line); background: var(--brand-soft); color: var(--brand-ink); border-radius: 999px; padding: .25rem .6rem; font: inherit; font-size: .78rem; font-weight: 600; cursor: pointer; white-space: nowrap; }
.ai-pill .icon { color: var(--brand); }
.ai-pill:hover { background: color-mix(in srgb, var(--brand) 18%, white); }
.ai-pill.off { background: var(--surface-3); border-color: var(--line-2); color: var(--ink-3); }
.ai-pill.off .icon { color: var(--ink-3); }
.ai-mark { color: var(--brand); display: inline-flex; }
.ai-auto-card { margin-top: 1.25rem; }
.ai-auto-card .card-head { align-items: flex-start; }
.sub-title { display: flex; align-items: center; gap: .4rem; font-size: .98rem; margin: 1.4rem 0 .5rem; padding-top: 1rem; border-top: 1px dashed var(--line); }
.sub-title .icon { color: var(--brand); }
.auto-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(300px, .9fr); gap: 1.5rem; align-items: start; }
.auto-grid.dimmed .auto-main { opacity: .55; pointer-events: none; }
.auto-main .switch-row { border-bottom: 0; padding: .5rem 0; }
.num-sm { width: 90px !important; }
.mode-pick { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin-top: .3rem; }
.mode-opt { display: flex; gap: .6rem; align-items: flex-start; border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: .6rem .75rem; cursor: pointer; background: var(--surface); transition: border-color .12s, background .12s; }
.mode-opt:hover { border-color: var(--brand-line); }
.mode-opt:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.mode-opt input { margin-top: .25rem; accent-color: var(--brand); }
.mode-opt span { display: flex; flex-direction: column; gap: .1rem; }
.mode-opt b { font-size: .9rem; }
.mode-opt small { color: var(--ink-3); font-size: .76rem; line-height: 1.5; }
.auto-try { position: sticky; top: 1rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; display: flex; flex-direction: column; gap: .5rem; }
.auto-try h3 { display: flex; align-items: center; gap: .4rem; font-size: .95rem; margin: 0; }
.try-chat { background: var(--wa-bg); border-radius: 12px; padding: .7rem; min-height: 220px; max-height: 380px; overflow-y: auto; display: flex; flex-direction: column; gap: .4rem; }
.try-empty { align-self: center; margin: auto; text-align: center; }
.try-msg { max-width: 88%; padding: .45rem .7rem; border-radius: 12px; font-size: .88rem; line-height: 1.55; white-space: pre-wrap; word-break: break-word; background: #fff; box-shadow: 0 1px 1px rgba(0,0,0,.06); }
.try-msg.customer { align-self: flex-start; border-start-start-radius: 3px; }
.try-msg.ai { align-self: flex-end; background: var(--wa-out); border-start-end-radius: 3px; }
.try-msg.ai.wait { color: var(--ink-3); }
.try-msg.sys { align-self: center; background: rgba(255,255,255,.7); color: var(--ink-2); font-size: .78rem; border-radius: 999px; padding: .2rem .7rem; box-shadow: none; }
.try-msg.sys.bad { color: var(--red); }
.try-row { display: flex; gap: .4rem; }
.try-row input { flex: 1; }
.try-row .btn { width: 2.6rem; padding: 0; justify-content: center; }
.lib-ai-note { font-size: .8rem; margin-top: .25rem; border-color: transparent; background: transparent; width: 100%; }
.lib-ai-note:hover, .lib-ai-note:focus { border-color: var(--line-2); background: var(--surface); }
.ai-context { min-height: 200px; font-size: .9rem; line-height: 1.7; }
@media (max-width: 960px) {
  .auto-grid { grid-template-columns: 1fr; }
  .auto-try { position: static; }
  .mode-pick { grid-template-columns: 1fr; }
}

/* تقرير الحملة: المستلمون والردود */
.row-replied td { background: #F3FAF6; }
.reply-preview { color: var(--ink-2); max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .8rem; }

/* ============================================================
   1.5.0 — عدّاد معلومات الشركة (بلا حد) وملفات المساعد
   ============================================================ */
.ctx-meter { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .6rem; font-size: .8rem; color: var(--ink-2); margin-top: .35rem; }
.ctx-meter b { font-variant-numeric: tabular-nums; }
.ctx-meter .pill { font-size: .72rem; }
.ctx-warn { display: flex; align-items: flex-start; gap: .35rem; color: #8A5A0B; background: var(--saffron-soft); border-radius: var(--radius-sm); padding: .4rem .6rem; margin-top: .35rem; }
.ctx-warn[hidden] { display: none; }
.ctx-warn .icon { flex: none; margin-top: .15rem; color: var(--saffron); }
.ai-files { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); padding: .65rem .8rem; margin: .2rem 0 .4rem; }
.ai-files-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .4rem; font-size: .86rem; margin-bottom: .35rem; }
.ai-files-head .link-btn { font-size: .8rem; display: inline-flex; align-items: center; gap: .25rem; }
.ai-files-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; max-height: 260px; overflow-y: auto; }
.ai-files-list li { display: flex; gap: .55rem; align-items: flex-start; padding: .45rem 0; border-top: 1px solid var(--line); }
.ai-files-list li:first-child { border-top: 0; }
.ai-file-ico { flex: none; width: 1.9rem; height: 1.9rem; border-radius: 6px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line); color: var(--brand); }
.ai-file-text { display: flex; flex-direction: column; gap: .1rem; min-width: 0; font-size: .85rem; }
.ai-file-text b { font-weight: 600; }
.ai-file-text small { font-size: .76rem; color: var(--ink-2); line-height: 1.5; }
.ai-file-text .warn-text { color: #8A5A0B; }

/* ============================================================
   1.5.0 — أرقام مربوطة بالباركود (WAHA) — غير رسمي
   ============================================================ */
.qr-card .card-head h2 { display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; }
.qr-card .card-head h2 .pill { font-size: .72rem; font-weight: 500; }
.qr-warning { display: flex; gap: .8rem; align-items: flex-start; background: var(--saffron-soft); border: 1px solid #EED9A6; border-inline-start: 4px solid var(--saffron); border-radius: var(--radius-sm); padding: .8rem 1rem; margin-bottom: 1rem; color: #4A3509; }
.qr-warning-ico { color: var(--saffron); margin-top: .1rem; flex: none; }
.qr-warning b { display: block; margin-bottom: .25rem; color: #3D2B06; }
.qr-warning ul { margin: 0; padding-inline-start: 1.1rem; display: flex; flex-direction: column; gap: .25rem; font-size: .86rem; line-height: 1.65; }
.qr-warning li b { display: inline; margin: 0; }
.qr-off { border: 1px dashed var(--line-2); border-radius: var(--radius-sm); padding: .9rem 1rem; margin-bottom: 1rem; background: var(--surface-2); }
.qr-off p { margin: 0 0 .5rem; font-size: .9rem; }
.cmd-line { display: inline-flex; align-items: center; gap: .4rem; background: var(--charcoal); color: #F2EEE8; border-radius: var(--radius-sm); padding: .35rem .4rem .35rem .8rem; direction: ltr; }
.cmd-line code { font-family: var(--mono); font-size: .9rem; background: none; color: inherit; }
.cmd-line .icon-btn { color: #F2EEE8; }
.qr-list { display: flex; flex-direction: column; gap: .7rem; margin-bottom: 1rem; }
.qr-row { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); padding: .85rem 1rem; display: flex; flex-direction: column; gap: .65rem; }
.qr-row.off { opacity: .65; }
.qr-row-main { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: .6rem 1rem; align-items: center; }
.qr-row-main .form-alert { margin: .3rem 0 0; font-size: .8rem; }
.form-alert.warn { background: var(--saffron-soft); color: #7A5410; border: 1px solid #F0DDB4; border-radius: var(--radius-sm); padding: .5rem .7rem; display: flex; gap: .4rem; align-items: center; }
.qr-camp-on { color: #7A5410; }
.qr-actions { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; justify-content: flex-end; }
.qr-edit { padding-top: .6rem; border-top: 1px dashed var(--line); }
.qr-policy { margin: 0; }
.qr-policy h3 { display: flex; align-items: center; gap: .4rem; font-size: .98rem; }
.qr-policy .switch-row { border-bottom: 0; padding: .5rem 0; }
.qr-policy .dimmed { opacity: .5; }
.check-ack { display: flex; gap: .55rem; align-items: flex-start; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .6rem .75rem; margin: .5rem 0; font-size: .86rem; line-height: 1.6; cursor: pointer; }
.check-ack[hidden] { display: none; }
.check-ack input { margin-top: .3rem; accent-color: var(--brand); flex: none; }
.qr-new { border-top: 1px dashed var(--line); padding-top: .8rem; }
.qr-new > summary { cursor: pointer; display: inline-flex; align-items: center; gap: .35rem; color: var(--brand-ink); font-weight: 500; }
.qr-new form { margin-top: .8rem; max-width: 640px; }
/* نافذة الربط */
.qr-link { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 1.4rem; align-items: start; }
.qr-steps ol { margin: 0 0 .6rem; padding-inline-start: 1.2rem; display: flex; flex-direction: column; gap: .45rem; line-height: 1.7; }
.qr-box { width: 300px; height: 300px; border: 1px solid var(--line); border-radius: 14px; background: #fff; display: grid; place-items: center; overflow: hidden; }
.qr-img { width: 280px; height: 280px; image-rendering: pixelated; }
.qr-wait { display: flex; flex-direction: column; align-items: center; gap: .6rem; color: var(--ink-3); font-size: .86rem; text-align: center; padding: 1rem; }
.qr-done { display: flex; flex-direction: column; align-items: center; gap: .3rem; color: var(--green); text-align: center; }
.qr-done b { font-size: 1.2rem; color: var(--ink); }
.qr-done span { font-family: var(--font-display); font-size: 1.05rem; color: var(--ink); }
.qr-done small { color: var(--ink-3); }
.qr-state { min-height: 1.4em; margin: .8rem 0 0; font-size: .86rem; color: var(--ink-2); }
.qr-state.ok { color: var(--green); }
.qr-state.warn { color: #8A5A0B; }
.qr-state.bad { color: var(--red); }
.qr-alt { margin-top: .4rem; border-top: 1px dashed var(--line); padding-top: .6rem; }
.qr-alt summary { cursor: pointer; display: inline-flex; align-items: center; gap: .35rem; color: var(--brand-ink); font-size: .88rem; }
.qr-alt p { margin: .5rem 0; }
.pair-out { margin-top: .6rem; display: flex; align-items: center; gap: .5rem; font-size: .9rem; }
.pair-code { font-family: var(--mono); font-size: 1.35rem; letter-spacing: .18em; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: .25rem .6rem; }
/* مطابقة رمز مفتاح المرور داخل صندوق الباركود */
.qr-passkey { display: flex; flex-direction: column; align-items: center; gap: .75rem; padding: 1rem; text-align: center; }
.qr-passkey > span { font-size: .88rem; color: var(--ink-2); max-width: 22ch; }
.qr-passkey .pair-code { font-size: 2rem; letter-spacing: .3em; padding: .35rem .9rem; }
@media (max-width: 760px) {
  .qr-link { grid-template-columns: 1fr; }
  .qr-box { width: 100%; max-width: 300px; margin: 0 auto; }
  .qr-row-main { grid-template-columns: auto minmax(0, 1fr); }
  .qr-actions { grid-column: 1 / -1; justify-content: flex-start; }
}
/* حملة رقم الباركود: نص الرسالة */
.camp-text h3 { display: flex; align-items: center; gap: .4rem; font-size: 1rem; }
.camp-text-body { background: var(--wa-out); border-radius: 10px; padding: .6rem .8rem; margin: .4rem 0; white-space: pre-wrap; line-height: 1.7; font-size: .92rem; max-width: 640px; }
.camp-text p { margin: .5rem 0 0; display: flex; align-items: center; gap: .35rem; }
.callout[hidden] { display: none; }
/* منشئ الحملة لرقم الباركود */
.qr-camp-note { margin: .9rem 0 0; }
.qr-camp-note.bad { background: var(--red-soft); border-color: #F3C5C5; }
.qr-camp-note p { font-size: .86rem; }
.variant-tools { margin: -.2rem 0 .3rem; }
.variant-tools .link-btn { display: inline-flex; align-items: center; gap: .25rem; font-size: .84rem; }
.field.variant > span { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.field.variant .link-btn.danger { font-size: .78rem; }
.wa-file { display: flex; align-items: center; gap: .3rem; font-size: .8rem; color: var(--ink-2); background: var(--surface-2); border-radius: 6px; padding: .3rem .45rem; margin-bottom: .35rem; }
.qr-prev-note { display: flex; align-items: center; gap: .3rem; color: #7A5410; }
.qr-prev-note[hidden] { display: none; }
/* المحادثة على رقم باركود: شارة الخط، ورسائل من الجوال أو محذوفة */
.tw-line.qr { color: #8A5A0B; }
.msg-meta .from-phone, .msg-meta .revoked { display: inline-flex; align-items: center; gap: .2rem; font-size: .7rem; color: var(--ink-3); }
.msg-meta .revoked { color: var(--red); }
