:root {
    --bg: #ffffff;
    --mist: #eaf1f7;
    --mist-strong: #d8e3ee;
    --card-bg: #ffffff;
    --card-border: #e2e8ee;
    --card-shadow: 0 1px 2px rgba(15, 27, 44, 0.04), 0 4px 16px rgba(15, 27, 44, 0.04);
    --text: #0f1b2c;
    --text-muted: #5c6b7b;
    --text-eyebrow: #8a95a3;
    --primary: #1f4e84;
    --primary-hover: #194172;
    --primary-active: #143560;
    --accent: #1f4e84;
    --focus-ring: rgba(31, 78, 132, 0.22);
    --border: #d6dde4;
    --border-strong: #aab4be;
    --input-bg: #ffffff;
    --success: #22c55e;
    --radius: 10px;
    --radius-sm: 8px;
}

*, *::before, *::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    min-height: 100%;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex: 1 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
}

.pre-line {
    white-space: pre-line;
}

/* ---------------------------------------------------------------------------
   Centered single-panel shell — used by Reset / Change / Migration / Error.
   --------------------------------------------------------------------------- */

.auth-shell {
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
}

main form {
    width: 100%;
}

.brand {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
}

.brand-logo {
    height: 36px;
    width: auto;
    display: block;
}

/* ---------------------------------------------------------------------------
   Split shell (the corporate-split login). Two panes side-by-side.
   --------------------------------------------------------------------------- */

.split-shell {
    flex: 1 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    min-height: 100vh;
    width: 100%;
}

/* Left: white brand pane — three horizontal wordmarks, centered. */
.brand-pane {
    background: var(--bg);
    color: var(--text);
    padding: 48px 56px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.connected-products-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 32px;
}

/* Each product is a fixed-size bounding box; the wordmark inside scales to
   fit. Wordmarks with different aspect ratios all end up in the same row size,
   even if the visual mark itself differs in width. */
.connected-product {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 56px;
    min-width: 220px;
}

.connected-product img {
    display: block;
    width: auto;
    height: auto;
    max-height: 48px;
    max-width: 240px;
    object-fit: contain;
}

/* Per-logo overrides — edit one without touching the others. The row-level
   selector (e.g. .connected-product--wateroutlook) lets you tweak min-height,
   padding, alignment, etc. The img selector underneath lets you resize the
   wordmark itself (max-height, max-width, transform, opacity, etc.). */

.connected-product--wateroutlook {
    /* row tweaks for WaterOutlook (e.g. min-height: 64px;) */
}

.connected-product--wateroutlook img {
    /* logo tweaks for WaterOutlook (e.g. max-height: 56px; max-width: 260px;) */
}

.connected-product--schedulehub {
    
}

.connected-product--schedulehub img {
    width: 100%;
    max-width: 250px;
}

.connected-product--labonline {
    /* row tweaks for LabOnline */
}

.connected-product--labonline img {
    width: 100%;
    max-width: 150px;
    max-height: unset;
}

li.connected-product:hover a {
    opacity: 0.85;
}

/* Right: mist form pane — form fills the top, meta footer at the bottom. */
.form-pane {
    background: var(--mist);
    padding: 32px 56px 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.form-pane-body {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.form-pane-body > * {
    width: 100%;
    max-width: 380px;
}

.form-pane-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    font-size: 0.78rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.form-pane-footer-meta {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.form-pane-footer-meta .footer-divider {
    color: var(--border-strong);
    user-select: none;
}

/* When the form lives inside the split, drop the card chrome — the panes
   themselves provide all the structure. */
.split-shell .form-signin {
    background: transparent;
    border: 0;
    box-shadow: none;
    padding: 0;
}

/* ---------------------------------------------------------------------------
   Sign-in heading + form body (works in both split and centered layouts).
   --------------------------------------------------------------------------- */

.sign-in-heading {
    margin-bottom: 28px;
}

.sign-in-heading h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 8px;
    line-height: 1.25;
    letter-spacing: -0.01em;
}

.sign-in-heading .sign-in-sub {
    font-size: 0.95rem;
    font-weight: 400;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.5;
}

/* Body paragraphs inside the auth card (e.g. Migration). */
.migration-copy {
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.55;
    margin: 0 0 16px;
}

.migration-copy:last-of-type {
    margin-bottom: 24px;
}

/* Card (used by centered pages — Reset / Change / Migration / Error). */
.form-signin {
    width: 100%;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    padding: 32px 28px;
    margin: 0;
}

.form-signin h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 8px;
    line-height: 1.25;
    letter-spacing: -0.01em;
}

.form-signin .h5 {
    font-size: 0.95rem;
    font-weight: 400;
    color: var(--text-muted);
    margin: 0 0 24px;
    line-height: 1.5;
}

.form-signin .form-group {
    margin-bottom: 14px;
}

.form-signin label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 6px;
}

/* Label row supports a right-aligned helper link (e.g. "Forgot?"). */
.form-label-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
}

