﻿/*
 * The admin portal's own layout.
 *
 * Kept in its own file rather than added to the public site's stylesheet. That is
 * partly hygiene and partly a real constraint: several of this project's verifiers
 * scan every rule after their own banner to the end of style.css and hold it to the
 * marketing page's standards â€” no literal colour, nothing but the type scale, no bare
 * element selectors. Dashboard chrome (data tables, badges, drawers) is not marketing
 * markup and should not have to pass a marketing page's checks to ship.
 *
 * Every colour falls back to its literal brand value, so the portal still reads
 * correctly if the shared stylesheet is slow or fails.
 */

.evx-body {
  margin: 0;
  background: var(--bg2, #F6F3EE);
  color: var(--ink, #221F1C);
  font-family: var(--sans, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif);
}

/*
 * The boot state â€” the first thing painted, before any script has run.
 *
 * It is deliberately plain and centred rather than a skeleton of the portal: the point is
 * to prove the document loaded and to say what is happening, not to pretend content is on
 * its way. It sits above the sign-in card so the two never overlap during the swap.
 *
 * `hidden` is toggled by the portal once it knows which screen to show, and the fail-safe
 * inline script in index.html changes the text if nothing has started after six seconds.
 */
.evx-boot {
  min-height: 100dvh;
  display: grid;
  place-content: center;
  gap: 6px;
  padding: 24px;
  text-align: center;
  background: var(--bg2, #F6F3EE);
  color: var(--ink, #221F1C);
}
.evx-boot[hidden] { display: none; }
.evx-boot__brand {
  margin: 0;
  font-family: var(--serif, Georgia, "Times New Roman", serif);
  font-size: 26px;
  color: var(--pri, #1F5A4A);
}
.evx-boot__text { margin: 0; color: var(--mut, #6B6560); font-size: 14px; max-width: 46ch; }

/* A keyboard user should not have to tab through the whole sidebar to reach a page. */
.evx-skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 60;
  padding: 10px 14px;
  background: var(--card, #FFFFFF);
  color: var(--ink, #221F1C);
  border-radius: 0 0 8px 0;
}

.evx-skip:focus { left: 0; }

/* ============================== sign in ============================== */

.evx-auth {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}

.evx-auth__card {
  width: 100%;
  max-width: 380px;
  padding: 28px 24px 22px;
  background: var(--card, #FFFFFF);
  border: 1px solid var(--line, #E4DED4);
  border-radius: var(--radius, 16px);
  box-shadow: 0 18px 44px rgba(34, 31, 28, .10);
}

.evx-auth__brand {
  margin: 0;
  letter-spacing: .16em;
  text-transform: uppercase;
  font-size: 12px;
  color: var(--moss, #6E7F62);
}

.evx-auth__title {
  margin: 6px 0 6px;
  font-family: var(--serif, Georgia, serif);
  font-size: 26px;
  font-weight: 600;
}

.evx-auth__lede {
  margin: 0 0 18px;
  color: var(--mut, #6B6560);
  font-size: 14px;
  line-height: 1.5;
}

.evx-field { display: block; margin: 0 0 14px; }

.evx-field > span {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--mut, #6B6560);
}

/* 16px so a phone does not zoom when the field takes focus. */
.evx-field input {
  width: 100%;
  padding: 12px 13px;
  font: 16px/1.35 inherit;
  color: var(--ink, #221F1C);
  background: var(--bg, #FBF9F6);
  border: 1px solid var(--line, #E4DED4);
  border-radius: 10px;
}

.evx-field input:focus-visible {
  outline: 2px solid var(--pri, #1F5A4A);
  outline-offset: 1px;
}

.evx-auth__submit { width: 100%; margin-top: 4px; }

.evx-auth__note {
  margin: 14px 0 0;
  font-size: 13px;
  color: var(--mut, #6B6560);
  text-align: center;
}

/*
 * The registration route under the sign-in control.
 *
 * Full width comes from the shared `.btn.w` on the public stylesheet, so this only owns the
 * spacing: one step below the primary button, and the hint one step below that. Read
 * together the card is "sign in — or, if you have no account, register here", which is the
 * order someone actually decides in. The hint is quieter than the button (12.5px, muted) so
 * it explains the button without becoming a second thing to read.
 */
.evx-auth__signup { margin-top: 10px; }

.evx-auth__hint {
  margin: 8px 0 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--mut, #6B6560);
  text-align: center;
}

.evx-msg { margin: 0 0 14px; padding: 10px 12px; border-radius: 10px; font-size: 14px; }

.evx-msg--bad {
  background: #FBEEEE;
  border: 1px solid #E7C9C9;
  color: #8A2F2F;
}

.evx-msg--good {
  background: #EFF6EF;
  border: 1px solid #CBDDCB;
  color: #2C5C36;
}

/* ============================== shell ============================== */

.evx-shell { min-height: 100dvh; display: grid; grid-template-columns: 244px 1fr; }

/*
 * `hidden` MUST ACTUALLY HIDE.
 *
 * This is the one rule in this file that is load-bearing for correctness rather than for
 * looks, and it was the bug that survived longest.
 *
 * The portal switches between exactly two screens by setting the `hidden` ATTRIBUTE, and
 * the UA stylesheet's `[hidden] { display: none }` is what is supposed to make that work.
 * But an author declaration outranks a UA one, and both `.evx-auth` and `.evx-shell`
 * declare `display: grid`. So marking either one hidden did nothing at all: the sign-in card
 * stayed laid out at 900px tall, kept its place at the top of the document, and pushed the
 * portal down to document-top 900. Signed in, the page opened scrolled past the login card
 * still sitting above it.
 *
 * `.evx-modal[hidden]` and `.evx-boot[hidden]` already carried this override, which is why
 * the modal and the boot line behaved and these two did not. Selector specificity does the
 * work here â€” (0,2,0) against (0,1,0) â€” so no `!important` is needed, and none is wanted.
 */
.evx-auth[hidden],
.evx-shell[hidden] { display: none; }

.evx-side {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 14px;
  background: var(--card, #FFFFFF);
  border-right: 1px solid var(--line, #E4DED4);
}

.evx-side__head { padding: 0 6px; }

.evx-side__brand {
  margin: 0;
  letter-spacing: .16em;
  text-transform: uppercase;
  font-size: 12px;
  color: var(--moss, #6E7F62);
}

.evx-side__sub {
  margin: 2px 0 0;
  font-family: var(--serif, Georgia, serif);
  font-size: 20px;
  font-weight: 600;
}

.evx-nav { display: grid; gap: 2px; overflow-y: auto; }

.evx-nav__link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  font: inherit;
  text-align: left;
  color: var(--ink, #221F1C);
  background: none;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
}

.evx-nav__link:hover { background: var(--bg2, #F6F3EE); }

/* Active is marked by a bar and weight as well as colour, so it is not colour-only. */
.evx-nav__link[aria-current="page"] {
  background: var(--bg2, #F6F3EE);
  font-weight: 700;
  box-shadow: inset 3px 0 0 var(--pri, #1F5A4A);
}

.evx-nav__link:focus-visible {
  outline: 2px solid var(--pri, #1F5A4A);
  outline-offset: 1px;
}

.evx-side__foot { margin-top: auto; display: grid; gap: 8px; }

.evx-who { margin: 0 4px 2px; font-size: 13px; color: var(--mut, #6B6560); word-break: break-word; }

.evx-wide { width: 100%; }

.evx-main { min-width: 0; display: flex; flex-direction: column; }

.evx-top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 22px;
  background: var(--card, #FFFFFF);
  border-bottom: 1px solid var(--line, #E4DED4);
}

.evx-h1 { margin: 0; font-family: var(--serif, Georgia, serif); font-size: 21px; font-weight: 600; }

.evx-burger {
  display: none;
  width: 42px;
  height: 42px;
  padding: 10px;
  background: var(--bg, #FBF9F6);
  border: 1px solid var(--line, #E4DED4);
  border-radius: 10px;
  cursor: pointer;
}

.evx-burger span { display: block; height: 2px; margin: 3px 0; background: var(--ink, #221F1C); }

/*
 * THE VIEW MAY NOT BE WIDER THAN THE COLUMN IT SITS IN.
 *
 * `.evx-view` is a flex item inside `.evx-main`, and it was being sized by its own CONTENT instead: a
 * menu-items table whose min-content is ~790px pushed the view to 869px inside a 768px column, and
 * 901px inside the 780px column that a 1024px window leaves beside the sidebar. The page therefore
 * scrolled sideways at every width between the 760px card breakpoint and roughly 1200px — the range
 * where the sidebar is still a permanent column and the table is still a real table.
 *
 * `min-width: 0` alone did not settle it, because the floor was reaching the view through the panel
 * rather than through the flex algorithm. A percentage `max-width` resolves against the containing
 * block and caps the box outright, which is what lets `.evx-tablewrap`'s `overflow-x: auto` finally do
 * its job: the table scrolls INSIDE the panel instead of dragging the whole page sideways.
 */
.evx-view { padding: 20px 22px 44px; min-width: 0; max-width: 100%; }

/*
 * THE REGION THE PHASE 3 DASHBOARD PANEL LIVES IN.
 *
 * This box is a SIBLING of `#evx-main`, not a child, and that separation is deliberate: the dashboard
 * draws its own cards asynchronously and clears its host when they arrive, so a panel placed inside it
 * is wiped as soon as the counts return. Owning a neighbouring region is what makes the panel survive.
 *
 * The consequence is that it does NOT inherit `.evx-view`'s padding. It had no rule at all, so the
 * panel rendered flush against the window edges while every panel above it was inset by 22px — a
 * layout defect nothing was checking for until the static analysis compared the classes admin-phase3.js
 * uses against the classes the stylesheet defines. Empty and hidden whenever a non-dashboard section is
 * showing, so this only ever has an effect on the dashboard.
 */
.evx-extras { padding: 0 22px 44px; }
.evx-extras[hidden] { display: none; }

.evx-view:focus { outline: none; }

/* The reminder that this portal is not a website CMS yet. Shown once, closeable. */
.evx-scope {
  margin: 14px 22px 0;
  padding: 11px 13px;
  font-size: 13.5px;
  line-height: 1.5;
  color: #5A4A22;
  background: #FBF4E4;
  border: 1px solid #E8D8B0;
  border-radius: 10px;
}

.evx-scope b { color: #4A3C1A; }

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

.evx-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin: 0 0 22px;
}

.evx-card {
  padding: 15px;
  background: var(--card, #FFFFFF);
  border: 1px solid var(--line, #E4DED4);
  border-radius: var(--radius-sm, 12px);
}

.evx-card__label {
  margin: 0;
  font-size: 13px;
  color: var(--mut, #6B6560);
  text-transform: uppercase;
  letter-spacing: .06em;
}

.evx-card__value {
  margin: 6px 0 0;
  font-size: 27px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* An unavailable figure says so; it is never rendered as a zero. */
.evx-card__none { margin: 6px 0 0; font-size: 15px; color: var(--mut, #6B6560); }

.evx-card__note { margin: 4px 0 0; font-size: 12.5px; color: var(--mut, #6B6560); }

.evx-panel {
  margin: 0 0 20px;
  padding: 16px;
  background: var(--card, #FFFFFF);
  border: 1px solid var(--line, #E4DED4);
  border-radius: var(--radius-sm, 12px);
}

.evx-panel__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.evx-panel__title { margin: 0; font-size: 17px; font-weight: 600; }

/* ============================== toolbar ============================== */

.evx-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }

.evx-tools input[type="search"],
.evx-tools select,
.evx-tools input[type="text"] {
  padding: 10px 12px;
  font: 16px/1.3 inherit;
  color: var(--ink, #221F1C);
  background: var(--bg, #FBF9F6);
  border: 1px solid var(--line, #E4DED4);
  border-radius: 10px;
  min-width: 0;
}

.evx-tools input[type="search"] { flex: 1 1 220px; }

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

.evx-tablewrap { overflow-x: auto; }

.evx-table { width: 100%; border-collapse: collapse; font-size: 14.5px; }

.evx-table th,
.evx-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line, #E4DED4);
  vertical-align: top;
}

.evx-table th {
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--mut, #6B6560);
  white-space: nowrap;
}

.evx-table td.num { text-align: right; font-variant-numeric: tabular-nums; }

.evx-table tbody tr:hover { background: var(--bg2, #F6F3EE); }

.evx-badge {
  display: inline-block;
  padding: 3px 9px;
  font-size: 12.5px;
  border-radius: 999px;
  border: 1px solid var(--line, #E4DED4);
  background: var(--bg, #FBF9F6);
  white-space: nowrap;
}

/* Status is carried by the word, never by the tint alone. */
.evx-badge--new { background: #EFF3FA; border-color: #C9D6EA; }
.evx-badge--ok { background: #EFF6EF; border-color: #CBDDCB; }
.evx-badge--warn { background: #FBF4E4; border-color: #E8D8B0; }
.evx-badge--bad { background: #FBEEEE; border-color: #E7C9C9; }

.evx-link {
  font: inherit;
  color: var(--pri, #1F5A4A);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
}

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

.evx-state { padding: 26px 16px; text-align: center; color: var(--mut, #6B6560); }

.evx-state__title { margin: 0 0 4px; font-size: 15.5px; font-weight: 600; color: var(--ink, #221F1C); }

.evx-state__body { margin: 0; font-size: 14px; }

/* Skeleton rows rather than an empty table that looks like "no data". */
.evx-skel { display: grid; gap: 8px; }

.evx-skel span {
  display: block;
  height: 15px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--bg2, #F6F3EE) 25%, #EFEAE2 50%, var(--bg2, #F6F3EE) 75%);
  background-size: 200% 100%;
  animation: adShimmer 1.4s linear infinite;
}

@keyframes adShimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

/* ============================== detail ============================== */

.evx-dl { display: grid; grid-template-columns: 168px 1fr; gap: 7px 14px; margin: 0; font-size: 14.5px; }

.evx-dl dt { color: var(--mut, #6B6560); }

.evx-dl dd { margin: 0; word-break: break-word; }

.evx-pre {
  margin: 0;
  padding: 13px;
  font: 13.5px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--bg, #FBF9F6);
  border: 1px solid var(--line, #E4DED4);
  border-radius: 10px;
}

.evx-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ============================== dialog ============================== */

.evx-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(34, 31, 28, .55);
}

.evx-modal[hidden] { display: none; }

.evx-modal__card {
  width: 100%;
  max-width: 460px;
  max-height: calc(100dvh - 36px);
  overflow-y: auto;
  padding: 20px;
  background: var(--card, #FFFFFF);
  border-radius: var(--radius, 16px);
  box-shadow: 0 22px 54px rgba(34, 31, 28, .3);
}

.evx-modal__title { margin: 0 0 6px; font-size: 18px; font-weight: 600; }

.evx-modal__body { margin: 0 0 16px; font-size: 14.5px; color: var(--mut, #6B6560); line-height: 1.55; }

.evx-modal__acts { display: flex; flex-wrap: wrap; gap: 9px; justify-content: flex-end; }

.evx-form { display: grid; gap: 12px; }

/* ============================== toasts ============================== */

.evx-toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 90;
  display: grid;
  gap: 8px;
  width: min(360px, calc(100vw - 32px));
}

.evx-toast {
  padding: 12px 14px;
  font-size: 14px;
  border-radius: 10px;
  background: var(--card, #FFFFFF);
  border: 1px solid var(--line, #E4DED4);
  box-shadow: 0 10px 26px rgba(34, 31, 28, .16);
}

.evx-toast--ok { border-color: #CBDDCB; background: #EFF6EF; color: #2C5C36; }
.evx-toast--bad { border-color: #E7C9C9; background: #FBEEEE; color: #8A2F2F; }

/* ============================== narrow ============================== */

@media (max-width: 860px) {
  .evx-shell { grid-template-columns: 1fr; }

  /* The sidebar becomes a drawer rather than being squeezed into a strip. */
  .evx-side {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 70;
    width: min(280px, 84vw);
    transform: translateX(-102%);
    transition: transform .22s ease;
    box-shadow: 14px 0 40px rgba(34, 31, 28, .22);
  }

  .evx-side[data-open="true"] { transform: none; }

  .evx-burger { display: block; }

  .evx-dl { grid-template-columns: 1fr; }

  .evx-dl dt { margin-top: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  .evx-side { transition: none; }
  .evx-skel span { animation: none; }
}

/* Wide data tables become stacked cards, so nothing is cut off on a phone. */
@media (max-width: 700px) {
  .evx-tablewrap { overflow-x: visible; }

  .evx-table, .evx-table tbody, .evx-table tr, .evx-table td { display: block; width: 100%; }

  .evx-table thead { display: none; }

  .evx-table tr {
    margin-bottom: 10px;
    padding: 10px 12px;
    background: var(--bg, #FBF9F6);
    border: 1px solid var(--line, #E4DED4);
    border-radius: 10px;
  }

  .evx-table td { border: 0; padding: 4px 0; }

  .evx-table td::before {
    content: attr(data-th) " ";
    display: block;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--mut, #6B6560);
  }

  .evx-table td.num { text-align: left; }
}

/* ==========================================================================================
   PHASE 3 — CATALOGUE, PACKAGE BUILDER AND MEDIA LIBRARY
   ==========================================================================================

   Appended rather than woven in, so every rule that was already verified keeps its position and its
   precedence. Everything here composes with the existing system: the same `var(--token, literal)`
   fallback pattern the rest of this file uses, and the classes the portal already defined
   (.evx-panel, .evx-cards, .evx-card, .evx-tools, .evx-table, .evx-field, .evx-view) are reused
   rather than redefined.

   Layout is mobile-first in the two places that matter — the sidebar grouping and the data tables —
   because those are where a narrow screen actually breaks. The narrow-screen rule at the foot turns
   each table row into a labelled card rather than letting it overflow horizontally, which is what
   the 320px requirement really asks for.
   ------------------------------------------------------------------------------------------ */

/* ------------------------------------------------------------------ nav groups --- */

.evx-nav__group {
  margin: 14px 0 4px;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mut, #6B6560);
}

.evx-nav__group:first-child { margin-top: 4px; }

.evx-nav__link--sub {
  padding-left: 20px;
  font-size: 14px;
}

/* ------------------------------------------------------------------- toolbar --- */

.evx-filterbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 0 0 14px;
}

.evx-filterbar input[type="search"],
.evx-filterbar select {
  padding: 8px 10px;
  border: 1px solid var(--line, #E7E1D8);
  border-radius: 8px;
  background: #fff;
  color: inherit;
  font: inherit;
  font-size: 14px;
  min-width: 0;
}

.evx-filterbar input[type="search"] { flex: 1 1 240px; }
.evx-filterbar select { flex: 0 1 190px; }

.evx-filterbar input[type="search"]:focus-visible,
.evx-filterbar select:focus-visible {
  outline: 2px solid var(--accent, #8C6A3F);
  outline-offset: 1px;
}

.evx-tools--start { justify-content: flex-start; }

/* --------------------------------------------------------------------- tags --- */

.evx-tag {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--line, #E7E1D8);
  background: var(--bg2, #F6F3EE);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.evx-tag--ok { background: #E8F3EA; border-color: #BEDCC4; color: #245C33; }
.evx-tag--warn { background: #FBF3E2; border-color: #E7D5AC; color: #6B4E14; }
.evx-tag--muted { background: var(--bg2, #F6F3EE); color: var(--mut, #6B6560); }

/* -------------------------------------------------------------------- table --- */

.evx-th--sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.evx-th--sortable:focus-visible {
  outline: 2px solid var(--accent, #8C6A3F);
  outline-offset: -2px;
}

.evx-sort {
  display: inline-block;
  margin-left: 5px;
  font-size: 10px;
  color: var(--mut, #6B6560);
}

.evx-th--actions,
.evx-td--actions { text-align: right; white-space: nowrap; }

.evx-cell-primary { display: flex; align-items: center; gap: 10px; min-width: 0; }

.evx-cell-name { display: block; font-weight: 600; }

.evx-cell-sub {
  display: block;
  font-size: 11.5px;
  color: var(--mut, #6B6560);
}

.evx-thumb {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line, #E7E1D8);
  background: var(--bg2, #F6F3EE);
}

.evx-thumb--none {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--mut, #6B6560);
  font-size: 14px;
}

.evx-clamp { display: inline-block; max-width: 42ch; }

.evx-rowactions { display: inline-flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }

.evx-btn--sm { padding: 5px 10px; font-size: 13px; }

.evx-btn--danger {
  background: #9C2B20;
  border-color: #9C2B20;
  color: #fff;
}

.evx-btn--danger:hover { background: #83231A; }

/* ------------------------------------------------------------------- pager --- */

.evx-pager {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  margin-top: 14px;
}

.evx-pager__info { font-size: 13.5px; color: var(--mut, #6B6560); }

/* ------------------------------------------------------------------- misc --- */

.evx-muted { color: var(--mut, #6B6560); font-size: 13.5px; }
.evx-readonly { margin: 4px 0 0; font-size: 14px; font-variant-numeric: tabular-nums; }
.evx-sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.evx-summary {
  display: flex; flex-wrap: wrap; gap: 20px;
  padding: 12px 14px; margin: 0 0 14px;
  border: 1px solid var(--line, #E7E1D8); border-radius: 10px;
  background: var(--bg2, #F6F3EE);
}

.evx-summary__item { display: grid; gap: 2px; }
.evx-summary__k { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--mut, #6B6560); }
.evx-summary__v { font-size: 15px; font-weight: 600; }

.evx-panel--extras { margin-top: 18px; }

/* ------------------------------------------------------------------- modal --- */

.evx-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 14px;
  overflow-y: auto;
  background: rgba(24, 20, 16, 0.48);
}

.evx-modal__box {
  width: 100%;
  max-width: 560px;
  margin: auto;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
  outline: none;
}

.evx-modal__box--wide { max-width: 860px; }

.evx-modal__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 0;
}

.evx-modal__title { margin: 0; font-size: 18px; }

.evx-modal__close {
  flex: 0 0 auto;
  width: 32px; height: 32px;
  border: 1px solid var(--line, #E7E1D8);
  border-radius: 8px;
  background: #fff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.evx-modal__close:hover { background: var(--bg2, #F6F3EE); }
.evx-modal__lede { margin: 8px 18px 0; font-size: 13.5px; color: var(--mut, #6B6560); }
.evx-modal__body { padding: 16px 18px; }
.evx-modal__foot {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  padding: 0 18px 18px;
}

.evx-modal__close:focus-visible,
.evx-modal :focus-visible {
  outline: 2px solid var(--accent, #8C6A3F);
  outline-offset: 2px;
}

/* -------------------------------------------------------------------- form --- */

.evx-formgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.evx-field--wide { grid-column: 1 / -1; }
.evx-field__label { display: block; margin-bottom: 4px; font-size: 13.5px; font-weight: 600; }
.evx-field__help { display: block; margin-top: 4px; font-size: 12.5px; color: var(--mut, #6B6560); }
.evx-field__note { display: block; margin-top: 3px; font-size: 12.5px; color: var(--mut, #6B6560); }
.evx-req { margin-left: 3px; color: #9C2B20; text-decoration: none; border: 0; }

.evx-field textarea {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--line, #E7E1D8);
  border-radius: 8px;
  font: inherit;
  font-size: 14.5px;
  resize: vertical;
}

.evx-field select { width: 100%; }

.evx-check { display: inline-flex; align-items: center; gap: 8px; }
.evx-check input { width: 18px; height: 18px; }

.evx-formproblem {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid #E4B7B0;
  border-radius: 10px;
  background: #FDF2F0;
  color: #7C241B;
  font-size: 14px;
}

.evx-formproblem p { margin: 0; }
.evx-formproblem__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

/* ------------------------------------------------------------------ images --- */

.evx-imagebox { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-start; }
.evx-imagebox__frame {
  flex: 0 0 140px; width: 140px; height: 108px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line, #E7E1D8); border-radius: 10px;
  background: var(--bg2, #F6F3EE); overflow: hidden;
}
.evx-imagebox__frame img { width: 100%; height: 100%; object-fit: cover; }
.evx-imagebox__meta { flex: 1 1 220px; min-width: 0; }
.evx-imagebox__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

.evx-uploadpreview { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 10px 0; }
.evx-uploadpreview .evx-mediacard__frame { flex: 0 0 120px; width: 120px; height: 96px; }

.evx-progress {
  height: 8px;
  margin: 10px 0 4px;
  border-radius: 999px;
  background: var(--bg2, #F6F3EE);
  overflow: hidden;
}

.evx-progress__fill {
  display: block; height: 100%; width: 0;
  background: var(--accent, #8C6A3F);
  transition: width 160ms linear;
}

/* -------------------------------------------------------------- media grid --- */

.evx-mediagrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
}

.evx-mediagrid--pick { max-height: 52vh; overflow-y: auto; }

.evx-mediacard {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line, #E7E1D8);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
  min-width: 0;
}

.evx-mediacard__frame {
  height: 132px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg2, #F6F3EE);
  overflow: hidden;
}

.evx-mediacard__frame img { width: 100%; height: 100%; object-fit: cover; }
.evx-mediacard__frame--wide { height: 220px; margin-bottom: 12px; border-radius: 10px; }
.evx-mediacard__info { padding: 10px 12px; display: grid; gap: 3px; }
.evx-mediacard__name { margin: 0; font-size: 14px; font-weight: 600; word-break: break-word; }
.evx-mediacard__meta { margin: 0; font-size: 12.5px; color: var(--mut, #6B6560); }
.evx-mediacard__actions { padding: 0 12px 12px; display: flex; flex-wrap: wrap; gap: 6px; }

.evx-mediacard--pick { text-align: left; cursor: pointer; font: inherit; padding: 0; }
.evx-mediacard--pick:hover { border-color: var(--accent, #8C6A3F); }
.evx-mediacard--pick:focus-visible { outline: 2px solid var(--accent, #8C6A3F); outline-offset: 2px; }
.evx-mediacard--pick.is-selected { border-color: var(--accent, #8C6A3F); box-shadow: 0 0 0 2px rgba(140, 106, 63, 0.28); }
.evx-mediacard--pick[disabled] { opacity: 0.55; cursor: not-allowed; }

.evx-picklist { display: grid; gap: 8px; }
.evx-pick {
  display: flex; flex-direction: column; gap: 2px;
  padding: 10px 12px; text-align: left;
  border: 1px solid var(--line, #E7E1D8); border-radius: 10px;
  background: #fff; font: inherit; cursor: pointer;
}
.evx-pick:hover { background: var(--bg2, #F6F3EE); }
.evx-pick.is-selected { border-color: var(--accent, #8C6A3F); box-shadow: 0 0 0 2px rgba(140, 106, 63, 0.28); }
.evx-pick:focus-visible { outline: 2px solid var(--accent, #8C6A3F); outline-offset: 2px; }
.evx-pick__name { font-weight: 600; font-size: 14.5px; }
.evx-pick__meta { font-size: 12.5px; color: var(--mut, #6B6560); }

/* =========================================================================
   NARROW SCREENS
   =========================================================================
   Below 760px each table row becomes a labelled card. `data-label` on every
   cell carries the column heading, so nothing is lost when the header row is
   hidden — the label travels with the value. This is the rule that stops a
   wide catalogue table from forcing a horizontal scrollbar at 320px.
   ========================================================================= */

@media (max-width: 760px) {
  .evx-formgrid { grid-template-columns: 1fr; }
  .evx-mediagrid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }

  .evx-tablewrap { overflow-x: visible; }
  .evx-table, .evx-table thead, .evx-table tbody, .evx-table tr, .evx-table td { display: block; width: 100%; }
  .evx-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .evx-table tr {
    border: 1px solid var(--line, #E7E1D8);
    border-radius: 12px;
    margin-bottom: 12px;
    padding: 10px 12px;
    background: #fff;
  }
  .evx-table td {
    border: 0;
    padding: 5px 0;
    display: flex;
    gap: 10px;
    align-items: baseline;
    text-align: left;
    white-space: normal;
  }
  .evx-table td::before {
    content: attr(data-label);
    flex: 0 0 38%;
    max-width: 38%;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--mut, #6B6560);
  }
  .evx-table td[data-label=""]::before { content: none; }
  .evx-td--actions { justify-content: flex-start; }
  .evx-td--actions::before { content: none; }
  .evx-rowactions { justify-content: flex-start; }
  .evx-clamp { max-width: none; }

  .evx-modal { padding: 0; align-items: stretch; }
  .evx-modal__box { max-width: none; border-radius: 0; min-height: 100%; }
  .evx-modal__foot { padding-bottom: 24px; }
  .evx-pager { justify-content: space-between; }
}

/* 320px is the narrowest width worth defending. The sidebar already collapses to a drawer at
   860px; what is tightened here is the remaining fixed-width furniture. */
@media (max-width: 380px) {
  .evx-view { padding: 14px 12px 40px; }
  /* The extras region tracks the view's inset, so the two stay aligned on a narrow screen. */
  .evx-extras { padding: 0 12px 40px; }
  .evx-imagebox__frame { flex: 0 0 108px; width: 108px; height: 84px; }
  .evx-mediagrid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .evx-mediacard__frame { height: 104px; }
  .evx-filterbar input[type="search"],
  .evx-filterbar select { flex: 1 1 100%; }
  .evx-table td::before { flex: 0 0 44%; max-width: 44%; }
}

@media (prefers-reduced-motion: reduce) {
  .evx-progress__fill { transition: none; }
}
