/* ==========================================================================
   Pokezard Dashboard
   Strict-CSP friendly: no inline styles required, all dynamic values are set
   through CSS custom properties via the CSSOM.
   ========================================================================== */

/* ---------- Fonts (local only) ------------------------------------------ */
@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 200 1000;
  font-display: swap;
  src: url("/assets/fonts/nunito-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 200 1000;
  font-display: swap;
  src: url("/assets/fonts/nunito-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Luckiest Guy";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/luckiest-guy-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Luckiest Guy";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/luckiest-guy-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- Tokens ------------------------------------------------------- */
:root {
  color-scheme: dark;

  --bg: #0E0D0C;
  --surface: #161412;
  --surface-2: #1E1B18;
  --surface-3: #26221E;
  --line: rgba(244, 239, 232, 0.08);
  --line-strong: rgba(244, 239, 232, 0.14);

  --text: #F4EFE8;
  --muted: #B3AA9F;
  --faint: #A0978C;
  --control-border: #766D64;
  --control-border-hover: #8C8379;

  --coral: #FF7452;
  --primary: #AB2009;
  --primary-hi: #C8290F;
  --flame: #FF6A1F;

  --ok: #6FD6A0;
  --ok-bg: rgba(111, 214, 160, 0.12);
  --warn: #FFC266;
  --warn-bg: rgba(255, 194, 102, 0.12);
  --bad: #FF8A7A;
  --bad-bg: rgba(255, 116, 82, 0.14);
  --info: #9DB8FF;
  --info-bg: rgba(157, 184, 255, 0.12);
  --neutral-bg: rgba(244, 239, 232, 0.07);

  --font: "Nunito", ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Luckiest Guy", "Nunito", system-ui, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "JetBrains Mono", Menlo, Consolas, monospace;

  --r-sm: 10px;
  --r: 16px;
  --r-lg: 22px;
  --r-xl: 28px;

  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 18px 40px -24px rgba(0, 0, 0, 0.8);
  --shadow-lg: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 40px 80px -30px rgba(0, 0, 0, 0.85);

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --t-fast: 160ms;
  --t: 280ms;
  --t-slow: 520ms;

  --header-h: 68px;
  --sidebar-w: 248px;
  --gutter: clamp(16px, 3.2vw, 32px);
}

/* ---------- Base --------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); scroll-padding-bottom: 96px; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--coral); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: #ff9478; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; font-weight: 800; letter-spacing: -0.01em; }
p { margin: 0; }
code, .mono { font-family: var(--mono); font-size: 0.86em; }
::selection { background: rgba(255, 116, 82, 0.35); color: var(--text); }

:focus-visible {
  outline: 2px solid var(--coral);
  outline-offset: 3px;
  border-radius: 6px;
}

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: fixed; top: 10px; left: 10px; z-index: 100;
  padding: 10px 16px; border-radius: 999px; background: var(--text); color: var(--bg);
  font-weight: 800; text-decoration: none; transform: translateY(-160%);
  transition: transform var(--t) var(--ease-out);
}
.skip-link:focus { transform: translateY(0); }

.noscript {
  position: fixed; inset: 0; display: grid; place-items: center; padding: 24px;
  background: var(--bg); color: var(--text); text-align: center; z-index: 50;
}

/* ---------- Ambient background ----------------------------------------- */
.ambient { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.ambient__orb {
  position: absolute; border-radius: 50%; filter: blur(80px); opacity: 0.55;
  will-change: transform;
}
.ambient__orb--a {
  width: 46vmax; height: 46vmax; left: -14vmax; top: -18vmax;
  background: radial-gradient(circle at 40% 40%, rgba(171, 32, 9, 0.55), rgba(171, 32, 9, 0) 65%);
  animation: drift-a 38s var(--ease-in-out) infinite alternate;
}
.ambient__orb--b {
  width: 38vmax; height: 38vmax; right: -12vmax; top: 18vh;
  background: radial-gradient(circle at 50% 50%, rgba(255, 106, 31, 0.22), rgba(255, 106, 31, 0) 65%);
  animation: drift-b 46s var(--ease-in-out) infinite alternate;
}
.ambient__orb--c {
  width: 34vmax; height: 34vmax; left: 30vw; bottom: -22vmax;
  background: radial-gradient(circle at 50% 50%, rgba(255, 116, 82, 0.16), rgba(255, 116, 82, 0) 65%);
  animation: drift-c 52s var(--ease-in-out) infinite alternate;
}
.ambient__grain {
  position: absolute; inset: 0; opacity: 0.5;
  background:
    radial-gradient(rgba(244, 239, 232, 0.035) 1px, transparent 1px) 0 0 / 3px 3px,
    linear-gradient(180deg, rgba(14, 13, 12, 0) 0%, rgba(14, 13, 12, 0.6) 100%);
}
@keyframes drift-a { to { transform: translate3d(8vmax, 6vmax, 0) scale(1.08); } }
@keyframes drift-b { to { transform: translate3d(-6vmax, 10vmax, 0) scale(0.92); } }
@keyframes drift-c { to { transform: translate3d(-10vmax, -6vmax, 0) scale(1.1); } }

.root { position: relative; z-index: 1; min-height: 100vh; min-height: 100dvh; }

/* ---------- Boot -------------------------------------------------------- */
.boot {
  min-height: 100vh; min-height: 100dvh; display: grid; place-content: center; justify-items: center; gap: 22px;
  animation: fade-in var(--t-slow) var(--ease-out) both;
}
.boot__mark { position: relative; width: 120px; height: 120px; }
.boot__mark img { width: 120px; height: 120px; animation: breathe 2.4s var(--ease-in-out) infinite; }
.boot__ring {
  position: absolute; inset: -14px; border-radius: 50%;
  border: 2px solid rgba(255, 116, 82, 0.15); border-top-color: var(--coral);
  animation: spin 1.1s linear infinite;
}
.boot__text { color: var(--muted); font-weight: 700; }
.boot--error .boot__ring { display: none; }
.boot--error .boot__mark img { animation: none; filter: grayscale(0.4); }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes breathe { 50% { transform: scale(1.04); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise-in {
  from { opacity: 0; transform: translate3d(0, 14px, 0); }
  to { opacity: 1; transform: none; }
}
@keyframes pop-in {
  from { opacity: 0; transform: scale(0.94); }
  to { opacity: 1; transform: none; }
}

/* Staggered reveal: elements get --i via CSSOM */
.reveal {
  animation: rise-in var(--t-slow) var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 55ms);
}

/* ---------- Buttons ------------------------------------------------------ */
.btn {
  --btn-bg: var(--surface-2);
  --btn-fg: var(--text);
  --btn-bd: var(--line-strong);
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 18px;
  border-radius: 999px; border: 1px solid var(--btn-bd);
  background: var(--btn-bg); color: var(--btn-fg);
  font-weight: 800; font-size: 14px; letter-spacing: 0.01em; line-height: 1;
  text-decoration: none; white-space: nowrap; cursor: pointer; user-select: none;
  overflow: hidden; isolation: isolate;
  transition: transform var(--t-fast) var(--ease-out), background-color var(--t) var(--ease-out),
    border-color var(--t) var(--ease-out), box-shadow var(--t) var(--ease-out), opacity var(--t);
}
.btn:hover { --btn-bg: var(--surface-3); color: var(--btn-fg); }
.btn:active { transform: scale(0.97); }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn--primary {
  --btn-bg: linear-gradient(135deg, var(--primary) 0%, #C42E10 60%, #D0381A 100%);
  --btn-fg: #fff; --btn-bd: rgba(255, 116, 82, 0.45);
  background: var(--btn-bg);
  box-shadow: 0 10px 30px -12px rgba(171, 32, 9, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.btn--primary:hover {
  --btn-bg: linear-gradient(135deg, var(--primary-hi) 0%, #CC3A12 60%, #D6421C 100%);
  box-shadow: 0 14px 36px -12px rgba(255, 106, 31, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.btn--primary::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.22) 50%, transparent 70%);
  transform: translateX(-120%);
  transition: transform 700ms var(--ease-out);
}
.btn--primary:hover::after { transform: translateX(120%); }
.btn--ghost { --btn-bg: transparent; --btn-bd: transparent; color: var(--muted); }
.btn--ghost:hover { --btn-bg: var(--neutral-bg); color: var(--text); }
.btn--danger { --btn-bg: rgba(171, 32, 9, 0.16); --btn-bd: rgba(255, 116, 82, 0.35); --btn-fg: #ffb4a3; }
.btn--danger:hover { --btn-bg: rgba(171, 32, 9, 0.3); }
.btn--sm { min-height: 34px; padding: 0 13px; font-size: 13px; }
.btn--sm svg { width: 16px; height: 16px; }
.btn--icon { width: 40px; padding: 0; }
.btn--block { width: 100%; }
.btn--lg { min-height: 52px; padding: 0 26px; font-size: 16px; }
.btn[disabled], .btn[aria-disabled="true"] {
  opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none;
}
.btn[disabled]::after { display: none; }
.btn.is-busy { cursor: progress; }
.btn.is-busy .btn__label { opacity: 0; }
.btn.is-busy svg:not(.spinner) { opacity: 0; }
.btn .spinner { position: absolute; inset: 0; margin: auto; }

.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.25); border-top-color: currentColor;
  animation: spin 0.8s linear infinite;
}

/* ---------- Chips / badges ---------------------------------------------- */
.chip {
  --chip-fg: var(--muted); --chip-bg: var(--neutral-bg);
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px;
  background: var(--chip-bg); color: var(--chip-fg);
  font-size: 12px; font-weight: 800; letter-spacing: 0.02em; line-height: 1.5; white-space: nowrap;
}
.chip__dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.chip--ok { --chip-fg: var(--ok); --chip-bg: var(--ok-bg); }
.chip--ok .chip__dot { box-shadow: 0 0 0 0 rgba(111, 214, 160, 0.6); animation: pulse-dot 2.4s ease-out infinite; }
.chip--warn { --chip-fg: var(--warn); --chip-bg: var(--warn-bg); }
.chip--bad { --chip-fg: var(--bad); --chip-bg: var(--bad-bg); }
.chip--info { --chip-fg: var(--info); --chip-bg: var(--info-bg); }
.chip--brand { --chip-fg: #ffd2c4; --chip-bg: rgba(171, 32, 9, 0.35); }
@keyframes pulse-dot {
  0% { box-shadow: 0 0 0 0 rgba(111, 214, 160, 0.55); }
  70%, 100% { box-shadow: 0 0 0 7px rgba(111, 214, 160, 0); }
}

.sandbox-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px 6px 10px; border-radius: 999px;
  background: repeating-linear-gradient(-45deg, rgba(255, 194, 102, 0.16) 0 8px, rgba(255, 194, 102, 0.08) 8px 16px);
  border: 1px solid rgba(255, 194, 102, 0.45);
  color: var(--warn); font-size: 12px; font-weight: 900; letter-spacing: 0.06em; text-transform: uppercase;
  white-space: nowrap;
}
.sandbox-badge svg { width: 15px; height: 15px; }
.sandbox-badge--live {
  background: var(--bad-bg); border-color: rgba(255, 138, 122, 0.6); color: var(--bad);
}

/* ---------- Cards / surfaces ------------------------------------------- */
.card {
  position: relative;
  background: linear-gradient(180deg, rgba(30, 27, 24, 0.92), rgba(22, 20, 18, 0.92));
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: clamp(16px, 2.4vw, 24px);
  backdrop-filter: blur(6px);
}
.card--glow { overflow: hidden; isolation: isolate; }
.card--glow::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: 0;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 0%), rgba(255, 116, 82, 0.09), transparent 60%);
  transition: opacity var(--t) var(--ease-out);
}
.card--glow:hover::before { opacity: 1; }
.card--interactive { cursor: pointer; transition: transform var(--t) var(--ease-out), border-color var(--t) var(--ease-out); }
.card--interactive:hover { transform: translateY(-2px); border-color: var(--line-strong); }

.card__head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-bottom: 16px;
}
.card__title { font-size: 16px; font-weight: 900; }
.card__sub { color: var(--muted); font-size: 13px; }

/* ---------- Login ------------------------------------------------------- */
.login {
  min-height: 100vh; min-height: 100dvh;
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  align-items: center; gap: clamp(24px, 5vw, 72px);
  padding: clamp(20px, 5vw, 64px) var(--gutter);
  max-width: 1240px; margin: 0 auto;
}
.login__hero { position: relative; display: grid; gap: 22px; }
.login__logo-wrap { position: relative; width: clamp(140px, 22vw, 240px); aspect-ratio: 1; }
.login__logo-wrap::before {
  content: ""; position: absolute; inset: -18%; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 106, 31, 0.35), rgba(171, 32, 9, 0.12) 45%, transparent 70%);
  filter: blur(10px);
  animation: glow-pulse 5s var(--ease-in-out) infinite;
}
.login__logo { position: relative; width: 100%; height: 100%; object-fit: contain; animation: float 7s var(--ease-in-out) infinite; }
.login__embers { position: absolute; inset: -10% -30%; pointer-events: none; }
.ember {
  position: absolute; bottom: 10%; left: var(--x, 50%);
  width: var(--s, 5px); height: var(--s, 5px); border-radius: 50%;
  background: radial-gradient(circle, #ffd0a0, var(--flame) 55%, transparent 70%);
  opacity: 0; filter: blur(0.3px);
  animation: ember var(--d, 6s) linear var(--delay, 0s) infinite;
}
@keyframes ember {
  0% { opacity: 0; transform: translate3d(0, 0, 0) scale(1); }
  12% { opacity: 0.9; }
  100% { opacity: 0; transform: translate3d(var(--dx, 20px), -240px, 0) scale(0.3); }
}
@keyframes float { 50% { transform: translateY(-10px) rotate(-1.2deg); } }
@keyframes glow-pulse { 50% { opacity: 0.65; transform: scale(1.06); } }

.wordmark {
  font-family: var(--display); font-weight: 400; letter-spacing: 0.03em; line-height: 0.95;
  color: var(--text);
  text-shadow: 0 2px 0 var(--primary), 0 6px 24px rgba(171, 32, 9, 0.45);
}
.login__title { font-size: clamp(40px, 7vw, 76px); }
.login__lead { font-size: clamp(16px, 1.6vw, 19px); color: var(--muted); max-width: 46ch; }
.login__lead strong { color: var(--text); }

.login__panel { display: grid; gap: 18px; }
.login__panel .card { padding: clamp(20px, 3vw, 32px); }
.login__panel h2 { font-size: 22px; margin-bottom: 6px; }

.steps { list-style: none; margin: 18px 0 22px; padding: 0; display: grid; gap: 4px; counter-reset: step; }
.steps li {
  position: relative; display: grid; grid-template-columns: 40px 1fr; gap: 14px; align-items: start;
  padding: 12px 0;
}
.steps li + li::before {
  content: ""; position: absolute; left: 19px; top: -10px; height: 22px; width: 2px;
  background: linear-gradient(var(--line-strong), transparent);
}
.steps__num {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  background: var(--surface-3); border: 1px solid var(--line-strong);
  font-family: var(--display); font-size: 18px; color: var(--coral); padding-top: 3px;
}
.steps strong { display: block; font-weight: 900; }
.steps span { color: var(--muted); font-size: 14px; }

.notice {
  display: grid; grid-template-columns: 22px 1fr; gap: 12px; align-items: start;
  padding: 14px 16px; border-radius: var(--r);
  border: 1px solid var(--line-strong); background: var(--neutral-bg);
  font-size: 14px; color: var(--muted);
}
.notice svg { width: 22px; height: 22px; color: var(--muted); }
.notice strong { color: var(--text); }
.notice--warn { border-color: rgba(255, 194, 102, 0.35); background: var(--warn-bg); }
.notice--warn svg { color: var(--warn); }
.notice--info { border-color: rgba(157, 184, 255, 0.3); background: var(--info-bg); }
.notice--info svg { color: var(--info); }
.notice--bad { border-color: rgba(255, 138, 122, 0.35); background: var(--bad-bg); }
.notice--bad svg { color: var(--bad); }
.notice--brand { border-color: rgba(255, 116, 82, 0.35); background: rgba(171, 32, 9, 0.14); }
.notice--brand svg { color: var(--coral); }

.discord-btn {
  --btn-bg: #5865F2; --btn-bd: rgba(255, 255, 255, 0.18); --btn-fg: #fff;
  box-shadow: 0 14px 36px -16px rgba(88, 101, 242, 0.9);
}
.discord-btn:hover { --btn-bg: #4F5BEA; }

.login__foot { color: var(--faint); font-size: 12px; text-align: center; }

/* ---------- App shell -------------------------------------------------- */
.shell { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-rows: auto 1fr; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px;
  min-height: var(--header-h);
  padding: 10px var(--gutter);
  padding-top: max(10px, env(safe-area-inset-top));
  background: rgba(14, 13, 12, 0.72);
  backdrop-filter: blur(16px) saturate(140%);
  border-bottom: 1px solid var(--line);
  animation: slide-down var(--t-slow) var(--ease-out) both;
}
@keyframes slide-down { from { opacity: 0; transform: translateY(-100%); } to { opacity: 1; transform: none; } }

.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; }
.brand:hover { color: var(--text); }
.brand img { width: 40px; height: 40px; object-fit: contain; transition: transform var(--t-slow) var(--ease-spring); }
.brand:hover img { transform: rotate(-8deg) scale(1.08); }
.brand__name { font-family: var(--display); font-size: 22px; letter-spacing: 0.04em; padding-top: 4px; }
.topbar__spacer { flex: 1; min-width: 0; }

.usermenu { display: flex; align-items: center; gap: 10px; min-width: 0; }
.usermenu > * { flex-shrink: 0; }
.usermenu > .usermenu__who { flex-shrink: 1; min-width: 0; }
.usermenu__who { display: grid; text-align: right; line-height: 1.2; }
.usermenu__name { font-weight: 900; font-size: 14px; max-width: 28ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.usermenu__role { color: var(--muted); font-size: 12px; }

.avatar {
  --size: 36px;
  width: var(--size); height: var(--size); border-radius: 50%; flex: none;
  object-fit: cover; background: var(--surface-3);
  border: 1px solid var(--line-strong);
  display: grid; place-items: center; overflow: hidden;
  font-weight: 900; font-size: calc(var(--size) * 0.4); color: var(--coral);
}
.avatar--lg { --size: 64px; }
.avatar--xl { --size: 84px; }
.avatar--sm { --size: 28px; }

.layout { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
.layout--member { grid-template-columns: minmax(0, 1fr); }

.sidebar {
  position: sticky; top: var(--header-h); align-self: start;
  height: calc(100vh - var(--header-h)); height: calc(100dvh - var(--header-h));
  padding: 22px 14px 22px var(--gutter);
  overflow-y: auto;
}
.nav { position: relative; display: grid; gap: 2px; }
.nav__group { margin: 18px 12px 6px; color: var(--faint); font-size: 11px; font-weight: 900; letter-spacing: 0.12em; text-transform: uppercase; }
.nav__group:first-child { margin-top: 0; }
.nav__link {
  position: relative; z-index: 1;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 12px;
  color: var(--muted); text-decoration: none; font-weight: 800; font-size: 14px;
  transition: color var(--t) var(--ease-out), background-color var(--t) var(--ease-out);
}
.nav__link svg { width: 19px; height: 19px; flex: none; transition: transform var(--t) var(--ease-spring); }
.nav__link:hover { color: var(--text); background: rgba(244, 239, 232, 0.04); }
.nav__link:hover svg { transform: scale(1.12); }
.nav__link[aria-current="page"] { color: var(--text); }
.nav__link[aria-current="page"] svg { color: var(--coral); }
.nav__badge {
  margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: 999px;
  background: var(--bad-bg); color: var(--bad); font-size: 11px; font-weight: 900; text-align: center;
}
.nav__indicator {
  position: absolute; left: 0; right: 0; top: 0; z-index: 0;
  height: var(--ih, 0px); transform: translateY(var(--iy, 0px));
  border-radius: 12px;
  background: linear-gradient(90deg, rgba(171, 32, 9, 0.35), rgba(255, 116, 82, 0.08));
  border: 1px solid rgba(255, 116, 82, 0.22);
  opacity: 0;
  transition: transform 420ms var(--ease-out), height 420ms var(--ease-out), opacity var(--t);
}
.nav__indicator.is-ready { opacity: 1; }
.nav__indicator::before {
  content: ""; position: absolute; left: -1px; top: 22%; bottom: 22%; width: 3px; border-radius: 3px;
  background: var(--coral); box-shadow: 0 0 12px var(--flame);
}

.main {
  min-width: 0;
  padding: 28px var(--gutter) 64px;
  padding-bottom: max(64px, calc(env(safe-area-inset-bottom) + 64px));
}
.view { max-width: 1180px; margin: 0 auto; display: grid; gap: 22px; }
.view:focus { outline: none; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head__eyebrow { color: var(--coral); font-size: 12px; font-weight: 900; letter-spacing: 0.14em; text-transform: uppercase; margin-bottom: 6px; }
.page-head h1 { font-size: clamp(26px, 3.2vw, 34px); font-weight: 900; }
.page-head p { color: var(--muted); margin-top: 6px; max-width: 64ch; }
.page-head__actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Stats ------------------------------------------------------ */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.stat { display: grid; gap: 10px; padding: 18px 20px; min-height: 124px; align-content: space-between; }
.stat__label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; font-weight: 800; }
.stat__label svg { width: 17px; height: 17px; color: var(--coral); }
.stat__value { font-size: clamp(26px, 3vw, 34px); font-weight: 900; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat__hint { color: var(--faint); font-size: 12px; }
.stat--alert { border-color: rgba(255, 138, 122, 0.35); }
.stat--alert .stat__value { color: var(--bad); }
.stat--alert .stat__label svg { color: var(--bad); }

/* ---------- Grids ------------------------------------------------------ */
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.stack { display: grid; gap: 12px; }
.view > *, .stack > *, .grid-2 > *, .grid-3 > *, .stats > *, .modal__body > *, .drawer__body > *, .sub-card__meta > * { min-width: 0; }
.page-head > div { min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row--between { justify-content: space-between; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.strong { font-weight: 900; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* ---------- Member area ------------------------------------------------ */
.hello {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: clamp(20px, 3vw, 30px);
  overflow: hidden;
}
.hello::after {
  content: ""; position: absolute; right: -60px; top: -80px; width: 280px; height: 280px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 106, 31, 0.22), transparent 65%);
  pointer-events: none;
}
.hello__text { flex: 1; min-width: 200px; }
.hello__text h1 { font-size: clamp(24px, 3vw, 32px); font-weight: 900; }
.hello__text p { color: var(--muted); margin-top: 4px; }

.sub-card { display: grid; gap: 16px; }
.sub-card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.sub-card__name { font-size: 18px; font-weight: 900; }
.sub-card__meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.meta { display: grid; gap: 2px; }
.meta__k { color: var(--faint); font-size: 12px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; }
.meta__v { font-weight: 800; }

.product { display: grid; gap: 14px; align-content: start; }
.product__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.product__name { font-size: 18px; font-weight: 900; }
.product__price { display: flex; align-items: baseline; gap: 6px; }
.product__amount { font-size: 30px; font-weight: 900; letter-spacing: -0.02em; }
.product__interval { color: var(--muted); font-weight: 800; }
.product__desc { color: var(--muted); font-size: 14px; white-space: pre-line; }
.product__foot { margin-top: auto; display: grid; gap: 8px; }

/* ---------- Toolbar / inputs ------------------------------------------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.toolbar .field { margin: 0; }
.search {
  position: relative; flex: 1 1 260px; min-width: 0;
}
.search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--faint); pointer-events: none; }
.search input { padding-left: 42px; }

.field { display: grid; gap: 7px; }
.field + .field { margin-top: 16px; }
.field__label { font-weight: 800; font-size: 14px; }
.field__hint { color: var(--faint); font-size: 12.5px; }
.field__error { color: var(--bad); font-size: 13px; font-weight: 700; }
.input, .select, .textarea {
  width: 100%; min-height: 44px; padding: 10px 14px;
  background: rgba(14, 13, 12, 0.6); color: var(--text);
  border: 1px solid var(--control-border); border-radius: 12px;
  transition: border-color var(--t) var(--ease-out), box-shadow var(--t) var(--ease-out), background-color var(--t);
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.select {
  appearance: none; -webkit-appearance: none; padding-right: 40px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 52%, calc(100% - 14px) 52%;
  background-size: 6px 6px, 6px 6px; background-repeat: no-repeat;
}
.select option { background: var(--surface-2); color: var(--text); }
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--control-border-hover); }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--coral);
  box-shadow: 0 0 0 4px rgba(255, 116, 82, 0.16);
  background: rgba(14, 13, 12, 0.85);
}
.input[aria-invalid="true"] { border-color: var(--bad); }
.input--code { font-family: var(--mono); letter-spacing: 0.08em; font-size: 16px; }
.input:disabled, .select:disabled, .textarea:disabled { opacity: 0.55; cursor: not-allowed; }

.check {
  display: grid; grid-template-columns: 22px 1fr; gap: 12px; align-items: start; cursor: pointer;
  padding: 10px 12px; border-radius: 12px; border: 1px solid transparent;
  transition: background-color var(--t), border-color var(--t);
}
.check:hover { background: rgba(244, 239, 232, 0.03); }
.check input {
  appearance: none; -webkit-appearance: none; margin: 1px 0 0; width: 22px; height: 22px;
  border-radius: 7px; border: 1.5px solid var(--control-border); background: rgba(14, 13, 12, 0.6);
  display: grid; place-items: center; cursor: pointer;
  transition: background-color var(--t-fast), border-color var(--t-fast);
}
.check input::after {
  content: ""; width: 6px; height: 11px; border: solid #fff; border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg) scale(0); margin-top: -2px; transition: transform var(--t-fast) var(--ease-spring);
}
.check input:checked { background: var(--primary); border-color: var(--coral); }
.check input:checked::after { transform: rotate(45deg) scale(1); }
.check input:disabled { opacity: 0.45; cursor: not-allowed; }
.check--disabled { cursor: not-allowed; opacity: 0.7; }
.check__label { font-weight: 700; }
.check__hint { display: block; color: var(--faint); font-size: 12.5px; font-weight: 600; }
.checklist { display: grid; gap: 2px; max-height: 280px; overflow: auto; padding: 4px; border: 1px solid var(--line); border-radius: 14px; background: rgba(14, 13, 12, 0.4); }

.switch { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; font-weight: 800; }
.switch input {
  appearance: none; -webkit-appearance: none; margin: 0; width: 46px; height: 26px; border-radius: 999px;
  background: var(--surface-3); border: 1px solid var(--control-border); position: relative; cursor: pointer;
  transition: background-color var(--t) var(--ease-out);
}
.switch input::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--muted); transition: transform var(--t) var(--ease-spring), background-color var(--t);
}
.switch input:checked { background: var(--primary); border-color: var(--coral); }
.switch input:checked::after { transform: translateX(20px); background: #fff; }

/* ---------- Tables ---------------------------------------------------- */
.table-wrap { position: relative; overflow-x: auto; border-radius: var(--r-lg); border: 1px solid var(--line); background: rgba(22, 20, 18, 0.85); }
/* positioned so absolutely positioned screen-reader text stays inside the scroll container */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; font-size: 11.5px; font-weight: 900; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--faint); padding: 14px 16px; border-bottom: 1px solid var(--line); white-space: nowrap;
  background: rgba(30, 27, 24, 0.6);
}
.table td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background-color var(--t-fast); animation: rise-in var(--t-slow) var(--ease-out) both; animation-delay: calc(var(--i, 0) * 28ms); }
.table tbody tr.is-clickable { cursor: pointer; }
.table tbody tr.is-clickable:hover, .table tbody tr.is-clickable:focus-visible { background: rgba(255, 116, 82, 0.05); }
.table tbody tr:focus-visible { outline: 2px solid var(--coral); outline-offset: -2px; border-radius: 0; }
.table .actions { text-align: right; white-space: nowrap; }
.table td.cell-primary { min-width: 180px; }
.table .actions .row { justify-content: flex-end; flex-wrap: nowrap; }

.identity { display: flex; align-items: center; gap: 12px; min-width: 0; }
.identity__text { display: grid; min-width: 0; line-height: 1.3; }
.identity__name { font-weight: 900; }
.identity__sub { color: var(--faint); font-size: 12.5px; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }

.progress { width: 100%; min-width: 90px; height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; position: relative; }
.progress__bar {
  position: absolute; inset: 0 auto 0 0; width: 100%; border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--flame));
  transform-origin: left center; transform: scaleX(var(--p, 0));
  transition: transform 800ms var(--ease-out);
}
.progress__res {
  position: absolute; inset: 0 auto 0 0; width: 100%; border-radius: inherit;
  background: rgba(255, 194, 102, 0.5); transform-origin: left; transform: scaleX(var(--r, 0));
}

