:root {
    --brand: #0f7f76;
    --brand-strong: #0b625b;
    --brand-soft: #e3f4f1;
    --ink: #14272b;
    --ink-soft: #4a5f63;
    --muted: #7a8c8f;
    --line: #dbe5e5;
    --surface: #ffffff;
    --page: #f3f7f6;
    --danger: #c2413a;
    --danger-soft: #fdecea;
    --radius: 14px;
    --font: "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    min-height: calc(100vh / var(--ui-zoom));
    min-height: calc(100dvh / var(--ui-zoom));
    background: var(--page);
    color: var(--ink);
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.5;
}

button,
input {
    font: inherit;
    color: inherit;
}

.hidden {
    display: none !important;
}

/* ---------- Layout ---------- */

.login-page {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    min-height: calc(100vh / var(--ui-zoom));
    min-height: calc(100dvh / var(--ui-zoom));
}

/* ---------- Brand panel ---------- */

.brand-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 40px;
    padding: 48px 56px;
    overflow: hidden;
    color: #ffffff;
    background:
        radial-gradient(circle at 85% 10%, rgba(255, 255, 255, 0.18), transparent 38%),
        radial-gradient(circle at 10% 95%, rgba(120, 220, 205, 0.35), transparent 45%),
        linear-gradient(150deg, #13958a 0%, #0f7f76 45%, #0b5f63 100%);
}

/* Soft decorative rings */
.brand-panel::before,
.brand-panel::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.14);
    pointer-events: none;
}

.brand-panel::before {
    width: 520px;
    height: 520px;
    right: -180px;
    top: -160px;
}

.brand-panel::after {
    width: 360px;
    height: 360px;
    right: -90px;
    top: -60px;
}

.brand-top {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.18);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3);
    font-size: 1.25rem;
    font-weight: 700;
}

.brand-name {
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.brand-copy {
    position: relative;
    max-width: 520px;
}

.eyebrow {
    margin: 0 0 14px;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    opacity: 0.85;
}

.brand-copy h1 {
    margin: 0;
    font-size: clamp(2.2rem, 3.6vw, 3.2rem);
    font-weight: 600;
    line-height: 1.12;
    letter-spacing: -0.02em;
}

.brand-copy h1 span {
    display: block;
}

.brand-lead {
    margin: 18px 0 0;
    max-width: 460px;
    font-size: 1.08rem;
    line-height: 1.6;
    opacity: 0.92;
}

.feature-list {
    display: grid;
    gap: 16px;
    margin: 36px 0 0;
    padding: 0;
    list-style: none;
}

.feature-list li {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.feature-icon {
    flex: none;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 11px;
    background: rgba(255, 255, 255, 0.16);
}

.feature-icon svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: #ffffff;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.feature-list strong {
    display: block;
    font-weight: 600;
}

.feature-list small {
    display: block;
    margin-top: 2px;
    font-size: 0.93rem;
    opacity: 0.82;
}

.brand-foot {
    position: relative;
    font-size: 0.82rem;
    letter-spacing: 0.04em;
    opacity: 0.7;
}

/* ---------- Form panel ---------- */

.form-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 32px;
}

.locale-switch {
    position: absolute;
    top: 28px;
    right: 32px;
    display: flex;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
}

.locale {
    min-width: 46px;
    padding: 6px 12px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--ink-soft);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
}

.locale.active {
    background: var(--brand);
    color: #ffffff;
}

.auth-card {
    width: min(100%, 420px);
}

.auth-header h2 {
    margin: 0;
    font-size: 2rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.auth-header p {
    margin: 8px 0 0;
    color: var(--ink-soft);
}

.auth-form {
    display: grid;
    gap: 20px;
    margin-top: 32px;
}

.field {
    display: grid;
    gap: 8px;
}

.field-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--ink);
}

.field-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.field-link {
    padding: 0;
    border: 0;
    background: none;
    color: var(--brand);
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
}

.field-link:hover {
    text-decoration: underline;
}

.field-input {
    width: 100%;
    height: 52px;
    padding: 0 16px;
    border: 1.5px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field-input::placeholder {
    color: #a3b2b4;
}

.field-input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 4px rgba(15, 127, 118, 0.14);
}

