/* ==========================================================================
   练了么 · Enterprise Pose Coach — Design System
   "Kinetic Enterprise": light, calm, high-signal. One dark surface (the
   camera stage) so the athlete pops; everything else stays bright and legible
   for HR / EHS operators sitting in a lit office.

   Loaded first on every page. Page-level sheets only compose these tokens.
   No external font or asset requests — the product ships as an offline claim.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens
   -------------------------------------------------------------------------- */
:root {
    color-scheme: light;

    /* Neutral ramp — cool graphite, never pure gray */
    --n-0: #ffffff;
    --n-25: #fcfdfe;
    --n-50: #f8fafc;
    --n-100: #f1f5fa;
    --n-150: #e9eef5;
    --n-200: #dfe6f0;
    --n-300: #c7d2e2;
    --n-400: #9aa8be;
    --n-500: #6d7d95;
    --n-600: #4e5d75;
    --n-700: #374357;
    --n-800: #232e3f;
    --n-900: #141d2b;
    --n-950: #0a111c;

    /* Brand — Cobalt. Trust, systems, enterprise. */
    --b-50: #eef4ff;
    --b-100: #dde8ff;
    --b-200: #bdd2ff;
    --b-300: #91b2ff;
    --b-400: #5d8bff;
    --b-500: #2a63f2;
    --b-600: #1a50e8;
    --b-700: #163ebb;
    --b-800: #173796;
    --b-900: #183176;

    /* Energy — Spring. Motion, pass, counted, alive. */
    --g-50: #e8fbf3;
    --g-100: #c9f5e3;
    --g-200: #95ebc8;
    --g-300: #57dba7;
    --g-400: #1fc689;
    --g-500: #068056;
    --g-600: #067a52;
    --g-700: #056d4b;
    --g-800: #08573d;
    --g-900: #074734;

    /* Warn — Amber */
    --w-50: #fff8ea;
    --w-100: #ffedc9;
    --w-300: #fbc75a;
    --w-500: #e0930b;
    --w-600: #b97205;
    --w-700: #8f5606;

    /* Alert — Coral */
    --r-50: #fff1ef;
    --r-100: #ffe0dc;
    --r-300: #ff9d92;
    --r-500: #f0503f;
    --r-600: #d2361f;
    --r-700: #a92b19;

    /* Accent — Cyan, reserved for the "target / ghost" layer only */
    --c-300: #67e8f9;
    --c-400: #22d3ee;
    --c-500: #06b6d4;
    --c-700: #0e7490;

    /* ---- Semantic ---- */
    --bg: var(--n-50);
    --bg-tint: #f4f7fc;
    --surface: var(--n-0);
    --surface-2: var(--n-100);
    --surface-3: var(--n-150);
    --line: #e6ebf3;
    --line-strong: var(--n-200);
    --line-heavy: var(--n-300);

    --text: var(--n-900);
    --text-2: var(--n-600);
    --text-3: #5d6b83;
    --text-4: #66748b;

    --accent: var(--b-500);
    --accent-hover: var(--b-600);
    --accent-soft: var(--b-50);
    --accent-line: var(--b-200);

    /* Dark stage — the single dark surface in the product */
    --stage: #0b1420;
    --stage-2: #101c2c;
    --stage-line: rgba(148, 174, 214, 0.16);
    --stage-text: #eaf1fb;
    --stage-text-2: rgba(215, 227, 245, 0.68);

    /* ---- Radii ---- */
    --r-xs: 6px;
    --r-sm: 8px;
    --r-md: 10px;
    --r-lg: 14px;
    --r-xl: 18px;
    --r-2xl: 24px;
    --r-3xl: 32px;
    --r-full: 999px;

    /* ---- Elevation: tinted, layered, never flat black ---- */
    --sh-xs: 0 1px 2px rgba(16, 30, 54, 0.06);
    --sh-sm: 0 1px 2px rgba(16, 30, 54, 0.06), 0 2px 6px rgba(16, 30, 54, 0.05);
    --sh-md: 0 1px 2px rgba(16, 30, 54, 0.05), 0 8px 20px -6px rgba(16, 30, 54, 0.1);
    --sh-lg: 0 2px 6px rgba(16, 30, 54, 0.05), 0 20px 44px -14px rgba(16, 30, 54, 0.18);
    --sh-xl: 0 4px 10px rgba(16, 30, 54, 0.05), 0 36px 72px -22px rgba(16, 30, 54, 0.24);
    --sh-brand: 0 1px 2px rgba(23, 55, 150, 0.24), 0 10px 24px -8px rgba(47, 107, 255, 0.5);
    --sh-good: 0 1px 2px rgba(4, 137, 92, 0.24), 0 10px 24px -8px rgba(15, 171, 115, 0.44);
    --sh-inset: inset 0 1px 0 rgba(255, 255, 255, 0.7);

    /* ---- Motion ---- */
    --ease: cubic-bezier(0.32, 0.72, 0.28, 1);
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --t-fast: 130ms;
    --t: 200ms;
    --t-slow: 420ms;

    /* ---- Type ---- */
    --font: "Inter var", "Inter", -apple-system, BlinkMacSystemFont,
        "Segoe UI Variable Display", "Segoe UI", system-ui, "PingFang SC",
        "HarmonyOS Sans SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code",
        Consolas, "Liberation Mono", monospace;

    /* ---- Layout ---- */
    --shell: 1200px;
    --shell-wide: 1440px;
    --gutter: clamp(16px, 4vw, 40px);
}

