/* ═══════════════════════════════════════════════════════════════════════════════════════════════
 * OWNER PORTAL — presentation only.
 *
 * Every colour, space, radius and type size is an existing --qtr-* token. Nothing here invents a
 * palette: the portal has to look like Quatron, not like a second product that happens to share a
 * login. What IS different is density — an owner reads a handful of figures and leaves, so the
 * cards are larger and the chrome is quieter than the internal console.
 *
 * RTL IS THE DEFAULT, not an override. The shell is Arabic-first, so the layout uses logical
 * properties (inline-start/end, margin-inline) and never left/right. Switching to English changes
 * `dir` on <html> and nothing in this file has to know.
 * ═══════════════════════════════════════════════════════════════════════════════════════════════ */

.po-shell { display: grid; grid-template-columns: 264px 1fr; gap: var(--qtr-space-5);
            align-items: start; min-height: 60vh; }
.po-nav { position: sticky; top: var(--qtr-space-4); display: flex; flex-direction: column;
          gap: 2px; padding: var(--qtr-space-3); background: var(--qtr-surface);
          border: 1px solid var(--qtr-border); border-radius: 14px; }
.po-nav__title { font-size: var(--qtr-font-size-xs); color: var(--qtr-muted-text);
                 font-weight: var(--qtr-weight-semibold); padding: var(--qtr-space-2) var(--qtr-space-3);
                 letter-spacing: .02em; }
.po-nav__item { display: flex; align-items: center; gap: var(--qtr-space-3);
                padding: 10px var(--qtr-space-3); border-radius: 10px; cursor: pointer;
                color: var(--qtr-text); font-size: var(--qtr-font-size-sm);
                border: 1px solid transparent; background: none; width: 100%;
                text-align: inherit; font-family: inherit;
                transition: background var(--qtr-motion-fast) var(--qtr-motion-curve); }
.po-nav__item:hover { background: var(--qtr-surface-soft); }
.po-nav__item:focus-visible { outline: 2px solid var(--qtr-accent); outline-offset: 2px; }
.po-nav__item[aria-current="page"] { background: var(--qtr-accent-soft); color: var(--qtr-ink-strong);
                                     font-weight: var(--qtr-weight-semibold); }
.po-nav__item i, .po-nav__item svg { width: 18px; height: 18px; flex: none; }
.po-nav__badge { margin-inline-start: auto; font-size: var(--qtr-font-size-xs);
                 background: var(--qtr-accent); color: var(--qtr-on-accent);
                 border-radius: 999px; padding: 1px 8px; }

.po-main { min-width: 0; }
.po-head { display: flex; flex-wrap: wrap; gap: var(--qtr-space-3); align-items: center;
           justify-content: space-between; margin-bottom: var(--qtr-space-4); }
.po-head__title { font-size: var(--qtr-font-size-xl); font-weight: var(--qtr-weight-semibold);
                  color: var(--qtr-ink-strong); margin: 0; }
.po-head__sub { font-size: var(--qtr-font-size-sm); color: var(--qtr-text-secondary); margin: 2px 0 0; }
/* THE `max-width:100%` BELOW COULD NEVER FIRE, AND THE SCOPE PICKER TOOK THE PAGE WITH IT.
   MEASURED at 375px in ENGLISH, signed in as a Platform Owner: the document is 387px against a
   375px viewport on every administration route, and the page really scrolls those 12px. Arabic is
   clean at exactly 375.

   The whole 12px is one control. A Platform Owner owns every company, so the scope picker offers
   the aggregate option, and in English that option reads "All permitted companies — currencies
   kept separate" — 327px of text, against 163px for the widest company row and far less for the
   Arabic "كل الشركات المصرّح بها — العملات منفصلة". A <select> is as wide as its longest option and
   never wraps, so the control wants 373px inside a 347px column and its right edge lands at 387.

   `max-width:100%` was the author asking for exactly the right thing, and it never got a chance.
   A percentage max-width resolves against the containing block, and .po-scope is sized BY this
   select — a cycle, so the percentage is ignored while the intrinsic width is computed. Worse,
   both boxes default to min-width:auto: .po-scope is a flex item of .po-head and the select is a
   flex item of .po-scope, and neither may become narrower than its content. A cap that resolves
   against a container which cannot shrink is not a cap.

   Letting the chain shrink is what makes the existing `max-width:100%` mean something: the select
   caps at the column, and the closed control truncates the aggregate label rather than the page
   growing. Every option still reads in full in the open dropdown, which is where it is chosen.
   The same family as the min-width:auto overflows recorded in platform-harmony.css; this is the
   one the Owner Portal owns. */
.po-scope { display: flex; gap: var(--qtr-space-2); align-items: center; flex-wrap: wrap;
            min-width: 0; }
.po-scope select { min-height: var(--qtr-control-height); border-radius: 10px;
                   border: 1px solid var(--qtr-border); background: var(--qtr-surface);
                   color: var(--qtr-text); padding: 0 var(--qtr-space-3); font-family: inherit;
                   font-size: var(--qtr-font-size-sm); max-width: 100%; min-width: 0; }
.po-scope select:focus-visible { outline: 2px solid var(--qtr-accent); outline-offset: 1px; }

/* KPI cards. A figure with no scope, period, currency and basis is a rumour, so the card has a
   fixed slot for each and the markup cannot omit them. */
.po-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
           gap: var(--qtr-space-3); }
.po-kpi { background: var(--qtr-surface); border: 1px solid var(--qtr-border); border-radius: 14px;
          padding: var(--qtr-space-4); display: flex; flex-direction: column; gap: 6px; }
