/* ==========================================================================
   Botgy design system v2: هادي ونضيف.
   الهوية (اللوجو والألوان) زي ما هي. الشكل: خلفية سادة، أسطح بيضا بحواف خفيفة، مسافات واسعة،
   والبرتقالي بس للفعل الأهم. نقط الكتابة بتظهر في اللوجو والحالات الفاضية.
   ========================================================================== */

:root {
  --bg: #FBFAF7;  --surface: #FFFFFF;  --surface-2: #F6F4EE;
  --ink: #1A1713; --ink-2: #6B645A;
  --line: #ECE8DF; --line-strong: #D9D3C6;
  --signal: #FF6A3D; --signal-hover: #F25A2B; --signal-soft: #FFE8DF; --on-signal: #1A1713;
  --signal-text: #B83A12; /* orange for small text: AA on cream and white */
  --ultra: #3B4BFF; --ultra-soft: #E4E7FF;
  --ok: #136B45; --ok-soft: #DDF3E8;
  --err: #C8372D; --err-soft: #FBE3E0;
  --shadow: 0 1px 2px rgba(26,23,19,.04), 0 8px 24px rgba(26,23,19,.04);
  --side: #FFFFFF; --hero-bg: linear-gradient(155deg, #FFF3EC 0%, #FFE2D4 100%);
  --mk-line: var(--ink); --mk-ant: var(--signal);
  --radius: 14px;
  --f-display: "Readex Pro", "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif;
  --f-body: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif;
}

/* الوضع الغامق: بالزرار بس (الفاتح هو الأساسي) */
:root[data-theme="dark"] {
  --bg: #0F0E0C; --surface: #181612; --surface-2: #1E1B16;
  --ink: #F2EDE3; --ink-2: #A59D8F; --line: #2A2620; --line-strong: #3B362D;
  --signal-text: #FF6A3D; --signal-soft: #3A2018; --ultra: #4B59F5; --ultra-soft: #20244F;
  --ok: #4CC38A; --ok-soft: #14301F; --err: #FF7B72; --err-soft: #3E1F1D;
  --shadow: 0 0 0 transparent; --side: #12100D; --hero-bg: #14110D;
  --mk-line: var(--ink); --mk-ant: var(--signal);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overflow-x: clip; }
body { margin: 0; color: var(--ink); background: var(--bg); font: 400 16px/1.8 var(--f-body); overflow-x: clip; }
h1, h2, h3 { font-family: var(--f-display); font-weight: 700; line-height: 1.3; margin: 0; letter-spacing: -.01em; }
h1 { font-size: clamp(24px, 3.4vw, 30px); } h2 { font-size: 19px; } h3 { font-size: 16px; }
a { color: inherit; text-decoration: none; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; border-radius: 6px; }
.mute { color: var(--ink-2); font-size: 15px; }
.num, [dir="ltr"] { font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------ اللوجو */
.mark { display: block; flex: none; }
.mk-s { fill: none; stroke: var(--mk-line); stroke-width: 28; stroke-linecap: round; stroke-linejoin: round; }
.mk-s.mk-thin { stroke-width: 12; }
.mk-f { fill: var(--mk-line); }
.mk-ant { fill: var(--mk-ant); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: inherit; }
.brand .word { font: 700 22px/1 var(--f-display); letter-spacing: -.03em; direction: ltr; }
.brand .word i { font-style: normal; color: var(--signal); }

.dots { display: inline-flex; gap: 5px; align-items: center; vertical-align: middle; }
.dots span { width: 7px; height: 7px; border-radius: 50%; background: var(--line-strong); animation: bounce 1.2s infinite ease-in-out; }
.dots span:nth-child(2) { animation-delay: .15s; }
.dots span:nth-child(3) { animation-delay: .3s; background: var(--signal); width: 9px; height: 9px; }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-5px); } }
@media (prefers-reduced-motion: reduce) { .dots span { animation: none; } }

/* ------------------------------------------------------------ الهيكل */
.shell { display: grid; grid-template-columns: 272px minmax(0, 1fr); min-height: 100vh; }
.side {
  background: var(--side); border-inline-end: 1px solid var(--line); padding: 22px 14px;
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 24px; overflow-y: auto;
}
.side .brand { padding: 0 10px; }
.side-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.menu-btn { display: none; background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); height: 40px; padding: 0 14px; font-size: 15px; box-shadow: none; }
.side .who { padding: 0 10px; color: var(--ink-2); font-size: 15px; margin-top: -12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav h4 { margin: 20px 10px 6px; font: 500 14px/1 var(--f-body); color: var(--ink-2); }
.nav a { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; font-size: 16px; font-weight: 500; color: var(--ink-2); transition: background .12s, color .12s; }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a.on { background: var(--signal-soft); color: var(--ink); font-weight: 600; position: relative; }
.nav a.on::before { content: ""; position: absolute; inset-inline-start: -14px; top: 8px; bottom: 8px; width: 4px; border-radius: 4px; background: var(--signal); }
.nav .ic { width: 16px; text-align: center; font-size: 15px; opacity: .85; }
.nav .pill { margin-inline-start: auto; font-size: 14px; font-weight: 600; background: var(--signal); color: var(--on-signal); padding: 0 8px; border-radius: 99px; line-height: 20px; }
.side-foot { margin-top: auto; padding: 0 10px; }
.side button.link { background: none; border: 0; padding: 0; color: var(--ink-2); font: inherit; font-size: 15px; cursor: pointer; box-shadow: none; }
.side button.link:hover { color: var(--ink); transform: none; box-shadow: none; }

.main { width: 100%; max-width: 1040px; margin-inline: auto; padding: 40px clamp(16px, 4vw, 40px) 96px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 28px; }
.page-head .sub { color: var(--ink-2); margin-top: 6px; }
.crumb { font-size: 15px; color: var(--ink-2); margin-bottom: 10px; }
.crumb a:hover { color: var(--ink); text-decoration: underline; }

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: sticky; top: 0; z-index: 30; height: auto; gap: 8px; padding: 10px 16px; border-inline-end: 0; border-bottom: 1px solid var(--line); overflow: visible; }
  .menu-btn { display: inline-flex; align-items: center; }
  .side .who { display: none; }
  .side .nav, .side .side-foot { display: none; }
  .side.open .nav, .side.open .side-foot { display: flex; }
  .side.open { max-height: 100vh; overflow-y: auto; }
  .side.open .nav { padding-top: 8px; }
  .main { padding-top: 24px; }
}