.form-label-row label {
    margin-bottom: 0;
}

.form-label-row .form-label-link {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--primary);
    text-decoration: none;
}

.form-label-row .form-label-link:hover {
    text-decoration: underline;
}

/* Inputs */
.form-control,
.form-signin .form-control {
    position: relative;
    width: 100%;
    height: auto;
    padding: 11px 14px;
    font-size: 1rem;
    line-height: 1.4;
    background: var(--input-bg);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:hover,
.form-signin .form-control:hover {
    border-color: var(--border-strong);
}

.form-control:focus,
.form-signin .form-control:focus {
    z-index: 2;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--focus-ring);
    outline: none;
}

.form-control::placeholder,
.form-signin .form-control::placeholder {
    color: #9aa4af;
}

.form-control:disabled,
.form-signin .form-control:disabled {
    background: #f4f6f8;
    color: var(--text-muted);
    cursor: not-allowed;
}

.form-control[readonly],
.form-control:read-only {
    background-color: #e9ecef;
    color: var(--text-muted);
}

/* Paired/stacked inputs: keep each field with its own rounded borders. */
.inputTop {
    margin-bottom: 10px;
}

.inputBottom {
    margin-bottom: 16px;
}

.inputSingle {
    margin-bottom: 16px;
}

/* Buttons */
.btn {
    border-radius: var(--radius-sm);
    font-weight: 500;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.05s ease;
}

.btn-lg {
    padding: 12px 16px;
    font-size: 1rem;
}

.btn-primary {
    color: #ffffff;
    background-color: var(--primary);
    border: 1px solid var(--primary);
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
    color: #ffffff;
}

.btn-primary:active {
    background-color: var(--primary-active) !important;
    border-color: var(--primary-active) !important;
    transform: translateY(1px);
}

.btn-primary:disabled,
.btn-primary.disabled {
    background-color: var(--primary);
    border-color: var(--primary);
    opacity: 0.55;
    cursor: not-allowed;
}

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
    box-shadow: 0 0 0 3px var(--focus-ring);
}

/* Links */
a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* Alerts */
.alert {
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 0.9rem;
    border: 1px solid transparent;
    margin-bottom: 16px;
    line-height: 1.4;
}

.alert-primary,
.alert-info {
    background-color: rgba(31, 78, 132, 0.08);
    border-color: rgba(31, 78, 132, 0.22);
    color: var(--text);
}

.alert-warning {
    background-color: #fff7e6;
    border-color: #f5d680;
    color: #6b4a05;
}

.alert-danger {
    background-color: #fdecec;
    border-color: #f3b4b4;
    color: #8a1f1f;
}

/* Centered-pages footer (the split has its own internal footer). */
.footer {
    flex-shrink: 0;
    padding: 16px;
    font-size: 0.78rem;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.5;
    border-top: 1px solid var(--card-border);
    background: transparent;
}

.footer .container {
    padding: 0;
    max-width: none;
}

/* ---------------------------------------------------------------------------
   Mobile (≤ 768px): stack vertically. Brand pane sits at the top with the
   three logos stacked, then the form pane below as a white card on mist.
   --------------------------------------------------------------------------- */

@media (max-width: 768px) {
    .split-shell {
        grid-template-columns: 1fr;
        background: var(--mist);
    }

    .brand-pane {
        padding: 28px 20px 20px;
        background: transparent;
    }

    .connected-products-list {
        gap: 18px;
    }

    .connected-product {
        min-height: 0;
        min-width: 0;
    }

    /* Per-logo overrides — mobile version. Mirrors the desktop hooks above so
       you can tune sizing for small screens without touching desktop values. */

    .connected-product--wateroutlook {
        /* row tweaks for WaterOutlook (mobile) */
    }

    .connected-product--wateroutlook img {
        /* logo tweaks for WaterOutlook (mobile) */
        max-width: 190px;
    }

    .connected-product--schedulehub {
        /* row tweaks for ScheduleHub (mobile) */
    }

    .connected-product--schedulehub img {
        /* logo tweaks for ScheduleHub (mobile) */
        max-width: 200px;
    }

    .connected-product--labonline {
        /* row tweaks for LabOnline (mobile) */
    }

    .connected-product--labonline img {
        /* logo tweaks for LabOnline (mobile) */
        max-width: 106px
    }

    .form-pane {
        padding: 20px;
        gap: 16px;
        margin: 0 16px 16px;
        background: var(--bg);
        border-radius: var(--radius);
        border: 1px solid var(--card-border);
        box-shadow: var(--card-shadow);
        min-height: 0;
    }

    .form-pane-body {
        align-items: stretch;
    }

    .form-pane-body > * {
        max-width: none;
    }

    .form-pane-footer {
        font-size: 0.72rem;
        gap: 8px;
    }

    .form-pane-footer-meta {
        gap: 8px;
    }

    .sign-in-heading {
        margin-bottom: 20px;
    }
}
