body {
    background-color: #f8f9fa;
}

/* Override Bootstrap theme variables to use PIMid primary blue */
:root {
    --bs-primary: #003366;
    --bs-primary-rgb: 0,51,102;
    --bs-link-color: #003366;
}

/* Global link colors for PIMid */
a {
    color: #003366;
    text-decoration: none;
    transition: color 0.12s ease, transform 0.12s ease;
    display: inline-block;
}

a:hover,
a:focus {
    color: #001a33;
    text-decoration: underline;
    transform: translateY(-1px);
}

/* ===== Button overrides (match precision.web.portal style) ===== */

.btn {
    background-color: #003366;
    border-color: #003366;
    color: white;
    border-radius: 1rem;
    min-width: 100px;
    margin: .1rem;
    transition: transform 0.15s ease;
    transform-origin: center;
}

.btn:hover {
    background-color: #002244;
    border-color: #002244;
    color: white;
    transform: scale(1.05);
}

.btn-lg {
    border-radius: 1rem;
}

.btn.btn-sm {
    min-width: 50px !important;
}

.btn-primary {
    background-color: #003366;
    border-color: #003366;
    color: white;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active,
.btn-primary:active:focus {
    background-color: #002244 !important;
    border-color: #002244 !important;
    color: white;
}

.btn-primary:focus,
.btn-primary:active:focus {
    background-color: #003366;
    border-color: #003366;
}

.btn-outline-secondary {
    background-color: transparent;
    border-color: #6c757d;
    color: #6c757d;
}

.btn-outline-secondary:hover {
    background-color: #5a6268;
    border-color: #545b62;
    color: white;
    transform: scale(1.05);
}

.btn-success,
.btn-outline-success {
    background-color: #339933;
    border-color: #339933;
    color: white;
}

.btn-success:hover,
.btn-outline-success:hover {
    background-color: #006600;
    border-color: #006600;
    color: white;
    transform: scale(1.05);
}

.btn-outline-danger,
.btn-danger {
    background-color: #cc0000;
    border-color: #cc0000;
    color: white;
}

.btn-outline-danger:hover,
.btn-danger:hover {
    background-color: #990000;
    border-color: #990000;
    color: white;
    transform: scale(1.05);
}

.btn-outline-primary {
    background-color: transparent;
    border-color: #003366;
    color: #003366;
}

.btn-outline-primary:hover {
    background-color: #003366;
    border-color: #003366;
    color: white;
    transform: scale(1.05);
}

.btn-outline-warning {
    background-color: transparent;
    border-color: #FFC107;
    color: #856404;
}

.btn-outline-warning:hover {
    background-color: #FFC107;
    border-color: #FFC107;
    color: #2b2b2b;
    transform: scale(1.05);
}

.btn:focus,
.btn:active:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #003366 !important;
}

.btn-link {
    background-color: transparent;
    border-color: transparent;
    color: #003366;
    min-width: auto;
    transform: none !important;
}

.btn-link:hover {
    background-color: transparent;
    border-color: transparent;
    color: #002244;
    transform: none !important;
}

.btn-close {
    background-color: transparent;
    border: none;
    min-width: auto;
    margin: 0;
    transform: none !important;
    filter: none;
}

.btn-close:hover {
    background-color: transparent;
    transform: none !important;
}

@media (max-width: 640px) {
    .btn {
        min-width: 50px;
    }
}

/* Ensure admin group filter pills use the PIMid primary blue when active */
.pimid-group-filter.active,
.pimid-group-filter.btn-primary.active,
.pimid-group-filter:active,
.pimid-group-filter.show {
    background-color: #003366 !important;
    border-color: #003366 !important;
    color: #ffffff !important;
    box-shadow: none !important;
}

.pimid-group-filter:hover {
    background-color: #002244;
    border-color: #002244;
    color: #ffffff;
}

/* ===== End button overrides ===== */

.navbar-brand {
    font-weight: 600;
    letter-spacing: 0.05em;
}

.pimid-admin-tabs .nav-link {
    font-weight: 600;
    color: #44546f;
}

.pimid-admin-tabs .nav-link.active {
    color: #003366;
    border-color: #dfe1e6 #dfe1e6 #ffffff;
}

.pimid-role-chip {
    border-radius: 999px;
    font-weight: 500;
    padding-inline: 0.75rem;
}

.pimid-tier-select {
    min-width: 220px;
}

.pimid-admin-table th {
    font-weight: 600;
    color: #44546f;
}

.pimid-admin-table td {
    vertical-align: top;
}

.pimid-fit-badge {
    width: fit-content;
}

.pimid-search-meta {
    white-space: nowrap;
}

.pimid-subtle-note {
    color: #44546f;
    font-size: 0.875rem;
}

.pimid-role-picker .dropdown-toggle {
    min-height: 38px;
}

.pimid-role-picker-menu {
    width: 420px;
    max-width: min(92vw, 420px);
}

.pimid-role-picker-menu .form-check-label {
    line-height: 1.25;
}

.pimid-apps-table-wrap {
    overflow-x: auto;
    overflow-y: visible;
}

.pimid-groups-table-wrap {
    overflow-x: auto;
    overflow-y: visible;
}

.pimid-group-app-trigger {
    min-width: 92px;
}

.pimid-group-app-info {
    width: 1.15rem;
    height: 1.15rem;
    border-radius: 999px;
    border: 1px solid var(--bs-border-color);
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
}

.pimid-group-app-info:hover,
.pimid-group-app-info:focus {
    color: var(--bs-body-color);
    border-color: var(--bs-secondary-color);
    background-color: var(--bs-tertiary-bg);
    text-decoration: none;
}

.pimid-group-app-menu {
    width: 360px;
    max-width: min(90vw, 360px);
}

.pimid-groups-page .card-header {
    font-weight: 600;
}

.pimid-groups-table th {
    white-space: nowrap;
}

.pimid-groups-table td {
    vertical-align: middle;
}

.pimid-member-count-btn {
    min-width: auto !important;
    margin: 0;
    padding: 0 !important;
    border: 0;
    text-decoration: none;
    transform: none !important;
}

.pimid-member-count-btn:hover,
.pimid-member-count-btn:focus {
    transform: none !important;
    text-decoration: none;
}

.pimid-member-count-badge {
    min-width: 2.1rem;
}

.pimid-group-actions .btn {
    margin: 0;
}

.pimid-group-members-modal .modal-title {
    font-weight: 600;
}

@media (min-width: 768px) {
    .pimid-apps-table-wrap {
        min-height: calc(100vh - 360px);
    }
}

@media (max-width: 767.98px) {
    .pimid-tier-select {
        min-width: 100%;
    }

    .pimid-search-meta {
        width: 100%;
    }

    .pimid-admin-table td .d-flex {
        width: 100%;
    }

    .pimid-role-picker-menu {
        width: min(92vw, 420px);
    }

    .pimid-group-app-menu {
        width: min(90vw, 360px);
    }

    .pimid-groups-table td:last-child {
        white-space: nowrap;
    }

    .pimid-group-actions {
        flex-direction: column;
        align-items: stretch !important;
    }

    .pimid-group-actions .btn {
        width: 100%;
    }
}
