/* ==========================================================================
   Monarch — custom SaaS product studio (client-side)
   Aesthetic: modern minimal SaaS × imperial Chinese severity
   Sibling of Builders: identical bones, opposite temperament.
   Builders is soft washi and sakura orange; Monarch is cold stone,
   lacquer black, imperial red and a single thread of gold.
   ========================================================================== */

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
img, picture, svg, video { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; background: none; border: 0; cursor: pointer; color: inherit; }
ul, ol { list-style: none; }

/* ---------- Tokens ---------- */
:root {
    /* canvas — cold stone / rice-paper grey, never warm */
    --canvas:    #F5F3F1;
    --canvas-2:  #EBE7E3;
    --canvas-3:  #DFD9D4;

    /* ink — hard near-black, never pure */
    --ink:       #14100F;
    --ink-soft:  #47413E;
    --ink-mute:  #857D78;

    /* lines */
    --line:       #E1DAD4;
    --line-soft:  #EDE8E3;

    /* accents — used sparingly */
    --imperial:     #C8102E;   /* 朱 the single emphasis colour, on light */
    --imperial-lit: #E63946;   /* the same red, brightened for black */
    --gold:         #C9A227;   /* 金 one thread, never a surface */
    --gold-lit:     #D9B65C;

    /* type */
    --serif: 'Playfair Display', 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
    --sans:  'Inter', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
    --zh:    'Noto Serif SC', 'Songti SC', 'SimSun', 'Source Han Serif SC', serif;

    /* motion */
    --ease:       cubic-bezier(0.22, 1, 0.36, 1);
    --ease-soft:  cubic-bezier(0.4, 0, 0.2, 1);
    --slow:       1400ms;
    --med:        700ms;
    --fast:       320ms;
}

/* ---------- Base ---------- */
body {
    background-color: var(--canvas);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.92' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.08 0 0 0 0 0.07 0 0 0 0 0.07 0 0 0 0.07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-blend-mode: multiply;
    color: var(--ink);
    font-family: var(--sans);
    font-size: 16px;
    line-height: 1.55;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
}

::selection { background: var(--ink); color: var(--canvas); }

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

em {
    font-style: italic;
    font-weight: 400;
    color: var(--imperial);
}

.eyebrow__line {
    display: inline-block;
    width: 28px;
    height: 1px;
    background: var(--ink-mute);
}

/* ───────── Intro curtain ─────────
   The 帝 hanzi rises into view, the "MONARCH" wordmark fades in below,
   then the curtain clears. Signin (`.intro-ripple--signin`) adds a final
   flourish — the glyph turns imperial red and fades out before the curtain
   wipes. Animations are CSS-keyframe driven; JS only locks scroll and
   removes the curtain when the sequence ends. */

#intro-curtain {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: #F5F3F1;
    display: grid;
    place-items: center;
    pointer-events: none;
    transition: opacity 0.6s ease;
}
#intro-curtain.is-clearing { opacity: 0; }

.intro-ripple .intro-stage {
    position: relative;
    display: grid;
    place-items: center;
    width: min(440px, 80vw);
    aspect-ratio: 1;
    color: var(--ink, #14100F);
}
.intro-ripple #intro-hanzi {
    position: relative;
    font-family: var(--zh);
    font-size: clamp(110px, 18vw, 180px);
    font-weight: 500;
    color: currentColor;
    opacity: 0;
    transform: translateY(8px);
    animation: intro-hanzi-rise .9s cubic-bezier(0.16, 1, 0.3, 1) .35s forwards;
    z-index: 2;
}
@keyframes intro-hanzi-rise { to { opacity: 1; transform: translateY(0); } }
.intro-ripple .intro-wordmark {
    position: absolute;
    bottom: 22%;
    left: 50%;
    transform: translateX(-50%) translateY(8px);
    font-family: var(--serif);
    font-size: 14px;
    letter-spacing: .32em;
    text-transform: uppercase;
    color: currentColor;
    opacity: 0;
    animation: intro-word-rise .7s ease .9s forwards;
    white-space: nowrap;
    z-index: 2;
}
@keyframes intro-word-rise { to { opacity: 1; transform: translateX(-50%) translateY(0); } }