.password-wrap {
    position: relative;
    display: block;
}

.password-wrap .field-input {
    padding-right: 52px;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 6px;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--muted);
    transform: translateY(-50%);
    cursor: pointer;
}

.password-toggle:hover,
.password-toggle[aria-pressed="true"] {
    background: var(--brand-soft);
    color: var(--brand);
}

.password-toggle svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.remember-row {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--ink-soft);
    cursor: pointer;
    user-select: none;
}

.remember-row input {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--brand);
}

.auth-error,
.auth-message {
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 0.95rem;
}

.auth-error {
    background: var(--danger-soft);
    color: var(--danger);
}

.auth-message {
    background: var(--brand-soft);
    color: var(--brand-strong);
}

.primary-button {
    height: 52px;
    border: 0;
    border-radius: 12px;
    background: linear-gradient(135deg, #13958a, #0f7f76);
    color: #ffffff;
    font-size: 1.02rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    box-shadow: 0 10px 24px rgba(15, 127, 118, 0.25);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.primary-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 28px rgba(15, 127, 118, 0.3);
}

.primary-button:disabled {
    opacity: 0.7;
    transform: none;
    cursor: default;
}

.form-foot {
    display: none;
    margin-top: 32px;
    color: var(--muted);
    font-size: 0.8rem;
    letter-spacing: 0.04em;
    text-align: center;
}

/* ---------- Tablet ---------- */

@media (max-width: 1100px) {
    .brand-panel {
        padding: 40px;
    }
}

/* ---------- Phone: brand becomes a compact header ---------- */

@media (max-width: 860px) {
    .login-page {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto 1fr;
    }

    .brand-panel {
        gap: 20px;
        padding: 24px 20px 56px;
        padding-top: max(24px, env(safe-area-inset-top));
    }

    .brand-panel::before {
        width: 300px;
        height: 300px;
        right: -120px;
        top: -140px;
    }

    .brand-panel::after {
        display: none;
    }

    /* Leave room for the language switch in the top-right corner. */
    .brand-top {
        padding-right: 112px;
    }

    .brand-copy h1 {
        font-size: 1.85rem;
    }

    .brand-lead {
        margin-top: 10px;
        font-size: 1rem;
    }

    .eyebrow {
        margin-bottom: 8px;
        font-size: 0.78rem;
    }

    .feature-list,
    .brand-foot {
        display: none;
    }

    /* The card overlaps the coloured header a little. */
    .form-panel {
        justify-content: flex-start;
        margin-top: -32px;
        padding: 0 16px 24px;
        padding-bottom: max(24px, env(safe-area-inset-bottom));
    }

    .auth-card {
        position: relative;
        z-index: 1;
        padding: 28px 22px;
        border-radius: 20px;
        background: var(--surface);
        box-shadow: 0 18px 40px rgba(20, 39, 43, 0.12);
    }

    .auth-header h2 {
        font-size: 1.6rem;
    }

    .auth-form {
        margin-top: 24px;
    }

    .locale-switch {
        top: max(20px, env(safe-area-inset-top));
        right: 16px;
        z-index: 2;
        border-color: rgba(255, 255, 255, 0.35);
        background: rgba(255, 255, 255, 0.15);
    }

    /* Anchor the switch to the page top (over the coloured header). */
    .login-page {
        position: relative;
    }

    .form-panel {
        position: static;
    }

    .locale {
        color: #ffffff;
    }

    .locale.active {
        background: #ffffff;
        color: var(--brand);
    }

    .form-foot {
        display: block;
    }
}

@media (max-width: 360px) {
    .brand-name {
        font-size: 1rem;
        line-height: 1.25;
    }

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

    .brand-copy h1 {
        font-size: 1.6rem;
    }

    .auth-card {
        padding: 24px 18px;
    }
}


/* ---------- Desktop scale ----------
   The interface is drawn at 80% on desktop screens (like browser zoom 80%), phones and tablets stay at 100%.
   Sizes based on the window height are divided by the zoom so full-height parts still fill the screen. */
:root {
    --ui-zoom: 1;
}

@media (min-width: 1024px) {
    :root {
        --ui-zoom: 0.8;
    }

    html {
        zoom: var(--ui-zoom);
    }
}