/* ------------------------------------------------------------ كروت وأزرار */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); margin-bottom: 20px; }
.card > h2 { margin-bottom: 4px; }
.card > .hint { color: var(--ink-2); margin: 0 0 20px; font-size: 15px; }

button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; white-space: nowrap;
  background: var(--signal); color: var(--on-signal); border: 0; border-radius: 10px; padding: 0 20px; height: 42px;
  font: 600 15px/1 var(--f-body); transition: background .12s, transform .06s;
}
button:hover, .btn:hover { background: var(--signal-hover); color: var(--on-signal); }
button:active, .btn:active { transform: scale(.98); }
button.ghost, .btn.ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong); }
button.ghost:hover, .btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
button.danger { background: transparent; color: var(--err); height: 32px; padding: 0 12px; font-weight: 500; }
button.danger:hover { background: var(--err-soft); color: var(--err); }
.inline { display: inline; }

label { display: block; font: 500 15px/1.4 var(--f-body); margin: 18px 0 6px; }
label small { font-weight: 400; color: var(--ink-2); }
input, select, textarea {
  width: 100%; height: 44px; padding: 0 14px; background: var(--surface); color: var(--ink); font: inherit;
  border: 1px solid var(--line-strong); border-radius: 10px; transition: border-color .12s, box-shadow .12s;
}
textarea { height: auto; min-height: 96px; padding: 11px 14px; resize: vertical; line-height: 1.7; }
input::placeholder, textarea::placeholder { color: var(--ink-2); opacity: .6; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--signal); box-shadow: 0 0 0 3px color-mix(in srgb, var(--signal) 22%, transparent); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .row { grid-template-columns: 1fr; gap: 0; } }
.actions { margin-top: 22px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

.switch { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; font-weight: 500; margin: 10px 0 0; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { width: 44px; height: 26px; border-radius: 99px; background: var(--line-strong); position: relative; transition: background .15s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: inset-inline-start .15s; }
.switch input:checked + .track { background: var(--signal); }
.switch input:checked + .track::after { inset-inline-start: 21px; }
.switch input:focus-visible + .track { outline: 2px solid var(--signal); outline-offset: 2px; }

/* ------------------------------------------------------------ جداول وتاجات */
.tablewrap { overflow-x: auto; margin: 0 -8px; padding: 0 8px; }
table { width: 100%; border-collapse: collapse; }
th { text-align: start; font: 500 14px/1 var(--f-body); color: var(--ink-2); padding: 0 12px 12px; }
td { padding: 14px 12px; border-top: 1px solid var(--line); vertical-align: middle; }
tbody tr:hover td, table tr:not(:first-child):hover td { background: var(--surface-2); }
td a { font-weight: 600; } td a:hover { color: var(--signal); }
.tag { display: inline-flex; align-items: center; gap: 6px; font: 500 14px/1 var(--f-body); padding: 5px 10px; border-radius: 99px; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
.tag.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.tag.warn { background: var(--signal-soft); color: var(--ink); border-color: transparent; }
.tag.bot { background: var(--ultra-soft); color: var(--ultra); border-color: transparent; }
.tag.off { color: var(--ink-2); }
.tag .d { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.bar { height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; margin-bottom: 4px; }
.bar i { display: block; height: 100%; background: var(--signal); border-radius: 99px; }

/* ------------------------------------------------------------ إحصائيات */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 20px; }
.stat { padding: 20px 24px; border-inline-start: 1px solid var(--line); }
.stat:first-child { border-inline-start: 0; }
.stat b { display: block; font: 700 30px/1.2 var(--f-display); }
.stat span { color: var(--ink-2); font-size: 15px; }
.stat.hot b { color: var(--signal); }
.stat.hot span::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--signal); margin-inline-end: 6px; }
@media (max-width: 860px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(3) { border-inline-start: 0; } .stat:nth-child(n+3) { border-top: 1px solid var(--line); }
}

/* ------------------------------------------------------------ تبويبات */
.tabs { display: inline-flex; gap: 4px; padding: 4px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 24px; flex-wrap: wrap; max-width: 100%; }
.tabs a { padding: 8px 16px; border-radius: 9px; font-weight: 500; color: var(--ink-2); font-size: 15px; }
.tabs a:hover { color: var(--ink); }
.tabs a.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); font-weight: 600; }
.js .pane { display: none; } .js .pane.on { display: block; }

