/* ==========================================================================
   1. CORE ARCHITECTURAL SYSTEM DESIGN & VARIABLES
   ========================================================================== */
:root {
    --primary: #2b706c;        /* Main Brand Teal */
    --primary-hover: #1e4f4c;  /* Darker Teal for buttons */
    --primary-bg: #f4f8f8;     /* Very Light Tint for backgrounds */
    
    --navy-brand: #22354a;
    /* Pristine White Sidebar Variable Config */
    --sidebar-bg: #ffffff;
    --sidebar-border: #f2f4f7;
    --sidebar-text: #475467;
    --sidebar-text-active: #101828;
    --sidebar-hover-bg: #f9fafb;

    /* Core Canvas Layout Parameters */
    --white: #ffffff;
    --light-bg: #fcfcfd;
    --border: #eaecf0;
    --text-dark: #101828;
    --text-muted: #667085;
    --card-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
    --box-shadow: 0 2px 4px rgba(43, 112, 108, 0.3);

    /* Functional Layout Variables */
    --success: #28a745;
    --success-bg: #ecfdf3;
    --danger: #dc3545;
    --danger-bg: #fef3f2;
    --warning: #dc6803;
    --warning-bg: #fffaeb;

    --font-stack: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
}
/* ==========================================================================
   2. GLOBAL INTERFACE INITIALIZATION
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-stack);
}

body {
    background-color: var(--light-bg);
    color: var(--text-dark);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
    margin: 20px;
}

.w-auto {
    width: auto;
}

/* ==========================================================================
   3. SIDEBAR COMPONENT (PRECISE MATCH TO SCREENSHOT)
   ========================================================================== */
.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    border-right: 1px solid var(--sidebar-border);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

.sidebar-brand {
    padding: 30px 24px;
    border-bottom: 1px solid var(--sidebar-border);
}

.brand-logo {
    color: var(--text-dark);
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 0.5px;
    line-height: 1.1;
}

.brand-subtext {
    color: var(--primary);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

.brand-version {
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 600;
    margin-top: 8px;
}

.sidebar-menu {
    list-style: none;
    padding: 20px 12px;
    flex-grow: 1;
    overflow-y: auto;
}

.sidebar-menu li {
    margin-bottom: 4px;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-radius: 6px;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.sidebar-menu li a i:first-child {
    margin-right: 14px;
    font-size: 16px;
    width: 20px;
    color: var(--text-muted);
}

.sidebar-menu li a .arrow-indicator {
    margin-left: auto;
    font-size: 10px;
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

/* Sidebar Dashboard Active Item Look */
.sidebar-menu li.active a {
    background-color: var(--sidebar-text-active);
    color: var(--white);
    font-weight: 600;
}

.sidebar-menu li.active a i:first-child {
    color: var(--white);
}

.sidebar-menu li.active a .arrow-indicator {
    color: var(--white);
}

/* Secondary Item Hover Actions */
.sidebar-menu li:not(.active) a:hover {
    background-color: var(--sidebar-hover-bg);
    color: var(--sidebar-text-active);
}

/* Profile Metadata Widget Footer */
.sidebar-user-footer {
    padding: 20px 16px;
    border-top: 1px solid var(--sidebar-border);
    background-color: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.user-profile-summary {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar-badge {
    width: 36px;
    height: 36px;
    background-color: var(--primary);
    color: var(--white);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 15px;
}

.user-metadata {
    flex-grow: 1;
    overflow: hidden;
}

.user-display-name {
    color: var(--text-dark);
    font-size: 13px;
    font-weight: 600;
}

.user-display-email {
    color: var(--text-muted);
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-logout-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    padding: 4px 8px;
    transition: color 0.2s ease;
}

.sidebar-logout-trigger:hover {
    color: var(--primary);
}

/* ==========================================================================
   4. SYSTEM CANVAS STRUCTURE & HEADER BAR
   ========================================================================== */
.main-content {
    margin-left: 260px;
    flex-grow: 1;
    padding: 40px;
    min-height: 100vh;
    width: calc(100% - 260px);
    transition: margin-left 0.3s ease, width 0.3s ease;
}

.topbar {
    height: 70px;
    background-color: var(--white);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    margin: -40px -40px 40px -40px;
    /* Aligns seamless layout boundaries */
}

.content-body {
    width: 100%;
}

.workspace-breadcrumbs {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.dashboard-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    gap: 15px;
}

.dashboard-title-row h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-dark);
    letter-spacing: -0.5px;
}

.dashboard-title-row p {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 4px;
}

.action-btn-group {
    display: flex;
    gap: 12px;
}

.dash-filter-form {
    display: flex;
    gap: 10px;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-sizing: border-box; /* Ensures padding stays inside bounds */
}

/* Styled selects */
.filter-select {
    background: #1a202c;
    color: #e2e8f0;
    border: 1px solid #4a5568;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    box-sizing: border-box;
}

/* Filter apply button */
.btn-filter-apply {
    background: #4a5568;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
    flex-shrink: 0; /* Prevents button from squeezing out */
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-filter-apply:hover {
    background: #718096;
}

@media (max-width: 768px) {

    /* Stack the whole banner content */
    .dash-welcome-banner {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
    }

    /* Make the filter form and buttons full width on mobile */
    .dashboard-action-btns {
        width: 100%;
        flex-direction: column;
        gap: 12px;
        box-sizing: border-box;
    }

    /* Ensure filters span full width properly inside container */
    .dash-filter-form {
        width: 100%;
        display: flex;
        gap: 8px;
        box-sizing: border-box;
    }

    /* Make selects share space evenly without pushing the button out */
    .filter-select {
        flex: 1 1 0; /* Allows flexible shrinking and growing */
        min-width: 0; /* Prevents native select overflow */
        padding: 8px 6px;
    }

    .btn-filter-apply {
        padding: 8px 14px;
    }
}

/* ==========================================================================
   5. DASHBOARD STATISTICAL CORE GRID MODALITY
   ========================================================================== */
.analytics-metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.metric-card-box {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 24px;
    box-shadow: var(--card-shadow);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.metric-label-heading {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-numerical-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-dark);
    margin-top: 14px;
    letter-spacing: -0.5px;
}

.metric-subtext-detail {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 8px;
}

.metric-icon-box {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background-color: var(--sidebar-hover-bg);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

/* Active Highlight Color Styling mapping screenshot */
.metric-card-box:nth-child(1) .metric-icon-box {
    background-color: var(--primary-bg);
    color: var(--primary);
}

.metric-card-box:nth-child(2) .metric-icon-box,
.metric-card-box:nth-child(3) .metric-icon-box,
.metric-card-box:nth-child(4) .metric-icon-box {
    background-color: var(--sidebar-border);
    color: var(--sidebar-text);
}

/* ==========================================================================
   6. SPLIT DISPLAY MODULES (CHARTS & FEED LOGS)
   ========================================================================== */
.workspace-split-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

/* Professional White Layout Framework Card Units */
.content-card-panel {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 24px;
    box-shadow: var(--card-shadow);
}

.card-panel-header {
    margin-bottom: 24px;
}

.card-panel-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card-panel-heading {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-dark);
    margin-top: 4px;
}

/* Chart Distribution Container Layouts */
.chart-placeholder-container {
    height: 260px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.donut-chart-mock {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: conic-gradient(var(--primary) 0% 60%, var(--text-dark) 60% 100%);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.donut-chart-mock::before {
    content: '';
    position: absolute;
    width: 105px;
    height: 105px;
    background-color: var(--white);
    border-radius: 50%;
}

.chart-legend-box {
    display: flex;
    gap: 16px;
    margin-top: 30px;
    font-size: 13px;
    font-weight: 500;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.legend-color-dot {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

.dot-construction {
    background-color: var(--text-dark);
}

.dot-planning {
    background-color: var(--primary);
}

/* System Action Log Activity Feed */
.activity-logs-container {
    max-height: 270px;
    overflow-y: auto;
    padding-right: 4px;
}

.activity-logs-feed {
    list-style: none;
}

.feed-item-row {
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.feed-item-row:last-child {
    border-bottom: none;
}

.status-dot-indicator {
    width: 8px;
    height: 8px;
    background-color: var(--primary);
    border-radius: 50%;
    margin-top: 5px;
    flex-shrink: 0;
}

.feed-item-content {
    flex: 1;
}

.feed-item-text {
    font-size: 13px;
    color: var(--sidebar-text);
    line-height: 1.4;
}

.feed-item-text span {
    font-weight: 600;
    color: var(--text-dark);
}

.feed-item-timestamp {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ==========================================================================
   7. FOOTER QUICK NAV SECTIONS 
   ========================================================================== */
.quick-navigation-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-top: 20px;
}

.nav-matrix-anchor {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    text-decoration: none;
    color: var(--text-dark);
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    box-shadow: var(--card-shadow);
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.nav-matrix-anchor:hover {
    border-color: var(--sidebar-border);
    background-color: var(--sidebar-hover-bg);
}

.matrix-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.matrix-counter {
    font-size: 24px;
    font-weight: 700;
    margin-top: 8px;
    color: var(--text-dark);
}

.matrix-arrow-icon {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

/* ==========================================================================
   8. SECONDARY MANAGING WORKSPACES STYLING (PRESERVED & CORRECTED)
   ========================================================================== */
.card {
    background: var(--white);
    border-radius: 8px;
    border: 1px solid var(--border);
    box-shadow: var(--card-shadow);
    margin-bottom: 30px;
    overflow: hidden;
}

.card-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    color: var(--text-dark);
    font-size: 16px;
    font-weight: 700;
    background: var(--white);
}

.card-body {
    padding: 24px;
}

.padding-24 {
    padding: 24px;
}

/* Data Table Presentation Engine */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background-color: var(--sidebar-hover-bg);
    color: var(--text-muted);
    font-weight: 700;
    text-align: left;
    padding: 14px 20px;
    font-size: 12px;
    text-transform: uppercase;
    border-bottom: 2px solid var(--border);
}

td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    color: var(--sidebar-text);
    vertical-align: middle;
}

tr:hover td {
    background-color: var(--sidebar-hover-bg);
}

/* Input Form Controls Layouts */
.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.form-group {
    flex: 1;
    min-width: 200px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
}

.form-control {
    width: 100%;
    height: 42px;
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--white);
    font-size: 14px;
    color: var(--text-dark);
    outline: none;
    transition: border-color 0.15s ease;
}

.form-control:focus {
    border-color: var(--primary);
}

#serviceGrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
    margin-top: 12px;
}

.service-card {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px 16px;
    background-color: var(--white);
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    position: relative;
    user-select: none;
    gap: 5px;
}

.service-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.service-card-header input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}


.service-card-desc-wrapper {
    width: 100%;
    padding: 0 4px;
}

.service-rate-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    justify-content: space-between;
}

.service-rate-wrapper label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

.rate-input-card {
    width: 90px;
    height: 32px;
    padding: 4px 8px;
    font-size: 13px;
    border: 1px solid var(--border);
    border-radius: 4px;
    text-align: right;
    background-color: var(--white);
    outline: none;
    transition: border-color 0.2s ease;
}

.rate-input-card:focus {
    border-color: var(--primary);
}

.summary-box {
    width: 320px;
    margin-left: auto;
    /* Aligns the box to the right side */
    padding: 20px;
    border-top: 2px solid var(--border);
    margin-top: 20px;
    background: var(--sidebar-hover-bg);
    border-radius: 6px;
    max-width: 350px;
}

/* Individual rows for clean alignment */
.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    font-size: 16px;
    /* Slightly larger base font size */
    color: var(--sidebar-text);
}

/* Specific styling for the Total row to make it prominent */
.total-row {
    border-top: 1px solid var(--border);
    margin-top: 10px;
    padding-top: 15px;
    font-weight: 700;
    /* Bold */
    font-size: 20px;
    /* Larger font size for the final total */
    color: var(--primary);
    /* Primary brand color */
}

.total-row span {
    font-weight: 800;
}

.calculation-summary-block {
    background: var(--light-bg);
    padding: 20px;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.summary-total-row {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border);
    font-size: 18px;
    font-weight: 700;
}

/* Unified Layout Control Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    border: 1px solid transparent;
    text-decoration: none;
    transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.btn-primary {
    background-color: var(--primary);
    color: var(--white);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-secondary {
    background-color: var(--white);
    color: var(--text-dark);
    border-color: var(--border);
    box-shadow: var(--card-shadow);
}

.btn-secondary:hover {
    background-color: var(--sidebar-hover-bg);
}

.btn-success {
    background-color: var(--success);
    color: var(--white);
}

.btn-danger {
    background-color: var(--danger);
    color: var(--white);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 4px;
}

.btn-info {
    color: #b82d18;
    /* Dark primary tone for crisp legibility */
    background-color: var(--primary-bg);
    /* Soft tint derived from primary variable */
    border-color: #f7ccc5;
    /* Subtle matching border */
}

.btn-info:hover {
    color: var(--white);
    /* White text on hover */
    background-color: var(--primary);
    /* Primary Color */
    border-color: var(--primary);
    box-shadow: 0 4px 10px rgba(233, 75, 53, 0.3);
    /* Primary glow */
}

.btn-blueprint {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
    border: 1px solid transparent;
}

.btn-blueprint-primary {
    background-color: var(--primary);
    color: var(--white);
}

.btn-blueprint-primary:hover {
    background-color: var(--primary-hover);
}

.btn-blueprint-outline {
    background-color: var(--white);
    color: var(--text-dark);
    border-color: var(--border);
    box-shadow: var(--card-shadow);
}

.btn-blueprint-outline:hover {
    background-color: var(--light-bg);
}

/* Feedback Status Alerts */
.alert {
    padding: 14px 20px;
    border-radius: 6px;
    margin-bottom: 24px;
    font-size: 14px;
    font-weight: 500;
}

.alert-success {
    background: var(--success-bg);
    color: #039855;
    border: 1px solid #b4eed0;
}

.alert-danger {
    background: var(--danger-bg);
    color: #d92d20;
    border: 1px solid #f8b4b4;
}

/* Secure Gateway Session Auth Styling */
.login-view-wrapper {
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--light-bg);
}

.login-structural-card {
    width: 420px;
    background: var(--white);
    border-radius: 12px;
    border: 1px solid var(--border);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.login-branding-header {
    background: #111418;
    padding: 35px 30px;
    text-align: center;
    border-bottom: 4px solid var(--primary);
}

.login-branding-header i {
    font-size: 36px;
    color: var(--primary);
    margin-bottom: 12px;
}

.login-branding-header h2 {
    color: var(--white);
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 1px;
}

.login-branding-header p {
    color: var(--text-muted);
    font-size: 12px;
    margin-top: 5px;
}

.login-form-body {
    padding: 35px 30px;
}

.login-form-body .form-group {
    margin-bottom: 20px;
}

/* ==========================================================================
   9. MOBILE & TABLET DURABILITY BREAKPOINTS
   ========================================================================== */

    .mobile-toggle-btn {
        width: 40px;
        height: 40px;
        display: flex;
        position: fixed;
        top: 15px;
        left: 15px;
        z-index: 99;
        /* Higher than main content, but lower than an active sidebar */
        background-color: var(--primary);
        color: var(--white);
        border: none;
        padding: 10px 14px;
        border-radius: 6px;
        cursor: pointer;
        align-items: center;
        justify-content: center;
        font-size: 18px;
        box-shadow: var(--card-shadow);
        transition: background-color 0.3s ease, box-shadow 0.3s ease;
    }

@media (max-width: 1200px) {

    .analytics-metrics-grid,
    .quick-navigation-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 1024px) {
    .services-grid {
        grid-template-columns: repeat(2, 1fr);
        /* 2 columns on tablets */
    }
}

@media (max-width: 600px) {
    .services-grid {
        grid-template-columns: 1fr;
        /* 1 column on mobile */
    }
}

@media (max-width: 992px) {
    .workspace-split-row {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: -280px;
        /* Hidden off-screen by default */
        width: 280px;
        height: 100vh;
        z-index: 1000;
        /* High z-index ensures it sits completely over the toggle button */
        transition: transform 0.3s ease, left 0.3s ease;
        box-shadow: none;
    }

    /* When the sidebar becomes active */
    .sidebar.active {
        left: 0;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
    }

    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 24px 16px;
        padding-top: 75px;
    }

    .topbar {
        margin: -24px -16px 24px -16px;
        padding: 0 16px 0 60px;
    }
}

@media (max-width: 576px) {

    .analytics-metrics-grid,
    .quick-navigation-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-title-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .action-btn-group {
        width: 100%;
        margin-top: 10px;
    }

    .action-btn-group .btn {
        flex-grow: 1;
    }

    .form-row {
        flex-direction: column;
        gap: 14px;
    }

    .form-group {
        width: 100%;
    }
}

/* ==========================================================================
   10. INDEX / DASHBOARD COMPONENT EXTENDED STYLES
   ========================================================================== */

/* Page Header Title Row */
.dashboard-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.dashboard-header-title {
    margin: 0;
    font-size: 26px;
    font-weight: 800;
    color: var(--text-dark);
}

.dashboard-header-subtext {
    margin: 4px 0 0 0;
    font-size: 13px;
    color: var(--text-muted);
}

.dashboard-action-btns {
    display: flex;
    gap: 10px;
}

/* Button Custom Modifiers */
.btn-dash-primary {
    background-color: var(--primary);
    border-color: var(--primary);
    font-weight: 600;
    padding: 10px 18px;
    border-radius: 6px;
    text-decoration: none;
    color: var(--white);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-dash-secondary {
    background-color: #f1f5f9;
    color: #334155;
    border: 1px solid #cbd5e1;
    font-weight: 600;
    padding: 10px 18px;
    border-radius: 6px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* Extended Analytics Cards Grid */
.dashboard-metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    margin-bottom: 30px;
}

.dashboard-metric-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.dashboard-metric-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.dashboard-metric-value {
    font-size: 26px;
    font-weight: 800;
    color: var(--text-dark);
    margin: 6px 0 2px 0;
}

.dashboard-metric-subtext {
    font-size: 12px;
    color: var(--text-muted);
}

.dashboard-metric-icon {
    width: 46px;
    height: 46px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

/* Metric Icon Color Variants */
.icon-active-projects {
    background: #eff6ff;
    color: #2563eb;
}

.icon-success {
    background: var(--success-bg);
    color: var(--success);
}

.icon-danger {
    background: var(--danger-bg);
    color: var(--danger);
}

.icon-billed {
    background: var(--sidebar-hover-bg);
    color: var(--sidebar-text);
}

/* Dashboard Split Workspace */
.dashboard-split-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 35px;
}

.dashboard-panel-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 22px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.dashboard-panel-header {
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 12px;
}

.dashboard-panel-subheader {
    margin-top: 15px;
}

.dashboard-panel-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dashboard-panel-heading {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-dark);
    margin-top: 2px;
}

/* Portfolio Analysis Component */
.portfolio-summary-wrapper {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.progress-info-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--sidebar-text);
}

