/* ============================================
   PREMIUM TEAL THEME - Shopping Mart POS Dashboard
   ============================================ */

:root {
    /* Primary Teal Colors */
    --teal-primary: #0B7077;
    --teal-light: #6FC5C5;
    --teal-accent: #98E0D5;
    --teal-dark: #112D32;
    
    /* Background Colors */
    --bg-soft-gray: #F5F7F8;
    --bg-card: #FFFFFF;
    --bg-body: #FFFFFF;
    
    /* Border Colors */
    --border-color: #E6ECEC;
    --border-light: #D5E3E3;
    
    /* Text Colors */
    --text-primary: #1A2E35;
    --text-secondary: #6B7A80;
    --text-muted: #8A9BA0;
    
    /* Sidebar Colors */
    --sidebar-bg: #0B7077;
    --sidebar-active-bg: rgba(255, 255, 255, 0.20);
    --sidebar-active-text: #FFFFFF;
    --sidebar-inactive-text: rgba(255, 255, 255, 0.70);
    --sidebar-hover-bg: rgba(255, 255, 255, 0.10);
    --sidebar-icon-opacity: 0.70;
    
    /* Button Colors */
    --btn-primary-bg: #0B7077;
    --btn-primary-hover: #095A5F;
    --btn-secondary-bg: #E6ECEC;
    --btn-secondary-hover: #DDE4E4;
    --btn-secondary-text: #0B7077;
    
    /* Table Colors */
    --table-header-bg: #F5F7F8;
    --table-header-text: #1A2E35;
    --table-row-hover: #F0FAFA;
    --table-active-border: #0B7077;
    
    /* Shadow */
    --shadow-soft: 0 2px 6px rgba(0, 0, 0, 0.06);
    --shadow-card: 0 2px 8px rgba(11, 112, 119, 0.08);
    
    /* Border Radius */
    --radius-card: 20px;
    --radius-button: 12px;
    --radius-input: 14px;
    --radius-search: 18px;
}

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

body {
    background-color: var(--bg-soft-gray) !important;
    color: var(--text-primary);
    font-size: 15px;
    line-height: 1.6;
}

/* ============================================
   SIDEBAR STYLES
   ============================================ */

.vertical-menu {
    background-color: var(--sidebar-bg) !important;
    border-right: none !important;
}

#sidebar-menu {
    background-color: transparent !important;
}

.vertical-menu .metismenu li a {
    color: var(--sidebar-inactive-text) !important;
    transition: all 0.3s ease;
    padding: 12px 20px;
    border-radius: 10px;
    margin: 4px 12px;
}

.vertical-menu .metismenu li a i {
    opacity: var(--sidebar-icon-opacity);
    margin-right: 12px;
}

.vertical-menu .metismenu li a:hover {
    background-color: var(--sidebar-hover-bg) !important;
    color: var(--sidebar-active-text) !important;
}

.vertical-menu .metismenu li a.active,
.vertical-menu .metismenu li.mm-active > a {
    background-color: var(--sidebar-active-bg) !important;
    color: var(--sidebar-active-text) !important;
    font-weight: 500;
}

.vertical-menu .metismenu li a.active i,
.vertical-menu .metismenu li.mm-active > a i {
    opacity: 1;
}

.vertical-menu .metismenu .sub-menu {
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    margin: 8px 12px;
    padding: 8px 0;
}

.vertical-menu .metismenu .sub-menu li a {
    padding: 10px 20px 10px 50px;
    color: rgba(255, 255, 255, 0.60) !important;
    font-size: 14px;
}

.vertical-menu .metismenu .sub-menu li a:hover {
    background-color: var(--sidebar-hover-bg) !important;
    color: var(--sidebar-active-text) !important;
}

.vertical-menu .metismenu .sub-menu li a.active {
    background-color: var(--sidebar-active-bg) !important;
    color: var(--sidebar-active-text) !important;
}

.user-sidebar {
    background-color: rgba(0, 0, 0, 0.15);
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.user-sidebar .user-info h5 {
    color: #FFFFFF !important;
}

.user-sidebar .user-info span {
    color: rgba(255, 255, 255, 0.70) !important;
}

.menu-title {
    color: rgba(255, 255, 255, 0.50) !important;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 16px 20px 8px;
}

/* ============================================
   HEADER / NAVBAR STYLES
   ============================================ */

#page-topbar {
    background-color: var(--bg-card) !important;
    box-shadow: var(--shadow-soft) !important;
    border-bottom: 1px solid var(--border-color);
}

