:root {
    --blue: #174ea6;
    --blue-dark: #123c80;
    --cyan: #2f80ed;
    --gold: #f5c542;
    --ink: #101828;
    --muted: #667085;
    --line: #d8e3f1;
    --danger: #c0352b;
    --ok: #0e9384;
    --card: rgba(255, 255, 255, 0.92);
    --shadow: 0 22px 58px rgba(15, 23, 42, 0.11);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at 18% 8%, rgba(245, 197, 66, 0.18), transparent 28%),
        radial-gradient(circle at 86% 20%, rgba(47, 128, 237, 0.18), transparent 30%),
        linear-gradient(135deg, #eef5ff 0%, #f8fbff 46%, #eef6ff 100%);
    color: var(--ink);
    font-family: Tahoma, Arial, sans-serif;
}

body.apple-captive-page {
    background: #f5f8fc;
}

h1,
h2,
h3 {
    margin: 0 0 12px;
}

h1 {
    font-size: 2.4rem;
    line-height: 1.2;
    margin-bottom: 10px;
}

.page {
    margin: 0 auto;
    padding: 28px 0 36px;
    width: min(1080px, calc(100% - 28px));
}

.topbar {
    align-items: center;
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid rgba(216, 227, 241, 0.78);
    border-radius: 18px;
    box-shadow: 0 16px 42px rgba(15, 23, 42, 0.08);
    display: flex;
    gap: 14px;
    justify-content: space-between;
    margin-bottom: 18px;
    overflow: visible;
    padding: 14px 16px;
    position: relative;
    z-index: 50;
}

.brand {
    display: grid;
    gap: 2px 10px;
    grid-template-columns: auto 1fr;
    min-width: 0;
}

.brand-logo {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 10px 22px rgba(23, 78, 166, 0.12);
    grid-row: span 2;
    height: 42px;
    object-fit: contain;
    padding: 4px;
    width: 42px;
}

.brand strong {
    display: block;
    font-size: 1.35rem;
}

.brand span,
.muted {
    color: var(--muted);
}

.topbar-actions {
    display: flex;
    flex: 0 0 auto;
    gap: 10px;
    margin-left: auto;
}

.topbar-mobile-menu {
    display: none;
    position: relative;
    z-index: 90;
}

.mobile-menu-button {
    align-items: center;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    cursor: pointer;
    display: inline-flex;
    flex-direction: column;
    gap: 4px;
    height: 42px;
    justify-content: center;
    list-style: none;
    width: 42px;
}

.mobile-menu-button::-webkit-details-marker {
    display: none;
}

.mobile-menu-button span {
    background: var(--blue);
    border-radius: 999px;
    display: block;
    height: 2px;
    width: 20px;
}

.mobile-menu-panel {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 16px 38px rgba(15, 23, 42, 0.14);
    display: grid;
    min-width: 180px;
    padding: 6px;
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    z-index: 110;
}

.mobile-menu-panel a {
    border-radius: 6px;
    color: var(--ink);
    font-weight: 700;
    padding: 11px 12px;
    text-decoration: none;
    white-space: nowrap;
}

.panel {
    background: var(--card);
    border: 1px solid rgba(216, 227, 241, 0.9);
    border-radius: 20px;
    box-shadow: var(--shadow);
    overflow: hidden;
    position: relative;
    z-index: 1;
}

.apple-captive-page .topbar,
.apple-captive-page .panel {
    background: #fff;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.hero {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
}

.hero-copy {
    padding: 46px;
}

.hero-side {
    background:
        radial-gradient(circle at 18% 16%, rgba(245, 197, 66, 0.25), transparent 30%),
        linear-gradient(160deg, rgba(8, 31, 68, 0.28), transparent 42%),
        linear-gradient(180deg, #174ea6 0%, #0b3a82 100%);
    color: #fff;
    overflow: hidden;
    padding: 34px;
    position: relative;
}

.hero-side::after {
    background:
        linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px);
    background-size: 28px 28px;
    content: "";
    inset: 0;
    opacity: 0.28;
    pointer-events: none;
    position: absolute;
}

.hero-side > * {
    position: relative;
    z-index: 1;
}

.eyebrow {
    background: #eef6ff;
    border: 1px solid #bfd8ff;
    border-radius: 7px;
    color: var(--blue);
    display: inline-block;
    font-size: 0.82rem;
    font-weight: 800;
    margin-bottom: 12px;
    padding: 6px 10px;
}

.tabs {
    background: #f2f6fb;
    border: 1px solid var(--line);
    border-radius: 14px;
    display: flex;
    margin-top: 26px;
    padding: 5px;
}

.tab {
    background: transparent;
    border: 0;
    border-radius: 10px;
    color: var(--muted);
    cursor: pointer;
    flex: 1;
    font: inherit;
    padding: 12px;
}

.tab.active {
    background: #fff;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
    color: var(--blue);
    font-weight: 700;
}

