@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    /* Primary Brand Colors */
    --primary-color: #3b82f6;
    --sidebar-bg: #1e293b;
    --sidebar-active-bg: rgba(59, 130, 246, 0.1);
    
    /* Semantic Colors */
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #3b82f6;
    
    /* Neutral Palette */
    --text-main: #1e293b;
    --text-muted: #64748b;
    --bg-main: #f8fafc;
    --border-color: #e2e8f0;

    /* Border Radii */
    --border-radius-xl: 12px;
    --border-radius-lg: 8px;
    --border-radius-md: 6px;
    
    /* Shadows */
    --shadow-soft: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-md: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    
    /* Spacing Scale (UI Standards) */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 12px;
    --space-lg: 16px;
    --space-xl: 24px;
    --space-2xl: 32px;
    --space-3xl: 48px;

    /* Sizing & Targets */
    --touch-target-min: 44px;
    --form-max-width: 900px;
    
    /* Legacy/Specifics */
    --indigo: #6366f1;
    --indigo-hover: #4f46e5;
    --bg-indigo: #eef2ff;
}

.bg-indigo { background-color: var(--indigo) !important; }
.text-indigo { color: var(--indigo) !important; }
.btn-indigo { background-color: var(--indigo); color: white; border: none; transition: all 0.2s; }
.btn-indigo:hover { background-color: var(--indigo-hover); color: white; transform: translateY(-1px); }
.btn-outline-indigo { color: var(--indigo); border: 2px solid var(--indigo); background: transparent; font-weight: 600; }
.btn-outline-indigo:hover, .btn-check:checked + .btn-outline-indigo { background-color: var(--bg-indigo); color: var(--indigo); border-color: var(--indigo); }
.bg-light-indigo { background-color: var(--bg-indigo); }

body {
    font-family: 'Inter', sans-serif;
    background-color: #f8fafc;
    color: #1e293b;
}

/* Layout & Container */
.app-main {
    padding-bottom: 2rem;
}

.container-fluid {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

/* Cards */
.card {
    border: none !important;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-soft);
    margin-bottom: var(--space-xl);
    transition: box-shadow 0.3s ease;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    background-color: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: var(--space-lg) var(--space-xl);
}

.card-title {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-main);
}

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

/* Sidebar */
.app-sidebar {
    background-color: var(--sidebar-bg) !important;
    box-shadow: 4px 0 10px rgba(0,0,0,0.1);
}

.brand-link {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 1rem !important;
    border-bottom: 1px solid rgba(255,255,255,0.08) !important;
    text-decoration: none !important;
    min-height: 100px;
}

.brand-image {
    max-height: 60px;
    width: auto;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.3));
    object-fit: contain;
}

