/* ============================================================================
   Hayat In — Vendor Panel v2 · BASE
   ----------------------------------------------------------------------------
   Reset-ish, typography, layout primitives.
   Everything is scoped under `body.vp` so it cannot leak into a page that still
   loads the Tivo/Pixelstrap theme.

   RTL: this file uses LOGICAL properties throughout (margin-inline-*,
   padding-inline, inset-inline-*, border-inline-*, text-align: start/end).
   There are no physical left/right declarations in any layout path. Only
   genuinely visual mirrors (chevrons, carets, sort arrows) flip, and those do
   it with a transform under [dir="rtl"] — see components.css.
   ========================================================================== */

/* ---- reset ---------------------------------------------------------------- */

body.vp *,
body.vp *::before,
body.vp *::after { box-sizing: border-box; }

body.vp {
  margin: 0;
  min-height: 100vh;
  font-family: var(--vp-font-sans);
  font-size: var(--vp-text-base);
  font-weight: var(--vp-weight-400);
  line-height: var(--vp-leading-normal);
  color: var(--vp-text);
  background: var(--vp-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body.vp img,
body.vp svg,
body.vp video { max-width: 100%; display: block; }

/* The design package's own base sets `max-width: 100%` and `display: block` on
   an image and nothing else. `height: auto` is ours, and at (0,1,1) it outranks
   every (0,1,0) size the package writes — and the package writes one for every
   image it places: 58 by 43 for the offer row's thumbnail, 100 by 72 for the
   editor's media view, 28 by 28 for a customer's avatar. The thumbnail was
   rendering 58 by 58 here, which made every row of the offers list taller than
   the design's and narrowed the title beside it. Those three screens opt out.
   The exclusion sits inside :where() so the rule keeps the exact weight it has
   always had on every other screen in the panel. */
body.vp:where(:not(.offers-library-reference, .offers-detail-reference, .offers-create-reference)) img { height: auto; }

/* A NORMALIZATION, not an override — hence :where().
   Written plainly this is `body.vp input`, which is (0,1,2): higher than any
   `.some-class input` rule a module can write, so a module that wanted to give
   its inputs a colour silently lost to a reset that only meant to undo the
   browser's defaults. :where() drops it to (0,1,1) and lets module CSS win,
   while still beating the vendor sheets it exists to correct — Bootstrap's
   `input, button, select, optgroup, textarea` and feather-icon's
   `button, input, … { font-family: sans-serif }` are both (0,0,1). */
/* The three offers screens render the approved design package, which brings its
   own complete base. `color: inherit` here is a normalisation the package does
   not have, and at (0,1,1) it outranked every (0,1,0) class the package writes,
   so an inactive filter tab took the page's ink instead of the package's grey.
   Those pages opt out. The exclusion sits inside :where() so the rule keeps the
   exact weight it has always had; writing it outside would lift the rule and
   change what it beats on every other screen. */
body.vp:where(:not(.offers-library-reference, .offers-detail-reference, .offers-create-reference)) :where(button, input, select, textarea) { font: inherit; color: inherit; }
body.vp:where(.offers-library-reference, .offers-detail-reference, .offers-create-reference) :where(button, input, select, textarea) { font: inherit; }

/* Normalization, not an override — see the two rules above. At (0,1,2) this
   outranked any `.some-class button` a module could write; :where() drops it
   to (0,1,1) while still beating the vendor sheets' bare `button` rules. */
/* The design package's own buttons carry their complete styling and opt out:
   at (0,1,1) this reset outranks their (0,1,0) class and stripped their
   background and border. Every other button in the panel is unaffected. */
body.vp :where(button:not(.of-btn, .of-icon-btn)) { cursor: pointer; background: none; border: 0; }
body.vp :where(button:is(.of-btn, .of-icon-btn)) { cursor: pointer; }

/* Normalizations, not overrides — hence :where(), for the same reason as the
   form-control rule above. `body.vp ol` is (0,1,2), which quietly outranks any
   `.some-module ol` a module writes; a numbered list inside a card could not get
   its indent back without an !important. At (0,1,1) the reset still beats
   Bootstrap's `ol, ul { padding-left: 2rem }` (0,0,2), which is the whole point
   of it existing. */
body.vp :where(h1, h2, h3, h4, h5, h6, p, figure, ul, ol) { margin: 0; }

body.vp :where(ul, ol) { padding: 0; list-style: none; }

body.vp table { border-collapse: collapse; width: 100%; }

body.vp hr {
  border: 0;
  border-block-start: 1px solid var(--vp-divider);
  margin-block: var(--vp-space-8);
}

body.vp :focus-visible {
  outline: 2px solid var(--vp-focus-ring);
  outline-offset: 2px;
  border-radius: var(--vp-radius-xs);
}

/* ---- typography ----------------------------------------------------------- */

/* The package brings its own heading scale, so the three screens that render it
   opt out of ours — the same opt-out the button, link and form-control resets
   above already carry, and for the same reason. `body.vp h2` is (0,1,2) and the
   package writes `.of-dashboard-heading h2` at (0,1,1), so ours won every time:
   the page heading rendered 23px at weight 800 where the design has 24px at
   700, and the offers library heading 20px where the design has 16px. The
   package's own base only zeroes heading margins and lets each component set
   its size, which is exactly what happens once ours is out of the way. The
   exclusion sits inside :where() so each rule keeps the weight it has always
   had on every other screen. */
body.vp:where(:not(.offers-library-reference, .offers-detail-reference, .offers-create-reference)) h1,
body.vp .vp-h1 {
  font-size: var(--vp-text-3xl);
  font-weight: var(--vp-weight-800);
  line-height: var(--vp-leading-tight);
  letter-spacing: var(--vp-tracking-tight);
}
body.vp:where(:not(.offers-library-reference, .offers-detail-reference, .offers-create-reference)) h2,
body.vp .vp-h2 {
  font-size: var(--vp-text-2xl);
  font-weight: var(--vp-weight-800);
  line-height: var(--vp-leading-tight);
  letter-spacing: var(--vp-tracking-tight);
}
body.vp:where(:not(.offers-library-reference, .offers-detail-reference, .offers-create-reference)) h3,
body.vp .vp-h3 {
  font-size: var(--vp-text-xl);
  font-weight: var(--vp-weight-700);
  line-height: var(--vp-leading-snug);
  letter-spacing: var(--vp-tracking-tight);
}
body.vp:where(:not(.offers-library-reference, .offers-detail-reference, .offers-create-reference)) h4,
body.vp .vp-h4 {
  font-size: var(--vp-text-lg);
  font-weight: var(--vp-weight-700);
  line-height: var(--vp-leading-snug);
}
body.vp:where(:not(.offers-library-reference, .offers-detail-reference, .offers-create-reference)) h5,
body.vp .vp-h5 {
  font-size: var(--vp-text-md);
  font-weight: var(--vp-weight-700);
}
body.vp:where(:not(.offers-library-reference, .offers-detail-reference, .offers-create-reference)) h6,
body.vp .vp-h6 {
  font-size: var(--vp-text-base);
  font-weight: var(--vp-weight-700);
}

/* bootstrap.css sets `h1 … h6 { font-weight: 500 }` at (0,0,1), and the panel's
   own heading scale used to stand in front of it. Now that the three package
   screens step out of the way, that 500 reaches every heading the package does
   not give a weight of its own: the detail hero's "Performance" rendered 500
   where the design renders the browser's bold. Restated here at bootstrap's own
   weight — :where() contributes nothing, so each selector is (0,0,1) — and our
   sheets load after bootstrap, so this wins on order. Any package rule that
   names a class is (0,1,0) or more and still wins over both. */
:where(body.offers-library-reference, body.offers-detail-reference, body.offers-create-reference) h1,
:where(body.offers-library-reference, body.offers-detail-reference, body.offers-create-reference) h2,
:where(body.offers-library-reference, body.offers-detail-reference, body.offers-create-reference) h3,
:where(body.offers-library-reference, body.offers-detail-reference, body.offers-create-reference) h4,
:where(body.offers-library-reference, body.offers-detail-reference, body.offers-create-reference) h5,
:where(body.offers-library-reference, body.offers-detail-reference, body.offers-create-reference) h6 {
  font-weight: bold;
  /* The same bootstrap rule also sets `line-height: 1.2`, and the package's
     headings have no line height of their own: they inherit the 1.45 its own
     base puts on the page, which our page carries too. Measured, the design's
     15px panel heading is 21.75px tall and ours was 18px. `inherit` reproduces
     what the package does rather than restating a number. */
  line-height: inherit;
}

body.vp .vp-display {
  font-size: var(--vp-text-4xl);
  font-weight: var(--vp-weight-800);
  line-height: var(--vp-leading-tight);
  letter-spacing: var(--vp-tracking-tight);
}

body.vp .vp-muted    { color: var(--vp-text-muted); }
body.vp .vp-subtle   { color: var(--vp-text-subtle); }
body.vp .vp-text-xs  { font-size: var(--vp-text-xs); }
body.vp .vp-text-sm  { font-size: var(--vp-text-sm); }
body.vp .vp-text-lg  { font-size: var(--vp-text-lg); }
body.vp .vp-strong   { font-weight: var(--vp-weight-700); }
body.vp .vp-mono     { font-family: var(--vp-font-mono); font-size: var(--vp-text-sm); }

/* The design package's own buttons opt out, the same way they opt out of the
   button normalisation above. An <a class="of-btn"> is a button that navigates,
   and this rule at (0,1,2) outranked the package's .of-btn at (0,1,0), so the
   two buttons in the offers heading took the link colour: "Reports" read blue
   instead of ink and the label on the filled "New offer" read blue instead of
   white. The exclusion sits inside :where() so the rule keeps the exact weight
   it has always had — writing it outside would lift the rule instead and change
   what it beats elsewhere. */
body.vp a:where(:not(.of-btn, .of-icon-btn)),
body.vp .vp-link {
  color: var(--vp-link);
  text-decoration: none;
  transition: color var(--vp-dur-fast) var(--vp-ease);
}
body.vp a:where(:not(.of-btn, .of-icon-btn)):hover,
body.vp .vp-link:hover { color: var(--vp-link-hover); text-decoration: underline; }

body.vp code:not([class]) {
  font-family: var(--vp-font-mono);
  font-size: .9em;
  padding: .12em .38em;
  border-radius: var(--vp-radius-xs);
  background: var(--vp-surface-sunken);
  color: var(--vp-text);
}

/* ---- shell ---------------------------------------------------------------- */

body.vp .vp-shell {
  display: grid;
  grid-template-columns: var(--vp-sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
  transition: grid-template-columns var(--vp-dur-base) var(--vp-ease);
}

body.vp.vp-sidebar-collapsed .vp-shell {
  grid-template-columns: var(--vp-sidebar-w-collapsed) minmax(0, 1fr);
}

body.vp .vp-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
}

body.vp .vp-page {
  flex: 1 1 auto;
  padding: var(--vp-space-8);
}

body.vp .vp-container {
  width: 100%;
  max-width: 1440px;
  margin-inline: auto;
}

body.vp .vp-container-narrow {
  width: 100%;
  max-width: 880px;
  margin-inline: auto;
}

/* ---- layout primitives ---------------------------------------------------- */

body.vp .vp-stack-1 > * + * { margin-block-start: var(--vp-space-2); }
body.vp .vp-stack-2 > * + * { margin-block-start: var(--vp-space-4); }
body.vp .vp-stack-3 > * + * { margin-block-start: var(--vp-space-5); }
body.vp .vp-stack-4 > * + * { margin-block-start: var(--vp-space-6); }
body.vp .vp-stack-5 > * + * { margin-block-start: var(--vp-space-8); }
body.vp .vp-stack-6 > * + * { margin-block-start: var(--vp-space-12); }

body.vp .vp-row {
  display: flex;
  align-items: center;
  gap: var(--vp-space-5);
}

body.vp .vp-cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--vp-space-4);
}

