/*
 * لوحة Flowly — نفس لغة Aliens OS: كانفاس ابيض، رماديات دافية هادية، سايد بار فاتح،
 * ولون الهوية (اخضر Flowly) للحاجات النشطة بس. مفيش اي جزء غامق.
 */

:root {
  color-scheme: light;
  --bg: #ffffff;
  --bg-subtle: #f7f7f5;
  --surface: #ffffff;
  --surface-hover: #f6f6f4;
  --surface-active: #ededea;
  --line: #ebebe7;
  --line-2: #f2f2ef;
  --line-strong: #dcdcd6;

  --ink: #2a2f37;
  --ink-strong: #161a20;
  --ink-2: #5b626d;
  --muted: #737a85;
  --icon-ink: #7c8087;

  /* هوية Flowly — مأخوذة من ملفات اللوجو */
  --teal: #11b159;
  --teal-dark: #0c8f47;
  --teal-soft: #e8f6ee;
  --navy: #24253a;

  --green: #12a06a;   --green-soft: #e7f6ef;
  --amber: #b7791f;   --amber-soft: #fdf3e2;
  --red: #e5484d;     --red-soft: #fdecec;
  --blue: #2f6bd8;    --blue-soft: #ebf1fd;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow-xs: 0 1px 2px rgba(22, 24, 28, .04);
  --shadow-sm: 0 1px 2px rgba(22, 24, 28, .04), 0 2px 8px -2px rgba(22, 24, 28, .06);
  --shadow-md: 0 12px 32px -12px rgba(22, 24, 28, .14), 0 2px 6px -2px rgba(22, 24, 28, .05);
  --focus: 0 0 0 3px rgba(17, 177, 89, .16);
  --sb-w: 252px;
  --font: "Lato", "Cairo", "Segoe UI", Tahoma, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg-subtle); color: var(--ink);
  font-family: var(--font); font-size: 14px; line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--teal-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: "Cascadia Mono", ui-monospace, Consolas, monospace; font-size: 12.5px; }
::selection { background: var(--teal-soft); }

/* ================================================================ الهيكل */
body.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sb-w); flex: none; position: sticky; top: 0; height: 100vh;
  background: var(--surface); border-left: 1px solid var(--line);
  display: flex; flex-direction: column; z-index: 40;
}
.sb-brand {
  display: flex; align-items: center; gap: 11px; padding: 18px 18px 16px;
  color: var(--ink-strong); text-decoration: none !important;
}
.sb-name b { display: block; line-height: 1.1; }
.sb-name small { display: block; font-size: 11.5px; color: var(--muted); font-weight: 500; }

.sb-nav { flex: 1; overflow-y: auto; padding: 6px 12px 12px; }
.sb-label {
  font-size: 11px; font-weight: 600; color: var(--muted);
  padding: 16px 10px 6px; letter-spacing: .2px;
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 8px 10px; margin: 1px 0; border-radius: var(--radius-sm);
  color: #626873; font-weight: 500; font-size: 13.5px;
  transition: background .12s, color .12s;
}
.nav-item svg { color: #8f939a; width: 19px; height: 19px; transition: color .12s; }
.nav-item:hover { background: var(--surface-hover); color: var(--ink-strong); text-decoration: none; }
.nav-item.active { background: var(--teal-soft); color: var(--teal-dark); font-weight: 600; }
.nav-item.active svg { color: var(--teal); }

.sb-foot { border-top: 1px solid var(--line); padding: 12px; }
.sb-user { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: var(--radius-sm); }
.avatar {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  display: grid; place-items: center; font-weight: 700; font-size: 14px;
  background: var(--teal-soft); color: var(--teal-dark);
}
.sb-user-name { flex: 1; min-width: 0; }
.sb-user-name b { display: block; font-size: 13px; color: var(--ink-strong); }
.sb-user-name small { display: block; font-size: 11px; color: var(--muted); }

.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px;
  border-radius: 10px; border: 0; background: transparent; color: var(--icon-ink); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-hover); color: var(--ink-strong); }
.icon-btn svg { width: 19px; height: 19px; }

.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.content { width: 100%; max-width: 1320px; margin: 0 auto; padding: 28px 32px 64px; }

.mobile-bar { display: none; }
.sb-scrim { display: none; }