/* The seal — a red square that stamps itself behind the glyph, the way a
   Chinese name-chop lands on paper. Builders has no equivalent; this is
   Monarch's one flourish of its own. */
.intro-ripple .intro-seal {
    position: absolute;
    width: clamp(128px, 21vw, 208px);
    aspect-ratio: 1;
    border: 2px solid var(--imperial);
    border-radius: 6px;
    opacity: 0;
    transform: scale(1.35) rotate(-4deg);
    animation: intro-seal-stamp .7s cubic-bezier(0.16, 1, 0.3, 1) 1.15s forwards;
    z-index: 1;
}
@keyframes intro-seal-stamp {
    0%   { opacity: 0;   transform: scale(1.35) rotate(-4deg); }
    60%  { opacity: .85; transform: scale(.97)  rotate(-4deg); }
    100% { opacity: .5;  transform: scale(1)    rotate(-4deg); }
}

/* ═══════ Signin flourish — turn imperial red, then fade ═══════ */
.intro-ripple--signin #intro-hanzi {
    /* Stack the rise + recolour-and-fade so the glyph enters in ink, holds
       for ~700ms, burns to imperial red, then dims out before the curtain
       clears. The 0.35s rise delay matches the base rule so timing stays in
       sync with the wordmark. */
    animation:
        intro-hanzi-rise .9s cubic-bezier(0.16, 1, 0.3, 1) .35s forwards,
        signin-hanzi-red-fade 1.0s ease 1.7s forwards;
}
@keyframes signin-hanzi-red-fade {
    0%   { color: var(--ink, #14100F); opacity: 1; }
    40%  { color: #C8102E; opacity: 1; }
    100% { color: #C8102E; opacity: 0; transform: translateY(-4px); }
}
.intro-ripple--signin .intro-seal {
    animation:
        intro-seal-stamp .7s cubic-bezier(0.16, 1, 0.3, 1) 1.15s forwards,
        signin-seal-fade .9s ease 1.9s forwards;
}
@keyframes signin-seal-fade { to { opacity: 0; transform: scale(1.04) rotate(-4deg); } }

/* ---------- Custom cursor ---------- */
.cur {
    position: fixed;
    top: 0; left: 0;
    pointer-events: none;
    z-index: 9999;
    color: #ffffff;
    display: none;
    mix-blend-mode: difference;
}
@media (hover: hover) and (pointer: fine) {
    .cur { display: block; }
}
.cur__dot {
    /* No constantly-following dot — native cursor handles position. */
    display: none;
}
.cur__ring {
    position: absolute;
    top: 0; left: 0;
    width: 26px; height: 26px;
    border: 1px solid #ffffff;
    border-radius: 2px;              /* Monarch's ring is a seal, not a circle */
    transform: translate(-50%, -50%);
    display: flex; align-items: center; justify-content: center;
    opacity: 0;
    transition: width 320ms var(--ease),
                height 320ms var(--ease),
                opacity 220ms var(--ease),
                background 220ms var(--ease);
    will-change: transform;
}
.cur__label {
    font-family: var(--sans);
    font-size: 10px;
    letter-spacing: 0.06em;
    color: currentColor;
    opacity: 0;
    transition: opacity 200ms var(--ease);
    white-space: nowrap;
    transform: translateY(0.5px);
}
.cur.is-link .cur__ring { width: 50px; height: 50px; opacity: 1; }
.cur.is-link .cur__label { opacity: 1; }
.cur.is-cta .cur__ring {
    width: 36px; height: 36px;
    opacity: 1;
    animation: curPulse 1.4s ease-in-out infinite;
}
.cur.is-text .cur__ring,
.cur.is-text .cur__dot { opacity: 0; }
@keyframes curPulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1);   opacity: 0.85; }
    50%      { transform: translate(-50%, -50%) scale(1.18); opacity: 1; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    .cur { display: none; }
    .intro-ripple #intro-hanzi,
    .intro-ripple .intro-wordmark { animation: none; opacity: 1; transform: none; }
    .intro-ripple .intro-seal { animation: none; opacity: .5; transform: rotate(-4deg); }
    .intro-ripple--signin #intro-hanzi { color: #C8102E; }
}

/* ==========================================================================
   /signin PAGE — split-screen SaaS layout
   ========================================================================== */

.auth-page { background: #FFFFFF; }

/* Back button — sits over the dark brand panel on desktop */
.auth-back {
    position: fixed;
    top: clamp(1rem, 3vw, 1.6rem);
    left: clamp(1rem, 3vw, 1.6rem);
    z-index: 80;
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    color: rgba(245, 243, 241, 0.78);
    font-size: 0.82rem;
    letter-spacing: 0.04em;
    padding: 0.55rem 0.9rem;
    background: rgba(245, 243, 241, 0.06);
    border: 1px solid rgba(245, 243, 241, 0.18);
    border-radius: 999px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: gap var(--fast) var(--ease),
                color var(--fast) var(--ease),
                border-color var(--fast) var(--ease),
                background var(--fast) var(--ease);
}
.auth-back:hover {
    gap: 0.85rem;
    color: var(--canvas);
    border-color: rgba(230, 57, 70, 0.55);
    background: rgba(200, 16, 46, 0.14);
}
.auth-back__icon {
    display: inline-grid;
    place-items: center;
    line-height: 0;
}

.auth {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: #FFFFFF;
}

/* ---------- Brand panel (left) ---------- */
.auth__brand {
    position: relative;
    overflow: hidden;
    padding: clamp(1.6rem, 4vw, 3rem) clamp(1.8rem, 5vw, 4rem);
    color: var(--canvas);
    background:
        radial-gradient(120% 80% at 100% 0%, rgba(200, 16, 46, 0.20), transparent 55%),
        radial-gradient(140% 100% at 0% 100%, rgba(201, 162, 39, 0.07), transparent 50%),
        linear-gradient(155deg, #171114 0%, #07060A 100%);
    background-color: #08070A;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 0;
    height: 100%;
}
.auth__brand::before {
    content: '帝';
    position: absolute;
    font-family: var(--zh);
    font-weight: 500;
    font-size: clamp(380px, 56vw, 720px);
    color: var(--imperial);
    opacity: 0.07;
    line-height: 0.78;
    bottom: -0.18em;
    right: -0.08em;
    pointer-events: none;
    user-select: none;
}
/* A single gold hairline down the panel's inner edge — the only gold surface
   in the whole app. Builders has a soft gradient here; Monarch has a rule. */
.auth__brand::after {
    content: '';
    position: absolute;
    top: 0; bottom: 0; right: 0;
    width: 1px;
    background: linear-gradient(180deg, transparent, rgba(201, 162, 39, 0.5), transparent);
    pointer-events: none;
}
.auth__brand > * { position: relative; z-index: 1; }

.auth__brand-top {
    display: flex;
    align-items: center;
    margin-bottom: 0.9rem;
}
.auth__mark {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    color: var(--canvas);
    text-decoration: none;
    transition: opacity var(--fast) var(--ease);
}
.auth__mark:hover { opacity: 0.8; }
.auth__mark-hanzi {
    font-family: var(--zh);
    font-size: 30px;
    line-height: 1;
    color: var(--imperial-lit);
}
.auth__mark-name {
    font-family: var(--serif);
    font-weight: 500;
    font-size: 0.94rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.auth__brand-mid {
    max-width: 38ch;
    margin: 0;
}
.auth__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-family: var(--sans);
    font-size: 0.74rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(245, 243, 241, 0.6);
    margin: 0 0 1.4rem;
}
.auth__eyebrow .eyebrow__line {
    display: inline-block;
    width: 32px;
    height: 1px;
    background: var(--imperial-lit);
}
.auth__hl {
    font-family: var(--serif);
    font-weight: 400;
    font-size: clamp(1.8rem, 3.6vw, 3rem);
    line-height: 1.05;
    letter-spacing: -0.02em;
    color: var(--canvas);
    margin: 0 0 1.1rem;
}
.auth__hl em {
    font-style: italic;
    color: var(--imperial-lit);
}
.auth__sub {
    font-family: var(--sans);
    font-size: 1rem;
    line-height: 1.65;
    color: rgba(245, 243, 241, 0.72);
    max-width: 38ch;
    margin: 0;
}

.auth__brand-bottom {
    position: absolute;
    bottom: clamp(1.6rem, 4vh, 2.4rem);
    left: clamp(1.8rem, 5vw, 4rem);
    right: clamp(1.8rem, 5vw, 4rem);
    max-width: 40ch;
}
.auth__quote {
    margin: 0 0 0.5rem;
    padding: 0.4rem 0 0.4rem 1rem;
    border-left: 2px solid var(--imperial);
    font-family: var(--serif);
    font-style: italic;
    font-size: 1rem;
    line-height: 1.65;
    color: rgba(245, 243, 241, 0.78);
}
.auth__quote em {
    font-style: italic;
    color: var(--gold-lit);
}
.auth__quote-attr {
    font-family: var(--sans);
    font-size: 0.72rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(245, 243, 241, 0.48);
    margin: 0;
    padding-left: 1rem;
}

/* ---------- Form panel (right) ---------- */
.auth__form-side {
    background: #FFFFFF;
    padding: clamp(1.4rem, 4vw, 3rem) clamp(1.4rem, 5vw, 3.5rem);
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    overflow-y: auto;
}
.auth__form-inner {
    width: 100%;
    max-width: 420px;
}

.auth-form__head {
    margin-bottom: 1.4rem;
}
.auth-form__eyebrow {
    font-family: var(--sans);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--ink-mute);
    margin: 0 0 0.9rem;
}
.auth-form__title {
    font-family: var(--serif);
    font-weight: 500;
    font-size: clamp(1.6rem, 2.6vw, 2rem);
    line-height: 1.1;
    letter-spacing: -0.015em;
    color: var(--ink);
    margin: 0 0 0.5rem;
}
.auth-form__title em {
    font-style: italic;
    font-weight: 400;
}
.auth-form__sub {
    color: var(--ink-soft);
    font-size: 0.94rem;
    line-height: 1.55;
    margin: 0;
}

/* Active-session banner shown when the user already has a session. */
.auth-active {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    padding: 1rem 1.1rem;
    background: linear-gradient(165deg, rgba(200, 16, 46, 0.06), rgba(235, 231, 227, 0));
    border: 1px solid rgba(200, 16, 46, 0.35);
    border-radius: 12px;
    margin-bottom: 1.1rem;
}
/* Power-role variant: gold, because the sovereign outranks the house colour */
.auth-active--power {
    background: linear-gradient(155deg, rgba(201, 162, 39, 0.18), rgba(235, 231, 227, 0));
    border-color: rgba(201, 162, 39, 0.7);
    box-shadow: 0 12px 30px -18px rgba(201, 162, 39, 0.4);
}
.auth-active__eyebrow {
    font-family: var(--sans);
    font-size: 0.66rem;
    font-weight: 500;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--imperial);
    margin: 0;
}
.auth-active--power .auth-active__eyebrow { color: var(--gold); }
.auth-active__line {
    font-family: var(--serif);
    font-size: 1.05rem;
    line-height: 1.4;
    color: var(--ink);
    margin: 0;
}
.auth-active__line em {
    font-style: italic;
    color: var(--imperial);
}
/* Shared role pill — used in active session banner, dashboards, etc. */
.role-pill {
    display: inline-block;
    margin-left: 0.4rem;
    font-family: var(--sans);
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    padding: 0.22rem 0.6rem;
    border-radius: 999px;
    vertical-align: middle;
    border: 1px solid transparent;
    background: var(--canvas-2);
    color: var(--ink-mute);
    transition: transform var(--fast) var(--ease);
}
.role-pill--client { background: var(--canvas-2); color: var(--ink-soft); border-color: var(--line); }
.role-pill--staff  { background: var(--canvas-2); color: var(--ink-soft); border-color: var(--line); }

/* Sovereign — the founder, supreme admin. Filled black with gold. */
.role-pill--sovereign {
    background: linear-gradient(135deg, #171114 0%, #08070A 100%);
    color: var(--gold);
    border-color: var(--gold);
    box-shadow: 0 0 0 1px rgba(201, 162, 39, 0.5), 0 8px 18px -10px rgba(201, 162, 39, 0.55);
}
.auth-active__actions {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    flex-wrap: wrap;
    margin-top: 0.2rem;
}
.auth-active__cta {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--ink);
    color: var(--canvas);
    padding: 0.6rem 0.95rem;
    border-radius: 8px;
    font-family: var(--sans);
    font-size: 0.84rem;
    font-weight: 500;
    letter-spacing: 0.005em;
    transition: background var(--fast) var(--ease), gap var(--fast) var(--ease);
}
.auth-active__cta:hover {
    background: var(--imperial);
    gap: 0.6rem;
}
.auth-active__alt {
    color: var(--ink-mute);
    font-family: var(--sans);
    font-size: 0.82rem;
    text-decoration: none;
    border-bottom: 1px solid var(--line);
    padding-bottom: 1px;
    transition: color var(--fast) var(--ease), border-bottom-color var(--fast) var(--ease);
}
.auth-active__alt:hover {
    color: var(--imperial);
    border-bottom-color: var(--imperial);
}
.auth-active__divider {
    text-align: center;
    margin: 0 0 1.1rem;
    color: var(--ink-mute);
    font-family: var(--sans);
    font-size: 0.74rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}
.auth-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.auth-field__label {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    font-family: var(--sans);
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--ink);
    letter-spacing: 0.005em;
}
.auth-remember {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    font-family: var(--sans);
    font-size: 0.84rem;
    color: var(--ink-soft);
    cursor: pointer;
    user-select: none;
    margin-top: -0.1rem;
}
.auth-remember input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border: 1px solid #C6BEB7;
    background: #FFFFFF;
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease);
    flex: 0 0 auto;
}
.auth-remember input[type="checkbox"]:hover { border-color: var(--ink-mute); }
.auth-remember input[type="checkbox"]:checked {
    background: var(--imperial);
    border-color: var(--imperial);
}
.auth-remember input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 1px;
    width: 5px;
    height: 9px;
    border: solid #FFFFFF;
    border-width: 0 1.5px 1.5px 0;
    transform: rotate(45deg);
}
.auth-remember:hover { color: var(--ink); }
.auth-field input {
    font: inherit;
    font-family: var(--sans);
    font-size: 0.94rem;
    background: #FFFFFF;
    border: 1px solid #E0D9D3;
    padding: 0.78rem 1rem;
    color: var(--ink);
    border-radius: 10px;
    transition: border-color var(--fast) var(--ease),
                box-shadow var(--fast) var(--ease);
}
.auth-field input:hover {
    border-color: #C6BEB7;
}
.auth-field input:focus {
    outline: none;
    border-color: var(--imperial);
    box-shadow: 0 0 0 3px rgba(200, 16, 46, 0.10);
}
.auth-field input::placeholder {
    color: #B3ABA4;
}

