/* =====================================================================
   LYNX Client Area — design system v4
   No framework. Mobile-first. Dark default + light.
   Direction-agnostic: logical properties throughout, so RTL costs nothing.

   Type: Rubik (display + UI, covers Arabic) / IBM Plex Mono (data).
   Credentials, MACs, counts and URLs are set in mono on purpose — they
   are the product here, and they need to be scannable and copyable.
   ================================================================== */

/* ---------- tokens: dark (default) ---------------------------------- */
:root {
  --brand:        #9B7FE0;
  --brand-2:      #7C5FC4;
  --accent:       #3FB6D8;
  --accent-2:     #1D8AAC;

  /* Ground is near-black with a violet bias; each step up is a real
     surface, not a slightly different grey. */
  --bg:        #09070E;
  --bg-2:      #0E0B15;
  --surface:   #15111E;
  --surface-2: #1C1728;
  --surface-3: #241E33;

  --line:      #272036;
  --line-soft: #1C1728;

  /* An inner top highlight is what makes a panel read as raised. */
  --edge: inset 0 1px 0 rgba(255,255,255,.055);

  --text:      #F0ECF7;
  --text-dim:  #ADA3C2;
  --text-mute: #6F6689;

  --ok:   #3ED598;  --ok-bg:  rgba(62,213,152,.12);
  --warn: #F0B457;  --warn-bg:rgba(240,180,87,.12);
  --err:  #FF6B85;  --err-bg: rgba(255,107,133,.12);

  --r-xs: 8px;
  --r-sm: 12px;
  --r:    18px;
  --r-lg: 24px;

  --shadow-1: 0 1px 2px rgba(0,0,0,.5);
  --shadow-3: 0 8px 24px rgba(0,0,0,.45), 0 24px 64px rgba(0,0,0,.4);
  --shadow-2: 0 2px 6px rgba(0,0,0,.4), 0 12px 32px rgba(0,0,0,.38);

  --sidebar-w:   270px;
  --topbar-h:    62px;
  --bottomnav-h: 64px;

  --ring: 0 0 0 3px rgba(155,127,224,.4);

  --font:  "Rubik", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono:  "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ---------- tokens: light ------------------------------------------- */
:root[data-theme="light"] {
  --brand:        #6641AE;
  --brand-2:      #543691;
  --accent:       #0B6A8C;
  --accent-2:     #085570;

  --bg:        #F6F4FA;
  --bg-2:      #FFFFFF;
  --surface:   #FFFFFF;
  --surface-2: #F5F2FA;
  --surface-3: #EBE6F5;

  --line:      #E1DAEF;
  --line-soft: #EEE9F7;
  --edge: inset 0 1px 0 rgba(255,255,255,.9);

  --text:      #150F22;
  --text-dim:  #574D6E;
  --text-mute: #857B9C;

  --ok:   #0C7A52;  --ok-bg:  rgba(12,122,82,.10);
  --warn: #8A5A0B;  --warn-bg:rgba(138,90,11,.12);
  --err:  #C02744;  --err-bg: rgba(192,39,68,.10);

  --shadow-1: 0 1px 2px rgba(30,18,58,.06);
  --shadow-2: 0 2px 6px rgba(30,18,58,.06), 0 12px 28px rgba(30,18,58,.08);
  --shadow-3: 0 8px 20px rgba(30,18,58,.10), 0 24px 56px rgba(30,18,58,.10);
  --ring: 0 0 0 3px rgba(102,65,174,.28);
}

/* ---------- reset ---------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.2; letter-spacing: -.015em; text-wrap: balance; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--r-xs); }
::-webkit-scrollbar { width: 10px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 8px; }
::selection { background: var(--brand); color: #fff; }

/* ---------- shell ---------------------------------------------------- */
.lx-shell { min-height: 100dvh; }

.lx-topbar {
  position: sticky; top: 0; z-index: 40;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 8px;
  padding-inline: 14px;
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  backdrop-filter: saturate(180%) blur(16px);
  border-block-end: 1px solid var(--line-soft);
}
/* Artwork paths come from lx_asset_vars() in the page, not from here —
   this file lives in assets/, so a relative url() would resolve against
   assets/ and break whenever the images move. */
.lx-topbar--textured {
  background-image:
    linear-gradient(color-mix(in srgb, var(--bg) 88%, transparent), color-mix(in srgb, var(--bg) 88%, transparent)),
    var(--img-texture, none);
  background-size: auto, 300px;
  background-position: center, center;
  background-repeat: repeat, repeat;
}
.lx-topbar__logo { height: 30px; width: auto; }
.lx-topbar__spacer { flex: 1; }

.lx-main { padding: 16px 14px calc(var(--bottomnav-h) + 28px); max-width: 1240px; }

/* sidebar: drawer on phones, permanent from 1024px.
   The closed offset is a variable so the desktop rule never has to
   out-specify a direction selector. */
:root           { --drawer-closed: -100%; }
html[dir="rtl"] { --drawer-closed:  100%; }

.lx-sidebar {
  position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 60;
  width: var(--sidebar-w);
  background: var(--bg-2);
  border-inline-end: 1px solid var(--line-soft);
  display: flex; flex-direction: column;
  transform: translateX(var(--drawer-closed));
  transition: transform .28s cubic-bezier(.32,.72,0,1);
  overflow-y: auto;
}
.lx-sidebar.is-open { transform: translateX(0); }

.lx-sidebar__head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 18px 18px 14px;
}
.lx-sidebar__head img { height: 34px; width: auto; }

