/* ============================================================================
   ICOPAD — Auth shell (login / register / forgot / reset)
   Design: split-panel, institutional, WCAG 2.2 AA conscious.
   PRD: §18, §19, §22
   ============================================================================ */

.auth-shell {
    display: grid;
    grid-template-columns: 1fr;
    min-height: 100vh;
    background: var(--surface, #fff);
}

@media (min-width: 1024px) {
    .auth-shell {
        grid-template-columns: 1fr 1fr;
    }
}

/* ── Left brand panel ─────────────────────────────────────────────── */

.auth-shell__brand {
    display: none;
    background:
        radial-gradient(ellipse at top left,
            color-mix(in srgb, var(--brand, #0a4d8c) 25%, transparent),
            transparent 55%),
        radial-gradient(ellipse at bottom right,
            color-mix(in srgb, var(--brand, #0a4d8c) 18%, transparent),
            transparent 55%),
        linear-gradient(135deg, #0a4d8c 0%, #06325a 100%);
    color: #fff;
    position: relative;
    overflow: hidden;
}
.auth-shell__brand::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
    background-size: 32px 32px;
    pointer-events: none;
}
@media (min-width: 1024px) {
    .auth-shell__brand { display: flex; }
}

.auth-shell__brand-inner {
    position: relative;
    z-index: 1;
    align-self: center;
    max-width: 480px;
    margin: 0 auto;
    padding: clamp(3rem, 6vw, 5rem);
}
.auth-shell__brand-eyebrow {
    font-size: .6875rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .24em;
    color: rgba(255,255,255,.72);
    margin: 0 0 20px;
}
.auth-shell__brand-title {
    font-size: clamp(1.75rem, 1.4rem + 1.6vw, 2.5rem);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -.03em;
    margin: 0 0 2rem;
    color: #fff;
    text-wrap: balance;
}
.auth-shell__brand-points {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.auth-shell__brand-points li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: .9375rem;
    color: rgba(255,255,255,.86);
    line-height: 1.5;
}
.auth-shell__brand-points li::before {
    content: "";
    display: inline-block;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    margin-top: 1px;
    border-radius: 50%;
    background: rgba(255,255,255,.14)
                url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><polyline points='20 6 9 17 4 12'/></svg>")
                center / 12px no-repeat;
}

/* ── Right panel ──────────────────────────────────────────────────── */

.auth-shell__panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(1.5rem, 3vw, 3rem);
}

.auth-panel {
    width: 100%;
    max-width: 420px;
}

.auth-panel__head {
    margin-bottom: 2rem;
}
.auth-panel__logo {
    display: inline-block;
    font-size: 1.125rem;
    font-weight: 800;
    letter-spacing: -.02em;
    color: var(--brand, #0a4d8c);
    text-decoration: none;
    margin-bottom: 1.75rem;
}
.auth-panel__title {
    font-size: clamp(1.5rem, 1.2rem + 1vw, 1.875rem);
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -.025em;
    margin: 0 0 6px;
    color: var(--text, #111);
}
.auth-panel__lead {
    font-size: .9375rem;
    color: var(--text-muted, #555);
    line-height: 1.55;
    margin: 0;
    text-wrap: pretty;
}

/* Notices / alerts */
.auth-panel__notice,
.auth-panel__alert {
    padding: 12px 16px;
    border-radius: 10px;
    font-size: .875rem;
    margin-bottom: 1.25rem;
    line-height: 1.5;
}
.auth-panel__notice {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
}
.auth-panel__alert {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}
.auth-panel__alert:focus {
    outline: 2px solid #991b1b;
    outline-offset: 2px;
}
.auth-panel__alert-lead {
    margin: 0 0 6px;
    font-weight: 600;
}
.auth-panel__alert-list {
    margin: 0;
    padding-left: 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.auth-panel__alert-list a {
    color: inherit;
    text-decoration: underline;
}
.auth-panel__alert-list a:hover {
    text-decoration: none;
}

/* ── Form ─────────────────────────────────────────────────────────── */

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}

.auth-form__field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.auth-form__label-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
}
.auth-form__label {
    font-size: .8125rem;
    font-weight: 600;
    color: var(--text, #111);
}
.auth-form__link-sm {
    font-size: .8125rem;
    color: var(--brand, #0a4d8c);
    text-decoration: none;
}
.auth-form__link-sm:hover { text-decoration: underline; }

.auth-form input[type="email"],
.auth-form input[type="password"],
.auth-form input[type="text"],
.auth-form select.auth-form__select {
    padding: 12px 14px;
    font: inherit;
    font-size: .9375rem;
    background: var(--surface, #fff);
    border: 1px solid var(--border, #d4d4d4);
    border-radius: 10px;
    color: var(--text, #111);
    transition: border-color .15s ease, box-shadow .15s ease;
    width: 100%;
}
.auth-form select.auth-form__select {
    appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 38px;
}
.auth-form input[type="email"]:focus,
.auth-form input[type="password"]:focus,
.auth-form input[type="text"]:focus,
.auth-form select.auth-form__select:focus {
    outline: none;
    border-color: var(--brand, #0a4d8c);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand, #0a4d8c) 20%, transparent);
}

/* Password wrapper with toggle */
.auth-form__password {
    position: relative;
    display: flex;
    align-items: center;
}
.auth-form__password input {
    padding-right: 44px;
}
.auth-form__toggle {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: transparent;
    border: 0;
    border-radius: 8px;
    color: var(--text-subtle, #888);
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease;
}
.auth-form__toggle:hover {
    background: var(--surface-hover, #f3f3f3);
    color: var(--text, #111);
}
.auth-form__toggle:focus-visible {
    outline: 2px solid var(--brand, #0a4d8c);
    outline-offset: 2px;
}
.auth-form__toggle-icon--hide { display: none; }
.auth-form__toggle.is-visible .auth-form__toggle-icon--show { display: none; }
.auth-form__toggle.is-visible .auth-form__toggle-icon--hide { display: inline-block; }

/* Remember-me row */
.auth-form__row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}
.auth-form__check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: .8125rem;
    color: var(--text-muted, #555);
    cursor: pointer;
}
.auth-form__check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--brand, #0a4d8c);
}

/* Submit button */
.auth-form__submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: .25rem;
    min-height: 48px;
    padding: 0 24px;
    background: var(--brand, #0a4d8c);
    color: #fff;
    border: 0;
    border-radius: 999px;
    font: inherit;
    font-size: .9375rem;
    font-weight: 700;
    cursor: pointer;
    transition: background-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.auth-form__submit:hover {
    background: color-mix(in srgb, var(--brand, #0a4d8c) 88%, #000);
    transform: translateY(-1px);
    box-shadow: 0 12px 24px -12px color-mix(in srgb, var(--brand, #0a4d8c) 60%, transparent);
}
.auth-form__submit:active { transform: none; }
.auth-form__submit:focus-visible {
    outline: 2px solid var(--brand, #0a4d8c);
    outline-offset: 3px;
}

/* Errors */
.auth-form__error {
    font-size: .8125rem;
    color: #b91c1c;
    margin: 0;
}

/* Native invalid state (subtle) */
.auth-form input:invalid:not(:placeholder-shown) {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, .12);
}

/* ── Divider + alt link ───────────────────────────────────────────── */

.auth-panel__divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 2rem 0 1.25rem;
    color: var(--text-subtle, #888);
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
}
.auth-panel__divider::before,
.auth-panel__divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border-subtle, #eaeaea);
}

.auth-panel__alt {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-start;
}
.auth-panel__alt-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: .9375rem;
    font-weight: 700;
    color: var(--brand, #0a4d8c);
    text-decoration: none;
}
.auth-panel__alt-link:hover { text-decoration: underline; }
.auth-panel__alt-note {
    font-size: .8125rem;
    color: var(--text-muted, #666);
    margin: 0;
    line-height: 1.5;
    text-wrap: pretty;
}

/* Footer */
.auth-panel__foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 2.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border-subtle, #eaeaea);
    font-size: .8125rem;
    color: var(--text-muted, #666);
}
.auth-panel__foot a {
    color: var(--text-muted, #666);
    text-decoration: none;
}
.auth-panel__foot a:hover {
    color: var(--brand, #0a4d8c);
    text-decoration: underline;
}

/* ── Mobile ───────────────────────────────────────────────────────── */

@media (max-width: 480px) {
    .auth-shell__panel { padding: 1.5rem 1.25rem; }
    .auth-form__submit { width: 100%; }
}

/* ── Reduced motion ──────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
    .auth-form__submit,
    .auth-form__toggle,
    .auth-form input,
    .auth-form select {
        transition-duration: .01ms !important;
    }
}

/* ── Forced-colours / high-contrast (PRD §19) ────────────────────── */

@media (forced-colors: active) {
    .auth-form__submit {
        border: 1px solid ButtonText;
    }
    .auth-form input,
    .auth-form select {
        border: 1px solid FieldText;
    }
    .auth-panel__alert,
    .auth-panel__notice {
        border: 1px solid CanvasText;
    }
}

/* ============================================================================
   ICOPAD — Register-specific additions
   PRD: §4.1, §16, §18, §19
   ============================================================================ */

/* Required-field asterisk */
.auth-form__label .req,
.auth-form__check .req {
    color: #dc2626;
    font-weight: 700;
    margin-left: 2px;
}

/* Honeypot — off-canvas (PRD §18 anti-spam).
   NOTE: field name is `website`; keep in sync with the view. */
.auth-form__honeypot {
    position: absolute;
    left: -10000px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* Hint text under fields */
.auth-form__hint {
    font-size: .75rem;
    color: var(--text-subtle, #888);
    margin: 0;
    line-height: 1.5;
}
.auth-form__hint[data-level="0"],
.auth-form__hint[data-level="1"] { color: #b91c1c; }
.auth-form__hint[data-level="2"] { color: #b45309; }
.auth-form__hint[data-level="3"],
.auth-form__hint[data-level="4"] { color: #065f46; }

/* Password strength meter */
.auth-form__meter {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    margin-top: 2px;
}
.auth-form__meter-bar {
    height: 4px;
    border-radius: 999px;
    background: var(--border-subtle, #eaeaea);
    transition: background-color .2s ease;
}
.auth-form__meter-bar.is-active[data-level="1"] { background: #dc2626; }
.auth-form__meter-bar.is-active[data-level="2"] { background: #f59e0b; }
.auth-form__meter-bar.is-active[data-level="3"] { background: #10b981; }
.auth-form__meter-bar.is-active[data-level="4"] { background: #047857; }

/* Consent block — the previous version declared `border` twice;
   the second declaration silently won. Kept a single declaration here. */
.auth-form__consent {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: .5rem 0 0;
    padding: 14px 16px;
    background: var(--bg-subtle, #fafafa);
    border: 1px solid var(--border-subtle, #eaeaea);
    border-radius: 12px;
}
.auth-form__consent legend {
    font-size: .75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--text-subtle, #888);
    padding: 0 6px;
}
.auth-form__check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: .8125rem;
    color: var(--text-muted, #555);
    line-height: 1.55;
    cursor: pointer;
}
.auth-form__check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin-top: 2px;
    accent-color: var(--brand, #0a4d8c);
    flex-shrink: 0;
}
.auth-form__check a {
    color: var(--brand, #0a4d8c);
    text-decoration: underline;
}

/* Screen-reader-only helper (if not already defined globally) */
.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;
}

@media (max-width: 480px) {
    .auth-form__consent {
        padding: 12px;
    }
}

/* Print — hide the decorative brand panel and scripts (PRD §19) */
@media print {
    .auth-shell__brand { display: none !important; }
    .auth-form__toggle,
    .auth-panel__divider,
    .auth-panel__foot { display: none !important; }
    .auth-shell { display: block; }
}