body.auth-pending > :not(#auth-screen),
body.auth-required > :not(#auth-screen) { visibility: hidden; }
.auth-screen[hidden], #auth-register-fields[hidden], #auth-form[hidden], #auth-code-form[hidden],
#google-company-form[hidden], #google-auth-box[hidden], #auth-tabs[hidden],
.auth-divider[hidden], #google-unavailable[hidden], #company-picker[hidden],
#selected-company[hidden], #auth-login-tab[hidden], #auth-register-tab[hidden] { display: none !important; }

.auth-screen {
    position: fixed; inset: 0; z-index: 10000; overflow-y: auto;
    display: flex; align-items: center; justify-content: center;
    padding: clamp(16px, 3vw, 36px); box-sizing: border-box;
    background: radial-gradient(circle at 8% 8%, #d7efe7 0, transparent 32%),
                radial-gradient(circle at 95% 90%, #dce8f2 0, transparent 35%),
                #f4f7f6;
    color: #17313a; font-family: "Segoe UI", Arial, sans-serif;
}
.auth-layout {
    width: min(1120px, 100%); min-height: 670px; display: grid;
    grid-template-columns: minmax(0, 1.12fr) minmax(410px, .88fr);
    overflow: hidden; border: 1px solid #dbe6e2; border-radius: 28px;
    background: #fff; box-shadow: 0 28px 85px rgba(22, 53, 60, .13);
}
.auth-story {
    position: relative; display: flex; flex-direction: column;
    justify-content: space-between; padding: 42px 48px; overflow: hidden;
    background: linear-gradient(145deg, #102f39 0%, #123e43 54%, #0b594d 100%);
    color: #f4fffb;
}
.auth-story::before {
    content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .13;
    background-image: linear-gradient(rgba(255,255,255,.2) 1px, transparent 1px),
                      linear-gradient(90deg, rgba(255,255,255,.2) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: linear-gradient(135deg, transparent 10%, #000 100%);
}
.auth-story::after {
    content: ""; position: absolute; width: 330px; height: 330px;
    right: -185px; bottom: -175px; border-radius: 50%;
    border: 1px solid rgba(149, 240, 201, .33);
    box-shadow: 0 0 0 55px rgba(149,240,201,.045), 0 0 0 115px rgba(149,240,201,.025);
    pointer-events: none;
}
.auth-story > * { position: relative; z-index: 1; }
.auth-story-brand { display: flex; align-items: flex-start; }
.pho-full-logo { display: block; width: 160px; height: 160px; flex: none; }
.auth-story-content { max-width: 500px; }
.auth-eyebrow, .auth-card-eyebrow {
    display: inline-flex; align-items: center; gap: 9px;
    font-size: 10px; font-weight: 800; letter-spacing: .16em;
}
.auth-eyebrow { color: #a9e6ca; }
.auth-eyebrow span, .auth-story-dot {
    width: 7px; height: 7px; border-radius: 50%; background: #80e4ac;
    box-shadow: 0 0 0 4px rgba(128, 228, 172, .16);
}
.auth-story h2 {
    margin: 18px 0 16px; font-size: clamp(34px, 3.6vw, 48px);
    line-height: 1.13; font-weight: 740; letter-spacing: -.055em;
}
.auth-story h2 em { color: #8ce7b4; font-style: normal; }
.auth-story-content > p {
    max-width: 435px; margin: 0; color: #c5dbd8;
    font-size: 15px; line-height: 1.7;
}
.auth-flow { display: grid; gap: 10px; margin-top: 34px; }
.auth-flow > div {
    display: flex; align-items: center; gap: 14px; min-height: 60px;
    padding: 10px 16px; border: 1px solid rgba(190, 239, 219, .17);
    border-radius: 13px; background: rgba(255,255,255,.055);
}
.auth-flow-icon {
    width: 34px; height: 34px; flex: none; display: grid; place-items: center;
    border-radius: 9px; color: #94e9bb; background: rgba(150, 236, 190, .12);
    font-size: 11px; font-weight: 800;
}
.auth-flow strong { display: block; font-size: 13px; }
.auth-flow small { display: block; margin-top: 2px; color: #a7cac6; font-size: 11px; }
.auth-flow b { margin-left: auto; color: #a9e6ca; font-size: 18px; font-weight: 400; }
.auth-story-footer { display: flex; align-items: center; gap: 11px; color: #abd2ca; font-size: 11px; }
.auth-story-dot { width: 6px; height: 6px; flex: none; }

.auth-card {
    box-sizing: border-box; display: flex; flex-direction: column;
    justify-content: center; min-width: 0; padding: 52px clamp(34px, 4.5vw, 62px);
    background: #fff;
}
.auth-mobile-brand { display: none; align-items: center; justify-content: center; margin-bottom: 25px; }
.auth-mobile-brand .pho-full-logo { width: 140px; height: 140px; }
.auth-card-eyebrow { color: #087768; }
.auth-card h1 {
    margin: 11px 0 8px; font-size: clamp(27px, 3vw, 33px);
    font-weight: 750; letter-spacing: -.05em; line-height: 1.2;
}
.auth-card > p {
    margin: 0 0 27px; color: #64757a; line-height: 1.6; font-size: 13px;
}
.auth-selected-company {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 12px 14px; margin-bottom: 17px; border: 1px solid #b9ddd2;
    border-radius: 11px; background: #eef9f5; color: #155d50; font-size: 12px;
}
.auth-selected-company #selected-company-name { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; min-width: 0; }
.auth-selected-company #selected-company-name strong { color: #103d38; font-size: 14px; font-weight: 800; line-height: 1.35; }
.auth-company-tax-code { display: inline-block; padding: 4px 8px; border-radius: 6px; background: #d7f1e6; color: #075e50; font-size: 12px; font-weight: 800; letter-spacing: .02em; }
.auth-selected-company button { border: 0; background: none; color: #087b68; cursor: pointer; font: inherit; font-weight: 700; white-space: nowrap; }
#company-picker-error { margin-top: 7px; color: #b34036; font-size: 12px; }
.google-auth-box { display: grid; justify-items: center; min-height: 46px; }
#google-signin-button { width: 100%; display: flex; justify-content: center; }
#google-unavailable {
    width: 100%; min-height: 43px; border: 1px solid #d2dddb;
    border-radius: 10px; background: #fff; color: #55696a; font: inherit;
}
#google-error, #google-company-error, #auth-error, #auth-code-error {
    min-height: 18px; margin: 6px 0 0; color: #b34036; font-size: 12px;
}
#google-error:empty, #google-company-error:empty, #auth-error:empty, #auth-code-error:empty {
    min-height: 0; margin: 0;
}
.auth-divider {
    display: flex; align-items: center; gap: 13px; margin: 19px 0;
    color: #8a9b9e; font-size: 12px; white-space: nowrap;
}
.auth-divider::before, .auth-divider::after {
    content: ""; flex: 1; height: 1px; background: #e5ecea;
}
.auth-tabs {
    display: flex; gap: 4px; padding: 4px; margin-bottom: 19px;
    border-radius: 10px; background: #f2f6f5;
}
.auth-tabs button {
    flex: 1; min-height: 38px; border: 0; border-radius: 7px;
    background: transparent; color: #60747a; cursor: pointer;
    font: inherit; font-size: 13px; font-weight: 700;
}
.auth-tabs button.active { background: #fff; color: #0a6c5c; box-shadow: 0 2px 8px rgba(16,61,59,.09); }
.auth-card form { width: 100%; }
.auth-card label { display: block; margin: 11px 0 7px; color: #30494d; font-size: 12px; font-weight: 700; }
.auth-card input {
    width: 100%; height: 44px; box-sizing: border-box; padding: 10px 13px;
    border: 1px solid #cadbd7; border-radius: 9px; background: #fbfdfc;
    color: #18343a; font: inherit; font-size: 13px; transition: border .15s, box-shadow .15s;
}
.auth-card input::placeholder { color: #a3b4b7; }
.auth-card input:focus { outline: 0; border-color: #168873; box-shadow: 0 0 0 3px rgba(31,153,121,.13); }
.auth-submit {
    width: 100%; min-height: 45px; margin-top: 17px; padding: 11px 15px;
    border: 0; border-radius: 9px; background: #087b68; color: #fff;
    font: inherit; font-size: 13px; font-weight: 750; cursor: pointer;
    box-shadow: 0 7px 17px rgba(8, 123, 104, .15);
    transition: background .15s, transform .15s, box-shadow .15s;
}
.auth-submit:hover { background: #086653; transform: translateY(-1px); box-shadow: 0 9px 20px rgba(8,123,104,.2); }
.auth-submit:disabled { opacity: .55; cursor: wait; transform: none; }
.auth-card .auth-form-note {
    display: block; margin-top: 13px; text-align: center;
    color: #8a9b9e; font-size: 11px; line-height: 1.5;
}
.auth-card .auth-code-message, #google-company-email {
    margin: 0 0 17px; color: #5e7478; font-size: 13px; line-height: 1.6;
}
.auth-code-actions { display: flex; justify-content: space-between; margin-top: 15px; }
.auth-code-actions button {
    border: 0; background: transparent; color: #087b68;
    cursor: pointer; font: inherit; font-size: 12px; font-weight: 700;
}
.auth-code-actions button:hover { text-decoration: underline; }
.auth-card-footer {
    margin-top: 28px; padding-top: 18px; border-top: 1px solid #edf1f0;
    color: #8ca1a3; font-size: 10px; text-align: center;
}
.auth-card-footer span { color: #20a986; font-size: 14px; vertical-align: -1px; }
#logout-button { border: 0; background: none; color: #475569; cursor: pointer; font-size: 12px; }

@media (max-width: 900px) {
    .auth-layout { grid-template-columns: 1fr; max-width: 570px; min-height: 0; }
    .auth-story { min-height: 174px; padding: 24px 32px; }
    .auth-story-brand, .auth-flow, .auth-story-footer { display: none; }
    .auth-story h2 { margin: 10px 0 7px; font-size: 29px; }
    .auth-story-content > p { max-width: 470px; font-size: 12px; line-height: 1.5; }
    .auth-card { padding: 34px 42px 35px; }
    .auth-mobile-brand { display: flex; }
}
@media (max-width: 520px) {
    .auth-screen { align-items: flex-start; padding: 0; background: #fff; }
    .auth-layout { border: 0; border-radius: 0; box-shadow: none; min-height: 100vh; }
    .auth-story { min-height: 150px; padding: 25px 25px 22px; }
    .auth-story h2 { font-size: 26px; }
    .auth-story-content > p { display: none; }
    .auth-card { justify-content: flex-start; padding: 27px 25px 32px; }
    .auth-mobile-brand { margin-bottom: 27px; }
}