.lx-nav { padding: 6px 12px 20px; display: flex; flex-direction: column; gap: 2px; }
.lx-nav__label {
  font-size: 10.5px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
  color: var(--text-mute); padding: 16px 12px 7px;
}
.lx-nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--r-sm);
  color: var(--text-dim); font-weight: 400; font-size: 14.5px;
  transition: background .15s, color .15s;
}
.lx-nav a:hover { background: var(--surface); color: var(--text); text-decoration: none; }
/* Active is a filled pill, not a rail stripe — it reads instantly and
   nothing has to fight the border radius. */
.lx-nav a.is-active {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff; font-weight: 500;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--brand) 35%, transparent);
}
.lx-nav a.is-active svg { opacity: 1; }
.lx-nav svg { width: 19px; height: 19px; flex: none; opacity: .75; }

.lx-scrim {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(3,2,7,.66); backdrop-filter: blur(3px);
  opacity: 0; pointer-events: none; transition: opacity .28s;
}
.lx-scrim.is-open { opacity: 1; pointer-events: auto; }

.lx-bottomnav {
  position: fixed; inset-inline: 0; inset-block-end: 0; z-index: 45;
  height: var(--bottomnav-h);
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  background: color-mix(in srgb, var(--bg-2) 92%, transparent);
  backdrop-filter: blur(16px);
  border-block-start: 1px solid var(--line-soft);
  padding-block-end: env(safe-area-inset-bottom);
}
.lx-bottomnav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; font-size: 10px; font-weight: 500;
  color: var(--text-mute); text-decoration: none; position: relative;
}
.lx-bottomnav a.is-active { color: var(--brand); }
.lx-bottomnav a.is-active::before {
  content: ""; position: absolute; inset-block-start: 0;
  width: 26px; height: 2.5px; border-radius: 0 0 3px 3px; background: var(--brand);
}
.lx-bottomnav svg { width: 21px; height: 21px; }

@media (min-width: 1024px) {
  .lx-sidebar { transform: translateX(0); }
  .lx-shell { padding-inline-start: var(--sidebar-w); }
  .lx-main { padding: 24px 32px 48px; }
  .lx-bottomnav, .lx-scrim, #lxMenuBtn, .lx-sidebar__close,
  .lx-topbar__logo { display: none !important; }
  .lx-topbar { padding-inline: 32px; }
}