.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: 13px; font-weight: 700; }
.pager__btns { display: flex; gap: 8px; }

/* ---------- Lists / timeline ----------------------------------------- */
.list { display: grid; }
.list__item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.list__item:last-child { border-bottom: 0; }
.list__main { flex: 1; min-width: 0; }
.list__title { font-weight: 800; }

.timeline { list-style: none; margin: 0; padding: 0; display: grid; }
.timeline__item { position: relative; display: grid; grid-template-columns: 34px 1fr; gap: 14px; padding: 12px 0; }
.timeline__item::before {
  content: ""; position: absolute; left: 16px; top: 46px; bottom: -12px; width: 2px; background: var(--line);
}
.timeline__item:last-child::before { display: none; }
.timeline__icon {
  width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center;
  background: var(--surface-3); border: 1px solid var(--line-strong); color: var(--coral);
}
.timeline__icon svg { width: 16px; height: 16px; }
.timeline__body { min-width: 0; }
.timeline__title { font-weight: 800; overflow-wrap: anywhere; }
.timeline__title .actor { color: var(--text); font-weight: 900; }
.timeline__meta { color: var(--faint); font-size: 12.5px; display: flex; gap: 8px; flex-wrap: wrap; }
.timeline__details {
  margin-top: 6px; padding: 8px 10px; border-radius: 10px; background: rgba(14, 13, 12, 0.6);
  border: 1px solid var(--line); color: var(--muted); font-family: var(--mono); font-size: 12px;
  white-space: pre-wrap; overflow-wrap: anywhere; max-height: 160px; overflow: auto;
}

