/* ==========================================================================
   Auven — Modern SaaS Theme v2
   Reference: Clean dashboard with icon sidebar, white/gray palette, green accent
   ========================================================================== */

/* Google Fonts are loaded in header.php */

:root {
    /* ---- Core Palette ---- */
    --accent:        #3DDB85;      /* Lime-green accent from reference */
    --accent-hover:  #2BC870;
    --accent-dark:   #111111;      /* Black CTA card */
    --bg:            #F5F5F5;      /* Near-white page background */
    --surface:       #FFFFFF;      /* Card / sidebar background */
    --surface-2:     #EBEBEB;      /* Slightly darker surface */
    --text:          #111111;      /* Main text */
    --text-muted:    #888888;      /* Muted / label text */
    --border:        #E4E4E4;

    /* ---- Status ---- */
    --success:  #3DDB85;
    --warning:  #F59E0B;
    --danger:   #EF4444;
    --info:     #3B82F6;

    /* ---- Layout ---- */
    --sidebar-width:    240px;    /* Expanded sidebar */
    --topbar-height:    68px;
    --content-padding:  24px;
    --radius:           16px;
    --radius-sm:        12px;
    --radius-xs:        8px;
    --shadow-sm:  0 2px 8px rgba(0,0,0,.05);
    --shadow-md:  0 6px 24px rgba(0,0,0,.08);
    --t:          0.22s ease;
}

/* Dark mode */
[data-theme="dark"] {
    --bg:         #0F0F0F;
    --surface:    #1A1A1A;
    --surface-2:  #252525;
    --text:       #F5F5F5;
    --text-muted: #888888;
    --border:     #2E2E2E;
    --shadow-sm:  0 2px 8px rgba(0,0,0,.4);
    --shadow-md:  0 6px 24px rgba(0,0,0,.5);
}

/* ============================================================
   Reset & Base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
button { border: none; outline: none; background: none; font-family: inherit; cursor: pointer; }


html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 15px;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    transition: background var(--t), color var(--t);
}

a { text-decoration: none; color: inherit; }
h1,h2,h3,h4,h5,h6 { margin: 0; font-weight: 700; color: var(--text); line-height: 1.2; }
p { margin: 0; }
img { max-width: 100%; }

#app-wrapper {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* ============================================================
   Sidebar — Icon-only strip (72px wide)
   ============================================================ */
#sidebar {
    width: var(--sidebar-width);
    background: var(--surface);
    border-right: 1px solid var(--border);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    padding: 0 0 1.5rem;
    transition: transform var(--t);
    overflow: hidden;
}

/* Logo area */
.sb-logo {
    width: 100%;
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 0 20px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.5rem;
    flex-shrink: 0;
}

.sb-logo-icon {
    width: 38px;
    height: 38px;
    background: var(--accent-dark);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.1rem;
}

/* Nav links */
.sb-nav {
    display: flex;
    flex-direction: column;
    width: 100%;
    flex: 1;
    gap: 4px;
    padding: 0.5rem 12px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
}
.sb-nav::-webkit-scrollbar { display: none; }

.sb-link {
    position: relative;
    width: 100%;
    height: 44px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 14px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 500;
    transition: background var(--t), color var(--t);
    cursor: pointer;
    white-space: nowrap;
}

.sb-link:hover {
    background: var(--surface-2);
    color: var(--text);
}

.sb-link.active {
    background: var(--accent-dark);
    color: #fff;
}
[data-theme="dark"] .sb-link.active {
    background: var(--accent);
    color: var(--accent-dark);
}

/* Tooltip label on hover */
.sb-link .sb-tooltip {
    font-size: 0.88rem;
    font-weight: 500;
    transition: color var(--t);
}

/* Section divider label in sidebar */
.sb-divider {
    width: 100%;
    height: 1px;
    background: var(--border);
    margin: 12px 0;
    flex-shrink: 0;
}

/* Bottom actions (theme, logout) */
.sb-bottom {
    display: flex;
    flex-direction: column;
    padding: 0 12px;
    gap: 4px;
    width: 100%;
    flex-shrink: 0;
}

