/**
 * Mapit - Main Application Stylesheet
 * This is the single source of truth for styling
 */

/* Import design system variables */
@import url('design-system.css');

/* ========================================
   GLOBAL STYLES
   ======================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    color: var(--text-primary);
    background: var(--bg-body);
    line-height: 1.5;
}

/* ========================================
   TYPOGRAPHY UTILITIES
   ======================================== */

.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-white { color: var(--text-inverse); }

.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }
.text-2xl { font-size: var(--text-2xl); }
.text-3xl { font-size: var(--text-3xl); }
.text-4xl { font-size: var(--text-4xl); }

.font-normal { font-weight: var(--font-normal); }
.font-medium { font-weight: var(--font-medium); }
.font-semibold { font-weight: var(--font-semibold); }
.font-bold { font-weight: var(--font-bold); }

/* ========================================
   COLOR UTILITIES
   ======================================== */

.bg-primary { background-color: var(--mapit-primary); }
.bg-primary-light { background-color: var(--mapit-primary-light); }
.bg-primary-lightest { background-color: var(--mapit-primary-lightest); }
.bg-white { background-color: var(--neutral-white); }
.bg-gray-50 { background-color: var(--neutral-lightest); }
.bg-gray-100 { background-color: var(--neutral-lighter); }
.bg-gray-200 { background-color: var(--neutral-light); }

.text-primary-color { color: var(--mapit-primary); }
.text-success { color: var(--mapit-success); }
.text-warning { color: var(--mapit-warning); }
.text-danger { color: var(--color-danger); }

/* ========================================
   SPACING UTILITIES
   ======================================== */

.m-0 { margin: 0; }
.m-1 { margin: var(--space-xs); }
.m-2 { margin: var(--space-sm); }
.m-3 { margin: var(--space-md); }
.m-4 { margin: var(--space-lg); }
.m-5 { margin: var(--space-xl); }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: var(--space-xs); }
.mt-2 { margin-top: var(--space-sm); }
.mt-3 { margin-top: var(--space-md); }
.mt-4 { margin-top: var(--space-lg); }
.mt-5 { margin-top: var(--space-xl); }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: var(--space-xs); }
.mb-2 { margin-bottom: var(--space-sm); }
.mb-3 { margin-bottom: var(--space-md); }
.mb-4 { margin-bottom: var(--space-lg); }
.mb-5 { margin-bottom: var(--space-xl); }

.p-0 { padding: 0; }
.p-1 { padding: var(--space-xs); }
.p-2 { padding: var(--space-sm); }
.p-3 { padding: var(--space-md); }
.p-4 { padding: var(--space-lg); }
.p-5 { padding: var(--space-xl); }

/* ========================================
   BUTTON STYLES
   ======================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-base);
    text-decoration: none;
}

.btn-primary {
    background-color: var(--mapit-primary);
    color: var(--text-inverse);
    border-color: var(--mapit-primary);
}

.btn-primary:hover {
    background-color: var(--mapit-primary-hover);
    border-color: var(--mapit-primary-hover);
}

.btn-secondary {
    background-color: var(--neutral-white);
    color: var(--text-secondary);
    border-color: var(--border-light);
}

.btn-secondary:hover {
    background-color: var(--neutral-lighter);
}

.btn-success {
    background-color: var(--mapit-success);
    color: var(--text-inverse);
}

.btn-danger {
    background-color: var(--color-danger);
    color: var(--text-inverse);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: var(--text-xs);
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: var(--text-base);
}

/* ========================================
   CARD STYLES
   ======================================== */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.card-header {
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-card);
}

.card-body {
    padding: var(--space-lg);
}

.card-footer {
    padding: var(--space-md) var(--space-lg);
    border-top: 1px solid var(--border-light);
    background: var(--neutral-lightest);
}

/* ========================================
   BADGE STYLES
   ======================================== */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    border-radius: var(--radius-full);
}

.badge-success {
    background-color: var(--badge-green-bg);
    color: var(--badge-green-text);
}

.badge-warning {
    background-color: var(--badge-yellow-bg);
    color: var(--badge-yellow-text);
}

.badge-danger {
    background-color: var(--badge-red-bg);
    color: var(--badge-red-text);
}

.badge-info {
    background-color: var(--badge-blue-bg);
    color: var(--badge-blue-text);
}

/* ========================================
   ALERT STYLES
   ======================================== */
 
