form:not(.auth-form) {
    background: var(--color-surface);
    padding: 28px;
    border-radius: 20px;
    border: 1px solid var(--color-line);
    max-width: 520px;
    box-shadow: var(--shadow-raised);
    box-sizing: border-box;
}

label:not(.auth-form label),
.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.85rem;
    font-weight: 650;
    color: var(--color-ink);
    letter-spacing: 0;
}

input:not(.auth-form input),
select:not(.auth-form select),
textarea:not(.auth-form textarea) {
    width: 100%;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-line);
    background: var(--color-surface-alt);
    color: var(--color-ink);
    font: inherit;
    font-size: 1rem;
    outline: none;
    transition: border var(--transition-base), box-shadow var(--transition-base), background var(--transition-base);
    box-sizing: border-box;
}

input:not(.auth-form input)::placeholder,
textarea:not(.auth-form textarea)::placeholder {
    color: var(--color-ink-a52);
}

input:not(.auth-form input):focus,
select:not(.auth-form select):focus,
textarea:not(.auth-form textarea):focus {
    border-color: var(--color-moss);
    background: var(--color-white);
    box-shadow: 0 0 0 4px var(--color-moss-a16);
}

input:not(.auth-form input):disabled,
select:not(.auth-form select):disabled,
textarea:not(.auth-form textarea):disabled {
    opacity: 0.58;
    background: var(--color-surface-disabled);
    color: var(--color-ink-soft);
    cursor: not-allowed;
}

.input-error,
.input-success {
    border-color: var(--color-moss) !important;
    box-shadow: 0 0 0 4px var(--color-moss-a16) !important;
}

.form-group {
    margin-bottom: 20px;
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: var(--color-ink-a52);
    font-size: 0.8rem;
}

.form-section {
    margin-bottom: 18px;
    padding: 18px;
    background: var(--color-surface);
    border: 1px solid var(--color-ink-a12);
    border-radius: var(--radius-md);
}