/* ---------- Empty / error states ------------------------------------- */
.empty {
  display: grid; justify-items: center; text-align: center; gap: 12px;
  padding: clamp(28px, 5vw, 48px) 20px;
}
.empty__icon {
  width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center;
  background: radial-gradient(circle at 30% 20%, rgba(255, 116, 82, 0.28), rgba(171, 32, 9, 0.12));
  border: 1px solid rgba(255, 116, 82, 0.25); color: var(--coral);
  animation: pop-in var(--t-slow) var(--ease-spring) both;
}
.empty__icon svg { width: 28px; height: 28px; }
.empty--error .empty__icon { background: var(--bad-bg); border-color: rgba(255, 138, 122, 0.35); color: var(--bad); }
.empty h3 { font-size: 18px; font-weight: 900; }
.empty p { color: var(--muted); max-width: 52ch; }
.empty .mono { color: var(--faint); }

/* ---------- Skeletons ------------------------------------------------- */
.skel {
  display: block; border-radius: 8px; height: 14px;
  background: linear-gradient(90deg, rgba(244, 239, 232, 0.05) 0%, rgba(244, 239, 232, 0.11) 40%, rgba(244, 239, 232, 0.05) 80%);
  background-size: 300% 100%;
  animation: shimmer 1.6s linear infinite;
}
.skel--title { height: 22px; width: 55%; }
.skel--value { height: 34px; width: 60%; border-radius: 10px; }
.skel--line { width: 100%; }
.skel--short { width: 40%; }
.skel--avatar { width: 36px; height: 36px; border-radius: 50%; flex: none; }
.skel--block { height: 180px; border-radius: var(--r-lg); }
.skel-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; }
.skel-row .stack { flex: 1; gap: 8px; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -200% 0; } }