.progress-bar-bg {
    width: 100%;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--success);
}

.portfolio-stat-row {
    display: flex;
    justify-content: space-between;
    padding: 12px;
    background: var(--sidebar-hover-bg);
    border-radius: 6px;
}

.portfolio-stat-label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

.portfolio-stat-value {
    color: var(--text-dark);
    font-size: 14px;
}

/* Activity Audit Feed Component */
.audit-logs-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.audit-log-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.audit-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-top: 6px;
    flex-shrink: 0;
}

.dot-invoice {
    background-color: var(--primary);
}

.dot-quotation {
    background-color: var(--warning);
}

.dot-project {
    background-color: var(--success);
}

.dot-expense {
    background-color: var(--danger);
}

.audit-log-text {
    font-size: 13px;
    color: var(--sidebar-text);
    font-weight: 500;
}

.audit-log-highlight {
    font-weight: 700;
    color: var(--text-dark);
}

.audit-log-timestamp {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.audit-log-amount {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-dark);
}

.audit-log-empty {
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
    padding: 20px 0;
}

/* Quick Navigation Matrix */
.quick-nav-section-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.8px;
    text-transform: uppercase;
}

.quick-nav-section-title {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-dark);
    margin: 4px 0 15px 0;
}

.dashboard-quick-nav-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.dashboard-nav-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 18px;
    text-decoration: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.dashboard-nav-card:hover {
    border-color: #cbd5e1;
    background-color: var(--sidebar-hover-bg);
}

.dashboard-nav-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
}

.dashboard-nav-counter {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-dark);
    margin-top: 4px;
}

.dashboard-nav-subtext {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-dark);
    margin-top: 8px;
}

.dashboard-nav-icon {
    color: #cbd5e1;
    font-size: 16px;
}

/* ==========================================================================
   11. ENHANCED DASHBOARD & ANALYTICS EXTENDED STYLES
   ========================================================================== */

/* Welcome Banner Component */
.dash-welcome-banner {
    background: linear-gradient(135deg, #1e293b 0%, var(--text-dark) 100%);
    border-radius: 12px;
    padding: 24px 28px;
    color: var(--white);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

.dash-welcome-title {
    font-size: 24px;
    font-weight: 800;
    margin: 0;
    letter-spacing: -0.3px;
}

.dash-welcome-subtitle {
    margin: 6px 0 0 0;
    font-size: 14px;
    color: #94a3b8;
}

.dash-welcome-tag {
    display: inline-block;
    background: var(--white);
    color: var(--primary);
    font-size: 12px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Metric Text Color Overrides */
.text-success {
    color: var(--success) !important;
}

.text-danger {
    color: var(--danger) !important;
}

.text-primary {
    color: #2563eb !important;
}

/* Dashboard Recent Payments Component */
.recent-payments-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 15px;
}

.payment-item-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    background: var(--sidebar-hover-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
}

.payment-client-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-dark);
}

.payment-inv-code {
    font-size: 12px;
    color: var(--text-muted);
}

.payment-amount-val {
    font-size: 14px;
    font-weight: 800;
    color: var(--success);
    text-align: right;
}

.payment-date-subtext {
    font-size: 11px;
    color: var(--text-muted);
    text-align: right;
}

/* Quick Nav Matrix Extra Columns */
.dashboard-quick-nav-grid-6 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

/* ==========================================================================
   12. MOBILE RESPONSIVENESS FOR INDEX / DASHBOARD
   ========================================================================== */

/* Tablet & Smaller Laptops (under 992px) */
@media (max-width: 992px) {

    /* Stack split panels into a single column */
    .dashboard-split-row {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    /* Metric cards 2-column layout */
    .dashboard-metrics-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
    }

    /* Quick Nav 3-column layout */
    .dashboard-quick-nav-grid-6 {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }
}

