:root {
    --background: #f4f7fa;
    --surface: #ffffff;
    --text: #172033;
    --muted: #687387;
    --primary: #173f67;
    --primary-hover: #102f4f;
    --border: #e1e7ee;
    --shadow: 0 24px 70px rgba(23, 32, 51, 0.12);
}

* {
    box-sizing: border-box;
}

html {
    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}

body {
    margin: 0;
    color: var(--text);
    background: var(--background);
}

.login-page {
    min-height: 100vh;
    background:
        radial-gradient(
            circle at 10% 10%,
            rgba(23, 63, 103, 0.14),
            transparent 32rem
        ),
        radial-gradient(
            circle at 90% 90%,
            rgba(71, 137, 113, 0.12),
            transparent 30rem
        ),
        var(--background);
}

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-card {
    width: 100%;
    max-width: 460px;
    padding: 44px;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid var(--border);
    border-radius: 24px;
    box-shadow: var(--shadow);
}

.brand-mark {
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    margin-bottom: 28px;
    color: #ffffff;
    background: var(--primary);
    border-radius: 16px;
    font-size: 22px;
    font-weight: 800;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--primary);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

h1 {
    margin: 0;
    font-size: clamp(30px, 6vw, 40px);
    line-height: 1.1;
    letter-spacing: -0.04em;
}

.login-description {
    margin: 18px 0 0;
    color: var(--muted);
    font-size: 16px;
    line-height: 1.65;
}

.microsoft-button {
    min-height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 13px;
    margin-top: 34px;
    padding: 12px 20px;
    color: #ffffff;
    background: var(--primary);
    border-radius: 12px;
    font-size: 15px;
    font-weight: 750;
    text-decoration: none;
    transition:
        background 160ms ease,
        transform 160ms ease,
        box-shadow 160ms ease;
}

.microsoft-button:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(23, 63, 103, 0.2);
}

.microsoft-icon {
    display: grid;
    grid-template-columns: repeat(2, 8px);
    gap: 2px;
}

.microsoft-icon span {
    width: 8px;
    height: 8px;
    background: currentColor;
}

.access-notice {
    margin: 24px 0 0;
    padding-top: 22px;
    color: var(--muted);
    border-top: 1px solid var(--border);
    font-size: 13px;
    line-height: 1.5;
    text-align: center;
}

@media (max-width: 520px) {
    .login-card {
        padding: 32px 24px;
        border-radius: 20px;
    }
}

.alert {
    margin-top: 24px;
    padding: 14px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
}

.alert-error {
    color: #8f2525;
    background: #fff2f2;
    border: 1px solid #f0cccc;
}

.portal-page {
    min-height: 100vh;
    background: #f5f7fa;
}

.portal-header {
    min-height: 76px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 14px clamp(20px, 4vw, 56px);
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(18px);
}

.portal-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text);
    text-decoration: none;
}

.portal-brand-mark {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    color: #ffffff;
    background: var(--primary);
    border-radius: 12px;
    font-weight: 800;
}

.portal-brand > span:last-child {
    display: grid;
}

.portal-brand strong {
    font-size: 15px;
}

.portal-brand small {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    color: var(--primary);
    background: #e8eef5;
    border-radius: 50%;
    font-size: 13px;
    font-weight: 800;
}

.user-copy {
    display: grid;
}

.user-copy strong {
    font-size: 13px;
}

.user-copy span {
    color: var(--muted);
    font-size: 12px;
}

.logout-button {
    min-height: 38px;
    padding: 8px 14px;
    color: var(--text);
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 10px;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.logout-button:hover {
    border-color: #aeb8c5;
    background: #f8fafc;
}

.portal-main {
    width: min(1180px, calc(100% - 40px));
    margin: 0 auto;
    padding: 64px 0 80px;
}

.welcome-section {
    max-width: 720px;
}

.welcome-section h1 {
    font-size: clamp(36px, 6vw, 58px);
}

.welcome-section > p:last-child {
    margin: 18px 0 0;
    color: var(--muted);
    font-size: 18px;
}

.overview-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin-top: 42px;
}

.overview-card,
.application-card,
.empty-state {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
}

.overview-card {
    min-height: 220px;
    display: flex;
    flex-direction: column;
    padding: 24px;
}

.overview-label {
    margin-bottom: 26px;
    color: var(--primary);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.overview-card strong {
    font-size: 19px;
}

.overview-card p {
    margin: 12px 0 24px;
    color: var(--muted);
    line-height: 1.55;
}

.card-status {
    width: fit-content;
    margin-top: auto;
    padding: 6px 10px;
    color: #315f52;
    background: #edf6f2;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 750;
}

.section-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    margin-top: 58px;
    margin-bottom: 20px;
}

.section-heading h2 {
    margin: 6px 0 0;
    font-size: 28px;
    letter-spacing: -0.03em;
}

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

.application-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 15px;
    min-height: 100px;
    padding: 18px;
    color: var(--text);
    text-decoration: none;
    transition:
        transform 160ms ease,
        border-color 160ms ease,
        box-shadow 160ms ease;
}

.application-card:hover {
    transform: translateY(-2px);
    border-color: #bac5d2;
    box-shadow: 0 16px 35px rgba(23, 32, 51, 0.08);
}

.application-icon {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    color: #ffffff;
    background: var(--primary);
    border-radius: 14px;
    font-weight: 800;
}

.application-card strong {
    font-size: 15px;
}