/* ---------- Dialogs / drawers ---------------------------------------- */
dialog { color: var(--text); }
.modal, .drawer {
  padding: 0; border: 1px solid var(--line-strong); background: var(--surface);
  box-shadow: var(--shadow-lg);
  max-width: none; max-height: none;
}
.modal::backdrop, .drawer::backdrop {
  background: rgba(8, 7, 6, 0.6);
  backdrop-filter: blur(4px);
  opacity: 0; transition: opacity var(--t) var(--ease-out);
}
.modal.is-open::backdrop, .drawer.is-open::backdrop { opacity: 1; }

.modal {
  width: min(520px, calc(100vw - 32px));
  margin: auto; border-radius: var(--r-xl);
  opacity: 0; transform: translateY(16px) scale(0.97);
  transition: opacity var(--t) var(--ease-out), transform var(--t) var(--ease-out);
}
.modal.is-open { opacity: 1; transform: none; }
.modal__body { padding: 26px; display: grid; gap: 16px; }
.modal__icon {
  width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center;
  background: rgba(171, 32, 9, 0.22); color: var(--coral); border: 1px solid rgba(255, 116, 82, 0.3);
}
.modal__icon svg { width: 24px; height: 24px; }
.modal__title { font-size: 20px; font-weight: 900; }
.modal__text { color: var(--muted); }
.modal__text p + p { margin-top: 8px; }
.modal__text strong { color: var(--text); }
.modal__title, .modal__text, .drawer__title, .drawer__sub, .card__title, .product__name, .sub-card__name, .hello__text h1, .page-head h1, .notice, .field__error, .check__label { overflow-wrap: anywhere; }
.modal__foot { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; padding: 0 26px 24px; }