.form-section h4 {
    margin: 0 0 10px;
    color: var(--color-ink-a76);
    border-bottom: 2px solid var(--color-moss);
    padding-bottom: 10px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.form-grid,
.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.form-grid {
    gap: 14px 18px;
}

.checkbox-grid {
    gap: 10px 14px;
}

.checkbox-item,
.checkboxLine {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid var(--color-ink-a12);
    border-radius: var(--radius-sm);
    background: var(--color-surface-alt);
    color: var(--color-ink-a76);
    font-weight: 650;
}

.checkbox-item input,
.checkboxLine input {
    width: auto;
}

.repeat-row {
    display: grid;
    gap: 12px;
    margin-bottom: 14px;
    padding: 14px;
    border: 1px solid var(--color-ink-a12);
    border-radius: var(--radius-md);
    background: var(--color-surface-alt);
}

@media (max-width: 560px) {
    form:not(.auth-form) {
        max-width: 100%;
        padding: 18px;
        border-radius: var(--radius-md);
    }

    .form-section {
        padding: 14px;
    }

    .section-header {
        align-items: stretch;
        flex-direction: column;
    }

    .section-header button,
    .button-row button {
        width: 100%;
    }

    .form-grid,
    .checkbox-grid {
        grid-template-columns: 1fr;
    }
}

/* Authentication forms */
.auth-shell .auth-panel {
    width: 100%;
}

.auth-shell .auth-heading {
    margin-bottom: 2rem;
}

.auth-shell .auth-eyebrow {
    display: block;
    margin-bottom: 0.75rem;
    color: var(--auth-moss-dark);
    font-size: 0.72rem;
    font-weight: 850;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}

.auth-shell .auth-heading h1 {
    margin: 0;
    color: var(--auth-black);
    font-size: clamp(2.35rem, 5vw, 3.45rem);
    line-height: 1;
    letter-spacing: -0.05em;
}

.auth-shell .auth-heading p {
    max-width: 45ch;
    margin: 1rem 0 0;
    color: var(--auth-muted);
    font-size: 0.95rem;
    line-height: 1.65;
}

.auth-shell .auth-form {
    display: grid;
    gap: 1.35rem;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.auth-shell .register-form {
    margin-top: 1.75rem;
}

.auth-shell .auth-field {
    display: grid;
    gap: 0.4rem;
    margin: 0;
}

.auth-shell .auth-field-label,
.auth-shell .auth-field > span:first-child {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin: 0;
    color: var(--auth-black);
    font-size: 0.78rem;
    font-weight: 800;
}

.auth-shell .auth-field-hint {
    color: var(--auth-muted);
    font-size: 0.7rem;
    font-weight: 600;
}

.auth-shell .auth-field input:not([type="checkbox"]):not([type="hidden"]):not(.totp-code-cell) {
    width: 100%;
    min-height: 52px;
    margin: 0;
    padding: 0.75rem 0.85rem;
    border: 0;
    border-bottom: 1px solid var(--auth-line);
    border-radius: 0;
    background: transparent;
    color: var(--auth-black);
    font: inherit;
    font-size: 1rem;
    font-weight: 520;
    outline: none;
    box-shadow: none;
    box-sizing: border-box;
    transition: border-color 0.15s ease;
}

.auth-shell .auth-field input:not([type="checkbox"]):not([type="hidden"]):not(.totp-code-cell)::placeholder {
    color: #a1a59c;
    font-weight: 400;
    opacity: 1;
}

.auth-shell .auth-field input:not([type="checkbox"]):not([type="hidden"]):not(.totp-code-cell):hover {
    border-bottom-color: var(--auth-moss);
}

.auth-shell .auth-field input:not([type="checkbox"]):not([type="hidden"]):not(.totp-code-cell):focus {
    border-bottom: 2px solid var(--auth-moss-dark);
    box-shadow: none;
}

.auth-shell .auth-field input.invalid {
    border-bottom-color: var(--auth-moss-dark);
}

.auth-shell .validation-message {
    color: var(--auth-moss-dark);
    font-size: 0.74rem;
    font-weight: 700;
}

.auth-shell .auth-actions {
    display: grid;
    gap: 0.75rem;
    margin-top: 0.25rem;
}

.auth-shell .auth-button {
    min-height: 50px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    margin: 0;
    padding: 0 1.1rem;
    border: 1px solid var(--auth-black);
    border-radius: 6px;
    background: var(--auth-white);
    color: var(--auth-black);
    font: inherit;
    font-size: 0.86rem;
    font-weight: 850;
    cursor: pointer;
    box-shadow: none;
    box-sizing: border-box;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.auth-shell .auth-button:disabled {
    cursor: wait;
    opacity: 0.58;
}

.auth-shell .auth-button.primary {
    background: var(--auth-black);
    color: var(--auth-white);
}

.auth-shell .auth-button.primary:hover:not(:disabled),
.auth-shell .auth-button.primary:focus-visible:not(:disabled) {
    border-color: var(--auth-moss-dark);
    background: var(--auth-moss-dark);
}

.auth-shell .auth-button.secondary {
    border-color: var(--auth-line);
    background: var(--auth-white);
    color: var(--auth-black);
}

.auth-shell .auth-button.secondary:hover:not(:disabled),
.auth-shell .auth-button.secondary:focus-visible:not(:disabled) {
    border-color: var(--auth-moss-dark);
    color: var(--auth-moss-dark);
}

.auth-shell .auth-button.full {
    width: 100%;
}

.auth-shell .auth-inline-link,
.auth-shell .auth-link-button,
.auth-shell .auth-secondary-link a {
    color: var(--auth-moss-dark);
    font: inherit;
    font-size: 0.78rem;
    font-weight: 800;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-decoration-color: var(--auth-moss);
    text-underline-offset: 0.22rem;
}

.auth-shell .auth-link-button {
    min-height: 36px;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
}

.auth-shell .auth-secondary-link {
    margin: 1rem 0 0;
    text-align: center;
}

.auth-shell .auth-checks {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.auth-shell .auth-checks label {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin: 0;
    color: var(--auth-muted);
    font-size: 0.76rem;
}

.auth-shell .auth-checks input {
    width: 17px;
    height: 17px;
    flex: 0 0 auto;
    accent-color: var(--auth-moss-dark);
}

.auth-shell .auth-divider {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 0.8rem;
    color: var(--auth-muted);
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
}

.auth-shell .auth-divider::before,
.auth-shell .auth-divider::after {
    content: "";
    height: 1px;
    background: var(--auth-line);
}

.auth-shell .auth-form-note {
    margin: -0.5rem 0 0;
    color: var(--auth-muted);
    font-size: 0.72rem;
    line-height: 1.5;
    text-align: center;
}

.auth-shell .auth-message {
    margin-top: 1rem;
    padding: 0.65rem 0 0.65rem 0.85rem;
    border: 0;
    border-left: 3px solid var(--auth-moss-dark);
    border-radius: 0;
    background: transparent;
    color: var(--auth-black);
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1.5;
}

.auth-shell .auth-message.success {
    border-left-color: var(--auth-moss);
    color: var(--auth-moss-dark);
}

.auth-shell .auth-confirmation {
    margin: 0 0 0.25rem;
    color: var(--auth-moss-dark);
    font-size: 0.8rem;
    font-weight: 850;
}

.auth-shell .auth-switch {
    margin: 1.5rem 0 0;
    color: var(--auth-muted);
    font-size: 0.82rem;
    text-align: center;
}

.auth-shell .auth-switch a {
    margin-left: 0.2rem;
    color: var(--auth-moss-dark);
    font-weight: 900;
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-decoration-color: var(--auth-moss);
    text-underline-offset: 0.22rem;
}

.auth-shell .auth-register-prompt {
    display: grid;
    gap: 0.35rem;
    margin-top: 1.75rem;
    color: var(--auth-muted);
    font-size: 0.78rem;
    text-align: center;
}

.auth-shell .auth-register-prompt a {
    width: fit-content;
    margin: 0 auto;
    color: var(--auth-moss-dark);
    font-size: 0.92rem;
    font-weight: 900;
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-decoration-color: var(--auth-moss);
    text-underline-offset: 0.28rem;
}

@media (max-width: 560px) {
    .auth-shell .auth-heading h1 {
        font-size: clamp(2.1rem, 11vw, 2.8rem);
    }

    .auth-shell .auth-checks {
        grid-template-columns: 1fr;
    }
}

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