/*
 * =============================================================================
 * OPSPORTAL DESIGN SYSTEM
 * =============================================================================
 *
 * Shares the visual identity with FirmPortal:
 *   Aesthetic: Quiet luxury + structured productivity
 *   Font: Plus Jakarta Sans
 *   Accent: #25403C (dark teal/forest green)
 *   Neutrals: Warm stone palette
 *
 * =============================================================================
 */


/* =============================================================================
   1. DESIGN TOKENS
   ============================================================================= */

:root {
    /* Accent */
    --ip-accent: #25403C;
    --ip-accent-rgb: 37, 64, 60;
    --ip-accent-hover: #1E3531;
    --ip-accent-light: #2F524D;
    --ip-accent-subtle: #E8EDEC;
    --ip-accent-subtle-hover: #DCE4E3;

    /* Warm stone neutrals */
    --ip-neutral-50: #FAFAFA;
    --ip-neutral-100: #F5F5F4;
    --ip-neutral-200: #E7E5E4;
    --ip-neutral-300: #D6D3D1;
    --ip-neutral-400: #A8A29E;
    --ip-neutral-500: #78716C;
    --ip-neutral-600: #57534E;
    --ip-neutral-700: #44403C;
    --ip-neutral-800: #292524;
    --ip-neutral-900: #1C1917;

    /* Font */
    --ip-font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;

    /* Spacing */
    --ip-spacing-unit: 8px;

    /* Radius */
    --ip-radius-sm: 6px;
    --ip-radius-md: 8px;
    --ip-radius-lg: 12px;

    /* Transitions */
    --ip-transition-fast: 150ms ease;

    /* Layout */
    --ip-sidebar-width: 260px;
}


/* =============================================================================
   2. BOOTSTRAP VARIABLE OVERRIDES
   ============================================================================= */

:root {
    --bs-font-sans-serif: var(--ip-font-family);
    --bs-body-font-size: 0.9375rem;
    --bs-body-font-weight: 400;
    --bs-body-line-height: 1.6;
    --bs-body-color: var(--ip-neutral-800);
    --bs-body-bg: #fff;
    --bs-border-radius: var(--ip-radius-md);
    --bs-border-radius-sm: var(--ip-radius-sm);
    --bs-border-radius-lg: var(--ip-radius-lg);
    --bs-link-color: var(--ip-accent);
    --bs-link-hover-color: var(--ip-accent-hover);
    --bs-primary-rgb: var(--ip-accent-rgb);
}


/* =============================================================================
   3. BASE ELEMENT RESETS
   ============================================================================= */

body {
    font-family: var(--ip-font-family);
    letter-spacing: -0.011em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    margin: 0;
}

a {
    color: var(--ip-accent);
    text-decoration: none;
    transition: color var(--ip-transition-fast);
}

a:hover {
    color: var(--ip-accent-hover);
}


/* =============================================================================
   4. TYPOGRAPHY SCALE
   ============================================================================= */

h1, h2, h3, h4, h5, h6 {
    color: var(--ip-neutral-900);
}

h1 { font-size: 1.875rem; font-weight: 700; letter-spacing: -0.025em; }
h2 { font-size: 1.5rem;   font-weight: 700; letter-spacing: -0.02em; }
h3 { font-size: 1.25rem;  font-weight: 600; letter-spacing: -0.015em; }
h4 { font-size: 1.0625rem; font-weight: 600; letter-spacing: -0.01em; }
h5 { font-size: 0.9375rem; font-weight: 600; }

h6 {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ip-neutral-500);
}

/* Text color utilities */
.text-neutral-400 { color: var(--ip-neutral-400) !important; }
.text-neutral-500 { color: var(--ip-neutral-500) !important; }
.text-neutral-600 { color: var(--ip-neutral-600) !important; }
.bg-neutral-50 { background-color: var(--ip-neutral-50) !important; }


/* =============================================================================
   5. COMPONENT OVERRIDES
   ============================================================================= */

/* ----- Buttons ----- */

.btn {
    font-weight: 500;
    letter-spacing: -0.005em;
    transition: all var(--ip-transition-fast);
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background-color: var(--ip-accent);
    border-color: var(--ip-accent);
}

.btn-primary:hover, .btn-primary:focus, .btn-primary:active, .btn-primary.active, .btn-primary:first-child:active {
    background-color: var(--ip-accent-hover);
    border-color: var(--ip-accent-hover);
}

.btn-secondary {
    background-color: var(--ip-neutral-100);
    border-color: var(--ip-neutral-100);
    color: var(--ip-neutral-700);
}

.btn-secondary:hover {
    background-color: var(--ip-neutral-200);
    border-color: var(--ip-neutral-200);
    color: var(--ip-neutral-800);
}

.btn-outline-primary {
    color: var(--ip-accent);
    border-color: var(--ip-accent);
}

.btn-outline-primary:hover {
    background-color: var(--ip-accent);
    border-color: var(--ip-accent);
    color: #fff;
}