.po-kpi__label { font-size: var(--qtr-font-size-sm); color: var(--qtr-text-secondary); }
.po-kpi__value { font-size: var(--qtr-font-size-2xl); font-weight: var(--qtr-weight-semibold);
                 color: var(--qtr-ink-strong); line-height: 1.15; font-variant-numeric: tabular-nums; }
.po-kpi__row { display: flex; justify-content: space-between; gap: var(--qtr-space-2);
               font-variant-numeric: tabular-nums; font-size: var(--qtr-font-size-md);
               color: var(--qtr-ink-strong); font-weight: var(--qtr-weight-medium); }
.po-kpi__ccy { color: var(--qtr-muted-text); font-size: var(--qtr-font-size-xs);
               font-weight: var(--qtr-weight-semibold); }
.po-kpi__meta { font-size: var(--qtr-font-size-xs); color: var(--qtr-muted-text); margin-top: auto;
                padding-top: var(--qtr-space-2); border-top: 1px dashed var(--qtr-line); }
.po-kpi__basis { font-size: var(--qtr-font-size-xs); color: var(--qtr-text-secondary); }

.po-card { background: var(--qtr-surface); border: 1px solid var(--qtr-border);
           border-radius: 14px; padding: var(--qtr-space-4); margin-bottom: var(--qtr-space-4); }
.po-card__title { font-size: var(--qtr-font-size-md); font-weight: var(--qtr-weight-semibold);
                  color: var(--qtr-ink-strong); margin: 0 0 var(--qtr-space-3); }

.po-toolbar { display: flex; flex-wrap: wrap; gap: var(--qtr-space-2); margin-bottom: var(--qtr-space-3); }
.po-toolbar input[type="search"], .po-toolbar select {
  min-height: var(--qtr-control-height); border-radius: 10px; border: 1px solid var(--qtr-border);
  background: var(--qtr-surface); color: var(--qtr-text); padding: 0 var(--qtr-space-3);
  font-family: inherit; font-size: var(--qtr-font-size-sm); }
.po-toolbar input[type="search"] { flex: 1 1 220px; }
.po-toolbar input:focus-visible, .po-toolbar select:focus-visible {
  outline: 2px solid var(--qtr-accent); outline-offset: 1px; }

/* Tables scroll inside their own box; the page itself must never scroll sideways. */
.po-tablewrap { overflow-x: auto; }
.po-table { width: 100%; border-collapse: collapse; font-size: var(--qtr-font-size-sm); }
.po-table th, .po-table td { padding: 10px var(--qtr-space-3); text-align: start;
                             border-bottom: 1px solid var(--qtr-line); }
.po-table th { color: var(--qtr-muted-text); font-weight: var(--qtr-weight-semibold);
               font-size: var(--qtr-font-size-xs); white-space: nowrap; }
.po-table td.po-num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.po-table tbody tr:hover { background: var(--qtr-surface-soft); }

.po-pill { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px;
           padding: 2px 10px; font-size: var(--qtr-font-size-xs); font-weight: var(--qtr-weight-medium); }
.po-pill--ok   { background: var(--qtr-success-soft); color: var(--qtr-success-text); }
.po-pill--warn { background: var(--qtr-warning-soft); color: var(--qtr-warning-text); }
.po-pill--bad  { background: var(--qtr-danger-soft);  color: var(--qtr-danger-text); }
.po-pill--info { background: var(--qtr-info-soft);    color: var(--qtr-info-text); }

.po-state { text-align: center; padding: var(--qtr-space-6) var(--qtr-space-4);
            color: var(--qtr-text-secondary); }
.po-state__title { font-size: var(--qtr-font-size-md); color: var(--qtr-ink-strong);
                   font-weight: var(--qtr-weight-semibold); margin: 0 0 6px; }
.po-state__body { font-size: var(--qtr-font-size-sm); margin: 0 auto; max-width: 46ch; line-height: 1.6; }
.po-state i, .po-state svg { width: 30px; height: 30px; color: var(--qtr-muted-text);
                             margin-bottom: var(--qtr-space-3); }

.po-btn { min-height: var(--qtr-control-height); border-radius: 10px; padding: 0 var(--qtr-space-4);
          border: 1px solid var(--qtr-border); background: var(--qtr-surface); color: var(--qtr-text);
          font-family: inherit; font-size: var(--qtr-font-size-sm); cursor: pointer; }
.po-btn:hover { background: var(--qtr-surface-soft); }
.po-btn:focus-visible { outline: 2px solid var(--qtr-accent); outline-offset: 2px; }
.po-btn--primary { background: var(--qtr-accent); color: var(--qtr-on-accent); border-color: transparent; }
.po-btn--danger  { background: var(--qtr-danger);  color: var(--qtr-white);    border-color: transparent; }
.po-btn[disabled] { opacity: .55; cursor: not-allowed; }

.po-scopebanner { display: flex; align-items: center; gap: var(--qtr-space-3);
                  padding: 10px var(--qtr-space-4); border-radius: 12px;
                  background: var(--qtr-info-soft); color: var(--qtr-info-text);
                  font-size: var(--qtr-font-size-sm); font-weight: var(--qtr-weight-medium);
                  margin-bottom: var(--qtr-space-4); flex-wrap: wrap; }
.po-scopebanner--global { background: var(--qtr-accent-soft); color: var(--qtr-ink-strong); }
.po-scopebanner i, .po-scopebanner svg { width: 18px; height: 18px; flex: none; }
.po-scopebanner__exit { margin-inline-start: auto; color: inherit; text-decoration: underline;
                        font-weight: var(--qtr-weight-regular); }
