@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 400; font-style: normal; font-display: swap; src: url("/fonts/plex-arabic-regular.woff") format("woff"); }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 500 600; font-style: normal; font-display: swap; src: url("/fonts/plex-arabic-medium.woff") format("woff"); }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 700 800; font-style: normal; font-display: swap; src: url("/fonts/plex-arabic-bold.woff") format("woff"); }
/* Graphex LB — مركز التحكم: واجهة بشكل تطبيق (RTL). شريط جانبي داكن على الكمبيوتر، وشريط تبويبات سفلي على الهاتف. */
:root {
  /* هوية Graphex LB: كحلي، أزرق ثانوي، رمادي فاتح */
  --navy: #132E53;
  --blue: #3982AF;
  --bg: #F2F2F2;
  --surface: #ffffff;
  --surface-2: #f6f7f9;
  --fg: #132E53;
  --muted: #5d6b7e;
  --line: #dfe3e8;
  --accent: #3982AF;
  --accent-ink: #2b6a93;
  --accent-fg: #ffffff;
  --accent-soft: #e6f0f6;
  --good: #2b6a93;
  --good-soft: #e6f0f6;
  --warn: #132E53;
  --warn-soft: #e9ecf1;
  --crit: #132E53;
  --crit-soft: #e9ecf1;
  --side-bg: #132E53;
  --side-fg: #dbe5ef;
  --side-muted: #93a8c0;
  --side-hover: #1b3a66;
  --side-active: #234a7d;
  --radius: 10px;
  --radius-sm: 8px;
  --shadow: none;
  --font: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, "Noto Sans Arabic", "Noto Naskh Arabic", system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --tabbar-h: 62px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.7 var(--font); }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 24px; line-height: 1.35; font-weight: 700; color: var(--navy); }
