/* MAPEX Hub skin, continued from the previous part (the 800-line rule); load order matters. */

/* As in the MAPEX Hub logo: the name strong, «هوب» in the lighter weight. */
.mx-splash__name > span {
  font-weight: 400;
  color: var(--ink-soft);
}

.mx-splash__name {
  font-size: 2.1rem;
  white-space: nowrap;
  animation: mx-write 620ms var(--mx-ease) 620ms both;
}

@keyframes mx-write {
  from {
    opacity: 0;
    clip-path: inset(0 0 0 100%);
    transform: translateX(10px);
  }
  to {
    opacity: 1;
    clip-path: inset(0 0 0 0);
    transform: none;
  }
}

html[dir='ltr'] .mx-splash__name {
  animation-name: mx-write-ltr;
}

@keyframes mx-write-ltr {
  from {
    opacity: 0;
    clip-path: inset(0 100% 0 0);
    transform: translateX(-10px);
  }
  to {
    opacity: 1;
    clip-path: inset(0 0 0 0);
    transform: none;
  }
}

/* The in-page loader carries the same lockup, smaller. */
.view:empty {
  grid-auto-flow: column;
  justify-content: center;
  align-items: center;
  gap: 0.7rem;
}

.view:empty::after {
  content: 'مابيكس هوب';
  font-size: 1.45rem;
  animation: mx-write 560ms var(--mx-ease) 760ms both;
}

@media (prefers-reduced-motion: reduce) {
  .mx-splash__name,
  .view:empty::after {
    animation: none;
  }
}

@keyframes mx-shimmer {
  0% {
    opacity: 1;
    background-position: -400px 0;
  }
  100% {
    opacity: 1;
    background-position: 400px 0;
  }
}

/* A fresh screen settles in rather than snapping. */
.view > :first-child {
  animation: mx-rise 220ms var(--mx-ease) both;
}

@keyframes mx-rise {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ===================================================================== cards */

.cards {
  gap: 0.75rem;
  background: none;
  border: 0;
}

.card {
  border: 1px solid var(--rule);
  border-radius: var(--mx-radius-lg);
  box-shadow: var(--mx-shadow-xs);
  padding: 1rem 1.15rem;
}

.card__label {
  font-size: 0.76rem;
  font-weight: 500;
  letter-spacing: 0;
}

.card__value {
  font-family: var(--mono);
  font-weight: 650;
  font-size: 1.45rem;
  letter-spacing: -0.01em;
}

.band {
  background: var(--mx-primary-soft);
  color: var(--ink);
  border: 1px solid var(--mx-primary-tint);
  border-radius: var(--mx-radius-lg);
  margin-block-end: 0.75rem;
}

.band .card__label {
  color: var(--mx-primary);
  font-weight: 600;
}

.band .card__note {
  color: var(--ink-soft);
}

.meter {
  border-radius: 999px;
  background: var(--mx-surface-2);
}

.meter > span {
  border-radius: inherit;
  background: var(--mx-primary);
}

.plan-grid .is-current {
  background: var(--mx-primary-soft);
}

.checks {
  border-radius: var(--mx-radius);
}

/* ==================================================================== tables */

.toolbar {
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-block-end: 0;
  border-start-start-radius: var(--mx-radius-lg);
  border-start-end-radius: var(--mx-radius-lg);
  padding: 0.85rem 1rem;
}

.field__label {
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--ink-soft);
}

.scroll-x {
  border: 1px solid var(--rule);
  border-radius: var(--mx-radius-lg);
  background: var(--paper-raised);
  box-shadow: var(--mx-shadow-xs);
  /*
   * A table scrolls WITH the page, never in a frame of its own: a frame that
   * holds the scroll swallowed two-finger trackpad scrolling, so the page
   * looked stuck (owner, 22 Oct 2026). Sideways scrolling stays for narrow
   * screens; on a desktop the header sticks under the top bar instead.
   */
  overflow-x: auto;
}

@media (min-width: 1001px) {
  .scroll-x {
    overflow: visible;
  }

  .scroll-x .sheet thead th {
    inset-block-start: var(--topbar-h);
  }
}

