*, :after, :before {
    box-sizing: border-box;
    font-family: 'Open Sans', Arial, sans-serif;
}

html, body {
    margin: 0;
    height: 100%;
    width: 100%;
    padding: 0;
}

*, :after, :before {
    box-sizing: border-box;
    font-family: 'Open Sans', Arial, sans-serif;
}

html, body {
    margin: 0;
    height: 100%;
    width: 100%;
    padding: 0;
}

.is-hidden {
    display: none !important;
}

/* Login page */

.login-body,
.login-body * {
    font-family: 'Roboto', Arial, sans-serif;
}

.login-body {
    min-height: 100vh;
    background: #e5f2f6;
    color: #172536;
    overflow: hidden;
}

.login-wrapper {
    min-height: 100vh;
    width: 100vw;
    padding: 2rem;
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    width: 100%;
    max-width: 420px;
    padding: 2rem 1.9rem 2.1rem;
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
}

.login-title {
    margin: 0 0 1.7rem;
    color: #172536;
    font-size: 1.35rem;
    line-height: 1.25;
    font-weight: 700;
    text-align: left;
    letter-spacing: -0.02rem;
}

.login-field {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    margin-bottom: 1.35rem;
}

.login-field label {
    color: #253246;
    font-size: 0.75rem;
    line-height: 1;
    font-weight: 500;
}

.login-field input,
.login-field select {
    width: 100%;
    height: 44px;
    padding: 0 0.9rem;
    border: 1px solid #d9dde4;
    border-radius: 9px;
    background-color: #ffffff;
    color: #172536;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.login-field input::placeholder {
    color: #a9b0ba;
}

.login-field select {
    cursor: pointer;
}

.login-field input:focus,
.login-field select:focus {
    border-color: #7ecfd0;
    box-shadow: 0 0 0 3px rgba(126, 207, 208, 0.18);
}

.login-error {
    margin: -0.45rem 0 1rem;
    color: #c0392b;
    font-size: 0.78rem;
    line-height: 1.35;
}

.login-submit-btn {
    width: 100%;
    height: 44px;
    margin-top: 0.15rem;
    border: none;
    border-radius: 8px;
    background: #7ecfd0;
    color: #ffffff;
    font-size: 0.86rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.15s ease;
}

.login-submit-btn:hover {
    background: #67c5c7;
}

.login-submit-btn:active {
    transform: translateY(1px);
}

.app-page {
    position: relative;
    z-index: 2;
}

.form-background {
    background-color: #e5f2f6;
    height: 100vh;
    width: 100vw;
    position: fixed;
    top: 0;
    left: 0;
    overflow: hidden;
}

.form-background {
    background-color: #e5f2f6;
    height: 100vh;
    width: 100vw;
    position: fixed;
    top: 0;
    left: 0;
    overflow: hidden;
}

.form-background .left-wave, .form-background .middle-wave, .form-background .right-wave {
    width: max(79.166vw, 1139.9904px);
    position: absolute;
    height: auto;
    top: 50%;
    left: 50%;
}

.form-background .left-wave {
    transform: translate(-86.05%) translateY(-33.3%);
}

.form-background .middle-wave {
    transform: translate(-52.36%) translateY(-39.53%);
}

.form-background .right-wave {
    transform: translate(-30.96%) translateY(-60.5%);
}

.main-row {
    min-height: 100vh;
    min-width: 100vw;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    overflow: auto;
    padding: 2rem 0;
    flex-wrap: wrap;
}

.container {
    padding: 5rem 3.75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    gap: 3.4rem;
    color: #034563;
    width: 100%;
    max-width: 90rem;
}

.card-container {
    display: flex;
    flex-direction: row;
    gap: 1.4rem;
    flex-wrap: wrap;
    width: 100%;
}

.card {
    border-radius: 20px;
    border: 1px solid #E5ECEF;
    background: #fff;
    padding: 2.5rem 1.75rem 3.2rem;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    flex: 1;
}