/* Mobile Devices (under 768px) */
@media (max-width: 768px) {

    /* Welcome Banner vertical alignment */
    .dash-welcome-banner {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
        padding: 20px;
    }

    .dash-welcome-title {
        font-size: 20px;
    }

    .dash-welcome-subtitle {
        font-size: 13px;
    }

    /* Action buttons stretch to full width */
    .dashboard-action-btns {
        width: 100%;
        flex-direction: column;
        gap: 8px;
    }

    .dashboard-action-btns .btn-dash-primary,
    .dashboard-action-btns .btn-dash-secondary {
        width: 100%;
        justify-content: center;
        text-align: center;
        padding: 12px 14px;
    }

    /* Quick Nav 2-column layout */
    .dashboard-quick-nav-grid-6 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Small Mobile Screens (under 576px) */
@media (max-width: 576px) {

    /* Force metrics grid to single column on small phones */
    .dashboard-metrics-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .dashboard-metric-card {
        padding: 16px;
    }

    .dashboard-metric-value {
        font-size: 22px;
    }

    .dashboard-panel-card {
        padding: 16px;
    }

    /* Stack payment item row on extra tight screens */
    .payment-item-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .payment-item-card>div:last-child {
        text-align: left;
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-top: 1px dashed var(--border);
        padding-top: 6px;
    }

    .payment-amount-val,
    .payment-date-subtext {
        text-align: left;
    }

    /* Quick Nav 1-column layout for small mobile */
    .dashboard-quick-nav-grid-6 {
        grid-template-columns: 1fr;
    }

    /* Audit logs text sizing */
    .audit-log-item {
        gap: 10px;
    }

    .audit-log-text {
        font-size: 12px;
    }

    .audit-log-amount {
        font-size: 11px;
    }

    /* Stack Image and Content Vertically on Mobile Phones */
    .site-update-card {
        flex-direction: column;
        align-items: center; /* Centers items horizontally inside the card */
        text-align: center;   /* Keeps inner text aligned nicely if needed */
        gap: 12px;
    }

    .site-thumb-box {
        margin: 0 auto;       /* Explicitly centers the thumbnail box */
        width: 140px;          /* Adjusted width for clean square display */
        height: 140px;
    }

    .site-update-header {
        flex-direction: column;
        align-items: center;  /* Centers title and badge vertically */
        justify-content: center;
        gap: 6px;
    }

    /* Stack Document Actions & Ensure Icon Layout Shrinks Cleanly */
    .doc-item-card {
        align-items: flex-start;
        position: relative;
        padding-right: 42px; /* Leaves room for shortcut icon on top-right */
    }

    .doc-action-shortcut {
        position: absolute;
        top: 14px;
        right: 12px;
    }
}

/* ==========================================================================
   13. CLIENT MANAGEMENT COMPONENT STYLES
   ========================================================================== */

/* Page Header & Action Bar */
.page-header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.page-title-text {
    margin: 0;
    font-size: 24px;
    font-weight: 800;
    color: var(--text-dark);
    letter-spacing: -0.3px;
}

.page-title-subtext {
    margin: 4px 0 0 0;
    font-size: 13px;
    color: var(--text-muted);
}

.search-filter-form {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.search-input-field {
    padding: 9px 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
    width: 280px;
    font-size: 14px;
    outline: none;
    background: var(--white);
    color: var(--text-dark);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-input-field:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-bg);
}

/* Alert Notification Banner */
.alert-banner-success {
    background-color: var(--success-bg);
    color: #0f5132;
    border: 1px solid #badbcc;
    padding: 12px 18px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Data Table Wrapper & Structural Design */
.data-table-container {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--card-shadow);
    overflow: hidden;
    margin-bottom: 25px;
}

.responsive-table-scroll {
    overflow-x: auto;
    width: 100%;
}

.clients-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.clients-table th {
    background-color: var(--sidebar-hover-bg);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
}

.clients-table td {
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    color: var(--text-dark);
    vertical-align: middle;
}

.clients-table tr:last-child td {
    border-bottom: none;
}

.clients-table tr:hover {
    background-color: var(--sidebar-hover-bg);
}

/* Specific Table Cell Typography */
.client-name-bold {
    font-weight: 700;
    color: var(--text-dark);
}

.client-meta-subtext {
    font-size: 13px;
    color: var(--text-muted);
}

.invoice-count-badge {
    background-color: var(--sidebar-hover-bg);
    color: var(--sidebar-text);
    border: 1px solid var(--border);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
}

.amount-paid-text {
    color: var(--success);
    font-weight: 700;
}

.amount-pending-text {
    color: var(--danger);
    font-weight: 700;
}

.amount-settled-text {
    color: var(--text-muted);
    font-weight: 600;
}

.table-empty-row {
    padding: 35px !important;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
}

.action-buttons-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Custom Action Buttons */
.btn-action-edit {
    background-color: #f0f9ff;
    color: #0284c7;
    border: 1px solid #bae6fd;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.btn-action-edit:hover {
    background-color: #0284c7;
    color: var(--white);
    border-color: #0284c7;
}

.btn-action-delete {
    background-color: var(--danger-bg);
    color: var(--danger);
    border: 1px solid #fecdd3;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.btn-action-delete:hover {
    background-color: var(--danger);
    color: var(--white);
    border-color: var(--danger);
}

/* ========================================================
   Pagination Component
   ======================================================== */
.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin: 25px 0 10px 0;
    width: 100%;
    flex-wrap: wrap;
    font-family: var(--font-stack);
}

.pagination-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 12px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-dark);
    background-color: var(--white);
    border: 1px solid var(--border);
    border-radius: 6px;
    text-decoration: none;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
    box-shadow: var(--card-shadow);
}

/* Hover & Focus States */
.pagination-btn:hover:not(.disabled):not(.active) {
    background-color: var(--primary-bg);
    border-color: var(--primary-hover);
    color: var(--primary-hover);
    transform: translateY(-1px);
}

/* Active Page State */
.pagination-btn.active {
    background-color: var(--primary);
    border-color: var(--primary);
    color: var(--white);
    font-weight: 600;
    box-shadow: var(--box-shadow);
    cursor: default;
}

/* Prev & Next Button Styling */
.pagination-btn.pagination-nav {
    font-weight: 600;
    padding: 0 14px;
}

/* Disabled Prev/Next State */
.pagination-btn.disabled {
    color: var(--text-muted);
    background-color: var(--light-bg);
    border-color: var(--sidebar-border);
    cursor: not-allowed;
    opacity: 0.6;
    pointer-events: none;
    box-shadow: none;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    .page-header-container {
        flex-direction: column;
        align-items: stretch;
    }

    .search-filter-form {
        width: 100%;
    }

    .search-input-field {
        width: 100%;
    }
}

/* ==========================================================================
   14. INVOICE MANAGEMENT COMPONENT STYLES
   ========================================================================== */

/* Filter Bar Layout */
.invoice-filter-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 18px 20px;
    box-shadow: var(--card-shadow);
    margin-bottom: 25px;
}

.invoice-filter-form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 14px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    min-width: 160px;
}

.filter-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-control {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    color: var(--text-dark);
    background: var(--white);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    width: 100%;
}

.filter-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-bg);
}