/* ============================================================
   Main Content
   ============================================================ */
#main-content {
    flex: 1;
    min-width: 0;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left var(--t);
}

/* ============================================================
   Topbar
   ============================================================ */
#topbar {
    height: var(--topbar-height);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--content-padding);
    position: sticky;
    top: 0;
    z-index: 1000;
}

/* Search bar */
.topbar-search {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--surface-2);
    border-radius: var(--radius-sm);
    padding: 8px 16px;
    width: 260px;
    border: 1px solid transparent;
    transition: border-color var(--t);
}
.topbar-search:focus-within { border-color: var(--accent); }
.topbar-search i { color: var(--text-muted); font-size: 0.9rem; }
.topbar-search input {
    border: none;
    background: transparent;
    outline: none;
    font-size: 0.85rem;
    color: var(--text);
    width: 100%;
}
.topbar-search input::placeholder { color: var(--text-muted); }

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Icon button */
.icon-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: none;
    background: var(--surface-2);
    color: var(--text-muted);
    font-size: 1rem;
    cursor: pointer;
    transition: background var(--t), color var(--t);
    position: relative;
}
.icon-btn:hover { background: var(--border); color: var(--text); }

/* Avatar */
.topbar-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent-dark);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    flex-shrink: 0;
}

/* Mobile hamburger */
.topbar-hamburger {
    display: none;
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--text);
    cursor: pointer;
    padding: 4px 8px;
    margin-right: 8px;
}

/* ============================================================
   Page Content Area
   ============================================================ */
.page-content {
    flex: 1;
    min-width: 0;
    padding: var(--content-padding);
}

/* Page Header */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}
.page-header h1 {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.1;
}
.page-header p { color: var(--text-muted); margin-top: 4px; font-size: 0.9rem; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ============================================================
   Cards
   ============================================================ */
.card-m {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
    transition: box-shadow var(--t), transform var(--t);
}
.card-m:hover { box-shadow: var(--shadow-md); }

.card-m-dark {
    background: var(--accent-dark);
    color: #fff;
    border-color: transparent;
}

.card-m-body { padding: 24px; }
.card-m-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
    font-size: 0.92rem;
}

/* ============================================================
   Stat / KPI Cards
   ============================================================ */
.kpi-card {
    padding: 24px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--border);
    transition: transform var(--t), box-shadow var(--t);
    height: 100%;
}
.kpi-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

.kpi-card.dark {
    background: var(--accent-dark);
    border-color: transparent;
    color: #fff;
}
.kpi-card .kpi-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 10px;
}
.kpi-card.dark .kpi-label { color: rgba(255,255,255,0.6); }
.kpi-card .kpi-value {
    font-size: 2.4rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 8px;
}
.kpi-card .kpi-sub {
    font-size: 0.78rem;
    color: var(--text-muted);
}
.kpi-card.dark .kpi-sub { color: rgba(255,255,255,0.5); }

/* Arrow button on KPI card */
.kpi-arrow {
    width: 34px; height: 34px;
    background: rgba(255,255,255,0.15);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 0.85rem;
    transition: background var(--t);
}
.kpi-arrow:hover { background: rgba(255,255,255,0.3); }

/* ============================================================
   Tables
   ============================================================ */
.table-responsive {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
    scrollbar-width: thin;
}
.table-responsive::-webkit-scrollbar { height: 6px; }
.table-m { width: 100%; border-collapse: collapse; }
.table-m th {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    padding: 10px 16px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.table-m td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 0.88rem;
    vertical-align: middle;
    color: var(--text);
}
.table-m tbody tr:last-child td { border-bottom: none; }
.table-m tbody tr { transition: background var(--t); }
.table-m tbody tr:hover { background: var(--surface-2); }

/* ============================================================
   Buttons
   ============================================================ */
.btn-m {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    border: none;
    transition: background var(--t), transform var(--t), box-shadow var(--t);
    white-space: nowrap;
    text-decoration: none;
    user-select: none;
}
.btn-m:active { transform: scale(0.97); }