.alert {
    padding: 0.875rem 1rem;
    border-radius: var(--radius-md);
    border: 1px solid;
    margin-bottom: var(--space-md);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.alert-success {
    background-color: var(--badge-green-bg);
    border-color: var(--mapit-success);
    color: var(--badge-green-text);
}

.alert-warning {
    background-color: var(--badge-yellow-bg);
    border-color: var(--mapit-warning);
    color: var(--badge-yellow-text);
}

.alert-danger, .alert-error {
    background-color: var(--badge-red-bg);
    border-color: var(--color-danger);
    color: var(--badge-red-text);
}

.alert-info {
    background-color: var(--badge-blue-bg);
    border-color: var(--mapit-primary);
    color: var(--badge-blue-text);
}

/* ========================================
   FORM STYLES
   ======================================== */

.form-group {
    margin-bottom: var(--space-md);
}

.form-label {
    display: block;
    margin-bottom: var(--space-sm);
    color: var(--text-secondary);
    font-weight: var(--font-medium);
    font-size: var(--text-sm);
}

.form-control, .form-select {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: var(--text-base);
    color: var(--text-primary);
    background-color: var(--neutral-white);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
}

.form-control:focus, .form-select:focus {
    outline: none;
    border-color: var(--mapit-primary);
    box-shadow: 0 0 0 3px var(--mapit-primary-lightest);
}

.form-text {
    margin-top: var(--space-xs);
    font-size: var(--text-sm);
    color: var(--text-muted);
}

/* ========================================
   TABLE STYLES
   ======================================== */

.table {
    width: 100%;
    border-collapse: collapse;
}

.table thead {
    background-color: var(--neutral-lightest);
    border-bottom: 1px solid var(--border-light);
}

.table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.table td {
    padding: 1rem;
    border-bottom: 1px solid var(--neutral-lighter);
}

.table tbody tr:hover {
    background-color: var(--neutral-lightest);
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }

.rounded { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-full { border-radius: var(--radius-full); }

.border { border: 1px solid var(--border-light); }
.border-0 { border: none; }

.d-flex { display: flex; }
.d-inline-flex { display: inline-flex; }
.d-block { display: block; }
.d-inline-block { display: inline-block; }
.d-none { display: none; }

.align-items-center { align-items: center; }
.justify-content-center { justify-content: center; }
.justify-content-between { justify-content: space-between; }

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.fw-normal { font-weight: var(--font-normal); }
.fw-medium { font-weight: var(--font-medium); }
.fw-semibold { font-weight: var(--font-semibold); }
.fw-bold { font-weight: var(--font-bold); }

.text-decoration-none { text-decoration: none; }

.w-100 { width: 100%; }
.h-100 { height: 100%; }

.gap-2 { gap: var(--space-sm); }
.gap-3 { gap: var(--space-md); }
.gap-4 { gap: var(--space-lg); }

/* ============================================
   APPS PAGE STYLES
   ============================================ */

/* Page Title - Blue */
.apps-page-title {
    color: var(--mapit-primary);
    font-weight: var(--font-bold);
    font-size: var(--text-3xl);
    margin-bottom: var(--space-xs);
}

.apps-page-subtitle {
    color: var(--text-muted);
    font-size: var(--text-base);
    margin-bottom: var(--space-xl);
}

/* Insight Cards Row */
.insight-cards-row {
    display: flex;
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

/* Wrapper for card + description underneath */
.apps-insight-card-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.apps-insight-card {
    background: var(--neutral-white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    transition: var(--transition-base);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.apps-insight-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.apps-insight-card.active-insight {
    border: 2px solid var(--mapit-primary);
    background-color: var(--bg-card-hover);
}

.apps-insight-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
    flex: 1;
}

.apps-insight-card-link .apps-insight-card {
    cursor: pointer;
    transition: all 0.2s;
}

.apps-insight-card-link .apps-insight-review-link {
    text-decoration: underline;
    pointer-events: none;
}

.apps-insight-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-xs);
}

.apps-insight-card-title {
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    color: var(--text-secondary);
    margin: 0;
}

.apps-insight-review-link {
    color: var(--mapit-warning);
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    text-decoration: none;
}

.apps-insight-value {
    font-size: 2.25rem;
    font-weight: var(--font-bold);
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
    line-height: 1;
}

.apps-insight-label {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: var(--text-xs);
    margin-bottom: 0;
}

.apps-insight-label.security-risk {
    color: var(--mapit-warning);
}

.apps-insight-label.unnecessary-spend {
    color: var(--badge-yellow);
}

.apps-insight-label.provide-info {
    color: var(--mapit-primary);
}

.apps-insight-label.investigation {
    color: var(--mapit-primary);
}

/* Description now appears below the card */
.apps-insight-description {
    font-size: var(--text-xs);
    color: var(--text-muted);
    margin: var(--space-xs) 0 0 0;
    padding: 0 var(--space-xs);
}

/* Filter Bar */
.apps-filter-bar {
    display: flex;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
    align-items: center;
}

.apps-filter-select {
    width: 160px;
    padding: var(--space-sm) var(--space-md);
    font-size: var(--text-sm);
}

.apps-search-input {
    flex: 1;
    max-width: 400px;
    padding: var(--space-sm) var(--space-md);
    font-size: var(--text-sm);
}

/* Apps Table */
.apps-table-container {
    background: var(--neutral-white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.apps-table {
    width: 100%;
    margin: 0;
}

.apps-table thead {
    background: var(--neutral-lightest);
}

.apps-table thead th {
    padding: var(--space-md) var(--space-lg);
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-light);
}

.apps-table thead th .sortable-header {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition-base);
    cursor: pointer;
}

.apps-table thead th .sortable-header:hover {
    color: var(--mapit-primary);
}

.apps-table thead th .sortable-header.active {
    color: var(--mapit-primary);
}

.apps-table thead th .sortable-header i {
    font-size: 0.75rem;
    opacity: 0.6;
}

.apps-table tbody td {
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

.apps-table tbody tr:last-child td {
    border-bottom: none;
}

.apps-table tbody tr:hover {
    background: var(--neutral-lightest);
}

.app-name-cell {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.app-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    object-fit: contain;
}

.app-icon-placeholder {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: var(--neutral-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: var(--font-semibold);
    font-size: var(--text-sm);
    color: var(--neutral-dark);
}

.app-name-link {
    color: var(--text-primary);
    font-weight: var(--font-semibold);
    text-decoration: none;
    font-size: var(--text-base);
}

.app-name-link:hover {
    color: var(--mapit-primary);
}

/* Insight Badges in Table */
.insight-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
}

.insight-badge.no-contract {
    background: var(--badge-yellow-bg);
    color: var(--badge-yellow-text);
}

.insight-badge.duplicate {
    background: var(--badge-blue-bg);
    color: var(--badge-blue-text);
}

.insight-badge.unapproved {
    background: var(--badge-red-bg);
    color: var(--badge-red-text);
}

.insight-badge.under-review {
    background: var(--badge-blue-bg);
    color: var(--badge-blue-text);
}

.insight-badge.expiring {
    background: var(--badge-red-bg);
    color: var(--badge-red-text);
}

.insight-badge.no-owner {
    background: var(--badge-green-bg);
    color: var(--badge-green-text);
}

.insight-badge.rejected {
    background: var(--badge-red-bg);
    color: var(--badge-red-text);
}

/* Action Buttons */
.app-action-btn {
    padding: var(--space-xs) var(--space-md);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: var(--transition-base);
    display: inline-block;
}

.app-action-btn.review {
    background: var(--mapit-primary);
    color: var(--text-inverse);
    border: none;
}

.app-action-btn.review:hover {
    background: var(--mapit-primary-hover);
}

.app-action-btn.assign {
    background: var(--neutral-white);
    color: var(--mapit-primary);
    border: 1px solid var(--mapit-primary);
}

.app-action-btn.assign:hover {
    background: var(--mapit-primary-lightest);
}

/* Pagination */
.apps-pagination { 
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-lg);
    background: var(--neutral-white);
    border-top: 1px solid var(--border-light);
}

.apps-pagination-info {
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.apps-pagination-controls {
    display: flex;
    gap: var(--space-xs);
}

.apps-pagination-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    background: var(--neutral-white);
    color: var(--text-secondary);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    cursor: pointer;
    transition: var(--transition-base);
    text-decoration: none;
}

.apps-pagination-btn:hover:not(.disabled) {
    background: var(--neutral-lightest);
    border-color: var(--border-medium);
}

.apps-pagination-btn.active {
    background: var(--mapit-primary);
    color: var(--text-inverse);
    border-color: var(--mapit-primary);
}

.apps-pagination-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============================================
   APP DETAIL MODAL
   ============================================ */

/* Modal Container */
.app-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-lg);
}