.form-wrap {
    padding: 24px 0 0;
}

.form-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.field.full {
    grid-column: 1 / -1;
}

.password-pair-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

label {
    color: #344054;
    font-size: 0.96rem;
    font-weight: 700;
}

.field-hint {
    color: var(--muted);
    font-size: 0.86rem;
}

input,
select {
    background: #fff;
    border: 1px solid #d7e1ee;
    border-radius: 12px;
    font: inherit;
    font-size: 1rem;
    min-height: 50px;
    padding: 12px 14px;
    width: 100%;
}

input:focus,
select:focus {
    border-color: #6ea8fe;
    box-shadow: 0 0 0 3px rgba(47, 128, 237, 0.12);
    outline: none;
}

select {
    appearance: none;
    background-image:
        linear-gradient(45deg, transparent 50%, #475467 50%),
        linear-gradient(135deg, #475467 50%, transparent 50%);
    background-position:
        calc(100% - 18px) 50%,
        calc(100% - 13px) 50%;
    background-repeat: no-repeat;
    background-size: 5px 5px, 5px 5px;
    padding-right: 42px;
}

.lookup-locked {
    background: #eef6ff !important;
    border-color: #b8d8ff !important;
    color: #344054 !important;
    cursor: not-allowed;
}

select.lookup-locked:disabled {
    opacity: 1;
}

.password-reveal {
    position: relative;
}

.password-reveal input {
    padding-right: 70px;
}

.password-reveal-btn {
    align-items: center;
    background: #eef6ff;
    border: 1px solid #bfd8ff;
    border-radius: 10px;
    color: var(--blue);
    cursor: pointer;
    display: inline-flex;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    height: 38px;
    justify-content: center;
    min-height: 0;
    padding: 0;
    position: absolute;
    right: 7px;
    top: 50%;
    transform: translateY(-50%);
    width: 54px;
}

.password-reveal-btn:hover,
.password-reveal-btn[aria-pressed="true"] {
    background: var(--blue);
    border-color: var(--blue);
    color: #fff;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

.inline-actions {
    align-items: center;
    margin-top: 0;
}

.btn {
    align-items: center;
    border: 1px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    display: inline-flex;
    font: inherit;
    font-weight: 700;
    justify-content: center;
    min-height: 42px;
    padding: 9px 14px;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, #174ea6, #2f80ed);
    border-radius: 14px;
    box-shadow: 0 14px 24px rgba(23, 78, 166, 0.22);
    color: #fff;
    font-size: 1.05rem;
    min-height: 54px;
    padding: 14px 22px;
}

.btn-light {
    background: rgba(255, 255, 255, 0.92);
    border-color: rgba(216, 227, 241, 0.96);
    color: var(--blue);
}

.register-prompt {
    color: var(--muted);
    font-size: 0.94rem;
    margin: 12px 0 0;
    text-align: center;
}

.register-prompt button {
    background: transparent;
    border: 0;
    color: var(--blue);
    cursor: pointer;
    font: inherit;
    font-weight: 800;
    padding: 0;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.alert {
    border-radius: 14px;
    margin-bottom: 14px;
    padding: 12px;
}

.alert-danger {
    background: #fff1f0;
    border: 1px solid #ffd1cc;
    color: var(--danger);
}

.alert-ok {
    background: #ecfdf3;
    border: 1px solid #b8efd1;
    color: #067647;
}

.alert-info {
    background: #eef6ff;
    border: 1px solid #bfd8ff;
    color: #174ea6;
}

.identity-field {
    background: linear-gradient(180deg, #ffffff, #f8fbff);
    border: 1px solid #dbe7f5;
    border-radius: 16px;
    gap: 10px;
    padding: 12px;
}

.identity-switch {
    background: #eef4ff;
    border: 1px solid #d6e4ff;
    border-radius: 13px;
    display: grid;
    gap: 4px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 4px;
}

.identity-option {
    background: transparent;
    border: 0;
    border-radius: 10px;
    color: #475467;
    cursor: pointer;
    font: inherit;
    font-weight: 800;
    min-height: 42px;
    padding: 8px 10px;
}

.identity-option.active {
    background: #fff;
    box-shadow: 0 8px 18px rgba(23, 78, 166, 0.1);
    color: var(--blue);
}

.connection-card {
    align-items: center;
    display: flex;
    gap: 14px;
}

.connection-card h2 {
    margin-bottom: 2px;
}

.connection-card p {
    color: rgba(255, 255, 255, 0.8);
    margin: 0;
}

.signal-dot {
    background: #fff;
    border: 8px solid rgba(255, 255, 255, 0.26);
    border-radius: 50%;
    box-shadow: 0 0 0 9px rgba(245, 197, 66, 0.22);
    flex: 0 0 auto;
    height: 38px;
    width: 38px;
}

.status-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 22px;
}

.status {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 8px;
    padding: 12px;
}

.status span {
    display: block;
    font-size: 0.8rem;
    opacity: 0.82;
}

.status strong {
    display: block;
    font-size: 1.05rem;
    margin-top: 4px;
    overflow-wrap: anywhere;
}

.steps {
    border-top: 1px solid rgba(255, 255, 255, 0.22);
    display: grid;
    gap: 10px;
    margin-top: 22px;
    padding-top: 20px;
}

.steps div {
    align-items: center;
    color: rgba(255, 255, 255, 0.88);
    display: flex;
    gap: 10px;
}

.steps .support-text {
    flex: 1 1 auto;
    min-width: 0;
}

.steps span {
    align-items: center;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 50%;
    display: inline-flex;
    font-weight: 800;
    height: 28px;
    justify-content: center;
    width: 28px;
}

.line-contact {
    align-items: center;
    color: #fff;
    display: inline-flex;
    flex: 0 0 auto;
    margin-left: auto;
    text-decoration: none;
    white-space: nowrap;
}

.line-icon {
    align-items: center;
    background: #06c755;
    border-radius: 6px;
    color: #fff;
    display: inline-flex;
    font-size: 0.58rem;
    font-weight: 800;
    height: 28px;
    justify-content: center;
    width: 28px;
}

@media (max-width: 800px) {
    .page {
        padding: 12px 0;
        width: min(100% - 20px, 1080px);
    }

    .hero,
    .form-grid,
    .password-pair-grid,
    .status-grid {
        grid-template-columns: 1fr;
    }

    .hero-copy,
    .hero-side {
        padding: 22px;
    }

    .hero-copy {
        padding: 24px;
    }

    #connection-info {
        padding: 16px 18px;
    }

    #connection-info .connection-card,
    #connection-info .status-grid,
    #connection-info .steps > div:not(.support-step) {
        display: none;
    }

    #connection-info .steps {
        border-top: 0;
        margin-top: 0;
        padding-top: 0;
    }

    #connection-info .support-step {
        gap: 12px;
    }

    #connection-info .support-step > span {
        display: none;
    }

    #connection-info .support-text {
        font-size: 0.95rem;
        line-height: 1.45;
    }

    .register-prompt {
        font-size: 0.86rem;
        margin-top: 8px;
    }

    .register-prompt button {
        font-weight: 700;
        text-decoration-thickness: 1px;
        text-underline-offset: 2px;
    }

    .login-identity-label {
        font-size: 0.76rem;
        line-height: 1.35;
    }

    h1 {
        font-size: 1.58rem;
    }

    .hero-copy > .muted {
        font-size: 0.8rem;
        line-height: 1.45;
    }

    .topbar,
    .actions {
        align-items: stretch;
        flex-direction: column;
    }

    .topbar {
        align-items: center;
        flex-direction: row;
        gap: 10px;
        padding: 12px;
    }

    .brand {
        flex: 1 1 auto;
    }

    .brand-logo {
        height: 36px;
        width: 36px;
    }

    .brand strong {
        font-size: 1.08rem;
    }

    .brand span {
        font-size: 0.78rem;
    }

    .topbar .topbar-actions {
        display: none;
    }

    .topbar-mobile-menu {
        display: block;
        flex: 0 0 auto;
    }

    .mobile-menu-button {
        background: linear-gradient(135deg, #174ea6, #2f80ed);
        border-color: rgba(255, 255, 255, 0.2);
        box-shadow: 0 10px 22px rgba(23, 78, 166, 0.22);
        height: 44px;
        width: 44px;
    }

    .mobile-menu-button span {
        background: #fff;
        width: 19px;
    }

    .mobile-menu-panel {
        border-color: rgba(216, 227, 241, 0.96);
        border-radius: 16px;
        box-shadow: 0 22px 54px rgba(15, 23, 42, 0.2);
        gap: 4px;
        left: auto;
        max-width: calc(100vw - 28px);
        min-width: min(280px, calc(100vw - 28px));
        padding: 8px;
        right: 0;
        top: calc(100% + 10px);
    }

    .mobile-menu-panel a {
        align-items: center;
        background: #f8fbff;
        border: 1px solid #e2ebf7;
        border-radius: 10px;
        display: flex;
        min-height: 44px;
        padding: 11px 12px;
        white-space: normal;
    }

    .tabs {
        margin-top: 20px;
    }

    .tab {
        min-height: 48px;
    }

    input,
    select {
        min-height: 48px;
    }

    .btn {
        min-height: 48px;
        width: 100%;
    }

    .btn-primary {
        font-size: 1.14rem;
        min-height: 64px;
        padding: 17px 20px;
    }

    .identity-switch {
        grid-template-columns: 1fr;
    }

}

@media (max-width: 420px) {
    .page {
        width: min(100% - 12px, 1080px);
    }

    .hero-copy {
        padding: 20px 18px;
    }

    .form-wrap {
        padding-top: 18px;
    }
}
