/* مركز حسابي — MizaPos (حاسوب + جوال) */
:root {
  --hub-navy: #00407b;
  --hub-navy-deep: #002d57;
  --hub-sky: #0b5fff;
  --hub-cyan: #22d3ee;
  --hub-teal: #0d9488;
  --hub-emerald: #059669;
  --hub-amber: #f59e0b;
  --hub-rose: #f43f5e;
  --hub-ink: #0f172a;
  --hub-muted: #64748b;
  --hub-line: rgba(0, 64, 123, 0.12);
  --hub-card: rgba(255, 255, 255, 0.92);
  --hub-radius: 22px;
  --hub-shadow: 0 18px 48px rgba(0, 45, 87, 0.1);
  --hub-font: "Tajawal", system-ui, sans-serif;
}

*,
*::before,
*::after { box-sizing: border-box; }

body.hub-body {
  margin: 0;
  min-height: 100vh;
  color: var(--hub-ink);
  font-family: var(--hub-font);
  background:
    radial-gradient(ellipse 70% 45% at 100% -5%, rgba(34, 211, 238, 0.28), transparent 55%),
    radial-gradient(ellipse 55% 40% at -5% 15%, rgba(11, 95, 255, 0.22), transparent 50%),
    radial-gradient(ellipse 45% 30% at 80% 100%, rgba(13, 148, 136, 0.14), transparent 50%),
    linear-gradient(165deg, #e8f3ff 0%, #f4f8fc 42%, #eefaf7 100%);
  -webkit-font-smoothing: antialiased;
}

/* ——— الشريط العلوي ——— */
.hub-top {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px clamp(14px, 3vw, 28px);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(16px) saturate(1.2);
  border-bottom: 1px solid var(--hub-line);
  box-shadow: 0 8px 28px rgba(0, 64, 123, 0.06);
}

.hub-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
  font-size: clamp(1rem, 2.5vw, 1.15rem);
  color: var(--hub-navy);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.hub-brand img {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  box-shadow: 0 8px 18px rgba(0, 64, 123, 0.2);
}

.hub-top-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: flex-end;
}

.hub-top-links .site-auth-slot {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-inline-start: 0;
  order: 0;
}

.hub-top-links .auth-hello {
  font-size: 0.88rem;
  font-weight: 700;
  color: #334155;
  padding: 0 4px 0 2px;
  white-space: nowrap;
}

.hub-top-links .auth-hello strong {
  color: var(--hub-sky);
}

.hub-top-links .auth-link,
.hub-top-links .auth-btn,
.hub-top-links a,
.hub-chip {
  font: inherit;
  font-size: 0.85rem;
  font-weight: 800;
  text-decoration: none;
  border: 1px solid var(--hub-line);
  background: #fff;
  color: #334155;
  padding: 8px 13px;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.hub-top-links .auth-link:hover,
.hub-top-links a:hover,
.hub-chip:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(0, 64, 123, 0.1);
}

.hub-top-links .auth-link--primary,
.hub-chip-primary {
  background: linear-gradient(135deg, var(--hub-navy-deep), var(--hub-sky) 55%, var(--hub-cyan));
  border: none;
  color: #fff;
}

/* ——— الدخول / التسجيل ——— */
.hub-auth {
  width: min(500px, 100% - 28px);
  margin: clamp(28px, 6vh, 56px) auto 48px;
  animation: hubRise 0.45s ease both;
}

.signup-guide {
  margin: 0 0 16px;
  padding-inline-start: 1.2em;
  font-weight: 700;
  line-height: 1.7;
  color: var(--hub-ink);
}

.signup-guide li + li { margin-top: 8px; }

.signup-guide-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

@keyframes hubRise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

.portal-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
  padding: 6px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--hub-line);
  border-radius: 999px;
  backdrop-filter: blur(8px);
}