/* --------------------------------------------------------------------------
   2. Reset & base
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.6;
    letter-spacing: -0.006em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
h4 {
    margin: 0;
    font-weight: 660;
    line-height: 1.18;
    letter-spacing: -0.026em;
    color: var(--text);
    text-wrap: balance;
}

p {
    margin: 0;
    text-wrap: pretty;
}

a {
    color: inherit;
    text-decoration: none;
}

img,
svg,
video,
canvas {
    display: block;
    max-width: 100%;
}

button,
input,
select,
textarea {
    font: inherit;
    color: inherit;
}

ul,
ol {
    margin: 0;
    padding: 0;
    list-style: none;
}

code,
kbd {
    font-family: var(--font-mono);
    font-size: 0.88em;
    letter-spacing: 0;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--r-xs);
    padding: 0.12em 0.42em;
    color: var(--n-700);
}

::selection {
    background: var(--b-200);
    color: var(--b-900);
}

:focus-visible {
    outline: 2px solid var(--b-400);
    outline-offset: 2px;
    border-radius: var(--r-xs);
}

/* Templates toggle panels with the `hidden` attribute; no layout rule may win
   over it. */
[hidden] {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

/* --------------------------------------------------------------------------
   3. Layout primitives
   -------------------------------------------------------------------------- */
.shell {
    width: 100%;
    max-width: var(--shell);
    margin-inline: auto;
    padding-inline: var(--gutter);
}

.shell-wide {
    width: 100%;
    max-width: var(--shell-wide);
    margin-inline: auto;
    padding-inline: var(--gutter);
}

.stack {
    display: flex;
    flex-direction: column;
}

.row {
    display: flex;
    align-items: center;
}

.hairline {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--line-strong) 12%, var(--line-strong) 88%, transparent);
    border: 0;
    margin: 0;
}

/* --------------------------------------------------------------------------
   4. Type utilities
   -------------------------------------------------------------------------- */
.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 11.5px;
    font-weight: 620;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--b-600);
}

.display {
    font-size: clamp(38px, 5.4vw, 64px);
    font-weight: 700;
    line-height: 1.06;
    letter-spacing: -0.036em;
}

.h2 {
    font-size: clamp(24px, 2.8vw, 34px);
    font-weight: 680;
    letter-spacing: -0.03em;
    line-height: 1.16;
}

.h3 {
    font-size: 17px;
    font-weight: 640;
    letter-spacing: -0.018em;
}

.lede {
    font-size: clamp(16px, 1.5vw, 18.5px);
    line-height: 1.68;
    color: var(--text-2);
}

.muted {
    color: var(--text-2);
}

.tnum {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1, "ss01" 1;
}

.grad-text {
    background: linear-gradient(96deg, var(--b-600) 0%, var(--b-500) 34%, var(--g-500) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* --------------------------------------------------------------------------
   5. Surfaces
   -------------------------------------------------------------------------- */
.card {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-xl);
    box-shadow: var(--sh-sm);
}

.card-pad {
    padding: clamp(18px, 2.2vw, 26px);
}

/* Interactive card: lifts on hover, reveals a cobalt hairline */
.card-lift {
    transition: transform var(--t) var(--ease-out), box-shadow var(--t) var(--ease-out),
        border-color var(--t) var(--ease-out);
}

.card-lift:hover {
    transform: translateY(-3px);
    border-color: var(--accent-line);
    box-shadow: var(--sh-lg);
}

.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
}

/* --------------------------------------------------------------------------
   6. Buttons
   -------------------------------------------------------------------------- */
.btn {
    --btn-bg: var(--surface);
    --btn-fg: var(--n-800);
    --btn-line: var(--line-strong);
    --btn-shadow: var(--sh-xs);
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 16px;
    border: 1px solid var(--btn-line);
    border-radius: var(--r-md);
    background: var(--btn-bg);
    color: var(--btn-fg);
    font-size: 14px;
    font-weight: 580;
    letter-spacing: -0.012em;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: var(--btn-shadow);
    transition: transform var(--t-fast) var(--ease), background var(--t-fast) var(--ease),
        border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease),
        opacity var(--t-fast) var(--ease);
    -webkit-user-select: none;
    user-select: none;
}