/* ---------- buttons -------------------------------------------------- */
.lx-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; min-height: 44px;
  border: 1px solid transparent; border-radius: var(--r-sm);
  font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff; text-decoration: none;
  box-shadow: 0 2px 10px color-mix(in srgb, var(--brand) 30%, transparent);
  transition: transform .12s, box-shadow .15s, background .15s;
}
.lx-btn:hover { color: #fff; text-decoration: none; box-shadow: 0 4px 18px color-mix(in srgb, var(--brand) 45%, transparent); }
.lx-btn:active { transform: translateY(1px); }
.lx-btn svg { width: 17px; height: 17px; }
.lx-btn--ghost {
  background: var(--surface-2); color: var(--text);
  border-color: var(--line); box-shadow: var(--edge);
}
.lx-btn--ghost:hover { background: var(--surface-3); color: var(--text); border-color: var(--brand); box-shadow: var(--edge); }
.lx-btn--accent { background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 2px 10px color-mix(in srgb, var(--accent) 30%, transparent); }
.lx-btn--danger { background: linear-gradient(135deg, var(--err), color-mix(in srgb, var(--err) 70%, #000)); box-shadow: none; }
.lx-btn--sm { padding: 7px 13px; min-height: 36px; font-size: 13px; border-radius: var(--r-xs); }
.lx-btn--block { width: 100%; }
.lx-btn[disabled] { opacity: .45; pointer-events: none; }

.lx-iconbtn {
  display: inline-grid; place-items: center; flex: none;
  width: 40px; height: 40px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface); color: var(--text-dim);
  box-shadow: var(--edge); cursor: pointer; transition: .15s;
}
.lx-iconbtn:hover { color: var(--text); border-color: var(--brand); }
.lx-iconbtn svg { width: 19px; height: 19px; }

/* ---------- panels --------------------------------------------------- */
.lx-panel, .lx-card {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r);
  box-shadow: var(--shadow-1), var(--edge);
  overflow: hidden;
}
.lx-card { margin-block-end: 16px; }

.lx-panel__head, .lx-card__head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 16px 18px 14px;
}
.lx-panel__head h2, .lx-card__head h2 { font-size: 15px; font-weight: 600; }
.lx-spacer { flex: 1; }
.lx-panel__body, .lx-card__body { padding: 0 18px 18px; }
.lx-card__body--flush { padding: 0; }

.lx-page-title { font-size: clamp(21px, 5vw, 26px); font-weight: 700; letter-spacing: -.025em; }
.lx-page-sub { color: var(--text-dim); font-size: 14px; margin: 5px 0 20px; }

/* ---------- bento grid ------------------------------------------------
   Replaces the vertical stack of identical full-width cards. Panels earn
   their size from what they hold, which is what stops a dashboard reading
   like a template. */
.lx-bento { display: grid; gap: 14px; grid-template-columns: 1fr; margin-block-end: 16px; }
@media (min-width: 760px)  { .lx-bento { grid-template-columns: repeat(2, 1fr); gap: 16px; } }
@media (min-width: 1100px) { .lx-bento { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 760px)  { .lx-bento > .span-2 { grid-column: span 2; } }
.lx-bento > .span-all { grid-column: 1 / -1; }

/* ---------- hero ----------------------------------------------------- */
.lx-hero {
  position: relative; overflow: hidden;
  border-radius: var(--r-lg);
  border: 1px solid var(--line-soft);
  box-shadow: var(--shadow-2);
  margin-block-end: 16px;
  min-height: 178px;
  display: flex; align-items: flex-end;
  background: #150C22;
}
.lx-hero::before {
  content: ""; position: absolute; inset: 0;
  background-image: var(--img-hero, none);
  background-position: center right;
  background-size: cover;
  background-repeat: no-repeat;
}
/* The lynx sits on the right of the source file; mirror it in RTL so it
   stays opposite the text rather than behind it. */
html[dir="rtl"] .lx-hero::before { transform: scaleX(-1); }
.lx-hero::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to right, rgba(9,6,16,.96) 0%, rgba(9,6,16,.82) 44%, rgba(9,6,16,.2) 100%);
}
html[dir="rtl"] .lx-hero::after {
  background: linear-gradient(to left, rgba(9,6,16,.96) 0%, rgba(9,6,16,.82) 44%, rgba(9,6,16,.2) 100%);
}
.lx-hero__inner { position: relative; z-index: 1; padding: 22px; width: 100%; }
.lx-hero__eyebrow { font-size: 10.5px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: #C4AEF0; margin-block-end: 7px; }
.lx-hero h1 { color: #fff; font-size: clamp(21px, 5.4vw, 30px); font-weight: 700; letter-spacing: -.025em; }
.lx-hero__meta { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; margin-block-start: 14px; color: #D5CBEB; font-size: 13.5px; }
.lx-hero__meta .lx-mono { background: rgba(255,255,255,.09); border-color: rgba(255,255,255,.15); color: #fff; }
@media (min-width: 700px) { .lx-hero { min-height: 208px; } .lx-hero__inner { padding: 28px 34px; } }

/* ---------- stat tiles ------------------------------------------------ */
.lx-stats { display: grid; gap: 12px; grid-template-columns: repeat(2, 1fr); }

.lx-stat {
  position: relative; overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r);
  box-shadow: var(--shadow-1), var(--edge);
  padding: 16px 16px 14px;
  display: flex; flex-direction: column; gap: 10px;
}
/* A soft bloom in the corner instead of a coloured left bar. */
.lx-stat::after {
  content: ""; position: absolute; inset-block-start: -40%; inset-inline-end: -30%;
  width: 150px; height: 150px; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--brand) 26%, transparent), transparent 68%);
  pointer-events: none;
}
.lx-stat--accent::after { background: radial-gradient(circle, color-mix(in srgb, var(--accent) 26%, transparent), transparent 68%); }
.lx-stat__icon {
  width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--brand) 16%, transparent); color: var(--brand);
}
.lx-stat--accent .lx-stat__icon { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.lx-stat__icon svg { width: 18px; height: 18px; }
.lx-stat__value {
  font-family: var(--mono); font-size: clamp(22px, 6vw, 27px); font-weight: 500;
  letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums;
}
.lx-stat__label { font-size: 11px; color: var(--text-mute); font-weight: 500; letter-spacing: .07em; text-transform: uppercase; }

/* ---------- credential cards ------------------------------------------
   Detail pages used to be tables. A credential is something you read and
   copy on a phone, so it gets a card with a big mono value instead of a
   cramped table row. */
.lx-creds { display: grid; gap: 12px; grid-template-columns: 1fr; padding: 0 18px 18px; }
@media (min-width: 620px) { .lx-creds { grid-template-columns: repeat(2, 1fr); } }

.lx-cred {
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  padding: 13px 14px;
  display: flex; flex-direction: column; gap: 7px;
  min-width: 0;
}
.lx-cred__k { font-size: 10.5px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--text-mute); }
.lx-cred__row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.lx-cred__v {
  font-family: var(--mono); font-size: 15px; font-weight: 500;
  flex: 1; min-width: 0;
  word-break: normal; overflow-wrap: anywhere;   /* break long URLs, but not mid-number */
  direction: ltr; unicode-bidi: embed; text-align: start;
}
.lx-cred__v--plain {
  font-family: var(--font); font-weight: 400; font-size: 14.5px;
  overflow-wrap: normal; direction: inherit;
}
.lx-cred--wide { grid-column: 1 / -1; }