.navbar-header {
    padding: 12px 24px;
}

.navbar-brand-box {
    background-color: transparent;
}

.header-item {
    color: var(--text-secondary) !important;
}

.header-item:hover {
    color: var(--teal-primary) !important;
}

/* Search Bar */
.search-wrap {
    background-color: var(--bg-card);
}

.search-bar .search-input {
    background-color: var(--bg-soft-gray);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-search);
    padding: 10px 20px;
    color: var(--text-primary);
    font-size: 15px;
}

.search-bar .search-input:focus {
    border-color: var(--teal-primary);
    box-shadow: 0 0 0 3px rgba(11, 112, 119, 0.15);
    outline: none;
}

.search-bar .search-input::placeholder {
    color: var(--text-muted);
}

/* ============================================
   DASHBOARD CARDS
   ============================================ */

.card {
    background-color: var(--bg-card) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-card) !important;
    box-shadow: var(--shadow-card) !important;
    margin-bottom: 24px;
    transition: all 0.3s ease;
    overflow: hidden;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(11, 112, 119, 0.12) !important;
    transform: translateY(-2px);
}

.card-body {
    padding: 24px 26px !important;
}

.card .font-size-16 {
    color: var(--text-secondary);
    font-size: 15px;
    font-weight: 500;
    margin-bottom: 12px;
}

.card .font-size-20 {
    color: var(--teal-primary);
    font-size: 22px;
    font-weight: 600;
    margin: 8px 0;
}

.card .text-muted {
    color: var(--text-secondary) !important;
    font-size: 14px;
}

