/* ══════════════════════════════════════════════════════════════════════
   PHAZA PORTAL ADAPTER — UI Core 2.4.0
   Laravel + Filament. Vendor SELECTORS only; every value comes from a
   token. If you find a raw hex below, it is a bug — fix it in tokens.py
   and rebuild, never here.

   Pinned to: Filament v5.x (.fi-* class contract), verified against rendered
   markup 2026-08-24 by the Portal parity matrix. Two selectors in the first cut
   were DEAD and silently did nothing — .fi-fo-field-wrp (v5 renders
   .fi-fo-field) and .fi-btn-primary (v3-era). Note the exception below: the
   ERROR MESSAGE class kept the -wrp- infix that the wrapper lost. A dead selector is worse than a
   missing rule: it looks like coverage.
   On a Filament major upgrade, re-run the visual regression set in
   ../rules/accessibility.md §7 before shipping.
   ══════════════════════════════════════════════════════════════════════ */
/* REQUIRES core/phaza-ui-core.css to be loaded FIRST by the host application
   (contracts.md §1). This file deliberately does NOT @import it: in 2.0.0 it
   did, which bound the adapter to one directory layout and double-loaded the
   core stylesheet. Load order is the app's job, not the adapter's. */

/* ---- ground: no vendor white ever reaches the screen ---- */
.fi-body, .fi-main, .fi-layout { background: var(--phz-surface-canvas) !important; color: var(--phz-text-primary); }
.fi-sidebar, .fi-topbar { background: var(--phz-surface-raised) !important; border-color: var(--phz-border-subtle) !important; }
.fi-sidebar-item-button.fi-active { background: var(--phz-surface-hover) !important;
  box-shadow: inset 2px 0 0 var(--phz-brand-action); }
[dir="rtl"] .fi-sidebar-item-button.fi-active { box-shadow: inset -2px 0 0 var(--phz-brand-action); }

/* ---- containers wear the one edge ---- */
.fi-section, .fi-wi-stats-overview-stat, .fi-modal-window {
  background: linear-gradient(180deg, var(--phz-surface-hover), var(--phz-surface-raised) 24%) !important;
  box-shadow: inset 0 0 0 1px var(--phz-border-default) !important;
  border: 0 !important; border-radius: 0 !important;
  clip-path: var(--phz-cut-stage); position: relative; }
[dir="rtl"] .fi-section, [dir="rtl"] .fi-wi-stats-overview-stat, [dir="rtl"] .fi-modal-window {
  clip-path: var(--phz-cut-stage-rtl); }
.fi-section::after, .fi-wi-stats-overview-stat::after, .fi-modal-window::after {
  content: ""; position: absolute; top: 0; left: 0; z-index: 2;
  width: var(--phz-cut-len); height: 1.5px; background: var(--phz-gradient-signature);
  transform-origin: 0 0; transform: translateX(var(--phz-cut-x)) rotate(var(--phz-cut-ang));
  pointer-events: none; }
[dir="rtl"] .fi-section::after, [dir="rtl"] .fi-wi-stats-overview-stat::after,
[dir="rtl"] .fi-modal-window::after { left: auto; right: 0; transform-origin: 100% 0;
  transform: translateX(calc(var(--phz-cut-x) * -1)) rotate(calc(var(--phz-cut-ang) * -1)); }

/* ---- actions ---- */
.fi-btn { border-radius: 0 !important; }
/* the canonical primary button carries the control-scale blade cut. The first
   cut of this adapter set border-radius:0 and stopped there, so Filament
   primaries were square but uncut — right colour, wrong shape. */
.fi-btn.fi-color-primary { background: var(--phz-gradient-action) !important;
  border: 0 !important; color: #fff !important; clip-path: var(--phz-cut-button); }
[dir="rtl"] .fi-btn.fi-color-primary { clip-path: var(--phz-cut-button-rtl); }
.fi-btn.fi-color-danger { background: linear-gradient(140deg,#E25555,#C03434) !important; color:#fff !important; }
.fi-btn:disabled, .fi-btn[aria-disabled="true"] { opacity: .45; filter: none; }

/* ---- fields: shadow-elevated, sharp, bloom+sweep focus. Never a system border ---- */
.fi-input, .fi-select-input, .fi-textarea, .fi-fo-field input, .fi-fo-field textarea {
  background-color: var(--phz-surface-sunken) !important; color: var(--phz-text-primary) !important;
  border-color: transparent !important; border-radius: 0 !important;
  box-shadow: var(--phz-shadow-field) !important; }
.fi-input:focus, .fi-select-input:focus, .fi-textarea:focus,
.fi-fo-field input:focus, .fi-fo-field textarea:focus {
  outline: none !important; box-shadow: var(--phz-shadow-field-focus) !important; }
/* Filament's naming is INCONSISTENT here and it is a trap. The wrapper div was
   renamed .fi-fo-field-wrp -> .fi-fo-field in v5, but its error message KEPT
   the -wrp- infix: field-wrapper.blade.php still renders
   .fi-fo-field-wrp-error-message (verified in vendor source, v5.7.6).
   Do NOT "normalise" this selector to match the wrapper rename — that kills it. */
.fi-fo-field-wrp-error-message { color: var(--phz-status-danger); }

/* ---- dropdowns: one surface language, sharp, attached tier ---- */
.fi-dropdown-panel, .fi-select-option-list {
  background: var(--phz-surface-overlay) !important; border: 1px solid var(--phz-border-default) !important;
  border-radius: 0 !important; box-shadow: var(--phz-shadow-dropdown) !important; }
.fi-dropdown-list-item, .fi-select-option { border-radius: 0 !important; position: relative; }
.fi-dropdown-list-item:hover, .fi-select-option:hover { background: var(--phz-surface-hover) !important; }
.fi-select-option[aria-selected="true"] { color: var(--phz-link) !important; }

/* ---- identity: the blade window, never a circle ---- */
.fi-avatar, .fi-user-avatar { border-radius: 0 !important;
  transform: skewX(var(--phz-window-skew)); overflow: hidden; }
.fi-avatar img, .fi-user-avatar img { transform: skewX(var(--phz-window-counter)); }

/* ---- status stays colour + icon + word, never colour alone ---- */
.fi-badge { border-radius: var(--phz-radius-pill) !important; }

/* ---- tables ---- */
.fi-ta-table thead { background: var(--phz-surface-raised); }
.fi-ta-row:hover { background: var(--phz-surface-hover); }
.fi-ta-header-cell-sort-icon { color: var(--phz-brand-action); }

/* ---- links ---- */
a, .fi-link { color: var(--phz-link); }