.drawer {
  position: fixed; inset: 0 0 0 auto; margin: 0;
  width: min(560px, 100vw); height: 100vh; height: 100dvh;
  border-radius: var(--r-xl) 0 0 var(--r-xl); border-right: 0;
  display: grid; grid-template-rows: auto 1fr auto;
  transform: translateX(104%);
  transition: transform 440ms var(--ease-out);
}
.drawer.is-open { transform: none; }
.drawer:not([open]) { display: none; }
.drawer__head {
  display: flex; align-items: center; gap: 14px; justify-content: space-between;
  padding: 20px 22px; padding-top: max(20px, env(safe-area-inset-top));
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
}
.drawer__title { font-size: 18px; font-weight: 900; }
.drawer__sub { color: var(--muted); font-size: 13px; }
.drawer__body { overflow-y: auto; padding: 22px; display: grid; gap: 20px; align-content: start; overscroll-behavior: contain; }
.drawer__foot {
  display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap;
  padding: 16px 22px; padding-bottom: max(16px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line); background: var(--surface);
}
.drawer__section { display: grid; gap: 12px; }
.drawer__section > h3 { font-size: 13px; font-weight: 900; color: var(--faint); letter-spacing: 0.1em; text-transform: uppercase; }
.drawer__body > * { animation: rise-in var(--t-slow) var(--ease-out) both; animation-delay: calc(120ms + var(--i, 0) * 50ms); }