.filter-action-btns {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Invoice Status Badge Custom Colors */
.badge-status {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.badge-status-paid {
    background-color: var(--success-bg);
    color: #0f5132;
    border: 1px solid #badbcc;
}

.badge-status-partially {
    background-color: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.badge-status-unpaid {
    background-color: var(--danger-bg);
    color: var(--danger);
    border: 1px solid #fecdd3;
}

.badge-status-cancelled {
    background-color: #f1f5f9;
    color: #64748b;
    border: 1px solid #cbd5e1;
}

.badge-status-draft {
    background-color: #f8fafc;
    color: #475569;
    border: 1px solid #e2e8f0;
}

/* Table Typography Extensions */
.invoice-number-bold {
    font-weight: 700;
    color: var(--text-dark);
    font-size: 14px;
}

.btn-action-pdf {
    background-color: #f8fafc;
    color: #475569;
    border: 1px solid #cbd5e1;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s;
}

.btn-action-pdf:hover {
    background-color: #475569;
    color: var(--white);
    border-color: #475569;
}

/* Mobile Responsive Adjustments for Invoices Page */
@media (max-width: 768px) {
    .invoice-filter-form {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-group {
        width: 100%;
        min-width: 100%;
    }

    .filter-action-btns {
        width: 100%;
        margin-top: 6px;
    }

    .filter-action-btns .btn-dash-primary,
    .filter-action-btns .btn-dash-secondary {
        flex: 1;
        justify-content: center;
    }
}

/* ==========================================================================
   15. QUOTATION MANAGEMENT COMPONENT STYLES
   ========================================================================== */

/* Quotation Status Badge Variants */
.badge-status-accepted {
    background-color: var(--success-bg);
    color: var(--success);
    border: 1px solid var(--success-border, #badbcc);
}

.badge-status-sent {
    background-color: var(--info-bg, #e0f2fe);
    color: var(--info, #0369a1);
    border: 1px solid var(--info-border, #bae6fd);
}

.badge-status-rejected {
    background-color: var(--danger-bg);
    color: var(--danger);
    border: 1px solid #fecdd3;
}

/* Action Button: Convert to Invoice */
.btn-action-convert {
    background-color: var(--success-bg);
    color: var(--success);
    border: 1px solid var(--success-border, #badbcc);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.btn-action-convert:hover {
    background-color: var(--success);
    color: var(--white);
    border-color: var(--success);
}

/* Project Meta Subtext in Table */
.project-meta-details {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 3px;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.project-meta-divider {
    color: var(--border);
}

/* ==========================================================================
   16. PAYMENT & COLLECTION MANAGEMENT STYLES
   ========================================================================== */

/* Alert Notification Banner - Danger Variant */
.alert-banner-danger {
    background-color: var(--danger-bg);
    color: var(--danger);
    border: 1px solid var(--danger-border, #f5c6cb);
    padding: 12px 18px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Card Container Components */
.payment-card {
    background: var(--white);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 25px;
    border: 1px solid var(--border);
    box-shadow: var(--card-shadow);
}

.payment-card-edit-accent {
    border-left: 4px solid var(--primary);
}

.logs-actions-wrapper {
    display: flex;
    align-items: center;
    gap: 15px;
}

.card-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
    flex-wrap: wrap;
    gap: 12px;
}

.card-heading-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-dark);
}

/* Form Layout System */
.form-row-grid {
    display: flex;
    gap: 15px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.form-group-col-1 {
    flex: 1;
    min-width: 160px;
}

.form-group-col-1-5 {
    flex: 1.5;
    min-width: 180px;
}

.form-group-col-2 {
    flex: 2;
    min-width: 250px;
}

.form-group-actions-align {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.form-input-readonly {
    background-color: var(--sidebar-hover-bg);
}

/* Custom Payment Badges */
.payment-method-badge {
    background: #dbeafe;
    color: #1e40af;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
}

.payment-method-badge-sm {
    display: inline-block;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 700;
    border-radius: 4px;
    background: #dbeafe;
    color: #1e40af;
    text-transform: uppercase;
}

.badge-category {
    background: #fef3c7;
    color: #92400e;
}

.logs-summary-badge {
    background-color: #f1f5f9;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 13px;
    color: var(--text-dark);
}

.logs-summary-divider {
    margin: 0 8px;
    color: var(--border);
}

.receipt-id-bold {
    font-weight: 700;
    color: var(--text-dark);
}

/* Align Right Utility for Action Cells */
.text-align-right {
    text-align: right;
}

/* ==========================================================================
   17. SERVICE & RATE CATALOG COMPONENT STYLES
   ========================================================================== */

/* Category Property Type Badges */
.badge-property-type {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    display: inline-block;
    letter-spacing: 0.3px;
}

.badge-type-residential {
    background-color: #f0fdf4;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.badge-type-commercial {
    background-color: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}

.badge-type-industrial {
    background-color: #f3e8ff;
    color: #6b21a8;
    border: 1px solid #e9d5ff;
}

.badge-type-default {
    background-color: #f8fafc;
    color: #475569;
    border: 1px solid #e2e8f0;
}

/* Rate Typography styling */
.rate-amount-text {
    color: var(--success);
    font-weight: 700;
    font-size: 14px;
}

.rate-unit-subtext {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-muted);
}

/* ==========================================================================
   18. USER ACCESS & ROLES COMPONENT STYLES
   ========================================================================== */

/* User Role Badges */
.badge-role-admin {
    background-color: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.badge-role-staff {
    background-color: #e0e7ff;
    color: #3730a3;
    border: 1px solid #c7d2fe;
}

.badge-role-manager {
    background-color: #e0f2fe;
    color: #0369a1;
    border: 1px solid #bae6fd;
}


/* User Form Subtext Helper */
.form-helper-text {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ==========================================================================
   19. COMPANY SETTINGS COMPONENT STYLES
   ========================================================================== */

/* Section Heading Cards */
.settings-section-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 25px;
    box-shadow: var(--card-shadow);
}

.settings-section-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.8px;
    text-transform: uppercase;
    margin-bottom: 18px;
}

/* Form Layout System for Settings */
.settings-form-row {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.settings-col-1 {
    flex: 1;
    min-width: 240px;
}

.settings-col-2 {
    flex: 2;
    min-width: 300px;
}

/* Logo Upload Component Styles */
.logo-upload-wrapper {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo-preview-box {
    width: 64px;
    height: 64px;
    background: var(--sidebar-hover-bg);
    border: 1px dashed var(--border);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.logo-preview-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.logo-placeholder-icon {
    font-size: 24px;
    color: var(--text-muted);
}

.logo-upload-input {
    display: none;
}

/* Settings Custom Textarea */
.settings-textarea {
    width: 100%;
    height: 200px;
    padding: 12px;
    font-size: 14px;
    line-height: 1.6;
    border: 1px solid var(--border);
    border-radius: 6px;
    resize: vertical;
    font-family: inherit;
    background-color: var(--white);
    color: var(--text-dark);
}

/* ==========================================================================
   21. ENHANCED PRINT & PDF RESPONSIVE TEMPLATE STYLES
   ========================================================================== */

/* Override global body display: flex to prevent side-by-side layout */
body.print-page-body {
    display: block !important;
    font-family: var(--font-stack);
    margin: 0;
    padding: 20px;
    color: var(--text-dark);
    background-color: var(--sidebar-hover-bg);
    min-height: 100vh;
}

.print-control-bar {
    width: 100%;
    max-width: 800px;
    margin: 0 auto 20px auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--text-dark);
    padding: 12px 20px;
    border-radius: 6px;
    color: var(--white);
}

.print-btn {
    background: var(--primary);
    color: var(--white);
    padding: 8px 18px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
}

.print-btn:hover {
    background: var(--primary-hover);
}

.document-container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    background: var(--white);
    border: 1px solid var(--border);
    padding: 45px 50px;
    border-radius: 4px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
}

.doc-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid var(--sidebar-hover-bg);
    padding-bottom: 25px;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 20px;
}

.brand-block {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Fixed Logo Size System */
.h-10 {
    height: 40px !important;
}
.h-60 {
    height: 60px !important;
}
.h-120 {
    height: 120px !important;
}

.w-auto {
    width: auto !important;
}

.print-logo-img {
    object-fit: contain;
    display: block;
}

.logo-box {
    background: var(--primary);
    color: var(--white);
    font-weight: 900;
    font-size: 20px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    letter-spacing: 1px;
}

.company-info h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1.2;
}

.company-info p {
    margin: 4px 0 0 0;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
}

.doc-title-box {
    text-align: right;
}

.doc-title-box .label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.doc-title-box .doc-no {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-dark);
    margin: 2px 0;
}

.doc-title-box .doc-date {
    font-size: 12px;
    color: var(--text-muted);
}

.meta-grid {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 24px;
    flex-wrap: wrap;
}

.meta-col {
    flex: 1;
    min-width: 240px;
}

.meta-label {
    font-size: 14px;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 0.8px;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.client-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 4px;
}

.meta-text {
    font-size: 13px;
    color: var(--text-muted);
    margin: 3px 0;
    line-height: 1.4;
}

/* Table Wrapper */
.print-table-wrapper {
    width: 100%;
    overflow-x: auto;
    margin-bottom: 30px;
}

.items-table {
    width: 100%;
    border-collapse: collapse;
}

.items-table th {
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    padding: 10px 8px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    vertical-align: middle;
}

.items-table td {
    padding: 12px 8px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-dark);
    vertical-align: middle;
}

.th-sr-col {
    width: 40px;
    text-align: center !important;
}

.th-service-col {
    text-align: left !important;
}

.th-area-col {
    text-align: right;
    width: 110px;
}

.th-rate-col {
    text-align: right;
    width: 110px;
}

.th-amount-col {
    text-align: right;
    width: 120px;
}

.td-service-name {
    font-weight: 500;
}

.td-text-right {
    text-align: right;
}

.td-amount-bold {
    text-align: right;
    font-weight: 600;
}

.totals-container {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 12px;
}

.totals-table {
    width: 280px;
    border-collapse: collapse;
}

.totals-table td {
    padding: 6px 8px;
    font-size: 13px;
    color: var(--text-muted);
}

.totals-table .amount-col {
    text-align: right;
    font-weight: 600;
    color: var(--text-dark);
}

.totals-table tr.grand-total-row td {
    border-top: 1px solid var(--border);
    padding-top: 10px;
    font-size: 16px;
    font-weight: 800;
}

.totals-table tr.grand-total-row .grand-amount {
    color: var(--primary);
}

.footer-section {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-top: 10px;
    padding-top: 5px;
    gap: 20px;
    flex-wrap: wrap;
}

.terms-block {
    flex: 1;
    min-width: 260px;
    max-width: 440px;
}

.terms-block h4 {
    font-size: 14px;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin: 0 0 8px 0;
}

.terms-content-text {
    font-size: 12px;
    color: var(--text-dark);
    line-height: 1.6;
}

.signature-block {
    text-align: center;
    min-width: 180px;
}

.signature-line {
    width: 180px;
    border-bottom: 1px solid var(--border);
    margin: 0 auto 8px auto;
}

.signature-label {
    font-size: 12px;
    color: var(--text-muted);
}

.print-btn-secondary {
    background: var(--sidebar-text) !important;
}

.print-btn-secondary:hover {
    background: var(--text-muted) !important;
}

.site-credit-footer {
    text-align: center;
    padding: 15px 20px;
    font-size: 15px;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    margin-top: 30px;
}

.site-credit-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.site-credit-footer a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* ==========================================================================
   QUOTATION & INVOICE LAYOUT COMPONENTS
   ========================================================================== */
.quote-card-section {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 25px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
    overflow: visible !important;
    position: relative;
}

.quote-section-header {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.8px;
    text-transform: uppercase;
    margin-bottom: 16px;
}

.quote-field-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
}

.quote-field-wrapper:last-of-type {
    margin-bottom: 0;
}

.quote-form-group {
    flex: 1;
    min-width: 200px;
}

.quote-form-group.wide {
    min-width: 280px;
    position: relative;
    overflow: visible !important;
}

.quote-field-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 6px;
}

.quote-area-highlight {
    font-weight: 700;
    color: var(--primary);
}

.quote-number-readonly {
    background: var(--sidebar-hover-bg) !important;
}

/* Service Card Selection Grid Matrix */
#serviceGrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.service-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.service-card:hover {
    border-color: var(--text-muted);
    background: var(--sidebar-hover-bg);
}

.service-card.selected {
    border-color: var(--primary);
    background-color: var(--primary-bg);
    box-shadow: 0 0 0 1px var(--primary);
}

.service-card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
    flex-grow: 1;
    min-width: 0;
    overflow-wrap: break-word;
    word-break: break-word;
}

/* Financial Invoice Summary Panels */
.summary-split-layout {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
}

.summary-table-pane {
    flex: 1.5;
    min-width: 300px;
}

.summary-calc-pane {
    flex: 1;
    min-width: 280px;
    background: var(--sidebar-hover-bg);
    padding: 16px;
    border-radius: 6px;
    border: 1px solid var(--border);
}

.summary-calc-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 14px;
}

.summary-calc-row.muted {
    font-size: 13px;
    color: var(--text-muted);
}

.summary-calc-row.danger {
    color: var(--danger);
}

.summary-calc-row.success {
    color: var(--success);
}

.summary-grand-total {
    display: flex;
    justify-content: space-between;
    font-size: 16px;
    font-weight: 700;
    color: var(--primary);
}

/* --------------------------------------------------------------------------
   DATABASE SEARCHABLE SELECT CUSTOM COMPONENT
   -------------------------------------------------------------------------- */
.searchable-select-container {
    position: relative;
    width: 100%;
}

.searchable-select-input {
    /* Note: SVG fill kept as literal hex to maintain browser background-image support */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23667085'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 14px center !important;
    background-size: 16px !important;
    cursor: pointer;
}

.searchable-dropdown-menu {
    position: absolute;
    top: 102%;
    left: 0;
    width: 100%;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(16, 24, 40, 0.08);
    z-index: 999;
    max-height: 250px;
    overflow-y: auto;
    display: none;
}

.searchable-dropdown-search-box {
    position: sticky;
    top: 0;
    background: var(--white);
    padding: 8px;
    border-bottom: 1px solid var(--border);
    z-index: 10;
}

.searchable-dropdown-search-box input {
    width: 100%;
    height: 36px;
    padding: 6px 12px;
    font-size: 13px;
    border: 1px solid var(--border);
    border-radius: 4px;
    outline: none;
}

.searchable-dropdown-search-box input:focus {
    border-color: var(--primary);
}

.searchable-dropdown-option {
    padding: 10px 14px;
    font-size: 14px;
    color: var(--text-dark);
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.searchable-dropdown-option:hover {
    background-color: var(--sidebar-hover-bg);
    color: var(--primary);
}

.searchable-dropdown-option.no-results {
    color: var(--text-muted);
    text-align: center;
    cursor: default;
    background: transparent !important;
}


/* ==========================================================================
   MOBILE-RESPONSIVE MILESTONE WORKSPACE & ADJUSTMENTS
   ========================================================================== */

.invoice-card-section {
    margin-bottom: 25px;
    overflow: visible !important;
    position: relative;
}

.invoice-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.invoice-header-title h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0;
}

.invoice-header-title p {
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 4px;
}

.invoice-section-heading {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.8px;
    text-transform: uppercase;
    margin-bottom: 16px;
}

.invoice-flex-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.invoice-flex-row.mb-20 {
    margin-bottom: 20px;
}

.invoice-col-large {
    position: relative;
    overflow: visible !important;
    flex: 1;
    min-width: 280px;
}

.invoice-col-small {
    flex: 1;
    min-width: 180px;
}

.invoice-field-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 6px;
}

.form-control-readonly {
    background: var(--sidebar-hover-bg) !important;
}

.form-control-highlight {
    font-weight: 700;
    color: var(--primary) !important;
}

.summary-split-row {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
}

.summary-table-side {
    flex: 1.5;
    min-width: 300px;
}

.summary-ledger-side {
    flex: 1;
    min-width: 280px;
    background: var(--sidebar-hover-bg);
    padding: 16px;
    border-radius: 6px;
    border: 1px solid var(--border);
}

.summary-items-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.summary-items-table th {
    border-bottom: 2px solid var(--border);
    /* text-align: left;*/
    color: var(--text-muted);
    padding: 8px 0;
}

.summary-items-table td {
    padding: 10px;
    border-bottom: 1px solid var(--border);
}

.summary-items-table td.text-right {
    text-align: right;
}

.ledger-entry-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 14px;
}

.ledger-entry-row.align-center {
    align-items: center;
}

.ledger-entry-row.discount-negative {
    font-size: 13px;
    color: var(--danger);
}

.ledger-entry-row.gst-positive {
    font-size: 13px;
    color: var(--success);
}

.ledger-entry-row label {
    font-size: 13px;
    color: var(--text-muted);
}

.ledger-entry-row input {
    width: 90px;
    height: 32px;
    text-align: right;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 2px 6px;
}

.ledger-entry-row.grand-total {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 15px;
}

.ledger-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 12px 0;
}

.payment-collection-box {
    background: var(--white);
    border: 1px solid var(--border);
    padding: 12px;
    border-radius: 6px;
}

.payment-collection-box input {
    width: 110px;
    height: 32px;
    text-align: right;
    border: 1px solid var(--success);
    border-radius: 4px;
    padding: 2px 6px;
    font-weight: 700;
    color: var(--success);
}

.payment-collection-box .balance-due-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 700;
    color: var(--danger);
}

.milestones-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.milestones-header-row .aggregate-metric {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}

.milestones-header-row .aggregate-metric span {
    color: var(--primary);
    font-weight: 700;
}

/* Base Desktop Table Structure */
.milestones-data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin-bottom: 15px;
}

.milestones-data-table th {
    background: var(--sidebar-hover-bg);
    border-bottom: 2px solid var(--border);
    text-align: left;
    color: var(--text-muted);
    padding: 12px 10px;
}

.milestones-data-table td {
    padding: 10px 8px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.milestones-input-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
}

.milestones-data-table input.height-36,
.milestones-data-table select.height-36 {
    height: 36px;
}

.milestones-data-table input.ms-pct {
    text-align: right;
    max-width: 90px;
}

.milestones-data-table input.ms-amt {
    text-align: right;
    background: var(--sidebar-hover-bg);
    font-weight: 600;
    max-width: 140px;
}

.invoice-form-actions {
    text-align: right;
    margin-bottom: 40px;
}

/* Fluid Mobile Adaptation Configuration */
@media (max-width: 768px) {
    .milestones-data-table thead {
        display: none;
    }

    .milestones-data-table tbody tr {
        display: block;
        background: var(--sidebar-hover-bg);
        border: 1px solid var(--border);
        border-radius: 8px;
        padding: 16px;
        margin-bottom: 16px;
    }

    .milestones-data-table tbody td {
        display: flex;
        flex-direction: column;
        padding: 6px 0;
        border-bottom: none;
        width: 100% !important;
        text-align: left !important;
    }

    .milestones-data-table tbody td::before {
        content: attr(data-label);
        font-size: 11px;
        font-weight: 700;
        color: var(--text-muted);
        text-transform: uppercase;
        margin-bottom: 4px;
        letter-spacing: 0.5px;
    }

    .milestones-data-table input.ms-pct,
    .milestones-data-table input.ms-amt {
        max-width: 100%;
        text-align: left;
    }

    .milestones-input-wrapper {
        width: 100%;
    }

    .milestones-input-wrapper input {
        flex: 1;
    }

    .milestones-data-table tbody td.mobile-action-align {
        align-items: flex-end;
        margin-top: 4px;
        padding-top: 10px;
        border-top: 1px dashed var(--border);
    }


    .logs-summary-badge {
        width: 100%;
        justify-content: center;
        /* Centers the summary text */
        text-align: center;
    }

    .btn-print-export {
        width: 100%;
        /* Makes the button easy to tap */
        justify-content: center;
        margin-left: 0 !important;
        /* Removes the side margin */
    }
}

/* ==========================================================================
   SEARCHABLE CLIENT SELECT DROPDOWN COMPONENT
   ========================================================================== */
.custom-dropdown-container {
    position: relative;
    width: 100%;
}