.app-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
}

.app-modal-content {
    position: relative;
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    background: var(--neutral-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    z-index: 10000;
    margin: auto;
    overflow: hidden;
}

/* Modal content wrapper for dynamically loaded content */
.app-modal-content > div {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1;
}

/* Modal Header - Override the generic div rule above */
.app-modal-header {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border-light);
}

.app-modal-header-left {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.app-modal-header-right {
    display: flex;
    align-items: center;
    margin-right: var(--space-lg);
}

.app-modal-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: var(--mapit-primary-lightest);
    display: flex;
    align-items: center;
    justify-content: center;
}

.app-modal-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: var(--radius-md);
}

.app-modal-title {
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
    color: var(--text-primary);
    margin: 0;
}

.app-modal-meta {
    display: flex;
    gap: var(--space-md);
    margin-top: var(--space-xs);
}

.app-modal-status {
    font-size: var(--text-sm);
    color: var(--mapit-success);
    font-weight: var(--font-medium);
}

.app-modal-users {
    font-size: var(--text-sm);
    color: var(--text-muted);
}

.app-modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--neutral-lighter);
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-base);
}

.app-modal-close:hover {
    background: var(--neutral-light);
}

.app-modal-close i {
    font-size: 1.5rem;
    color: var(--text-secondary);
}