.page-title {
    font-size: 3rem;
    font-weight: 700;
    line-height: 4.5rem;
    letter-spacing: -.9px;
    text-align: center;
    z-index: 2;
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1.2rem;
    margin-top: 0;
}

h1, h2 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 1.2rem;
    line-height: 2.9375rem;
    letter-spacing: -0.0375rem;
    text-align: center;
    color: #034563;
}

.button-row {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    width: 100%;
    gap: 0.5rem;
    margin-bottom: 1.2rem;
}

#syncBtn, .queryBtn {
    padding: 1rem 2rem;
    font-size: .875rem;
    font-weight: 700;
    line-height: 1rem;
    letter-spacing: .14px;
    text-transform: uppercase;
    border-radius: 30px;
    background: #00b2b2;
    color: #fff;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
    margin-bottom: 1.2rem;
}

#syncBtn:hover, .queryBtn:hover {
    background: #7fd8d8;
}

#syncBtn:disabled, .queryBtn:disabled {
    cursor: default;
    background-color: #e5ecef;
    color: #81a2b1;
    box-shadow: 0 4px 8px #0000000d;
}

#status {
    font-size: 1rem;
    color: #388e3c;
}

.query-section label {
    font-weight: 500;
    color: #333;
    margin-bottom: 0.5em;
    display: block;
}

.queryResult, #status {
    border-radius: 20px;
    border: 1px solid #E5ECEF;
    background: #f6f7f9;
    padding: 1rem;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    flex: 1;
    overflow-y: auto;
    max-height: 12rem;
}

.associations-filters {
    display: flex;
    justify-content: flex-start;
    align-items: center;
}

.associations-filters .filters-row {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 8px;
}

.associations-filters .filters-control {
    min-width: 280px;
    padding: 10px 12px;
}

.floating-action-btn {
    padding: 0.9rem 1.1rem;
    border: none;
    border-radius: 999px;
    background: #00b2b2;
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(3, 69, 99, 0.22);
}

.floating-action-btn:hover {
    background: #056085;
}

.popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(3, 69, 99, 0.35);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 30;
    padding: 1rem;
}

.popup-overlay.is-open {
    display: flex;
}

.popup-modal {
    width: min(760px, 100%);
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e5ecef;
}

.popup-header h2 {
    margin: 0;
    text-align: left;
    line-height: 1.4;
}

.popup-close-btn {
    border: none;
    background: transparent;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    color: #034563;
}