.custom-dropdown-container.dropdown-active {
    z-index: 1100;
}

.dropdown-trigger-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px 14px;
    font-size: 14px;
    min-height: 40px;
    box-sizing: border-box;
}

.dropdown-trigger-box i {
    color: var(--text-muted);
    font-size: 12px;
    transition: transform 0.2s ease;
}

.custom-dropdown-container.dropdown-active .dropdown-trigger-box i {
    transform: rotate(180deg);
}

.dropdown-search-panel {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-top: 4px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    z-index: 1200;
    max-height: 280px;
    flex-direction: column;
}

.custom-dropdown-container.dropdown-active .dropdown-search-panel {
    display: flex;
}

.dropdown-search-wrapper {
    padding: 8px;
    border-bottom: 1px solid var(--border);
    background: var(--sidebar-hover-bg);
    border-top-left-radius: 6px;
    border-top-right-radius: 6px;
}

.dropdown-search-field {
    width: 100%;
    height: 36px;
    padding: 0 12px;
    font-size: 13px;
    border: 1px solid var(--border);
    border-radius: 4px;
    outline: none;
    box-sizing: border-box;
}

.dropdown-search-field:focus {
    border-color: var(--primary);
}

.dropdown-options-list {
    overflow-y: auto;
    max-height: 200px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.dropdown-option-item {
    padding: 10px 14px;
    font-size: 13px;
    color: var(--text-dark);
    cursor: pointer;
    transition: background 0.15s ease;
    border-bottom: 1px solid var(--sidebar-hover-bg);
}

.dropdown-option-item:last-child {
    border-bottom: none;
}

.dropdown-option-item:hover {
    background: var(--sidebar-hover-bg);
}

.dropdown-option-item.client-highlighted {
    background: var(--primary-bg) !important;
    color: var(--primary) !important;
    font-weight: 700;
    border-left: 3px solid var(--primary);
}

.dropdown-no-results {
    padding: 14px;
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
}

/* ==========================================================================
   OPTIMIZED CORE PROJECTS MODULE STYLES
   ========================================================================== */

.page-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 12px;
}

.page-title-heading h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0 0 6px 0;
    font-family: var(--font-stack);
}

.page-title-heading p {
    color: var(--text-muted);
    font-size: 14px;
    margin: 0;
    font-family: var(--font-stack);
}

.btn-add-action {
    background-color: var(--primary);
    color: var(--white) !important;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: none;
    cursor: pointer;
    font-family: var(--font-stack);
    transition: background-color 0.2s ease;
}

.btn-add-action:hover {
    background-color: var(--primary-hover);
}

/* Custom Uniform Dropdown Select UI */
.custom-dropdown-container {
    position: relative;
    width: 100%;
}

.dropdown-trigger-box {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px 14px;
    font-size: 14px;
    color: var(--sidebar-text);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    min-height: 40px;
}

.dropdown-search-panel {
    display: none;
    position: absolute;
    top: 102%;
    left: 0;
    width: 100%;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    z-index: 999;
}

.dropdown-active .dropdown-search-panel {
    display: block;
}

.dropdown-search-wrapper {
    padding: 8px;
    border-bottom: 1px solid var(--sidebar-border);
}

.dropdown-search-field {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 13px;
    box-sizing: border-box;
}

.dropdown-options-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 200px;
    overflow-y: auto;
}

.dropdown-option-item {
    padding: 10px 14px;
    font-size: 13px;
    color: var(--sidebar-text);
    cursor: pointer;
}

.dropdown-option-item:hover,
.client-highlighted {
    background: var(--sidebar-hover-bg);
    color: var(--primary);
    font-weight: 600;
}

/* Stage Photo Element */
.monitor-photo-preview-box {
    width: 42px;
    height: 42px;
    border-radius: 4px;
    border: 1px solid var(--border);
    background: var(--sidebar-hover-bg);
    background-size: cover;
    background-position: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    overflow: hidden;
    position: relative;
}

.monitor-photo-preview-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hidden-file-input {
    display: none !important;
}

/* Project Summary Dashboard */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.project-summary-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    text-decoration: none;
    color: inherit;
    display: block;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.project-summary-card:hover {
    border-color: var(--primary);
    box-shadow: var(--card-shadow);
}

.project-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.project-badge-stage {
    background: var(--sidebar-hover-bg);
    border: 1px solid var(--border);
    color: var(--sidebar-text);
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
}

.project-badge-type {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.project-card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0 0 4px 0;
}

.project-card-client {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.project-progress-track {
    background: var(--sidebar-hover-bg);
    height: 6px;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 14px;
    margin-top: 5px;
}

.project-progress-fill {
    background: var(--primary);
    height: 100%;
    transition: width 0.3s ease;
}

/* Document Repository */
.doc-history-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 6px;
}

.doc-history-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--sidebar-border);
    font-size: 13px;
    vertical-align: middle;
}

.doc-history-table tr:last-child td {
    border-bottom: none;
}

/* Pipeline Modules */
.project-container-fluid {
    padding: 24px;
}

.flex-gap-12 {
    display: flex;
    gap: 12px;
}

.flex-gap-24 {
    display: flex;
    gap: 24px;
}

.flex-align-center-gap-16 {
    display: flex;
    align-items: center;
    gap: 16px;
}

.flex-align-center-gap-12 {
    display: flex;
    align-items: center;
    gap: 12px;
}

.flex-1 {
    flex: 1;
}

.grid-col-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

/* Notification Banners */
.audit-footprint-banner {
    background: var(--light-bg);
    border: 1px solid var(--border);
    padding: 10px 16px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    gap: 24px;
}

.alert-toast-success {
    background: var(--success-bg);
    border: 1px solid var(--success);
    color: var(--success);
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 600;
}

/* Metrics Cards */
.metric-param-card {
    background: var(--white);
    border: 1px solid var(--border);
    padding: 16px;
    border-radius: 6px;
}

.metric-param-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
}

.metric-select-field,
.metric-input-field {
    margin-top: 6px;
    height: 38px;
}

.metric-progress-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-dark);
    margin-top: 4px;
}

.metric-progress-track-wrapper {
    margin: 6px 0 0 0;
}

/* Master Form Components */
.master-profile-section {
    background: var(--white);
    border: 1px solid var(--border);
    padding: 24px;
    border-radius: 6px;
    margin-bottom: 24px;
}

.margin-bottom-16 {
    margin-bottom: 16px;
}

.quote-form-group.wide.overflow-visible {
    position: relative;
    overflow: visible !important;
}

/* Milestone Matrix */
.construction-matrix-heading {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0 0 16px 0;
}

.monitor-stage-row {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 14px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.monitor-stage-title {
    font-weight: 700;
    color: var(--sidebar-text-active);
    font-size: 14px;
}

.monitor-status-badge {
    margin-left: 0;
    margin-top: 4px;
    display: inline-block;
    padding: 2px 6px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 3px;
}

.stage-status-dropdown {
    width: 130px;
    height: 36px;
    padding: 4px 8px;
}

.stage-date-input {
    height: 36px;
    width: 140px;
}

.btn-upload-trigger {
    background: var(--sidebar-hover-bg);
    border: 1px solid var(--border);
    height: 36px;
    padding: 0 12px;
    border-radius: 4px;
    color: var(--sidebar-text);
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* Vault Area */
.document-repository-vault {
    background: var(--white);
    border: 1px solid var(--border);
    padding: 24px;
    border-radius: 6px;
    margin-bottom: 40px;
}

.document-upload-bar {
    background: var(--sidebar-hover-bg);
    border: 1px solid var(--border);
    padding: 16px;
    border-radius: 6px;
    margin-bottom: 20px;
}

.document-input-row {
    display: flex;
    gap: 16px;
    align-items: center;
}

.document-text-field {
    height: 40px;
}

.document-file-field {
    padding: 6px;
    height: 40px;
}

.btn-commit-action {
    height: 40px;
    padding: 0 24px;
}

.doc-history-header-row {
    background: var(--sidebar-hover-bg);
    font-weight: 700;
    color: var(--sidebar-text);
}

.doc-history-table td.width-80-center {
    width: 80px;
    text-align: center;
}

.doc-history-table td.width-120-center {
    width: 120px;
    text-align: center;
}

.doc-version-tag {
    background: var(--sidebar-border);
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 700;
    color: var(--sidebar-text);
}

.doc-reference-title {
    color: var(--text-dark);
    font-size: 14px;
}

.doc-asset-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.doc-uploader-meta {
    color: var(--text-muted);
    font-size: 12px;
}

.doc-status-badge {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
}

/* Grid Overrides */
.projects-grid-empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-muted);
}

.projects-grid-empty-icon {
    font-size: 32px;
    margin-bottom: 12px;
    color: var(--border);
}

.projects-grid-empty-text {
    margin: 0;
    font-size: 14px;
}

.project-card-metrics-row {
    margin-top: 14px;
}

.project-card-progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.project-card-progress-value-text {
    color: var(--text-dark);
}

.project-card-footer-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--sidebar-border);
    padding-top: 12px;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 12px;
}

.project-card-footer-icon {
    margin-right: 4px;
}

/* ==========================================================================
   Full-Screen Image Preview Modal Component
   ========================================================================== */

/* Preview Hover & Trigger Overlay Context */
.monitor-photo-preview-box {
    position: relative;
    overflow: hidden;
}

.monitor-photo-preview-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.preview-trigger-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(16, 24, 40, 0.6);
    /* Mapped to dark theme */
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
    cursor: pointer;
    border-radius: inherit;
    z-index: 2;
}

.monitor-photo-preview-box:hover .preview-trigger-overlay {
    opacity: 1;
}

.btn-preview-view-action {
    background: var(--white);
    color: var(--text-dark);
    border: none;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    box-shadow: var(--card-shadow);
    transform: translateY(4px);
    transition: transform 0.2s ease-in-out;
}

.monitor-photo-preview-box:hover .btn-preview-view-action {
    transform: translateY(0);
}

/* Modal Core Overlay Background Structure */
.preview-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(16, 24, 40, 0.9);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    opacity: 0;
    transition: opacity 0.25s ease-in-out;
}

.preview-modal-overlay.active {
    display: flex;
    opacity: 1;
}

/* Modal Content Wrapper & Responsive Bounds */
.preview-modal-wrapper {
    position: relative;
    max-width: 90vw;
    max-height: 85vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-modal-viewport-img {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transform: scale(0.95);
    transition: transform 0.25s ease-in-out;
}

.preview-modal-overlay.active .preview-modal-viewport-img {
    transform: scale(1);
}

/* Absolute Close Button Architecture */
.btn-preview-modal-close {
    position: absolute;
    top: -45px;
    right: 0;
    background: rgba(255, 255, 255, 0.15);
    color: var(--white);
    border: 1px solid rgba(255, 255, 255, 0.25);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.2s ease, transform 0.2s ease;
}

.btn-preview-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

/* Responsive Grid & Content Pipeline Adaptation */
@media screen and (max-width: 1024px) {
    .grid-col-4 {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 16px !important;
    }
}

@media screen and (max-width: 768px) {
    .project-container-fluid {
        padding: 16px 12px !important;
    }

    .page-title-row {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 16px !important;
    }

    .page-title-row .flex-gap-12 {
        width: 100% !important;
        justify-content: flex-start !important;
    }

    .grid-col-4 {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    .quote-field-wrapper {
        flex-direction: column !important;
        gap: 16px !important;
        margin-bottom: 16px !important;
    }

    .quote-form-group.wide {
        width: 100% !important;
    }

    /* Construction Matrix Rows Transformation */
    .monitor-stage-row {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 14px !important;
        padding: 16px !important;
        border-radius: 8px !important;
        position: relative !important;
    }

    .monitor-photo-preview-box {
        width: 100% !important;
        height: 160px !important;
        max-width: none !important;
    }

    .monitor-photo-preview-box img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
    }

    .flex-align-center-gap-12 {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 10px !important;
        width: 100% !important;
    }

    .stage-status-dropdown,
    .stage-date-input,
    .btn-upload-trigger {
        width: 100% !important;
        margin: 0 !important;
    }

    /* Document Repository Vault Adjustments */
    .document-input-row {
        flex-direction: column !important;
        gap: 12px !important;
    }

    .document-input-row .flex-1,
    .document-input-row button {
        width: 100% !important;
    }

    /* Table Component Scroll Engine Safe Wrapper */
    .document-repository-vault {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    .doc-history-table {
        min-width: 600px !important;
    }
}

@media screen and (max-width: 480px) {
    .projects-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }

    .audit-footprint-banner {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 6px !important;
    }
}

/* ==========================================================================
   Full-Screen Image Preview Modal Component
   ========================================================================== */

.monitor-photo-preview-box {
    position: relative;
    overflow: hidden;
}

.monitor-photo-preview-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.preview-trigger-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(16, 24, 40, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
    cursor: pointer;
    border-radius: inherit;
    z-index: 2;
}

.monitor-photo-preview-box:hover .preview-trigger-overlay {
    opacity: 1;
}

.btn-preview-view-action {
    background: var(--white);
    color: var(--text-dark);
    border: none;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    box-shadow: var(--card-shadow);
    transform: translateY(4px);
    transition: transform 0.2s ease-in-out;
}

.monitor-photo-preview-box:hover .btn-preview-view-action {
    transform: translateY(0);
}

/* Modal Core Overlay Background Structure */
.preview-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(16, 24, 40, 0.9);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    opacity: 0;
    transition: opacity 0.25s ease-in-out;
}