.portal-tabs button {
  border: 0;
  background: transparent;
  border-radius: 999px;
  padding: 11px 14px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  color: var(--hub-muted);
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.portal-tabs button.active {
  background: linear-gradient(135deg, var(--hub-navy), var(--hub-sky));
  color: #fff;
  box-shadow: 0 10px 24px rgba(11, 95, 255, 0.28);
}

.auth-hero {
  margin: 0 0 16px;
  padding: 18px 18px 16px;
  border-radius: var(--hub-radius);
  background:
    linear-gradient(135deg, rgba(0, 64, 123, 0.96), rgba(11, 95, 255, 0.9) 55%, rgba(34, 211, 238, 0.85));
  color: #fff;
  box-shadow: 0 20px 44px rgba(0, 64, 123, 0.28);
  position: relative;
  overflow: hidden;
}

.auth-hero::after {
  content: "";
  position: absolute;
  inset: auto -20% -40% 40%;
  height: 120%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.22), transparent 60%);
  pointer-events: none;
}

.auth-hero h1 {
  margin: 0;
  font-size: clamp(1.35rem, 4vw, 1.7rem);
  font-weight: 900;
  position: relative;
  z-index: 1;
}

.auth-hero p {
  margin: 8px 0 0;
  font-weight: 600;
  opacity: 0.92;
  font-size: 0.95rem;
  line-height: 1.55;
  position: relative;
  z-index: 1;
}

/* ——— الهيكل بعد الدخول ——— */
.hub-shell {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  gap: 18px;
  width: min(1180px, 100% - 28px);
  margin: 20px auto 48px;
  align-items: start;
  animation: hubRise 0.4s ease both;
}

.hub-side {
  position: sticky;
  top: 78px;
  background: var(--hub-card);
  border-radius: var(--hub-radius);
  padding: 12px;
  border: 1px solid var(--hub-line);
  box-shadow: var(--hub-shadow);
  backdrop-filter: blur(10px);
}

.hub-side button {
  width: 100%;
  text-align: start;
  border: 0;
  background: transparent;
  font: inherit;
  font-weight: 800;
  padding: 12px 14px;
  border-radius: 14px;
  cursor: pointer;
  color: #475569;
  margin-bottom: 4px;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.hub-side button:hover {
  background: rgba(11, 95, 255, 0.06);
  color: var(--hub-navy);
}

.hub-side button.active {
  background: linear-gradient(135deg, rgba(11, 95, 255, 0.14), rgba(34, 211, 238, 0.12));
  color: var(--hub-sky);
  box-shadow: inset 0 0 0 1px rgba(11, 95, 255, 0.18);
}

.hub-nav-ico,
.hub-nav-short { display: none; }

.hub-main { min-width: 0; }

.hub-card {
  background: var(--hub-card);
  border-radius: var(--hub-radius);
  padding: clamp(16px, 2.5vw, 22px);
  border: 1px solid var(--hub-line);
  box-shadow: var(--hub-shadow);
  margin-bottom: 14px;
  backdrop-filter: blur(8px);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hub-card:hover {
  box-shadow: 0 22px 52px rgba(0, 45, 87, 0.12);
}

.hub-card h2,
.hub-card h3 {
  margin: 0 0 12px;
  font-weight: 900;
  letter-spacing: -0.02em;
}

.hub-card h3 {
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.hub-card h3::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--hub-sky), var(--hub-cyan));
  box-shadow: 0 0 0 4px rgba(11, 95, 255, 0.12);
  flex-shrink: 0;
}

.hub-panel.hidden,
.portal-panel.hidden,
.portal-msg.hidden,
.portal-form.hidden {
  display: none !important;
}

.hub-panel { display: none; }
.hub-panel.is-open { display: block; animation: hubRise 0.28s ease both; }

body:not(.is-authed) .hub-shell { display: none; }
body.is-authed .hub-auth { display: none; }
body:not(.is-authed) .hub-side-authed { display: none; }

/* ——— الحقول والأزرار ——— */
.field-label {
  display: block;
  font-weight: 800;
  margin: 0 0 6px;
  font-size: 13.5px;
  color: #334155;
}