.toolbar + .scroll-x {
  border-start-start-radius: 0;
  border-start-end-radius: 0;
}

.scroll-x:has(+ .pager) {
  border-end-start-radius: 0;
  border-end-end-radius: 0;
}

.sheet {
  font-size: 0.87rem;
}

.sheet th,
.sheet td {
  padding: 0.62rem 0.9rem;
  border-block-end: 1px solid var(--rule);
}

.sheet thead th {
  background: var(--mx-head);
  color: var(--ink-soft);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0;
  border-block-end: 1px solid var(--rule-strong);
  z-index: 1;
}

.sheet thead th button:hover {
  color: var(--mx-primary);
}

.sheet tbody tr {
  transition: background-color 80ms ease;
}

.sheet tbody tr:hover {
  background: var(--mx-primary-soft);
}

tr.is-clickable:active {
  background: var(--mx-primary-tint);
}

.sheet tfoot td {
  background: var(--mx-head);
  border-block-start: 1px solid var(--rule-strong);
  font-weight: 700;
}

.sheet caption {
  border-block-start: 1px solid var(--rule);
}

.num,
.card__value,
.sheet--form input.num {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum', 'cv11';
}

/* An identifier in Latin digits is monospaced; an Arabic word in the same cell keeps its joined script. */
.code {
  font-family: var(--mx-code), var(--sans);
  letter-spacing: 0;
  font-size: 0.84em;
  color: var(--ink-faint);
}

.pager {
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-block-start: 0;
  border-end-start-radius: var(--mx-radius-lg);
  border-end-end-radius: var(--mx-radius-lg);
  padding: 0.6rem 1rem;
}

/* ==================================================================== states */

.flag {
  border: 0;
  border-radius: 999px;
  padding: 0.12rem 0.6rem;
  font-size: 0.74rem;
  font-weight: 600;
  background: color-mix(in oklab, currentColor 11%, transparent);
}

.tag {
  border-color: var(--rule);
  background: var(--paper-raised);
}

.tag--muted {
  background: var(--mx-surface-2);
  border-color: transparent;
}

.banner,
.notice,
.notice--warn,
.notice--good,
.notice-row,
.position__gap {
  border-width: 1px;
  border-inline-start-width: 1px;
  border-radius: 10px;
}

.banner {
  border: 1px solid color-mix(in oklab, var(--bad) 30%, var(--rule));
  background: color-mix(in oklab, var(--bad) 7%, var(--paper-raised));
}

.notice--warn {
  border-color: color-mix(in oklab, var(--warn) 40%, var(--rule));
  background: color-mix(in oklab, var(--warn) 7%, var(--paper-raised));
}

.state {
  border: 1px dashed var(--rule-strong);
  border-radius: var(--mx-radius-lg);
  background: var(--paper-raised);
  padding: 2.75rem 1.5rem;
}

.state__title {
  font-size: 1rem;
  font-weight: 600;
}

.state__icon {
  opacity: 0.35;
}

.state--denied,
.state--error,
.state--absent {
  border-style: solid;
  border-inline-start-width: 1px;
}

.state--denied {
  border-color: color-mix(in oklab, var(--warn) 40%, var(--rule));
  background: color-mix(in oklab, var(--warn) 5%, var(--paper-raised));
}

.state--error {
  border-color: color-mix(in oklab, var(--bad) 40%, var(--rule));
  background: color-mix(in oklab, var(--bad) 5%, var(--paper-raised));
}

.state--absent {
  border-color: color-mix(in oklab, var(--absent) 40%, var(--rule));
  background: color-mix(in oklab, var(--absent) 5%, var(--paper-raised));
}

.skeleton__row {
  border-radius: 6px;
  background: linear-gradient(
    90deg,
    var(--mx-surface-2) 25%,
    var(--paper-raised) 50%,
    var(--mx-surface-2) 75%
  );
  background-size: 200% 100%;
}

/* The company-setup checklist: a missing item is a row with a red flag, not a red rail. */
.setup__row--missing {
  border-inline-start: 0;
  padding-inline-start: 0;
}