.preview-modal-overlay.active {
    display: flex;
    opacity: 1;
}

.preview-modal-wrapper {
    position: relative;
    max-width: 90vw;
    max-height: 85vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-modal-viewport-img {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transform: scale(0.95);
    transition: transform 0.25s ease-in-out;
}

.preview-modal-overlay.active .preview-modal-viewport-img {
    transform: scale(1);
}

.btn-preview-modal-close {
    position: absolute;
    top: -45px;
    right: 0;
    background: rgba(255, 255, 255, 0.15);
    color: var(--white);
    border: 1px solid rgba(255, 255, 255, 0.25);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.2s ease, transform 0.2s ease;
}

.btn-preview-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

/* Responsive Grid & Content Pipeline Adaptation */
@media screen and (max-width: 1024px) {
    .grid-col-4 {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 16px !important;
    }
}

@media screen and (max-width: 768px) {
    .project-container-fluid {
        padding: 16px 12px !important;
    }

    .page-title-row {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 16px !important;
    }

    .page-title-row .flex-gap-12 {
        width: 100% !important;
        justify-content: flex-start !important;
    }

    .grid-col-4 {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    .quote-field-wrapper {
        flex-direction: column !important;
        gap: 16px !important;
        margin-bottom: 16px !important;
    }

    .quote-form-group.wide {
        width: 100% !important;
    }

    .monitor-stage-row {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 14px !important;
        padding: 16px !important;
        border-radius: 8px !important;
        position: relative !important;
    }

    .monitor-photo-preview-box {
        width: 100% !important;
        height: 160px !important;
        max-width: none !important;
    }

    .monitor-photo-preview-box img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
    }

    .flex-align-center-gap-12 {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 10px !important;
        width: 100% !important;
    }

    .stage-status-dropdown,
    .stage-date-input,
    .btn-upload-trigger {
        width: 100% !important;
        margin: 0 !important;
    }

    .document-input-row {
        flex-direction: column !important;
        gap: 12px !important;
    }

    .document-input-row .flex-1,
    .document-input-row button {
        width: 100% !important;
    }

    .document-repository-vault {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    .doc-history-table {
        min-width: 600px !important;
    }
}

@media screen and (max-width: 480px) {
    .projects-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }

    .audit-footprint-banner {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 6px !important;
    }
}

/* Layout Alignment & Layout Helpers */
.form-row-single-block {
    display: flex;
    flex-direction: column;
    margin-top: 16px;
    width: 100%;
}

.margin-top-16 {
    margin-top: 16px !important;
}

.font-size-15 {
    font-size: 15px !important;
    display: inline-block;
    margin-bottom: 4px;
}

/* Textarea Controls Configuration */
.filter-textarea-control {
    width: 100%;
    min-height: 80px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background-color: var(--white);
    font-family: inherit;
    font-size: 14px;
    color: var(--text-dark);
    resize: vertical;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.filter-textarea-control:focus {
    outline: none;
    border-color: #4a90e2;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.15);
}

/* Master Grid List Detailed Descriptions styling */
.service-display-block {
    display: flex;
    flex-direction: column;
    padding: 4px 0;
}

.service-description-subtext {
    margin: 4px 0 0 0;
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
    white-space: normal;
    word-break: break-word;
}

.service-description-missing {
    font-size: 12px;
    color: #b5b5b5;
    font-style: italic;
}

.text-field-numeric {
    font-variant-numeric: tabular-nums;
}

/* Service Description Enhancements */
.text-muted-desc {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 6px;
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 4px 8px;
    background-color: var(--sidebar-hover-bg);
}

.text-muted-desc-sub {
    font-size: 12px;
    color: var(--text-muted);
    display: block;
    margin-top: 2px;
    font-weight: 400;
}

.pdf-item-description-text {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 400;
    margin-top: 3px;
    display: inline-block;
}

/* Structural Layout Resets */
.quote-header-flex-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.quote-main-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0;
}

.quote-sub-headline {
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 4px;
}

.back-to-quote-btn {
    background: var(--light-bg);
    color: var(--text-muted);
    border: 1px solid var(--border);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 14px;
}

.service-selection-heading {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: block;
    margin-bottom: 12px;
}

.calculation-summary-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.summary-table-hdr-row {
    border-bottom: 2px solid var(--border);
    text-align: left;
    color: var(--text-muted);
}

.pad-left-zero {
    padding: 8px 0;
}

.discount-input-calc,
.gst-input-calc {
    width: 90px;
    height: 32px;
    text-align: right;
}

.summary-calc-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 12px 0;
}

.submit-action-btn {
    background: var(--primary);
    color: var(--white);
    border: none;
    padding: 12px 28px;
    font-size: 15px;
    font-weight: 700;
    border-radius: 6px;
    cursor: pointer;
    box-shadow: var(--box-shadow);
}

.save-quotation-wrapper {
    text-align: right;
    margin-bottom: 40px;
}

.line-item-border-row {
    border-bottom: 1px solid var(--border);
}

.td-padding-standard {
    padding: 10px;
}

.paid-amt-input {
    text-align: right;
}

.print-control-title-box {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 14px;
}

.print-control-btn-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.milestones-pdf-outer-block {
    margin-top: 25px;
    margin-bottom: 30px;
}

.pdf-milestone-header-border {
    border-bottom: 1px solid var(--border);
    padding-bottom: 6px;
    margin-bottom: 12px;
}

.badge-status-pdf-style {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
}

/* Service Item Typography Styling */
.td-service-name .service-title-text {
    font-size: 14px;
    color: var(--text-dark);
    display: inline-block;
    margin-bottom: 2px;
}

.td-service-name .pdf-item-description-text {
    font-size: 12px;
    color: var(--text-muted);
    font-style: italic;
    display: inline-block;
    margin-top: 2px;
}

/* Totals Section Context Modifiers */
.totals-table .discount-row-amount {
    color: var(--danger);
}

.totals-table .due-amount-unpaid {
    font-weight: 700;
    color: var(--danger);
}

.totals-table .due-amount-paid {
    font-weight: 700;
    color: var(--success);
}

/* Milestone Schedule Custom Insets */
.milestones-pdf-outer-block .th-milestone-split {
    width: 100px;
}

.milestones-pdf-outer-block .th-milestone-status {
    width: 100px;
}

/* --- Table Core Refinements --- */
.print-table-wrapper {
    margin: 15px 0;
    width: 100%;
}

.items-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-stack);
}

.items-table td {
    padding: 16px;
    vertical-align: top;
    border-bottom: 1px solid var(--border);
    color: var(--text-dark);
    font-size: 13px;
}

.items-table tbody tr:hover {
    background-color: var(--sidebar-hover-bg);
}

/* --- Column Configurations & Alignment --- */
.text-right {
    text-align: right;
}

.text-center,
th.text-center,
td.text-center {
    text-align: center !important;
}

.th-sr-col {
    width: 6%;
    text-align: left;
}

.th-service-col {
    width: 50%;
    text-align: left;
}

.th-area-col {
    width: 14%;
}

.th-rate-col {
    width: 14%;
}

.th-amount-col {
    width: 16%;
}

.milestone-col-width {
    width: 110px;
}

.td-sr-num {
    font-weight: 500;
    color: var(--text-muted);
    text-align: center !important;
}

.td-text-right {
    text-align: right;
    font-variant-numeric: tabular-nums;
    color: var(--text-dark);
}

.td-amount-bold {
    font-weight: 600;
    color: var(--text-dark);
    font-variant-numeric: tabular-nums;
}

/* --- Service & Description Typography Hierarchy --- */
.td-service-name {
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-align: left;
}

.service-title-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
    line-height: 1.4;
}

.pdf-item-description-text {
    font-size: 12px;
    font-style: italic;
    color: var(--text-muted);
    line-height: 1.5;
    padding-left: 4px;
    border-left: 2px solid var(--border);
}

.milestone-title-text {
    font-weight: 500;
    color: var(--text-dark);
}

/* --- Financial Totals Column --- */
.discount-text {
    color: var(--danger);
}

.due-unpaid {
    font-weight: 700;
    color: var(--danger);
}

.due-paid {
    font-weight: 700;
    color: var(--success);
}

/* --- Component Status Badges --- */
.badge-status-pdf-style {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-align: center;
}

.badge-paid {
    background-color: var(--success-bg);
    color: var(--success);
}

.badge-unpaid {
    background-color: var(--danger-bg);
    color: var(--danger);
}

/* Construction Stage Management Header */
.stages-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
}

.monitor-stage-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--light-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 10px;
}

.stage-title-input {
    font-weight: 600;
}

.btn-stage-remove {
    background-color: var(--danger-bg);
    color: var(--danger);
    border: 1px solid #fca5a5;
    padding: 7px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.btn-stage-remove:hover {
    background-color: var(--danger);
    color: var(--white);
}

/* Utilities */
.hidden-file-input {
    display: none;
}

/* ==========================================
   Split Layout Login Screen
   ========================================== */

body.login-view-wrapper {
    margin: 0;
    padding: 0;
    width: 100vw;
    height: 100vh;
    font-family: var(--font-stack);
    background-color: var(--white);
    overflow: hidden;
}

.login-split-container {
    display: flex;
    width: 100%;
    height: 100vh;
}

/* Left Form Section */
.login-form-panel {
    width: 40%;
    min-width: 420px;
    height: 100%;
    padding: 60px 80px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background-color: var(--white);
}

.login-brand-logo img {
    height: 48px;
    width: auto;
    object-fit: contain;
}

.login-header-content {
    margin-top: 20px;
    margin-bottom: 25px;
}

.login-eyebrow-text {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    text-transform: uppercase;
    display: block;
    margin-bottom: 12px;
}

.login-main-title {
    font-size: 38px;
    font-weight: 800;
    color: var(--text-dark);
    margin: 0 0 10px 0;
    line-height: 1.1;
}

.login-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.5;
}

.alert-danger-banner {
    background-color: var(--danger-bg);
    color: var(--danger);
    border: 1px solid var(--danger);
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.login-main-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.login-form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.login-field-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.login-field-input {
    width: 100%;
    height: 48px;
    padding: 0 16px;
    font-size: 14px;
    color: var(--text-dark);
    background-color: var(--white);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.login-field-input:focus {
    border-color: var(--primary);
    box-shadow: var(--box-shadow);
}

.login-btn-submit {
    width: 100%;
    height: 48px;
    background-color: var(--primary);
    color: var(--white);
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 10px;
    transition: background-color 0.2s ease;
}

.login-btn-submit:hover {
    background-color: var(--primary-hover);
}

.login-footer-address {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.4;
}

/* Right Hero Section */
.login-hero-panel {
    flex: 1;
    height: 100%;
    background-image: linear-gradient(rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0.65)), url('https://images.unsplash.com/photo-1503387762-592deb58ef4e?auto=format&fit=crop&q=80&w=1600');
    background-size: cover;
    background-position: center;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 80px;
    box-sizing: border-box;
}

.login-hero-content {
    color: var(--white);
    max-width: 600px;
}

.login-hero-tagline {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 2px;
    color: rgba(255, 255, 255, 0.7);
    display: block;
    margin-bottom: 12px;
}

.login-hero-heading {
    font-size: 38px;
    font-weight: 800;
    line-height: 1.25;
    margin: 0 0 16px 0;
    color: var(--white);
}

.login-hero-subtext {
    font-size: 15px;
    color: rgba(255, 255, 255, 0.85);
    margin: 0;
    line-height: 1.5;
}

/* Responsive adjustments */
@media (max-width: 992px) {
    .login-hero-panel {
        display: none;
    }

    .login-form-panel {
        width: 100%;
        min-width: unset;
        padding: 40px 30px;
    }
}

/* Disabled Conversion Action State */
.btn-action-convert.disabled {
    background-color: var(--border) !important;
    color: var(--text-muted) !important;
    border-color: var(--sidebar-border) !important;
    cursor: not-allowed !important;
    pointer-events: none;
    opacity: 0.75;
}

/* Converted Status Badge Styles */
.badge-status-converted {
    background-color: #f3e8ff;
    color: #6b21a8;
    border: 1px solid #d8b4fe;
}

/* ==========================================
   EXPENSE CATEGORY MODAL & CONTROL STYLES
   ========================================== */

.category-select-wrapper {
    display: flex;
    gap: 8px;
    align-items: center;
}

.category-select-wrapper select {
    flex: 1;
}

.category-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.category-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.category-modal-card {
    background: var(--white);
    width: 100%;
    max-width: 440px;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border);
    overflow: hidden;
    transform: translateY(-20px);
    transition: transform 0.25s ease;
}