.field-input {
  width: 100%;
  padding: 13px 14px;
  border: 1.5px solid rgba(0, 64, 123, 0.16);
  border-radius: 14px;
  font: inherit;
  font-size: 16px;
  margin-bottom: 12px;
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field-input:focus {
  outline: none;
  border-color: var(--hub-cyan);
  box-shadow: 0 0 0 4px rgba(34, 211, 238, 0.22);
}

.portal-msg {
  margin: 0 0 12px;
  padding: 11px 13px;
  border-radius: 14px;
  font-weight: 700;
  font-size: 13.5px;
}

.portal-msg.err { background: #fff1f2; color: #be123c; border: 1px solid #fecdd3; }
.portal-msg.ok { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.portal-msg.info { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }

.portal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 14px;
  padding: 11px 16px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  border: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: linear-gradient(135deg, var(--hub-navy-deep), var(--hub-sky) 60%, #38bdf8);
  color: #fff;
  box-shadow: 0 12px 28px rgba(11, 95, 255, 0.28);
}

.btn-ghost {
  background: #fff;
  border: 1.5px solid rgba(0, 64, 123, 0.16);
  color: #334155;
}

.btn-sm { padding: 8px 12px; font-size: 13px; }
.btn-lg { padding: 13px 18px; font-size: 15px; }
.btn-block { width: 100%; }
.btn.is-busy { opacity: 0.7; pointer-events: none; }

/* ——— بطاقات KPI ——— */
.sub-status {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.sub-kpi {
  position: relative;
  overflow: hidden;
  background: linear-gradient(165deg, #ffffff 0%, #f3f8ff 100%);
  border: 1px solid var(--hub-line);
  border-radius: 18px;
  padding: 14px 14px 13px;
  box-shadow: 0 10px 24px rgba(0, 64, 123, 0.05);
}

.sub-kpi::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 12px;
  bottom: 12px;
  width: 4px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--hub-sky), var(--hub-cyan));
}

.sub-kpi:nth-child(3n+2)::before {
  background: linear-gradient(180deg, var(--hub-teal), #2dd4bf);
}

.sub-kpi:nth-child(3n)::before {
  background: linear-gradient(180deg, var(--hub-amber), #fbbf24);
}

.sub-kpi .k {
  color: var(--hub-muted);
  font-size: 12px;
  font-weight: 800;
  padding-inline-start: 8px;
}

.sub-kpi .v {
  font-size: clamp(1.1rem, 2.6vw, 1.35rem);
  font-weight: 900;
  margin-top: 6px;
  color: var(--hub-navy);
  padding-inline-start: 8px;
  letter-spacing: -0.02em;
  word-break: break-word;
}

.sub-kpi .s {
  font-size: 12px;
  color: var(--hub-muted);
  margin-top: 5px;
  padding-inline-start: 8px;
  font-weight: 600;
}

.phase-pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.phase-pill.trial { background: #fff7ed; color: #c2410c; }
.phase-pill.paid { background: #ecfdf5; color: #047857; }
.phase-pill.expired,
.phase-pill.suspended { background: #fff1f2; color: #be123c; }
.phase-pill.none { background: #f1f5f9; color: #64748b; }

/* ——— الجداول ——— */
.dev-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13.5px;
  min-width: 480px;
}

.dev-table th,
.dev-table td {
  text-align: start;
  padding: 11px 10px;
  border-bottom: 1px solid rgba(0, 64, 123, 0.07);
}

.dev-table th {
  color: var(--hub-muted);
  font-size: 12px;
  font-weight: 800;
  background: rgba(248, 250, 252, 0.9);
  position: sticky;
  top: 0;
}

.dev-table tbody tr {
  transition: background 0.12s ease;
}

.dev-table tbody tr:hover {
  background: rgba(11, 95, 255, 0.04);
}

.table-scroll {
  overflow: auto;
  border-radius: 16px;
  border: 1px solid var(--hub-line);
  background: #fff;
  -webkit-overflow-scrolling: touch;
}

.inv-kind {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}
.inv-kind-sale { background: #dbeafe; color: #1d4ed8; }
.inv-kind-purchase { background: #ffedd5; color: #c2410c; }
.inv-detail td {
  background: #f8fafc;
  padding: 0 8px 12px;
}
.inv-detail.hidden { display: none; }
.inv-lines {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-top: 8px;
}
.inv-lines th,
.inv-lines td {
  text-align: start;
  padding: 6px 8px;
  border-bottom: 1px solid rgba(11, 95, 255, 0.08);
}
.rp-detail {
  padding: 10px 4px 4px;
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
}

.rp-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-start;
  margin-bottom: 12px;
}

.rp-lead {
  margin: 6px 0 0;
  color: var(--hub-muted);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.55;
}

.rp-h {
  margin: 20px 0 10px;
  font-size: 0.95rem;
  font-weight: 900;
  color: var(--hub-navy);
}

.rp-source-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.rp-chip {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  border: 1.5px solid rgba(0, 64, 123, 0.14);
  background: #fff;
  color: #334155;
  font: inherit;
  font-weight: 800;
  font-size: 13px;
  padding: 8px 13px;
  border-radius: 16px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.rp-chip-sub {
  font-size: 11px;
  font-weight: 700;
  opacity: 0.78;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rp-chip.is-empty {
  opacity: 0.62;
  border-style: dashed;
}

.rp-chip:hover { transform: translateY(-1px); }

.rp-chip.active {
  background: linear-gradient(135deg, var(--hub-navy), var(--hub-sky));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 20px rgba(11, 95, 255, 0.25);
}

.rp-source-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(11, 95, 255, 0.06), rgba(34, 211, 238, 0.08));
  border: 1px solid var(--hub-line);
  font-size: 13px;
  font-weight: 700;
  color: #475569;
}

.rp-toolbar-card { margin-bottom: 12px; }
.rp-toolbar-card .rp-source-banner { margin-bottom: 0; }

.rp-sub-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--hub-line);
}

.rp-sub-btn {
  border: 1.5px solid rgba(0, 64, 123, 0.12);
  background: #fff;
  color: #334155;
  font: inherit;
  font-weight: 800;
  font-size: 12.5px;
  padding: 8px 12px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
  white-space: nowrap;
}

.rp-sub-btn:hover {
  transform: translateY(-1px);
  background: rgba(11, 95, 255, 0.05);
}

.rp-sub-btn.active {
  background: linear-gradient(135deg, rgba(11, 95, 255, 0.12), rgba(34, 211, 238, 0.14));
  border-color: rgba(11, 95, 255, 0.28);
  color: var(--hub-navy);
  box-shadow: inset 0 0 0 1px rgba(11, 95, 255, 0.1);
}

.rp-sub-panel { display: none; }
.rp-sub-panel.is-open {
  display: block;
  animation: hubRise 0.24s ease both;
}

.rp-sub-picker { display: none; }

.rp-sub-select {
  margin-bottom: 0;
  font-weight: 800;
  padding: 14px 16px;
  border-radius: 16px;
  background: #fff;
}

.table-scroll--cards {
  overflow: visible;
  border: 0;
  background: transparent;
}

.dev-table--cards {
  min-width: 0;
}

.src-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  background: #f1f5f9;
  color: #64748b;
}
.src-pill-desktop { background: #e0e7ff; color: #3730a3; }
.src-pill-mobile { background: #dcfce7; color: #166534; }
.src-pill-none { background: #f1f5f9; color: #64748b; }

.profile-banner {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  align-items: flex-start;
  padding: 4px 2px 2px;
}

.profile-banner h2 {
  margin: 0;
  font-size: clamp(1.25rem, 3vw, 1.55rem);
  font-weight: 900;
  color: var(--hub-navy);
}

.profile-meta {
  margin: 6px 0 0;
  color: var(--hub-muted);
  font-weight: 700;
}

.profile-meta-sm {
  margin: 4px 0 0;
  color: var(--hub-muted);
  font-size: 13px;
  font-weight: 600;
}

.detail-grid {
  display: grid;
  gap: 10px;
  font-size: 14px;
  font-weight: 700;
}

.detail-grid > div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  padding: 12px 14px;
  border-radius: 14px;
  background: linear-gradient(135deg, #f8fbff, #f0fdfa);
  border: 1px solid var(--hub-line);
}

.detail-grid strong { color: var(--hub-navy); }

.phone-grid {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 10px;
}

/* ——— نافذة دخول الموقع ——— */
.site-login-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.site-login-modal.hidden { display: none !important; }
.site-login-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(4px);
}
.site-login-card {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  background: #fff;
  border-radius: 22px;
  padding: 22px 20px 18px;
  box-shadow: 0 28px 70px rgba(15, 23, 42, 0.28);
}
.site-login-card h2 { margin: 0 0 6px; font-size: 1.35rem; font-weight: 900; }
.site-login-sub { margin: 0 0 14px; color: #64748b; font-weight: 600; font-size: 0.92rem; }
.site-login-x {
  position: absolute; top: 10px; left: 12px; border: 0; background: transparent;
  font-size: 1.6rem; cursor: pointer; color: #64748b;
}
.site-login-card .field-label { display: block; font-weight: 800; margin: 0 0 6px; font-size: 13.5px; }
.site-login-card .field-input {
  width: 100%; padding: 12px 14px; border: 1.5px solid rgba(11, 95, 255, 0.18);
  border-radius: 12px; font: inherit; font-size: 16px; margin-bottom: 12px; box-sizing: border-box;
}
.site-login-foot { margin: 14px 0 0; font-size: 13.5px; font-weight: 700; text-align: center; }
body.login-modal-open { overflow: hidden; }

/* ——— تجاوب الجوال ——— */
@media (max-width: 860px) {
  .hub-body {
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .hub-auth {
    width: min(100% - 20px, 500px);
    margin: 16px auto 32px;
  }

  .signup-guide-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .signup-guide-actions .btn {
    width: 100%;
    min-height: 46px;
  }

  .hub-shell {
    grid-template-columns: 1fr;
    width: min(100% - 20px, 1180px);
    margin: 12px auto 118px;
    gap: 12px;
  }

  .hub-side {
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    top: auto;
    z-index: 45;
    display: flex;
    gap: 4px;
    justify-content: space-between;
    overflow: hidden;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px));
    border-radius: 22px 22px 0 0;
    border: 1px solid var(--hub-line);
    border-bottom: 0;
    box-shadow: 0 -12px 36px rgba(0, 45, 87, 0.14);
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(16px);
  }

  .hub-side button {
    flex: 1 1 0;
    width: auto;
    min-width: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    white-space: nowrap;
    text-align: center;
    font-size: 11px;
    font-weight: 800;
    padding: 8px 4px;
    border-radius: 16px;
    min-height: 56px;
  }

  .hub-nav-ico {
    display: block;
    font-size: 18px;
    line-height: 1;
  }

  .hub-nav-short { display: block; }
  .hub-nav-full { display: none; }

  .hub-side button.active {
    background: linear-gradient(135deg, var(--hub-navy), var(--hub-sky));
    color: #fff;
    box-shadow: 0 8px 18px rgba(11, 95, 255, 0.28);
  }

  .hub-top {
    padding: max(10px, env(safe-area-inset-top, 0px)) 12px 10px;
    gap: 8px;
  }

  .hub-brand {
    gap: 8px;
    min-width: 0;
  }

  .hub-brand img {
    width: 36px;
    height: 36px;
    border-radius: 10px;
  }

  .hub-top-links {
    gap: 8px;
    flex-wrap: nowrap;
  }

  .hub-top-links .site-auth-slot {
    gap: 8px;
    flex-wrap: nowrap;
  }

  .hub-body.is-authed .hub-top-links .auth-link--primary {
    display: none;
  }

  .hub-top-links .auth-hello {
    display: inline-block;
    max-width: min(38vw, 140px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0;
    font-size: 0.82rem;
  }

  .hub-top-links .auth-link,
  .hub-top-links .auth-btn,
  .hub-top-links a {
    padding: 7px 11px;
    font-size: 0.8rem;
    min-height: 36px;
    flex-shrink: 0;
  }

  .profile-banner {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .profile-banner .portal-actions {
    margin-top: 0;
  }

  .portal-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .portal-actions .btn {
    width: 100%;
    min-height: 44px;
    font-size: 13px;
  }

  .portal-actions .btn-primary {
    grid-column: 1 / -1;
  }

  .sub-status {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .sub-kpi {
    padding: 12px 12px 11px;
    border-radius: 16px;
  }

  .phone-grid {
    grid-template-columns: 1fr;
  }

  .auth-hero {
    border-radius: 20px;
    padding: 16px 16px 14px;
  }

  .auth-hero h1 {
    font-size: 1.28rem;
  }

  .hub-card {
    padding: 14px;
    border-radius: 18px;
  }

  .hub-card:hover {
    transform: none;
    box-shadow: var(--hub-shadow);
  }

  .hub-panel[data-panel="reports"] .hub-card:not(.rp-toolbar-card) h3 {
    font-size: 1rem;
  }

  .hub-panel[data-panel="reports"] .hub-card:not(.rp-toolbar-card) > .rp-lead {
    display: none;
  }

  .rp-toolbar-card {
    position: sticky;
    top: 58px;
    z-index: 30;
    margin-bottom: 10px;
    padding: 12px;
    box-shadow: 0 12px 32px rgba(0, 45, 87, 0.12);
  }

  .rp-head {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .rp-head .btn {
    width: 100%;
    min-height: 44px;
  }

  .rp-lead {
    font-size: 12.5px;
    line-height: 1.5;
  }

  .rp-source-row {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 8px;
    padding: 2px 2px 8px;
    margin-inline: -4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  .rp-chip {
    flex: 0 0 auto;
    width: auto;
    min-width: 112px;
    max-width: 170px;
    padding: 9px 12px;
    font-size: 12.5px;
    text-align: start;
    align-items: flex-start;
    min-height: 48px;
  }

  .rp-chip-sub {
    max-width: 146px;
  }

  .rp-source-banner {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 10px 12px;
    font-size: 12px;
    line-height: 1.45;
  }

  #rpMeta {
    word-break: break-word;
  }

  .rp-sub-nav {
    display: none;
  }

  .rp-sub-picker {
    display: block;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--hub-line);
  }

  .rp-sub-picker .field-label {
    margin-bottom: 6px;
    font-size: 12px;
  }

  .rp-sub-select {
    min-height: 46px;
    margin-bottom: 0;
  }

  .table-scroll {
    overflow: visible;
    border: 0;
    background: transparent;
  }

  .dev-table {
    min-width: 0;
  }

  .dev-table thead {
    display: none;
  }

  .dev-table tbody tr:not(.inv-detail) {
    display: block;
    margin-bottom: 10px;
    padding: 12px;
    border: 1px solid var(--hub-line);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 8px 20px rgba(0, 45, 87, 0.05);
  }

  .dev-table tbody tr.inv-detail {
    display: block;
    margin: -6px 0 10px;
    border: 1px solid var(--hub-line);
    border-radius: 0 0 16px 16px;
    border-top: 0;
    background: #f8fafc;
  }

  .dev-table tbody tr.inv-detail td {
    display: block;
    padding: 10px 12px 12px;
  }

  .dev-table tbody tr:not(.inv-detail):has(+ tr.inv-detail:not(.hidden)) {
    margin-bottom: 0;
    border-radius: 16px 16px 0 0;
  }

  .dev-table td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 7px 0;
    border-bottom: 1px dashed rgba(0, 64, 123, 0.08);
    text-align: end;
  }

  .dev-table td:last-child {
    border-bottom: 0;
    padding-bottom: 0;
    justify-content: stretch;
  }

  .dev-table td[data-label=""]:empty,
  .dev-table td:not([data-label]) {
    border-bottom: 0;
  }

  .dev-table td[data-label=""] .btn,
  .dev-table td:last-child .btn {
    width: 100%;
    min-height: 42px;
  }

  .dev-table td::before {
    content: attr(data-label);
    font-weight: 800;
    font-size: 12px;
    color: var(--hub-muted);
    text-align: start;
    flex: 0 0 auto;
    max-width: 46%;
  }

  .dev-table td[data-label=""]::before,
  .dev-table td:not([data-label])::before {
    content: none;
  }

  .dev-table tbody tr td[colspan] {
    display: block;
    text-align: center;
    border: 0;
    padding: 14px 8px;
    justify-content: center;
  }

  .dev-table tbody tr td[colspan]::before {
    content: none;
  }

  .inv-lines {
    font-size: 12px;
  }

  .inv-lines thead {
    display: none;
  }

  .inv-lines tbody tr {
    display: block;
    margin-bottom: 8px;
    padding: 8px;
    border-radius: 12px;
    background: #fff;
    border: 1px solid rgba(0, 64, 123, 0.08);
  }

  .inv-lines td {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 4px 0;
    border: 0;
  }

  .inv-lines td::before {
    content: attr(data-label);
    font-weight: 800;
    color: var(--hub-muted);
    font-size: 11px;
  }

  .rp-h {
    margin-top: 14px;
    margin-bottom: 8px;
    font-size: 0.9rem;
  }
}

@media (max-width: 420px) {
  .hub-brand span {
    display: none;
  }

  .hub-top-links .auth-hello {
    max-width: min(34vw, 120px);
  }

  .hub-side button {
    font-size: 10.5px;
    padding: 7px 2px;
    min-height: 54px;
  }

  .hub-nav-ico {
    font-size: 17px;
  }

  .hub-shell {
    width: min(100% - 14px, 1180px);
    margin-bottom: 122px;
  }

  .sub-kpi .v {
    font-size: 1.05rem;
  }

  .portal-actions {
    grid-template-columns: 1fr;
  }
}

.inv-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.inv-pdf-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  flex-direction: column;
  padding: 12px;
}
.inv-pdf-overlay.hidden { display: none; }
.inv-pdf-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  max-width: 820px;
  width: 100%;
  margin: 0 auto 10px;
  color: #fff;
  font-weight: 800;
}
.inv-pdf-toolbar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.inv-pdf-scroll {
  flex: 1;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.inv-pdf-sheet {
  width: min(210mm, 100%);
  margin: 0 auto 24px;
  background: #fff;
  color: #0f172a;
  border-radius: 8px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
  padding: 22px 24px 28px;
  font-family: Tajawal, sans-serif;
}
.inv-pdf-brand {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  border-bottom: 3px solid #00407b;
  padding-bottom: 14px;
  margin-bottom: 16px;
}
.inv-pdf-brand h2 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 900;
  color: #00407b;
}
.inv-pdf-brand .inv-pdf-doc {
  text-align: start;
}
.inv-pdf-kind {
  display: inline-block;
  background: #00407b;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 6px;
}
.inv-pdf-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 16px;
  margin-bottom: 16px;
  font-size: 14px;
  font-weight: 700;
}
.inv-pdf-meta span {
  color: #64748b;
  font-weight: 800;
  display: block;
  font-size: 12px;
}
.inv-pdf-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.inv-pdf-table th {
  background: #00407b;
  color: #fff;
  padding: 8px 6px;
  text-align: start;
  font-weight: 800;
}
.inv-pdf-table td {
  padding: 7px 6px;
  border-bottom: 1px solid #e2e8f0;
  text-align: start;
}
.inv-pdf-table tfoot td {
  font-weight: 900;
  border-bottom: none;
  padding-top: 12px;
}
.inv-pdf-foot {
  margin-top: 18px;
  font-size: 12px;
  color: #64748b;
  font-weight: 700;
  border-top: 1px dashed #cbd5e1;
  padding-top: 10px;
}

@media print {
  @page {
    size: A4;
    margin: 12mm;
  }
  body.inv-pdf-printing .hub-top,
  body.inv-pdf-printing .hub-auth,
  body.inv-pdf-printing .hub-shell,
  body.inv-pdf-printing .inv-pdf-toolbar {
    display: none !important;
  }
  body.inv-pdf-printing .inv-pdf-overlay {
    position: static;
    background: none;
    padding: 0;
    display: block;
  }
  body.inv-pdf-printing .inv-pdf-scroll {
    overflow: visible;
  }
  body.inv-pdf-printing .inv-pdf-sheet {
    box-shadow: none;
    width: 100%;
    margin: 0;
    padding: 0;
    border-radius: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hub-auth,
  .hub-shell,
  .hub-panel.is-open,
  .btn,
  .hub-card {
    animation: none !important;
    transition: none !important;
  }
}