/* A status pill keeps the width of its word inside a grid cell. */
.setup__what > .flag,
.setup__what > .tag {
  justify-self: start;
}

.sidebar__foot .btn {
  border-color: var(--rule);
}

.period,
.request,
.self-approval-dialog,
.role-inert {
  border-inline-start-width: 1px;
}

.period {
  border-radius: 10px;
  position: relative;
  padding-inline-start: 1.6rem;
}

.period::before {
  content: '';
  position: absolute;
  inset-inline-start: 0.7rem;
  inset-block-start: 1rem;
  inline-size: 0.45rem;
  block-size: 0.45rem;
  border-radius: 50%;
  background: var(--ink-faint);
}

.period--open::before {
  background: var(--good);
}

.period--soft_closed::before {
  background: var(--gold);
}

.period--closed::before {
  background: var(--warn);
}

.period--locked::before {
  background: var(--bad);
}

.request {
  border-radius: var(--mx-radius-lg);
  border-color: color-mix(in oklab, var(--warn) 35%, var(--rule));
}

.tax-code,
.reg,
.position__card,
.detail,
.login,
.self-approval-dialog {
  border-radius: var(--mx-radius-lg);
}

.position__card {
  border: 1px solid var(--mx-primary-tint);
  background: var(--mx-primary-soft);
}

.tax-code__rate {
  color: var(--mx-primary);
}

.rate-history__item {
  border-radius: 6px;
}

/* ================================================================== controls */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  position: relative;
  min-block-size: 2.25rem;
  padding: 0.42rem 0.95rem;
  border: 1px solid var(--rule-strong);
  border-radius: var(--mx-radius);
  background: var(--paper-raised);
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 500;
  line-height: 1.3;
  text-decoration: none;
  box-shadow: var(--mx-shadow-xs);
  transition:
    background-color 120ms ease,
    border-color 120ms ease,
    color 120ms ease,
    box-shadow 120ms ease,
    transform 120ms var(--mx-ease);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.btn:hover,
.btn:focus-visible {
  background: var(--mx-surface-2);
  border-color: var(--rule-strong);
  color: var(--ink);
}

.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--mx-ring);
}

/* The press answers before the network does. */
.btn:active:not(:disabled),
.icon-btn:active:not(:disabled),
.topbar__toggle:active {
  transform: scale(0.97);
}

.btn--primary {
  background: var(--mx-primary);
  border-color: var(--mx-primary);
  color: var(--mx-on-primary);
  font-weight: 600;
  box-shadow: 0 1px 2px rgb(36 71 224 / 0.25);
}

.btn--primary:hover:not(:disabled),
.btn--primary:focus-visible:not(:disabled) {
  background: var(--mx-primary-hover);
  border-color: var(--mx-primary-hover);
  color: var(--mx-on-primary);
}

.btn--primary:active:not(:disabled) {
  background: var(--mx-primary-press);
  border-color: var(--mx-primary-press);
}

.btn--ghost {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: var(--ink-soft);
}

.btn--ghost:hover,
.btn--ghost:focus-visible {
  background: var(--mx-surface-2);
  border-color: transparent;
  color: var(--ink);
}

.btn--danger {
  border-color: color-mix(in oklab, var(--bad) 40%, var(--rule));
  color: var(--bad);
}

.btn--danger:hover:not(:disabled),
.btn--danger:focus-visible:not(:disabled) {
  background: var(--bad);
  border-color: var(--bad);
  color: #fff;
}

.btn:disabled {
  opacity: 0.5;
  box-shadow: none;
}

/* Busy: the pressed button keeps its size and shows it is working. */
.btn[data-busy],
.btn[data-busy]:disabled {
  opacity: 1;
  color: transparent !important;
  cursor: progress;
}

.btn[data-busy]::after {
  content: '';
  position: absolute;
  inset: 0;
  margin: auto;
  inline-size: 1rem;
  block-size: 1rem;
  border-radius: 50%;
  border: 2px solid var(--ink-faint);
  border-block-start-color: transparent;
  animation: mx-spin 600ms linear infinite;
}