@media (max-width: 900px) {
  .sidebar {
    position: fixed; inset: 0 0 0 auto; transform: translateX(105%);
    transition: transform .22s ease; box-shadow: var(--shadow-md);
  }
  body.sb-open .sidebar { transform: none; visibility: visible; }
  /* السايد بار وهو مقفول بره الشاشة — من غير ده بيعمل سكرول افقي للصفحة كلها */
  .sidebar { visibility: hidden; transition: transform .22s ease, visibility 0s linear .22s; }
  body.sb-open .sidebar { transition: transform .22s ease; }
  html, body.shell { overflow-x: clip; }
  body.sb-open .sb-scrim {
    display: block; position: fixed; inset: 0; background: rgba(22, 24, 28, .28); z-index: 35;
  }
  .mobile-bar {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    position: sticky; top: 0; z-index: 30; height: 56px; padding: 0 10px;
    background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
  }
  .mb-brand { display: flex; align-items: center; gap: 8px; color: var(--ink-strong); font-size: 16px; text-decoration: none !important; }
  .content { padding: 18px 16px 56px; }
}

/* ================================================================ تابات الشغل (نفس Aliens OS) */
.ws-strip {
  position: sticky; top: 0; z-index: 25; display: flex; align-items: center; gap: 6px; height: 46px; flex-shrink: 0;
  padding-inline: 10px 8px; border-bottom: 1px solid var(--line);
  background: linear-gradient(to bottom, var(--bg-subtle), color-mix(in srgb, var(--bg-subtle) 40%, var(--bg)));
}
.ws-strip[hidden] { display: none; }
.ws-scroller {
  position: relative; flex: 1; min-width: 0; height: 100%; overflow-x: auto; overflow-y: hidden;
  scrollbar-width: none; overscroll-behavior-x: contain;
}
.ws-scroller::-webkit-scrollbar { display: none; }
.ws-list { position: relative; display: flex; align-items: center; gap: 4px; height: 100%; width: max-content; min-width: 100%; padding: 0 2px; }
.ws-tab {
  position: relative; display: flex; align-items: center; flex: 0 0 auto; min-width: 0; max-width: 232px; height: 33px;
  border: 1px solid transparent; border-radius: 11px; color: var(--ink-2);
  transition: background-color .16s, border-color .16s, color .16s, box-shadow .22s, transform .22s cubic-bezier(.16, 1, .3, 1), opacity .16s;
  animation: ws-tab-in 300ms cubic-bezier(.16, 1, .3, 1) both;
}
.ws-tab:hover { background: color-mix(in srgb, var(--surface) 80%, transparent); border-color: var(--line); color: var(--ink); }
.ws-tab[data-active='true'] {
  background: var(--surface); border-color: var(--line); color: var(--ink-strong); transform: translateY(-1.5px);
  box-shadow: 0 1px 2px rgba(22, 24, 28, .05), 0 8px 18px -10px rgba(22, 24, 28, .22), inset 0 1px 0 rgba(255, 255, 255, .7);
}
.ws-tab[data-closing='true'] { animation: ws-tab-out 170ms ease-in both; pointer-events: none; }
.ws-tab-main {
  display: flex; align-items: center; gap: 7px; min-width: 0; height: 100%; padding-inline: 5px 4px; border-radius: 10px;
  font-size: 12.5px; font-weight: 600; color: inherit; text-decoration: none !important;
}
.ws-tab-icon {
  position: relative; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 23px; height: 23px; border-radius: 7px;
  color: var(--hue, var(--icon-ink)); background: color-mix(in srgb, var(--hue, var(--icon-ink)) 12%, var(--surface));
  transition: transform .25s cubic-bezier(.34, 1.56, .64, 1), background-color .2s;
}
.ws-tab-icon svg { width: 15px; height: 15px; }
.ws-tab[data-active='true'] .ws-tab-icon { background: color-mix(in srgb, var(--hue, var(--icon-ink)) 17%, var(--surface)); transform: scale(1.06); }
.ws-tab:hover .ws-tab-icon { transform: scale(1.06) rotate(-4deg); }
.ws-tab-title { min-width: 0; max-width: 158px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ws-tab-close {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 19px; height: 19px;
  margin-inline-end: 5px; padding: 0; border: 0; border-radius: 6px; background: transparent; cursor: pointer;
  color: var(--muted); opacity: 0; transition: opacity .15s, background-color .15s, color .15s;
}
.ws-tab:hover .ws-tab-close, .ws-tab[data-active='true'] .ws-tab-close, .ws-tab:focus-within .ws-tab-close { opacity: 1; }
.ws-tab-close:hover { background: var(--surface-active); color: var(--ink-strong); }
/* الخط المضيء تحت التاب المفتوح — بلون Flowly */
.ws-indicator {
  position: absolute; bottom: 3px; height: 3px; border-radius: 9999px; pointer-events: none; opacity: 0;
  background: linear-gradient(90deg, #2bd277, var(--teal) 60%, var(--teal-dark));
  box-shadow: 0 0 10px 1px rgba(17, 177, 89, .38), 0 2px 7px rgba(17, 177, 89, .3);
  transition: left 300ms cubic-bezier(.2, .9, .3, 1), width 300ms cubic-bezier(.2, .9, .3, 1), opacity .2s;
}
.ws-actions { display: flex; align-items: center; gap: 2px; flex-shrink: 0; padding-inline-start: 6px; border-inline-start: 1px solid var(--line); }
.ws-count {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px; height: 30px; min-width: 30px; padding-inline: 7px;
  border-radius: 9px; color: var(--ink-2); font-size: 12px; font-weight: 700;
}
.ws-count svg { width: 16px; height: 16px; }
@keyframes ws-tab-in { from { opacity: 0; transform: translateY(4px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes ws-tab-out { to { opacity: 0; max-width: 0; padding: 0; margin: 0; transform: scale(.9); } }
@media (max-width: 900px) { .ws-strip { top: 56px; height: 44px; } .ws-tab-title { max-width: 110px; } }

/* ================================================================ راس الصفحة */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; margin-bottom: 22px; flex-wrap: wrap;
}
.page-head h1 {
  margin: 0; font-size: 23px; font-weight: 700; letter-spacing: -.3px; color: var(--ink-strong);
  display: flex; align-items: center; gap: 10px;
}
.page-head h1 svg { width: 24px; height: 24px; color: var(--teal); }
.page-head p { margin: 4px 0 0; color: var(--ink-2); font-size: 13.5px; }

/* ================================================================ البطاقات */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-xs); margin-bottom: 20px;
  min-width: 0;
}
.card-head {
  padding: 14px 18px; border-bottom: 1px solid var(--line-2);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.card-head h2 {
  margin: 0; font-size: 14.5px; font-weight: 650; color: var(--ink-strong);
  display: flex; align-items: center; gap: 9px;
}
.card-head h2 svg { color: var(--icon-ink); }
.card-head .hint { font-size: 12px; color: var(--muted); font-weight: 400; }
.card-body { padding: 18px; }
.card-body.tight { padding: 0; }

.grid { display: grid; gap: 16px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1150px) { .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .grid.c2, .grid.c3 { grid-template-columns: 1fr; } }
@media (max-width: 460px) { .grid.c4 { grid-template-columns: 1fr; } }

/* ================================================================ الارقام */
.stat {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-xs);
  position: relative; overflow: hidden;
}
.stat .label {
  font-size: 12.5px; color: var(--ink-2); font-weight: 500;
  display: flex; align-items: center; gap: 8px; margin-bottom: 10px;
}
.stat .label svg {
  width: 30px; height: 30px; padding: 6px; border-radius: 9px;
  background: var(--bg-subtle); color: var(--icon-ink);
}
.stat .value { font-size: 27px; font-weight: 700; letter-spacing: -.6px; color: var(--ink-strong); line-height: 1.15; }
.stat .sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.stat.accent .label svg { background: var(--teal-soft); color: var(--teal); }
.stat.accent .value { color: var(--teal-dark); }
.stat.warn .label svg { background: var(--amber-soft); color: var(--amber); }
.stat.warn .value { color: var(--amber); }
.stat.danger .label svg { background: var(--red-soft); color: var(--red); }
.stat.danger .value { color: var(--red); }

/* ================================================================ الجداول */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: right; font-size: 12px; font-weight: 600; color: var(--muted);
  padding: 11px 16px; border-bottom: 1px solid var(--line); background: var(--surface);
  white-space: nowrap;
}
tbody td { padding: 12px 16px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .1s; }
tbody tr:hover { background: #fafaf8; }
td.num, th.num { text-align: left; font-variant-numeric: tabular-nums; }
.truncate { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ================================================================ الشارات */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 600;
  background: var(--line-2); color: var(--ink-2); white-space: nowrap;
}
.badge .dot { width: 6px; height: 6px; border-radius: 99px; background: currentColor; }
.badge.connected, .badge.active, .badge.sent, .badge.delivered, .badge.read, .badge.ok { background: var(--green-soft); color: var(--green); }
.badge.qr_required, .badge.connecting, .badge.queued, .badge.sending, .badge.warn { background: var(--amber-soft); color: var(--amber); }
.badge.disconnected, .badge.logged_out, .badge.inactive, .badge.expired { background: var(--line-2); color: var(--ink-2); }
.badge.error, .badge.failed, .badge.suspended, .badge.cancelled { background: var(--red-soft); color: var(--red); }
.badge.info, .badge.inbound { background: var(--blue-soft); color: var(--blue); }
.badge.teal { background: var(--teal-soft); color: var(--teal-dark); }
.badge.connecting .dot, .badge.qr_required .dot, .badge.sending .dot { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }

/* ================================================================ الازرار */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 15px; min-height: 38px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--surface);
  color: var(--ink-strong); font-size: 13.5px; font-weight: 550; font-family: inherit;
  cursor: pointer; transition: background .12s, border-color .12s, box-shadow .12s, transform .06s;
  white-space: nowrap;
}
.btn svg { width: 17px; height: 17px; }
.btn:hover { background: var(--surface-hover); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--focus); }
.btn.primary { background: var(--teal); border-color: var(--teal); color: #fff; box-shadow: 0 1px 2px rgba(12, 143, 71, .25); }
.btn.primary:hover { background: var(--teal-dark); border-color: var(--teal-dark); }
.btn.dark { background: var(--ink-strong); border-color: var(--ink-strong); color: #fff; }
.btn.dark:hover { background: #2a2e34; }
.btn.danger { color: var(--red); border-color: #f6cfd0; background: var(--red-soft); }
.btn.danger:hover { background: #fbdedf; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-hover); }
.btn.sm { padding: 4px 11px; min-height: 30px; font-size: 12.5px; border-radius: 8px; }
.btn.sm svg { width: 15px; height: 15px; }
.btn.block { width: 100%; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.copied { border-color: var(--teal); color: var(--teal-dark); background: var(--teal-soft); }

/* ================================================================ النماذج */
label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=url],
input[type=date], input[type=search], input[type=tel], select, textarea {
  width: 100%; padding: 9px 12px; min-height: 40px; font-size: 14px; font-family: inherit;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink-strong); outline: none;
  transition: border-color .12s, box-shadow .12s;
}
input::placeholder, textarea::placeholder { color: #a3a8b0; }
input:focus, select:focus, textarea:focus { border-color: var(--teal); box-shadow: var(--focus); }
textarea { resize: vertical; min-height: 78px; }
.field { margin-bottom: 15px; }
.field .help { font-size: 12px; color: var(--muted); margin-top: 5px; }
.field .help b { color: var(--teal-dark); font-weight: 600; }
.check { display: flex; align-items: center; gap: 8px; }
.check input { width: auto; accent-color: var(--teal); }
.check label { margin: 0; font-weight: 500; }
.inline-form { display: inline; }

/* ================================================================ التنبيهات */
.alert {
  padding: 12px 15px; border-radius: var(--radius-sm); font-size: 13.5px;
  margin-bottom: 18px; display: flex; align-items: flex-start; gap: 10px;
  border: 1px solid transparent;
}
.alert svg { margin-top: 2px; }
.alert.ok { background: var(--green-soft); color: #0b6e48; border-color: #cdebdc; }
.alert.err { background: var(--red-soft); color: #b2262b; border-color: #f6cfd0; }
.alert.info { background: var(--blue-soft); color: #1f55b5; border-color: #d4e2fb; }
.alert.warn { background: var(--amber-soft); color: #8a5a10; border-color: #f4e1bd; }

.notice {
  font-size: 12px; color: var(--muted); line-height: 1.8;
  padding: 12px 15px; background: var(--bg-subtle);
  border: 1px dashed var(--line-strong); border-radius: var(--radius-sm);
}

.secret-box {
  font-family: "Cascadia Mono", ui-monospace, Consolas, monospace; font-size: 13px; direction: ltr; text-align: left;
  background: var(--bg-subtle); color: var(--ink-strong); padding: 13px 15px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm); word-break: break-all; user-select: all;
}
.copy-row { display: flex; gap: 8px; align-items: stretch; }
.copy-row .secret-box { flex: 1; min-width: 0; }

/* ================================================================ التبويبات */
.tabs {
  display: flex; gap: 4px; margin-bottom: 20px; overflow-x: auto;
  padding: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  padding: 7px 14px; font-size: 13px; font-weight: 550; color: var(--ink-2);
  border-radius: 9px; white-space: nowrap;
}
.tabs a:hover { color: var(--ink-strong); background: var(--surface-hover); text-decoration: none; }
.tabs a.active { color: var(--teal-dark); background: var(--teal-soft); }

/* ================================================================ الرسم البياني */
.chart { width: 100%; height: 200px; display: block; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .area-sent { fill: var(--teal); opacity: .1; }
.chart .line-sent { fill: none; stroke: var(--teal); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.chart .line-recv { fill: none; stroke: var(--blue); stroke-width: 1.8; stroke-dasharray: 4 3; }
.chart .line-fail { fill: none; stroke: var(--red); stroke-width: 1.8; }
.chart text { font-size: 10px; fill: var(--muted); }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--ink-2); flex-wrap: wrap; }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 3px; border-radius: 2px; display: inline-block; }

/* ================================================================ متنوع */
.empty { padding: 48px 20px; text-align: center; color: var(--muted); font-size: 13.5px; }
.empty svg {
  width: 46px; height: 46px; padding: 11px; border-radius: 14px; margin-bottom: 12px;
  background: var(--bg-subtle); color: var(--icon-ink); display: inline-block;
}
.filters { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }
.filters input, .filters select { width: auto; min-width: 170px; }
@media (max-width: 600px) { .filters input, .filters select { width: 100%; min-width: 0; } }
.meter { height: 7px; background: var(--line-2); border-radius: 99px; overflow: hidden; margin-top: 6px; }
.meter > i { display: block; height: 100%; background: var(--teal); border-radius: 99px; }
.meter > i.warn { background: var(--amber); }
.meter > i.over { background: var(--red); }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 10px 14px; font-size: 13.5px; }
.kv dt { color: var(--ink-2); font-weight: 550; }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 520px) { .kv { grid-template-columns: 1fr; gap: 2px 0; } .kv dd { margin-bottom: 8px; } }
svg.ico { width: 18px; height: 18px; flex: none; }
.qr-thumb { width: 150px; height: 150px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }

/* شريط "الارقام: 1 من 3" في صفحة العميل */
.quota-strip { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.quota-strip .q {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-xs);
}
.quota-strip .q svg { color: var(--teal); }
.quota-strip .q b { font-size: 16px; color: var(--ink-strong); }
.quota-strip .q small { color: var(--muted); font-size: 12px; display: block; line-height: 1.2; }

/* اسم Flowly: خط هندسي تقيل زي اللوجو الاصلي، و"o" بلون الفقاعة */
.wm {
  font-family: "Outfit", var(--font); font-weight: 800; font-size: 21px; letter-spacing: -.8px;
  color: var(--navy); direction: ltr; unicode-bidi: isolate;
}
.wm i { font-style: normal; color: var(--teal); }
.mb-brand .wm { font-size: 19px; }

/* ================================================================ اللوجو والايقونة الرسمية */
.logo-full { display: block; height: auto; user-select: none; }
.sb-logo { width: 150px; }
.mb-logo { width: 104px; }
.sb-brand { padding: 22px 20px 18px; }

.brandmark { flex: none; overflow: visible; }
.bm-bg { fill: #13b05a; }
.fb { fill: #fff; animation: fb-in .7s cubic-bezier(.2, .9, .3, 1.15) both; }
.fb.b2 { animation-delay: .14s; }
.fb.b3 { animation-delay: .28s; }
/* بعد ما تدخل: موجة خفيفة كل شوية كأن الرسايل لسه بتتبعت */
.brandmark:not(.once) .fb { animation: fb-in .7s cubic-bezier(.2, .9, .3, 1.15) both, fb-wave 3.2s ease-in-out 1.4s infinite; }
.brandmark:not(.once) .fb.b2 { animation-delay: .14s, 1.55s; }
.brandmark:not(.once) .fb.b3 { animation-delay: .28s, 1.7s; }
@keyframes fb-in { from { transform: translateX(-90px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fb-wave { 0%, 70%, 100% { transform: none; } 80% { transform: translateX(16px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
.brandmark.once .bm-flow { animation: bm-fade .5s ease 5s forwards; }
@keyframes bm-fade { to { opacity: 0; } }

/* ================================================================ انتقالات الصفحات */
/* المتصفحات الحديثة: المحتوى بس اللي بيتبدل، والسايد بار والتابات ثابتين في مكانهم */
@view-transition { navigation: auto; }
.sidebar { view-transition-name: fx-sidebar; }
.ws-strip { view-transition-name: fx-tabs; }
.mobile-bar { view-transition-name: fx-mobilebar; }
::view-transition-old(root) { animation: fx-out .18s cubic-bezier(.4, 0, 1, 1) both; }
::view-transition-new(root) { animation: fx-in .34s cubic-bezier(.16, 1, .3, 1) both; }
::view-transition-group(fx-sidebar), ::view-transition-group(fx-tabs), ::view-transition-group(fx-mobilebar) { animation: none; }
@keyframes fx-out { to { opacity: 0; transform: translateY(-6px); } }
@keyframes fx-in { from { opacity: 0; transform: translateY(10px); filter: blur(2px); } }

/* اول ما الصفحة تفتح (او في متصفح مالوش view transitions): المحتوى بيطلع بهدوء */
.content > * { animation: fx-rise .42s cubic-bezier(.16, 1, .3, 1) both; }
.content > *:nth-child(2) { animation-delay: .04s; }
.content > *:nth-child(3) { animation-delay: .08s; }
.content > *:nth-child(4) { animation-delay: .12s; }
.content > *:nth-child(n+5) { animation-delay: .16s; }
@keyframes fx-rise { from { opacity: 0; transform: translateY(8px); } }

/* شريط التحميل: خط اخضر بيتملى، ونقط ماشية جواه زي رسايل رايحة */
.fx-bar { position: fixed; top: 0; inset-inline: 0; height: 3px; z-index: 200; pointer-events: none; opacity: 0; transition: opacity .2s; overflow: hidden; }
.fx-bar.on { opacity: 1; }
.fx-bar i { position: absolute; inset: 0; transform-origin: right; transform: scaleX(0);
  background: linear-gradient(90deg, #0c8f47, #11b159 60%, #2bd277); box-shadow: 0 0 10px rgba(17, 177, 89, .55); }
.fx-bar.on i { animation: fx-fill 6s cubic-bezier(.1, .7, .2, 1) forwards; }
.fx-bar b { position: absolute; top: 0; width: 22px; height: 3px; border-radius: 3px; background: #fff; opacity: .9; right: -30px; }
.fx-bar.on b { animation: fx-fly 1.1s linear infinite; }
.fx-bar.on b:nth-of-type(2) { animation-delay: .36s; }
.fx-bar.on b:nth-of-type(3) { animation-delay: .72s; }
@keyframes fx-fill { 0% { transform: scaleX(0); } 30% { transform: scaleX(.55); } 100% { transform: scaleX(.92); } }
@keyframes fx-fly { from { right: -30px; } to { right: 105%; } }

/* لو الصفحة اتأخرت: علامة F وخطوطها بتتبعت ورا بعض */
.fx-veil { position: fixed; inset: 0; z-index: 190; display: grid; place-items: center; pointer-events: none;
  background: rgba(247, 247, 245, .55); backdrop-filter: blur(3px); opacity: 0; transition: opacity .25s; }
.fx-veil.on { opacity: 1; }
.fx-card { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 26px 30px; border-radius: 22px;
  background: #fff; box-shadow: 0 24px 60px -20px rgba(22, 24, 28, .3); transform: scale(.94); transition: transform .3s cubic-bezier(.16, 1, .3, 1); }
.fx-veil.on .fx-card { transform: none; }
.fx-mark { width: 64px; height: 64px; filter: drop-shadow(0 10px 18px rgba(17, 177, 89, .3)); }
.fx-mark path { fill: #fff; }
.fx-veil.on .fx-mark path { animation: fx-send 1.4s cubic-bezier(.45, 0, .2, 1) infinite; }
.fx-veil.on .fx-mark .f2 { animation-delay: .16s; }
.fx-veil.on .fx-mark .f3 { animation-delay: .32s; }
@keyframes fx-send { 0% { transform: translateX(-60px); opacity: 0; } 25%, 60% { transform: none; opacity: 1; } 100% { transform: translateX(70px); opacity: 0; } }
.fx-dots { display: flex; gap: 6px; }
.fx-dots span { width: 7px; height: 7px; border-radius: 50%; background: #11b159; opacity: .3; }
.fx-veil.on .fx-dots span { animation: fx-dot 1s ease-in-out infinite; }
.fx-veil.on .fx-dots span:nth-child(2) { animation-delay: .15s; }
.fx-veil.on .fx-dots span:nth-child(3) { animation-delay: .3s; }
@keyframes fx-dot { 50% { opacity: 1; transform: translateY(-3px); } }

@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  .fx-bar, .fx-veil { display: none; }
}

/* =============================================================================
   Premium v2 — نفس روح بورتال Aliens وصندوق المتابعة: خلفية رمادية هادية، كروت بيضا مسطحة
   بخطوط فاصلة رفيعة، ارقام كبيرة واضحة (Lato)، زرار اساسي اخضر غامق، وكل حاجة متساوية في الارتفاع.
   ============================================================================= */
:root{
  --bg-subtle:#f5f7f6; --line:#e8ecea; --line-2:#f0f3f1; --line-strong:#d9dfdc;
  --ink:#1c2620; --ink-strong:#0f1a14; --ink-2:#4a5650; --muted:#6f7b75; --icon-ink:#7d8883;
  --teal:#11b159; --teal-dark:#0b7a3e; --teal-soft:#e7f7ee;
  --radius:16px; --radius-sm:11px;
  --shadow-xs:0 1px 2px rgba(15,26,20,.04);
  --shadow-sm:0 1px 2px rgba(15,26,20,.04),0 4px 14px -6px rgba(15,26,20,.08);
}
body.shell{background:var(--bg-subtle)}
.content{max-width:1320px}
.main-col{min-width:0}

/* السايد بار */
.sidebar{background:#fff;border-inline-start:1px solid var(--line)}
.sb-label{font-size:11.5px;font-weight:700;color:#98a29d;letter-spacing:.2px}
.nav-item{border-radius:11px;font-weight:600;font-size:14px;color:var(--ink-2);padding:9px 12px}
.nav-item:hover{background:#f3f6f4;color:var(--ink)}
.nav-item.active{background:var(--teal-soft);color:var(--teal-dark);position:relative}
.nav-item.active::before{content:none}
.nav-item.active svg{color:var(--teal-dark)}
.nav-item svg{width:20px;height:20px}

/* راس الصفحة */
.page-head{align-items:flex-end;margin-bottom:22px}
.page-head h1{font-family:"Cairo",sans-serif;font-size:26px;font-weight:800;letter-spacing:-.3px;color:var(--ink-strong)}
.page-head h1 svg{width:26px;height:26px;padding:6px;box-sizing:content-box;border-radius:10px;background:var(--teal-soft);color:var(--teal-dark)}
.page-head p{color:var(--muted);font-size:14px}

/* الكروت */
.card{background:#fff;border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow-xs);overflow:hidden}
.card-head{padding:15px 20px;border-bottom:1px solid var(--line-2);gap:12px}
.card-head h2{font-family:"Cairo",sans-serif;font-size:15.5px;font-weight:800;color:var(--ink-strong)}
.card-head h2 svg{width:20px;height:20px;color:var(--teal-dark)}
.card-head .hint{font-size:12.5px;color:var(--muted)}
.card-body{padding:18px 20px}

/* ارقام الداشبورد */
.stat{background:#fff;border:1px solid var(--line);border-radius:var(--radius);padding:18px 20px;box-shadow:var(--shadow-xs);transition:box-shadow .15s,transform .15s}
.stat:hover{box-shadow:var(--shadow-sm);transform:translateY(-1px)}
.stat .label{font-size:13px;font-weight:700;color:var(--muted);gap:10px}
.stat .label svg{width:22px;height:22px;padding:8px;box-sizing:content-box;border-radius:12px;background:#f1f4f2;color:var(--ink-2)}
.stat.accent .label svg{background:var(--teal-soft);color:var(--teal-dark)}
.stat .value{font-family:"Lato",sans-serif;font-size:32px;font-weight:900;letter-spacing:-.5px;color:var(--ink-strong);margin-top:6px}
.stat.accent .value{color:var(--teal-dark)}
.stat .sub{font-size:12.5px;color:var(--muted)}

/* الجداول */
.table-wrap{overflow-x:auto}
table{font-size:13.5px}
thead th{background:#f8faf9;color:#7b8781;font-size:12px;font-weight:700;letter-spacing:.2px;padding:11px 16px;border-bottom:1px solid var(--line);white-space:nowrap}
tbody td{padding:13px 16px;border-bottom:1px solid var(--line-2);vertical-align:middle}
tbody tr{transition:background .1s}
tbody tr:hover{background:#fafcfb}
td.num,th.num{font-family:"Lato",sans-serif;font-variant-numeric:tabular-nums}

/* الشارات */
.badge{border-radius:999px;font-size:12px;font-weight:700;padding:3px 10px 3px 9px;gap:6px;border:0}
.badge .dot{width:6px;height:6px}

/* الزراير */
.btn{height:40px;border-radius:11px;font-weight:700;font-size:13.5px;padding:0 16px;border:1px solid var(--line-strong);background:#fff;color:var(--ink);gap:8px;box-shadow:var(--shadow-xs)}
.btn:hover{background:#f6f8f7;border-color:#cdd5d1}
.btn svg{width:18px;height:18px}
.btn.primary{background:var(--teal-dark);border-color:var(--teal-dark);color:#fff;box-shadow:0 6px 16px -8px rgba(11,122,62,.55)}
.btn.primary:hover{background:#096834;border-color:#096834}
.btn.danger{background:#fff5f5;border-color:#f5c9cb;color:#c0262b;box-shadow:none}
.btn.danger:hover{background:#fdeaea}
.btn.ghost{background:transparent;border-color:transparent;box-shadow:none}
.btn.sm{height:32px;border-radius:9px;font-size:12.5px;padding:0 11px}
.btn.sm svg{width:15px;height:15px}

/* الحقول */
label{font-size:13px;font-weight:700;color:var(--ink-2)}
input[type=text],input[type=email],input[type=password],input[type=number],input[type=url],input[type=date],input[type=search],input[type=tel],select,textarea{
  border:1.5px solid #e1e6e3;border-radius:11px;min-height:42px;font-size:14px;background:#fff;transition:border-color .15s,box-shadow .15s}
input:focus,select:focus,textarea:focus{border-color:var(--teal);box-shadow:0 0 0 4px rgba(17,177,89,.13);outline:none}
.field .help{color:var(--muted);font-size:12.5px}

/* التبويبات */
.tabs{background:#fff;border:1px solid var(--line);border-radius:14px;padding:5px;gap:4px;box-shadow:var(--shadow-xs)}
.tabs a{border-radius:10px;font-weight:700;font-size:13.5px;color:var(--ink-2);padding:8px 14px;border:0}
.tabs a:hover{background:#f3f6f4}
.tabs a.active{background:var(--teal-soft);color:var(--teal-dark);box-shadow:none}

/* شريط ارقام العميل */
.quota-strip .q{background:#fff;border:1px solid var(--line);border-radius:14px;box-shadow:var(--shadow-xs)}
.quota-strip .q b{font-family:"Lato","Cairo",sans-serif;font-size:17px;font-weight:900}
.quota-strip .q svg{width:22px;height:22px;color:var(--teal-dark)}

/* التنبيهات والرسايل */
.alert{border-radius:13px;font-weight:600;border:0}
.alert.ok{background:#e9f8ef;color:#0b6b37}
.alert.err{background:#fdeeee;color:#a52429}
.alert.warn{background:#fff6e5;color:#8a5300}
.alert.info{background:#eef4ff;color:#1f4fa8}
.secret-box{border-radius:11px;background:#f6f8f7;border:1px dashed var(--line-strong)}
.empty{color:var(--muted)}
.empty svg{color:#c3ccc7}

/* ما يعديش عرض الشاشة */
.content,.card,.grid > *{min-width:0}
@media (max-width:820px){
  .grid.c4,.grid.c3{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media (max-width:760px){
  .grid.c3{grid-template-columns:1fr}
}
@media (max-width:820px){
  .stat{padding:14px 14px}
  .stat .value{font-size:26px}
  .stat .label{font-size:12.5px}
  .stat .label svg{width:18px;height:18px;padding:7px}
  .page-head h1{font-size:22px}
  .card-head{padding:13px 16px}
  .card-body{padding:14px 16px}
}
