/* 五套方案共用的表单控件。配色由各页 :root 覆盖。 */

:root {
    --primary: #0F62E8;
    --primary-hover: #0B52C7;
    --text: #1C2430;
    --muted: #5C6B7E;
    --label: #3E4A5C;
    --line: #E3E8EF;
    --line-hover: #C5CEDA;
    --input-bg: #FFFFFF;
    --input-text: #1C2430;
    --placeholder: #6B7787;
    --ring: rgba(15, 98, 232, .16);
    --code: #0F62E8;
    --code-border: #0F62E8;
    --danger: #C2413A;
    --radius: 8px;
    --font: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

.auth {
    width: min(100%, 380px);
    max-width: 100%;
    flex: 0 0 auto;
    font-family: var(--font);
    color: var(--text);
}

.auth h2 {
    margin: 0 0 18px;
    font-size: 26px;
    line-height: 1.25;
    font-weight: 650;
    letter-spacing: -0.02em;
}

.auth .lede {
    margin: -8px 0 18px;
    font-size: 14px;
    line-height: 1.5;
    color: var(--muted);
}

.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 20px;
    margin: 0 0 22px;
    border-bottom: 1px solid var(--line);
}

.tabs button {
    appearance: none;
    margin: 0 0 -1px;
    padding: 0 0 10px;
    border: 0;
    border-bottom: 2px solid transparent;
    background: none;
    color: var(--muted);
    font: inherit;
    font-size: 14px;
    line-height: 1.4;
    cursor: pointer;
    transition: color 200ms ease, border-color 200ms ease;
}

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

.tabs button.is-on {
    color: var(--text);
    font-weight: 650;
    border-bottom-color: var(--primary);
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0 0 14px;
}

.field > span,
.field-label {
    font-size: 13px;
    line-height: 1.4;
    font-weight: 600;
    color: var(--label);
}

.opt {
    margin-left: 6px;
    font-weight: 400;
    color: var(--muted);
}

.field input {
    width: 100%;
    height: 44px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--input-bg);
    color: var(--input-text);
    font: inherit;
    font-size: 15px;
    transition: border-color 200ms ease, box-shadow 200ms ease;
}

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

.field input:hover { border-color: var(--line-hover); }

.field input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--ring);
}

.pass { position: relative; display: block; }

.pass input { padding-right: 44px; }

.eye {
    position: absolute;
    top: 50%;
    right: 4px;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    margin-top: -18px;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
}

.eye:hover { color: var(--text); }

.eye svg { display: block; }

.eye .when-on { display: none; }

.eye.is-on .when-off { display: none; }

.eye.is-on .when-on { display: block; }

.code-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: end;
}

.code-row .field { margin-bottom: 14px; }

.code-btn {
    height: 44px;
    margin-bottom: 14px;
    padding: 0 14px;
    border: 1px solid var(--code-border);
    border-radius: var(--radius);
    background: transparent;
    color: var(--code);
    font: inherit;
    font-size: 14px;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 200ms ease, color 200ms ease, border-color 200ms ease;
}

.code-btn:hover:not(:disabled) {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.code-btn:disabled {
    border-color: var(--line);
    color: var(--muted);
    cursor: not-allowed;
}

.extras {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: -2px 0 16px;
}

.check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 14px;
    cursor: pointer;
}

.check input {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--primary);
    cursor: pointer;
}

.btn {
    width: 100%;
    height: 44px;
    border: 0;
    border-radius: var(--radius);
    background: var(--primary);
    color: #fff;
    font: inherit;
    font-size: 15px;
    font-weight: 650;
    cursor: pointer;
    transition: background-color 200ms ease;
}

.btn:hover { background: var(--primary-hover); }

.switch {
    margin: 16px 0 0;
    text-align: center;
    font-size: 14px;
    color: var(--muted);
}

.switch a {
    color: var(--primary);
    font-weight: 650;
    text-decoration: none;
    cursor: pointer;
}

.switch a:hover { text-decoration: underline; }

.live {
    min-height: 1.4em;
    margin: 10px 0 0;
    font-size: 13px;
    line-height: 1.4;
}

.live[data-tone="error"] { color: var(--danger); }

.live[data-tone="info"] { color: var(--muted); }

.tabs button:focus-visible,
.btn:focus-visible,
.code-btn:focus-visible,
.eye:focus-visible,
.switch a:focus-visible,
.check input:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .tabs button,
    .field input,
    .code-btn,
    .btn { transition: none; }
}