.po-scopebanner__exit:focus-visible { outline: 2px solid var(--qtr-accent); outline-offset: 2px; }

.po-boot { padding: var(--qtr-space-6) var(--qtr-space-4); text-align: center;
            color: var(--qtr-text-secondary); font-size: var(--qtr-font-size-sm); }

.po-placeholder { background: var(--qtr-surface); border: 1px solid var(--qtr-border);
                  border-radius: 14px; padding: var(--qtr-space-4);
                  display: flex; flex-direction: column; gap: 8px; }

.po-skel { background: linear-gradient(90deg, var(--qtr-surface-soft), var(--qtr-page-soft), var(--qtr-surface-soft));
           background-size: 200% 100%; animation: po-shimmer 1.1s linear infinite;
           border-radius: 8px; height: 14px; }
@keyframes po-shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .po-skel { animation: none; } }

/* Mobile: the sidebar becomes a horizontal rail, and every table gets a card presentation
   through data-label rather than being left to overflow. */
@media (max-width: 900px) {
  .po-shell { grid-template-columns: 1fr; }
  .po-nav { position: static; flex-direction: row; overflow-x: auto; gap: var(--qtr-space-2); }
  .po-nav__title { display: none; }
  .po-nav__item { white-space: nowrap; width: auto; }
  .po-kpis { grid-template-columns: 1fr; }
  /* The stacked-card table hides its header rather than removing it, so each cell can still carry
     its label through `data-label`. The recipe was incomplete: position/width/height/clip without
     resetting padding, margin or border leaves the header cells contributing their natural width.
     Under RTL that overflow runs leftward and costs nothing; under LTR it runs rightward and grew
     the document to 387px in a 375px viewport — a horizontal scrollbar on the English cockpit and
     not the Arabic one. This is the same recipe `.po-sr` already uses successfully below, plus
     `clip-path`, which unlike the deprecated `clip` is honoured for layout as well as paint. */
  .po-table thead { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
                    overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%);
                    white-space: nowrap; border: 0; }
  .po-table tr { display: block; border: 1px solid var(--qtr-border); border-radius: 12px;
                 padding: var(--qtr-space-3); margin-bottom: var(--qtr-space-3); }
  .po-table td { display: flex; justify-content: space-between; gap: var(--qtr-space-3);
                 border: 0; padding: 5px 0; text-align: end; }
  .po-table td::before { content: attr(data-label); color: var(--qtr-muted-text);
                         font-size: var(--qtr-font-size-xs); text-align: start; flex: none; }
}

.po-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
         overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ═══════════════════════════════════════════════════════════════════════════════════════════════
 * PLATFORM OWNER ADMINISTRATION
 *
 * Same tokens, same density, one deliberate difference: the administration group is separated in
 * the sidebar and its destructive actions are visually distinct. Reading a business and suspending
 * a customer must not look like neighbouring tabs.
 * ═══════════════════════════════════════════════════════════════════════════════════════════════ */

.po-nav__title--split { margin-top: var(--qtr-space-3); padding-top: var(--qtr-space-3);
                        border-top: 1px solid var(--qtr-line); }

.po-link { background: none; border: 0; padding: 0; font: inherit; color: var(--qtr-accent);
           cursor: pointer; text-align: inherit; text-decoration: underline;
           text-underline-offset: 2px; }
.po-link:hover { color: var(--qtr-ink-strong); }
.po-link:focus-visible { outline: 2px solid var(--qtr-accent); outline-offset: 2px; border-radius: 4px; }

.po-scopebanner--ok   { background: var(--qtr-success-soft); color: var(--qtr-success-text); }
.po-scopebanner--warn { background: var(--qtr-warning-soft); color: var(--qtr-warning-text); }

/* The action dialog. It is modal on purpose: an operation that needs a stated reason and a typed
   confirmation is not something to perform half-attentively beside the table it changes. */
.po-modal { position: fixed; inset: 0; z-index: 1200; display: flex; align-items: center;
            justify-content: center; padding: var(--qtr-space-4);
            background: color-mix(in srgb, var(--qtr-ink-strong) 45%, transparent);
            overflow-y: auto; }
.po-modal__box { background: var(--qtr-surface); border: 1px solid var(--qtr-border);
                 border-radius: 16px; padding: var(--qtr-space-5); width: min(560px, 100%);
                 /* The token, with no literal fallback. A hard-coded rgba() here was a colour
                    written outside the brand layer, and the brand gate was right to refuse it:
                    a "fallback" colour is still a colour this file decided on its own. */
                 box-shadow: var(--qtr-shadow-lg);
                 max-height: 92vh; overflow-y: auto; }
.po-modal__title { font-size: var(--qtr-font-size-lg); font-weight: var(--qtr-weight-semibold);
                   color: var(--qtr-ink-strong); margin: 0 0 var(--qtr-space-3); }
.po-modal__body { font-size: var(--qtr-font-size-sm); color: var(--qtr-text-secondary);
                  margin: 0 0 var(--qtr-space-3); line-height: 1.6; }
/* A second approver or an irreversible act is stated before the reason field, not after the
   button. A warning read on the way out is not a warning. */
.po-modal__note { font-size: var(--qtr-font-size-sm); background: var(--qtr-warning-soft);
                  color: var(--qtr-warning-text); border-radius: 10px;
                  padding: 10px var(--qtr-space-3); margin: 0 0 var(--qtr-space-3); line-height: 1.55; }