.kv { display: grid; grid-template-columns: minmax(84px, max-content) minmax(0, 1fr); gap: 10px 16px; font-size: 14px; }
.kv dt { color: var(--faint); font-weight: 800; }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; font-weight: 700; }

.code-reveal {
  position: relative; padding: 20px; border-radius: var(--r);
  background: rgba(14, 13, 12, 0.8); border: 1px dashed rgba(255, 116, 82, 0.55);
  text-align: center; font-family: var(--mono); font-size: clamp(18px, 4.6vw, 24px); font-weight: 700; letter-spacing: 0.08em;
  color: var(--text);
  overflow-wrap: anywhere; user-select: all;
  animation: pop-in 520ms var(--ease-spring) 120ms both;
}
.code-reveal::after {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; pointer-events: none;
  box-shadow: 0 0 0 0 rgba(255, 116, 82, 0.4);
  animation: code-glow 2.2s ease-out 400ms 2;
}
@keyframes code-glow { 0% { box-shadow: 0 0 0 0 rgba(255, 116, 82, 0.45); } 100% { box-shadow: 0 0 0 16px rgba(255, 116, 82, 0); } }

/* ---------- Toasts --------------------------------------------------- */
.toasts {
  position: fixed; z-index: 1000; right: 16px; bottom: 16px; bottom: max(16px, env(safe-area-inset-bottom));
  display: grid; gap: 10px; width: min(380px, calc(100vw - 32px)); pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: grid; grid-template-columns: 22px 1fr auto; gap: 12px; align-items: start;
  padding: 14px 14px 14px 16px; border-radius: var(--r);
  background: rgba(30, 27, 24, 0.96); border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-lg); backdrop-filter: blur(10px);
  font-size: 14px; font-weight: 700;
  animation: toast-in 420ms var(--ease-spring) both;
}
.toast.is-leaving { animation: toast-out 260ms var(--ease-out) both; }
.toast svg { width: 22px; height: 22px; }
.toast--ok svg { color: var(--ok); }
.toast--error { border-color: rgba(255, 138, 122, 0.4); }
.toast--error svg { color: var(--bad); }
.toast--info svg { color: var(--info); }
.toast__close { background: none; border: 0; color: var(--faint); cursor: pointer; padding: 2px; border-radius: 6px; }
.toast__close:hover { color: var(--text); }
.toast__close svg { width: 18px; height: 18px; }
@keyframes toast-in { from { opacity: 0; transform: translate3d(0, 16px, 0) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translate3d(24px, 0, 0); } }