.category-modal-overlay.active .category-modal-card {
    transform: translateY(0);
}

.category-modal-header {
    padding: 16px 20px;
    background-color: var(--sidebar-hover-bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.category-modal-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 8px;
}

.category-modal-close {
    background: none;
    border: none;
    font-size: 18px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    border-radius: 4px;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.category-modal-close:hover {
    color: var(--text-dark);
    background-color: var(--border);
}

.category-modal-body {
    padding: 20px;
}

.category-modal-footer {
    padding: 12px 20px 20px 20px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.modal-alert {
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 14px;
    display: none;
}

.modal-alert-danger {
    background-color: var(--danger-bg);
    color: var(--danger);
    border: 1px solid var(--danger);
}

.modal-alert-success {
    background-color: var(--success-bg);
    color: var(--success);
    border: 1px solid var(--success);
}

/* ==========================================
   CLIENT ADD MODAL & TRIGGER STYLES
   ========================================== */

.dropdown-header-action {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background-color: var(--sidebar-hover-bg);
    border-bottom: 1px solid var(--border);
}

.btn-add-client-inline {
    background-color: var(--primary);
    color: var(--white);
    border: none;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: background-color 0.2s ease;
}

.btn-add-client-inline:hover {
    background-color: var(--primary-hover);
}

.client-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.client-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.client-modal-card {
    background: var(--white);
    width: 100%;
    max-width: 500px;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border);
    overflow: hidden;
    transform: translateY(-20px);
    transition: transform 0.25s ease;
}

.client-modal-overlay.active .client-modal-card {
    transform: translateY(0);
}

.client-modal-header {
    padding: 16px 20px;
    background-color: var(--sidebar-hover-bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.client-modal-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 8px;
}

.client-modal-close {
    background: none;
    border: none;
    font-size: 18px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    border-radius: 4px;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.client-modal-close:hover {
    color: var(--text-dark);
    background-color: var(--border);
}

.client-modal-body {
    padding: 20px;
}

.client-modal-body .form-group {
    margin-bottom: 14px;
}

.client-modal-body .form-group:last-child {
    margin-bottom: 0;
}

.client-modal-footer {
    padding: 12px 20px 20px 20px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.client-modal-alert {
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 14px;
    display: none;
}

.client-modal-alert-danger {
    background-color: var(--danger-bg);
    color: var(--danger);
    border: 1px solid var(--danger);
}

.client-modal-alert-success {
    background-color: var(--success-bg);
    color: var(--success);
    border: 1px solid var(--success);
}

.preview-visible {
    display: block !important;
}

.preview-hidden {
    display: none !important;
}

.print-btn-icon {
    margin-right: 5px;
}

.bank-details-wrapper {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px dashed var(--border);
}

.bank-details-flex {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.bank-title {
    margin-bottom: 5px;
    font-size: 13px;
    color: var(--text-dark);
    font-weight: 700;
}

.qr-code-box {
    text-align: center;
}

.qr-code-img {
    width: 100px;
    height: 100px;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 3px;
    background-color: var(--white);
}

.qr-code-caption {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ==========================================================================
   FIX FOR DISJOINTED / STAIR-STEPPED TABLE BORDERS
   ========================================================================== */

/* 1. Ensure table layout collapses borders cleanly */
.items-table,
.milestone-table,
/* or whatever class your table uses */
table {
    width: 100%;
    border-collapse: collapse !important;
    /* Critical to merge adjacent cell borders */
    border-spacing: 0 !important;
}

/* 2. Reset padding & align vertical baselines for ALL table cells */
.items-table th,
.items-table td,
items-table th,
items-table td {
    vertical-align: middle !important;
    padding: 12px 8px !important;
    /* Uniform height/padding across all columns */
    box-sizing: border-box;
}

/* 3. Apply border to the ROW (tr) or uniformly across td elements */
.items-table tr,
table tr {
    border-bottom: 1px solid #e2e8f0 !important;
    /* Creates a single continuous line across the entire row */
}

/* Clear borders on individual TD elements to avoid double/broken lines */
.items-table td,
table td {
    border-bottom: none !important;
    border-top: none !important;
}

/* 4. Fix row header (th) borders */
.items-table th,
table th {
    border-top: 1px solid #e2e8f0 !important;
    border-bottom: 1px solid #e2e8f0 !important;
    background-color: #f8fafc;
    /* Standardized subtle header background */
}

/* GST Toggle & Label Styling */
.gst-header-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.gst-toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dark, #2d3748);
    user-select: none;
}

/* Custom Toggle Switch Component */
.switch-control {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
}

.switch-control input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    transition: 0.25s ease;
    border-radius: 20px;
}

.switch-slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: #ffffff;
    transition: 0.25s ease;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.switch-control input:checked+.switch-slider {
    background-color: var(--primary, #e94b35);
}

.switch-control input:checked+.switch-slider:before {
    transform: translateX(16px);
}

.switch-control input:focus+.switch-slider {
    box-shadow: 0 0 0 2px rgba(233, 75, 53, 0.2);
}

/* Disabled State for Input Field */
.input-disabled {
    background-color: #f8fafc !important;
    color: #94a3b8 !important;
    cursor: not-allowed;
    border-color: #e2e8f0 !important;
}

/* ==========================================================================
   22. DASHBOARD SITE MONITORING & CLICKABLE DOCUMENTS STYLES
   ========================================================================== */

.dashboard-section-title-wrapper {
    margin: 30px 0 15px 0;
}

.dashboard-section-title-wrapper .section-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.dashboard-section-title-wrapper .section-heading {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-dark);
    margin-top: 2px;
}

/* Site Monitor Updates List */
.project-updates-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.site-update-card {
    display: flex;
    gap: 14px;
    padding: 10px;
    background: var(--sidebar-hover-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 14px;
}

.site-update-card:last-child {
    margin-bottom: 0;
}

.site-update-card:hover {
    border-color: var(--text-muted);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.site-thumb-box {
    width: 60px;
    height: 60px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
    margin: auto;
}

.site-thumb-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.site-content-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0; /* Prevents text overflow in flex items */
}

.site-update-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.site-project-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-dark);
    text-decoration: none;
    word-break: break-word;
}

.site-project-name:hover {
    color: var(--primary);
}

.badge-stage {
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
    background: var(--sidebar-border);
    color: var(--sidebar-text);
    text-transform: capitalize;
}

.site-progress-info {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.nav-link-icon {
    font-size: 11px;
    color: var(--text-muted);
}

.badge-stage {
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-stage-planning {
    background: #e0f2fe;
    color: #0369a1;
}

.badge-stage-design {
    background: #fef3c7;
    color: #92400e;
}

.badge-stage-construction {
    background: var(--danger-bg);
    color: var(--primary);
}

.badge-stage-finishing {
    background: #f3e8ff;
    color: #6b21a8;
}

.badge-stage-completed {
    background: var(--success-bg);
    color: var(--success);
}

.site-update-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.site-progress-info {
    font-size: 12px;
    color: var(--text-muted);
}

.progress-bar-fill.site-fill {
    background: var(--primary);
}

.site-stage-footer {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.site-stage-footer span {
    font-weight: 600;
    color: var(--text-dark);
}

/* Document Repository List */
.doc-updates-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.doc-item-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    background: var(--sidebar-hover-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 12px;
}

.doc-item-card:last-child {
    margin-bottom: 0;
}

.doc-icon-wrapper {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    background: #fef2f2;
    color: #ef4444;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.doc-meta-info {
    flex: 1;
    min-width: 0;
}

.doc-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.doc-name-link {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-dark);
    text-decoration: none;
    word-break: break-word;
}

.doc-name-link:hover {
    color: var(--primary);
}

.view-doc-icon {
    font-size: 11px;
    color: var(--text-muted);
}

.doc-version-tag {
    font-size: 10px;
    font-weight: 700;
    background: var(--border);
    color: var(--text-dark);
    padding: 1px 6px;
    border-radius: 4px;
}

.doc-subtext {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.doc-project-link {
    color: var(--sidebar-text);
    font-weight: 600;
    text-decoration: none;
}

.doc-project-link:hover {
    color: var(--primary);
    text-decoration: underline;
}

.doc-timestamp {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

.doc-action-shortcut {
    flex-shrink: 0;
}

.btn-doc-shortcut {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--white);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 12px;
    flex-shrink: 0;
}

.btn-doc-shortcut:hover {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

/* Activity Feeds (Expenses, Quotations, Invoices) */
.activity-feed-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.activity-feed-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--sidebar-hover-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
}

.activity-icon-badge {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
}

.activity-icon-badge.icon-quote {
    background: #e0f2fe;
    color: #0284c7;
}

.activity-icon-badge.icon-expense {
    background: var(--danger-bg);
    color: var(--danger);
}

.activity-main-body {
    flex-grow: 1;
}

.activity-title {
    font-size: 13px;
    color: var(--text-dark);
}

.activity-subtext {
    font-size: 11px;
    color: var(--text-muted);
}

.activity-right-value {
    font-size: 13px;
    font-weight: 700;
}

.badge-inv-status {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-inv-status.status-paid {
    background: var(--success-bg);
    color: var(--success);
}

.badge-inv-status.status-unpaid {
    background: var(--danger-bg);
    color: var(--danger);
}

.badge-inv-status.status-partially-paid {
    background: var(--warning-bg);
    color: var(--warning);
}

/* ==========================================================================
   DASHBOARD CLICKABLE ACTIVITIES & FEED STYLING
   ========================================================================== */

/* Clickable Activity Link Items */
a.clickable-activity {
    text-decoration: none;
    color: inherit;
    display: flex;
    transition: all 0.2s ease-in-out;
    cursor: pointer;
}

a.clickable-activity:hover {
    background: var(--sidebar-hover-bg);
    border-color: var(--border);
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.04);
}

.activity-feed-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.activity-feed-item {
    align-items: center;
    gap: 12px;
    background: var(--sidebar-hover-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
}

.activity-icon-badge {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
}

.activity-icon-badge.icon-quote {
    background: #e0f2fe;
    color: #0284c7;
}

.activity-icon-badge.icon-invoice {
    background: var(--success-bg);
    color: var(--success);
}

.activity-icon-badge.icon-expense {
    background: var(--danger-bg);
    color: var(--danger);
}

.activity-main-body {
    flex-grow: 1;
}

.activity-title {
    font-size: 13px;
    color: var(--text-dark);
}

.activity-subtext {
    font-size: 11px;
    color: var(--text-muted);
}

.activity-right-value {
    font-size: 13px;
    font-weight: 700;
}

/* Invoice Badges */
.badge-inv-status {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-inv-status.status-paid {
    background: var(--success-bg);
    color: var(--success);
}

.badge-inv-status.status-unpaid {
    background: var(--danger-bg);
    color: var(--danger);
}

.badge-inv-status.status-partially-paid {
    background: var(--warning-bg);
    color: var(--warning);
}

.badge-inv-status.status-cancelled {
    background: var(--sidebar-hover-bg);
    color: var(--text-muted);
}

/* ==========================================================================
   PAYMENTS RECEIVED CARD FIX (FORCE TOP BLOCK TO LEFT ALIGN)
   ========================================================================== */

.payment-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-start !important;
    text-align: left !important;
    width: 100%;
}

.payment-client-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-dark);
    text-align: left !important;
}

.payment-inv-code {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: flex-start !important;
    gap: 6px;
    margin-top: 2px;
    text-align: left !important;
    width: 100%;
}

@media screen and (max-width: 768px) {

    .payment-meta,
    .payment-client-name,
    .payment-inv-code {
        align-items: flex-start !important;
        justify-content: flex-start !important;
        text-align: left !important;
    }
}

/* =========================================================
   PROFESSIONAL LANDSCAPE PDF EXPORT & PRINT STYLES
   ========================================================= */

/* Hide print-only rows during regular screen preview */
.print-only-row {
    display: none;
}

.print-header {
    display: none;
    /* Hide print header on screen */
}

.btn-print-export {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 6px;
}

.invoice-number-bold,
.client-meta-subtext {
    white-space: nowrap;
}

/* Ensure the table header for Quote # stays on a single line as well */
.clients-table th {
    white-space: nowrap;
}

/* Optional: ensure table cells adjust padding gracefully if space is tight */
.clients-table td {
    vertical-align: middle;
}

/* ==========================================================================
   PRINT / PDF & MOBILE RESPONSIVE STYLES
   ========================================================================== */

.invoice-number-bold,
.client-meta-subtext {
    white-space: nowrap;
}

/* Ensure the table header for Quote # stays on a single line as well */
.clients-table th {
    white-space: nowrap;
}

/* Optional: ensure table cells adjust padding gracefully if space is tight */
.clients-table td {
    vertical-align: middle;
}


/* ==========================================================================
   MOBILE SCREEN RESPONSIVENESS (ONLY ON SCREEN VIEW, NOT PRINT)
   ========================================================================== */
@media screen and (max-width: 768px) {
    body.print-page-body {
        padding: 10px !important;
        background-color: var(--light-bg) !important;
    }

    /* Sticky top control bar for easy printing on mobile */
    .print-control-bar {
        flex-direction: column !important;
        gap: 10px !important;
        align-items: stretch !important;
        padding: 12px 15px !important;
    }

    .print-control-btn-wrapper {
        display: flex !important;
        width: 100% !important;
        gap: 8px !important;
    }

    .print-btn {
        flex: 1 !important;
        justify-content: center !important;
        padding: 10px 12px !important;
        font-size: 14px !important;
    }

    /* Fluid document card for small mobile screens */
    .document-container {
        width: 100% !important;
        max-width: 100% !important;
        padding: 15px !important;
        margin: 10px 0 !important;
        box-shadow: var(--card-shadow) !important;
    }

    /* Responsive document header */
    .doc-header {
        flex-direction: column !important;
        gap: 15px !important;
    }

    .doc-title-box {
        text-align: left !important;
        border-top: 1px dashed var(--border) !important;
        padding-top: 12px !important;
    }

    /* Responsive metadata columns */
    .meta-grid {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
    }

    /* Mobile scrollable table wrapper to prevent page clipping */
    .print-table-wrapper {
        width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        margin-bottom: 15px !important;
    }

    .items-table {
        min-width: 550px !important;
    }

    /* Responsive Totals section */
    .totals-container {
        width: 100% !important;
    }

    .totals-table {
        width: 100% !important;
    }

    /* Bank details & QR section on mobile */
    .bank-details-flex {
        flex-direction: column !important;
        gap: 15px !important;
    }

    .qr-code-box {
        align-self: flex-start !important;
    }

    /* Responsive Footer */
    .footer-section {
        flex-direction: column !important;
        gap: 25px !important;
    }

    .terms-block,
    .signature-block {
        width: 100% !important;
    }

    .signature-block {
        margin-top: 15px !important;
    }
}

/* Vertical divider between A/C No and IFSC Code */
.bank-divider {
    color: var(--border);
    font-weight: bold;
    margin: 0 6px;
    display: inline-block;
}

/* Styling for the new Rate Type toggle */
.rate-type-select {
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 12px;
    background-color: #f8fafc;
    cursor: pointer;
    margin-right: 5px;
    width: 80px;
}

.summary-items-table .type-badge {
    font-size: 10px;
    padding: 2px 6px;
    background: #e2e8f0;
    border-radius: 10px;
    text-transform: uppercase;
}

.badge-rate-type {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    display: inline-block;
    letter-spacing: 0.3px;
}

/* Service Card Badge Styling */
.rate-type-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    align-self: flex-end;
    /* Aligns badge to the left */
    display: inline-block;
}

.badge-sqft {
    background-color: var(--success-bg);
    color: #0f5132;
    border: 1px solid #badbcc;
}

.badge-fixed {
    background-color: var(--danger-bg);
    color: var(--danger);
    border: 1px solid #fecdd3;
}

/* --- SEARCHABLE SELECT COMPONENT --- */
.search-select-container {
    position: relative;
    width: 100%;
}

.select-trigger {
    width: 100%;
    padding: 10px 14px;
    background: #fff;
    border: 1px solid #ced4da;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    color: #495057;
    transition: all 0.2s ease;
}

.select-trigger:after {
    content: '\f078';
    /* FontAwesome chevron-down */
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    font-size: 10px;
    color: #999;
}

.select-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: #fff;
    border: 1px solid #ced4da;
    border-radius: 6px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    z-index: 1050;
    /* Ensure it floats above others */
    margin-top: 5px;
    overflow: hidden;
}

.select-dropdown.active {
    display: block;
}

.search-input {
    width: 100%;
    padding: 10px;
    border: none;
    border-bottom: 1px solid #eee;
    outline: none;
    font-size: 14px;
}

.options-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 200px;
    overflow-y: auto;
}

.option-item {
    padding: 10px 14px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.15s ease;
}

.option-item:hover {
    background-color: #f8f9fa;
}

/* The Highlight Effect */
.option-item.selected {
    background-color: var(--primary-bg);
    /* Light red highlight */
    color: var(--primary);
    /* Matches your theme */
    font-weight: 600;
}

/* Mobile responsive override for Payment Form */
@media (max-width: 768px) {

    /* Target the container row that holds the Payment Method and Date */
    .payment-card .form-row-grid:has(#mainMethodSelect, #editMethodSelect) {
        display: flex;
        flex-direction: column;
        gap: 15px;
        /* Adjust spacing as needed */
    }

    /* Force the form groups to take 100% width on mobile */
    .payment-card .form-row-grid:has(#mainMethodSelect, #editMethodSelect) .form-group-col-1 {
        flex: 0 0 100%;
        max-width: 100%;
        width: 100%;
    }
}


/* 1. Global Page Setup */
@page {
    size: A4 portrait;
    margin: 10mm 12mm 10mm 12mm;
}

/* Landscape Override: Add this to your body class to trigger landscape */
@page landscape {
    size: A4 landscape;
}

@media print {

    /* 2. LAYOUT RESET: Grouped all resets to prevent browser calculation errors */
    html,
    body,
    .content-wrapper,
    .printable-area,
    .document-container,
    body.print-page-body,
    body.expense-pdf-body,
    body.payment-pdf-body {
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        background: #ffffff !important;
        color: #0f172a !important;
        box-shadow: none !important;
        border: none !important;
        max-width: 100% !important;
        min-height: auto !important;
        overflow: visible !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* 3. Landscape Handler: If body has this class, trigger the named page */
    body.landscape-mode {
        page: landscape;
    }

    /* 4. HIDE UNNECESSARY ELEMENTS: All UI controls in one list */
    header,
    footer,
    nav,
    .sidebar,
    .menu-icon,
    .hamburger,
    .toggle-btn,
    .navbar-toggler,
    .fa-bars,
    .page-header-container,
    .payment-card,
    .invoice-filter-card,
    .alert-banner-success,
    .alert-banner-danger,
    .pagination-container,
    .action-col,
    .no-print,
    button,
    .topbar,
    .mobile-toggle-btn,
    .print-control-bar {
        display: none !important;
        visibility: hidden !important;
    }

    /* 5. TABLE LAYOUT: Optimized for multi-page flow */
    .data-table-container,
    .responsive-table-scroll,
    .print-table-wrapper {
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
        overflow: visible !important;
        page-break-inside: auto !important;
    }

    .clients-table,
    .items-table {
        width: 100% !important;
        border-collapse: collapse !important;
        table-layout: auto !important;
        page-break-inside: auto !important;
    }

    .clients-table thead,
    .items-table thead {
        display: table-header-group !important;
    }

    /* Allow rows to break naturally to solve the "Blank Page" issue */
    .clients-table tr,
    .items-table tr {
        page-break-inside: auto !important;
        break-inside: auto !important;
    }

    /* 6. STYLE OVERRIDES: Kept all your existing class styles */
    .print-header {
        display: flex !important;
        justify-content: space-between;
        align-items: flex-end;
        border-bottom: 2px solid #0f172a;
        padding-bottom: 10px;
        margin-bottom: 14px;
    }

    .print-header-left {
        display: flex;
        align-items: center;
        gap: 16px;
    }

    .print-logo {
        max-height: 50px;
        max-width: 130px;
        object-fit: contain;
    }

    .print-firm-title {
        font-size: 1.3rem;
        font-weight: 700;
        margin: 0 0 3px 0;
        color: #0f172a;
    }

    .print-firm-details {
        font-size: 0.78rem;
        margin: 0;
        line-height: 1.3;
        color: #475569;
    }

    .print-header-right {
        text-align: right;
    }

    .print-doc-title {
        font-size: 1.1rem;
        font-weight: 800;
        margin: 0 0 4px 0;
        text-transform: uppercase;
        color: #0f172a;
    }

    .print-meta {
        font-size: 0.75rem;
        margin: 0;
        color: #64748b;
    }

    .logs-summary-badge {
        display: flex !important;
        background-color: #f8fafc !important;
        border: 1px solid #cbd5e1 !important;
        padding: 8px 14px !important;
        border-radius: 6px !important;
        font-size: 0.82rem !important;
        margin-bottom: 12px !important;
        color: #334155 !important;
    }

    .clients-table th {
        background-color: #f1f5f9 !important;
        color: #0f172a !important;
        font-weight: 700 !important;
        border: 1px solid #cbd5e1 !important;
        padding: 8px 10px !important;
    }

    .clients-table td {
        border: 1px solid #e2e8f0 !important;
        padding: 7px 10px !important;
        color: #334155 !important;
        vertical-align: middle !important;
    }

    .clients-table tbody tr:nth-child(even) {
        background-color: #f8fafc !important;
    }

    /* Utility classes */
    .col-amount,
    .amount-paid-text,
    .col-date,
    .col-id,
    .receipt-id-bold,
    .invoice-number-bold,
    .col-mode,
    .client-meta-subtext,
    .payment-method-badge,
    .col-client,
    .client-name-bold {
        white-space: nowrap !important;
        color: #000 !important;
        border: none !important;
        background: transparent !important;
    }

    .print-only-row {
        display: table-row !important;
    }

    .print-hide-col {
        display: none !important;
    }

    /* Desktop Parity Layouts */
    .doc-header {
        display: flex !important;
        flex-direction: row !important;
        justify-content: space-between !important;
    }

    .meta-grid {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 20px !important;
    }

    .footer-section {
        display: flex !important;
        flex-direction: row !important;
        justify-content: space-between !important;
        page-break-inside: avoid !important;
    }

    .terms-block {
        width: 65% !important;
    }

    .signature-block {
        width: 30% !important;
        page-break-inside: avoid !important;
    }

    .totals-container {
        display: flex !important;
        justify-content: flex-end !important;
        page-break-inside: avoid !important;
    }
}

.header-flex-container {
    display: flex;
    align-items: center;        /* Centers items vertically */
    justify-content: space-between; /* Spreads items horizontally */
    flex-wrap: wrap;            /* Allows wrapping on smaller screens */
    gap: 15px;                  /* Adds space between the sections */
    width: 100%;
}

/* Filter Tag Styles */
.active-filters-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 24px; /* Matches your padding-24 class */
}

.filter-tag {
    background-color: #f8f9fa;
    border: 1px solid #ced4da;
    color: #495057;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 0.85rem;
    display: inline-block;
}

.filter-tag strong {
    color: #212529;
    margin-right: 4px;
}

/* 1. Mobile (Small Screens) */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -260px; /* Hidden off-screen */
        top: 0;
        width: 260px;
        height: 100%;
        transition: 0.3s ease-in-out;
        z-index: 999;
        background: #fff; /* Ensure this matches your sidebar color */
    }

    .sidebar.active {
        left: 0; /* Slide in */
    }

    .main-content {
        margin-left: 0 !important; /* Full width on mobile */
        width: 100%;
    }

    .sidebar.active + .sidebar-overlay {
        display: block;
    }
}

/* 2. Desktop (Large Screens) */
@media (min-width: 769px) {
    .sidebar {
        left: 0; /* Always visible */
    }
    
    .mobile-toggle-btn {
        display: none; /* Hidden on desktop */
    }
    
    .main-content {
        margin-left: 260px; /* Push content to accommodate sidebar */
        transition: 0.3s;
    }
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 998;
}