.btn-link {
    color: var(--ip-accent);
    font-weight: 500;
}

.btn-link:hover {
    color: var(--ip-accent-hover);
}

/* ----- Forms ----- */

.form-control, .form-select {
    border-color: var(--ip-neutral-300);
    font-size: 0.9375rem;
    transition: border-color var(--ip-transition-fast), box-shadow var(--ip-transition-fast);
}

.form-control:hover, .form-select:hover {
    border-color: var(--ip-neutral-400);
}

.form-control:focus, .form-select:focus {
    border-color: var(--ip-accent);
    box-shadow: 0 0 0 3px rgba(var(--ip-accent-rgb), 0.1);
}

.form-control::placeholder {
    color: var(--ip-neutral-400);
}

.form-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--ip-neutral-700);
    margin-bottom: 4px;
}

.form-check-input:checked {
    background-color: var(--ip-accent);
    border-color: var(--ip-accent);
}

.form-check-input:focus {
    box-shadow: 0 0 0 3px rgba(var(--ip-accent-rgb), 0.1);
    border-color: var(--ip-accent);
}

/* ----- Tables ----- */

.table {
    --bs-table-bg: transparent;
    font-size: 0.875rem;
    margin-bottom: 0;
}

.table > thead > tr > th {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ip-neutral-500);
    border-bottom-width: 2px;
    border-bottom-color: var(--ip-neutral-200);
    padding: 10px 16px;
    white-space: nowrap;
}

.table > tbody > tr > td {
    padding: 12px 16px;
    vertical-align: middle;
    border-bottom: 1px solid var(--ip-neutral-100);
    color: var(--ip-neutral-800);
}

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

/* ----- Badges ----- */

.badge {
    font-weight: 500;
    font-size: 0.75rem;
    letter-spacing: 0.01em;
    padding: 3px 8px;
    border-radius: var(--ip-radius-sm);
}

/* ----- Alerts ----- */

.alert {
    border: none;
    border-left: 3px solid;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--ip-radius-md);
}

/* ----- Modals ----- */

.modal-backdrop {
    --bs-backdrop-opacity: 0.3;
}

.modal-content {
    border: none;
    border-radius: var(--ip-radius-lg);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.12);
}

/* ----- Nav Pills ----- */

.nav-pills .nav-link {
    color: var(--ip-neutral-600);
    font-weight: 500;
    font-size: 0.875rem;
    border-radius: var(--ip-radius-sm);
    transition: all var(--ip-transition-fast);
}

.nav-pills .nav-link:hover {
    color: var(--ip-neutral-800);
    background-color: var(--ip-neutral-100);
}

.nav-pills .nav-link.active,
.nav-pills .show > .nav-link {
    color: #fff;
    background-color: var(--ip-accent);
}

/* ----- Breadcrumbs ----- */

.breadcrumb {
    font-size: 0.8125rem;
    margin-bottom: 16px;
}

/* ----- Dropdowns ----- */

.dropdown-menu {
    border: 1px solid var(--ip-neutral-200);
    border-radius: var(--ip-radius-md);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
    padding: 4px;
    font-size: 0.875rem;
}

.dropdown-item {
    border-radius: var(--ip-radius-sm);
    padding: 6px 12px;
    font-size: 0.875rem;
    color: var(--ip-neutral-700);
}

.dropdown-item:hover {
    background-color: var(--ip-neutral-50);
    color: var(--ip-neutral-900);
}


/* =============================================================================
   6. APP LAYOUT (sidebar + main content)
   ============================================================================= */

.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    width: var(--ip-sidebar-width);
    flex-shrink: 0;
    flex-direction: column;
    background:
        linear-gradient(134deg, rgba(25, 80, 77, 0) 72%, rgba(32, 48, 45, 1) 92%),
        radial-gradient(circle at 12px 225px, rgba(0, 0, 0, 0) 10px, rgba(0, 0, 0, 0.25) 950px),
        radial-gradient(circle, rgba(37, 64, 60, 1) 0%, rgba(25, 80, 77, 1) 73%, rgba(37, 64, 60, 1) 100%);
    border-right: none;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1030;
    overflow-y: auto;
}

.app-sidebar-header {
    padding: 24px 20px 16px;
}

.app-wordmark {
    font-family: 'Young Serif', serif;
    font-weight: 400;
    color: #fff;
    text-decoration: none;
    line-height: 0.8;
}

.app-wordmark:hover {
    color: #fff;
}

.app-sidebar-nav {
    flex: 1;
    padding: 0 12px;
    overflow-y: auto;
}

.app-sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Sidebar Nav Items */

.sidebar-nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav-divider {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin: 12px 12px;
}

.sidebar-nav-group-label {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(255, 255, 255, 0.4);
    padding: 24px 12px 6px;
}

.sidebar-nav-item {
    margin-bottom: 2px;
}