/* Card Icons */
.mini-stat-icon .avatar-title {
    background-color: rgba(11, 112, 119, 0.10) !important;
    color: var(--teal-primary) !important;
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mini-stat-icon .avatar-title i {
    font-size: 24px;
    color: var(--teal-primary) !important;
}

/* Progress Bars */
.progress {
    background-color: var(--bg-soft-gray);
    border-radius: 10px;
    height: 6px !important;
    overflow: hidden;
}

.progress-bar {
    background-color: var(--teal-primary) !important;
    border-radius: 10px;
}

/* ============================================
   BUTTONS
   ============================================ */

.btn-primary {
    background-color: var(--btn-primary-bg) !important;
    border-color: var(--btn-primary-bg) !important;
    color: #FFFFFF !important;
    border-radius: var(--radius-button) !important;
    padding: 10px 20px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background-color: var(--btn-primary-hover) !important;
    border-color: var(--btn-primary-hover) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(11, 112, 119, 0.25);
}

.btn-secondary {
    background-color: var(--btn-secondary-bg) !important;
    border-color: var(--btn-secondary-bg) !important;
    color: var(--btn-secondary-text) !important;
    border-radius: var(--radius-button) !important;
    padding: 10px 20px;
    font-weight: 500;
}

.btn-secondary:hover {
    background-color: var(--btn-secondary-hover) !important;
    border-color: var(--btn-secondary-hover) !important;
    color: var(--btn-secondary-text) !important;
}

.btn-success {
    background-color: var(--teal-primary) !important;
    border-color: var(--teal-primary) !important;
    border-radius: var(--radius-button) !important;
}

/* ============================================
   FORMS & INPUTS
   ============================================ */

.form-control {
    border: 1px solid var(--border-light) !important;
    border-radius: var(--radius-input) !important;
    padding: 12px 16px;
    font-size: 15px;
    color: var(--text-primary);
    background-color: var(--bg-card);
    transition: all 0.3s ease;
}

.form-control:focus {
    border-color: var(--teal-primary) !important;
    box-shadow: 0 0 0 3px rgba(11, 112, 119, 0.25) !important;
    outline: none;
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-label {
    color: var(--text-primary);
    font-weight: 500;
    font-size: 14px;
    margin-bottom: 8px;
}

/* ============================================
   TABLES
   ============================================ */

.table {
    background-color: var(--bg-card);
    border-radius: var(--radius-card);
    overflow: hidden;
}

.table thead {
    background-color: var(--table-header-bg) !important;
}

.table thead th {
    color: var(--table-header-text) !important;
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 16px 20px;
    border-bottom: 2px solid var(--border-color);
}

.table tbody td {
    color: var(--text-primary);
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    font-size: 15px;
}

.table tbody tr {
    transition: all 0.2s ease;
}

.table tbody tr:hover {
    background-color: var(--table-row-hover) !important;
}

.table tbody tr.active {
    border-left: 3px solid var(--table-active-border);
    background-color: var(--table-row-hover) !important;
}

.table-responsive {
    border-radius: var(--radius-card);
    overflow: hidden;
}

/* ============================================
   BADGES
   ============================================ */

.badge {
    border-radius: 8px;
    padding: 6px 12px;
    font-weight: 500;
    font-size: 12px;
}

.badge.bg-info,
.badge.bg-primary {
    background-color: var(--teal-primary) !important;
}

.badge.bg-success {
    background-color: var(--teal-primary) !important;
}

.badge.bg-soft-info {
    background-color: rgba(11, 112, 119, 0.15) !important;
    color: var(--teal-primary) !important;
}

/* ============================================
   LINKS
   ============================================ */

a {
    color: var(--teal-primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--btn-primary-hover);
}

a.text-success {
    color: var(--teal-primary) !important;
}

a.text-success:hover {
    color: var(--btn-primary-hover) !important;
}

/* ============================================
   PAGE TITLE
   ============================================ */

.page-title-box {
    background-color: var(--bg-card);
    padding: 24px 0;
    margin-top: 0 !important;
    margin-bottom: 24px !important;
    border-bottom: 1px solid var(--border-color);
    position: relative !important;
    top: auto !important;
    z-index: 1 !important;
    display: block !important;
    clear: both !important;
}

.page-title h4 {
    color: var(--text-primary);
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 8px;
}

.breadcrumb {
    background-color: transparent;
    padding: 0;
    margin: 0;
}

.breadcrumb-item {
    color: var(--text-secondary);
    font-size: 14px;
}

.breadcrumb-item.active {
    color: var(--text-primary);
    font-weight: 500;
}

.breadcrumb-item a {
    color: var(--text-secondary);
}

.breadcrumb-item a:hover {
    color: var(--teal-primary);
}

/* ============================================
   PAGINATION
   ============================================ */

.pagination .page-link {
    color: var(--text-secondary);
    border-color: var(--border-color);
    border-radius: 8px;
    margin: 0 4px;
    padding: 8px 14px;
}

.pagination .page-link:hover {
    background-color: var(--teal-primary);
    color: #FFFFFF;
    border-color: var(--teal-primary);
}

.pagination .page-item.active .page-link {
    background-color: var(--teal-primary);
    border-color: var(--teal-primary);
    color: #FFFFFF;
}

/* ============================================
   DROPDOWN MENUS
   ============================================ */

.dropdown-menu {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    padding: 8px;
}

.dropdown-item {
    border-radius: 8px;
    padding: 10px 16px;
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.dropdown-item:hover {
    background-color: var(--table-row-hover);
    color: var(--teal-primary);
}

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

.text-teal {
    color: var(--teal-primary) !important;
}

.bg-teal {
    background-color: var(--teal-primary) !important;
}

.bg-soft-teal {
    background-color: rgba(11, 112, 119, 0.10) !important;
}

.border-teal {
    border-color: var(--teal-primary) !important;
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */

@media (max-width: 768px) {
    .card-body {
        padding: 20px !important;
    }
    
    .card .font-size-20 {
        font-size: 20px;
    }
    
    .vertical-menu .metismenu li a {
        padding: 10px 16px;
        margin: 2px 8px;
    }
}

/* ============================================
   MAIN CONTENT AREA
   ============================================ */

.main-content {
    background-color: var(--bg-soft-gray);
    min-height: 100vh;
    padding-top: 0;
    position: relative;
}

.page-content {
    position: relative !important;
    padding: 0 !important;
    margin: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 60px !important;
}

.page-content-wrapper {
    padding: 0 !important;
    margin-top: 0 !important; /* Override the -90px from app.css */
    position: relative;
    z-index: 0;
    clear: both;
}

/* Override negative margin from app.css that causes overlap */
body .page-content-wrapper,
.page-content-wrapper {
    margin-top: 0 !important;
}

/* Ensure page-title-box is visible below header */
.page-title-box {
    margin-top: 0 !important;
    margin-bottom: 24px !important;
    position: relative !important;
    top: auto !important;
    z-index: 1 !important;
}

.container-fluid {
    padding-left: 24px;
    padding-right: 24px;
}

/* Ensure container after page-title-box has proper spacing */
.page-title-box + .container-fluid {
    margin-top: 0 !important;
    padding-top: 24px !important;
    clear: both;
    display: block;
}

/* Ensure first row of cards has proper spacing from header */
.page-content-wrapper > .row:first-child {
    margin-top: 0;
    padding-top: 0;
}

/* Prevent any negative margins or absolute positioning that could cause overlap */
.kpi-card,
.chart-card {
    position: relative;
    margin-top: 0 !important;
}

/* Ensure no cards overlap the header - force proper spacing */
.page-title-box {
    display: block !important;
    width: 100% !important;
    clear: both !important;
    margin-bottom: 24px !important;
}

/* Force container after page-title-box to start below it */
.page-title-box + .container-fluid {
    display: block !important;
    clear: both !important;
    margin-top: 0 !important;
    padding-top: 24px !important;
    position: relative !important;
}

.page-title-box + .container-fluid .page-content-wrapper {
    margin-top: 0 !important;
    padding-top: 0 !important;
    position: relative !important;
}

.page-title-box + .container-fluid .kpi-card,
.page-title-box + .container-fluid .chart-card {
    margin-top: 0 !important;
    position: relative !important;
    top: auto !important;
}

/* Override any absolute positioning from other CSS files */
.main-content .page-content .container-fluid {
    position: relative !important;
    top: auto !important;
    margin-top: 0 !important;
}

/* Specific fix for dashboard layout - ensure content starts after page-title-box */
.page-content > .page-title-box {
    margin-bottom: 24px !important;
}

.page-content > .page-title-box + .container-fluid {
    padding-top: 24px !important;
    margin-top: 0 !important;
}

/* Ensure first row doesn't have negative margins */
.page-content > .page-title-box + .container-fluid > .page-content-wrapper > .row:first-child {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* ============================================
   CRITICAL LAYOUT FIX - PREVENT OVERLAP
   ============================================ */

/* Override app.css padding - restore header spacing but fix content flow */
.main-content .page-content {
    padding-top: 70px !important; /* Account for fixed header (70px height) */
    padding-left: 12px !important;
    padding-right: 12px !important;
    padding-bottom: 60px !important;
}

/* Ensure page-title-box is in normal flow and takes space */
.main-content .page-content .page-title-box {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    margin-top: 0 !important;
    margin-bottom: 24px !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-top: 24px !important;
    padding-bottom: 20px !important;
    display: block !important;
    width: 100% !important;
    clear: both !important;
    float: none !important;
    height: auto !important;
    min-height: auto !important;
}

/* Force the container after page-title-box to be below it */
.main-content .page-content .page-title-box ~ .container-fluid,
.main-content .page-content .page-title-box + .container-fluid {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    margin-top: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-top: 24px !important;
    clear: both !important;
    display: block !important;
    float: none !important;
}

/* Ensure all content inside is in normal flow */
.main-content .page-content .page-title-box ~ .container-fluid .page-content-wrapper,
.main-content .page-content .page-title-box + .container-fluid .page-content-wrapper {
    position: relative !important;
    top: auto !important;
    margin-top: 0 !important;
    padding-top: 0 !important;
    clear: both !important;
}

/* Ensure cards are in normal flow */
.main-content .page-content .page-title-box ~ .container-fluid .kpi-card,
.main-content .page-content .page-title-box ~ .container-fluid .chart-card,
.main-content .page-content .page-title-box + .container-fluid .kpi-card,
.main-content .page-content .page-title-box + .container-fluid .chart-card {
    position: relative !important;
    top: auto !important;
    margin-top: 0 !important;
}

/* ============================================
   ADDITIONAL COMPONENT STYLES
   ============================================ */

/* Ensure sidebar width is maintained */
#sidebar-menu {
    padding: 16px 0;
}

/* Fix for any Bootstrap overrides */
.bg-success {
    background-color: var(--teal-primary) !important;
}

.text-success {
    color: var(--teal-primary) !important;
}

/* Icon adjustments */
.mdi {
    font-size: inherit;
}

/* Ensure proper spacing */
.row {
    margin-left: -12px;
    margin-right: -12px;
}

.row > * {
    padding-left: 12px;
    padding-right: 12px;
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: fadeIn 0.4s ease-out;
}

/* ============================================
   OVERRIDE EXISTING THEMES
   ============================================ */

/* Ensure teal theme takes priority */
body .card {
    background-color: var(--bg-card) !important;
}

body .vertical-menu {
    background: var(--sidebar-bg) !important;
}

/* Fix for any conflicting styles */
.bg-soft-info {
    background-color: rgba(11, 112, 119, 0.10) !important;
}

/* Ensure text colors are correct */
.text-teal,
.font-size-20.text-teal {
    color: var(--teal-primary) !important;
}

/* Progress bar overrides */
.progress-bar.bg-teal,
.progress-bar.bg-success {
    background-color: var(--teal-primary) !important;
}

/* Avatar title adjustments */
.avatar-title.rounded-circle {
    border-radius: 14px !important;
}

/* Ensure proper icon colors in cards */
.card .mdi.text-teal,
.card .mdi.text-success {
    color: var(--teal-primary) !important;
}

/* ============================================
   CHART CONTAINERS
   ============================================ */

.chart-container {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-card);
    padding: 24px;
    margin-bottom: 24px;
}

/* ============================================
   ALERTS & NOTIFICATIONS
   ============================================ */

.alert {
    border-radius: 12px;
    border: none;
    padding: 16px 20px;
}

.alert-success {
    background-color: rgba(11, 112, 119, 0.10);
    color: var(--teal-primary);
    border-left: 4px solid var(--teal-primary);
}

.alert-warning {
    background-color: rgba(255, 193, 7, 0.10);
    color: #856404;
    border-left: 4px solid #ffc107;
}

.alert-danger {
    background-color: rgba(220, 53, 69, 0.10);
    color: #721c24;
    border-left: 4px solid #dc3545;
}

/* ============================================
   DASHBOARD KPI CARDS
   ============================================ */

.kpi-card {
    background: #FFFFFF;
    border: 1px solid #E6ECEC;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
    height: 100%;
    overflow: hidden;
    min-height: 120px;
}

.kpi-card:hover {
    box-shadow: 0 4px 12px rgba(11, 112, 119, 0.12);
    transform: translateY(-2px);
}

.kpi-card-featured {
    background: linear-gradient(135deg, #0B7077 0%, #095A5F 100%);
    border: none;
}

.kpi-card-featured .kpi-value,
.kpi-card-featured .kpi-label,
.kpi-card-featured .kpi-change {
    color: #FFFFFF !important;
}

.kpi-card-body {
    padding: 14px 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    overflow: hidden;
    height: 100%;
}

.kpi-icon-wrapper {
    flex-shrink: 0;
}

.kpi-icon-badge {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(11, 112, 119, 0.10);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #0B7077;
    font-size: 18px;
    flex-shrink: 0;
}

.kpi-card-featured .kpi-icon-badge {
    background: rgba(255, 255, 255, 0.20);
    color: #FFFFFF;
}

.kpi-icon-badge.alert {
    background: rgba(220, 53, 69, 0.10);
    color: #dc3545;
}

.kpi-content {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    width: 100%;
}

.kpi-value {
    font-size: 18px;
    font-weight: 600;
    color: #0B7077;
    margin: 0 0 3px 0;
    line-height: 1.2;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.kpi-label {
    font-size: 11px;
    color: #6B7A80;
    margin: 0 0 8px 0;
    font-weight: 500;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    line-height: 1.3;
}

.kpi-change {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    margin-top: 6px;
    flex-wrap: nowrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: nowrap;
    line-height: 1.3;
}

.kpi-change.positive {
    color: #23c58f;
}

.kpi-change.negative {
    color: #f14e4e;
}

.kpi-change i {
    font-size: 14px;
    flex-shrink: 0;
}

.kpi-change span {
    font-weight: 600;
    flex-shrink: 0;
}

.kpi-change small {
    color: #6B7A80;
    font-size: 9px;
    margin-left: 3px;
    white-space: nowrap;
    word-wrap: break-word;
    display: inline;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================================
   CHART CARDS
   ============================================ */

.chart-card {
    background: #FFFFFF;
    border: 1px solid #E6ECEC;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    height: 100%;
}

.chart-card-header {
    padding: 14px 18px;
    border-bottom: 1px solid #E6ECEC;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chart-title {
    font-size: 15px;
    font-weight: 600;
    color: #1A2E35;
    margin: 0;
}

.btn-view-all {
    font-size: 12px;
    color: #0B7077;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
    padding: 4px 8px;
}

.btn-view-all:hover {
    color: #095A5F;
}

.chart-card-body {
    padding: 16px 18px;
}

/* Responsive Chart Card Body Padding */
@media (min-width: 1920px) {
    .chart-card-body {
        padding: 18px 20px;
    }
}

@media (min-width: 1366px) and (max-width: 1919px) {
    .chart-card-body {
        padding: 16px 18px;
    }
}

@media (max-width: 1365px) {
    .chart-card-body {
        padding: 14px 16px;
    }
}

.chart-legend {
    display: flex;
    gap: 16px;
    margin-top: 12px;
    justify-content: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #6B7A80;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

.gauge-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    padding-top: 16px;
    border-top: 1px solid #E6ECEC;
}

.gauge-footer-text {
    font-size: 14px;
    color: #6B7A80;
    margin: 0;
}

/* ============================================
   TOP ITEMS LIST
   ============================================ */

.top-items-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.top-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.item-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.item-name {
    font-size: 14px;
    font-weight: 500;
    color: #1A2E35;
}

.item-qty {
    font-size: 13px;
    color: #6B7A80;
}

.item-progress {
    height: 6px;
    background: #F5F7F8;
    border-radius: 10px;
    overflow: hidden;
}

.progress-bar-item {
    height: 100%;
    background: linear-gradient(90deg, #0B7077 0%, #6FC5C5 100%);
    border-radius: 10px;
    transition: width 0.3s ease;
}

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

.table-modern {
    margin: 0;
    border-collapse: separate;
    border-spacing: 0;
}

.table-modern thead {
    background: #F5F7F8;
}

.table-modern thead th {
    padding: 10px 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: #1A2E35;
    border-bottom: 2px solid #E6ECEC;
    border-top: none;
}

.table-modern tbody td {
    padding: 10px 12px;
    font-size: 12px;
    color: #1A2E35;
    border-bottom: 1px solid #E6ECEC;
}

/* Responsive Table Sizing */
@media (min-width: 1920px) {
    .table-modern thead th {
        padding: 12px 16px;
        font-size: 12px;
    }
    
    .table-modern tbody td {
        padding: 12px 16px;
        font-size: 13px;
    }
}

@media (min-width: 1366px) and (max-width: 1919px) {
    .table-modern thead th {
        padding: 10px 12px;
        font-size: 11px;
    }
    
    .table-modern tbody td {
        padding: 10px 12px;
        font-size: 12px;
    }
}

@media (max-width: 1365px) {
    .table-modern thead th {
        padding: 8px 10px;
        font-size: 10px;
    }
    
    .table-modern tbody td {
        padding: 8px 10px;
        font-size: 11px;
    }
}

.table-modern tbody tr:hover {
    background: #F0FAFA;
}

.badge-status {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
}

.badge-status.paid {
    background: rgba(35, 197, 143, 0.15);
    color: #23c58f;
}

.badge-status.unpaid {
    background: rgba(249, 184, 90, 0.15);
    color: #f9b85a;
}

.badge-status.critical {
    background: rgba(220, 53, 69, 0.15);
    color: #dc3545;
}

.badge-status.warning {
    background: rgba(249, 184, 90, 0.15);
    color: #f9b85a;
}

.action-icons {
    display: flex;
    gap: 12px;
    align-items: center;
}

.action-icons i {
    font-size: 18px;
    color: #6B7A80;
    cursor: pointer;
    transition: color 0.2s;
}

.action-icons i:hover {
    color: #0B7077;
}

/* ============================================
   TABLE HEADER WITH TABS
   ============================================ */

.chart-card-header .header-left,
.chart-card-header .header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.table-tabs {
    display: flex;
    gap: 8px;
}

.tab-btn {
    padding: 8px 16px;
    border: 1px solid #E6ECEC;
    background: #FFFFFF;
    color: #6B7A80;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn:hover {
    background: #F5F7F8;
    color: #1A2E35;
}

.tab-btn.active {
    background: #0B7077;
    color: #FFFFFF;
    border-color: #0B7077;
}

.search-box-table {
    position: relative;
    display: flex;
    align-items: center;
}

.search-box-table i {
    position: absolute;
    left: 12px;
    color: #6B7A80;
    font-size: 18px;
}

.search-input-table {
    padding: 10px 16px 10px 40px;
    border: 1px solid #E6ECEC;
    border-radius: 18px;
    font-size: 14px;
    color: #1A2E35;
    background: #F5F7F8;
    width: 300px;
    transition: all 0.3s;
}

.search-input-table:focus {
    outline: none;
    border-color: #0B7077;
    background: #FFFFFF;
    box-shadow: 0 0 0 3px rgba(11, 112, 119, 0.15);
}

.btn-filter {
    padding: 10px 20px;
    border: 1px solid #E6ECEC;
    background: #FFFFFF;
    color: #6B7A80;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-filter:hover {
    background: #F5F7F8;
    color: #1A2E35;
    border-color: #D5E3E3;
}

/* ============================================
   MODALS
   ============================================ */

.modal-content {
    border-radius: var(--radius-card);
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
    padding: 20px 24px;
}

.modal-title {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 20px;
}

.modal-body {
    padding: 24px;
    color: var(--text-primary);
}

.modal-footer {
    border-top: 1px solid var(--border-color);
    padding: 16px 24px;
}

/* ============================================
   FINAL CRITICAL OVERRIDE - MUST BE LAST
   ============================================ */

/* Force proper layout flow - override ALL conflicting styles */
body .main-content .page-content {
    padding-top: 0 !important;
    padding-left: 12px !important;
    padding-right: 12px !important;
    padding-bottom: 60px !important;
}

body .main-content .page-content .page-title-box {
    position: relative !important;
    top: auto !important;
    margin-top: 0 !important;
    margin-bottom: 24px !important;
    padding-top: 24px !important;
    padding-bottom: 20px !important;
    display: block !important;
    width: 100% !important;
    clear: both !important;
    float: none !important;
    height: auto !important;
    z-index: auto !important;
}

body .main-content .page-content .page-title-box + .container-fluid,
body .main-content .page-content .page-title-box ~ .container-fluid {
    position: relative !important;
    top: auto !important;
    margin-top: 0 !important;
    padding-top: 24px !important;
    clear: both !important;
    display: block !important;
    float: none !important;
}

body .main-content .page-content .page-title-box + .container-fluid .page-content-wrapper,
body .main-content .page-content .page-title-box ~ .container-fluid .page-content-wrapper {
    position: relative !important;
    top: auto !important;
    margin-top: 0 !important;
    padding-top: 0 !important;
}

body .main-content .page-content .page-title-box + .container-fluid .kpi-card,
body .main-content .page-content .page-title-box + .container-fluid .chart-card {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    margin-top: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    transform: none !important;
    -webkit-transform: none !important;
}

/* Prevent any negative positioning - CRITICAL FIX */
body .main-content .page-content .page-title-box {
    margin-top: 0 !important;
    margin-bottom: 24px !important;
}

body .main-content .page-content .page-title-box ~ *,
body .main-content .page-content .page-title-box + * {
    margin-top: 0 !important;
    top: auto !important;
    position: relative !important;
}

/* Ensure first row of cards starts after header */
body .main-content .page-content .page-title-box + .container-fluid {
    margin-top: 0 !important;
    padding-top: 24px !important;
}

body .main-content .page-content .page-title-box + .container-fluid .page-content-wrapper .row:first-child {
    margin-top: 0 !important;
    padding-top: 0 !important;
    transform: none !important;
    -webkit-transform: none !important;
    position: relative !important;
    top: auto !important;
}

/* Override any card transforms that might cause overlap */
body .main-content .page-content .kpi-card,
body .main-content .page-content .chart-card {
    transform: none !important;
    -webkit-transform: none !important;
    margin-top: 0 !important;
    top: auto !important;
}

/* Dashboard content wrapper - ensures proper spacing */
.dashboard-content-wrapper {
    margin-top: 0 !important;
    padding-top: 24px !important;
    clear: both !important;
    display: block !important;
    position: relative !important;
    top: auto !important;
}

/* Ensure page-title-box closes properly and next element starts below */
.page-title-box::after {
    content: '';
    display: block;
    clear: both;
    height: 0;
    visibility: hidden;
}

/* Force page-title-box to take up space */
.page-title-box {
    min-height: 80px !important;
    box-sizing: border-box !important;
}

/* ============================================
   RESPONSIVE FIXES FOR KPI CARDS
   ============================================ */

/* Large Desktop (24" and above - 1920px+) */
@media (min-width: 1920px) {
    .kpi-card {
        min-height: 130px !important;
    }
    
    .kpi-card-body {
        padding: 16px 18px !important;
    }
    
    .kpi-icon-badge {
        width: 44px !important;
        height: 44px !important;
        font-size: 20px !important;
    }
    
    .kpi-value {
        font-size: 20px !important;
    }
    
    .kpi-label {
        font-size: 12px !important;
    }
    
    .kpi-change {
        font-size: 11px !important;
    }
    
    .kpi-change small {
        font-size: 10px !important;
    }
    
    .chart-card-header {
        padding: 16px 20px !important;
    }
    
    .chart-title {
        font-size: 16px !important;
    }
    
    .chart-card-body {
        padding: 18px 20px !important;
    }
}

/* Standard Desktop (13" Laptop - 1366px to 1919px) */
@media (min-width: 1366px) and (max-width: 1919px) {
    .kpi-card {
        min-height: 120px !important;
    }
    
    .kpi-card-body {
        padding: 14px 16px !important;
    }
    
    .kpi-icon-badge {
        width: 40px !important;
        height: 40px !important;
        font-size: 18px !important;
    }
    
    .kpi-value {
        font-size: 18px !important;
    }
    
    .kpi-label {
        font-size: 11px !important;
    }
    
    .kpi-change {
        font-size: 10px !important;
    }
    
    .kpi-change small {
        font-size: 9px !important;
    }
    
    .chart-card-header {
        padding: 14px 18px !important;
    }
    
    .chart-title {
        font-size: 15px !important;
    }
    
    .chart-card-body {
        padding: 16px 18px !important;
    }
}

/* Tablet and Small Desktop (1024px to 1365px) */
@media (min-width: 1024px) and (max-width: 1365px) {
    .kpi-card {
        min-height: 115px !important;
    }
    
    .kpi-card-body {
        padding: 12px 14px !important;
        gap: 10px !important;
    }
    
    .kpi-icon-badge {
        width: 36px !important;
        height: 36px !important;
        font-size: 16px !important;
    }
    
    .kpi-value {
        font-size: 16px !important;
    }
    
    .kpi-label {
        font-size: 10px !important;
    }
    
    .kpi-change {
        font-size: 9px !important;
    }
    
    .kpi-change small {
        font-size: 8px !important;
    }
}

/* Tablet Portrait (768px to 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
    .kpi-card {
        min-height: 110px !important;
    }
    
    .kpi-card-body {
        padding: 12px !important;
        gap: 10px !important;
    }
    
    .kpi-icon-badge {
        width: 36px !important;
        height: 36px !important;
        font-size: 16px !important;
    }
    
    .kpi-value {
        font-size: 16px !important;
    }
    
    .kpi-label {
        font-size: 10px !important;
    }
    
    .kpi-change {
        font-size: 9px !important;
    }
    
    .kpi-change small {
        font-size: 8px !important;
    }
}

/* Mobile (below 768px) */
@media (max-width: 767px) {
    .kpi-card {
        min-height: 100px !important;
    }
    
    .kpi-card-body {
        padding: 12px !important;
        gap: 10px !important;
    }
    
    .kpi-icon-badge {
        width: 32px !important;
        height: 32px !important;
        font-size: 14px !important;
    }
    
    .kpi-value {
        font-size: 15px !important;
    }
    
    .kpi-label {
        font-size: 10px !important;
    }
    
    .kpi-change {
        font-size: 9px !important;
    }
    
    .kpi-change small {
        font-size: 8px !important;
    }
}

/* Small Mobile (below 576px) */
@media (max-width: 575px) {
    .kpi-card {
        min-height: 95px !important;
    }
    
    .kpi-card-body {
        padding: 10px !important;
        flex-direction: column !important;
        align-items: center !important;
        text-align: center !important;
    }
    
    .kpi-content {
        text-align: center !important;
    }
    
    .kpi-change {
        justify-content: center !important;
    }
}

/* Additional safety - ensure no overlap possible */
.main-content .page-content {
    overflow: visible !important;
}

.main-content .page-content .page-title-box {
    overflow: visible !important;
    z-index: 10 !important;
}

.main-content .page-content .page-title-box + .container-fluid,
.main-content .page-content .page-title-box ~ .container-fluid {
    z-index: 1 !important;
}