.btn:hover:not(:disabled) {
    background: var(--n-50);
    border-color: var(--line-heavy);
}

.btn:active:not(:disabled) {
    transform: translateY(1px) scale(0.994);
    box-shadow: none;
}

.btn:disabled {
    opacity: 0.44;
    cursor: not-allowed;
    box-shadow: none;
}

.btn svg {
    flex: none;
}

.btn-primary {
    --btn-bg: linear-gradient(180deg, var(--b-500), var(--b-700));
    --btn-fg: #fff;
    --btn-line: var(--b-800);
    --btn-shadow: var(--sh-brand);
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(180deg, var(--b-500), var(--b-600));
    border-color: var(--b-700);
}

.btn-success {
    --btn-bg: linear-gradient(180deg, var(--g-500), var(--g-700));
    --btn-fg: #fff;
    --btn-line: var(--g-800);
    --btn-shadow: var(--sh-good);
}

.btn-success:hover:not(:disabled) {
    background: linear-gradient(180deg, var(--g-500), var(--g-600));
    border-color: var(--g-700);
}

/* Alias: templates spell the neutral button out as .btn-secondary. */
.btn-secondary {
    --btn-bg: var(--surface);
    --btn-fg: var(--n-800);
    --btn-line: var(--line-strong);
}

.btn-ghost {
    --btn-bg: transparent;
    --btn-line: transparent;
    --btn-shadow: none;
    color: var(--text-2);
}

.btn-ghost:hover:not(:disabled) {
    background: var(--surface-2);
    border-color: var(--line);
    color: var(--text);
}

.btn-lg {
    min-height: 48px;
    padding: 0 22px;
    font-size: 15.5px;
    border-radius: var(--r-lg);
}

.btn-block {
    width: 100%;
}

/* Arrow that slides on hover — used on CTAs */
.btn .arw {
    transition: transform var(--t) var(--spring);
}

.btn:hover .arw {
    transform: translateX(3px);
}

/* --------------------------------------------------------------------------
   7. Chips, pills, badges
   -------------------------------------------------------------------------- */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 26px;
    padding: 0 10px;
    border-radius: var(--r-full);
    background: var(--surface-2);
    border: 1px solid var(--line);
    color: var(--text-2);
    font-size: 12px;
    font-weight: 560;
    letter-spacing: -0.004em;
    white-space: nowrap;
}

.chip-brand {
    background: var(--accent-soft);
    border-color: var(--accent-line);
    color: var(--b-700);
}

.chip-good {
    background: var(--g-50);
    border-color: var(--g-200);
    color: var(--g-700);
}

.chip-warn {
    background: var(--w-50);
    border-color: var(--w-100);
    color: var(--w-700);
}

.chip-alert {
    background: var(--r-50);
    border-color: var(--r-100);
    color: var(--r-700);
}

/* Live dot */
.dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--g-400);
    box-shadow: 0 0 0 0 rgba(31, 198, 137, 0.65);
    animation: pulse-dot 2.4s var(--ease-out) infinite;
    flex: none;
}

@keyframes pulse-dot {
    0% {
        box-shadow: 0 0 0 0 rgba(31, 198, 137, 0.6);
    }
    65% {
        box-shadow: 0 0 0 7px rgba(31, 198, 137, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(31, 198, 137, 0);
    }
}

/* --------------------------------------------------------------------------
   8. Forms
   -------------------------------------------------------------------------- */
.field-label {
    display: block;
    margin-bottom: 7px;
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: 0.004em;
    color: var(--text-2);
}

.input,
.select {
    width: 100%;
    min-height: 42px;
    padding: 0 13px;
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: var(--r-md);
    font-size: 14.5px;
    color: var(--text);
    box-shadow: var(--sh-xs);
    transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease),
        background var(--t-fast) var(--ease);
}

.input::placeholder {
    color: var(--text-4);
}

.input:hover,
.select:hover {
    border-color: var(--line-heavy);
}

.input:focus,
.select:focus {
    outline: none;
    border-color: var(--b-400);
    box-shadow: 0 0 0 3.5px rgba(47, 107, 255, 0.15);
}

.select {
    appearance: none;
    padding-right: 38px;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none' stroke='%236d7d95' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6.5 8 10.5 12 6.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

/* Segmented control */
.seg {
    display: inline-grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    gap: 2px;
    padding: 3px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    width: 100%;
}

.seg > button {
    appearance: none;
    border: 0;
    background: transparent;
    border-radius: 7px;
    min-height: 32px;
    padding: 0 12px;
    font-size: 13px;
    font-weight: 570;
    color: var(--text-2);
    cursor: pointer;
    transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease),
        box-shadow var(--t-fast) var(--ease);
}