/* Modal Tabs */
.app-modal-tabs {
    display: flex;
    gap: var(--space-sm);
    padding: 0 var(--space-lg);
    border-bottom: 1px solid var(--border-light);
}

.app-modal-tab {
    padding: var(--space-md) var(--space-lg);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    cursor: pointer;
    transition: var(--transition-base);
}

.app-modal-tab:hover {
    color: var(--mapit-primary);
}

.app-modal-tab.active {
    color: var(--mapit-primary);
    border-bottom-color: var(--mapit-primary);
}

/* Modal Body */
.app-modal-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: var(--space-lg);
    min-height: 0;
    -webkit-overflow-scrolling: touch;
}

.app-modal-body::-webkit-scrollbar {
    width: 8px;
}

.app-modal-body::-webkit-scrollbar-track {
    background: var(--neutral-lighter);
    border-radius: var(--radius-sm);
}

.app-modal-body::-webkit-scrollbar-thumb {
    background: var(--neutral-medium);
    border-radius: var(--radius-sm);
}

.app-modal-body::-webkit-scrollbar-thumb:hover {
    background: var(--neutral-dark);
}

.app-modal-content-wrapper {
    display: flex;
    gap: var(--space-xl);
    padding: var(--space-lg);
}

.app-modal-main {
    flex: 1;
}

.app-modal-tab-content {
    display: none;
}

.app-modal-tab-content.active {
    display: block;
}

/* Detail Sections */
.app-detail-section {
    margin-bottom: var(--space-lg);
}

.app-detail-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-sm);
}

.app-detail-heading {
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    color: var(--text-secondary);
    margin: 0 0 var(--space-sm) 0;
}

.app-detail-text {
    font-size: var(--text-base);
    color: var(--text-primary);
    margin: 0;
    line-height: 1.6;
}

.app-detail-add-btn {
    padding: var(--space-xs) var(--space-sm);
    background: none;
    border: 1px solid var(--mapit-primary);
    border-radius: var(--radius-sm);
    color: var(--mapit-primary);
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    cursor: pointer;
    transition: var(--transition-base);
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
}

.app-detail-add-btn:hover {
    background: var(--mapit-primary-lightest);
}

.app-detail-edit-btn {
    padding: var(--space-xs) var(--space-sm);
    background: none;
    border: none;
    color: var(--mapit-primary);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    cursor: pointer;
    text-decoration: underline;
}