.brand-text {
    font-weight: 700 !important;
    letter-spacing: 0.02em;
    font-size: 1.1rem !important;
    text-transform: uppercase;
    white-space: normal;
    text-align: center;
    line-height: 1.3;
    color: #fff !important;
    width: 100%;
    padding: 0 5px;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .container-fluid {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .app-content-header h3 {
        font-size: 1.5rem;
    }

    .stat-card h3 {
        font-size: 1.5rem;
    }

    .btn-group-responsive {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }

    .btn-group-responsive .btn {
        width: 100%;
    }

    /* Touch Ergonomics (Standardized) */
    .btn, .nav-link, .form-control, .form-select, .dropdown-item {
        min-height: var(--touch-target-min);
        display: flex;
        align-items: center;
    }

    .btn-sm, .form-select-sm, .form-control-sm {
        min-height: 38px; /* Slightly smaller but still accessible for secondary actions */
    }

    /* List Action Buttons */
    .btn-action {
        min-width: 44px;
        min-height: 44px;
    }

    /* Pagination Touch Targets */
    .pagination .page-link {
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Operational Hierarchy (Phase V1.8) */
    .mobile-op-context {
        background: #fff;
        padding: 0.75rem 1rem;
        border-bottom: 2px solid var(--primary-color);
        margin-bottom: 1rem;
    }
}

/* Sticky Action Bar (Phase V1.8) */
@media (max-width: 991.98px) {
    .sticky-action-bar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: #fff;
        box-shadow: 0 -4px 12px rgba(0,0,0,0.1);
        padding: 1rem;
        z-index: 1030;
        display: flex;
        gap: 0.75rem;
        border-top: 1px solid #e2e8f0;
    }

    .sticky-action-bar .btn {
        flex: 1;
        justify-content: center;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.05em;
    }

    /* Content spacer for sticky bar */
    .has-sticky-bar {
        padding-bottom: 80px !important;
    }
}

/* Operational Summary Cards (Phase V1.8) */
.op-summary-card {
    background: #fff;
    border-radius: var(--border-radius-lg);
    padding: 1rem;
    margin-bottom: 1rem;
    border-left: 4px solid var(--primary-color);
    box-shadow: var(--shadow-soft);
}

.op-summary-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.op-summary-title {
    font-weight: 700;
    font-size: 1rem;
    color: #0f172a;
}

.op-summary-status {
    font-size: 0.7rem;
    font-weight: 600;
}

.op-summary-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.op-summary-item {
    display: flex;
    flex-direction: column;
}

.op-summary-label {
    font-size: 0.7rem;
    color: #64748b;
    text-transform: uppercase;
    font-weight: 600;
}

.op-summary-value {
    font-size: 0.85rem;
    font-weight: 600;
    color: #334155;
}

.op-summary-actions {
    display: flex;
    gap: 0.5rem;
    border-top: 1px dashed #e2e8f0;
    padding-top: 0.75rem;
}

/* Collapsible Metadata (Phase V1.8) */
.metadata-section {
    background: #f8fafc;
    border-radius: var(--border-radius-lg);
    border: 1px solid #e2e8f0;
    margin-top: 1.5rem;
}

.metadata-header {
    padding: 0.75rem 1rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #64748b;
}

.metadata-header:hover {
    background: #f1f5f9;
}

/* Breadcrumb Condenser (Phase V1.8) */
@media (max-width: 768px) {
    .breadcrumb-mobile-condensed {
        display: flex;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 0.8rem;
    }
    
    .breadcrumb-mobile-condensed li:not(:last-child) {
        display: none;
    }
    
    .breadcrumb-mobile-condensed li:last-child::before {
        content: "\f053"; /* FontAwesome Chevron Left */
        font-family: "Font Awesome 6 Free";
        font-weight: 900;
        margin-right: 0.5rem;
        color: var(--primary-color);
    }
}

.nav-sidebar .nav-link {
    border-radius: var(--border-radius-lg);
    margin: 0.2rem 0.8rem;
    padding: 0.75rem 1rem;
    color: #94a3b8 !important;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
}

.nav-sidebar .nav-link .nav-icon {
    width: 1.6rem;
    text-align: center;
    margin-right: 0.8rem;
    font-size: 1.1rem;
}

.nav-sidebar .nav-link:hover {
    background-color: rgba(255,255,255,0.05) !important;
    color: #f8fafc !important;
}

.nav-sidebar .nav-link.active {
    background-color: var(--sidebar-active-bg) !important;
    color: var(--primary-color) !important;
    font-weight: 600;
    border-left: 3px solid var(--primary-color);
}

.nav-sidebar .nav-header {
    padding: 1.5rem 1.5rem 0.5rem !important;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #64748b !important;
    font-weight: 700;
}

/* Tables */
.table {
    margin-bottom: 0;
}

.table thead th {
    background-color: #f8fafc;
    border-bottom: 2px solid #f1f5f9;
    color: #64748b;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
    padding: 1rem 1.5rem;
}

.table tbody td {
    padding: 1rem 1.5rem;
    vertical-align: middle;
    color: #334155;
    border-bottom: 1px solid #f1f5f9;
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: #fdfdfe;
}

.table-hover tbody tr:hover {
    background-color: #f1f5f9;
}

/* Forms */
.form-label {
    font-weight: 500;
    color: #475569;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.form-control, .form-select {
    border-radius: var(--border-radius-lg);
    border: 1px solid #e2e8f0;
    padding: 0.6rem 1rem;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

/* Buttons */
.btn {
    border-radius: var(--border-radius-lg);
    padding: 0.6rem 1.2rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

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

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

.btn-primary:hover {
    background-color: #2563eb;
    border-color: #2563eb;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* Record Sections Component */
.nav-tabs-custom .nav-link { 
    color: var(--text-muted); 
    background: var(--bg-light); 
    margin-right: 5px; 
    transition: all 0.2s ease;
    border: none !important;
}
.nav-tabs-custom .nav-link:hover {
    color: var(--text-main);
    background: #edf2f7;
}
.nav-tabs-custom .nav-link.active { 
    color: var(--primary-color) !important; 
    background: #fff; 
    border-bottom: 3px solid var(--primary-color) !important;
}

.field-item {
    transition: all 0.2s ease;
}
.field-item:hover {
    background-color: #fdfdfd !important;
    border-color: var(--primary-color) !important;
}

.extra-small { font-size: 0.65rem; letter-spacing: 0.5px; }

/* Icons in Tables */
.btn-action {
    padding: 0.5rem;
    line-height: 1;
    border-radius: 8px;
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    color: #64748b;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    min-height: 32px;
}

.btn-action:hover {
    background-color: #f8fafc;
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
}

.btn-action i {
    font-size: 0.9rem;
}

/* Summary Cards (Dashboard) */
.stat-card {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none !important;
    display: block;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.stat-card .inner {
    padding: 1.5rem;
}

.stat-card h3 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.2rem;
}

.stat-card p {
    font-size: 0.9rem;
    color: #64748b;
    margin-bottom: 0;
}

.stat-card .icon {
    position: absolute;
    right: 1.5rem;
    top: 1.5rem;
    font-size: 2.5rem;
    opacity: 0.15;
    transition: transform 0.3s ease;
}

.stat-card:hover .icon {
    transform: scale(1.2);
}

/* Loading Overlay */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.7);
    backdrop-filter: blur(2px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Alerts */
.alert {
    border: none;
    border-radius: var(--border-radius-lg);
    padding: 1rem 1.5rem;
}

/* Semantic Utilities */
.text-success { color: var(--success-color) !important; }
.text-warning { color: var(--warning-color) !important; }
.text-danger { color: var(--danger-color) !important; }
.text-info { color: var(--info-color) !important; }

.bg-success-subtle { background-color: rgba(16, 185, 129, 0.1) !important; }
.bg-warning-subtle { background-color: rgba(245, 158, 11, 0.1) !important; }
.bg-danger-subtle { background-color: rgba(239, 68, 68, 0.1) !important; }
.bg-info-subtle { background-color: rgba(59, 130, 246, 0.1) !important; }

/* Badges */
.badge {
    padding: 0.4rem 0.8rem;
    border-radius: var(--border-radius-md);
    font-weight: 600;
    letter-spacing: 0.02em;
    font-size: 0.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.badge-pill {
    border-radius: 50rem;
    padding-left: 1rem;
    padding-right: 1rem;
}
/* Timeline & Activity Feed */
.timeline-sm {
    position: relative;
}

.timeline-sm::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 5px;
    bottom: 5px;
    width: 2px;
    background: #e2e8f0;
    border-radius: 2px;
}

.timeline-sm .position-relative {
    padding-left: 2.5rem !important; /* Ensure enough space for the icon line */
}

.timeline-sm .start-0 {
    left: 7px !important; /* Align dot with the line */
    z-index: 2;
    background: #fff; /* Mask the line behind the dot */
    width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transform: translateX(-50%);
}
/* Formula Engine Stabilization (Phase FE-3.5) */
.formula-debug-badge {
    position: absolute;
    top: -12px;
    right: 5px;
    font-size: 0.65rem;
    padding: 2px 6px;
    background: #1e293b;
    color: #fff;
    border-radius: 10px;
    z-index: 10;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.mb-3:hover .formula-debug-badge {
    opacity: 0.8;
}

.formula-error-indicator {
    border-color: #ef4444 !important;
    background-color: #fef2f2 !important;
}

.formula-error-msg {
    color: #ef4444;
    font-size: 0.75rem;
    margin-top: 4px;
    display: block;
}

[data-calculated="1"] {
    background-color: #f8fafc;
    border-style: dashed;
    cursor: not-allowed;
}

/* Field Save Indicators */
.is-saving {
    background-color: rgba(59, 130, 246, 0.05) !important;
    border-color: var(--primary-color) !important;
    transition: background-color 0.3s ease;
}

/* Workflow Timeline (Standardized) */
.workflow-timeline-container { position: relative; padding: var(--space-lg) 0; }
.timeline-track { 
    position: absolute; top: 38px; left: 50px; right: 50px; height: 3px; 
    background: var(--border-color); z-index: 1; 
}
.node-circle { 
    width: 36px; height: 36px; border-radius: 50%; display: flex; 
    align-items: center; justify-content: center; background: #fff; border: 2px solid var(--border-color);
    transition: all 0.3s ease;
}
.timeline-node.completed .node-circle { background: var(--text-muted); border-color: var(--text-muted); color: #fff; }
.timeline-node.current .node-circle { background: var(--primary-color); border-color: var(--primary-color); color: #fff; transform: scale(1.15); box-shadow: 0 0 10px rgba(59, 130, 246, 0.4); }
.timeline-node.future .node-circle { color: #adb5bd; border-style: dashed; }

.pulse-halo { animation: pulse-animation 2s infinite; }
@keyframes pulse-animation {
    0% { box-shadow: 0 0 0 0px rgba(59, 130, 246, 0.4); }
    100% { box-shadow: 0 0 0 15px rgba(59, 130, 246, 0); }
}

.workflow-stepper-mobile { position: relative; padding-left: 30px; }
.stepper-item { position: relative; padding-bottom: var(--space-xl); }
.stepper-item::before { 
    content: ''; position: absolute; left: -18px; top: 24px; bottom: 0; 
    width: 2px; background: var(--border-color); 
}
.stepper-item:last-child::before { display: none; }
.stepper-marker { 
    position: absolute; left: -30px; top: 0; width: 24px; height: 24px; 
    border-radius: 50%; background: #fff; border: 2px solid var(--border-color); 
    display: flex; align-items: center; justify-content: center; font-size: 10px; z-index: 2;
}
.stepper-item.completed .stepper-marker { background: var(--text-muted); border-color: var(--text-muted); color: #fff; }
.stepper-item.current .stepper-marker { background: var(--primary-color); border-color: var(--primary-color); color: #fff; box-shadow: 0 0 5px rgba(59, 130, 246, 0.3); }

/* Operational Cards */
.operational-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border-left-width: 4px !important;
}
.operational-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.hover-border:hover {
    border: 1px solid #e2e8f0 !important;
    background-color: #fff !important;
}

/* Business Control Center Styles */
.bcc-filter-bar {
    background: #fff;
    padding: 1rem;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-soft);
    margin-bottom: 1.5rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.bcc-filter-btn {
    padding: 0.4rem 1rem;
    font-size: 0.85rem;
    border-radius: 20px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s ease;
}

.bcc-filter-btn:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.bcc-filter-btn.active {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
    box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.3);
}

.module-card {
    display: none; /* Hidden by default on desktop */
}

@media (max-width: 991.98px) {
    .module-table-container {
        display: none;
    }
    .module-card {
        display: block;
        background: #fff;
        border-radius: var(--border-radius-xl);
        padding: 1.25rem;
        margin-bottom: 1rem;
        box-shadow: var(--shadow-soft);
        border: 1px solid #f1f5f9;
    }
    .module-card-header {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        margin-bottom: 1rem;
    }
    .module-card-title {
        font-weight: 700;
        font-size: 1.1rem;
        color: #1e293b;
        margin-bottom: 0.25rem;
    }
    .module-card-slug {
        font-size: 0.75rem;
        color: #64748b;
        font-family: monospace;
    }
    .module-card-body {
        font-size: 0.9rem;
    }
    .module-card-row {
        display: flex;
        justify-content: space-between;
        margin-bottom: 0.75rem;
        padding-bottom: 0.75rem;
        border-bottom: 1px dashed #f1f5f9;
    }
    .module-card-row:last-child {
        border-bottom: none;
        margin-bottom: 0;
        padding-bottom: 0;
    }
    .module-card-label {
        color: #94a3b8;
        font-weight: 500;
    }
    .module-card-value {
        color: #334155;
        font-weight: 600;
        text-align: right;
    }
    .module-card-actions {
        display: flex;
        gap: 0.5rem;
        margin-top: 1.25rem;
        padding-top: 1.25rem;
        border-top: 1px solid #f1f5f9;
    }
    .module-card-actions .btn {
        flex: 1;
        padding: 0.5rem;
        font-size: 0.85rem;
    }
}

.badge-outline-warning {
    background: transparent;
    border: 1px solid #f59e0b;
    color: #f59e0b;
}

.badge-outline-success {
    background: transparent;
    border: 1px solid #10b981;
    color: #10b981;
}

.text-xs {
    font-size: 0.75rem;
}

.record-stats-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.record-stat-item {
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 4px;
}

.child-table-tag {
    font-size: 0.7rem;
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    color: #475569;
    display: inline-block;
    margin-right: 4px;
    margin-bottom: 4px;
}

.visibility-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 4px;
}

.visibility-dot.active { background-color: #22c55e; }
.visibility-dot.inactive { background-color: #e2e8f0; }

.last-activity-time {
    font-size: 0.75rem;
    color: #94a3b8;
}

/* Remove dropdown arrow from select fields */
.no-arrow {
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    background-image: none !important;
    padding-right: 0.75rem !important;
}

/* For selects that should be readonly but still submit values */
.readonly-select {
    background-color: #e9ecef !important;
    opacity: 1 !important;
    pointer-events: none !important;
    touch-action: none !important;
    cursor: default !important;
}

select.form-control:disabled,
select.form-select:disabled,
input.form-control:disabled {
    background-color: #e9ecef !important;
    opacity: 1;
    color: #334155;
    border-color: #e2e8f0;
}

/* Phase V1.9: Operational Attention Management */
.navbar-badge {
    padding: 2px 4px !important;
    min-width: 16px;
    height: 16px;
    line-height: 12px;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.notifications-menu .dropdown-menu {
    width: 320px;
    padding: 0;
}

.notification-item {
    transition: background-color 0.2s ease;
}

.notification-item:hover {
    background-color: #f1f5f9 !important;
}

.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.extra-small {
    font-size: 0.7rem;
}

/* Urgency Hierarchy Indicators */
.urgency-high {
    border-left: 4px solid #ef4444 !important; /* Red: > 48h */
}

.urgency-medium {
    border-left: 4px solid #f59e0b !important; /* Amber: 24h - 48h */
}

.urgency-low {
    border-left: 4px solid #3b82f6 !important; /* Blue: < 24h */
}

.urgency-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.urgency-dot-high { background-color: #ef4444; box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2); }
.urgency-dot-medium { background-color: #f59e0b; box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2); }
.urgency-dot-low { background-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2); }

/* Animation for critical items */
@keyframes pulse-red {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}

.urgency-pulse {
    animation: pulse-red 2s infinite ease-in-out;
}
/* Phase UX-S3: Unified Operational Command Center */
.operational-card {
    transition: all 0.3s ease;
    border-radius: var(--border-radius-lg);
}
.operational-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.operational-card .card-body {
    padding: 1rem;
}

.sla-indicator {
    padding: 0.25rem 0;
}

.activity-stream .activity-item {
    padding-bottom: 0.5rem;
}

.activity-stream .activity-comment {
    background: #f8fafc;
    border-left: 3px solid #e2e8f0;
    padding: 0.5rem;
    font-size: 0.8rem;
    color: #64748b;
    border-radius: 4px;
}

.x-small { font-size: 0.8rem; }
.extra-small { font-size: 0.7rem; }
.text-xs { font-size: 0.75rem; }

.navbar-avatar,
.profile-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.navbar-avatar {
    width: 2rem;
    height: 2rem;
    background: rgba(var(--primary-rgb), 0.14);
    color: var(--primary-color);
    font-size: 0.8rem;
}

.profile-avatar {
    width: 5rem;
    height: 5rem;
    background: rgba(var(--primary-rgb), 0.14);
    color: var(--primary-color);
    font-size: 1.5rem;
}

.navbar-avatar.has-image,
.profile-avatar.has-image {
    background: #e2e8f0;
    color: transparent;
    overflow: hidden;
}

.avatar-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: inherit;
}

.profile-avatar.profile-avatar-sm {
    width: 4rem;
    height: 4rem;
    font-size: 1.1rem;
}

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

.profile-info-card {
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 0.9rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.9);
}

.profile-edit-panel {
    border-top: 1px solid rgba(15, 23, 42, 0.08);
    padding-top: 1.5rem;
}

.avatar-actions-panel {
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 0.9rem;
    padding: 1rem;
    background: rgba(248, 250, 252, 0.9);
}

.avatar-upload-form .form-control[type="file"] {
    overflow: hidden;
}

.notification-pref-card {
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 0.9rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.94);
}

.notification-toggle-group {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
}

.notification-switch {
    min-width: 7rem;
}

.profile-tabs .nav-link {
    font-weight: 600;
    color: #64748b;
    border: 0;
    border-bottom: 2px solid transparent;
}

.profile-tabs .nav-link.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background: transparent;
}

.profile-activity-item {
    padding: 1rem 0;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.profile-activity-item:last-child {
    border-bottom: 0;
}

.security-panel-grid {
    display: grid;
    gap: 1.25rem;
}

.security-panel-card,
.session-card,
.security-timeline-item {
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 0.9rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.94);
}

.session-card-list,
.delegation-card-list,
.security-timeline-list {
    display: grid;
    gap: 1rem;
}

.session-meta-grid,
.delegation-meta-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
}

.delegation-card {
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 0.9rem;
    padding: 1rem;
    background: rgba(248, 250, 252, 0.94);
}

.session-card-actions {
    min-width: 10rem;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.device-type-icon {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(59, 130, 246, 0.12);
    color: var(--primary-color);
    font-size: 0.95rem;
}

.session-rename-form {
    border-top: 1px dashed rgba(15, 23, 42, 0.12);
    padding-top: 1rem;
}

.session-action-stack {
    width: 100%;
    display: grid;
    gap: 0.75rem;
}

.session-current-note {
    text-align: center;
    padding: 0.65rem 0.75rem;
    border: 1px dashed rgba(15, 23, 42, 0.15);
    border-radius: 0.75rem;
    background: rgba(248, 250, 252, 0.9);
}

body.user-font-small {
    font-size: 0.92rem;
}

body.user-font-normal {
    font-size: 1rem;
}

body.user-font-large {
    font-size: 1.08rem;
}

body.user-density-compact .table > :not(caption) > * > * {
    padding-top: 0.45rem;
    padding-bottom: 0.45rem;
}

body.user-density-comfortable .table > :not(caption) > * > * {
    padding-top: 0.8rem;
    padding-bottom: 0.8rem;
}

@media (max-width: 767.98px) {
    .profile-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        scrollbar-width: thin;
    }

    .profile-tabs .nav-link {
        white-space: nowrap;
    }

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

    .profile-form-actions {
        flex-direction: column-reverse;
    }

    .profile-form-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .avatar-actions-panel .d-sm-flex {
        display: grid !important;
    }

    .notification-toggle-group {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .notification-switch {
        min-width: 0;
    }

    .session-meta-grid,
    .delegation-meta-grid {
        grid-template-columns: 1fr;
    }

    .session-card-actions {
        min-width: 0;
        justify-content: stretch;
    }

    .session-card-actions .btn {
        width: 100%;
        justify-content: center;
    }
}

.bg-danger-subtle { background-color: #fee2e2 !important; }
.bg-warning-subtle { background-color: #fef3c7 !important; }
.bg-primary-subtle { background-color: #dbeafe !important; }
.bg-success-subtle { background-color: #dcfce7 !important; }

.urgency-pulse {
    animation: pulse-danger 2s infinite;
}

@keyframes pulse-danger {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}