.btn--primary[data-busy]::after {
  border-color: rgb(255 255 255 / 0.9);
  border-block-start-color: transparent;
}

@keyframes mx-spin {
  to {
    transform: rotate(360deg);
  }
}

.icon-btn {
  border-radius: var(--mx-radius);
  transition:
    background-color 120ms ease,
    color 120ms ease,
    transform 120ms var(--mx-ease);
}

.icon-btn:hover:not(:disabled),
.icon-btn:focus-visible:not(:disabled) {
  background: var(--mx-surface-2);
  border-color: transparent;
}

.detail {
  border: 1px solid var(--rule);
}

.scrim,
.self-approval-overlay {
  background: var(--mx-scrim);
}

.self-approval-dialog,
dialog {
  box-shadow: var(--mx-shadow-lg);
  border: 1px solid var(--rule);
}

dialog {
  border-radius: var(--mx-radius-lg);
  background: var(--paper-raised);
  color: var(--ink);
  padding: 1.25rem 1.4rem;
}

dialog::backdrop {
  background: var(--mx-scrim);
}

/* ===================================================================== forms */

.grid-fields > label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--ink-soft);
  letter-spacing: 0;
}

.grid-fields input,
.grid-fields select,
.grid-fields textarea,
.sheet--form input,
.sheet--form select,
.dialog input,
.dialog textarea,
.decide__note textarea,
.self-approval-dialog textarea,
textarea {
  font: inherit;
  font-size: 0.88rem;
  color: var(--ink);
  background: var(--paper-raised);
  border: 1px solid var(--rule-strong);
  border-radius: var(--mx-radius);
  padding: 0.5rem 0.7rem;
  transition:
    border-color 120ms ease,
    box-shadow 120ms ease;
}

.grid-fields input:hover,
.grid-fields select:hover,
.sheet--form input:hover,
.sheet--form select:hover {
  border-color: var(--ink-faint);
}

.grid-fields input:focus-visible,
.grid-fields select:focus-visible,
.grid-fields textarea:focus-visible,
.sheet--form input:focus-visible,
.sheet--form select:focus-visible,
textarea:focus-visible {
  outline: none;
  border-color: var(--mx-primary);
  box-shadow: 0 0 0 3px var(--mx-ring);
}

.grid-fields input[readonly] {
  background: var(--mx-surface-2);
}

.grid-fields input::placeholder,
.search__input::placeholder,
textarea::placeholder {
  color: var(--ink-faint);
  opacity: 1;
}

input[aria-invalid='true'],
select[aria-invalid='true'] {
  border-color: var(--bad) !important;
}

/* ================================================== the top progress line */
/* Drawn by feel.js while a screen loads: the click is answered at once. */

.mx-progress {
  position: fixed;
  inset-block-start: 0;
  inset-inline: 0;
  block-size: 2px;
  z-index: 100;
  pointer-events: none;
  background: var(--mx-primary);
  transform-origin: right;
  transform: scaleX(0);
  opacity: 0;
}

html[dir='ltr'] .mx-progress {
  transform-origin: left;
}

.mx-progress.is-on {
  opacity: 1;
  transform: scaleX(0.8);
  transition:
    transform 2.4s cubic-bezier(0.1, 0.7, 0.2, 1),
    opacity 80ms linear;
}

.mx-progress.is-done {
  opacity: 0;
  transform: scaleX(1);
  transition:
    transform 160ms var(--mx-ease),
    opacity 260ms ease 140ms;
}

/* ================================================================ responsive */

@media (max-width: 1000px) {
  .sidebar {
    box-shadow: var(--mx-shadow-lg);
    transition: transform 220ms var(--mx-ease);
  }

  .search__input {
    inline-size: 9rem;
  }
}

@media (max-width: 620px) {
  /* On a phone a ledger scrolls sideways; its words do not stack letter by letter. */
  .sheet th,
  .sheet td {
    white-space: nowrap;
    padding: 0.55rem 0.75rem;
  }

  .scroll-x {
    max-block-size: none;
  }

  .search__input {
    inline-size: 7.5rem;
  }

  .page__head {
    align-items: flex-start;
  }
}