/* ---------- System ---------------------------------------------------- */
.sys { display: grid; gap: 14px; align-content: start; }
.sys__head { display: flex; align-items: center; gap: 10px 12px; flex-wrap: wrap; }
.sys__head .list__main { min-width: 0; flex: 1 1 8ch; }
.sys__icon {
  width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center;
  background: var(--surface-3); border: 1px solid var(--line-strong); color: var(--coral);
}
.sys__icon svg { width: 22px; height: 22px; }
.sys__title { font-weight: 900; font-size: 16px; }
.jobs { display: grid; grid-template-columns: repeat(auto-fit, minmax(6.75rem, 1fr)); gap: 8px; }
.jobs__cell { padding: 10px; border-radius: 14px; background: rgba(14, 13, 12, 0.55); border: 1px solid var(--line); min-width: 0; }
.jobs__n { font-size: 26px; font-weight: 900; font-variant-numeric: tabular-nums; }
.jobs__k { color: var(--faint); font-size: 12px; font-weight: 800; }
.jobs__cell--bad .jobs__n { color: var(--bad); }

.link-ext { display: inline-flex; align-items: center; gap: 5px; font-weight: 800; text-decoration: none; }
.link-ext svg { width: 14px; height: 14px; }
.link-ext:hover { text-decoration: underline; }

.copy-inline {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 8px;
  background: rgba(14, 13, 12, 0.6); border: 1px solid var(--line); color: var(--muted);
  font-family: var(--mono); font-size: 12px; cursor: pointer; max-width: 100%;
}
.copy-inline:hover { color: var(--text); border-color: var(--line-strong); }
.copy-inline svg { width: 13px; height: 13px; flex: none; }
.copy-inline span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Responsive ----------------------------------------------- */
@media (max-width: 1080px) {
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 920px) {
  :root { --header-h: 60px; }
  html { scroll-padding-top: calc(var(--header-h) + 72px); }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: sticky; top: var(--header-h); z-index: 15; height: auto;
    padding: 8px var(--gutter);
    background: rgba(14, 13, 12, 0.82); backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--line);
    overflow-x: auto; overflow-y: hidden; scrollbar-width: none;
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 12px, #000 calc(100% - 24px), transparent);
    mask-image: linear-gradient(90deg, transparent 0, #000 12px, #000 calc(100% - 24px), transparent);
  }
  .sidebar::-webkit-scrollbar { display: none; }
  .nav { display: flex; gap: 4px; width: max-content; }
  .nav__group { display: none; }
  .nav__link { padding: 8px 12px; white-space: nowrap; }
  .nav__indicator { top: 0; bottom: 0; left: 0; right: auto; height: auto; width: var(--iw, 0px); transform: translateX(var(--ix, 0px)); }
  .nav__indicator::before { left: 22%; right: 22%; top: auto; bottom: -1px; width: auto; height: 3px; }
  .usermenu__who { display: none; }
  .login { grid-template-columns: minmax(0, 1fr); text-align: left; }
  .login__hero { justify-items: start; }
  /* Tables become stacked cards (tablet and phone) */
  .table-wrap { border: 0; background: transparent; overflow: visible; }
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tbody { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .table tbody tr { min-width: 0; }
  .table tbody tr {
    border: 1px solid var(--line); border-radius: var(--r); background: rgba(22, 20, 18, 0.92);
    padding: 6px 14px;
  }
  .table td {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    padding: 9px 0; border-bottom: 1px dashed var(--line); text-align: right;
  }
  .table td::before {
    content: attr(data-label); color: var(--faint); font-size: 11.5px; font-weight: 900;
    letter-spacing: 0.06em; text-transform: uppercase; text-align: left; flex: none;
  }
  .table td[data-label=""]::before { display: none; }
  .table td.cell-primary { justify-content: flex-start; text-align: left; }
  .table td.cell-primary::before { display: none; }
  .table td:last-child { border-bottom: 0; }
  .table .actions .row { flex-wrap: wrap; }
  .table .chips { justify-content: flex-end; }
  .progress { min-width: 70px; max-width: 120px; }
  .table td > * { min-width: 0; }
  .table .truncate { white-space: normal; overflow-wrap: anywhere; }
  .table td.cell-primary .identity__text { white-space: normal; }
  .table tbody tr:focus-visible { outline-offset: 2px; border-radius: var(--r); }
}