.btn-dark { background: var(--accent-dark); color: #fff; }
.btn-dark:hover { background: #222; color: #fff; }

.btn-accent { background: var(--accent); color: var(--accent-dark); }
.btn-accent:hover { background: var(--accent-hover); color: var(--accent-dark); }

.btn-light-m { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn-light-m:hover { background: var(--border); color: var(--text); }

.btn-danger-m { background: rgba(239,68,68,0.1); color: var(--danger); }
.btn-danger-m:hover { background: var(--danger); color: #fff; }

.btn-sm-m { padding: 6px 14px; font-size: 0.8rem; }

/* ============================================================
   Badges
   ============================================================ */
.badge-m {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 0.73rem;
    font-weight: 600;
}
.badge-green  { background: rgba(61,219,133,0.15); color: #1a9255; }
.badge-red    { background: rgba(239,68,68,0.12);  color: #c0392b; }
.badge-yellow { background: rgba(245,158,11,0.12); color: #b7791f; }
.badge-gray   { background: var(--surface-2);      color: var(--text-muted); }
.badge-blue   { background: rgba(59,130,246,0.12); color: #1d4ed8; }

/* ============================================================
   Forms
   ============================================================ */
.form-m {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 0.88rem;
    color: var(--text);
    width: 100%;
    outline: none;
    transition: border-color var(--t), box-shadow var(--t);
    background: var(--surface);
    font-family: inherit;
}
.form-m:focus {
    border-color: var(--accent-dark);
    box-shadow: 0 0 0 3px rgba(61,219,133,0.2);
}
.form-m::placeholder { color: var(--text-muted); }

/* ---- Custom styled <select> dropdowns ---- */
select.form-m,
select.form-select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23888' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px !important;
    cursor: pointer;
}

/* Select options styling — dark mode compatible */
select.form-m option,
select.form-select option {
    background: var(--surface);
    color: var(--text);
    padding: 8px;
}

/* Dark mode dropdown arrow */
[data-theme="dark"] select.form-m,
[data-theme="dark"] select.form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23aaa' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

label.label-m {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    display: block;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Bootstrap override — use our form style */
.form-control, .form-select {
    background: var(--surface) !important;
    border: 1px solid var(--border) !important;
    color: var(--text) !important;
    border-radius: var(--radius-sm) !important;
    font-size: 0.88rem !important;
    transition: border-color var(--t), box-shadow var(--t) !important;
    font-family: inherit !important;
}
.form-control:focus, .form-select:focus {
    border-color: var(--accent-dark) !important;
    box-shadow: 0 0 0 3px rgba(61,219,133,0.2) !important;
    background: var(--surface) !important;
    color: var(--text) !important;
}
.form-select {
    appearance: none !important;
    -webkit-appearance: none !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23888' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 14px center !important;
    padding-right: 36px !important;
    cursor: pointer !important;
}
[data-theme="dark"] .form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23aaa' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
}

/* ============================================================
   Alerts
   ============================================================ */
.alert { border-radius: var(--radius-sm); font-size: 0.88rem; border: none; }
.alert-success { background: rgba(61,219,133,0.12); color: #1a9255; }
.alert-danger  { background: rgba(239,68,68,0.1);   color: #c0392b; }
.alert-warning { background: rgba(245,158,11,0.1);  color: #b7791f; }
.alert-info    { background: rgba(59,130,246,0.1);  color: #1d4ed8; }

/* ============================================================
   Charts Container
   ============================================================ */
.chart-wrap { position: relative; }

/* ============================================================
   Progress
   ============================================================ */
.progress-m {
    height: 6px;
    border-radius: 10px;
    background: var(--surface-2);
    overflow: hidden;
}
.progress-m-bar {
    height: 100%;
    border-radius: 10px;
    background: var(--accent);
    transition: width 0.5s ease;
}

/* ============================================================
   Overlay for mobile sidebar
   ============================================================ */
#sb-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 1030;
    backdrop-filter: blur(2px);
}
#sb-overlay.show { display: block; }

/* ============================================================
   Responsive Breakpoints
   ============================================================ */

/* Tablet (≤ 991px) */
@media (max-width: 991.98px) {
    :root { --sidebar-width: 240px; }

    #sidebar {
        transform: translateX(-100%);
        box-shadow: var(--shadow-md);
    }
    #sidebar.show { transform: translateX(0); }
    #main-content { margin-left: 0 !important; }
    .topbar-search { width: 160px; }
    .topbar-search input { font-size: 0.8rem; }
    .topbar-hamburger { display: block !important; }

    /* Grid: stack columns on tablet */
    .row > [class*="col-lg"] { margin-bottom: 16px; }
}

/* Mobile (≤ 768px) */
@media (max-width: 768px) {
    .table-m th, .table-m td { white-space: normal; font-size: 0.82rem; padding: 10px 12px; }
    .tbl-actions { flex-wrap: wrap; }
    /* Page header: stack on small screens */
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .page-header .page-actions { flex-wrap: wrap; width: 100%; gap: 8px; }
    .page-header .page-actions .btn-m { flex: 1 1 calc(50% - 8px); justify-content: center; min-width: 100px; padding: 8px 12px; font-size: 0.78rem; }

    /* KPI Grid Adjustments */
    .kpi-card { padding: 16px; }
    .kpi-card .kpi-label { font-size: 0.7rem; margin-bottom: 6px; }
    .kpi-card .kpi-value { font-size: 1.5rem; }
    .kpi-card .kpi-sub { font-size: 0.7rem; }
    .kpi-arrow { width: 28px; height: 28px; font-size: 0.7rem; }

    /* Card body padding reduction */
    .card-m-body { padding: 16px; }

    /* DataTables responsive */
    .dataTables_wrapper .dataTables_filter,
    .dataTables_wrapper .dataTables_length { text-align: left; }
    .dataTables_wrapper .dataTables_info,
    .dataTables_wrapper .dataTables_paginate { text-align: center; margin-top: 8px; }
}

/* Mobile (≤ 575px) */
@media (max-width: 575.98px) {
    :root {
        --content-padding: 14px;
        --topbar-height: 58px;
    }
    #topbar { padding: 0 14px; }
    .topbar-right { gap: 8px; }
    .topbar-search { display: none; }
    .page-header h1 { font-size: 1.4rem; }
    .kpi-card .kpi-value { font-size: 1.8rem; }

    /* Form rows collapse to single column */
    .row.g-3 > [class*="col-md"] { flex: 0 0 100%; max-width: 100%; }

    /* Buttons fill width on mobile */
    .d-flex.gap-2.justify-content-end { flex-direction: column; }
    .d-flex.gap-2.justify-content-end .btn-m { width: 100%; justify-content: center; }

    /* Auth card padding */
    .auth-card-m { padding: 28px 20px; }

    /* Search bar row */
    .card-m-body .d-flex.gap-2 { flex-direction: column; align-items: stretch; gap: 10px !important; }
    .card-m-body .d-flex.gap-2 .btn-m { width: 100%; justify-content: center; }
    .card-m-body .d-flex.gap-2 .form-control,
    .card-m-body .d-flex.gap-2 .form-m { width: 100% !important; flex: none; }

    /* KPI on mobile */
    .kpi-card .kpi-value { font-size: 1.25rem !important; }
    .page-header h1 { font-size: 1.2rem; }

    /* Modal full-width on mobile */
    .modal-dialog { margin: 8px; }
}

/* ============================================================
   Utility classes
   ============================================================ */
.text-muted-m  { color: var(--text-muted) !important; }
.text-accent   { color: var(--accent) !important; }
.text-xs       { font-size: 0.75rem !important; }
.text-sm       { font-size: 0.85rem !important; }
.fw-semibold   { font-weight: 600 !important; }
.fw-extra      { font-weight: 800 !important; }
.rounded-lg    { border-radius: var(--radius) !important; }
.rounded-sm    { border-radius: var(--radius-sm) !important; }
.gap-sm        { gap: 8px; }
.mb-section    { margin-bottom: 28px; }

/* Keep Bootstrap table classes working with our theme */
.table         { color: var(--text); --bs-table-bg: transparent; }
.table > :not(caption) > * > * { background-color: transparent; }
.table-striped > tbody > tr:nth-of-type(odd) > * { --bs-table-accent-bg: var(--surface-2); }
.table-hover  > tbody > tr:hover > * { --bs-table-accent-bg: var(--surface-2); }
.table-light  { --bs-table-bg: var(--surface-2); color: var(--text-muted); }

/* DataTables overrides */
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    background: var(--surface);
    color: var(--text);
    font-size: 0.85rem;
}
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_filter label,
.dataTables_wrapper .dataTables_length label { color: var(--text-muted); font-size: 0.82rem; }
.dataTables_wrapper .paginate_button { border-radius: var(--radius-xs) !important; font-size: 0.82rem !important; }
.dataTables_wrapper .paginate_button.current {
    background: var(--accent-dark) !important;
    border-color: transparent !important;
    color: #fff !important;
}

/* Select2 */
.select2-container--default .select2-selection--single {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm) !important;
    height: 38px;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 38px;
    color: var(--text);
    padding-left: 12px;
}
.select2-container--default .select2-selection--single .select2-selection__arrow { height: 36px; }

/* Dropdown */
.dropdown-menu {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    font-size: 0.88rem;
}
.dropdown-item { color: var(--text); padding: 10px 18px; }
.dropdown-item:hover { background: var(--surface-2); color: var(--text); }

/* Modal */
.modal-content {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.modal-header { border-bottom: 1px solid var(--border); }
.modal-footer { border-top: 1px solid var(--border); }

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ---- Form label ---- */
.label-m {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}

/* ---- Text utilities ---- */
.text-xs  { font-size: 0.75rem !important; }
.text-sm  { font-size: 0.85rem !important; }
.fw-semibold { font-weight: 600 !important; }
.mb-section { margin-bottom: 1.5rem; }

/* ============================================================
   Table extensions — status rows, action columns
   ============================================================ */

/* Table inside a card — remove border-radius clip issue */
.card-m .table-responsive { border-radius: 0; }
.card-m .table-m th:first-child { border-radius: 0; }

/* Status row overrides (Bootstrap table-danger / table-warning with theme) */
.table > tbody > tr.table-danger > * {
    background-color: rgba(239,68,68,0.07) !important;
    color: var(--text) !important;
}
.table > tbody > tr.table-warning > * {
    background-color: rgba(245,158,11,0.07) !important;
    color: var(--text) !important;
}
.table > tbody > tr.table-success > * {
    background-color: rgba(61,219,133,0.07) !important;
    color: var(--text) !important;
}

/* Action button groups in tables */
.tbl-actions {
    display: flex;
    gap: 6px;
    justify-content: center;
    flex-wrap: wrap;
}
.tbl-actions .btn-m { padding: 5px 12px; font-size: 0.78rem; }

/* ============================================================
   Form pages — section dividers inside cards
   ============================================================ */
.form-section-title {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin: 24px 0 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

/* Input group modern */
.input-group-text {
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: var(--radius-sm) 0 0 var(--radius-sm) !important;
}

/* Alert inside card - no border */
.card-m .alert { margin-bottom: 0; border-radius: var(--radius-sm); }

/* ============================================================
   Welcome / home page
   ============================================================ */
.quick-sale-card {
    border: 2px solid var(--accent);
    border-radius: var(--radius);
    background: var(--surface);
}

/* ============================================================
   DataTables responsive
   ============================================================ */
@media (max-width: 768px) {
    .dataTables_wrapper .dataTables_filter,
    .dataTables_wrapper .dataTables_length { text-align: left; }
    .dataTables_wrapper .dataTables_info,
    .dataTables_wrapper .dataTables_paginate { text-align: center; margin-top: 8px; }
    .table-m th, .table-m td { font-size: 0.8rem; padding: 10px 10px; }
}

/* ============================================================
   Print override
   ============================================================ */
@media print {
    #sidebar, #topbar, .page-header .page-actions { display: none !important; }

    #main-content { margin-left: 0 !important; }
    .card-m { box-shadow: none; border: 1px solid #ddd; }
}

/* --- Print Invoice Visibility Fix --- */
#print-invoice-modern {
    display: none !important;
}
