/**
 * Medallion XLN — shared UI primitives
 * Location: /public_html/nav/xln-ui.css
 *
 * Stages 1–3 of the UX consolidation: page containers and headers, button
 * hierarchy, cards, forms, and empty/loading/error states.
 *
 * WHY THIS IS SAFE TO SHIP INTO TEN LIVE ROUTES
 * ---------------------------------------------
 * Loaded from nav/markup.php, which every authenticated surface already shares
 * (verified: /profile /timeline /messages /community /my-apps /agents /docs
 * /wallet /dashboard /settings all include nav/sidebar.php → markup.php).
 *
 * Every rule is namespaced under `.xui-`. There is not one bare element
 *
 * NAMESPACE HISTORY — why `xui-` and not `xln-`
 * ---------------------------------------------------------------------------
 * These primitives originally used `.xln-`. That collided with `.xln-page`,
 * a plain layout wrapper profile/index.php had already used for a long time
 * with no styles attached to it. The moment this sheet shipped, it claimed
 * that class and applied `color: var(--xln-text)` — the dark-theme near-white
 * — so every post on the light profile page became unreadable.
 *
 * The safety check that missed it only inspected /timeline's rendered markup.
 * Before adding any new namespace, grep the whole of public_html for the
 * prefix, not just the page in front of you.
 * selector, not one reset, and nothing that targets an existing class. A page
 * that does not opt in renders byte-identically to before. Adoption is
 * therefore incremental and reversible per route, which is what makes this
 * shippable without a regression suite.
 *
 * Tokens are read from the existing sidebar variables where they exist, with
 * literal fallbacks, so this inherits the product's language rather than
 * introducing a second one.
 */