@media (min-width: 641px) and (max-width: 920px) {
  .table tbody { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
}

@media (max-width: 640px) {
  body { font-size: 14.5px; }
  .brand__name { display: none; }
  .topbar { gap: 10px; }
  .sandbox-badge { padding: 5px 10px 5px 8px; font-size: 11px; }
  .main { padding-top: 20px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 14px; min-height: 108px; }
  .stat__value { font-size: 24px; }
  .page-head__actions { width: 100%; }
  .page-head__actions .btn { flex: 1; }
  .drawer { width: 100vw; border-radius: 0; border-left: 0; }
  .modal__body { padding: 22px 20px; }
  .modal__foot { padding: 0 20px 20px; }
  .modal__foot .btn { flex: 1; }
  .kv { grid-template-columns: minmax(0, 1fr); gap: 2px 0; }
  .kv dd { margin-bottom: 10px; }

}

@media (max-width: 360px) {
  .topbar { gap: 6px; }
  .usermenu { gap: 4px; }
  .brand img { width: 30px; height: 30px; }
  .sandbox-badge { padding: 4px 8px 4px 7px; gap: 6px; letter-spacing: 0.04em; }
  .usermenu .avatar { --size: 32px; }
}

@media (max-width: 340px) {
  .stats { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 480px) {
  .btn:not(.btn--icon) { white-space: normal; text-align: center; line-height: 1.25; padding-block: 9px; }
  .modal__foot { flex-direction: column-reverse; }
  .modal__foot .btn { width: 100%; flex: none; }
  .drawer__foot .btn { flex: 1 1 auto; }
  .drawer__foot .btn--primary { flex-basis: 100%; }
}

@media (max-width: 400px) {
  .btn { padding-inline: 14px; }
  .usermenu .btn { width: 40px; padding: 0; }
  .usermenu .btn__label {
    position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
}

/* ---------- Reduced motion ------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0ms !important;
    transition-duration: 1ms !important;
    transition-delay: 0ms !important;
  }
  .ambient__orb, .ember, .login__logo, .login__logo-wrap::before, .boot__mark img { animation: none !important; }
  .ember { display: none; }
  .skel { animation: none !important; }
  .spinner, .boot__ring { animation: spin 1.2s linear infinite !important; }
}

@media (forced-colors: active) {
  .btn, .chip, .card, .input, .select, .textarea { border: 1px solid CanvasText; }
  .nav__link[aria-current="page"] { outline: 2px solid Highlight; }
}

/* ---------- Trials, free access & legal declarations ------------------- */
.steps-inline { list-style: none; margin: 0; padding: 0; display: flex; gap: 8px; flex-wrap: wrap; }
.steps-inline li {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 999px;
  background: var(--neutral-bg); color: var(--muted); font-size: 13px; font-weight: 800;
}
.steps-inline__n {
  width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px;
  background: var(--surface-3); color: var(--muted); border: 1px solid var(--control-border);
}
.steps-inline li.is-active { color: var(--text); background: rgba(171, 32, 9, 0.28); }
.steps-inline li.is-active .steps-inline__n { background: var(--primary); border-color: var(--coral); color: #fff; }
.steps-inline li.is-done .steps-inline__n { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); }

.offer__kv { margin-top: 4px; }
.offer__lines { margin: 0; padding-left: 18px; display: grid; gap: 6px; }
.offer__lines li { color: var(--text); }

.consents { border: 0; margin: 0; padding: 0; display: grid; gap: 4px; min-width: 0; }
.consents legend { margin-bottom: 6px; padding: 0; }
.check--consent { border-color: var(--line); background: rgba(14, 13, 12, 0.35); }
.check--consent a { font-weight: 800; }
.check input[aria-invalid="true"] { border-color: var(--bad); box-shadow: 0 0 0 3px rgba(255, 138, 122, 0.25); }

.mode-options { border: 0; margin: 0; padding: 0; display: grid; gap: 8px; min-width: 0; }
.mode-options legend { margin-bottom: 6px; padding: 0; }
.mode-option {
  display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 12px; align-items: start; cursor: pointer;
  padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line-strong); background: rgba(14, 13, 12, 0.4);
  transition: border-color var(--t), background-color var(--t);
}
.mode-option:hover { border-color: var(--control-border-hover); }
.mode-option:has(input:checked) { border-color: var(--coral); background: rgba(171, 32, 9, 0.16); }
.mode-option input {
  appearance: none; -webkit-appearance: none; margin: 2px 0 0; width: 20px; height: 20px; border-radius: 50%;
  border: 1.5px solid var(--control-border); background: rgba(14, 13, 12, 0.6); display: grid; place-items: center; cursor: pointer;
}
.mode-option input::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--coral); transform: scale(0); transition: transform var(--t-fast) var(--ease-spring); }
.mode-option input:checked { border-color: var(--coral); }
.mode-option input:checked::after { transform: scale(1); }
.mode-option__title { display: block; font-weight: 900; }
.mode-option__text { display: block; color: var(--muted); font-size: 13px; }

.duration { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 9rem); gap: 8px; }
.grant-form { padding: 14px; border-radius: var(--r); border: 1px solid var(--line-strong); background: rgba(14, 13, 12, 0.35); }
.grant-form .row { justify-content: flex-end; }

.segmented { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line-strong); width: fit-content; max-width: 100%; }
.segmented__btn {
  min-height: 36px; padding: 0 16px; border-radius: 999px; border: 0; background: transparent; color: var(--muted);
  font-weight: 800; cursor: pointer; transition: background-color var(--t), color var(--t);
}
.segmented__btn:hover { color: var(--text); }
.segmented__btn[aria-pressed="true"] { background: rgba(171, 32, 9, 0.35); color: var(--text); }

.pre-wrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.checklist-steps { margin: 0; padding-left: 20px; display: grid; gap: 6px; color: var(--muted); font-size: 14px; }
.nav__badge--warn { background: var(--warn-bg); color: var(--warn); }