.auth-form__error {
    margin: 0;
    padding: 0.7rem 0.9rem;
    background: rgba(200, 16, 46, 0.06);
    border: 1px solid rgba(200, 16, 46, 0.25);
    border-radius: 8px;
    color: #93122A;
    font-family: var(--sans);
    font-size: 0.86rem;
    line-height: 1.45;
}

.auth-form__submit {
    width: 100%;
    background: var(--ink);
    color: var(--canvas);
    padding: 0.85rem 1.4rem;
    font-family: var(--sans);
    font-size: 0.92rem;
    font-weight: 500;
    letter-spacing: 0.005em;
    border: 0;
    border-radius: 10px;
    cursor: pointer;
    margin-top: 0.3rem;
    transition: background var(--fast) var(--ease),
                transform var(--fast) var(--ease),
                box-shadow var(--fast) var(--ease);
}
.auth-form__submit:hover:not(:disabled) {
    background: var(--imperial);
    transform: translateY(-1px);
    box-shadow: 0 14px 30px -16px rgba(200, 16, 46, 0.65);
}
.auth-form__submit:active { transform: translateY(0); box-shadow: none; }
.auth-form__submit:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.auth-form__foot {
    margin-top: 1.4rem;
    padding-top: 1rem;
    border-top: 1px solid var(--line-soft);
    text-align: center;
    color: var(--ink-mute);
    font-family: var(--sans);
    font-size: 0.78rem;
    line-height: 1.65;
}
.auth-form__foot a {
    color: var(--ink-soft);
    text-decoration: none;
    border-bottom: 1px solid var(--line);
    padding-bottom: 1px;
}
.auth-form__foot a:hover {
    color: var(--imperial);
    border-bottom-color: var(--imperial);
}