.lx-mono {
  font-family: var(--mono); font-size: 13.5px;
  background: var(--surface-2); border: 1px solid var(--line-soft);
  padding: 4px 9px; border-radius: var(--r-xs);
  word-break: break-all; direction: ltr; unicode-bidi: embed;
}

/* ---------- content rails ---------------------------------------------
   Latest movies and series are a horizontally scrolling row — the idiom
   every streaming app already taught these customers — instead of a table
   they have to scroll sideways inside. */
.lx-rail {
  display: grid; grid-auto-flow: column; grid-auto-columns: 126px;
  gap: 12px; padding: 2px 18px 18px;
  overflow-x: auto; scroll-snap-type: x proximity;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.lx-rail::-webkit-scrollbar { display: none; }
@media (min-width: 700px) { .lx-rail { grid-auto-columns: 146px; } }

.lx-poster { scroll-snap-align: start; min-width: 0; }
.lx-poster__img {
  width: 100%; aspect-ratio: 2 / 3; object-fit: cover;
  border-radius: var(--r-sm); background: var(--surface-3);
  border: 1px solid var(--line-soft); margin-block-end: 8px;
  transition: transform .18s;
}
.lx-poster:hover .lx-poster__img { transform: translateY(-3px); }
.lx-poster__t {
  font-size: 13px; font-weight: 500; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.lx-poster__s { font-size: 11.5px; color: var(--text-mute); margin-block-start: 2px; }

/* ---------- forms ----------------------------------------------------- */
.lx-field { margin-block-end: 15px; }
.lx-label { display: block; font-size: 12.5px; font-weight: 500; color: var(--text-dim); margin-block-end: 7px; }
.lx-input, .lx-select, .lx-textarea {
  width: 100%; padding: 12px 14px; min-height: 46px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-sm); color: var(--text); transition: .15s;
}
.lx-input::placeholder, .lx-textarea::placeholder { color: var(--text-mute); }
.lx-input:focus, .lx-select:focus, .lx-textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
.lx-textarea { min-height: 112px; resize: vertical; line-height: 1.6; }
.lx-hint { font-size: 12.5px; color: var(--text-mute); margin-block-start: 6px; }

/* Numbered hand-off steps (HotPlayer) */
.lx-steps { margin: 0 0 16px; padding-inline-start: 22px; display: grid; gap: 8px; }
.lx-steps li { color: var(--text); font-size: 14px; line-height: 1.5; padding-inline-start: 4px; }
.lx-steps li::marker { color: var(--accent); font-weight: 600; }

/* A link styled as a button but currently unavailable */
a.lx-btn.is-disabled { opacity: .5; pointer-events: none; cursor: default; }

/* ---------- alerts / badges -------------------------------------------- */
.lx-alert {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 13px 15px; border-radius: var(--r-sm);
  border: 1px solid; font-size: 14px; margin-block-end: 16px;
}
.lx-alert svg { width: 18px; height: 18px; flex: none; margin-block-start: 2px; }
.lx-alert p { margin: 0; }
.lx-alert--ok   { background: var(--ok-bg);   border-color: color-mix(in srgb, var(--ok) 32%, transparent);   color: var(--ok); }
.lx-alert--err  { background: var(--err-bg);  border-color: color-mix(in srgb, var(--err) 32%, transparent);  color: var(--err); }
.lx-alert--warn { background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn) 32%, transparent); color: var(--warn); }