/* Tags */
.app-detail-gatekeepers,
.app-detail-departments {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.app-tag {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
}

.app-tag-removable {
    background: var(--neutral-lighter);
    color: var(--text-primary);
}

.app-tag-removable i {
    cursor: pointer;
    font-size: var(--text-xs);
}

.app-tag-removable i:hover {
    color: var(--color-danger);
}

.app-tag-blue {
    background: var(--badge-blue-bg);
    color: var(--badge-blue-text);
}

.app-tag-green {
    background: var(--badge-green-bg);
    color: var(--badge-green-text);
}

.app-tag-purple {
    background: #E9D5FF;
    color: #7C3AED;
}

/* Sidebar */
.app-modal-sidebar {
    width: 280px;
    flex-shrink: 0;
}

.app-sidebar-heading {
    font-size: var(--text-lg);
    font-weight: var(--font-bold);
    color: var(--text-primary);
    margin: 0 0 var(--space-lg) 0;
}

.app-insight-item {
    padding: var(--space-md);
    background: var(--neutral-lightest);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
}

.app-insight-label {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin-bottom: var(--space-xs);
}

.app-insight-value {
    font-size: var(--text-3xl);
    font-weight: var(--font-bold);
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
}

.app-insight-sublabel {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.app-insight-value-with-bar .app-insight-number {
    font-size: var(--text-3xl);
    font-weight: var(--font-bold);
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}

.app-insight-progress {
    height: 8px;
    background: var(--neutral-light);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: var(--space-xs);
}

.app-insight-progress-bar {
    height: 100%;
    background: var(--mapit-success);
    transition: width 0.3s ease;
}

.app-insight-percentage {
    font-size: var(--text-sm);
    color: var(--mapit-success);
    font-weight: var(--font-medium);
}

/* Compact Insights Layout for Unapproved Apps */
.app-insight-compact {
    background: var(--neutral-white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-bottom: var(--space-lg);
}

.app-insight-compact-item {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.app-insight-compact-label {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    font-weight: var(--font-medium);
}

.app-insight-compact-value {
    font-size: var(--text-2xl);
    font-weight: var(--font-bold);
    color: var(--text-primary);
}

.app-insight-compact-divider {
    height: 1px;
    background: var(--border-light);
    margin: var(--space-md) 0;
}

.app-insight-compact-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
}

/* Expanded Insights Layout for Approved Apps */
.app-insights-expanded {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.app-insight-card {
    background: #EFF6FF; /* Light blue background */
    border-radius: var(--radius-md);
    padding: var(--space-md);
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.app-insight-card .app-insight-label {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    font-weight: var(--font-medium);
}

.app-insight-card .app-insight-value {
    font-size: var(--text-2xl);
    font-weight: var(--font-bold);
}

/* Insight value colors for approved apps */
.app-insight-savings .app-insight-value {
    color: #F59E0B; /* Orange for savings */
}

.app-insight-spend .app-insight-value {
    color: #10B981; /* Green for spend */
}

.app-insight-users .app-insight-value {
    color: #3B82F6; /* Blue for users */
}

/* Sidebar Sections */
.app-sidebar-section {
    margin-bottom: var(--space-lg);
}

.app-sidebar-section-title {
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    color: var(--text-primary);
    margin: 0 0 var(--space-xs) 0;
}

.app-sidebar-section-subtitle {
    font-size: var(--text-xs);
    color: var(--text-muted);
    margin: 0 0 var(--space-sm) 0;
    line-height: 1.4;
}

/* Contracts List */
.app-contracts-list {
    margin-bottom: var(--space-lg);
}

.app-contract-card {
    padding: var(--space-md);
    background: var(--neutral-lightest);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
}

.app-contract-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-md);
}

.app-contract-header h4 {
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    color: var(--text-primary);
    margin: 0;
}

.app-contract-amount {
    font-size: var(--text-lg);
    font-weight: var(--font-bold);
    color: var(--mapit-primary);
}

.app-contract-details {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
}

/* Users List */
.app-users-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.app-user-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md);
    background: var(--neutral-lightest);
    border-radius: var(--radius-md);
}

.app-user-info {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.app-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: var(--mapit-primary-light);
    color: var(--mapit-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: var(--font-semibold);
    font-size: var(--text-sm);
}

.app-user-name {
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    color: var(--text-primary);
}

.app-user-email {
    font-size: var(--text-sm);
    color: var(--text-muted);
}

/* Button Utilities */
.btn-primary {
    padding: var(--space-sm) var(--space-lg);
    background: var(--mapit-primary);
    color: var(--text-inverse);
    border: none;
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    cursor: pointer;
    transition: var(--transition-base);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
}

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

.btn-outline {
    padding: var(--space-xs) var(--space-md);
    background: var(--neutral-white);
    color: var(--mapit-primary);
    border: 1px solid var(--mapit-primary);
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    cursor: pointer;
    transition: var(--transition-base);
}

.btn-outline:hover {
    background: var(--mapit-primary-lightest);
}

.btn-sm {
    padding: var(--space-xs) var(--space-sm);
    font-size: var(--text-xs);
}

/* Sortable table headers (generic - works with Bootstrap tables) */
.sortable-header {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--text-secondary, #6c757d);
    text-decoration: none;
    transition: color 0.2s ease;
    cursor: pointer;
    white-space: nowrap;
}

.sortable-header:hover {
    color: var(--mapit-primary, #5B99F8);
    text-decoration: none;
}

.sortable-header.active {
    color: var(--mapit-primary, #5B99F8);
}

.sortable-header i {
    font-size: 0.75rem;
    opacity: 0.7;
}