:root {
  /* Use the shell's spacing scale. The aliases preserve existing component APIs. */
  --xln-s1: var(--mx-space-1, 4px);
  --xln-s2: var(--mx-space-2, 8px);
  --xln-s3: var(--mx-space-3, 12px);
  --xln-s4: var(--mx-space-4, 16px);
  --xln-s5: var(--mx-space-5, 24px);
  --xln-s6: var(--mx-space-6, 32px);
  --xln-s7: var(--mx-space-7, 48px);
  --xln-s8: var(--mx-space-8, 64px);

  --xln-radius:    var(--mx-radius-card, 16px);
  --xln-radius-sm: var(--mx-radius-button, 10px);
  --xln-radius-lg: var(--mx-radius-dialog, 20px);

  /* Surfaces. Defaults suit the dark console; the light-scheme block below
     overrides them for surfaces that render light. */
  --xln-bg:        #0B0B14;
  --xln-surface:   #14141F;
  --xln-raised:    #1B1B28;
  --xln-line:      rgba(255, 255, 255, .09);
  --xln-line-firm: rgba(255, 255, 255, .16);

  --xln-text:      #E8E8F0;
  --xln-muted:     #9C9CB0;
  --xln-dim:       #64647A;

  /* UX Stage 1: the primary accent is Medallion gold (nav/shell.css
     --mx-accent-gold). It was a purple no other surface used for primary
     actions. Surfaces with their own accent (Opportunity: navy) override
     --xln-accent and --xln-accent-ink together. */
  --xln-accent:    var(--mx-accent-gold, #F9C94C);
  --xln-accent-ink: var(--mx-accent-gold-ink, #0A0A0F);
  --xln-accent-soft: rgba(249, 201, 76, .18);
  --xln-accent-2:  #FF4FD8;
  --xln-ok:        #34D399;
  --xln-warn:      #FBBF24;
  --xln-danger:    #F43F5E;

  --xln-fast: var(--mx-dur-fast, 150ms) var(--mx-ease, cubic-bezier(.16, 1, .3, 1));
  --xln-mid:  var(--mx-dur-mid, 220ms) var(--mx-ease, cubic-bezier(.16, 1, .3, 1));

  --xln-max:   1200px;   /* standard content width */
  --xln-max-narrow: 780px;
}

/* The light theme (UX3: html[data-theme="light"], set by nav/theme-head.php).
   .xui-light is the pre-UX3 per-surface opt-in, kept as an alias. Values are
   the shell's semantic tokens so every primitive matches the rest of the page. */
html[data-theme="light"],
.xui-light {
  --xln-bg:        var(--mx-app-bg, #F6F4EF);
  --xln-surface:   var(--mx-surface-primary, #FFFFFF);
  --xln-raised:    var(--mx-surface-secondary, #F1EEE7);
  --xln-line:      var(--mx-border-default, rgba(20, 26, 46, .12));
  --xln-line-firm: var(--mx-border-strong, rgba(20, 26, 46, .22));
  --xln-text:      var(--mx-text-primary, #141A2E);
  --xln-muted:     var(--mx-text-secondary, #3A4254);
  --xln-dim:       var(--mx-text-muted, #5B6374);
  --xln-accent-soft: var(--mx-accent-gold-soft, rgba(201, 146, 31, .12));
  --xln-accent-2:  #B0138F;
  --xln-ok:        var(--mx-success, #0B7A4B);
  --xln-warn:      var(--mx-warning, #8F5600);
  --xln-danger:    var(--mx-danger, #B42318);
}

/* ============================================================
   STAGE 2 — PAGE CONTAINER + HEADER STANDARD
   ============================================================ */

.xui-page {
  max-width: var(--xln-max);
  margin: 0 auto;
  padding: var(--xln-s6) var(--xln-s5) var(--xln-s8);
  color: var(--xln-text);
}
.xui-page--narrow { max-width: var(--xln-max-narrow); }
.xui-page--wide   { max-width: none; }

/* Context line above the title. Answers "where am I and how do I get back",
   which is the context-loss problem the brief names. */
.xui-crumbs {
  display: flex; align-items: center; gap: var(--xln-s2);
  font-size: 12px; color: var(--xln-dim); margin-bottom: var(--xln-s2);
  flex-wrap: wrap;
}
.xui-crumbs a { color: var(--xln-muted); text-decoration: none; }
.xui-crumbs a:hover { color: var(--xln-text); text-decoration: underline; }
.xui-crumbs-sep { opacity: .5; }

/*  [context]
 *  TITLE                          [secondary] [primary]
 *  short explanation
 *
 * One dominant action per surface, always in the same corner. */
.xui-head {
  display: flex; align-items: flex-start; gap: var(--xln-s4);
  flex-wrap: wrap; margin-bottom: var(--xln-s6);
}
.xui-head-main { flex: 1 1 320px; min-width: 0; }
.xui-title {
  margin: 0; font-size: clamp(22px, 2.4vw, 30px); font-weight: 700;
  letter-spacing: -.025em; line-height: 1.2; color: var(--xln-text);
  text-wrap: balance;
}
.xui-subtitle {
  margin: var(--xln-s2) 0 0; font-size: 15px; line-height: 1.6;
  color: var(--xln-muted); max-width: 62ch;
}
.xui-head-actions {
  display: flex; align-items: center; gap: var(--xln-s2);
  flex-shrink: 0; flex-wrap: wrap;
}

/* ============================================================
   STAGE 3 — BUTTON HIERARCHY
   Exactly one primary per region. Destructive never looks primary.
   ============================================================ */

.xui-btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--xln-s2);
  padding: 10px 18px; min-height: var(--mx-touch-min, 44px);
  border-radius: var(--xln-radius-sm);
  border: 1px solid transparent;
  font: inherit; font-size: 14px; font-weight: 600;
  line-height: 1; cursor: pointer; text-decoration: none;
  transition: background-color var(--xln-fast), border-color var(--xln-fast),
              color var(--xln-fast), opacity var(--xln-fast);
  white-space: nowrap;
}
.xui-btn:focus-visible { outline: 2px solid var(--mx-focus-ring-color, var(--xln-accent)); outline-offset: 2px; }
.xui-btn[disabled], .xui-btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }

.xui-btn--primary   { background: var(--xln-accent); color: var(--xln-accent-ink); }
.xui-btn--primary:hover:not([disabled]) { filter: brightness(1.07); }
.xui-btn--primary:active:not([disabled]) { filter: brightness(.94); }

.xui-btn--secondary { background: transparent; color: var(--xln-text); border-color: var(--xln-line-firm); }
.xui-btn--secondary:hover:not([disabled]) { background: var(--mxc-xui-1); }

.xui-btn--tertiary  { background: transparent; color: var(--xln-muted); padding-inline: 10px; }
.xui-btn--tertiary:hover:not([disabled]) { color: var(--xln-text); background: var(--mxc-xui-2); }

/* Outlined, never solid — a destructive action must not be reachable by
   muscle memory trained on the primary button. */
.xui-btn--danger {
  background: transparent; color: var(--mxc-xui-3); border-color: rgba(244,63,94,.5);
}
.xui-btn--danger:hover:not([disabled]) { background: rgba(244,63,94,.14); color: var(--mxc-xui-4); }

.xui-btn--icon { padding: 0; width: 44px; min-height: 44px; }
.xui-btn--sm   { min-height: 44px; padding: 8px 12px; font-size: 13px; }
.xui-btn--block{ width: 100%; }

/* ============================================================
   CARDS
   ============================================================ */

.xui-card {
  background: var(--xln-surface);
  border: 1px solid var(--xln-line);
  border-radius: var(--xln-radius);
  padding: var(--xln-s5);
}
.xui-card--flush   { padding: 0; overflow: hidden; }
.xui-card--raised  { background: var(--xln-raised); }
.xui-card--link {
  display: block; text-decoration: none; color: inherit;
  transition: border-color var(--xln-fast), transform var(--xln-fast);
}
.xui-card--link:hover { border-color: var(--xln-line-firm); transform: translateY(-2px); }

.xui-card-head {
  display: flex; align-items: center; gap: var(--xln-s2);
  padding: var(--xln-s4) var(--xln-s5); border-bottom: 1px solid var(--xln-line);
}
.xui-card-title {
  margin: 0; font-size: 14px; font-weight: 700; letter-spacing: -.01em;
  line-height: 1.4; color: var(--xln-text);
}
.xui-card-body { padding: var(--xln-s5); }
.xui-card-spacer { flex: 1; }

.xui-grid { display: grid; gap: var(--xln-s4); }
.xui-grid--2 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.xui-grid--3 { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }

/* ============================================================
   FORMS — one form language, not one per route
   ============================================================ */

.xui-field { display: grid; gap: var(--xln-s2); margin-bottom: var(--xln-s4); }
.xui-label { font-size: 13px; font-weight: 600; color: var(--xln-text); }
.xui-label .xui-req { color: var(--xln-danger); margin-left: 2px; }
.xui-hint  { font-size: 13px; color: var(--xln-dim); line-height: 1.5; }

.xui-input, .xui-select, .xui-textarea {
  box-sizing: border-box; width: 100%; min-height: 44px;
  padding: 10px 12px; font: inherit; font-size: 14px;
  color: var(--xln-text); background: var(--xln-raised);
  border: 1px solid var(--xln-line-firm); border-radius: var(--xln-radius-sm);
  transition: border-color var(--xln-fast);
}
.xui-input:focus, .xui-select:focus, .xui-textarea:focus {
  outline: 2px solid var(--mx-focus-ring-color); outline-offset: 2px;
  border-color: var(--xln-accent);
}
.xui-textarea { min-height: 96px; resize: vertical; }
@media (max-width: 768px) {
  .xui-input, .xui-select, .xui-textarea { font-size: 16px; }
}

/* Invalid state carries an icon-free text message, never colour alone. */
.xui-field[data-invalid="1"] .xui-input,
.xui-field[data-invalid="1"] .xui-select,
.xui-field[data-invalid="1"] .xui-textarea { border-color: var(--xln-danger); }
.xui-error-text { font-size: 12px; color: var(--mxc-xui-3); }

/* Save/Cancel always in the same order and the same place. */
.xui-form-actions {
  display: flex; align-items: center; gap: var(--xln-s2);
  padding-top: var(--xln-s4); margin-top: var(--xln-s4);
  border-top: 1px solid var(--xln-line);
}
.xui-form-actions .xui-spacer { flex: 1; }

/* ============================================================
   STATE — the brief's list, one visual language
   ============================================================ */

.xui-status {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700; letter-spacing: .04em;
  padding: 3px 9px; border-radius: 999px;
  background: var(--mxc-xui-5); color: var(--xln-muted);
}
.xui-status::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; flex-shrink: 0;
}
/* State is always written as a word too — never signalled by colour alone. */
.xui-status[data-state="live"]      { background: rgba(244,63,94,.16);  color: var(--mxc-xui-3); }
.xui-status[data-state="connected"],
.xui-status[data-state="saved"],
.xui-status[data-state="published"] { background: rgba(52,211,153,.14); color: var(--xln-ok); }
.xui-status[data-state="saving"],
.xui-status[data-state="sending"],
.xui-status[data-state="pending"],
.xui-status[data-state="loading"]   { background: rgba(251,191,36,.14); color: var(--xln-warn); }
.xui-status[data-state="error"],
.xui-status[data-state="offline"],
.xui-status[data-state="disconnected"] { background: rgba(244,63,94,.14); color: var(--mxc-xui-3); }
.xui-status[data-state="draft"],
.xui-status[data-state="paused"]    { background: var(--mxc-xui-5); color: var(--xln-muted); }
.xui-status[data-state="live"]::before { animation: xui-pulse 1.6s infinite; }
@keyframes xui-pulse { 0%,100% { opacity: 1 } 50% { opacity: .35 } }

/* EMPTY — must answer: what is this, why is it empty, what next. */
.xui-empty {
  text-align: center; padding: var(--xln-s7) var(--xln-s5);
  border: 1px dashed var(--xln-line-firm); border-radius: var(--xln-radius);
}
.xui-empty-title { font-size: 15px; font-weight: 700; color: var(--xln-text); }
.xui-empty-body  {
  font-size: 13px; color: var(--xln-muted); margin: var(--xln-s2) auto 0;
  max-width: 46ch; line-height: 1.6;
}
.xui-empty-actions { margin-top: var(--xln-s4); display: flex; gap: var(--xln-s2); justify-content: center; flex-wrap: wrap; }

/* LOADING — skeletons for predictable layouts, not a full-screen spinner. */
.xui-skel {
  background: linear-gradient(90deg, var(--mxc-xui-2) 25%, var(--mxc-xui-6) 37%, var(--mxc-xui-2) 63%);
  background-size: 400% 100%;
  animation: xui-shimmer 1.4s ease infinite;
  border-radius: var(--xln-radius-sm);
}
@keyframes xui-shimmer { 0% { background-position: 100% 50% } 100% { background-position: 0 50% } }
.xui-skel--text  { height: 12px; margin-bottom: var(--xln-s2); }
.xui-skel--title { height: 20px; width: 42%; margin-bottom: var(--xln-s3); }
.xui-skel--card  { height: 120px; }
.xui-skel--avatar{ width: 40px; height: 40px; border-radius: 50%; }

/* Inline spinner for an in-progress action, sized to its button. */
.xui-spinner {
  width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: xui-spin .7s linear infinite;
}
@keyframes xui-spin { to { transform: rotate(360deg) } }

/* ERROR — every error offers a next action. */
.xui-alert {
  display: flex; gap: var(--xln-s3); align-items: flex-start;
  padding: var(--xln-s4); border-radius: var(--xln-radius-sm);
  border: 1px solid var(--xln-line-firm); background: var(--xln-raised);
}
.xui-alert[data-kind="error"]   { border-color: rgba(244,63,94,.42); background: rgba(244,63,94,.09); }
.xui-alert[data-kind="warn"]    { border-color: rgba(251,191,36,.42); background: rgba(251,191,36,.09); }
.xui-alert[data-kind="success"] { border-color: rgba(52,211,153,.42); background: rgba(52,211,153,.09); }
.xui-alert-body { flex: 1; min-width: 0; }
.xui-alert-title { font-size: 14px; font-weight: 700; color: var(--xln-text); }
.xui-alert-text  { font-size: 13px; color: var(--xln-muted); margin-top: 2px; line-height: 1.55; }
.xui-alert-actions { margin-top: var(--xln-s3); display: flex; gap: var(--xln-s2); }

/* ============================================================
   UX STAGE 1 — shared primitives the platform uses everywhere but
   had no common form for. Tokens come from nav/shell.css (--mx-*),
   with literal fallbacks so this sheet still stands on its own.
   ============================================================ */

/* Type roles. A page states the role, never a pixel size. */
.xui-type-display       { font: 700 var(--mx-type-display, 36px)/1.08 var(--mx-font-display, inherit); letter-spacing: -.02em; }
.xui-type-page-title    { font: 700 var(--mx-type-page-title, 28px)/1.15 var(--mx-font-display, inherit); letter-spacing: -.01em; }
.xui-type-section-title { font: 700 var(--mx-type-section-title, 18px)/1.25 var(--mx-font-display, inherit); }
.xui-type-card-title    { font: 600 var(--mx-type-card-title, 15px)/1.35 var(--mx-font-body, inherit); }
.xui-type-body          { font: 400 var(--mx-type-body, 15px)/1.6 var(--mx-font-body, inherit); }
.xui-type-body-small    { font: 400 var(--mx-type-body-small, 13px)/1.55 var(--mx-font-body, inherit); }
.xui-type-label         { font: 600 var(--mx-type-label, 13px)/1.3 var(--mx-font-body, inherit); }
.xui-type-caption       { font: 400 var(--mx-type-caption, 12px)/1.45 var(--mx-font-body, inherit); color: var(--xln-muted); }
.xui-type-metadata      { font: 600 var(--mx-type-metadata, 11px)/1.3 var(--mx-font-body, inherit); letter-spacing: .08em; text-transform: uppercase; color: var(--xln-dim); }
.xui-type-mono          { font: 500 var(--mx-type-mono, 12.5px)/1.4 var(--mx-font-mono, monospace); }

/* Section header: title left, at most one action right. */
.xui-section-head {
  display: flex; align-items: center; gap: var(--xln-s3); flex-wrap: wrap;
  margin: 0 0 var(--xln-s4);
}
.xui-section-head > :first-child { flex: 1 1 auto; min-width: 0; margin: 0; }

/* Icon-only button. aria-label is mandatory — the icon is not a name. */
.xui-btn--icon { color: var(--xln-muted); background: transparent; border-color: transparent; }
.xui-btn--icon:hover:not([disabled]) { color: var(--xln-text); background: var(--mxc-xui-1); }

/* Search field: icon + input in one bordered control. */
.xui-search {
  display: flex; align-items: center; gap: var(--xln-s2); min-width: 0;
  min-height: 40px; padding: 0 12px; box-sizing: border-box;
  background: var(--xln-raised); border: 1px solid var(--xln-line-firm);
  border-radius: var(--xln-radius-sm); color: var(--xln-muted);
}
.xui-search:focus-within { border-color: var(--xln-accent); box-shadow: 0 0 0 3px var(--xln-accent-soft); }
.xui-search input {
  flex: 1 1 auto; min-width: 0; border: 0; outline: 0; background: transparent;
  font: inherit; font-size: 14px; color: var(--xln-text); padding: 8px 0;
}

/* Tabs (role="tablist" / role="tab" + aria-selected) and segmented control
   (aria-pressed). Tabs scroll horizontally on narrow screens rather than
   wrapping into a second row. */
.xui-tabs {
  display: flex; gap: var(--xln-s1); overflow-x: auto; scrollbar-width: none;
  border-bottom: 1px solid var(--xln-line);
}
.xui-tabs::-webkit-scrollbar { display: none; }
.xui-tab {
  flex: 0 0 auto; min-height: 40px; padding: 0 14px; margin: 0 0 -1px;
  border: 0; border-bottom: 2px solid transparent; background: none;
  font: inherit; font-size: 14px; font-weight: 600; color: var(--xln-muted);
  cursor: pointer; white-space: nowrap;
}
.xui-tab:hover { color: var(--xln-text); }
.xui-tab[aria-selected="true"], .xui-tab[aria-current="page"] { color: var(--xln-text); border-bottom-color: var(--xln-accent); }

.xui-seg {
  display: inline-flex; gap: 2px; padding: 3px; max-width: 100%; overflow-x: auto;
  background: var(--xln-raised); border: 1px solid var(--xln-line); border-radius: 999px;
}
.xui-seg > button {
  flex: 0 0 auto; min-height: 32px; padding: 0 14px; border: 0; border-radius: 999px;
  background: transparent; color: var(--xln-muted); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}
.xui-seg > button[aria-pressed="true"] { background: var(--xln-surface); color: var(--xln-text); box-shadow: 0 1px 2px rgba(var(--mx-shadow-rgb), calc(0.25 * var(--mx-shadow-k))); }

/* Chips are interactive filters; badges are read-only labels. */
.xui-chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 12px;
  border: 1px solid var(--xln-line-firm); border-radius: 999px; background: transparent;
  color: var(--xln-muted); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.xui-chip:hover { color: var(--xln-text); }
.xui-chip[aria-pressed="true"], .xui-chip[aria-selected="true"] {
  color: var(--xln-text); border-color: var(--xln-accent); background: var(--xln-accent-soft);
}
.xui-badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: .02em; line-height: 1.5;
  background: var(--mxc-xui-5); color: var(--xln-muted);
}
.xui-badge[data-tone="success"] { background: rgba(52,211,153,.14); color: var(--xln-ok); }
.xui-badge[data-tone="warning"] { background: rgba(251,191,36,.14); color: var(--xln-warn); }
.xui-badge[data-tone="danger"]  { background: rgba(244,63,94,.14);  color: var(--mxc-xui-3); }
.xui-badge[data-tone="info"]    { background: rgba(91,184,255,.14); color: var(--mxc-xui-7); }
.xui-badge[data-tone="accent"]  { background: var(--xln-accent-soft); color: var(--xln-accent); }

/* Selected / loading states for any control. */
.xui-is-selected { background: var(--mx-selected-bg, rgba(249,201,76,.12)); }
[aria-busy="true"].xui-btn { cursor: progress; }

/* Layout variants. A page opts into a contextual panel; it never invents a
   shell. On phones the panel follows the primary content, and a page should
   wrap it in .xui-disclosure so secondary context collapses. */
.xui-layout { display: grid; gap: var(--xln-s5); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1180px) {
  .xui-layout:has(> .xui-layout-context) { grid-template-columns: minmax(0, 1fr) minmax(280px, 340px); }
}
.xui-layout > * { min-width: 0; }

.xui-disclosure { border: 1px solid var(--xln-line); border-radius: var(--xln-radius); background: var(--xln-surface); }
.xui-disclosure > summary {
  display: flex; align-items: center; justify-content: space-between; gap: var(--xln-s2);
  min-height: 44px; padding: 0 var(--xln-s4); cursor: pointer; list-style: none;
  font-size: 14px; font-weight: 600; color: var(--xln-text);
}
.xui-disclosure > summary::-webkit-details-marker { display: none; }
.xui-disclosure > summary::after { content: "+"; color: var(--xln-muted); font-size: 18px; }
.xui-disclosure[open] > summary::after { content: "−"; }
.xui-disclosure > :not(summary) { padding: 0 var(--xln-s4) var(--xln-s4); }
@media (min-width: 1180px) {
  /* Desktop shows context in full; the summary becomes a plain heading. */
  .xui-layout-context .xui-disclosure > summary { pointer-events: none; }
  .xui-layout-context .xui-disclosure > summary::after { content: none; }
}

/* Dialog (centred) and sheet (bottom, phones). Use a real <dialog> or
   role="dialog" aria-modal="true" with focus moved in and restored on close. */
.xui-dialog {
  width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); overflow: auto;
  padding: var(--xln-s5); border: 1px solid var(--xln-line-firm);
  border-radius: var(--mx-radius-dialog, 20px); background: var(--xln-surface); color: var(--xln-text);
  box-shadow: 0 30px 80px rgba(var(--mx-shadow-rgb), calc(0.55 * var(--mx-shadow-k)));
}
.xui-dialog::backdrop { background: rgba(var(--mx-shade-rgb), calc(0.55 * var(--mx-shade-k))); }
@media (max-width: 768px) {
  .xui-dialog.xui-dialog--sheet {
    width: 100%; max-width: none; margin: auto 0 0; max-height: calc(100dvh - 24px);
    border-radius: var(--mx-radius-sheet, 20px) var(--mx-radius-sheet, 20px) 0 0;
    padding-bottom: max(var(--xln-s5), env(safe-area-inset-bottom));
  }
}

/* ============================================================
   RESPONSIVE — mobile is not desktop compressed
   ============================================================ */

@media (max-width: 720px) {
  .xui-page { padding: var(--xln-s5) var(--xln-s4) var(--xln-s7); }
  .xui-head { flex-direction: column; align-items: stretch; gap: var(--xln-s3); }
  .xui-head-main { flex-basis: auto; }
  /* The primary action becomes full-width and reachable by thumb rather than
     being squeezed beside the title. */
  .xui-head-actions { width: 100%; }
  .xui-head-actions .xui-btn { flex: 1 1 auto; min-height: 44px; }
  .xui-form-actions { flex-direction: column-reverse; align-items: stretch; }
  .xui-form-actions .xui-btn { width: 100%; min-height: 44px; }
  .xui-form-actions .xui-spacer { display: none; }
}

/* Touch targets stay at least 44px on coarse pointers. */
@media (pointer: coarse) {
  .xui-btn, .xui-tab, .xui-search { min-height: 44px; }
  .xui-btn--icon { width: 44px; }
  .xui-chip, .xui-seg > button { min-height: 40px; }
}

@media (prefers-reduced-motion: reduce) {
  .xui-skel, .xui-spinner, .xui-status[data-state="live"]::before { animation: none; }
  .xui-btn, .xui-card--link, .xui-search, .xui-input, .xui-select, .xui-textarea { transition: none; }
  .xui-card--link:hover { transform: none; }
}

/* Screen-reader-only text, for state that is otherwise visual. */
.xui-sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}


/* ── UX3 theme variables (generated) ──────────────────────────────────
   Dark values are this file's original literals, so dark rendering is
   unchanged. Light values are semantic tokens from nav/shell.css. */
:root {
  --mxc-xui-1: rgba(127,127,160,.12);
  --mxc-xui-2: rgba(127,127,160,.10);
  --mxc-xui-3: #FF8095;
  --mxc-xui-4: #fff;
  --mxc-xui-5: rgba(127,127,160,.14);
  --mxc-xui-6: rgba(127,127,160,.20);
  --mxc-xui-7: #5BB8FF;
}
html[data-theme="light"] {
  --mxc-xui-1: rgba(20, 26, 46, 0.07);
  --mxc-xui-2: rgba(20, 26, 46, 0.06);
  --mxc-xui-3: var(--mx-danger);
  --mxc-xui-4: var(--mx-text-primary);
  --mxc-xui-5: rgba(20, 26, 46, 0.08);
  --mxc-xui-6: rgba(20, 26, 46, 0.12);
  --mxc-xui-7: var(--mx-information);
}