.po-modal__error { font-size: var(--qtr-font-size-sm); background: var(--qtr-danger-soft);
                   color: var(--qtr-danger-text); border-radius: 10px;
                   padding: 10px var(--qtr-space-3); margin: var(--qtr-space-3) 0 0;
                   white-space: pre-wrap; line-height: 1.55; }
.po-modal__actions { display: flex; gap: var(--qtr-space-2); justify-content: flex-end;
                     margin-top: var(--qtr-space-4); flex-wrap: wrap; }

.po-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--qtr-space-3); }
.po-field > span { font-size: var(--qtr-font-size-sm); color: var(--qtr-text); font-weight: var(--qtr-weight-medium); }
.po-field input, .po-field textarea, .po-field select {
  border: 1px solid var(--qtr-border); border-radius: 10px; background: var(--qtr-surface);
  color: var(--qtr-text); padding: 10px var(--qtr-space-3); font-family: inherit;
  font-size: var(--qtr-font-size-sm); min-height: var(--qtr-control-height); width: 100%; }
.po-field textarea { min-height: 76px; resize: vertical; line-height: 1.55; }
.po-field input:focus-visible, .po-field textarea:focus-visible, .po-field select:focus-visible {
  outline: 2px solid var(--qtr-accent); outline-offset: 1px; }
.po-field__hint { font-size: var(--qtr-font-size-xs); color: var(--qtr-muted-text); }
.po-field--row { flex-direction: row; align-items: center; gap: var(--qtr-space-2); }
.po-field--row input { width: auto; min-height: 0; }

@media (max-width: 900px) {
  .po-modal { align-items: flex-start; padding: var(--qtr-space-3); }
  .po-modal__actions button { flex: 1 1 auto; }
}

/* ═══════════════════════════════════════════════════════════════════════════════════════════════
 * THE CONTROL PLANE: tiles, meters and gap lists
 *
 * A tile is a BUTTON, not a card with a number in it. Everything on the health screen opens the
 * list it counts, so the element that carries a count is the element you press — which is also why
 * a tile with nothing to open is rendered disabled rather than styled to look inert.
 * ═══════════════════════════════════════════════════════════════════════════════════════════════ */

.po-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
            gap: var(--qtr-space-3); }
.po-tile { display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
           background: var(--qtr-surface); border: 1px solid var(--qtr-border);
           border-radius: 12px; padding: var(--qtr-space-3) var(--qtr-space-4);
           cursor: pointer; text-align: inherit; font-family: inherit; width: 100%;
           transition: background var(--qtr-motion-fast) var(--qtr-motion-curve),
                       border-color var(--qtr-motion-fast) var(--qtr-motion-curve); }
.po-tile:hover:not([disabled]) { background: var(--qtr-surface-soft); border-color: var(--qtr-accent); }
.po-tile:focus-visible { outline: 2px solid var(--qtr-accent); outline-offset: 2px; }
.po-tile[disabled] { cursor: default; opacity: .8; }
.po-tile__value { font-size: var(--qtr-font-size-2xl); font-weight: var(--qtr-weight-semibold);
                  color: var(--qtr-ink-strong); line-height: 1.1; font-variant-numeric: tabular-nums; }
.po-tile__label { font-size: var(--qtr-font-size-sm); color: var(--qtr-text); }
.po-tile__sub   { font-size: var(--qtr-font-size-xs); color: var(--qtr-muted-text); }
.po-tile__go    { font-size: var(--qtr-font-size-xs); color: var(--qtr-accent); margin-top: 6px; }
/* Colour marks severity, and is never the only carrier: the sub-line says "blocks operation" in
   words, so the meaning survives a monochrome screen or a reader who cannot separate the hues. */
.po-tile--bad   { border-inline-start: 3px solid var(--qtr-danger); }
.po-tile--warn  { border-inline-start: 3px solid var(--qtr-warning-text); }
.po-tile--ok    { border-inline-start: 3px solid var(--qtr-success-text); }
.po-tile--alert .po-tile__value { color: var(--qtr-danger-text); }

.po-meter { height: 8px; border-radius: 999px; background: var(--qtr-surface-soft);
            overflow: hidden; border: 1px solid var(--qtr-line); }
.po-meter > span { display: block; height: 100%; background: var(--qtr-accent);
                   border-radius: 999px; transition: width var(--qtr-motion-slow) var(--qtr-motion-curve); }
@media (prefers-reduced-motion: reduce) { .po-meter > span { transition: none; } }

.po-gaps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.po-gap { display: flex; align-items: center; gap: var(--qtr-space-3); flex-wrap: wrap;
          padding: 8px var(--qtr-space-3); border-radius: 10px; background: var(--qtr-surface-soft); }
.po-gap--blocking { background: var(--qtr-danger-soft); }
.po-gap__what { font-size: var(--qtr-font-size-sm); color: var(--qtr-ink-strong); flex: 1 1 auto; }