/* ---------- Short viewports (laptops < 720px tall) ---------- */
@media (min-width: 961px) and (max-height: 720px) {
    .auth__brand {
        padding: 1.6rem clamp(1.6rem, 4vw, 3rem);
    }
    .auth__brand-top { margin-bottom: 0.6rem; }
    .auth__brand-mid { margin: 0; }
    .auth__hl       { font-size: clamp(1.6rem, 3vw, 2.2rem); }
    .auth__sub      { font-size: 0.92rem; }
    .auth__quote    { font-size: 0.92rem; line-height: 1.5; }

    .auth__form-side {
        padding: 1.4rem clamp(1.4rem, 4vw, 3rem);
    }
    .auth-form__head    { margin-bottom: 1rem; }
    .auth-form__title   { font-size: clamp(1.5rem, 2.4vw, 1.8rem); }
    .auth-form         { gap: 0.7rem; }
    .auth-field input   { padding: 0.7rem 0.95rem; }
    .auth-form__submit  { padding: 0.78rem 1.4rem; }
    .auth-form__foot    { margin-top: 1rem; padding-top: 0.85rem; }
}

/* ---------- Tablet & below: hide brand content, keep just the logo + form ---------- */
@media (max-width: 960px) {
    .auth {
        height: auto;
        min-height: 100vh;
        min-height: 100dvh;
        grid-template-columns: 1fr;
        overflow: visible;
        background: var(--canvas);
    }

    /* Brand panel collapses to a thin top strip with just the centered logo */
    .auth__brand {
        min-height: auto;
        height: auto;
        padding: 1.4rem;
        background: transparent;
        background-color: transparent;
        color: var(--ink);
        flex-direction: row;
        align-items: center;
        justify-content: center;
    }
    .auth__brand::before,
    .auth__brand::after { display: none; }
    .auth__brand-top {
        margin: 0;
        justify-content: center;
    }
    .auth__brand-mid,
    .auth__brand-bottom { display: none; }

    .auth__mark       { color: var(--ink); }
    .auth__mark-name  { color: var(--ink); }
    .auth__mark-hanzi { color: var(--imperial); }

    /* Back button needs to look right on a light surface now */
    .auth-back {
        color: var(--ink-soft);
        background: rgba(235, 231, 227, 0.8);
        border-color: var(--line);
    }
    .auth-back:hover {
        color: var(--imperial);
        border-color: var(--imperial);
        background: var(--canvas);
    }

    /* Form panel takes the rest of the viewport */
    .auth__form-side {
        height: auto;
        overflow: visible;
        background: var(--canvas);
        padding: clamp(0.6rem, 2vh, 1.2rem) clamp(1.4rem, 6vw, 3rem) clamp(2rem, 6vh, 3rem);
    }
    .auth__form-inner {
        max-width: 440px;
    }
}