.lx-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px; border-radius: 999px;
  font-size: 12px; font-weight: 500; line-height: 1.6; white-space: nowrap;
}
.lx-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.lx-badge--ok   { background: var(--ok-bg);   color: var(--ok); }
.lx-badge--err  { background: var(--err-bg);  color: var(--err); }
.lx-badge--warn { background: var(--warn-bg); color: var(--warn); }
.lx-badge--mute { background: var(--surface-3); color: var(--text-mute); }

/* ---------- action rows (login chooser + quick actions) ---------------- */
.lx-choice { display: flex; flex-direction: column; gap: 10px; }
.lx-choice__item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 15px; width: 100%; text-align: start;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--r-sm);
  cursor: pointer; text-decoration: none;
  box-shadow: var(--edge);
  transition: border-color .15s, background .15s, transform .12s;
}
.lx-choice__item:hover { border-color: var(--brand); background: var(--surface-3); transform: translateY(-1px); text-decoration: none; color: var(--text); }
.lx-choice__icon {
  width: 42px; height: 42px; border-radius: var(--r-sm); flex: none;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--brand) 16%, transparent); color: var(--brand);
}
.lx-choice__item--accent .lx-choice__icon { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.lx-choice__icon svg { width: 21px; height: 21px; }
.lx-choice__text { flex: 1; min-width: 0; }
.lx-choice__title { display: block; font-weight: 500; font-size: 15px; }
.lx-choice__sub { display: block; font-size: 13px; color: var(--text-mute); margin-block-start: 2px; }
/* The glyph is a left arrow, so flip it in LTR to point forward. */
.lx-choice__chev { color: var(--text-mute); flex: none; display: inline-flex; transform: scaleX(-1); }
html[dir="rtl"] .lx-choice__chev { transform: none; }
.lx-choice__chev svg { width: 18px; height: 18px; }

.lx-step-head { display: flex; align-items: center; gap: 11px; margin-block-end: 18px; }
.lx-step-head h1 { font-size: 18px; font-weight: 600; }

/* ---------- chips ------------------------------------------------------ */
.lx-chips {
  display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 12px;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.lx-chips::-webkit-scrollbar { display: none; }
.lx-chip {
  flex: none; padding: 8px 15px; border-radius: 999px; cursor: pointer;
  background: var(--surface-2); color: var(--text-dim);
  border: 1px solid var(--line); font-size: 13px; font-weight: 400;
  white-space: nowrap; transition: .15s; text-decoration: none;
}
.lx-chip:hover { color: var(--text); border-color: var(--brand); text-decoration: none; }
.lx-chip.is-active {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff; border-color: transparent; font-weight: 500;
}

/* ---------- channel grid ----------------------------------------------- */
.lx-channels {
  display: grid; gap: 10px; padding: 4px 18px 18px;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}
.lx-channel {
  display: flex; flex-direction: column; align-items: center; gap: 9px;
  padding: 15px 10px; text-align: center;
  background: var(--surface-2); border: 1px solid var(--line-soft);
  border-radius: var(--r-sm); box-shadow: var(--edge);
  transition: border-color .15s, transform .12s;
}
.lx-channel:hover { border-color: var(--brand); transform: translateY(-2px); }
.lx-channel__logo {
  width: 58px; height: 58px; border-radius: var(--r-xs); flex: none;
  object-fit: contain; background: var(--bg-2); padding: 6px;
}
.lx-channel__name {
  font-size: 13px; font-weight: 500; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; word-break: break-word;
}
.lx-channel__cat { font-size: 11px; color: var(--text-mute); }
.lx-count { font-family: var(--mono); font-size: 12.5px; color: var(--text-mute); font-variant-numeric: tabular-nums; }

/* ---------- tables (news and other simple lists) ------------------------ */
.lx-tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.lx-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.lx-table th {
  text-align: start; font-size: 10.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .12em; color: var(--text-mute);
  padding: 11px 18px; border-block-end: 1px solid var(--line);
  white-space: nowrap; background: var(--surface-2);
}
.lx-table td { padding: 13px 18px; border-block-end: 1px solid var(--line-soft); vertical-align: middle; }
.lx-table tr:last-child td { border-block-end: 0; }
.lx-table tbody tr:hover { background: var(--surface-2); }

@media (max-width: 640px) {
  .lx-table--stack thead { display: none; }
  .lx-table--stack tr { display: block; padding: 13px 18px; border-block-end: 1px solid var(--line-soft); }
  .lx-table--stack td { display: flex; justify-content: space-between; gap: 14px; padding: 4px 0; border: 0; text-align: end; }
  .lx-table--stack td::before { content: attr(data-label); font-size: 11.5px; font-weight: 500; color: var(--text-mute); text-align: start; flex: none; }
}

/* ---------- tickets ----------------------------------------------------- */
.lx-ticketlist { display: flex; flex-direction: column; }
.lx-ticket {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 15px 18px; border-block-start: 1px solid var(--line-soft);
  color: inherit; text-decoration: none; transition: background .15s;
}
.lx-ticket:hover { background: var(--surface-2); text-decoration: none; }
.lx-ticket.is-active { background: var(--surface-2); }
.lx-ticket__body { flex: 1; min-width: 0; }
.lx-ticket__subject { font-weight: 500; margin-block-end: 3px; }
.lx-ticket__meta { font-size: 12px; color: var(--text-mute); display: flex; gap: 9px; flex-wrap: wrap; align-items: center; }
.lx-ticket__meta .lx-mono { padding: 2px 6px; font-size: 11.5px; }

.lx-thread { display: flex; flex-direction: column; gap: 14px; padding: 18px; }
.lx-msg { display: flex; flex-direction: column; max-width: min(80%, 540px); }
.lx-msg--me { align-self: flex-end; align-items: flex-end; }
.lx-msg__bubble {
  padding: 11px 15px; border-radius: var(--r);
  background: var(--surface-2); border: 1px solid var(--line-soft);
  white-space: pre-wrap; word-break: break-word; line-height: 1.55;
}
.lx-msg--me .lx-msg__bubble {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff; border-color: transparent; border-end-end-radius: 6px;
}
.lx-msg--them .lx-msg__bubble { border-end-start-radius: 6px; }
.lx-msg__meta { font-size: 11px; color: var(--text-mute); margin-block-start: 6px; padding-inline: 4px; }

/* ---------- empty state -------------------------------------------------- */
.lx-empty { text-align: center; padding: 48px 22px; color: var(--text-mute); }
.lx-empty svg { width: 42px; height: 42px; opacity: .4; margin: 0 auto 14px; }
.lx-empty h3 { font-size: 16px; font-weight: 500; color: var(--text-dim); margin-block-end: 6px; }
.lx-empty p { margin: 0 0 18px; font-size: 14px; }

/* ---------- auth screens (login, link device) ---------------------------- */
.lx-auth {
  position: relative; isolation: isolate;
  min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px;
  background: var(--bg);
}
/* The lynx photograph, full bleed behind the card. */
.lx-auth::before {
  content: ""; position: absolute; inset: 0; z-index: -2;
  background-image: var(--img-hero, none);
  background-size: cover;
  /* The lynx sits right-of-centre in the source. On a phone the crop is a
     narrow vertical slice, so bias it towards him or the screen is all
     wall. */
  background-position: 72% center;
}
@media (min-width: 760px) { .lx-auth::before { background-position: center; } }
/* Scrim + brand glow, so the card stays readable over the photo in both
   themes without washing the artwork out completely. */
.lx-auth::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(1100px 520px at 12% -10%, color-mix(in srgb, var(--brand) 34%, transparent), transparent 60%),
    radial-gradient(900px 480px at 90% 4%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 60%),
    linear-gradient(180deg, rgba(9,6,16,.5), rgba(9,6,16,.72));
}
:root[data-theme="light"] .lx-auth::after {
  background:
    radial-gradient(1100px 520px at 12% -10%, color-mix(in srgb, var(--brand) 26%, transparent), transparent 60%),
    radial-gradient(900px 480px at 90% 4%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 60%),
    linear-gradient(180deg, rgba(12,8,22,.42), rgba(12,8,22,.6));
}
.lx-auth__card { position: relative; z-index: 1; }
.lx-auth__card {
  width: 100%; max-width: 420px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-3), var(--edge);
  padding: 30px 26px;
}
.lx-auth__logo { height: 52px; width: auto; margin: 0 auto 22px; }

