/*
 * payzy — the shell of the staff dashboard and the shop portal, and the
 * pieces of the staff overview (figures, charts). On payzy.css.
 *
 * After iPadOS: a light sidebar of app areas, grouped under plain labels,
 * the selected area filled with the tint; a translucent bar above the
 * content; content in white groups on the grey ground.
 */

body { background: var(--canvas); }

/* ── Frame ───────────────────────────────────────────────────────── */
.frame { display: grid; grid-template-columns: 260px minmax(0, 1fr); min-height: 100vh; }
.side { background: #F7F7FA; color: var(--text); position: relative; z-index: 30; border-inline-end: 1px solid var(--line); }
.side-inner { position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 16px 10px; display: flex; flex-direction: column; gap: 12px; scrollbar-width: thin; scrollbar-color: #C7C7CC transparent; }
.side-logo { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 10px 8px; }
.side-tag { font-size: 11px; font-weight: 600; color: var(--text-2); background: var(--gray-fill); padding: 2px 8px; border-radius: 6px; }

.side nav:not(.lang-switch) { display: flex; flex-direction: column; gap: 1px; }
.nav-group { margin: 14px 10px 4px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.side nav:not(.lang-switch) a { display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 6px 10px; border-radius: 8px; color: var(--text); font-weight: 500; font-size: 14px; }
.side nav:not(.lang-switch) a .ico { flex: none; color: var(--ui-violet); }
.side nav:not(.lang-switch) a:hover { background: var(--gray-fill-2); color: var(--text); }
.side nav:not(.lang-switch) a[aria-current="page"] { background: var(--ui-violet); color: var(--white); }
.side nav:not(.lang-switch) a[aria-current="page"] .ico { color: var(--white); }
.side nav:not(.lang-switch) a .count, .side nav:not(.lang-switch) a .badge { margin-inline-start: auto; min-width: 20px; padding: 0 6px; border-radius: 99px; background: transparent; color: var(--text-2); font-size: 13px; font-weight: 500; text-align: end; }
.side nav:not(.lang-switch) a[aria-current="page"] .count, .side nav:not(.lang-switch) a[aria-current="page"] .badge { color: var(--white); }
.side nav:not(.lang-switch) a .badge::before { display: none; }

.who { margin-top: auto; display: grid; gap: 10px; padding: 12px; border-radius: 12px; background: var(--surface); font-size: 13px; color: var(--text-2); }
.who-card { display: flex; align-items: center; gap: 10px; }
.who-card > span:last-child { display: grid; min-width: 0; }
.who-card strong { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.who-card .small { font-size: 12px; color: var(--text-2); }
.avatar { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: #E5E5EA; color: var(--text-2); font-weight: 600; font-size: 14px; }
.who-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.who-actions a { color: var(--ui-violet); }
.who form { margin: 0; }
.who button { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; color: var(--bad); font-weight: 600; font-size: 13px; min-height: 32px; }

.page { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px; padding: 10px 32px; background: rgba(242, 242, 247, .8); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-bottom: 1px solid var(--line); }
.icon-btn { all: unset; cursor: pointer; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 10px; color: var(--ui-violet); }
.icon-btn:hover { background: var(--gray-fill-2); }
.icon-btn:focus-visible { box-shadow: var(--focus); }
.search { position: relative; flex: 1; max-width: 520px; display: flex; align-items: center; }
.search .ico { position: absolute; inset-inline-start: 10px; color: var(--text-3); pointer-events: none; }
.search input { width: 100%; min-height: 36px; padding: 6px 36px; border-radius: 10px; border: 0; background: var(--gray-fill); font: inherit; font-size: 15px; }
.search input:focus { outline: none; box-shadow: var(--focus); }
.search kbd { position: absolute; inset-inline-end: 10px; font: 500 12px var(--font); color: var(--text-3); border: 1px solid #D1D1D6; border-radius: 5px; padding: 0 5px; }
.icon-btn.menu-btn { display: none; }
.topbar-who { margin-inline-start: auto; font-weight: 500; color: var(--text-2); font-size: 13px; }
.topbar-title { font-weight: 600; }
.topbar-cta { margin-inline-start: auto; min-height: 36px; padding-inline: 14px; font-size: 14px; }

.main { padding: 24px 32px 64px; display: grid; gap: 20px; align-content: start; max-width: 1280px; width: 100%; }
.page-head h1 { font-size: 30px; font-weight: 700; letter-spacing: -.02em; }
:lang(ar) .page-head h1 { letter-spacing: 0; }

.card.plain, .table-card { border: 0; box-shadow: none; }
.stat { background: var(--surface); border: 0; position: relative; }
.stat.attention { background: var(--warn-bg); }
.stat-ico { position: absolute; top: 14px; inset-inline-end: 14px; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--tint-soft); color: var(--ui-violet); }
.stat.attention .stat-ico { background: rgba(154, 77, 0, .12); color: var(--warn); }
table th { background: transparent; }
tbody tr:hover td { background: #FAFAFC; }

/* ── Overview ────────────────────────────────────────────────────── */
.section-title { font-size: 20px; font-weight: 700; margin-top: 6px; letter-spacing: -.01em; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 8px; }
/* A segmented control: a few views of the same thing. */
.segmented { display: inline-flex; padding: 2px; border-radius: 9px; background: var(--gray-fill); gap: 0; }
.segmented a { min-height: 32px; display: inline-flex; align-items: center; padding: 0 14px; border-radius: 7px; color: var(--text); font-weight: 500; font-size: 13px; }
.segmented a[aria-current="true"] { background: var(--white); font-weight: 600; box-shadow: 0 3px 8px rgba(0, 0, 0, .12), 0 3px 1px rgba(0, 0, 0, .04); }

.hero-card { display: grid; grid-template-columns: minmax(220px, .8fr) 2fr; gap: 24px; align-items: center; padding: 20px; border-radius: var(--r-card); background: var(--surface); }
.hero-card .label, .kpi .label, .health .label { font-size: 13px; font-weight: 500; color: var(--text-2); display: block; }
.hero-value { display: block; font-size: clamp(28px, 2.6vw, 38px); font-weight: 700; letter-spacing: -.02em; margin: 4px 0; white-space: nowrap; }
.hero-chart { min-width: 0; }
.delta { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; }
.delta.up { color: var(--ok); }
.delta.down { color: var(--bad); }
.delta.neutral { color: var(--text-2); font-weight: 500; }
.kpi { gap: 4px; }
.kpi .value { font-size: clamp(19px, 1.7vw, 24px); font-weight: 700; letter-spacing: -.01em; white-space: nowrap; }
.stat:has(.stat-ico) .label { padding-inline-end: 40px; }
.kpi .spark { margin-top: 4px; }

.chart { display: block; width: 100%; height: auto; overflow: visible; }
.chart .tick { font: 500 11px var(--font); fill: var(--text-3); }
.chart .mk { cursor: crosshair; }
.chart .mk:hover path { filter: brightness(1.1); }
.chart-card { gap: 10px; }
.chart-tip { position: fixed; z-index: 100; pointer-events: none; padding: 6px 10px; border-radius: 8px; background: rgba(255, 255, 255, .96); color: var(--text); font-size: 13px; font-weight: 600; white-space: nowrap; box-shadow: var(--shadow-pop); transform: translate(-50%, calc(-100% - 10px)); }
.chart-tip[hidden] { display: none; }

.health { display: grid; gap: 18px; }
.health .value { font-size: 24px; font-weight: 700; display: block; }
.meter { display: block; height: 6px; border-radius: 99px; background: #E5E5EA; overflow: hidden; margin-top: 8px; }
.meter i { display: block; height: 100%; border-radius: inherit; }
.meter i.ok { background: #34C759; } .meter i.warn { background: #FF9500; } .meter i.bad { background: #FF3B30; }

.hbars, .leaders { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.hbars li { display: grid; grid-template-columns: 110px 1fr 70px; align-items: center; gap: 12px; }
.hbar-label { font-size: 13px; font-weight: 500; color: var(--text-2); }
.hbar-track { display: block; height: 12px; border-radius: 0 4px 4px 0; background: #F2F2F7; overflow: hidden; }
[dir="rtl"] .hbar-track { border-radius: 4px 0 0 4px; }
.hbar-track i { display: block; height: 100%; border-radius: inherit; background: var(--ui-violet); min-width: 2px; }
.hbar-value { text-align: end; font-weight: 600; font-size: 13px; }
.leaders li { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto; gap: 4px 12px; }
.leader-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leaders .hbar-track { grid-column: 1 / -1; height: 6px; }
.leader-value { font-weight: 600; grid-row: 1; grid-column: 2; }
.steps-line { margin: 0; padding-inline-start: 20px; display: grid; gap: 6px; color: var(--text-2); }

/* ── Phone and tablet ────────────────────────────────────────────── */
@media (max-width: 960px) {
  .frame { grid-template-columns: 1fr; }
  .side { position: fixed; inset-block: 0; inset-inline-start: 0; width: 290px; transform: translateX(-100%); transition: transform .25s cubic-bezier(.2, .8, .2, 1); box-shadow: var(--shadow-pop); }
  [dir="rtl"] .side { transform: translateX(100%); }
  .frame.menu-open .side { transform: none; }
  .frame.menu-open::after { content: ''; position: fixed; inset: 0; background: rgba(0, 0, 0, .2); z-index: 25; }
  .icon-btn.menu-btn { display: grid; }
  .topbar { padding: 6px 12px; gap: 8px; }
  .topbar-who { display: none; }
  .search kbd { display: none; }
  .main { padding: 16px 16px 48px; }
  .hero-card { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .page-head h1 { font-size: 28px; }
}
@media (max-width: 520px) {
  .chart .tick { display: none; }
  .grid-4 { grid-template-columns: 1fr; }
  .hero-value { font-size: 30px; }
  .topbar-cta span, .topbar-title { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .side, a.stat, .side nav:not(.lang-switch) a { transition: none; }
}

/* ── Settings, roles ─────────────────────────────────────────────── */
.tabs-nav { justify-self: start; }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.settings-grid .field label { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.switch { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 600; }
.switch input { width: 20px; height: 20px; accent-color: var(--ui-violet); }
.account-row { background: var(--surface); border-radius: var(--r-card); padding: 4px 16px; }
.account-row[open] { padding-bottom: 16px; }
.account-row summary { display: grid; grid-template-columns: auto 1fr auto auto; gap: 14px; align-items: center; padding: 12px 0; cursor: pointer; list-style: none; }
.account-row summary::-webkit-details-marker { display: none; }
.account-ico { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; background: var(--tint-soft); color: var(--ui-violet); }
.account-main { display: grid; }
.account-number { font-weight: 700; letter-spacing: .02em; }
.account-row form { margin-top: 12px; }
.roles-grid { display: grid; gap: 14px; }
.role-card summary { display: flex; justify-content: space-between; align-items: center; gap: 12px; cursor: pointer; list-style: none; flex-wrap: wrap; }
.role-card summary::-webkit-details-marker { display: none; }
.role-title { display: inline-flex; align-items: center; gap: 10px; font-size: 17px; }
.perm-groups { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.perm-group { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin: 0; display: grid; gap: 6px; align-content: start; }
.perm-group legend { font-size: 12px; font-weight: 600; color: var(--text-2); padding: 0 6px; }
:lang(ar) .perm-group legend { letter-spacing: 0; font-size: 13px; }
.perm { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; }
.perm input { margin-top: 3px; accent-color: var(--ui-violet); }
@media (max-width: 960px) {
  .settings-grid, .perm-groups { grid-template-columns: 1fr; }
  .account-row summary { grid-template-columns: auto 1fr; }
}