.application-card p {
    margin: 6px 30px 0 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
}

.application-arrow {
    position: absolute;
    top: 18px;
    right: 18px;
    color: #8993a2;
}

.empty-state {
    padding: 34px;
    text-align: center;
}

.empty-state p {
    margin: 8px 0 0;
    color: var(--muted);
}

@media (max-width: 900px) {
    .overview-grid,
    .application-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 680px) {
    .portal-header {
        align-items: flex-start;
    }

    .user-copy {
        display: none;
    }

    .portal-main {
        width: min(100% - 28px, 1180px);
        padding-top: 42px;
    }

    .overview-grid,
    .application-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 440px) {
    .logout-button {
        padding-inline: 10px;
    }

    .portal-brand > span:last-child {
        display: none;
    }
}

.alert-success {
    color: #26614e;
    background: #edf8f3;
    border: 1px solid #cce8dc;
}

.signature-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.signature-page {
    width: min(1460px, calc(100% - 40px));
}

.signature-page-heading {
    max-width: 760px;
}

.signature-page-heading h1 {
    margin: 0;
}

.signature-page-heading > div > p:last-child {
    margin: 18px 0 0;
    color: var(--muted);
    font-size: 17px;
    line-height: 1.6;
}

.signature-layout {
    display: grid;
    grid-template-columns:
        minmax(360px, 0.8fr)
        minmax(520px, 1.2fr);
    gap: 24px;
    margin-top: 36px;
    align-items: start;
}

.signature-form-card,
.signature-preview-card {
    padding: 28px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
}

.signature-preview-card {
    position: sticky;
    top: 24px;
}

.card-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 26px;
}

.card-heading h2 {
    margin: 6px 0 0;
    font-size: 24px;
}

.microsoft-badge {
    padding: 7px 10px;
    color: #375d7c;
    background: #edf4fa;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 750;
    white-space: nowrap;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

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

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

.form-field > span {
    color: var(--text);
    font-size: 13px;
    font-weight: 750;
}

.form-field input {
    width: 100%;
    min-height: 48px;
    padding: 11px 13px;
    color: var(--text);
    background: #ffffff;
    border: 1px solid #ccd5df;
    border-radius: 10px;
    font: inherit;
    font-size: 15px;
}

.form-field input:focus {
    outline: 3px solid rgba(23, 63, 103, 0.12);
    border-color: var(--primary);
}

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

.primary-button,
.secondary-button {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    border-radius: 10px;
    font: inherit;
    font-size: 14px;
    font-weight: 750;
    text-decoration: none;
    cursor: pointer;
}

.primary-button {
    color: #ffffff;
    background: var(--primary);
    border: 1px solid var(--primary);
}

.secondary-button {
    color: var(--text);
    background: #ffffff;
    border: 1px solid var(--border);
}

.primary-button:hover {
    background: var(--primary-hover);
}

.secondary-button:hover {
    background: #f7f9fb;
    border-color: #b9c4d0;
}

.banner-admin-section {
    display: grid;
    gap: 18px;
    margin-top: 30px;
    padding-top: 26px;
    border-top: 1px solid var(--border);
}

.banner-admin-section h3 {
    margin: 6px 0 0;
}

.banner-admin-section p:last-child {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.5;
}

.banner-admin-section form {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.copy-status {
    color: #2e6a56;
    font-size: 13px;
    font-weight: 700;
}

.signature-preview {
    padding: 30px;
    overflow-x: auto;
    background: #ffffff;
    border: 1px solid #e1e6ec;
    border-radius: 16px;
    font-family: Arial, Helvetica, sans-serif;
}

.signature-preview-name {
    color: #172033;
    font-size: 30px;
    font-weight: 700;
    line-height: 1.2;
}

.signature-preview-title {
    margin-top: 6px;
    color: #252a34;
    font-size: 18px;
    line-height: 1.5;
}

.signature-contact-row {
    display: flex;
    flex-wrap: wrap;
    gap: 14px 28px;
    margin-top: 28px;
    color: #30343b;
    font-size: 15px;
}

.signature-contact-row strong {
    color: #727b8d;
    font-weight: 400;
}

.signature-disclaimer {
    margin: 28px 0 0;
    color: #70798a;
    font-size: 13px;
    line-height: 1.55;
}

.signature-banner {
    display: block;
    width: 100%;
    height: auto;
    margin-top: 30px;
    border-radius: 24px;
}

.signature-banner-placeholder {
    display: grid;
    place-items: center;
    min-height: 150px;
    margin-top: 30px;
    color: #708078;
    background: #dcebd8;
    border: 1px dashed #a8c2a4;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 700;
}

@media (max-width: 1050px) {
    .signature-layout {
        grid-template-columns: 1fr;
    }

    .signature-preview-card {
        position: static;
    }
}

@media (max-width: 600px) {
    .signature-page {
        width: min(100% - 28px, 1460px);
    }

    .signature-form-card,
    .signature-preview-card {
        padding: 20px;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-field-full {
        grid-column: auto;
    }

    .signature-preview {
        padding: 20px;
    }
}

.overview-card-link {
    color: inherit;
    text-decoration: none;
    transition:
        transform 160ms ease,
        border-color 160ms ease,
        box-shadow 160ms ease;
}

.overview-card-link:hover {
    transform: translateY(-2px);
    border-color: #bac5d2;
    box-shadow: 0 16px 35px rgba(23, 32, 51, 0.08);
}