/* ---------- misc --------------------------------------------------------- */
.lx-user {
  display: flex; align-items: center; gap: 9px;
  padding: 5px 13px 5px 5px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 999px; cursor: pointer; color: var(--text);
  box-shadow: var(--edge); text-decoration: none;
}
.lx-user:hover { text-decoration: none; border-color: var(--brand); }
.lx-user__avatar {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-size: 12px; font-weight: 600; color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  font-family: var(--mono);
}
.lx-user__name { font-size: 13px; font-weight: 400; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 520px) { .lx-user__name { display: none; } }

.lx-footer { padding: 22px 4px 8px; text-align: center; color: var(--text-mute); font-size: 12.5px; }
.lx-row-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.lx-grid-2 { display: grid; gap: 16px; }
@media (min-width: 900px) { .lx-grid-2 { grid-template-columns: 370px 1fr; align-items: start; } }
@media (max-width: 899px) {
  .lx-tickets.has-thread .lx-pane--list { display: none; }
  .lx-tickets:not(.has-thread) .lx-pane--thread { display: none; }
}
.lx-only-mobile { display: none; }
@media (max-width: 899px) { .lx-only-mobile { display: inline-flex; } }

.lx-toast {
  position: fixed; inset-inline: 16px; inset-block-end: calc(var(--bottomnav-h) + 18px);
  z-index: 90; margin-inline: auto; max-width: 340px;
  background: var(--surface-3); border: 1px solid var(--line);
  color: var(--text); box-shadow: var(--shadow-3);
  padding: 13px 18px; border-radius: var(--r-sm);
  text-align: center; font-size: 14px; font-weight: 400;
  opacity: 0; transform: translateY(12px); pointer-events: none; transition: .22s;
}
.lx-toast.is-on { opacity: 1; transform: translateY(0); }
@media (min-width: 1024px) { .lx-toast { inset-block-end: 26px; } }

