:root {
    --ink: #1a1a1a;
    --muted: #6b6b6b;
    --border: #b9bdbd;
    --red: #d6312b;
    --green: #1e7a1e;
    --bg: #cdd9d9;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    color: var(--ink);
}

body {
    /* Flat dark scrim over the photo (matches Microsoft's full-screen sign-in tint) for contrast/consistency. */
    background-image:
        linear-gradient(rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.4)),
        url("/img/background.jpg");
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-repeat: no-repeat;
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
    /* Full viewport height so the card centers vertically; min-height (not height) lets it grow and scroll
       when content is taller than the screen, so nothing gets clipped. */
    min-height: 100vh;
    padding: 48px 16px;
}

.card {
    position: relative;
    width: 100%;
    max-width: 460px;
    background: #fff;
    padding: 40px 40px 44px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
}

.card-nav {
    position: absolute;
    top: 14px;
    z-index: 1;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--ink);
    text-decoration: none;
    line-height: 1.2;
    padding: 4px 2px;
}

.card-nav:hover,
.card-nav:focus {
    text-decoration: underline;
}

.card-nav-back {
    left: 16px;
}

.card-nav-logout {
    right: 16px;
}

.brand {
    text-align: center;
    margin-bottom: 28px;
}

.logo {
    height: 52px;
    width: auto;
}

.form-title {
    font-size: 1.5rem;
    font-weight: 400;
    margin: 0 0 18px;
}

.form-subtitle {
    margin: -10px 0 18px;
    color: var(--muted);
    font-size: 0.9rem;
}

/* Triage landing: title sits closer to the logo and is centered with its subtitle. */
.hero-title {
    text-align: center;
    margin-top: -14px;
}

.hero-subtitle {
    text-align: center;
}

.field {
    position: relative;
    margin-bottom: 12px;
}

.field input {
    width: 100%;
    padding: 13px 56px 13px 13px;
    font-size: 1rem;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--ink);
}

.field input:focus {
    outline: 2px solid #7aa7d8;
    outline-offset: -1px;
}

.field input[readonly] {
    color: var(--muted);
    background: #fafafa;
}

/* Non-editable identity display: mirrors the read-only input box so password managers have no field to fill. */
.static-field {
    width: 100%;
    padding: 13px 56px 13px 13px;
    font-size: 1rem;
    border: 1px solid var(--border);
    background: #fafafa;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.toggle-visibility {
    position: absolute;
    top: 50%;
    right: 7px;
    transform: translateY(-50%);
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    background-color: var(--red);
    background-repeat: no-repeat;
    background-position: center;
    background-size: 14px 14px;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'><path d='M12 5c-7 0-10 7-10 7s3 7 10 7 10-7 10-7-3-7-10-7zm0 11a4 4 0 110-8 4 4 0 010 8zm0-6a2 2 0 100 4 2 2 0 000-4z'/></svg>");
}

.toggle-visibility.revealed {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'><path d='M2 5.3L3.3 4l16.7 16.7-1.3 1.3-3-3A11.6 11.6 0 0112 19C5 19 2 12 2 12a13.4 13.4 0 013.8-4.9L2 5.3zM12 8a4 4 0 014 4c0 .5-.1 1-.3 1.5l-5.2-5.2c.5-.2 1-.3 1.5-.3zm-5.7.2l2.1 2.1a4 4 0 005.3 5.3l1.4 1.4A11.6 11.6 0 0112 17c-7 0-10-5-10-5a13.7 13.7 0 014.3-3.8z'/></svg>");
}

.caps-warning {
    margin: -7px 0 10px;
    color: var(--red);
    font-size: 0.8rem;
}

.buttons {
    display: flex;
    gap: 10px;
    margin: 6px 0 22px;
}

.btn {
    flex: 1;
    padding: 13px 12px;
    font-size: 1rem;
    text-align: center;
    text-decoration: none;
    border: none;
    cursor: pointer;
    background: #000;
    color: #fff;
    line-height: 1.2;
}

.btn-primary:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.submit-progress {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: -8px 0 18px;
    padding: 12px 13px;
    font-size: 0.9rem;
    color: #1a1a1a;
    background: #f3f3f3;
    border: 1px solid #ddd;
}

.submit-progress[hidden] {
    display: none;
}

.submit-spinner {
    width: 1.1rem;
    height: 1.1rem;
    border: 2px solid #bbb;
    border-top-color: #000;
    border-radius: 50%;
    animation: submit-spin 0.7s linear infinite;
    flex-shrink: 0;
}

@keyframes submit-spin {
    to { transform: rotate(360deg); }
}

form.is-submitting .btn-secondary {
    pointer-events: none;
    opacity: 0.45;
}

.alert {
    padding: 11px 13px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.alert-error {
    background: #fdecea;
    color: #a31a13;
    border: 1px solid #f3c2bf;
}

.alert-error a {
    color: #a31a13;
    display: inline-block;
    margin-top: 6px;
}

.alert-success {
    background: #e7f6e7;
    color: var(--green);
    border: 1px solid #b7e0b7;
}

.rules {
    font-size: 0.95rem;
    line-height: 1.5;
}

.rules-intro {
    margin: 0 0 10px;
}

.rule-list {
    list-style: none;
    margin: 0 0 14px;
    padding: 0;
}

.rule {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 3px 0;
    color: var(--muted);
}

.rule .mark {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    line-height: 1;
    border: 2px solid #c4c4c4;
    color: #fff;
}

.rule.ok .mark {
    background: var(--green);
    border-color: var(--green);
}

.rule.ok .mark::after {
    content: "\2713";
}

.rule.bad .mark {
    background: var(--red);
    border-color: var(--red);
}

.rule.bad .mark::after {
    content: "\2715";
}

.rule.ok .text {
    color: var(--green);
}

.rule.bad .text {
    color: var(--red);
}

.rules-note {
    font-weight: 700;
    margin: 14px 0 0;
}

.success-note {
    color: var(--muted);
    font-size: 0.9rem;
}

/* MFA handoff interstitial: presented as a centered dialog within the card. */
.handoff {
    text-align: center;
}

.handoff .alert-success {
    text-align: left;
}

.handoff .buttons {
    margin-bottom: 0;
}

.handoff .btn-primary {
    flex: 0 1 auto;
    min-width: 160px;
    margin: 0 auto;
}