.sidebar-nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--ip-radius-sm);
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: background-color var(--ip-transition-fast), color var(--ip-transition-fast);
}

.sidebar-nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.sidebar-nav-link.active {
    background-color: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-weight: 600;
}

/* Sidebar User Menu */

.sidebar-user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-user-link {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
    text-decoration: none;
    border-radius: var(--ip-radius-sm);
    transition: opacity var(--ip-transition-fast);
}

.sidebar-user-link:hover {
    opacity: 0.8;
}

.sidebar-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.2);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    flex-shrink: 0;
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user-name {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-org {
    font-size: 0.6875rem;
    color: rgba(255, 255, 255, 0.5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-logout-form {
    flex-shrink: 0;
}

.sidebar-logout-btn {
    background: none;
    border: none;
    padding: 6px;
    border-radius: var(--ip-radius-sm);
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    transition: color var(--ip-transition-fast), background-color var(--ip-transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-logout-btn:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.1);
}

/* Main Content Area */

.app-main {
    flex: 1;
    margin-left: var(--ip-sidebar-width);
    min-height: 100vh;
}

.app-content {
    padding: 40px 48px;
    max-width: 1400px;
}

/* Mobile Header */

.app-mobile-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--ip-neutral-200);
    background: #fff;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.app-menu-toggle {
    background: none;
    border: none;
    padding: 6px;
    color: var(--ip-neutral-700);
    cursor: pointer;
    border-radius: var(--ip-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color var(--ip-transition-fast);
}

.app-menu-toggle:hover {
    background-color: var(--ip-neutral-100);
}

/* Offcanvas Sidebar */

.app-sidebar-offcanvas {
    width: var(--ip-sidebar-width) !important;
    background:
        linear-gradient(134deg, rgba(25, 80, 77, 0) 72%, rgba(32, 48, 45, 1) 92%),
        radial-gradient(circle at 12px 225px, rgba(0, 0, 0, 0) 10px, rgba(0, 0, 0, 0.25) 950px),
        radial-gradient(circle, rgba(37, 64, 60, 1) 0%, rgba(25, 80, 77, 1) 73%, rgba(37, 64, 60, 1) 100%);
}

.app-sidebar-offcanvas .offcanvas-header {
    padding: 24px 20px 16px;
    border-bottom: none;
}

.app-sidebar-offcanvas .btn-close {
    filter: invert(1);
}


/* =============================================================================
   7. AUTH LAYOUT
   ============================================================================= */

.auth-wrapper {
    display: flex;
    min-height: 100vh;
}

.auth-brand-panel {
    width: 45%;
    max-width: 600px;
    background:
        linear-gradient(134deg, rgba(25, 80, 77, 0) 72%, rgba(32, 48, 45, 1) 92%),
        radial-gradient(circle at 12px 225px, rgba(0, 0, 0, 0) 10px, rgba(0, 0, 0, 0.25) 950px),
        radial-gradient(circle, rgba(37, 64, 60, 1) 0%, rgba(25, 80, 77, 1) 73%, rgba(37, 64, 60, 1) 100%);
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    padding: 48px 56px;
    position: relative;
    overflow: hidden;
}

.auth-brand-content {
    position: relative;
    z-index: 1;
}

.auth-brand-tagline {
    font-size: 1rem;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.7);
    margin: 0;
}

.auth-brand-decoration {
    position: absolute;
    bottom: -40px;
    right: -40px;
    width: 300px;
    height: 300px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

.auth-brand-decoration::after {
    content: '';
    position: absolute;
    top: 30px;
    left: 30px;
    right: 30px;
    bottom: 30px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 50%;
}

.auth-form-panel {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
}

.auth-form-container {
    width: 100%;
    max-width: 420px;
}

@media (max-width: 767.98px) {
    .auth-form-panel {
        padding: 32px 20px;
    }

    .auth-form-container {
        max-width: 100%;
    }
}


/* =============================================================================
   8. SECTION SPACING
   ============================================================================= */

.section-gap {
    margin-bottom: 48px;
}

/* Mobile responsive */
@media (max-width: 991.98px) {
    .app-main {
        margin-left: 0;
    }

    .app-content {
        padding: 24px 16px;
    }
}


/* =============================================================================
   8. OPS-SPECIFIC UTILITIES
   ============================================================================= */

/* Nav pills bar (OPS filter bar) */
.nav-pills-bar {
    background-color: var(--ip-neutral-100);
    border-radius: 50rem;
    padding: 0.25rem;
    display: inline-flex;
}

.nav-pills-bar .nav-link {
    border-radius: 50rem;
    color: var(--ip-neutral-600);
    padding: 0.35rem 1rem;
    font-size: 0.875rem;
}

.nav-pills-bar .nav-link.active {
    background-color: #fff;
    color: var(--ip-neutral-900);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

/* Sticky table headers */
.table-responsive thead.table-light th {
    position: sticky;
    top: 0;
    z-index: 1;
}