/* ---------- Mid mobile (≤ 600px) ---------- */
@media (max-width: 600px) {
    .auth__brand     { padding: 1.2rem 1.4rem 0.4rem; }
    .auth__form-side { padding: 0.8rem 1.4rem 2rem; }
    .auth__mark-hanzi { font-size: 26px; }
    .auth__mark-name  { font-size: 0.88rem; }
    .auth-form__title { font-size: clamp(1.5rem, 6vw, 1.9rem); }
    .auth-form__sub   { font-size: 0.9rem; }
    .auth-back {
        font-size: 0.78rem;
        padding: 0.5rem 0.75rem;
    }
}

/* ---------- Small phones (≤ 400px) ---------- */
@media (max-width: 400px) {
    .auth__brand     { padding: 1rem 1.1rem 0.2rem; }
    .auth__form-side { padding: 0.8rem 1.1rem 1.6rem; }
    .auth-form__head { margin-bottom: 1.1rem; }
    .auth-form       { gap: 0.75rem; }
    .auth-field input,
    .auth-form__submit { font-size: 0.92rem; }
}

/* ---------- Landscape phones (very short) ---------- */
@media (max-width: 960px) and (max-height: 520px) and (orientation: landscape) {
    .auth__brand     { padding: 0.7rem; }
    .auth__form-side { padding-top: 0.6rem; padding-bottom: 1.4rem; }
    .auth-form__head { margin-bottom: 0.8rem; }
    .auth-form__sub  { display: none; }
}