/* ------------------------------------------------------------ المحادثة */
.thread { display: flex; flex-direction: column; gap: 2px; padding: 4px 0; }
.day { align-self: center; font-size: 14px; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line); border-radius: 99px; padding: 3px 12px; margin: 10px 0 14px; }
.msg { max-width: min(76%, 520px); padding: 10px 14px 8px; border-radius: 18px; word-break: break-word; margin-bottom: 8px; line-height: 1.65; }
.msg .txt { white-space: pre-wrap; }
.msg .who { display: block; font: 500 13px/1 var(--f-body); margin-bottom: 5px; opacity: .7; }
.msg time { display: block; font-size: 13px; opacity: .55; margin-top: 4px; direction: ltr; text-align: end; }
.msg.customer { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--line); border-end-start-radius: 5px; }
.msg.bot { align-self: flex-end; background: var(--ultra); color: #fff; border-end-end-radius: 5px; }
.msg.owner { align-self: flex-end; background: var(--signal); color: var(--on-signal); border-end-end-radius: 5px; }
.banner { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; background: var(--signal-soft); border-radius: var(--radius); padding: 16px 20px; margin-bottom: 20px; }
.banner p { font-weight: 600; flex: 1 1 240px; }

/* ------------------------------------------------------------ حالة فاضية وتنبيهات */
.empty { text-align: center; padding: 40px 12px; color: var(--ink-2); }
.empty .dots { margin-bottom: 14px; } .empty b { display: block; color: var(--ink); font: 600 16px var(--f-display); margin-bottom: 4px; }
.toasts { position: fixed; top: 16px; inset-inline: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 50; pointer-events: none; }
.toast { pointer-events: auto; background: var(--ink); color: var(--bg); border-radius: 12px; padding: 10px 18px; font-weight: 500; box-shadow: 0 8px 24px rgba(0,0,0,.18); animation: pop .25s ease-out, fade .4s 4.2s forwards; }
.toast.ok::before { content: "✓ "; color: var(--ok); } .toast.err { background: var(--err); color: #fff; }
@keyframes pop { from { transform: translateY(-12px); opacity: 0; } } @keyframes fade { to { opacity: 0; visibility: hidden; } }

/* ------------------------------------------------------------ الدخول */
.entry { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: var(--bg); }
.entry .hero {
  position: relative; overflow: hidden; background: var(--hero-bg); color: var(--ink); padding: clamp(28px, 6vw, 72px);
  display: flex; flex-direction: column; justify-content: space-between; gap: 40px;
}
.entry .hero::before { content: ""; position: absolute; width: 520px; height: 520px; border-radius: 50%; inset-inline-start: -160px; bottom: -200px; background: radial-gradient(closest-side, rgba(255,106,61,.22), transparent); pointer-events: none; }
.entry .hero > * { position: relative; }
.entry .hero h1 { font-size: clamp(34px, 4.6vw, 54px); line-height: 1.2; max-width: 11em; }
.entry .hero h1 em { font-style: normal; color: var(--signal); }
.entry .hero p { color: var(--ink-2); max-width: 28em; margin-top: 18px; font-size: 16px; }
.chatdemo { display: flex; flex-direction: column; gap: 8px; max-width: 340px; }
.chatdemo .msg { margin: 0; font-size: 15px; }
.chatdemo .msg.customer { background: #fff; border-color: var(--line); color: var(--ink); }
.entry .formside { display: grid; place-items: center; padding: 32px 20px; }
.entry .card { width: 100%; max-width: 380px; margin: 0; padding: 32px; }
@media (max-width: 860px) { .entry { grid-template-columns: 1fr; } .chatdemo { display: none; } .entry .hero { gap: 28px; } }

/* ------------------------------------------------------------ صفحة الهوية */
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(150px, 100%), 1fr)); gap: 14px; }
.sw { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); }
.sw i { display: block; height: 72px; }
.sw div { padding: 10px 12px; font-size: 15px; color: var(--ink-2); } .sw b { display: block; font-size: 15px; color: var(--ink); }
.logo-stage { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: 14px; }
.logo-stage > div { border: 1px solid var(--line); border-radius: 12px; padding: 28px 16px; display: grid; place-items: center; gap: 12px; min-height: 150px; }
.type-sample { font: 700 38px/1.2 var(--f-display); } .type-body { font-size: 18px; }
.voice { padding-inline-start: 20px; } .voice li { margin: 6px 0; }
.card p + .logo-stage, .card .hint + .swatches { margin-top: 4px; }
@media (max-width: 520px) { .msg { max-width: 92%; } .card { padding: 20px 16px; } }