.popup-body {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.popup-label {
    font-weight: 700;
    color: #034563;
}

.popup-search {
    width: 100%;
    padding: 0.8rem 0.9rem;
    border-radius: 12px;
    border: 1px solid #cfd9df;
}

.popup-results-list {
    max-height: 260px;
    overflow-y: auto;
    border: 1px solid #e5ecef;
    border-radius: 12px;
    background: #f6f7f9;
    padding: 0.5rem;
}

.popup-user-item {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.8rem 0.9rem;
    border: none;
    background: transparent;
    text-align: left;
    cursor: pointer;
    border-radius: 10px;
    color: #24485d;
}

.popup-user-item:hover,
.popup-user-item.is-selected {
    background: #e5f2f6;
}

.popup-user-name {
    font-weight: 700;
}

.popup-user-email {
    font-size: 0.92rem;
    opacity: 0.85;
}

.popup-empty-state {
    padding: 0.75rem 0.9rem;
    color: #6e8593;
}

.popup-associations {
    margin: 0;
    min-height: 240px;
    max-height: 360px;
    overflow: auto;
    padding: 1rem;
    border-radius: 12px;
    background: #f6f7f9;
    border: 1px solid #e5ecef;
    color: #24485d;
    white-space: pre-wrap;
    word-break: break-word;
}

.validate-sync-modal {
    width: min(1120px, calc(100vw - 2rem));
    max-height: calc(100vh - 2rem);
    display: flex;
    flex-direction: column;
}

.validate-sync-modal .popup-header {
    padding: 1.15rem 1.35rem;
    background: #ffffff;
}

.validate-sync-modal .popup-header h2 {
    font-size: 1.25rem;
    color: #034563;
}

.validate-sync-modal .popup-body {
    padding: 1.1rem 1.35rem 1.35rem;
    overflow-y: auto;
    gap: 1rem;
    flex: 1;
}

.sync-status-card {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.9rem 1rem;
    border-radius: 14px;
    border: 1px solid #dbe6eb;
    background: linear-gradient(180deg, #ffffff 0%, #f7fbfc 100%);
    color: #24485d;
    font-size: 0.92rem;
    font-weight: 700;
}

.sync-status-card::before {
    content: "";
    width: 0.65rem;
    height: 0.65rem;
    border-radius: 999px;
    background: #8aa3ad;
    flex: 0 0 auto;
}

.sync-status-card.is-success {
    border-color: #b8e2c2;
    background: #effaf2;
    color: #237a3b;
}

.sync-status-card.is-success::before {
    background: #27ae60;
}

.sync-status-card.is-error {
    border-color: #f0c1bd;
    background: #fff4f3;
    color: #a33a32;
}

.sync-status-card.is-error::before {
    background: #d6453d;
}

.sync-validation-result {
    min-height: 0;
    max-height: none;
    overflow: visible;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.sync-summary-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.7rem;
}

.sync-summary-item {
    padding: 0.85rem 0.85rem;
    border-radius: 16px;
    border: 1px solid #e3edf1;
    background: #ffffff;
    box-shadow: 0 8px 20px rgba(3, 69, 99, 0.06);
}

.sync-summary-label {
    display: block;
    color: #78909c;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.035rem;
    text-transform: uppercase;
    margin-bottom: 0.4rem;
}

.sync-summary-value {
    display: block;
    color: #034563;
    font-size: 1.45rem;
    line-height: 1;
    font-weight: 900;
}

.sync-section {
    border: 1px solid #e2ebef;
    border-radius: 18px;
    background: #ffffff;
    overflow: hidden;
    box-shadow: 0 8px 20px rgba(3, 69, 99, 0.045);
}

.sync-section-header {
    padding: 0.85rem 1rem;
    background: #f8fbfc;
    border-bottom: 1px solid #e5ecef;
    color: #034563;
    font-size: 0.98rem;
    font-weight: 900;
}

.sync-section-body {
    padding: 0.95rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 260px;
    overflow-y: auto;
}

.sync-user-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.sync-user-chip {
    display: inline-flex;
    align-items: center;
    min-height: 1.8rem;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    background: #eaf5f8;
    color: #034563;
    border: 1px solid #d8e9ef;
    font-size: 0.78rem;
    font-weight: 800;
    white-space: nowrap;
}

.sync-diff-item {
    padding: 0.9rem;
    border-radius: 14px;
    background: #f9fcfd;
    border: 1px solid #e5ecef;
}

.sync-diff-user {
    display: inline-flex;
    align-items: center;
    margin-bottom: 0.7rem;
    padding: 0.35rem 0.65rem;
    border-radius: 999px;
    background: #034563;
    color: #ffffff;
    font-size: 0.78rem;
    font-weight: 800;
}

.sync-diff-field {
    margin-top: 0.55rem;
}

.sync-diff-field-name {
    color: #24485d;
    font-size: 0.86rem;
    font-weight: 900;
    margin-bottom: 0.45rem;
}

.sync-diff-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.65rem;
}

.sync-diff-column {
    min-height: 4rem;
    padding: 0.7rem;
    border-radius: 12px;
    background: #ffffff;
    border: 1px solid #e5ecef;
}

.sync-diff-column-title {
    display: block;
    margin-bottom: 0.45rem;
    color: #78909c;
    font-size: 0.68rem;
    font-weight: 900;
    letter-spacing: 0.035rem;
    text-transform: uppercase;
}

.sync-empty-state {
    padding: 0.85rem 0.9rem;
    color: #6f8793;
    border-radius: 12px;
    background: #f7fafb;
    border: 1px dashed #d9e5ea;
    font-size: 0.88rem;
}

.sync-empty-value {
    color: #8aa3ad;
    font-size: 0.82rem;
    font-weight: 700;
}

.sync-validation-footer {
    padding: 0.85rem 0.95rem;
    color: #6f8793;
    border-radius: 14px;
    background: #f7fafb;
    font-size: 0.88rem;
}

.sync-validation-footer.is-warning {
    color: #8a4a15;
    background: #fff7ed;
    border: 1px solid #f5d2aa;
}

.sync-validation-footer.is-success {
    color: #237a3b;
    background: #effaf2;
    border: 1px solid #b8e2c2;
}

@media (max-width: 850px) {
    .sync-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .sync-summary-item:last-child {
        grid-column: span 2;
    }

    .sync-diff-columns {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 520px) {
    .validate-sync-modal {
        width: calc(100vw - 1rem);
        max-height: calc(100vh - 1rem);
    }

    .validate-sync-modal .popup-body {
        padding: 1rem;
    }

    .sync-summary-grid {
        grid-template-columns: 1fr;
    }

    .sync-summary-item:last-child {
        grid-column: auto;
    }
}

.sync-empty-state {
    padding: 0.9rem;
    color: #6e8593;
    border-radius: 12px;
    background: #f6f7f9;
}

.sync-actions {
    display: flex;
    justify-content: flex-end;
}

@media (max-width: 800px) {
    .sync-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .sync-diff-columns {
        grid-template-columns: 1fr;
    }
}

.assoc-summary {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.assoc-list-section {
    border: 1px solid #dbe6eb;
    border-radius: 14px;
    background: #ffffff;
    overflow: hidden;
    box-shadow: 0 4px 14px rgba(3, 69, 99, 0.05);
}

.assoc-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 0.9rem;
    font-weight: 700;
    color: #034563;
    border-bottom: 1px solid #e6eef2;
}

.assoc-list-title {
    font-size: 0.98rem;
}

.assoc-count {
    min-width: 2rem;
    height: 1.6rem;
    padding: 0 0.5rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    background: #eaf5f8;
    color: #034563;
}

.assoc-list-body {
    padding: 0.35rem 0.65rem 0.55rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.assoc-list-item {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.5rem;
    padding: 0.45rem 0.3rem;
    border-bottom: 1px solid #edf2f5;
}

.assoc-list-item:last-child {
    border-bottom: none;
}

.assoc-list-name {
    font-weight: 400;
}

.assoc-list-email {
    font-size: 0.88rem;
    color: #5e7380;
    line-height: 1.15;
}

@media (max-width: 1100px) {
    .main-row {
        flex-direction: column;
        align-items: center;
        gap: 1.5rem;
    }
}

@media (max-width: 500px) {
    .card, .query-section {
        padding: 1.2rem 0.5rem;
        min-width: 0;
        max-width: 100vw;
    }

    .page-title {
        font-size: 1.3rem;
    }

    h1, h2 {
        font-size: 1.1rem;
    }

    #syncBtn, .queryBtn {
        font-size: 1rem;
        padding: 0.7rem 1.2rem;
    }

    .floating-action-btn {
        padding: 0.75rem 0.9rem;
        font-size: 0.82rem;
    }

    .login-page {
        padding: 1rem;
    }

    .login-card {
        padding: 1.7rem 1.35rem;
    }

    .login-title {
        font-size: 1.25rem;
    }
}

.top-buttons {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
}

@media (max-width: 500px) {
    .top-buttons {
        top: 12px;
        right: 12px;
        left: 12px;
        flex-wrap: wrap;
    }
}

.login-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    padding: 6px 12px;
    border-radius: 999px;
    background-color: #e5f7f7;
    color: #2f6f7e;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.app-toast {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 9999;
    max-width: 360px;
    padding: 14px 18px;
    border-radius: 14px;
    background: #1f2937;
    color: #ffffff;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.4;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.22);
    opacity: 0;
    transform: translateY(-12px);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.app-toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.app-toast-error {
    background: #991b1b;
}

.app-toast-success {
    background: #047857;
}