/* ==========================================================================
   SHELL — placeholder pages (404 and friends)
   ========================================================================== */

.shell {
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: clamp(1.4rem, 5vw, 3rem);
}
.shell__card {
    width: min(100%, 560px);
    background: #FFFFFF;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: clamp(1.8rem, 4vw, 2.8rem);
    box-shadow: 0 24px 60px -40px rgba(20, 16, 15, 0.35);
}
.shell__card--power {
    border-color: rgba(201, 162, 39, 0.6);
    box-shadow: 0 24px 60px -36px rgba(201, 162, 39, 0.5);
}
.shell__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    font-family: var(--sans);
    font-size: 0.72rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--ink-mute);
    margin: 0 0 1.1rem;
}
.shell__title {
    font-family: var(--serif);
    font-weight: 400;
    font-size: clamp(1.7rem, 4vw, 2.4rem);
    line-height: 1.08;
    letter-spacing: -0.02em;
    margin: 0 0 0.7rem;
}
.shell__sub {
    color: var(--ink-soft);
    font-size: 0.96rem;
    margin: 0 0 1rem;
}
.shell__note {
    color: var(--ink-mute);
    font-size: 0.88rem;
    line-height: 1.6;
    padding: 0.8rem 1rem;
    background: var(--canvas);
    border: 1px dashed var(--line);
    border-radius: 10px;
    margin: 0 0 1.4rem;
}
.shell__actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}
.shell__cta {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--ink);
    color: var(--canvas);
    padding: 0.65rem 1.05rem;
    border-radius: 8px;
    font-size: 0.86rem;
    font-weight: 500;
    transition: background var(--fast) var(--ease), gap var(--fast) var(--ease);
}
.shell__cta:hover { background: var(--imperial); gap: 0.6rem; }
.shell__alt {
    color: var(--ink-mute);
    font-size: 0.84rem;
    border-bottom: 1px solid var(--line);
    padding-bottom: 1px;
    transition: color var(--fast) var(--ease), border-bottom-color var(--fast) var(--ease);
}
.shell__alt:hover {
    color: var(--imperial);
    border-bottom-color: var(--imperial);
}

/* ---------- Logo placement (desktop panel) ----------
   Top-aligned flow: the logo clears the fixed Home pill by a small gap,
   and the headline block follows the logo instead of floating at the
   vertical centre of the panel. */
@media (min-width: 961px) {
    .auth__brand { justify-content: flex-start; }
    .auth__brand-top {
        margin-top: clamp(5.5rem, 11vh, 7.5rem);
        margin-bottom: 1.1rem;
    }
}

/* ---------- Left panel alignment ----------
   One shared left edge for the whole brand column: the Home pill lines up
   with the logo, eyebrow, headline and quote (all at the panel padding). */
@media (min-width: 961px) {
    .auth-back {
        top: clamp(1.4rem, 3.5vh, 2rem);
        left: clamp(1.8rem, 5vw, 4rem);
    }
}