/* ------------------------------------------------------------ تنظيم v3 */
.summary { display: grid; grid-template-columns: 1.1fr 1.4fr 1fr; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 24px; }
.summary > div { padding: 18px 22px; border-inline-start: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; justify-content: center; min-width: 0; }
.summary > div:first-child { border-inline-start: 0; }
.summary .k { font-size: 14px; color: var(--ink-2); }
.summary .v { font: 700 22px/1.2 var(--f-display); }
.summary .v small { font: 400 15px var(--f-body); color: var(--ink-2); }
.summary .ctl { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.summary button { height: 34px; padding: 0 14px; font-size: 15px; }
@media (max-width: 860px) {
  .summary { grid-template-columns: 1fr; }
  .summary > div { border-inline-start: 0; border-top: 1px solid var(--line); } .summary > div:first-child { border-top: 0; }
}
.savebar { position: sticky; bottom: 0; z-index: 5; margin: 0 -12px; padding: 16px 12px 14px; display: flex; justify-content: flex-end; align-items: center; gap: 14px;
  background: linear-gradient(to top, var(--bg) 65%, transparent); }
.savebar .mute { margin-inline-end: auto; }
.inline-form { display: grid; grid-template-columns: 1.4fr 1fr auto; gap: 12px; align-items: end; }
.inline-form label { margin-top: 0; }
@media (max-width: 760px) { .inline-form { grid-template-columns: 1fr; } }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-title .mute { font-size: 15px; }
.theme-btn { background: none; border: 1px solid var(--line); color: var(--ink-2); height: 34px; padding: 0 14px; font-size: 15px; font-weight: 500; border-radius: 99px; }
.theme-btn:hover { background: var(--surface-2); color: var(--ink); }
.side-foot { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }


/* ------------------------------------------------------------ محاكاة واتساب */
.head-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.main:has(.sim) { max-width: none; padding-block: 20px 28px; }
.main:has(.sim) .page-head { margin-bottom: 14px; }
.sim { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
.phone { display: flex; flex-direction: column; height: calc(100vh - 150px); min-height: 560px; background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: 26px; overflow: hidden; box-shadow: var(--shadow); }
.phone-top { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.phone-top b { display: block; font: 600 15px/1.3 var(--f-display); }
.phone-top small { color: var(--ink-2); font-size: 14px; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--signal-soft); display: grid; place-items: center; font: 700 16px var(--f-display); flex: none; }
.wall { flex: 1; overflow-y: auto; padding: 16px 14px; display: flex; flex-direction: column; gap: 6px; background: var(--surface-2); }
.wa img { display: block; max-width: 100%; max-height: 420px; border-radius: 10px; margin-bottom: 6px; }
.wa { max-width: min(760px, 78%); position: relative; padding: 8px 12px 6px; border-radius: 14px; line-height: 1.6; word-break: break-word; font-size: 14.5px; }
.wa .txt { white-space: pre-wrap; }
.wa time { display: block; font-size: 10.5px; opacity: .55; margin-top: 2px; direction: ltr; text-align: end; }
.wa.out { align-self: flex-start; background: var(--ok-soft); border-end-start-radius: 4px; }
.wa.in { align-self: flex-end; background: var(--surface); border: 1px solid var(--line); border-end-end-radius: 4px; }
.wa.owner { background: var(--signal-soft); border-color: transparent; }
.wa-note { align-self: center; font-size: 12.5px; color: var(--ink-2); background: var(--surface); border: 1px dashed var(--line-strong); padding: 6px 12px; border-radius: 99px; text-align: center; }
.wa-empty { margin: auto; color: var(--ink-2); font-size: 15px; text-align: center; }
.composer { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); background: var(--surface); }
.composer input { flex: 1; min-width: 0; border-radius: 99px; }
.composer button { border-radius: 99px; padding-inline: 20px; }
.composer .sim-ico { padding: 0; width: 44px; min-width: 44px; height: 44px; flex: none; font-size: 18px; line-height: 1; }
.composer .sim-ico.rec { background: var(--danger, #d33); color: #fff; border-color: transparent; animation: simrec 1.2s ease-in-out infinite; }
@keyframes simrec { 50% { opacity: .6; } }
@media (prefers-reduced-motion: reduce) { .composer .sim-ico.rec { animation: none; } }
.wa .sim-voice { display: block; max-width: 240px; height: 40px; }
.sim-side { display: grid; gap: 16px; }
.wa-cm { position: absolute; inset-block-start: 4px; inset-inline-start: -30px; border: 0; background: transparent; cursor: pointer; opacity: 0; font-size: 15px; padding: 2px 4px; }
.wa:hover .wa-cm, .wa-cm:focus-visible { opacity: .8; }
.wa-nt { margin-top: 6px; padding: 6px 8px; border-radius: 8px; background: var(--signal-soft); font-size: 13px; white-space: pre-wrap; }
.wa-box { margin-top: 6px; display: grid; gap: 6px; } .wa-box textarea { width: 100%; font: inherit; }
.wa-box button { justify-self: start; }
.notes { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; max-height: 260px; overflow-y: auto; }
.notes li { font-size: 13.5px; line-height: 1.5; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; }
.notes q { display: block; color: var(--ink-2); font-size: 12px; margin-bottom: 2px; quotes: none; }
.note-x { border: 0; background: transparent; cursor: pointer; color: var(--ink-2); float: inline-end; }
#note-msg { width: 100%; font: inherit; }
@media (max-width: 980px) { .sim { grid-template-columns: minmax(0, 1fr); } .phone { height: 70vh; } }

/* ---------- بوابة العميل (/app) ---------- */
.pgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin-bottom: 20px; }
.pgrid .card { margin: 0; }
.chan { display: flex; flex-direction: column; gap: 10px; }
.chan .row1 { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.chan .big { font: 600 18px/1.3 var(--f-display); }
.chan .acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.list { display: flex; flex-direction: column; }
.list a.item, .list .item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 4px; border-top: 1px solid var(--line); color: inherit; }
.list .item:first-child { border-top: 0; }
.list .item .snip { color: var(--ink-2); font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 46ch; display: block; }
.list .item .who { font-weight: 600; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.filters a { padding: 7px 14px; border-radius: 99px; border: 1px solid var(--line); color: var(--ink-2); font-size: 15px; background: var(--surface); }
.filters a.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.replybox { display: flex; gap: 10px; align-items: flex-end; margin-top: 16px; }
.replybox textarea { min-height: 52px; flex: 1; }
.pager { display: flex; justify-content: center; gap: 12px; margin-top: 16px; color: var(--ink-2); font-size: 15px; }
.legend { display: inline-flex; gap: 14px; align-items: center; color: var(--ink-2); font-size: 14px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-inline-end: 5px; vertical-align: -1px; }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 180px; padding-top: 8px; }
.bars .col { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch; gap: 6px; }
.bars .stack { display: flex; flex-direction: column; border-radius: 6px 6px 2px 2px; overflow: hidden; min-height: 2px; }
.bars small { text-align: center; color: var(--ink-2); font-size: 13px; }
.rowacts { display: flex; gap: 6px; justify-content: flex-end; align-items: center; }
.rowacts .btn, .rowacts button { padding: 6px 12px; font-size: 15px; min-height: 0; }
.rowacts form { margin: 0; display: inline; }

/* ---- الصفحة العامة */
.land{max-width:1040px;margin:0 auto;padding:0 20px 40px}
.ltop{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:18px 0;flex-wrap:wrap}
.ltop nav{display:flex;align-items:center;gap:14px;flex-wrap:wrap}
.ltop nav a:not(.btn){color:var(--ink-2)}
.lhero{display:grid;grid-template-columns:1.1fr .9fr;gap:32px;align-items:center;padding:36px 0 24px}
.lhero h1{font-size:clamp(1.7rem,4.4vw,2.6rem);line-height:1.5;margin:0 0 12px}
.lhero p{color:var(--ink-2);line-height:2;margin:0 0 20px}
.lcta{display:flex;gap:10px;flex-wrap:wrap}
.lsec{padding:28px 0}
.lsec>h2{margin:0 0 14px}
.lgrid{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:14px}
.lgrid .card{margin:0}
.lgrid .card p{color:var(--ink-2);line-height:1.9;margin:0}
.lform{max-width:640px;margin:0 auto}
.lfoot{display:flex;gap:18px;justify-content:center;padding:28px 0;color:var(--ink-2);flex-wrap:wrap}
@media(max-width:760px){.lhero{grid-template-columns:1fr}}


/* ==========================================================================
   v3: شكل أقوى + حركة. (الهوية زي ما هي)
   ========================================================================== */
:root { --ease: cubic-bezier(.2,.7,.2,1); --glow: 0 10px 30px color-mix(in srgb, var(--signal) 28%, transparent); }
html { scroll-behavior: smooth; }
body { background:
  radial-gradient(900px 420px at 100% -80px, color-mix(in srgb, var(--signal) 9%, transparent), transparent 70%),
  radial-gradient(700px 360px at 0% 0, color-mix(in srgb, var(--ultra) 6%, transparent), transparent 70%), var(--bg);
  }

@keyframes up { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: translateY(-8px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes growx { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes sheen { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--signal) 55%, transparent); } 50% { box-shadow: 0 0 0 6px transparent; } }
.main > * { animation: up .55s var(--ease) both; }
.main > *:nth-child(2) { animation-delay: .06s; } .main > *:nth-child(3) { animation-delay: .12s; }
.main > *:nth-child(4) { animation-delay: .18s; } .main > *:nth-child(5) { animation-delay: .24s; }
.main > *:nth-child(n+6) { animation-delay: .3s; }
.pgrid > *, .lgrid > *, .stats .stat { animation: up .55s var(--ease) both; }
.pgrid > *:nth-child(2), .lgrid > *:nth-child(2), .stat:nth-child(2) { animation-delay: .08s; }
.pgrid > *:nth-child(3), .lgrid > *:nth-child(3), .stat:nth-child(3) { animation-delay: .16s; }
.lgrid > *:nth-child(4), .stat:nth-child(4) { animation-delay: .24s; }

/* القايمة الجانبية */
.side { background: linear-gradient(180deg, var(--side), color-mix(in srgb, var(--side) 92%, var(--signal-soft))); box-shadow: 1px 0 0 var(--line); gap: 18px; }
.side .brand { transition: transform .3s var(--ease); } .side .brand:hover { transform: scale(1.04); }
.side .who { display: block; margin-top: -8px; padding: 10px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink); font-weight: 600; }
.nav a { transition: background .2s, color .2s, transform .2s var(--ease); }
.nav a:hover { transform: translateX(-4px); }
.nav a .ic { transition: transform .25s var(--ease), color .2s; }
.nav a:hover .ic, .nav a.on .ic { transform: scale(1.18); color: var(--signal); }
.nav a.on { background: linear-gradient(90deg, transparent, var(--signal-soft)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--signal) 22%, transparent); }