/* ---------- entrance ------------------------------------------------------
   A short staggered rise on first paint. Purely decorative, so it is the
   first thing to go when the viewer asks for reduced motion. */
@keyframes lx-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.lx-main > * { animation: lx-rise .4s cubic-bezier(.22,.68,0,1) backwards; }
.lx-main > *:nth-child(1) { animation-delay: .02s; }
.lx-main > *:nth-child(2) { animation-delay: .06s; }
.lx-main > *:nth-child(3) { animation-delay: .1s; }
.lx-main > *:nth-child(4) { animation-delay: .14s; }
.lx-main > *:nth-child(n+5) { animation-delay: .18s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------- hero is always dark, whatever the page theme ----------------
   Badges and ghost buttons inside it must not take the light-theme tokens,
   or they end up dark-on-dark. These are fixed light-on-dark values. */
.lx-hero .lx-badge--ok   { background: rgba(62,213,152,.20);  color: #7BEBBC; }
.lx-hero .lx-badge--warn { background: rgba(240,180,87,.20);  color: #F7CE8B; }
.lx-hero .lx-badge--err  { background: rgba(255,107,133,.22); color: #FFA6B6; }
.lx-hero .lx-badge--mute { background: rgba(255,255,255,.12); color: #D5CBEB; }
.lx-hero .lx-btn--ghost {
  background: rgba(255,255,255,.11); border-color: rgba(255,255,255,.2);
  color: #fff; box-shadow: none;
}
.lx-hero .lx-btn--ghost:hover { background: rgba(255,255,255,.18); border-color: rgba(255,255,255,.32); color: #fff; }


/* ---------- horizontal scroller ------------------------------------------
   Rails and chip rows are swipeable on a phone, but a mouse has nothing to
   grab. These arrows appear only when the strip actually overflows, and
   disable themselves at each end. Direction-aware: the JS flips the sign
   in RTL. */
.lx-scroller { position: relative; }

.lx-scroller__btn {
  position: absolute; inset-block-start: 50%; transform: translateY(-50%);
  z-index: 3; width: 38px; height: 38px; border-radius: 50%;
  display: none; place-items: center; cursor: pointer;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border: 1px solid var(--line); color: var(--text);
  box-shadow: var(--shadow-2); backdrop-filter: blur(8px);
  transition: opacity .15s, background .15s;
}
.lx-scroller.can-scroll .lx-scroller__btn { display: grid; }
.lx-scroller__btn:hover { background: var(--surface-3); border-color: var(--brand); }
.lx-scroller__btn[disabled] { opacity: 0; pointer-events: none; }
.lx-scroller__btn svg { width: 18px; height: 18px; }
.lx-scroller__btn--prev { inset-inline-start: 6px; }
.lx-scroller__btn--next { inset-inline-end: 6px; }
/* The glyph is a left arrow: "next" points forward, so flip it in LTR. */
.lx-scroller__btn--next svg { transform: scaleX(-1); }
html[dir="rtl"] .lx-scroller__btn--next svg { transform: none; }
html[dir="rtl"] .lx-scroller__btn--prev svg { transform: scaleX(-1); }

/* Fade the strip edges so a cut-off card reads as "there is more". */
.lx-scroller::before, .lx-scroller::after {
  content: ""; position: absolute; inset-block: 0; width: 44px; z-index: 2;
  pointer-events: none; opacity: 0; transition: opacity .2s;
}
.lx-scroller::before { inset-inline-start: 0; background: linear-gradient(to right, var(--surface), transparent); }
.lx-scroller::after  { inset-inline-end: 0;  background: linear-gradient(to left,  var(--surface), transparent); }
html[dir="rtl"] .lx-scroller::before { background: linear-gradient(to left,  var(--surface), transparent); }
html[dir="rtl"] .lx-scroller::after  { background: linear-gradient(to right, var(--surface), transparent); }
.lx-scroller.at-start::after,
.lx-scroller.can-scroll:not(.at-end)::after { opacity: 1; }
.lx-scroller.can-scroll:not(.at-start)::before { opacity: 1; }
.lx-scroller.at-end::after { opacity: 0; }

/* Chips sit on the page ground, not on a panel, so their fade differs. */
.lx-scroller--chips::before { background: linear-gradient(to right, var(--surface), transparent); }
.lx-scroller--chips::after  { background: linear-gradient(to left,  var(--surface), transparent); }

/* ---------- poster placeholder --------------------------------------------
   Plenty of titles genuinely have no cover art. A blank gap reads as a
   broken image, so the frame itself carries a branded placeholder and the
   <img> simply sits on top when there is one. */
.lx-poster__frame {
  position: relative; width: 100%; aspect-ratio: 2 / 3;
  border-radius: var(--r-sm); overflow: hidden;
  border: 1px solid var(--line-soft); margin-block-end: 8px;
  background:
    linear-gradient(150deg, color-mix(in srgb, var(--brand) 22%, var(--surface-3)), var(--surface-2));
  display: grid; place-items: center;
}
.lx-poster__frame::after {
  content: ""; width: 34%; height: 34%; opacity: .3;
  background: currentColor; color: var(--text-mute);
  -webkit-mask: var(--icon-film) center / contain no-repeat;
          mask: var(--icon-film) center / contain no-repeat;
}
.lx-poster__frame .lx-poster__img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; margin: 0; border: 0; border-radius: 0;
  background: var(--surface-3);
}
:root {
  --icon-film: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><rect x="2.5" y="4" width="19" height="16" rx="2"/><path d="M7 4v16M17 4v16M2.5 12h19M2.5 8h4.5M2.5 16h4.5M17 8h4.5M17 16h4.5"/></svg>');
}

/* IBO manager rows carry extra controls (protected badge, a PIN input, a
   remove button). On a phone those squeeze the name to nothing, so let the
   controls wrap onto their own line under the name/url. */
.lx-ticket--wrap { flex-wrap: wrap; }
.lx-ticket--wrap .lx-ticket__body { flex: 1 1 100%; min-width: 0; }
.lx-ticket--wrap > .lx-badge,
.lx-ticket--wrap > form { margin-block-start: 4px; }