body.vp .vp-spread {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--vp-space-5);
  flex-wrap: wrap;
}

body.vp .vp-grid {
  display: grid;
  gap: var(--vp-space-6);
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
}
body.vp .vp-grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); }
body.vp .vp-grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); }
body.vp .vp-grid-4 { grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); }

body.vp .vp-fill { flex: 1 1 auto; min-width: 0; }
body.vp .vp-push-end { margin-inline-start: auto; }

body.vp .vp-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.vp .vp-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

body.vp .vp-scroll-x {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

body.vp .vp-text-start  { text-align: start; }
body.vp .vp-text-end    { text-align: end; }
body.vp .vp-text-center { text-align: center; }

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

/* ---- responsive ----------------------------------------------------------- */

@media (max-width: 1080px) {
  body.vp .vp-hide-md { display: none !important; }
}

@media (max-width: 860px) {
  body.vp .vp-shell,
  body.vp.vp-sidebar-collapsed .vp-shell { grid-template-columns: minmax(0, 1fr); }
  body.vp .vp-page { padding: var(--vp-space-6) var(--vp-space-5); }
  body.vp .vp-hide-sm { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  body.vp *,
  body.vp *::before,
  body.vp *::after {
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media print {
  body.vp .vp-footer { display: none !important; }
  body.vp .vp-shell { grid-template-columns: minmax(0, 1fr); }
}