h2 { font-size: 16px; line-height: 1.5; font-weight: 700; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
ul, ol { margin: 0; padding: 0; list-style: none; }
code { font-family: var(--mono); }
img { display: block; }

.muted { color: var(--muted); }
.block { display: block; }
.grow { flex: 1; min-width: 0; }
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }
.num { font-variant-numeric: tabular-nums; }
.cluster { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.text-crit { color: var(--crit); }
.pre { white-space: pre-wrap; }
.noscript { padding: 24px; text-align: center; }
.ico { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ico.x { transform: rotate(45deg); }
.ico.chev { width: 18px; height: 18px; color: var(--muted); opacity: .7; }

/* ---------- الهيكل ---------- */
.shell { min-height: 100dvh; }
.side { display: none; }
.main { min-width: 0; }
.view { min-width: 0; outline: none; }
.page { width: 100%; max-width: 1080px; margin-inline: auto; padding: 16px 16px calc(var(--tabbar-h) + 28px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 16px; }

.appbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 6px;
  min-height: calc(54px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 12px 0;
  background: var(--side-bg); color: #fff;
}
.appbar-title { color: #fff; font-size: 17px; font-weight: 700; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appbar-back { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 8px; color: #fff; }
.appbar-back[hidden] { display: none; }
.appbar-back:hover { background: var(--side-hover); text-decoration: none; }

.tabbar {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(4, 1fr);
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding: 6px 6px env(safe-area-inset-bottom);
  background: var(--surface); border-top: 1px solid var(--line);
}
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); font-size: 11.5px; line-height: 1.3; text-align: center; border-radius: 8px; min-width: 0; }
.tab:hover { text-decoration: none; }
.tab-ico { display: grid; place-items: center; width: 52px; height: 28px; border-radius: 8px; }
.tab-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-inline: 2px; }
.tab[aria-current="page"] { color: var(--navy); font-weight: 700; }
.tab[aria-current="page"] .tab-ico { background: var(--accent-soft); color: var(--accent-ink); }

/* ---------- الكمبيوتر: شريط جانبي داكن ---------- */
@media (min-width: 900px) {
  .shell { display: grid; grid-template-columns: 272px minmax(0, 1fr); }
  .side {
    display: flex; flex-direction: column; gap: 18px; position: sticky; top: 0; height: 100dvh; padding: 22px 14px 16px;
    background: var(--side-bg); color: var(--side-fg);
  }
  .brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 4px; }
  .brand-mark { width: 40px; height: 40px; border-radius: 9px; outline: 1px solid #3a5a86; }
  .brand strong { display: block; color: #fff; font-size: 17px; line-height: 1.3; }
  .brand small { display: block; color: var(--side-muted); font-size: 12.5px; }
  .nav { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; }
  .nav-link { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 8px; color: var(--side-fg); font-weight: 500; }
  .nav-link:hover { background: var(--side-hover); text-decoration: none; }
  .nav-link[aria-current="page"] { background: var(--side-active); color: #fff; font-weight: 700; box-shadow: inset -3px 0 0 #6fb1d6; }
  .side-user { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 8px; color: var(--side-fg); background: var(--side-hover); min-width: 0; }
  .side-user:hover { text-decoration: none; background: var(--side-active); }
  .side-user span:last-child { min-width: 0; display: flex; flex-direction: column; line-height: 1.4; }
  .side-user strong { font-size: 14px; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .side-user small { color: var(--side-muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .appbar, .tabbar { display: none; }
  .page { padding: 34px 40px 56px; gap: 20px; }
}
@media (max-width: 899.98px) {
  .page-head h1 { display: none; }
  .page-head .page-actions .btn { flex: 1 1 140px; }
  .back { display: none !important; }
}

/* ---------- رأس الصفحة ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 14px; }
.page-titles { min-width: 0; }
.subtitle { color: var(--muted); font-size: 14.5px; margin-top: 2px; }
.page-actions { display: flex; flex-wrap: wrap; gap: 10px; }
@media (max-width: 899.98px) { .page-head { align-items: stretch; flex-direction: column; flex-wrap: nowrap; } }
.back { display: inline-flex; align-items: center; gap: 4px; align-self: flex-start; color: var(--muted); font-size: 14px; margin-bottom: -8px; }
.back .ico { width: 16px; height: 16px; }

/* ---------- الأزرار ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 8px 18px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--fg);
  font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn .ico { width: 18px; height: 18px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn.primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.btn.danger { color: var(--crit); border-color: color-mix(in srgb, var(--crit) 40%, var(--line)); background: transparent; }
.btn.danger:hover { background: var(--crit-soft); }
.btn.danger-solid { background: var(--crit); border-color: var(--crit); color: #fff; }
.btn.danger-solid:hover { background: var(--crit); }
.btn.sm { min-height: 38px; padding: 4px 13px; font-size: 14px; border-radius: 10px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.icon-btn { display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); color: var(--fg); }

/* ---------- البطاقات ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.card-head.pad { padding: 16px 18px 4px; margin-bottom: 0; }
.card-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.card > p.muted { margin-bottom: 12px; font-size: 14px; }
.two-col { display: grid; grid-template-columns: 1fr; gap: 16px; align-items: start; }
@media (min-width: 900px) { .two-col { grid-template-columns: 1fr 1fr; } }

/* ---------- الصورة الرمزية ---------- */
.avatar { display: inline-grid; place-items: center; flex: none; width: 44px; height: 44px; border-radius: 10px; font-weight: 700; font-size: 17px; }
.avatar .ico { width: 21px; height: 21px; }
.avatar { background: var(--accent-soft); color: var(--navy); }

/* ---------- بطاقات الأرقام ---------- */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 900px) { .stats { grid-template-columns: repeat(5, 1fr); gap: 14px; } }
.stat { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.stat:first-child { grid-column: 1 / -1; }
@media (min-width: 900px) { .stat:first-child { grid-column: auto; } }
.stat-ico { display: none; place-items: center; width: 40px; height: 40px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); }
.stat-body { display: flex; flex-direction: column; min-width: 0; }
.stat-label { color: var(--muted); font-size: 13.5px; line-height: 1.4; }
.stat-value { font-size: 28px; line-height: 1.3; font-weight: 700; color: var(--navy); }
.stat.warn .stat-value { color: var(--warn); }
.stat.crit .stat-value { color: var(--crit); }
.stat-sub { color: var(--muted); font-size: 12.5px; line-height: 1.5; min-height: 1.5em; overflow-wrap: anywhere; }

/* ---------- خلايا القوائم ---------- */
.cells { display: flex; flex-direction: column; }
.cell { display: flex; align-items: center; gap: 12px; padding: 12px 16px; color: inherit; min-height: 64px; border-top: 1px solid var(--line); }
.cells > .cell:first-child { border-top: 0; }
.card-head.pad + .cells > .cell:first-child { border-top: 0; }
a.cell:hover { background: var(--surface-2); text-decoration: none; }
a.cell:active { background: var(--accent-soft); }
.cell-main { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.5; }
.cell-title { font-size: 15.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-sub { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-end { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; font-size: 13.5px; font-weight: 600; }
.cell-chips { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.cell-amount { font-weight: 700; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
@media (min-width: 640px) { .cell-end { flex-direction: row; align-items: center; gap: 12px; } .cell-chips { flex-direction: row; align-items: center; gap: 12px; } }

/* ---------- الشارات ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: 12.5px; font-weight: 600; line-height: 1.7; white-space: nowrap; }
.chip.dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip.good { background: var(--good-soft); color: var(--good); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.crit { background: var(--crit-soft); color: var(--crit); }

/* ---------- البحث ---------- */
.searchbox { position: relative; }
.searchbox .ico { position: absolute; inset-inline-start: 14px; top: 50%; margin-top: -10px; color: var(--muted); pointer-events: none; }
.search { width: 100%; min-height: 48px; padding: 8px 14px; padding-inline-start: 44px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); }
.search:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }

/* ---------- المواقع ---------- */
.site-list { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 900px) { .site-list { grid-template-columns: 1fr 1fr; } }
.site-card { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.site-top { display: flex; align-items: flex-start; gap: 12px; }
.site-id { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.5; }
.site-id strong { font-size: 16px; }
.site-id small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site-id small > .ltr { display: block; overflow: hidden; text-overflow: ellipsis; text-align: right; }
.site-top > .chip { margin-top: 2px; }
.site-switches { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.site-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.site-actions .btn { flex: 1 1 auto; }

/* مفتاح التشغيل */
.sw { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); cursor: pointer; text-align: start; }
.sw:disabled { opacity: .6; cursor: progress; }
.sw-track { position: relative; flex: none; width: 46px; height: 28px; border-radius: 999px; background: #b4bcc8; }
.sw-thumb { position: absolute; top: 3px; inset-inline-start: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff;  }
.sw[aria-checked="true"] .sw-track { background: var(--accent); }
.sw[aria-checked="true"] .sw-thumb { inset-inline-start: 21px; }
.sw-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.4; }
.sw-label { font-weight: 600; font-size: 14px; }
.sw-state { font-size: 12.5px; font-weight: 600; }
.sw-state.on { color: var(--accent-ink); }
.sw-state.off { color: var(--muted); }
.ctl-row .sw { width: auto; min-height: 0; padding: 0; border: 0; background: none; }
.ctl-row .sw-label:empty { display: none; }
.ctl-row { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); }
.ctl-row small { font-size: 13px; }
.ctl-ico { display: inline-grid; place-items: center; flex: none; width: 38px; height: 38px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); }

/* ---------- تفاصيل (مفتاح/قيمة) ---------- */
.kvs { margin: 0; display: grid; grid-template-columns: 1fr; }
.kv { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 11px 0; border-top: 1px solid var(--line); }
.kv:first-child { border-top: 0; }
.kv dt { color: var(--muted); font-size: 14px; flex: none; }
.kv dd { margin: 0; font-weight: 600; text-align: end; min-width: 0; overflow-wrap: anywhere; }
@media (min-width: 900px) { .kvs { grid-template-columns: 1fr 1fr; column-gap: 40px; } .kv:nth-child(2) { border-top: 0; } }

/* ---------- الدفعات ---------- */
.totals { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
.totals-set { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.total { display: flex; flex-direction: column; padding: 10px 12px; border-radius: 8px; background: var(--surface-2); font-weight: 700; font-size: 15px; min-width: 0; overflow-wrap: anywhere; }
.total small { color: var(--muted); font-size: 12px; font-weight: 500; }
.total.good { background: var(--good-soft); color: var(--good); }
.total.warn { background: var(--warn-soft); color: var(--warn); }
.total.crit { background: var(--crit-soft); color: var(--crit); }
.total small { color: inherit; opacity: .8; }
.pays { display: flex; flex-direction: column; }
.pay { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: center; padding: 14px 0; border-top: 1px solid var(--line); }
.pay:first-child { border-top: 0; }
.pay-amount { font-weight: 800; font-size: 16px; }
.pay-dates { grid-column: 1; font-size: 14px; }
.pay > .chip { grid-column: 2; grid-row: 1; justify-self: end; }
.pay-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; }
@media (min-width: 900px) {
  .pay { grid-template-columns: 150px 1fr auto auto; }
  .pay-dates { grid-column: 2; }
  .pay > .chip { grid-column: 3; grid-row: 1; }
  .pay-actions { grid-column: 4; grid-row: 1; }
}

/* ---------- الحالات الفارغة ---------- */
.empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 34px 20px; text-align: center; }
.empty p { max-width: 38ch; font-size: 14px; }
.empty .btn { margin-top: 10px; }
.empty-ico { display: grid; place-items: center; width: 56px; height: 56px; margin-bottom: 6px; border-radius: 18px; background: var(--surface-2); color: var(--muted); }
.empty-ico .ico { width: 26px; height: 26px; }
.profile { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 8px; }
.profile .avatar { width: 52px; height: 52px; font-size: 21px; }
.profile-name { font-size: 17px; }

/* ---------- النماذج ---------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 12px; }
.field { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.half { grid-column: span 1; }
@media (max-width: 480px) { .field.half { grid-column: 1 / -1; } }
.field label { font-size: 14px; font-weight: 600; }
.req { color: var(--crit); }
.field input, .field select, .field textarea { width: 100%; min-height: 46px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.field textarea { resize: vertical; min-height: 84px; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.field .ltr-input { text-align: left; }
.field [aria-invalid="true"] { border-color: var(--crit); }
.hint { color: var(--muted); font-size: 12.5px; }
.form-error { padding: 10px 14px; border-radius: 8px; background: var(--crit-soft); color: var(--crit); font-weight: 600; font-size: 14px; }
.form-error[hidden] { display: none; }
.intro { margin-bottom: 12px; font-size: 14px; }
.modal-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
.modal-actions .btn { flex: 1 1 120px; }
.form .modal-actions { margin-top: 0; }

/* ---------- النوافذ: مركزية على الكمبيوتر، وورقة سفلية على الهاتف ---------- */
.modal { padding: 0; border: 0; border-radius: 12px; background: var(--surface); color: var(--fg); width: min(520px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); box-shadow: 0 12px 32px rgb(19 46 83 / 22%); overflow: hidden; }
.modal.wide { width: min(680px, calc(100vw - 32px)); }
.modal::backdrop { background: rgb(19 46 83 / 45%); }
.modal-box { display: flex; flex-direction: column; max-height: inherit; }
.grab { display: none; width: 40px; height: 5px; margin: 8px auto 0; border-radius: 3px; background: var(--line); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px 8px; }
.modal-body { padding: 4px 18px 20px; overflow-y: auto; overscroll-behavior: contain; }
.confirm-text { margin-bottom: 14px; }
.warn-box { margin-bottom: 12px; padding: 12px 14px; border-radius: 8px; background: var(--warn-soft); color: var(--warn); font-weight: 600; font-size: 14px; }
.secret-row { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.secret { display: block; padding: 12px; border: 1px dashed var(--line); border-radius: 8px; background: var(--surface-2); font-size: 13px; word-break: break-all; user-select: all; }
.steps { padding-inline-start: 20px; margin-bottom: 14px; display: flex; flex-direction: column; gap: 8px; list-style: decimal; font-size: 14px; }
.inline { padding: 1px 6px; border-radius: 6px; background: var(--surface-2); font-size: 12.5px; word-break: break-all; }
@media (max-width: 599.98px) {
  .modal { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 14px 14px 0 0; max-height: 92dvh; }
  .modal.wide { width: 100vw; }
  .grab { display: block; }
  .modal-body { padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
}

/* ---------- التنبيهات ---------- */
.toasts { position: fixed; z-index: 50; inset-inline: 12px; bottom: calc(var(--tabbar-h) + 14px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
@media (min-width: 900px) { .toasts { bottom: 24px; inset-inline-end: auto; inset-inline-start: 24px; align-items: flex-start; } }
.toast { max-width: 440px; padding: 11px 16px; border-radius: 8px; background: var(--navy); color: #fff; font-weight: 600; font-size: 14px; box-shadow: 0 6px 16px rgb(19 46 83 / 22%); pointer-events: auto; }
.toast.error { background: var(--crit); }

/* ---------- التحميل ---------- */
.sk { background: var(--line); border-radius: 8px; }
.sk-title { height: 34px; width: 55%; max-width: 280px; }
.sk-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 900px) { .sk-grid { grid-template-columns: repeat(4, 1fr); } }
.sk-tile { height: 112px; }
.sk-block { height: 220px; }

/* ---------- تسجيل الدخول ---------- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 20px; background: var(--bg); }
.login-card { width: 100%; max-width: 420px; padding: 28px 24px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; display: flex; flex-direction: column; gap: 10px; }
.login-brand { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-bottom: 8px; text-align: center; }
.login-brand .brand-mark { width: 64px; height: 64px; border-radius: 14px; margin-bottom: 6px; }
.login-brand strong { font-size: 20px; }
.login-card h1 { font-size: 22px; text-align: center; }
.login-card .subtitle { text-align: center; margin: 0 0 8px; }


/* حالات بلا ألوان تنبيه: الأزرق = سليم، الكحلي العريض = يحتاج انتباهاً */
.chip.crit { font-weight: 800; box-shadow: inset 0 0 0 1px currentColor; }
.sw-state.off { font-weight: 700; }

/* الهاتف: رأس كحلي + ورقة فاتحة مدوّرة تحمل المحتوى */
.hero, .sheet { display: contents; }
@media (max-width: 899.98px) {
  body { background: #3982AF; }
  .appbar { border-bottom: 0; background: #3982AF; }
  .tabbar { background: #0f2442; border-top-color: #2d5084; }
  .tab { color: #a9bdd3; }
  .tab[aria-current="page"] { color: #fff; }
  .tab[aria-current="page"] .tab-ico { background: #254d82; color: #fff; }

  .page { padding: 0; gap: 0; min-height: calc(100dvh - 54px - env(safe-area-inset-top)); }
  .hero { display: flex; flex-direction: column; gap: 14px; padding: 0 16px 26px; background: #3982AF; }
  .hero .subtitle { color: #eaf3f9; font-size: 14.5px; margin: 0; }
  .hero .page-actions { gap: 12px; }
  .hero .btn { min-height: 54px; border-radius: 16px; font-size: 15.5px; }
  .hero .btn { background: #2f6f98; border-color: #2f6f98; color: #fff; }
  .hero .btn.primary { background: #132E53; border-color: #132E53; color: #fff; }
  .sheet {
    display: flex; flex-direction: column; gap: 14px; flex: 1;
    background: var(--bg); border-radius: 28px 28px 0 0; padding: 20px 16px calc(var(--tabbar-h) + 28px + env(safe-area-inset-bottom));
  }
}

/* ================= تنقيح: بطاقات هادئة بأرقام كبيرة (على نسق التطبيقات) ================= */
.card, .stat { border: 0; border-radius: 20px; }
.card { padding: 20px; }
.card.flush { padding: 0; }
.card-head.pad { padding: 20px 20px 6px; }
h2 { font-size: 17px; }
.page { gap: 14px; }

/* بطاقات الأرقام: عنوان بالأعلى والرقم بالأسفل */
.stats { gap: 12px; }
.stat { justify-content: space-between; gap: 18px; min-height: 140px; padding: 18px 20px; }
.stat-body { gap: 2px; }
.stat-label { font-size: 14px; order: -1; }
.stat-value { font-size: 40px; font-weight: 300; line-height: 1.15; }
.stat-sub { font-size: 13px; }
.stat:first-child { min-height: 150px; }
.stat:first-child .stat-value { font-size: 56px; }
.meter { display: block; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.meter-fill { display: block; height: 100%; border-radius: 3px; background: var(--accent); }
@media (min-width: 900px) {
  .stats { grid-template-columns: repeat(3, 1fr); }
  .stat, .stat:first-child { min-height: 150px; }
  .stat:first-child .stat-value { font-size: 40px; }
}

/* القوائم: بلا خطوط فاصلة ثقيلة، مسافات مريحة */
.cell { min-height: 72px; padding: 14px 20px; border-top: 0; }
.cells > .cell + .cell { box-shadow: inset 0 1px 0 var(--line); }
.cell-title { font-size: 16px; font-weight: 600; }
.cell-amount { font-weight: 600; }
.avatar { width: 44px; height: 44px; border-radius: 12px; }

/* بطاقة الموقع */
.site-card { gap: 16px; }
.site-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.site-actions .btn { padding-inline: 8px; font-size: 13.5px; }
.site-actions .btn .ico { display: none; }
.sw { border: 0; border-radius: 14px; }
.btn { border-radius: 12px; }
.search { border-radius: 14px; box-shadow: none; }
.modal { border-radius: 20px; }
@media (max-width: 599.98px) { .modal { border-radius: 20px 20px 0 0; } }
.page-head .subtitle { margin-top: 0; }
.kv-copy { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.secret-block { margin-bottom: 14px; }
.secret-label { display: flex; flex-direction: column; gap: 0; margin-bottom: 6px; line-height: 1.5; }
.secret-label small { font-size: 12.5px; }
.secret-block .secret-row { margin-bottom: 0; }
@media (min-width: 600px) { .secret-row { flex-direction: row; align-items: center; } .secret-row .secret { flex: 1; min-width: 0; } }

.field[hidden] { display: none; }

/* اختيار اللغة */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); }
.seg-btn { border: 0; cursor: pointer; min-height: 42px; padding: 0 22px; font-size: 15px; font-weight: 600; color: var(--navy); background: transparent; }
.seg-btn.on { background: var(--navy); color: #fff; }
.login-lang { display: flex; justify-content: center; margin-top: 8px; }
/* اتجاه الأسهم في الواجهة الإنجليزية */
[dir="ltr"] .back .ico, [dir="ltr"] .appbar-back .ico, [dir="ltr"] .ico.chev { transform: scaleX(-1); }
@media (max-width: 899.98px) { .page { gap: 0; } }

/* حقل كلمة المرور مع زر العين */
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 48px; }
.eye-btn { position: absolute; top: 0; bottom: 0; right: 0; width: 46px; display: grid; place-items: center; color: var(--muted); background: transparent; border: 0; border-radius: 8px; cursor: pointer; }
.eye-btn:hover { color: var(--navy); }
.eye-btn .ico { width: 20px; height: 20px; }
.login-back { margin-top: 4px; align-self: center; }
