:root {
  color-scheme: light;
  --color-primary: #7c3aed;
  --color-primary-strong: #5b21b6;
  --color-secondary: #6366f1;
  --color-accent: #ec4899;
  --color-accent-strong: #be185d;
  --color-background: #faf5ff;
  --color-foreground: #0f172a;
  --color-muted: #f7f3fd;
  --color-border: #e9ddf8;
  --color-subtle: #64748b;
  --color-success: #047857;
  --color-warning: #a16207;
  --color-danger: #b91c1c;
  --color-info: #0369a1;
  --surface: #ffffff;
  --surface-soft: #fcfaff;
  --focus: #6d28d9;
  --space-1: .25rem;
  --space-2: .5rem;
  --space-3: .75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --radius-sm: .625rem;
  --radius-md: .875rem;
  --radius-lg: 1.25rem;
  --radius-xl: 1.75rem;
  --shadow-sm: 0 1px 2px rgba(45, 17, 75, .06);
  --shadow-md: 0 10px 30px rgba(67, 33, 102, .09);
  --shadow-lg: 0 24px 60px rgba(61, 26, 99, .16);
  --sidebar-width: 16rem;
  font-family: "Plus Jakarta Sans", "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--color-background); scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; min-height: 100dvh; color: var(--color-foreground); background: var(--color-background); font-size: 16px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
body.modal-open { overflow: hidden; }
button, input, select, textarea { font: inherit; }
button, a, [role="button"] { -webkit-tap-highlight-color: transparent; }
button:not(:disabled), a, input[type="file"] { cursor: pointer; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; height: auto; }
svg { width: 1.25rem; height: 1.25rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }
:focus { outline: none; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
::selection { background: #e9d5ff; color: #3b0764; }

.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.skip-link { position: fixed; z-index: 1000; top: .75rem; left: .75rem; padding: .7rem 1rem; border-radius: var(--radius-sm); background: var(--color-foreground); color: white; transform: translateY(-160%); transition: transform .2s ease; }
.skip-link:focus { transform: translateY(0); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.boot-screen { position: fixed; inset: 0; z-index: 500; display: grid; place-content: center; justify-items: center; gap: 1rem; background: radial-gradient(circle at 50% 35%, #fff 0, #faf5ff 42%, #f3e8ff 100%); }
.boot-screen img { filter: drop-shadow(0 15px 25px rgba(91, 33, 182, .18)); }
.boot-screen p { margin: 0; color: #475569; font-weight: 600; }
.spinner { width: 1.75rem; height: 1.75rem; border: 3px solid #ddd6fe; border-top-color: var(--color-primary); border-radius: 50%; animation: spin .85s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.toast-region { position: fixed; z-index: 900; top: 1rem; right: 1rem; display: grid; gap: .75rem; width: min(25rem, calc(100vw - 2rem)); pointer-events: none; }
.toast { display: grid; grid-template-columns: auto 1fr auto; align-items: start; gap: .75rem; padding: .9rem 1rem; border: 1px solid var(--color-border); border-left: 4px solid var(--color-primary); border-radius: var(--radius-md); background: white; box-shadow: var(--shadow-lg); pointer-events: auto; animation: toast-in .22s ease-out; }
.toast.is-success { border-left-color: var(--color-success); }
.toast.is-error { border-left-color: var(--color-danger); }
.toast svg { margin-top: .1rem; }
.toast p { margin: 0; color: #334155; font-size: .9rem; }
.toast button { display: grid; place-items: center; width: 2.75rem; height: 2.75rem; margin: -.65rem -.7rem 0 0; border: 0; background: transparent; color: #64748b; border-radius: .65rem; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-.5rem); } }

.eyebrow { margin: 0 0 .4rem; color: var(--color-primary-strong); font-size: .75rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.muted { color: var(--color-subtle); }
.text-danger { color: var(--color-danger); }

/* Authentication */
.auth-screen { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(28rem, .95fr); background: #fff; }
.auth-story { position: relative; min-height: 100vh; min-height: 100dvh; overflow: hidden; padding: clamp(2rem, 5vw, 5rem); color: white; background: linear-gradient(145deg, rgba(49, 19, 111, .94), rgba(99, 40, 186, .88) 48%, rgba(190, 24, 93, .86)), url("/static/assets/banner_top.png") center top / 100% auto no-repeat; }
.auth-story::before, .auth-story::after { content: ""; position: absolute; border-radius: 50%; filter: blur(2px); pointer-events: none; }
.auth-story::before { width: 34rem; height: 34rem; right: -14rem; top: -10rem; background: rgba(255,255,255,.1); }
.auth-story::after { width: 26rem; height: 26rem; left: -12rem; bottom: -11rem; background: rgba(236,72,153,.25); }
.auth-brand { position: relative; z-index: 2; display: flex; align-items: center; gap: .8rem; font-size: 1.25rem; font-weight: 800; }
.auth-brand img { border-radius: .9rem; box-shadow: 0 12px 30px rgba(15, 8, 40, .2); }
.auth-copy { position: relative; z-index: 2; width: min(40rem, 88%); padding-top: clamp(4rem, 9vh, 8rem); }
.auth-copy .eyebrow { color: #f5d0fe; }
.auth-copy h1 { margin: 0 0 1.4rem; font-size: clamp(2.4rem, 4.8vw, 4.8rem); line-height: 1.12; letter-spacing: -.045em; }
.auth-copy > p:not(.eyebrow) { max-width: 38rem; margin: 0; color: #ede9fe; font-size: clamp(1rem, 1.5vw, 1.18rem); }
.auth-benefits { display: grid; gap: .9rem; margin: 2rem 0 0; padding: 0; list-style: none; }
.auth-benefits li { display: flex; align-items: center; gap: .7rem; font-weight: 600; }
.auth-benefits svg { flex: 0 0 auto; width: 1.4rem; height: 1.4rem; padding: .2rem; border-radius: 50%; background: rgba(255,255,255,.14); }
.auth-mascot { position: absolute; z-index: 1; right: clamp(-4rem, 3vw, 2rem); bottom: clamp(-4rem, -2vw, -1rem); width: clamp(17rem, 34vw, 32rem); height: auto; aspect-ratio: 1; object-fit: contain; filter: drop-shadow(0 28px 35px rgba(25, 8, 54, .28)); user-select: none; }
.auth-panel { display: grid; min-width: 0; place-items: center; padding: clamp(1.25rem, 5vw, 5rem); background: radial-gradient(circle at top right, #fdf4ff 0, white 40%); }
.auth-card { width: 100%; max-width: 28rem; min-width: 0; }
.mobile-brand { display: none; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: .35rem; margin-bottom: 2rem; padding: .3rem; border: 1px solid var(--color-border); border-radius: .8rem; background: var(--color-muted); }
.segment { min-height: 44px; border: 0; border-radius: .6rem; background: transparent; color: #64748b; font-weight: 700; transition: color .2s, background .2s, box-shadow .2s; }
.segment.is-active { background: white; color: var(--color-primary-strong); box-shadow: var(--shadow-sm); }
.auth-form { display: grid; min-width: 0; gap: 1.15rem; }
.auth-form h2 { margin: 0; font-size: clamp(1.75rem, 4vw, 2.25rem); letter-spacing: -.03em; }
.form-intro { margin: .4rem 0 0; color: var(--color-subtle); }
.field { display: grid; gap: .45rem; color: #334155; font-size: .9rem; font-weight: 700; }
.field input, .field select, .field textarea, .search-input { width: 100%; min-height: 46px; padding: .72rem .9rem; border: 1px solid #d7cce6; border-radius: .7rem; background: white; color: var(--color-foreground); font-size: 1rem; transition: border-color .2s, box-shadow .2s, background .2s; }
.field textarea { min-height: 6rem; resize: vertical; }
.field input:hover, .field select:hover, .field textarea:hover { border-color: #b9a3d7; }
.field input:focus, .field select:focus, .field textarea:focus, .search-input:focus { border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(124,58,237,.16); }
.field input[aria-invalid="true"] { border-color: var(--color-danger); box-shadow: 0 0 0 3px rgba(185,28,28,.1); }
.field-hint { color: #64748b; font-size: .76rem; font-weight: 500; }
.field-error { min-height: 1em; color: var(--color-danger); font-size: .8rem; font-weight: 500; }
.password-wrap { position: relative; display: block; }
.password-wrap input { padding-right: 3.4rem; }
.password-toggle { position: absolute; top: 1px; right: 1px; display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: .65rem; background: transparent; color: #64748b; }
.form-note { margin: 0; color: #64748b; font-size: .78rem; text-align: center; }
.auth-text-button { justify-self: end; min-height: 44px; padding: .4rem 0; border: 0; background: transparent; color: var(--color-primary-strong); font-weight: 700; text-align: right; }
.auth-text-button:hover { text-decoration: underline; text-underline-offset: .2rem; }
.sms-code-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .6rem; }
.sms-send-button { min-width: 7.5rem; white-space: nowrap; }
.sms-trust-note { margin: 0; padding: .75rem .85rem; border: 1px solid #bbf7d0; border-radius: .7rem; background: #f0fdf4; color: #166534; font-size: .78rem; font-weight: 650; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .55rem; min-height: 44px; padding: .68rem 1rem; border: 1px solid transparent; border-radius: .7rem; font-weight: 750; line-height: 1.2; transition: transform .18s ease, box-shadow .18s ease, background .18s ease, border-color .18s ease, color .18s ease; }
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(0); }
.btn:disabled { opacity: .52; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, var(--color-primary), var(--color-primary-strong)); color: white; box-shadow: 0 8px 20px rgba(91,33,182,.2); }
.btn-primary:hover:not(:disabled) { box-shadow: 0 11px 24px rgba(91,33,182,.26); }
.btn-secondary { border-color: #c4b5fd; background: white; color: var(--color-primary-strong); }
.btn-secondary:hover:not(:disabled) { border-color: var(--color-primary); background: #faf5ff; }
.btn-ghost { background: transparent; color: #475569; }
.btn-ghost:hover:not(:disabled) { background: #f3edf9; color: var(--color-primary-strong); }
.btn-danger { border-color: #fecaca; background: #fff7f7; color: var(--color-danger); }
.btn-block { width: 100%; min-height: 48px; }
.btn svg { width: 1.1rem; height: 1.1rem; }
.button-loader { display: none; width: 1rem; height: 1rem; border: 2px solid rgba(255,255,255,.45); border-top-color: white; border-radius: 50%; animation: spin .75s linear infinite; }
.is-loading .button-loader { display: inline-block; }

/* Shell */
.app-shell { min-height: 100vh; }
.sidebar { position: fixed; z-index: 80; inset: 0 auto 0 0; display: flex; flex-direction: column; width: var(--sidebar-width); padding: 1.25rem 1rem; border-right: 1px solid var(--color-border); background: rgba(255,255,255,.94); backdrop-filter: blur(16px); }
.brand { display: flex; align-items: center; gap: .7rem; min-height: 52px; padding: .25rem .5rem; border-radius: .8rem; }
.brand img { border-radius: .8rem; box-shadow: 0 7px 18px rgba(91,33,182,.15); }
.brand span { display: grid; line-height: 1.2; }
.brand strong { font-size: 1.05rem; }
.brand small { margin-top: .2rem; color: #64748b; font-size: .7rem; }
.side-nav { display: grid; gap: .35rem; margin-top: 2rem; }
.side-nav a, .sidebar-logout { display: flex; align-items: center; gap: .75rem; min-height: 46px; padding: .7rem .85rem; border: 0; border-radius: .75rem; background: transparent; color: #475569; font-weight: 650; text-align: left; transition: background .2s, color .2s; }
.side-nav a:hover, .sidebar-logout:hover { background: #f5f0fb; color: var(--color-primary-strong); }
.side-nav a.is-active { background: linear-gradient(135deg, #f3e8ff, #fce7f3); color: var(--color-primary-strong); box-shadow: inset 3px 0 var(--color-primary); }
.side-nav svg, .sidebar-logout svg { flex: 0 0 auto; }
.sidebar-help { position: relative; overflow: hidden; margin-top: auto; padding: 1rem 1rem 1rem 5.2rem; border: 1px solid #e9d5ff; border-radius: var(--radius-lg); background: linear-gradient(145deg, #faf5ff, #fdf2f8); min-height: 7.8rem; }
.sidebar-help img { position: absolute; left: -.45rem; bottom: -.25rem; width: 6rem; }
.sidebar-help strong { display: block; color: #4c1d95; font-size: .78rem; }
.sidebar-help p { margin: .35rem 0 0; color: #6b5b7d; font-size: .7rem; line-height: 1.45; }
.sidebar-logout { width: 100%; margin-top: .75rem; }
.app-main { min-height: 100vh; margin-left: var(--sidebar-width); }
.topbar { position: sticky; z-index: 50; top: 0; display: flex; align-items: center; gap: 1rem; min-height: 82px; padding: .9rem clamp(1rem, 3vw, 2.5rem); border-bottom: 1px solid rgba(233,221,248,.9); background: rgba(250,245,255,.88); backdrop-filter: blur(16px); }
.page-heading { flex: 1 1 auto; min-width: 0; }
.page-heading p { margin: 0 0 .1rem; color: var(--color-primary); font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.page-heading h1 { margin: 0; overflow: hidden; font-size: clamp(1.25rem, 2vw, 1.65rem); letter-spacing: -.02em; text-overflow: ellipsis; white-space: nowrap; }
.top-actions { display: flex; flex: 0 0 auto; align-items: center; gap: .75rem; margin-left: auto; }
.credit-pill { display: flex; align-items: center; gap: .65rem; min-height: 48px; padding: .45rem .8rem; border: 1px solid #e9d5ff; border-radius: .8rem; background: white; color: var(--color-primary-strong); box-shadow: var(--shadow-sm); }
.credit-pill > span { display: grid; line-height: 1.15; }
.credit-pill small { color: #64748b; font-size: .66rem; }
.credit-pill strong { font-size: .95rem; }
.account-button { display: flex; align-items: center; gap: .6rem; min-height: 48px; padding: .25rem .4rem; border: 0; border-radius: .8rem; background: transparent; color: var(--color-foreground); text-align: left; }
.account-button:hover { background: #f1eafa; }
.account-button > span:first-child { display: grid; place-items: center; width: 40px; height: 40px; border-radius: .75rem; background: linear-gradient(145deg, var(--color-primary), var(--color-accent)); color: white; font-weight: 800; }
.account-copy { display: grid; line-height: 1.15; }
.account-copy strong { max-width: 9rem; overflow: hidden; font-size: .82rem; text-overflow: ellipsis; white-space: nowrap; }
.account-copy small { margin-top: .25rem; color: #64748b; font-size: .66rem; }
.icon-button { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 1px solid var(--color-border); border-radius: .75rem; background: white; color: #475569; }
.menu-button { display: none; }
.main-content { width: min(100%, 96rem); margin: 0 auto; padding: clamp(1rem, 3vw, 2.5rem); padding-bottom: 4rem; }
.bottom-nav { display: none; }

/* Common page layout */
.page-stack { display: grid; gap: 1.5rem; animation: page-in .22s ease-out; }
@keyframes page-in { from { opacity: 0; transform: translateY(.4rem); } }
.page-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; }
.page-toolbar .search-wrap { flex: 1 1 18rem; }
.search-wrap { position: relative; }
.search-wrap svg { position: absolute; top: 50%; left: .9rem; transform: translateY(-50%); color: #94a3b8; pointer-events: none; }
.search-input { padding-left: 2.7rem; }
.section-title { display: flex; align-items: end; justify-content: space-between; gap: 1rem; }
.section-title h2 { margin: 0; font-size: clamp(1.1rem, 2vw, 1.35rem); letter-spacing: -.02em; }
.section-title p { margin: .25rem 0 0; color: #64748b; font-size: .88rem; }
.panel { min-width: 0; border: 1px solid var(--color-border); border-radius: var(--radius-lg); background: rgba(255,255,255,.94); box-shadow: var(--shadow-sm); }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.2rem 1.35rem; border-bottom: 1px solid var(--color-border); }
.panel-header h2, .panel-header h3 { margin: 0; font-size: 1rem; }
.panel-body { padding: 1.35rem; }

.hero-panel { position: relative; overflow: hidden; display: grid; grid-template-columns: minmax(0, 1fr) 12rem; min-height: 14rem; padding: clamp(1.5rem, 4vw, 2.5rem); border: 1px solid #ddd6fe; border-radius: var(--radius-xl); background: linear-gradient(135deg, #ffffff 0%, #faf5ff 55%, #fdf2f8 100%); box-shadow: var(--shadow-md); }
.hero-panel::after { content: ""; position: absolute; width: 18rem; height: 18rem; right: -6rem; top: -7rem; border-radius: 50%; background: linear-gradient(145deg, rgba(124,58,237,.13), rgba(236,72,153,.12)); }
.hero-content { position: relative; z-index: 2; align-self: center; max-width: 42rem; }
.hero-content h2 { margin: 0 0 .7rem; font-size: clamp(1.55rem, 3vw, 2.45rem); line-height: 1.2; letter-spacing: -.04em; }
.hero-content p:not(.eyebrow) { margin: 0 0 1.2rem; color: #586579; }
.hero-mascot { position: absolute; z-index: 1; right: -1.4rem; bottom: -2.5rem; width: 15.5rem; height: auto; aspect-ratio: 1; object-fit: contain; filter: drop-shadow(0 20px 30px rgba(91,33,182,.15)); }

.stats-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.stat-card { display: flex; align-items: center; gap: 1rem; min-height: 7rem; padding: 1.15rem; border: 1px solid var(--color-border); border-radius: var(--radius-lg); background: white; }
.stat-icon { display: grid; place-items: center; flex: 0 0 auto; width: 3rem; height: 3rem; border-radius: .85rem; background: #f3e8ff; color: var(--color-primary-strong); }
.stat-card:nth-child(2) .stat-icon { background: #e0e7ff; color: #4338ca; }
.stat-card:nth-child(3) .stat-icon { background: #fce7f3; color: var(--color-accent-strong); }
.stat-card span { display: grid; }
.stat-card small { color: #64748b; }
.stat-card strong { font-size: 1.35rem; }

.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr)); gap: 1rem; }
.project-card { position: relative; display: grid; gap: 1rem; min-height: 13rem; padding: 1.2rem; border: 1px solid var(--color-border); border-radius: var(--radius-lg); background: white; box-shadow: var(--shadow-sm); transition: border-color .2s, box-shadow .2s, transform .2s; }
.project-card:hover { border-color: #c4b5fd; box-shadow: var(--shadow-md); transform: translateY(-2px); }
.project-card:focus-visible { outline-offset: 2px; }
.project-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: .8rem; }
.project-glyph { display: grid; place-items: center; width: 2.8rem; height: 2.8rem; border-radius: .8rem; background: linear-gradient(145deg, #f3e8ff, #fce7f3); color: var(--color-primary-strong); }
.project-card h3 { margin: 0; font-size: 1.05rem; line-height: 1.35; }
.project-card p { margin: .3rem 0 0; color: #64748b; font-size: .8rem; }
.file-counts { display: flex; flex-wrap: wrap; gap: .45rem; }
.file-counts span { padding: .25rem .5rem; border-radius: 999px; background: #f8fafc; color: #475569; font-size: .72rem; }
.project-card-footer { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-top: auto; color: #64748b; font-size: .75rem; }
.project-card-footer svg { color: var(--color-primary); }
.status-badge { display: inline-flex; align-items: center; gap: .35rem; min-height: 26px; padding: .22rem .55rem; border-radius: 999px; background: #f1f5f9; color: #475569; font-size: .7rem; font-weight: 750; white-space: nowrap; }
.status-badge::before { content: ""; width: .42rem; height: .42rem; border-radius: 50%; background: currentColor; }
.status-badge.is-running, .status-badge.is-queued { background: #eff6ff; color: #0369a1; }
.status-badge.is-success, .status-badge.is-ready, .status-badge.is-succeeded { background: #ecfdf5; color: #047857; }
.status-badge.is-failed, .status-badge.is-canceled { background: #fef2f2; color: #b91c1c; }
.status-badge.is-overage { background: #fff7ed; color: #c2410c; }
.status-badge.is-draft { background: #faf5ff; color: #6d28d9; }

.empty-state { display: grid; justify-items: center; min-height: 20rem; padding: 3rem 1rem; text-align: center; }
.empty-state img { width: 9rem; margin-bottom: 1rem; }
.empty-state h2 { margin: 0 0 .4rem; font-size: 1.25rem; }
.empty-state p { max-width: 29rem; margin: 0 0 1.2rem; color: #64748b; }

/* Create and upload */
.wizard-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.wizard-step { display: flex; align-items: center; gap: .65rem; min-width: 0; color: #94a3b8; font-size: .8rem; font-weight: 700; }
.wizard-step::after { content: ""; flex: 1; height: 1px; background: #e2e8f0; }
.wizard-step:last-child::after { display: none; }
.wizard-step span { display: grid; place-items: center; flex: 0 0 auto; width: 2rem; height: 2rem; border: 1px solid #d8ccea; border-radius: 50%; background: white; }
.wizard-step.is-active, .wizard-step.is-complete { color: var(--color-primary-strong); }
.wizard-step.is-active span { background: var(--color-primary); color: white; border-color: var(--color-primary); }
.wizard-step.is-complete span { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.create-layout { display: grid; grid-template-columns: minmax(0, 1fr) 21rem; gap: 1.25rem; align-items: start; }
.create-main { display: grid; gap: 1rem; }
.upload-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.upload-zone { position: relative; display: grid; justify-items: center; align-content: center; min-height: 17rem; padding: 1.25rem; border: 2px dashed #c9b8df; border-radius: var(--radius-lg); background: #fcfaff; text-align: center; transition: border-color .2s, background .2s, transform .2s; }
.upload-zone:hover, .upload-zone.is-dragover { border-color: var(--color-primary); background: #faf5ff; }
.upload-zone:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 3px; border-color: var(--color-primary); }
.upload-zone.is-dragover { transform: translateY(-2px); }
.upload-zone input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; }
.upload-zone img { width: 5.2rem; height: 5.2rem; object-fit: contain; margin-bottom: .75rem; }
.upload-zone strong { font-size: 1rem; }
.upload-zone p { margin: .3rem 0 0; color: #64748b; font-size: .78rem; }
.upload-zone .file-summary { margin-top: .8rem; color: var(--color-primary-strong); font-weight: 750; }
.file-list { display: grid; gap: .55rem; margin-top: .8rem; }
.file-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .65rem; min-height: 48px; padding: .55rem .7rem; border: 1px solid var(--color-border); border-radius: .7rem; background: white; }
.file-row svg { color: var(--color-primary); }
.file-row span { min-width: 0; }
.file-row strong { display: block; overflow: hidden; font-size: .8rem; text-overflow: ellipsis; white-space: nowrap; }
.file-row small { color: #64748b; font-size: .68rem; }
.file-row button { display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: .65rem; background: transparent; color: #64748b; }
.summary-card { position: sticky; top: 6.5rem; padding: 1.2rem; }
.summary-card h3 { margin: 0 0 1rem; }
.summary-list { display: grid; gap: .75rem; margin: 0 0 1.1rem; }
.summary-line { display: flex; align-items: center; justify-content: space-between; gap: 1rem; color: #475569; font-size: .82rem; }
.summary-line strong { color: var(--color-foreground); }
.summary-note { padding: .75rem; border-radius: .7rem; background: #faf5ff; color: #5b4a70; font-size: .72rem; }

/* Project detail and timeline */
.detail-header { display: flex; flex-wrap: wrap; align-items: center; gap: .8rem; }
.detail-header .back-button { flex: 0 0 auto; }
.detail-header-copy { min-width: 0; }
.detail-header-copy h2 { margin: 0; font-size: clamp(1.3rem, 3vw, 1.9rem); letter-spacing: -.03em; }
.detail-header-copy p { margin: .25rem 0 0; color: #64748b; }
.detail-actions { display: flex; flex-wrap: wrap; gap: .55rem; margin-left: auto; }
.progress-card { display: grid; grid-template-columns: minmax(0, 1fr) 12rem; gap: 1rem; padding: 1.35rem; overflow: hidden; }
.progress-card.is-overage { border-color: #fdba74; background: linear-gradient(135deg, #fff 0%, #fff7ed 100%); }
.progress-card.is-overage .progress-track { background: #ffedd5; }
.progress-card.is-overage .progress-bar { background: linear-gradient(90deg, #f97316, #f59e0b); }
.progress-card-copy { min-width: 0; }
.progress-card h3 { margin: 0; font-size: 1.15rem; }
.progress-card p { margin: .35rem 0 1rem; color: #64748b; }
.progress-track { height: .7rem; overflow: hidden; border-radius: 999px; background: #ede9fe; }
.progress-bar { height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--color-secondary), var(--color-accent)); transition: width .35s ease; }
.progress-meta { display: flex; justify-content: space-between; gap: .5rem; margin-top: .5rem; color: #64748b; font-size: .72rem; }
.progress-mascot { align-self: end; justify-self: end; width: 10rem; height: auto; aspect-ratio: 1; object-fit: contain; margin: -1rem -1rem -2rem 0; }
.timeline { display: grid; }
.timeline-item { position: relative; display: grid; grid-template-columns: 2.8rem minmax(0, 1fr) auto; gap: .85rem; min-height: 5.4rem; }
.timeline-item:not(:last-child)::before { content: ""; position: absolute; left: 1.35rem; top: 2.6rem; bottom: -.1rem; width: 2px; background: #e2e8f0; }
.timeline-marker { position: relative; z-index: 1; display: grid; place-items: center; width: 2.8rem; height: 2.8rem; border: 2px solid #d8ccea; border-radius: 50%; background: white; color: #94a3b8; font-weight: 800; }
.timeline-item.is-complete .timeline-marker { border-color: #6ee7b7; background: #ecfdf5; color: var(--color-success); }
.timeline-item.is-running .timeline-marker { border-color: #93c5fd; background: #eff6ff; color: var(--color-info); box-shadow: 0 0 0 6px #eff6ff; }
.timeline-copy { padding: .25rem 0 1.2rem; }
.timeline-copy h4 { margin: 0; font-size: .9rem; }
.timeline-copy p { margin: .2rem 0 0; color: #64748b; font-size: .72rem; }
.timeline-action { align-self: start; min-width: 5.2rem; }
.timeline-action .btn { min-height: 44px; padding: .55rem .7rem; font-size: .75rem; }
.runs-table-wrap { width: 100%; min-width: 0; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; min-width: 42rem; }
.data-table th, .data-table td { padding: .85rem 1rem; border-bottom: 1px solid var(--color-border); text-align: left; font-size: .78rem; }
.data-table th { color: #64748b; font-size: .68rem; letter-spacing: .04em; text-transform: uppercase; }
.data-table tr:last-child td { border-bottom: 0; }
.table-actions { display: flex; gap: .35rem; }

/* Credits and admin */
.credit-hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1rem; align-items: center; padding: clamp(1.4rem, 4vw, 2.2rem); color: white; background: linear-gradient(135deg, #5b21b6, #7c3aed 58%, #be185d); }
.credit-hero .eyebrow { color: #e9d5ff; }
.credit-hero h2 { margin: 0; font-size: clamp(1.8rem, 4vw, 2.8rem); }
.credit-hero p { margin: .5rem 0 0; color: #ede9fe; }
.credit-number { text-align: right; }
.credit-number strong { display: block; font-size: clamp(2.5rem, 6vw, 4.5rem); line-height: 1; }
.credit-number span { color: #f5d0fe; font-size: .8rem; }
.redeem-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(16rem, .65fr); gap: 1rem; }
.redeem-form { display: flex; align-items: end; gap: .75rem; }
.redeem-form .field { flex: 1; }
.code-input { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .08em; text-transform: uppercase; }
.info-list { display: grid; gap: .7rem; margin: 0; padding: 0; list-style: none; }
.info-list li { display: flex; gap: .6rem; color: #475569; font-size: .78rem; }
.info-list svg { flex: 0 0 auto; color: var(--color-primary); }
.activation-history-panel .panel-header p { margin: .2rem 0 0; font-size: .74rem; }
.activation-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: .75rem; }
.activation-card { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: .8rem; min-height: 5.2rem; padding: .85rem; border: 1px solid var(--color-border); border-radius: .9rem; background: linear-gradient(135deg, #fff, #faf5ff); }
.activation-card-mark { display: grid; place-items: center; grid-row: 1 / span 2; width: 2.8rem; height: 2.8rem; border-radius: .85rem; background: #ede9fe; color: var(--color-primary-strong); }
.activation-card-copy { min-width: 0; }
.activation-card-copy h3 { margin: 0; overflow-wrap: anywhere; font-size: .9rem; }
.activation-card-copy p { margin: .18rem 0 0; color: #5b21b6; font-size: .78rem; font-weight: 800; }
.activation-card-description { display: block; margin-top: .3rem; color: #64748b; font-size: .75rem; line-height: 1.55; }
.activation-card time { grid-column: 2; color: #64748b; font-size: .75rem; line-height: 1.5; }
.activation-history-state { display: flex; align-items: center; justify-content: center; gap: .8rem; min-height: 8.5rem; padding: 1.2rem; color: #64748b; text-align: left; }
.activation-history-state > svg { flex: 0 0 auto; width: 2rem; height: 2rem; color: #8b5cf6; }
.activation-history-state strong { color: #334155; }
.activation-history-state p { margin: .25rem 0 0; font-size: .76rem; }
.activation-history-state.is-error > svg { color: var(--color-danger); }
.activation-history-state .btn { margin-top: .75rem; }
.activation-success-card { display: flex; align-items: center; gap: 1rem; padding: 1rem; border: 1px solid #a7f3d0; border-radius: 1rem; background: #ecfdf5; }
.activation-success-icon { display: grid; place-items: center; flex: 0 0 auto; width: 3rem; height: 3rem; border-radius: 50%; background: #10b981; color: white; }
.activation-success-card small { display: block; color: #047857; font-weight: 700; }
.activation-success-card strong { display: block; margin-top: .15rem; color: #065f46; font-size: 1.25rem; }
.activation-success-details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; margin: .8rem 0 0; }
.activation-success-details div { padding: .7rem .8rem; border: 1px solid var(--color-border); border-radius: .8rem; background: #f8fafc; }
.activation-success-details dt { color: #64748b; font-size: .75rem; }
.activation-success-details dd { margin: .2rem 0 0; color: #1e293b; font-weight: 800; overflow-wrap: anywhere; }
.activation-success-note { margin: 1rem 0 0; color: #475569; font-size: .82rem; }

/* Account center */
.account-hero { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; padding: clamp(1.35rem, 4vw, 2rem); background: linear-gradient(135deg, #fff 0%, #faf5ff 55%, #fdf2f8 100%); }
.account-identity { display: flex; align-items: center; min-width: 0; gap: 1rem; }
.account-avatar-large { display: grid; place-items: center; flex: 0 0 auto; width: 4.5rem; height: 4.5rem; border-radius: 1.25rem; background: linear-gradient(145deg, var(--color-primary), var(--color-accent)); color: white; box-shadow: 0 12px 26px rgba(91,33,182,.2); font-size: 1.65rem; font-weight: 800; }
.account-identity h2 { margin: 0; overflow-wrap: anywhere; font-size: clamp(1.4rem, 3vw, 2rem); }
.account-identity p:last-child { margin: .2rem 0 0; overflow-wrap: anywhere; color: #64748b; }
.account-hero-stats { display: grid; grid-template-columns: repeat(3, minmax(7rem, 1fr)); gap: .7rem; }
.account-hero-stats span { display: grid; min-height: 4.5rem; align-content: center; padding: .7rem .9rem; border: 1px solid var(--color-border); border-radius: .85rem; background: rgba(255,255,255,.8); }
.account-hero-stats small { color: #64748b; font-size: .7rem; }
.account-hero-stats strong { margin-top: .15rem; color: #4c1d95; font-size: .95rem; }
.account-grid { display: grid; grid-template-columns: minmax(0, .9fr) minmax(21rem, 1.1fr); gap: 1rem; align-items: start; }
.account-panel-note { margin: .2rem 0 0; font-size: .74rem; }
.profile-list { display: grid; margin: 0; }
.profile-list > div { display: grid; grid-template-columns: minmax(7rem, .65fr) minmax(0, 1.35fr); gap: 1rem; padding: .85rem 0; border-bottom: 1px solid var(--color-border); }
.profile-list > div:first-child { padding-top: 0; }
.profile-list > div:last-child { border-bottom: 0; }
.profile-list dt { color: #64748b; font-size: .78rem; }
.profile-list dd { min-width: 0; margin: 0; overflow-wrap: anywhere; color: #334155; font-size: .82rem; font-weight: 700; text-align: right; }
.profile-list code { color: #5b21b6; font-size: .75rem; }
.account-gate-note { margin-top: 1rem; padding: .8rem; border: 1px solid #fde68a; border-radius: .7rem; background: #fffbeb; color: #854d0e; font-size: .74rem; }
.membership-overview { position: relative; display: grid; grid-template-columns: minmax(18rem, .9fr) minmax(18rem, 1.1fr); align-items: center; gap: clamp(1.35rem, 4vw, 3rem); overflow: hidden; isolation: isolate; padding: clamp(1.25rem, 4vw, 2.4rem); border-color: rgba(196,181,253,.48); background: linear-gradient(135deg, rgba(255,255,255,.88), rgba(250,245,255,.8)); box-shadow: inset 0 1px rgba(255,255,255,.9), var(--shadow-sm); backdrop-filter: blur(22px) saturate(1.12); }
.membership-overview::before, .membership-overview::after { content: ""; position: absolute; z-index: -1; border-radius: 50%; filter: blur(2px); pointer-events: none; }
.membership-overview::before { left: -8%; top: -38%; width: 45%; aspect-ratio: 1; background: radial-gradient(circle, rgba(45,212,191,.22), rgba(124,58,237,.08) 48%, transparent 70%); animation: membership-ambient-a 12s ease-in-out infinite alternate; }
.membership-overview::after { right: -10%; bottom: -58%; width: 52%; aspect-ratio: 1; background: radial-gradient(circle, rgba(236,72,153,.17), rgba(99,102,241,.09) 50%, transparent 72%); animation: membership-ambient-b 15s ease-in-out infinite alternate; }
@keyframes membership-ambient-a { to { transform: translate3d(16%, 18%, 0) scale(1.12); } }
@keyframes membership-ambient-b { to { transform: translate3d(-18%, -14%, 0) scale(.92); } }
.membership-overview-model { position: relative; z-index: 1; display: grid; place-items: center; min-width: 0; }
.membership-overview-copy { position: relative; z-index: 1; min-width: 0; }
.membership-overview-copy .eyebrow { margin: 0 0 .45rem; }
.membership-overview-copy h2 { margin: 0; color: #20143f; font-size: clamp(1.8rem, 4vw, 3rem); font-weight: 900; letter-spacing: .04em; }
.membership-overview-copy > p:not(.eyebrow) { max-width: 34rem; margin: 1rem 0 0; color: #475569; line-height: 1.8; }
.membership-overview-copy > small { display: block; margin-top: 1rem; color: #64748b; font-size: .72rem; }
.membership-pinyin { display: block; margin-top: .45rem; color: #7c3aed; font-size: .68rem; font-weight: 800; letter-spacing: .3em; }

/* Lightweight 3D membership model: no external WebGL payload or CDN runtime. */
.membership-card-stage { --card-rotate-x: 0deg; --card-rotate-y: 0deg; --card-light-x: 25%; --card-light-y: 18%; --member-bg: linear-gradient(145deg, #e9fbf7 0%, #bdeee5 48%, #77cfc2 100%); --member-ink: #073b3a; --member-muted: #176b67; --member-line: rgba(7,59,58,.18); --member-edge: #6ebeb3; position: relative; width: min(100%, 28rem); aspect-ratio: 1.586 / 1; perspective: 1100px; isolation: isolate; }
.membership-card-stage.is-pro { --member-bg: linear-gradient(145deg, #1d4ed8 0%, #312e81 54%, #111b4d 100%); --member-ink: #f8fbff; --member-muted: #cbdcff; --member-line: rgba(219,234,254,.24); --member-edge: #162e79; }
.membership-card-stage.is-max { --member-bg: linear-gradient(145deg, #161126 0%, #3b1d65 53%, #0f172a 100%); --member-ink: #fff8df; --member-muted: #e8d7a0; --member-line: rgba(250,204,21,.28); --member-edge: #201634; }
.membership-card-model { position: absolute; inset: .55rem; transform: rotateX(var(--card-rotate-x)) rotateY(var(--card-rotate-y)); transform-style: preserve-3d; transition: transform .28s cubic-bezier(.2,.75,.25,1), filter .28s ease; filter: drop-shadow(0 20px 24px rgba(30,20,55,.2)); }
.membership-card-stage:hover .membership-card-model { filter: drop-shadow(0 26px 30px rgba(30,20,55,.26)); }
.membership-card-edge, .membership-card-face { position: absolute; inset: 0; border-radius: clamp(1rem, 3vw, 1.45rem); }
.membership-card-edge { transform: translate3d(.35rem, .45rem, -12px); border: 1px solid rgba(15,23,42,.16); background: var(--member-edge); box-shadow: 0 8px 22px rgba(15,23,42,.2); }
.membership-card-face { display: grid; grid-template-rows: auto 1fr auto; overflow: hidden; padding: clamp(1rem, 4vw, 1.55rem); transform: translateZ(7px); border: 1px solid rgba(255,255,255,.48); background: var(--member-bg); color: var(--member-ink); box-shadow: inset 0 1px rgba(255,255,255,.72), inset 0 -1px rgba(15,23,42,.16), inset 0 0 3rem rgba(255,255,255,.08); backdrop-filter: blur(12px) saturate(1.18); }
.membership-card-face::before { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 80% 12%, rgba(255,255,255,.48), transparent 22%), repeating-radial-gradient(ellipse at 105% 110%, transparent 0 1.7rem, var(--member-line) 1.78rem 1.84rem); opacity: .82; pointer-events: none; }
.membership-card-face::after { content: ""; position: absolute; right: -12%; bottom: -45%; width: 75%; aspect-ratio: 1; border: 1px solid var(--member-line); border-radius: 50%; box-shadow: 0 0 0 1.4rem transparent, 0 0 0 1.46rem var(--member-line), 0 0 0 3rem transparent, 0 0 0 3.06rem var(--member-line); pointer-events: none; }
.membership-card-stage.is-max .membership-card-face::before { background: radial-gradient(circle at 82% 14%, rgba(255,230,153,.3), transparent 24%), repeating-linear-gradient(125deg, transparent 0 2.8rem, rgba(250,204,21,.08) 2.86rem 2.92rem); }
.membership-card-glow { position: absolute; z-index: 1; inset: 0; background: radial-gradient(circle at var(--card-light-x) var(--card-light-y), rgba(255,255,255,.62), transparent 24%); mix-blend-mode: soft-light; transition: background-position .16s ease; pointer-events: none; }
.membership-card-sheen { position: absolute; z-index: 1; top: -55%; bottom: -55%; left: -78%; width: 48%; transform: skewX(-18deg); background: linear-gradient(90deg, transparent, rgba(255,255,255,.08) 18%, rgba(255,255,255,.55) 48%, rgba(196,181,253,.2) 70%, transparent); filter: blur(1px); mix-blend-mode: screen; animation: membership-sheen 7.5s cubic-bezier(.22,.61,.36,1) infinite; pointer-events: none; }
.membership-card-stage.is-max .membership-card-sheen { background: linear-gradient(90deg, transparent, rgba(250,204,21,.06), rgba(255,244,185,.48), rgba(196,181,253,.18), transparent); }
@keyframes membership-sheen { 0%, 58% { transform: translateX(0) skewX(-18deg); opacity: 0; } 64% { opacity: .86; } 82%, 100% { transform: translateX(390%) skewX(-18deg); opacity: 0; } }
.membership-card-watermark { position: absolute; z-index: 0; right: 7%; top: 14%; color: transparent; font-size: clamp(5rem, 18vw, 9rem); font-weight: 900; line-height: 1; -webkit-text-stroke: 1px var(--member-line); transform: translateZ(2px); opacity: .8; }
.membership-card-face header, .membership-card-face footer, .membership-card-title { position: relative; z-index: 2; transform: translateZ(16px); }
.membership-card-face header, .membership-card-face footer { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.membership-card-face header b { font-size: clamp(.7rem, 2vw, .84rem); font-weight: 900; letter-spacing: .2em; text-transform: uppercase; }
.membership-card-brand { display: inline-flex; align-items: center; gap: .45rem; color: var(--member-muted); font-size: clamp(.52rem, 1.7vw, .64rem); font-weight: 850; letter-spacing: .12em; }
.membership-card-brand i { display: grid; place-items: center; width: 1.55rem; height: 1.55rem; border: 1px solid rgba(255,255,255,.36); border-radius: .48rem; background: linear-gradient(145deg, rgba(255,255,255,.36), rgba(255,255,255,.1)); color: var(--member-ink); box-shadow: inset 0 1px rgba(255,255,255,.5), 0 5px 12px rgba(15,23,42,.08); backdrop-filter: blur(8px); font-style: normal; font-size: .72rem; font-weight: 900; }
.membership-card-title { align-self: center; display: grid; justify-items: start; }
.membership-card-title small { color: var(--member-muted); font-size: clamp(.5rem, 1.5vw, .6rem); font-weight: 800; letter-spacing: .22em; }
.membership-card-title strong { margin-top: .28rem; font-size: clamp(1.55rem, 5vw, 2.2rem); font-weight: 900; letter-spacing: .08em; line-height: 1.1; text-shadow: 0 1px rgba(255,255,255,.2); }
.membership-card-title span { margin-top: .48rem; color: var(--member-muted); font-size: clamp(.5rem, 1.5vw, .62rem); font-weight: 850; letter-spacing: .3em; }
.membership-card-face footer { color: var(--member-muted); font-size: clamp(.48rem, 1.5vw, .6rem); font-weight: 750; letter-spacing: .11em; }
.membership-card-stage.is-compact { width: 100%; }
.membership-card-stage.is-compact .membership-card-model { inset: .35rem; filter: drop-shadow(0 14px 18px rgba(30,20,55,.18)); }
.membership-card-stage.is-compact .membership-card-face { padding: clamp(.72rem, 2vw, 1rem); border-radius: 1rem; }
.membership-card-stage.is-compact .membership-card-edge { border-radius: 1rem; transform: translate3d(.25rem, .3rem, -9px); }
.membership-card-stage.is-compact .membership-card-brand { font-size: .45rem; }
.membership-card-stage.is-compact .membership-card-brand i { width: 1.2rem; height: 1.2rem; font-size: .55rem; }
.membership-card-stage.is-compact .membership-card-title strong { font-size: clamp(1.15rem, 3vw, 1.55rem); }

@media (hover: hover) and (pointer: fine) {
  .membership-card-model { will-change: transform; }
}

.membership-tier-section { position: relative; overflow: hidden; border-color: rgba(196,181,253,.48); background: radial-gradient(circle at 90% 0, rgba(196,181,253,.18), transparent 28%), rgba(255,255,255,.84); backdrop-filter: blur(20px) saturate(1.1); }
.membership-tier-showcase { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.membership-tier-preview { min-width: 0; padding: .8rem; border: 1px solid rgba(221,214,254,.8); border-radius: 1.15rem; background: linear-gradient(145deg, rgba(255,255,255,.9), rgba(250,245,255,.68)); box-shadow: inset 0 1px rgba(255,255,255,.9), 0 14px 30px rgba(76,29,149,.06); backdrop-filter: blur(14px) saturate(1.1); }
.membership-tier-preview > div:last-child { padding: .75rem .25rem .15rem; }
.membership-tier-preview > div:last-child strong, .membership-tier-preview > div:last-child span { display: block; }
.membership-tier-preview > div:last-child strong { color: #312e81; font-size: .92rem; font-weight: 850; }
.membership-tier-preview > div:last-child span { margin-top: .2rem; color: #7c3aed; font-size: .58rem; font-weight: 800; letter-spacing: .18em; }
.membership-tier-preview > div:last-child p { margin: .55rem 0 0; color: #64748b; font-size: .7rem; line-height: 1.6; }
.user-group-toolbar { display: grid; grid-template-columns: minmax(14rem, 1fr) minmax(12rem, .6fr) auto; align-items: end; gap: .75rem; margin-bottom: 1rem; }
.user-group-toolbar .field { margin: 0; }
.user-group-list { display: grid; gap: .65rem; }
.user-group-row { display: grid; grid-template-columns: auto minmax(12rem, 1fr) minmax(11rem, .45fr) auto; align-items: center; gap: .8rem; min-height: 5.25rem; padding: .75rem; border: 1px solid var(--color-border); border-radius: .9rem; background: #fff; }
.user-group-mark { display: grid; place-items: center; width: 2.75rem; height: 2.75rem; border-radius: .85rem; background: #d7f4ee; color: #0f5f5b; font-weight: 900; box-shadow: inset 0 0 0 1px rgba(15,95,91,.12); }
.user-group-mark.is-pro { background: #dbeafe; color: #1e40af; }
.user-group-mark.is-max { background: #ede9fe; color: #6b21a8; }
.user-group-identity { min-width: 0; }
.user-group-identity > div { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.user-group-identity strong, .user-group-identity p, .user-group-identity small { overflow-wrap: anywhere; }
.user-group-identity p { margin: .18rem 0 0; color: #64748b; font-size: .72rem; }
.user-group-identity small { display: block; margin-top: .15rem; color: #6d28d9; font-size: .68rem; font-weight: 750; }
.user-role-badge { padding: .12rem .38rem; border-radius: 999px; background: #ede9fe; color: #5b21b6; font-size: .6rem; font-weight: 800; }
.user-role-badge.is-muted { background: #f1f5f9; color: #64748b; }
.user-group-select { display: grid; gap: .25rem; color: #475569; font-size: .68rem; font-weight: 750; }
.user-group-select select { min-height: 44px; padding: .55rem .65rem; border: 1px solid var(--color-border-strong); border-radius: .65rem; background: #fff; color: #1e293b; font: inherit; font-size: .76rem; }
.user-group-select select:focus-visible { outline: 3px solid rgba(124,58,237,.2); border-color: var(--color-primary); }
.user-group-state { display: flex; align-items: center; justify-content: center; gap: .75rem; min-height: 6rem; padding: 1rem; border: 1px dashed var(--color-border-strong); border-radius: .85rem; color: #64748b; text-align: center; }
.user-group-state.is-error { color: #b91c1c; }
.session-header { align-items: flex-start; }
.session-bulk-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .55rem; }
.session-list { display: grid; gap: .7rem; }
.session-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .85rem; min-height: 5.5rem; padding: .85rem; border: 1px solid var(--color-border); border-radius: .85rem; background: #fff; }
.session-row.is-current { border-color: #c4b5fd; background: #fcfaff; box-shadow: inset 3px 0 var(--color-primary); }
.session-icon { display: grid; place-items: center; width: 2.7rem; height: 2.7rem; border-radius: .8rem; background: #f3e8ff; color: var(--color-primary-strong); }
.session-copy { min-width: 0; }
.session-copy > div { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; }
.session-copy p, .session-copy small { margin: .2rem 0 0; color: #64748b; font-size: .72rem; }
.session-copy small { display: block; }
.session-current { padding: .15rem .4rem; border-radius: 999px; background: #ede9fe; color: #5b21b6; font-size: .65rem; font-weight: 800; }
.admin-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(20rem, .75fr); gap: 1rem; }
.cdk-tier-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; }
.cdk-tier-card { padding: .9rem; border: 1px solid var(--color-border); border-radius: 1rem; background: #fff; box-shadow: var(--shadow-sm); }
.cdk-tier-card.is-qingjin { border-color: #a7f3d0; background: linear-gradient(145deg, #f0fdf4, #fff); }
.cdk-tier-card.is-hongjian { border-color: #bfdbfe; background: linear-gradient(145deg, #eff6ff, #fff); }
.cdk-tier-card.is-fuyao { border-color: #ddd6fe; background: linear-gradient(145deg, #f5f3ff, #fff); }
.cdk-tier-heading { display: grid; gap: .4rem; margin-bottom: .8rem; }
.cdk-tier-heading .eyebrow { margin: 0; color: #7c3aed; }
.cdk-tier-heading h3 { margin: .1rem 0 0; font-size: 1rem; }
.cdk-tier-heading > span { color: #475569; font-size: .72rem; font-weight: 700; }
.cdk-tier-heading > p { margin: 0; color: #64748b; font-size: .75rem; line-height: 1.55; }
.generated-batches { display: grid; gap: 1rem; }
.generated-batch { overflow: hidden; border: 1px solid var(--color-border); border-radius: .9rem; background: #fff; }
.generated-batch-heading { display: flex; align-items: center; justify-content: space-between; gap: .7rem; padding: .75rem; border-bottom: 1px solid var(--color-border); background: #faf5ff; }
.generated-batch-heading strong, .generated-batch-heading span { display: block; }
.generated-batch-heading span { margin-top: .15rem; color: #64748b; font-size: .68rem; }
.generated-batch .generated-codes { max-height: 18rem; margin: 0; padding: .65rem; }
.generated-codes { display: grid; gap: .55rem; max-height: 24rem; overflow: auto; margin-top: 1rem; }
.code-row { display: flex; align-items: center; gap: .5rem; min-height: 48px; padding: .45rem .55rem .45rem .8rem; border: 1px solid var(--color-border); border-radius: .7rem; background: #fcfaff; }
.code-row code { flex: 1; overflow-wrap: anywhere; color: #4c1d95; font-weight: 700; }
.code-row button { display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: .6rem; background: white; color: var(--color-primary-strong); }

/* Modal and skeleton */
.modal-layer { position: fixed; z-index: 850; inset: 0; display: grid; place-items: center; padding: 1rem; background: rgba(15,23,42,.54); backdrop-filter: blur(5px); animation: fade-in .18s ease; }
@keyframes fade-in { from { opacity: 0; } }
.modal { width: min(34rem, 100%); max-height: min(86vh, 48rem); overflow: auto; border: 1px solid rgba(255,255,255,.45); border-radius: var(--radius-xl); background: white; box-shadow: var(--shadow-lg); }
.modal.is-wide { width: min(72rem, 100%); height: min(88vh, 58rem); display: grid; grid-template-rows: auto 1fr; }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: 1.25rem 1.35rem; border-bottom: 1px solid var(--color-border); }
.modal-header h2 { margin: 0; font-size: 1.1rem; }
.modal-header p { margin: .25rem 0 0; color: #64748b; font-size: .78rem; }
.modal-close { display: grid; place-items: center; flex: 0 0 auto; width: 44px; height: 44px; margin: -.55rem -.65rem 0 0; border: 0; border-radius: .7rem; background: transparent; color: #64748b; }
.modal-body { padding: 1.35rem; }
.modal-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .6rem; margin-top: 1.25rem; }
.preview-frame { width: 100%; height: 100%; min-height: 35rem; border: 0; background: white; }
.skeleton { position: relative; overflow: hidden; border-radius: .6rem; background: #ede8f3; }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,.7), transparent); animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }
.skeleton-card { min-height: 13rem; }
.error-panel { display: grid; justify-items: center; gap: .8rem; padding: 2.5rem 1rem; text-align: center; }
.error-panel svg { width: 2.5rem; height: 2.5rem; color: var(--color-danger); }
.error-panel h2 { margin: 0; }
.error-panel p { max-width: 32rem; margin: 0; color: #64748b; }

@media (max-width: 1100px) {
  .auth-screen { grid-template-columns: minmax(0, .9fr) minmax(27rem, 1.1fr); }
  .auth-copy { width: 100%; }
  .create-layout, .admin-grid, .account-grid { grid-template-columns: 1fr; }
  .account-hero { align-items: stretch; flex-direction: column; }
  .detail-columns { grid-template-columns: 1fr !important; }
  .summary-card { position: static; }
}

@media (min-width: 901px) and (max-height: 900px) {
  .auth-story { padding: clamp(1.5rem, 3.5vw, 3rem); }
  .auth-copy { width: min(36rem, 92%); padding-top: clamp(2rem, 5vh, 3.5rem); }
  .auth-copy h1 { margin-bottom: 1rem; font-size: clamp(2.2rem, 4.2vw, 3.6rem); }
  .auth-benefits { gap: .65rem; margin-top: 1.25rem; }
  .auth-mascot { right: clamp(-2rem, 1vw, 1rem); bottom: clamp(-2rem, -1vw, -.5rem); width: clamp(12rem, 34vh, 19rem); }
}

@media (min-width: 901px) and (max-height: 680px) {
  .auth-copy { padding-top: 1.5rem; }
  .auth-copy h1 { font-size: clamp(2rem, 3.8vw, 3rem); }
  .auth-copy > p:not(.eyebrow) { font-size: .95rem; }
  .auth-benefits { gap: .45rem; margin-top: .9rem; font-size: .88rem; }
  .auth-mascot { width: clamp(9rem, 25vh, 12rem); }
}

@media (max-width: 900px) {
  .auth-screen { grid-template-columns: 1fr; background: radial-gradient(circle at top, #f3e8ff, white 28rem); }
  .auth-story { display: none; }
  .auth-panel { min-height: 100vh; min-height: 100dvh; padding: 1.25rem; }
  .mobile-brand { display: flex; align-items: center; justify-content: center; gap: .6rem; margin-bottom: 1.5rem; font-size: 1.2rem; }
  .mobile-brand img { border-radius: .75rem; box-shadow: var(--shadow-md); }
  .sidebar { transform: translateX(-105%); box-shadow: var(--shadow-lg); transition: transform .22s ease; }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar-scrim { position: fixed; z-index: 70; inset: 0; border: 0; background: rgba(15,23,42,.38); }
  .app-main { margin-left: 0; }
  .menu-button { display: grid; }
  .bottom-nav { position: fixed; z-index: 60; left: 50%; bottom: max(.7rem, env(safe-area-inset-bottom)); display: flex; transform: translateX(-50%); padding: .35rem; border: 1px solid var(--color-border); border-radius: 1rem; background: rgba(255,255,255,.95); box-shadow: var(--shadow-lg); backdrop-filter: blur(16px); }
  .bottom-nav a { display: grid; justify-items: center; align-content: center; min-width: 4.25rem; min-height: 52px; padding: .25rem .5rem; border-radius: .75rem; color: #64748b; font-size: .64rem; font-weight: 700; }
  .bottom-nav a.is-active { background: #f3e8ff; color: var(--color-primary-strong); }
  .bottom-nav svg { width: 1.2rem; height: 1.2rem; }
  .main-content { padding-bottom: 7rem; }
  .membership-overview { grid-template-columns: 1fr; }
  .membership-overview-model { width: min(100%, 30rem); justify-self: center; }
}

@media (max-width: 900px) and (max-height: 500px) {
  .auth-panel { place-items: start center; padding-block: .75rem; }
  .mobile-brand { margin-bottom: .75rem; }
  .segmented { margin-bottom: 1rem; }
  .auth-form { gap: .75rem; }
}

@media (max-width: 700px) {
  .topbar { min-height: 70px; padding: .65rem .8rem; }
  .page-heading p { display: none; }
  .page-heading h1 { font-size: 1.08rem; }
  .account-copy { display: none; }
  .credit-pill { min-width: 3.6rem; justify-content: center; }
  .credit-pill small { display: none; }
  .main-content { padding: 1rem .8rem 7rem; }
  .hero-panel { grid-template-columns: 1fr; min-height: 18rem; padding-bottom: 7rem; }
  .hero-mascot { display: none; }
  .stats-grid, .upload-grid, .redeem-layout { grid-template-columns: 1fr; }
  .stat-card { min-height: 5.8rem; }
  .section-title { align-items: flex-start; flex-direction: column; }
  .wizard-step { flex-direction: column; align-items: center; gap: .3rem; font-size: .62rem; text-align: center; }
  .wizard-step::after { display: none; }
  .upload-zone { min-height: 13rem; }
  .detail-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr)); width: 100%; margin-left: 0; }
  .detail-actions .btn { min-width: 0; }
  .progress-card { grid-template-columns: 1fr; }
  .progress-mascot { display: none; }
  .timeline-item { grid-template-columns: 2.8rem minmax(0, 1fr); }
  .timeline-action { grid-column: 2; padding-bottom: 1rem; }
  .credit-hero { grid-template-columns: 1fr; }
  .credit-number { text-align: left; }
  .activation-list, .cdk-tier-grid, .membership-tier-showcase { grid-template-columns: 1fr; }
  .activation-success-details { grid-template-columns: 1fr; }
  .activation-history-state { justify-content: flex-start; min-height: 7rem; }
  .generated-batch-heading { align-items: stretch; flex-direction: column; }
  .generated-batch-heading .btn { width: 100%; }
  .account-hero-stats { grid-template-columns: 1fr; }
  .membership-overview { padding: 1rem; }
  .membership-overview-copy { padding: .25rem; }
  .user-group-toolbar { grid-template-columns: 1fr; }
  .user-group-row { grid-template-columns: auto minmax(0, 1fr); }
  .user-group-select, .user-group-row > .btn { grid-column: 1 / -1; }
  .user-group-row > .btn { width: 100%; }
  .session-header { align-items: stretch; flex-direction: column; }
  .session-bulk-actions { display: grid; grid-template-columns: 1fr; width: 100%; }
  .session-row { grid-template-columns: auto minmax(0, 1fr); }
  .session-row > .btn { grid-column: 1 / -1; width: 100%; }
  .redeem-form { align-items: stretch; flex-direction: column; }
  .modal-layer { padding: .5rem; align-items: end; }
  .modal { width: 100%; max-height: 92vh; border-radius: 1.25rem 1.25rem .75rem .75rem; }
  .modal.is-wide { height: 94vh; }
}

@media (max-width: 420px) {
  .sms-code-row { grid-template-columns: 1fr; }
  .sms-send-button { width: 100%; }
}

@media (max-width: 420px) {
  .top-actions { gap: .35rem; }
  .credit-pill { padding: .35rem .5rem; }
  .bottom-nav { width: calc(100% - 1rem); justify-content: space-around; }
  .bottom-nav a { min-width: 3.8rem; flex: 1; }
  .project-grid { grid-template-columns: 1fr; }
  .auth-panel { padding: 1rem; }
  .auth-card { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .membership-card-model { transform: none !important; }
  .membership-card-glow, .membership-card-sheen { display: none; }
  .membership-overview::before, .membership-overview::after { animation: none; }
}

@media (prefers-contrast: more) {
  :root { --color-border: #9b88b4; --color-subtle: #475569; }
  .panel, .project-card, .stat-card { border-width: 2px; }
}