.seg > button:hover {
    color: var(--text);
}

.seg > button[aria-pressed="true"] {
    background: var(--surface);
    color: var(--b-700);
    box-shadow: var(--sh-xs);
}

/* Switch */
.switch {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 13.5px;
    font-weight: 540;
    color: var(--text-2);
    -webkit-user-select: none;
    user-select: none;
}

.switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.switch .track {
    position: relative;
    width: 38px;
    height: 22px;
    border-radius: var(--r-full);
    background: var(--n-300);
    transition: background var(--t) var(--ease);
    flex: none;
}

.switch .track::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(16, 30, 54, 0.3);
    transition: transform var(--t) var(--spring);
}

.switch input:checked + .track {
    background: var(--g-400);
}

.switch input:checked + .track::after {
    transform: translateX(16px);
}

.switch input:focus-visible + .track {
    outline: 2px solid var(--b-400);
    outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   9. Metrics
   -------------------------------------------------------------------------- */
.metric-label {
    display: block;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.055em;
    text-transform: uppercase;
    color: var(--text-3);
}

.metric-value {
    font-size: 26px;
    font-weight: 660;
    letter-spacing: -0.028em;
    line-height: 1.15;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   10. Banners
   -------------------------------------------------------------------------- */
.banner {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: var(--r-md);
    font-size: 13.5px;
    line-height: 1.55;
    border: 1px solid var(--r-100);
    background: var(--r-50);
    color: var(--r-700);
}

.banner-note {
    border-color: var(--line-strong);
    background: var(--surface-2);
    color: var(--text-2);
}

/* --------------------------------------------------------------------------
   11. Tables
   -------------------------------------------------------------------------- */
.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--surface);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
    min-width: 640px;
}

.table th {
    position: sticky;
    top: 0;
    text-align: left;
    font-size: 11.5px;
    font-weight: 640;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-3);
    background: var(--surface-2);
    padding: 11px 16px;
    border-bottom: 1px solid var(--line-strong);
    white-space: nowrap;
}

.table td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--line);
    color: var(--text-2);
    vertical-align: middle;
}

.table tbody tr:last-child td {
    border-bottom: 0;
}

.table tbody tr {
    transition: background var(--t-fast) var(--ease);
}

.table tbody tr:hover {
    background: var(--b-50);
}

.table td:first-child {
    color: var(--text);
    font-weight: 580;
}

/* --------------------------------------------------------------------------
   12. Decorative: grid + aurora backdrops
   -------------------------------------------------------------------------- */
.bg-grid {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image: linear-gradient(to right, rgba(19, 43, 82, 0.045) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(19, 43, 82, 0.045) 1px, transparent 1px);
    background-size: 56px 56px;
    -webkit-mask-image: radial-gradient(120% 80% at 50% 0%, #000 25%, transparent 78%);
    mask-image: radial-gradient(120% 80% at 50% 0%, #000 25%, transparent 78%);
}

.bg-aurora {
    position: absolute;
    inset: -20% -10% auto -10%;
    height: 720px;
    pointer-events: none;
    background:
        radial-gradient(560px 320px at 12% 22%, rgba(47, 107, 255, 0.18), transparent 66%),
        radial-gradient(520px 300px at 82% 8%, rgba(31, 198, 137, 0.16), transparent 68%),
        radial-gradient(680px 380px at 52% -6%, rgba(34, 211, 238, 0.12), transparent 70%);
    filter: blur(4px);
}

/* --------------------------------------------------------------------------
   13. Scroll reveal

   Opt-in, never opt-out: content is visible by default and only hidden once
   JS has confirmed it can reveal it again. A failed script can dim the polish
   but must never blank the page.
   -------------------------------------------------------------------------- */
.js-reveal .reveal {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 620ms var(--ease-out), transform 620ms var(--ease-out);
    transition-delay: var(--reveal-delay, 0ms);
    will-change: opacity, transform;
}

.js-reveal .reveal.in {
    opacity: 1;
    transform: none;
    will-change: auto;
}

/* --------------------------------------------------------------------------
   14. Scrollbars
   -------------------------------------------------------------------------- */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--n-300) transparent;
}

*::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

*::-webkit-scrollbar-track {
    background: transparent;
}

*::-webkit-scrollbar-thumb {
    background: var(--n-300);
    border: 3px solid var(--bg);
    border-radius: var(--r-full);
}

*::-webkit-scrollbar-thumb:hover {
    background: var(--n-400);
}

/* --------------------------------------------------------------------------
   15. Reduced motion
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }

    .reveal {
        opacity: 1;
        transform: none;
    }
}