@media (max-width: 900px) {
  .po-tiles { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .po-tiles { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════════════════════════════════════════════════════
 * THE COMPANY COCKPIT
 *
 * The cockpit shipped functional and unfinished: tabs were raw bordered buttons that wrapped into
 * two ragged rows, two red destructive buttons sat permanently at the top of the page, product
 * rows carried a coloured action button each, and dependencies arrived as a comma-separated list
 * of contract keys. It read as a database tool with a stylesheet, not as a product.
 *
 * Everything below is presentation. No control changes what it calls, what it is permitted to do,
 * or what it confirms before doing it.
 *
 * Written with logical properties throughout — inline-start/end, not left/right — because the
 * primary language is Arabic and a cockpit that only mirrors correctly by accident will stop
 * mirroring the first time someone adds a margin.
 * ═══════════════════════════════════════════════════════════════════════════════════════════════ */

/* ── breadcrumb ─────────────────────────────────────────────────────────────────────────────── */
.po-crumb { display: flex; align-items: center; gap: var(--qtr-space-2);
            font-size: var(--qtr-font-size-sm); color: var(--qtr-text-secondary);
            margin-bottom: var(--qtr-space-3); flex-wrap: wrap; }
.po-crumb__link { background: none; border: 0; padding: 4px 2px; font: inherit; cursor: pointer;
                  color: var(--qtr-accent); border-radius: 6px; }
.po-crumb__link:hover { text-decoration: underline; }
.po-crumb__link:focus-visible { outline: 2px solid var(--qtr-accent); outline-offset: 2px; }
.po-crumb__sep { color: var(--qtr-muted-text); }
/* The chevron points the way the language runs, so it flips with the document. */
.po-crumb__sep i, .po-crumb__sep svg { width: 14px; height: 14px; }
[dir="rtl"] .po-crumb__sep { transform: scaleX(-1); }
.po-crumb__here { color: var(--qtr-text); font-weight: var(--qtr-weight-medium); }

/* ── company header ─────────────────────────────────────────────────────────────────────────── */
.po-chead { background: var(--qtr-surface); border: 1px solid var(--qtr-border);
            border-radius: 16px; padding: var(--qtr-space-5); margin-bottom: var(--qtr-space-4); }
.po-chead__top { display: flex; flex-wrap: wrap; gap: var(--qtr-space-4);
                 align-items: flex-start; justify-content: space-between; }
.po-chead__id { min-width: 0; flex: 1 1 320px; }
.po-chead__namerow { display: flex; align-items: center; gap: var(--qtr-space-3); flex-wrap: wrap; }
.po-chead__name { font-size: var(--qtr-font-size-xl); font-weight: var(--qtr-weight-semibold);
                  color: var(--qtr-ink-strong); margin: 0; line-height: var(--qtr-line-display); }
/* The trading name is a different fact from the legal name and is shown as one, not appended to
   the heading with a separator that reads as part of the name. */
.po-chead__alt { font-size: var(--qtr-font-size-sm); color: var(--qtr-text-secondary);
                 margin: 4px 0 0; }
.po-chead__alt bdi { unicode-bidi: isolate; }

/* Metadata pairs. A label above its value, so a long registration number wraps under its own
   caption instead of pushing the next pair off the row. */
.po-chead__meta { display: grid; gap: var(--qtr-space-3) var(--qtr-space-5);
                  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
                  margin-top: var(--qtr-space-4); padding-top: var(--qtr-space-4);
                  border-top: 1px solid var(--qtr-line); }
.po-meta__k { display: block; font-size: var(--qtr-font-size-xs); color: var(--qtr-muted-text);
              margin-bottom: 2px; }
.po-meta__v { display: block; font-size: var(--qtr-font-size-sm); color: var(--qtr-text);
              overflow-wrap: anywhere; }
/* Registration and tax numbers are identifiers: never reversed, never reflowed, always legible as
   a single run of digits regardless of the surrounding direction. */
.po-meta__v--id { font-family: var(--qtr-font-mono, monospace); direction: ltr; unicode-bidi: isolate;
                  text-align: start; letter-spacing: .02em; }

.po-chead__actions { display: flex; align-items: center; gap: var(--qtr-space-2); flex-wrap: wrap; }

/* ── the danger zone ────────────────────────────────────────────────────────────────────────── */
/* Suspending a company and archiving it were two permanently red buttons at the top of the page,
   competing with the company's own name. They are still one click away and still permission-gated
   and still confirmed — they simply no longer look like the primary thing to do here. */
.po-danger { margin-top: var(--qtr-space-4); border: 1px solid var(--qtr-danger-soft);
             border-radius: 12px; background: var(--qtr-surface); overflow: hidden; }
.po-danger__head { display: flex; align-items: center; gap: var(--qtr-space-3);
                   width: 100%; padding: var(--qtr-space-3) var(--qtr-space-4);
                   background: none; border: 0; font: inherit; cursor: pointer;
                   color: var(--qtr-danger-text); text-align: start; }
.po-danger__head:hover { background: var(--qtr-danger-soft); }
.po-danger__head:focus-visible { outline: 2px solid var(--qtr-danger); outline-offset: -2px; }
.po-danger__head i, .po-danger__head svg { width: 16px; height: 16px; flex: none; }
.po-danger__title { font-weight: var(--qtr-weight-semibold); font-size: var(--qtr-font-size-sm); }
.po-danger__hint { color: var(--qtr-text-secondary); font-size: var(--qtr-font-size-xs);
                   margin-inline-start: auto; }
.po-danger__chev { transition: transform var(--qtr-motion-fast, .15s) var(--qtr-motion-curve, ease); }
.po-danger[open] .po-danger__chev { transform: rotate(180deg); }
.po-danger__body { padding: var(--qtr-space-4); border-top: 1px solid var(--qtr-danger-soft);
                   display: flex; flex-wrap: wrap; gap: var(--qtr-space-3); align-items: center; }
.po-danger__body p { margin: 0; flex: 1 1 260px; font-size: var(--qtr-font-size-sm);
                     color: var(--qtr-text-secondary); }

/* ── summary cards ──────────────────────────────────────────────────────────────────────────── */
/* Four across, two rows, so eight cards form a block rather than five-and-a-gap. auto-fit chose
   its own column count from the available width and left a hole wherever the remainder fell. */
.po-sum { display: grid; gap: var(--qtr-space-3); margin-bottom: var(--qtr-space-4);
          grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1180px) { .po-sum { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 860px)  { .po-sum { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 380px)  { .po-sum { grid-template-columns: 1fr; } }
.po-sum__card { display: flex; flex-direction: column; gap: 6px; min-height: 104px;
                background: var(--qtr-surface); border: 1px solid var(--qtr-border);
                border-radius: 14px; padding: var(--qtr-space-4); text-align: start;
                font: inherit; color: inherit; cursor: pointer;
                transition: border-color var(--qtr-motion-fast, .15s) ease,
                            box-shadow var(--qtr-motion-fast, .15s) ease; }
.po-sum__card:hover { border-color: var(--qtr-accent); box-shadow: var(--qtr-shadow); }
.po-sum__card:focus-visible { outline: 2px solid var(--qtr-accent); outline-offset: 2px; }
.po-sum__label { font-size: var(--qtr-font-size-xs); color: var(--qtr-text-secondary); }
.po-sum__value { font-size: var(--qtr-font-size-2xl); font-weight: var(--qtr-weight-semibold);
                 color: var(--qtr-ink-strong); line-height: 1.1;
                 font-variant-numeric: tabular-nums; }
/* A short word rather than a figure — "Assigned", "Not assigned" — must not be rendered at
   headline-numeral size or it reads as a value it is not. */
.po-sum__value--word { font-size: var(--qtr-font-size-lg); }
.po-sum__hint { font-size: var(--qtr-font-size-xs); color: var(--qtr-muted-text); margin-top: auto; }
/* Colour is applied only where the number means something is wrong, and never alone: the hint
   carries the same meaning in words. */
.po-sum__card--warn { border-color: var(--qtr-warning); }
.po-sum__card--warn .po-sum__value { color: var(--qtr-warning-text); }
.po-sum__card--bad  { border-color: var(--qtr-danger); }
.po-sum__card--bad  .po-sum__value { color: var(--qtr-danger-text); }
.po-sum__card--ok   .po-sum__value { color: var(--qtr-success-text); }

/* ── the tab rail ───────────────────────────────────────────────────────────────────────────── */
/* One row that scrolls, never two rows that wrap. Wrapping produced a ragged block of buttons
   whose second row looked like a different control group; scrolling keeps the set legible as one
   navigation and keeps the active tab findable. */
/* The rail scrolls, so it has to LOOK like it scrolls. Without an edge the last visible tab reads
   as the last tab, and six of the ten were simply invisible with nothing to suggest otherwise. */
.po-tabswrap { position: relative; margin-bottom: var(--qtr-space-4); }
.po-tabswrap::before, .po-tabswrap::after {
  content: ''; position: absolute; inset-block: 0; width: 28px; pointer-events: none; z-index: 2;
  opacity: 0; transition: opacity var(--qtr-motion-fast, .15s) ease; }
.po-tabswrap::before { inset-inline-start: 0; }
.po-tabswrap::after  { inset-inline-end: 0; }
.po-tabswrap[data-more-start="1"]::before { opacity: 1; }
.po-tabswrap[data-more-end="1"]::after   { opacity: 1; }
/* `linear-gradient(to <side>)` takes a physical side and does NOT mirror with the document, so a
   custom property holding "right" produced a fade running the wrong way in Arabic — a smear over
   the first tab instead of a hint that more follow. Written out per direction instead. */
[dir="ltr"] .po-tabswrap::before { background: linear-gradient(to right, var(--qtr-surface-soft), transparent); }
[dir="ltr"] .po-tabswrap::after  { background: linear-gradient(to left,  var(--qtr-surface-soft), transparent); }
[dir="rtl"] .po-tabswrap::before { background: linear-gradient(to left,  var(--qtr-surface-soft), transparent); }
[dir="rtl"] .po-tabswrap::after  { background: linear-gradient(to right, var(--qtr-surface-soft), transparent); }

.po-tabs { position: relative; display: flex; gap: 2px; margin-bottom: 0;
           padding: 4px; background: var(--qtr-surface-soft); border: 1px solid var(--qtr-border);
           border-radius: 14px; overflow-x: auto; overflow-y: hidden;
           scrollbar-width: thin; scroll-behavior: smooth; -webkit-overflow-scrolling: touch; }
.po-tabs::-webkit-scrollbar { height: 6px; }
.po-tabs::-webkit-scrollbar-thumb { background: var(--qtr-border); border-radius: 999px; }
.po-tabs__item { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
                 min-height: 40px; padding: 0 var(--qtr-space-4); border: 0; border-radius: 10px;
                 background: transparent; color: var(--qtr-text-secondary); font: inherit;
                 font-size: var(--qtr-font-size-sm); font-weight: var(--qtr-weight-medium);
                 cursor: pointer; flex: none;
                 transition: background var(--qtr-motion-fast, .15s) ease,
                             color var(--qtr-motion-fast, .15s) ease; }
.po-tabs__item i, .po-tabs__item svg { width: 16px; height: 16px; flex: none; }
.po-tabs__item:hover { background: var(--qtr-surface); color: var(--qtr-text); }
.po-tabs__item:focus-visible { outline: 2px solid var(--qtr-accent); outline-offset: -2px; }
.po-tabs__item[aria-selected="true"] { background: var(--qtr-accent); color: var(--qtr-on-accent);
                                       box-shadow: var(--qtr-shadow); }
.po-tabs__item[aria-selected="true"]:hover { background: var(--qtr-accent);
                                             color: var(--qtr-on-accent); }
/* The count beside a tab is a fact, not decoration, so it keeps its contrast in both states. */
.po-tabs__n { font-size: var(--qtr-font-size-xs); font-variant-numeric: tabular-nums;
              background: var(--qtr-surface); color: var(--qtr-text-secondary);
              border-radius: 999px; padding: 1px 7px; }
.po-tabs__item[aria-selected="true"] .po-tabs__n { background: rgb(255 255 255 / .22);
                                                   color: var(--qtr-on-accent); }

/* ── section headers, shared by every tab ───────────────────────────────────────────────────── */
.po-sec { display: flex; align-items: flex-start; gap: var(--qtr-space-3); flex-wrap: wrap;
          justify-content: space-between; margin-bottom: var(--qtr-space-3); }
.po-sec__t { font-size: var(--qtr-font-size-md); font-weight: var(--qtr-weight-semibold);
             color: var(--qtr-ink-strong); margin: 0; }
.po-sec__d { font-size: var(--qtr-font-size-sm); color: var(--qtr-text-secondary);
             margin: 4px 0 0; max-width: 78ch; line-height: var(--qtr-line-body, 1.6); }
.po-sec__actions { display: flex; gap: var(--qtr-space-2); flex-wrap: wrap; }

/* A compact strip of counts above a list. Not KPI cards — these label the list underneath. */
.po-tally { display: flex; flex-wrap: wrap; gap: var(--qtr-space-2); margin-bottom: var(--qtr-space-4); }
.po-tally__i { display: inline-flex; align-items: baseline; gap: 6px; border-radius: 999px;
               padding: 5px 12px; background: var(--qtr-surface-soft);
               border: 1px solid var(--qtr-border); font-size: var(--qtr-font-size-xs); }
.po-tally__n { font-weight: var(--qtr-weight-semibold); font-variant-numeric: tabular-nums;
               color: var(--qtr-ink-strong); }
.po-tally__i--ok   { background: var(--qtr-success-soft); border-color: transparent;
                     color: var(--qtr-success-text); }
.po-tally__i--ok .po-tally__n { color: var(--qtr-success-text); }
.po-tally__i--warn { background: var(--qtr-warning-soft); border-color: transparent;
                     color: var(--qtr-warning-text); }
.po-tally__i--warn .po-tally__n { color: var(--qtr-warning-text); }
.po-tally__i--bad  { background: var(--qtr-danger-soft); border-color: transparent;
                     color: var(--qtr-danger-text); }
.po-tally__i--bad .po-tally__n { color: var(--qtr-danger-text); }

/* ── chips ──────────────────────────────────────────────────────────────────────────────────── */
/* Dependencies were `organization, branches, localization, users, license` — contract keys, in
   English, inside an Arabic sentence, with no way to see which one is unmet. */
.po-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.po-chip { display: inline-flex; align-items: center; gap: 5px; border-radius: 8px;
           padding: 2px 8px; font-size: var(--qtr-font-size-xs);
           background: var(--qtr-surface-soft); border: 1px solid var(--qtr-border);
           color: var(--qtr-text-secondary); }
.po-chip i, .po-chip svg { width: 12px; height: 12px; }
.po-chip--unmet { background: var(--qtr-warning-soft); border-color: transparent;
                  color: var(--qtr-warning-text); font-weight: var(--qtr-weight-medium); }
.po-chip--met   { background: var(--qtr-success-soft); border-color: transparent;
                  color: var(--qtr-success-text); }

/* ── product identity ───────────────────────────────────────────────────────────────────────── */
.po-prod { display: flex; align-items: center; gap: var(--qtr-space-3); min-width: 0; }
.po-prod__ico { width: 30px; height: 30px; border-radius: 9px; flex: none;
                display: inline-flex; align-items: center; justify-content: center;
                background: var(--qtr-surface-soft); color: var(--qtr-text-secondary); }
.po-prod__ico i, .po-prod__ico svg { width: 16px; height: 16px; }
.po-prod__n { min-width: 0; }
.po-prod__name { display: block; font-weight: var(--qtr-weight-medium); color: var(--qtr-ink-strong);
                 overflow-wrap: anywhere; }
/* The contract key stays available as technical metadata, in a size and colour that says so. */
.po-prod__key { display: block; font-size: var(--qtr-font-size-xs); color: var(--qtr-muted-text);
                font-family: var(--qtr-font-mono, monospace); direction: ltr; unicode-bidi: isolate;
                text-align: start; }

/* ── row action menu ────────────────────────────────────────────────────────────────────────── */
/* A red Suspend button in every row made destruction the most prominent thing on the page. The
   action is now one deliberate step away, and only turns red once it has been chosen. */
.po-rowact { position: relative; display: inline-block; }
.po-rowact__btn { min-height: 34px; min-width: 34px; display: inline-flex; align-items: center;
                  justify-content: center; gap: 6px; border-radius: 9px; padding: 0 10px;
                  border: 1px solid var(--qtr-border); background: var(--qtr-surface);
                  color: var(--qtr-text-secondary); font: inherit;
                  font-size: var(--qtr-font-size-sm); cursor: pointer; }
.po-rowact__btn:hover { background: var(--qtr-surface-soft); color: var(--qtr-text); }
.po-rowact__btn:focus-visible { outline: 2px solid var(--qtr-accent); outline-offset: 2px; }
.po-rowact__btn i, .po-rowact__btn svg { width: 15px; height: 15px; }
.po-rowact__menu { position: absolute; inset-block-start: calc(100% + 4px); inset-inline-end: 0;
                   z-index: 40; min-width: 208px; padding: 5px; border-radius: 12px;
                   background: var(--qtr-surface); border: 1px solid var(--qtr-border);
                   box-shadow: var(--qtr-shadow-lg, var(--qtr-shadow)); }
.po-rowact__menu[hidden] { display: none; }
.po-rowact__i { display: flex; align-items: center; gap: 9px; width: 100%; min-height: 38px;
                padding: 0 10px; border: 0; border-radius: 8px; background: none; font: inherit;
                font-size: var(--qtr-font-size-sm); color: var(--qtr-text); cursor: pointer;
                text-align: start; }
.po-rowact__i:hover { background: var(--qtr-surface-soft); }
.po-rowact__i:focus-visible { outline: 2px solid var(--qtr-accent); outline-offset: -2px; }
.po-rowact__i i, .po-rowact__i svg { width: 15px; height: 15px; flex: none; }
.po-rowact__i--danger { color: var(--qtr-danger-text); }
.po-rowact__i--danger:hover { background: var(--qtr-danger-soft); }
.po-rowact__i[disabled] { opacity: .5; cursor: not-allowed; }

/* ── licences ───────────────────────────────────────────────────────────────────────────────── */
.po-lics { display: grid; gap: var(--qtr-space-3);
           grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.po-lic { border: 1px solid var(--qtr-border); border-radius: 12px; padding: var(--qtr-space-4);
          background: var(--qtr-surface); display: flex; flex-direction: column; gap: 10px; }
.po-lic--expiring { border-color: var(--qtr-warning); }
.po-lic--expired, .po-lic--revoked { border-color: var(--qtr-danger-soft);
                                     background: var(--qtr-surface-soft); }
.po-lic__top { display: flex; align-items: flex-start; justify-content: space-between;
               gap: var(--qtr-space-3); }
.po-lic__name { font-weight: var(--qtr-weight-medium); color: var(--qtr-ink-strong); margin: 0; }
/* When the contract has no display name the licence is identified by its product plus a short
   reference — never by a bare dash, which names nothing. */
.po-lic__ref { font-size: var(--qtr-font-size-xs); color: var(--qtr-muted-text);
               font-family: var(--qtr-font-mono, monospace); direction: ltr; unicode-bidi: isolate;
               text-align: start; }
.po-lic__grid { display: grid; gap: 8px var(--qtr-space-4);
                grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); }
.po-lic__foot { display: flex; align-items: center; justify-content: space-between;
                gap: var(--qtr-space-3); margin-top: auto; padding-top: 10px;
                border-top: 1px solid var(--qtr-line); }
/* Seats as a bar, because "3 of 10" is a ratio and a ratio is easier to read than to compute. */
.po-seats { height: 6px; border-radius: 999px; background: var(--qtr-surface-soft);
            overflow: hidden; margin-top: 5px; }
.po-seats__fill { height: 100%; background: var(--qtr-accent); border-radius: 999px; }
.po-seats__fill--full { background: var(--qtr-warning); }

/* ── mobile ─────────────────────────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  /* The rail sticks so the active tab stays reachable while a long tab scrolls. */
  .po-tabs { position: sticky; top: 0; z-index: 30; border-radius: 12px;
             background: var(--qtr-surface); box-shadow: var(--qtr-shadow); }
  .po-chead { padding: var(--qtr-space-4); }
  /* THE BASIS BECOMES A HEIGHT WHEN THE AXIS TURNS.
     `.po-chead__id { flex: 1 1 320px }` is a sensible minimum WIDTH on a row. The moment this
     container becomes a column, 320px is the flex basis along the block axis — so a block holding
     a company name and one subtitle was rendered 320px tall, with roughly 200px of white space
     under the name on every phone. Measured, not spotted: the header was 693px tall for 441px of
     content. */
  .po-chead__top { flex-direction: column; align-items: stretch; }
  .po-chead__id  { flex: 0 1 auto; }
  .po-chead__actions { justify-content: flex-start; }
  .po-sum { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
  .po-lics { grid-template-columns: 1fr; }
  /* Touch targets. 44px is the floor, including the ones that were icon-sized on desktop. */
  .po-tabs__item { min-height: 44px; }
  .po-rowact__btn { min-height: 44px; min-width: 44px; }
  .po-rowact__i { min-height: 44px; }
  .po-crumb__link { min-height: 44px; display: inline-flex; align-items: center; }
  /* A row rendered as a card must not hide its action behind a popover anchored to a cell. */
  .po-rowact__menu { position: static; box-shadow: none; border: 0; padding: 0; min-width: 0; }
  .po-rowact { width: 100%; }
  .po-rowact__btn { width: 100%; }
  /* The actions cell stacks: a 44px control squeezed into the right half of a label row is not a
     44px target. */
  .po-table td.po-actions { display: block; text-align: start; }
  .po-table td.po-actions::before { display: block; margin-bottom: 6px; }
  .po-tabs { margin-bottom: 0; }
  .po-tabswrap { position: sticky; top: 0; z-index: 30; }
}

@media (prefers-reduced-motion: reduce) {
  .po-tabs { scroll-behavior: auto; }
  .po-sum__card, .po-tabs__item, .po-danger__chev { transition: none; }
}