.side-foot { padding: 14px 10px 0; border-top: 1px solid var(--line); width: 100%; }
.side-foot .theme-btn { width: 100%; }

/* العناوين */
.page-head h1 { font-size: clamp(26px, 3.6vw, 36px); letter-spacing: -.02em; }
.page-head h1::after { content: ""; display: block; width: 44px; height: 4px; margin-top: 12px; border-radius: 4px; background: var(--signal); transform-origin: right; animation: growx .6s .2s var(--ease) both; }
.page-head .sub { font-size: 17px; }

/* الكروت */
.card { transition: transform .3s var(--ease), box-shadow .3s var(--ease), border-color .3s; }
.card:hover { transform: translateY(-3px); box-shadow: 0 14px 38px rgba(26,23,19,.09); border-color: var(--line-strong); }
:root[data-theme="dark"] .card:hover { box-shadow: 0 0 0 1px var(--line-strong); }
.card:has(form):hover, .card:has(textarea):hover, .phone:hover { transform: none; }
.stats { overflow: hidden; position: relative; }
.stats::before { content: ""; position: absolute; inset-inline: 0; top: 0; height: 3px; background: linear-gradient(90deg, var(--signal), var(--ultra), var(--signal)); background-size: 200% 100%; animation: sheen 6s linear infinite; }
.stat { transition: background .25s; } .stat:hover { background: var(--surface-2); }
.stat b { font-size: 38px; letter-spacing: -.02em; }
.bar { height: 8px; border-radius: 8px; overflow: hidden; background: var(--surface-2); }
.bar i { display: block; height: 100%; border-radius: 8px; background: linear-gradient(90deg, var(--signal), #FF9A6E); transform-origin: right; animation: growx .9s .3s var(--ease) both; }

/* الأزرار */
button, .btn { transition: background .2s, transform .2s var(--ease), box-shadow .25s, color .2s; min-height: 44px; font-size: 16px; }
button:hover:not(.link):not(.danger):not(.ghost):not(.menu-btn), .btn:not(.ghost):hover { transform: translateY(-2px); box-shadow: var(--glow); }
button.ghost:hover, .btn.ghost:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
button.link, button.danger { min-height: 0; }

/* الجداول والقوايم */
tr { transition: background .15s; } tr:hover td { background: var(--surface-2); }
.list .item { transition: background .2s, padding .2s var(--ease), border-radius .2s; }
.list a.item:hover { background: var(--surface-2); padding-inline: 12px; border-radius: 12px; }
.filters a { transition: all .2s var(--ease); } .filters a:hover { transform: translateY(-2px); border-color: var(--line-strong); color: var(--ink); }
.bars .stack { transform-origin: bottom; animation: grow .8s .25s var(--ease) both; }

/* الحقول */
input, select, textarea { font-size: 16px; min-height: 46px; transition: border-color .2s, box-shadow .25s, background .2s; }
label { font-size: 15px; font-weight: 600; }
.toast { animation: pop .35s var(--ease), fade .4s 4.2s forwards; }

/* الصفحة العامة */
.ltop { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(10px); margin-inline: -20px; padding-inline: 20px; }
.lhero { padding: 64px 0 48px; } .lhero h1 { font-size: clamp(32px, 5.4vw, 54px); }
.lhero h1 em { font-style: normal; color: var(--signal); background: linear-gradient(transparent 62%, var(--signal-soft) 62%); padding-inline: 4px; }
.lhero p { font-size: 18px; }
.lsec > h2 { font-size: 28px; margin-bottom: 20px; }
.lgrid .card h3 { margin: 8px 0; font-size: 18px; }
.lgrid .card .num { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--signal-soft); color: var(--signal); font: 700 18px var(--f-display); }
.chatdemo .msg { animation: up .6s var(--ease) both; }
.chatdemo .msg:nth-child(2) { animation-delay: .6s; } .chatdemo .msg:nth-child(3) { animation-delay: 1.2s; } .chatdemo .msg:nth-child(4) { animation-delay: 1.8s; }

@media (max-width: 860px) { .side-foot { padding-top: 10px; } .nav a:hover { transform: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* قايمة المعرفة */
.klist { display: flex; flex-direction: column; gap: 10px; }
.kitem { display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 16px 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); transition: transform .25s var(--ease), box-shadow .25s, border-color .25s; animation: up .5s var(--ease) both; }
.kitem:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--line-strong); }
.kitem.off { opacity: .6; }
.kmain { flex: 1 1 320px; min-width: 0; }
.ktop { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.kprice { margin-inline-start: auto; font: 700 18px var(--f-display); color: var(--signal); }
.kprice small { font-size: 13px; color: var(--ink-2); font-weight: 500; }
.ktitle { font: 600 17px/1.5 var(--f-display); } .ktitle:hover { color: var(--signal); }
.kbody { color: var(--ink-2); margin-top: 2px; line-height: 1.8; }
.rowacts { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.rowacts form { margin: 0; }

/* القنوات: تابات منفصلة */
.ptabs { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.ptab { display: inline-flex; align-items: center; gap: 10px; min-height: 56px; padding: 8px 18px 8px 14px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 16px; font-weight: 600; box-shadow: none; }
.ptab:hover { background: var(--surface-2); color: var(--ink); }
.ptab.on { border-color: var(--signal); background: var(--signal-soft); box-shadow: 0 0 0 3px color-mix(in srgb, var(--signal) 18%, transparent); }
.ptab i { font-style: normal; min-width: 24px; height: 24px; display: grid; place-items: center; border-radius: 99px; background: var(--surface-2); color: var(--ink-2); font-size: 14px; font-weight: 700; }
.ptab.on i { background: var(--signal); color: var(--on-signal); }
.pico { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; flex: none; }
.ptab .pico { width: 34px; height: 34px; border-radius: 10px; }
.pico.wa { background: #DDF3E8; color: #1B8A5C; } .pico.ig { background: #FDE4F0; color: #C2307A; } .pico.ms { background: var(--ultra-soft); color: var(--ultra); }
.ppanel { display: none; } .ppanel.on { display: block; animation: up .4s var(--ease) both; }
.phead { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.acct { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 16px; margin-bottom: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); }
.acct-main { flex: 1 1 200px; min-width: 0; display: flex; flex-direction: column; }
.acct .big { font: 600 18px/1.4 var(--f-display); }
.acct .acts { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; } .acct .acts form { margin: 0; }
.pnote { margin-top: 14px; }
@media (max-width: 560px) { .ptab { flex: 1 1 100%; } }



/* ===== admin panel ===== */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.kpi { display: flex; flex-direction: column; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow); color: var(--ink); transition: transform .2s, box-shadow .2s; }
a.kpi.link:hover { transform: translateY(-3px); box-shadow: var(--glow); }
.kpi-l { color: var(--ink-2); font-size: 15px; }
.kpi-v { font: 700 34px/1.1 var(--f-display); }
.kpi-s { color: var(--ink-2); font-size: 14px; }
.kpi.hot { border-color: var(--signal); }
.kpi.hot .kpi-v { color: var(--signal); }
.kpi.ok .kpi-v { color: var(--ok); }
.ap-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.alerts { display: flex; flex-direction: column; gap: 8px; }
.alert { display: block; padding: 12px 16px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink); font-size: 15px; }
.alert:hover { border-color: var(--ink-2); }
.alert.warn { background: var(--signal-soft); border-color: transparent; }
.alert.hot { background: var(--err-soft); border-color: transparent; color: var(--err); }
.split-meters { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 24px; }
.split-meters h3 { margin-bottom: 8px; font-size: 16px; color: var(--ink-2); }
.mrow { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.hbars { display: flex; flex-direction: column; gap: 12px; }
.hb { display: grid; grid-template-columns: 140px 1fr 48px; gap: 12px; align-items: center; }
.hb .bar { margin: 0; height: 10px; }
.hb b { text-align: end; }
.hours { display: flex; gap: 4px; align-items: flex-end; height: 140px; }
.hours .hr { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; gap: 4px; align-items: center; }
.hours .hr i { display: block; width: 100%; background: var(--ultra); border-radius: 4px 4px 0 0; min-height: 2px; }
.hours small { font-size: 11px; color: var(--ink-2); }
.checks { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.chk { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.chk .dot { width: 26px; height: 26px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 700; }
.chk.ok .dot { background: var(--ok-soft); color: var(--ok); }
.chk.bad .dot { background: var(--err-soft); color: var(--err); }
.chk small { display: block; color: var(--ink-2); margin-top: 2px; }
.banner.ok { background: var(--ok-soft); }
.bar.warn i { background: var(--signal); }
.bar.hot i { background: var(--err); }
.head-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.danger-zone { border-color: var(--err); }
.danger-zone h2 { color: var(--err); }
.danger-btn { background: var(--err); color: #fff; }
.item .who { font-weight: 600; display: block; }
.item .snip { color: var(--ink-2); font-size: 14px; display: block; }
form.inline { display: inline; margin: 0; }
@media (max-width: 900px) { .kpis { grid-template-columns: 1fr 1fr; } .ap-cols { grid-template-columns: 1fr; } .hb { grid-template-columns: 90px 1fr 40px; } }
.side-search { margin: 4px 0 8px; }
.side-search input { width: 100%; height: 42px; border-radius: 12px; font-size: 15px; }
.nav .cnt { margin-inline-start: auto; font-size: 14px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.nav a.sub { padding: 7px 14px; font-size: 15px; font-weight: 400; }
.nav a.sub .ic { font-size: 11px; opacity: .6; }

/* ===== scrollbar مخصص ===== */
* { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--line); border-radius: 99px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--ink-2); background-clip: content-box; }
*::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
*::-webkit-scrollbar-corner { background: transparent; }
.side { overflow-y: auto; overscroll-behavior: contain; }
/* شريط القايمة الجانبية ظاهر عشان يتسحب بالماوس */
.side::-webkit-scrollbar { width: 10px; }
.side { scrollbar-width: thin; scrollbar-color: var(--ink-2) transparent; }

/* ===== v4: controls, rows, layout (ui-ux-pro-max pass) ===== */
.main { max-width: 1240px; }

/* checkbox / radio: normal size, brand colour, 24px+ hit area through the row around them */
input[type="checkbox"], input[type="radio"] {
  appearance: none; -webkit-appearance: none; flex: none; display: inline-grid; place-content: center;
  width: 22px; height: 22px; min-height: 0; padding: 0; margin: 0; cursor: pointer;
  background: var(--surface); border: 1.5px solid var(--line-strong); box-shadow: none;
  transition: background .15s, border-color .15s, box-shadow .15s;
}
input[type="checkbox"] { border-radius: 7px; }
input[type="radio"] { border-radius: 50%; }
input[type="checkbox"]:hover, input[type="radio"]:hover { border-color: var(--ink-2); }
input[type="checkbox"]:checked {
  background: var(--signal) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%231A1713' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.5 8.5l3 3 6-7'/%3E%3C/svg%3E") center / 14px no-repeat;
  border-color: var(--signal);
}
input[type="radio"]:checked { border-color: var(--signal); background: radial-gradient(circle, var(--signal) 0 45%, var(--surface) 50%); }
input[type="checkbox"]:focus-visible, input[type="radio"]:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
input[type="checkbox"]:disabled, input[type="radio"]:disabled { opacity: .45; cursor: not-allowed; }

/* a labelled option = one tappable row */
label.check, label.switch-row {
  display: flex; align-items: center; gap: 12px; margin: 0; min-height: 52px; padding: 12px 16px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); font-weight: 500; font-size: 15px; line-height: 1.5;
  transition: border-color .15s, background .15s;
}
label.check:hover, label.switch-row:hover { border-color: var(--line-strong); background: var(--surface); }
label.check:has(input:checked), label.switch-row:has(input:checked) { border-color: color-mix(in srgb, var(--signal) 55%, var(--line)); background: var(--signal-soft); }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 10px; margin-top: 4px; }
.checks + .actions, .checks + button { margin-top: 18px; }

/* settings / long forms: two columns of cards on wide screens instead of one thin column */
.pane-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.pane-grid > .card { margin-bottom: 0; }
.pane-grid > .wide { grid-column: 1 / -1; }
@media (max-width: 1000px) { .pane-grid { grid-template-columns: minmax(0, 1fr); } }

/* section heading used inside long cards */
.card .sub-title { font: 600 15px/1.4 var(--f-display); color: var(--ink-2); margin: 22px 0 10px; padding-top: 18px; border-top: 1px solid var(--line); }
.card .sub-title:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.group { display: flex; align-items: center; gap: 14px; margin: 36px 0 16px; font: 700 14px/1.2 var(--f-display); letter-spacing: .02em; color: var(--ink-2); }
.group::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.group:first-child, .kpis + .group { margin-top: 28px; }
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(440px, 100%), 1fr)); gap: 16px; align-items: start; }
.cards-grid > .card { margin: 0; }
details.card > summary { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; font: 700 19px/1.3 var(--f-display); }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::after { content: "+"; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--line); font: 600 18px/1 var(--f-body); flex: none; }
details.card[open] > summary::after { content: "–"; }
details.card[open] > summary { margin-bottom: 16px; }

/* v4: filter rows with any number of fields */
.inline-form.fit { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.inline-form.fit > div:last-child { grid-column: auto; }
.inline-form.fit select, .inline-form.fit input { width: 100%; }

/* v4: portal "ready messages" (sequences) */
.form-foot { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-top: 16px; }
.form-foot label.check { min-height: 0; padding: 0; border: 0; background: none; margin: 0; }
.form-foot label.check:hover, .form-foot label.check:has(input:checked) { border: 0; background: none; }
.seq-items { list-style: none; margin: 22px 0 0; padding: 0; display: grid; gap: 8px; border-top: 1px solid var(--line); padding-top: 18px; }
.seq-item { display: grid; grid-template-columns: 30px auto minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.seq-item .num { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; background: var(--signal-soft); color: var(--signal); font: 700 14px var(--f-display); }
.seq-item img { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; }
.seq-item > .seq-text { grid-column: 3; }
.seq-text { font-size: 14px; line-height: 1.55; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.seq-item small { white-space: nowrap; }
.seq-item .rowacts { gap: 6px; flex-wrap: nowrap; }
.seq-item .rowacts button { min-height: 32px; width: 32px; padding: 0; font-size: 15px; display: grid; place-items: center; }
.seq-item:not(:has(img, [aria-label="ملف"])) { grid-template-columns: 30px minmax(0, 1fr) auto auto; }
.seq-item:not(:has(img, [aria-label="ملف"])) > .seq-text { grid-column: 2; }
details.seq-add { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; }
details.seq-add > summary { cursor: pointer; font-weight: 600; font-size: 15px; color: var(--ink-2); list-style: none; }
details.seq-add > summary::-webkit-details-marker { display: none; }
details.seq-add > summary::before { content: "+ "; color: var(--signal); }
details.seq-add[open] > summary { margin-bottom: 14px; color: var(--ink); }
details.seq-add .inline-form { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
details.seq-add .inline-form > div:nth-child(2) { grid-column: span 2; }
.seq-del { margin-top: 14px; }
@media (max-width: 700px) {
  .seq-item, .seq-item:not(:has(img, [aria-label="ملف"])) { grid-template-columns: 28px minmax(0, 1fr) auto; }
  .seq-item small { display: none; }
  .seq-item > .seq-text, .seq-item:not(:has(img, [aria-label="ملف"])) > .seq-text { grid-column: 2; }
}
.seq-tools { display: flex; justify-content: flex-end; margin-bottom: 12px; }
.seq-card > summary { font-size: 18px; }
.seq-card .seq-sum { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.seq-card .seq-meta { margin-inline-start: auto; font: 400 14px var(--f-body); }
.seq-card .seq-sum small { font: 400 13px var(--f-body); }
label.check { width: fit-content; max-width: 100%; }
.checks label.check, .form-foot label.check { width: auto; }

/* ---- سويتش: كل خيار تشغيل/إيقاف في اللوحة والبوابة (مطفي = رمادي، شغّال = برتقالي) ---- */
label.check input[type="checkbox"], label.switch-row input[type="checkbox"] {
  appearance: none; -webkit-appearance: none; flex: none; position: relative; width: 48px; height: 28px; margin: 0; padding: 0; border-radius: 99px;
  border: 1.5px solid var(--line-strong); background-color: color-mix(in srgb, var(--ink) 14%, var(--surface)); background-image: none; cursor: pointer;
  transition: background-color .2s, border-color .2s, box-shadow .2s;
}
label.check input[type="checkbox"]::after, label.switch-row input[type="checkbox"]::after {
  content: ""; position: absolute; top: 2px; inset-inline-start: 2px; width: 21px; height: 21px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .35); transition: inset-inline-start .22s cubic-bezier(.34, 1.56, .64, 1);
}
label.check input[type="checkbox"]:checked, label.switch-row input[type="checkbox"]:checked {
  background-color: #F25A2A; background-image: linear-gradient(135deg, #FF8B5C, #F25A2A); border-color: #E84E1E; box-shadow: 0 3px 12px rgba(255, 106, 61, .45);
}
label.check input[type="checkbox"]:checked::after, label.switch-row input[type="checkbox"]:checked::after { inset-inline-start: 22px; }
label.check input[type="checkbox"]:focus-visible, label.switch-row input[type="checkbox"]:focus-visible { outline: 2px solid var(--signal); outline-offset: 3px; }

/* زرار مسح الملاحظة (×): دايرة صغيرة بإطار خفيف، بتحمرّ عند المرور */
button.note-x, .pcontent button.note-x { all: unset; box-sizing: border-box; float: inline-end; display: inline-grid; place-items: center; width: 26px; height: 26px; margin-inline-start: 8px;
  border: 1px solid var(--line-strong); border-radius: 50%; cursor: pointer; font: 500 17px/1 var(--f-body, inherit); color: var(--ink-2); background: var(--surface); box-shadow: none; transition: background .15s, color .15s, border-color .15s; }
button.note-x:hover { background: color-mix(in srgb, var(--err, #d33) 12%, var(--surface)); color: var(--err, #d33); border-color: var(--err, #d33); transform: none; }
button.note-x:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
button.note-x::after { display: none !important; }
