/* ==========================================================================
   LOGISAGA - MONOCHROME BLACK & WHITE ERP DESIGN SYSTEM
   ========================================================================== */

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

:root {
    /* Color Palette - High Contrast Black & White (Light Theme Default) */
    --bg-main: #f8f9fa;
    --bg-card: rgba(255, 255, 255, 0.95);
    --bg-card-solid: #ffffff;
    --bg-sidebar: #f4f4f5;
    --border-color: rgba(0, 0, 0, 0.12);
    --border-accent: #000000;

    --primary: #000000;
    --primary-hover: #27272a;
    --primary-light: rgba(0, 0, 0, 0.06);
    --accent: #18181b;
    --success: #000000;
    --warning: #3f3f46;
    --danger: #000000;
    --info: #52525b;

    --text-main: #000000;
    --text-muted: #3f3f46;
    --text-dim: #71717a;

    --shadow-sm: 0 4px 20px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 12px 35px rgba(0, 0, 0, 0.1);
    --glass-bg: rgba(255, 255, 255, 0.92);
    --backdrop-filter: blur(14px);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light Theme Overrides */
[data-theme="light"] {
    --bg-main: #f8f9fa;
    --bg-card: rgba(255, 255, 255, 0.95);
    --bg-card-solid: #ffffff;
    --bg-sidebar: #f4f4f5;
    --border-color: rgba(0, 0, 0, 0.12);
    --border-accent: #000000;

    --primary: #000000;
    --primary-hover: #27272a;
    --primary-light: rgba(0, 0, 0, 0.06);
    --accent: #18181b;
    --success: #000000;
    --warning: #3f3f46;
    --danger: #000000;
    --info: #52525b;

    --text-main: #000000;
    --text-muted: #3f3f46;
    --text-dim: #71717a;

    --glass-bg: rgba(255, 255, 255, 0.92);
}

/* Dark Theme Overrides - Obsidian Monochrome */
[data-theme="dark"] {
    --bg-main: #09090b;
    --bg-card: rgba(18, 18, 21, 0.92);
    --bg-card-solid: #18181b;
    --bg-sidebar: #09090b;
    --border-color: rgba(255, 255, 255, 0.12);
    --border-accent: #ffffff;

    --primary: #ffffff;
    --primary-hover: #e4e4e7;
    --primary-light: rgba(255, 255, 255, 0.1);
    --accent: #d4d4d8;
    --success: #ffffff;
    --warning: #a1a1aa;
    --danger: #ffffff;
    --info: #d4d4d8;

    --text-main: #ffffff;
    --text-muted: #a1a1aa;
    --text-dim: #71717a;

    --shadow-sm: 0 4px 20px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 12px 35px rgba(0, 0, 0, 0.8);
    --glass-bg: rgba(18, 18, 21, 0.92);
}

/* Global Reset */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-main);
    background-image: radial-gradient(circle at top left, var(--primary-light), transparent 30%), linear-gradient(180deg, var(--primary-light), transparent 40%);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.4;
    font-size: 0.84rem;
}

h1 { font-size: 1.45rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.08rem; }
h4 { font-size: 0.95rem; }
h5 { font-size: 0.85rem; }
h6 { font-size: 0.78rem; }

h1, h2, h3, h4, h5, h6 {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    color: var(--text-main);
}

/* App Layout Structure */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styling */
.app-sidebar {
    width: 260px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1000;
    transition: var(--transition);
}

.sidebar-header {
    padding: 1rem 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-brand-logo {
    height: 52px;
    max-height: 52px;
    width: auto;
    max-width: 220px;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

.auth-brand-logo {
    height: 58px;
    max-height: 58px;
    width: auto;
    max-width: 250px;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

.brand-logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.sidebar-menu {
    flex: 1;
    padding: 1rem 0.75rem;
    overflow-y: auto;
}

.menu-category {
    font-size: 0.66rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-dim);
    margin: 1.25rem 0.75rem 0.5rem;
    font-weight: 700;
}

.nav-link-custom {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.68rem 0.9rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 0.86rem;
    font-weight: 500;
    transition: var(--transition);
}

.nav-link-custom:hover {
    color: var(--text-main);
    background: var(--primary-light);
    transform: translateX(3px);
}

.nav-link-custom.active {
    color: var(--text-main);
    background: rgba(0, 0, 0, 0.12);
    box-shadow: inset 3px 0 0 var(--text-main);
}

[data-theme="dark"] .nav-link-custom.active {
    background: rgba(255, 255, 255, 0.16);
    box-shadow: inset 3px 0 0 var(--text-main);
}

.nav-link-custom:focus-visible {
    outline: 3px solid var(--text-main);
    outline-offset: 2px;
}

.nav-link-custom i {
    font-size: 1.1rem;
    width: 22px;
    text-align: center;
}

/* Main Content Area */
.app-main {
    flex: 1;
    margin-left: 260px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Top Navbar */
.app-navbar {
    height: 64px;
    background: var(--glass-bg);
    backdrop-filter: var(--backdrop-filter);
    border-bottom: 1px solid var(--border-color);
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 900;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.page-title {
    font-size: 1.05rem;
    font-weight: 600;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.35rem 0.7rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 30px;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.user-badge:hover,
.user-badge:focus-visible {
    background: var(--bg-card-solid);
    border-color: var(--text-dim);
    outline: none;
}

.user-badge.dropdown-toggle::after {
    display: none;
}

.user-menu-chevron {
    color: var(--text-dim);
    font-size: 0.7rem;
    margin-left: 0.15rem;
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: var(--bg-main);
    font-size: 0.9rem;
}

/* Main Page Canvas */
.app-body {
    padding: 1.5rem;
    flex: 1;
}

.app-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    align-items: center;
    justify-content: center;
    padding: 0.9rem 1.5rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-dim);
    font-size: 0.72rem;
    background: var(--bg-card);
}

.app-footer-separator {
    color: var(--text-muted);
}

/* Glassmorphism Cards & Panels */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: var(--backdrop-filter);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.2rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.glass-card:hover {
    border-color: var(--border-accent);
    box-shadow: var(--shadow-lg);
}

/* Metric Stats Widget Cards */
.stat-card {
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--text-main);
}

.stat-title {
    font-size: 0.68rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.stat-value {
    font-family: 'Outfit', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0.25rem 0;
    color: var(--text-main);
}

.stat-trend {
    font-size: 0.76rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

/* Job details */
.job-details-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.job-details-heading h3 {
    line-height: 1.25;
}

.job-details-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.5rem;
}

.job-kpi-card {
    height: 100%;
    border-top: 3px solid var(--text-main);
    padding-top: 1rem;
}

.job-manifest-card {
    min-height: 0;
}

.manifest-group-box {
    background: rgba(255, 255, 255, 0.03);
    transition: var(--transition);
}

.manifest-group-box:hover {
    border-color: rgba(255, 255, 255, 0.15) !important;
}

.route-arrow-connector {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(var(--bs-primary-rgb), 0.1);
}

.job-vault-card {
    min-height: 0;
}

.job-file-upload {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.job-file-upload .form-control-custom {
    min-width: 0;
}

.job-file-upload .btn-primary-custom {
    flex: 0 0 auto;
    white-space: nowrap;
}

.job-vault-empty {
    display: flex;
    min-height: 7.5rem;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-align: center;
}

.job-vault-empty i {
    font-size: 1.35rem;
}

.job-list-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.4rem;
}

.job-open-action {
    padding: 0.42rem 0.68rem;
    font-size: 0.78rem;
}

.job-edit-action {
    color: var(--text-main) !important;
}

.list-row-actions {
    display: inline-flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.35rem;
}

.list-row-actions .btn-secondary-custom {
    padding: 0.38rem 0.6rem;
    font-size: 0.75rem;
}

/* System masters: keep related fields and their action aligned as one unit. */
.master-panel-heading {
    margin-bottom: 1rem;
}

.master-sales-form {
    display: grid;
    grid-template-columns: minmax(180px, 1.2fr) minmax(210px, 1.25fr) minmax(145px, 0.8fr) minmax(145px, 0.8fr) auto minmax(155px, auto);
    gap: 0.75rem;
    align-items: end;
    margin-bottom: 1.5rem;
}

.master-inline-form {
    display: grid;
    gap: 0.65rem;
    align-items: end;
    margin-bottom: 1rem;
}

.master-port-form {
    grid-template-columns: minmax(110px, 0.8fr) minmax(155px, 1.25fr) minmax(110px, 0.8fr) minmax(120px, auto);
}

.master-charge-form {
    grid-template-columns: minmax(95px, 0.8fr) minmax(150px, 1.25fr) minmax(100px, 0.8fr) minmax(130px, auto);
}

.master-checkbox-field,
.master-submit-field {
    min-height: 38px;
    display: flex;
    align-items: center;
}

.master-checkbox-field .form-check {
    margin: 0;
    white-space: nowrap;
}

.master-submit-field .btn-primary-custom {
    min-height: 38px;
    justify-content: center;
    white-space: nowrap;
}

.master-registry-card .table-custom-wrapper {
    min-height: 108px;
}

@media (max-width: 1199.98px) {
    .master-sales-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .master-checkbox-field,
    .master-submit-field {
        align-items: end;
    }
}

@media (max-width: 767.98px) {
    .master-sales-form,
    .master-inline-form,
    .master-port-form,
    .master-charge-form {
        grid-template-columns: 1fr;
    }

    .master-submit-field .btn-primary-custom {
        width: 100%;
    }
}

/* Custom Table Styling */
.table-custom-wrapper {
    background: var(--bg-card-solid);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.table-custom {
    width: 100%;
    border-collapse: collapse;
    color: var(--text-main);
}

.table-custom th {
    background: var(--primary-light);
    padding: 0.55rem 0.8rem;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
}

.table-custom td {
    padding: 0.55rem 0.8rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.78rem;
    vertical-align: middle;
}

.table-custom tbody tr {
    transition: var(--transition);
}

.table-custom tbody tr:hover {
    background: var(--primary-light);
}

/* Badge Status Pills - Monochrome */
.badge-pill {
    padding: 0.22rem 0.6rem;
    border-radius: 20px;
    font-size: 0.68rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.badge-active, .badge-posted, .badge-paid, .badge-cleared {
    background: var(--text-main);
    color: var(--bg-main);
    border: 1px solid var(--text-main);
}

.badge-pending, .badge-intransit, .badge-draft, .badge-partial {
    background: var(--primary-light);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.badge-danger, .badge-cancelled, .badge-overdue {
    background: var(--bg-card-solid);
    color: var(--text-main);
    border: 1px solid var(--text-main);
}

.badge-info, .badge-closed {
    background: transparent;
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

/* Custom Form Controls */
.form-control-custom, .form-select-custom {
    width: 100%;
    background: var(--bg-card-solid);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.42rem 0.75rem;
    color: var(--text-main);
    font-size: 0.8rem;
    transition: var(--transition);
}

.form-control-custom:focus, .form-select-custom:focus {
    outline: none;
    border-color: var(--text-main);
    box-shadow: 0 0 0 2px var(--border-color);
}

.form-control-custom:disabled,
.form-control-custom[readonly],
.form-control-custom:read-only,
.form-select-custom:disabled,
input.form-control-custom:read-only,
textarea.form-control-custom:read-only {
    background-color: #f1f3f5 !important;
    color: #212529 !important;
    border-color: #ced4da !important;
    opacity: 0.95;
    cursor: not-allowed;
}

/* Force pointer cursor and clean flex alignment on checkboxes and radio buttons */
.form-check-input,
input[type="checkbox"],
input[type="radio"],
.chk-vat {
    cursor: pointer !important;
}

.table td .form-check,
.table th .form-check {
    min-height: auto;
    margin: 0 !important;
    padding: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

.table td .form-check-input,
.chk-vat {
    margin: 0 !important;
    width: 1.15rem;
    height: 1.15rem;
    cursor: pointer !important;
    vertical-align: middle;
}

.form-control-custom.is-invalid-custom,
.form-select-custom.is-invalid-custom {
    border-color: #dc3545;
    background-color: rgba(220, 53, 69, 0.06);
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.15);
}

.form-control-custom.is-invalid-custom:focus,
.form-select-custom.is-invalid-custom:focus {
    border-color: #dc3545;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.2);
}

/* List filter and empty-state patterns */
.list-search {
    position: relative;
}

.list-search > i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    z-index: 1;
}

.list-search .form-control-custom {
    padding-left: 2.7rem;
}

.list-empty-state {
    padding: 3.5rem 1rem !important;
    text-align: center;
    color: var(--text-main);
}

.list-empty-state > i {
    display: inline-flex;
    width: 3rem;
    height: 3rem;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    background: var(--primary-light);
    font-size: 1.2rem;
}

/* Buttons */
.btn-primary-custom {
    background: var(--text-main);
    color: var(--bg-main);
    border: 1px solid var(--text-main);
    padding: 0.42rem 0.85rem;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    text-decoration: none;
}

.btn-primary-custom:hover {
    background: var(--text-muted);
    border-color: var(--text-muted);
    color: var(--bg-main);
    transform: translateY(-1px);
}

.btn-secondary-custom {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.42rem 0.85rem;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-secondary-custom:hover {
    background: var(--primary-light);
    border-color: var(--text-main);
    color: var(--text-main);
}

.btn-icon {
    width: 34px;
    height: 34px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-main);
    transition: var(--transition);
}

.btn-icon:hover,
.btn-icon:focus-visible,
.btn-icon:active {
    /* Bootstrap's .text-* utilities are intentionally monochrome here.
       Keep icon glyphs visible when an action control receives its dark state. */
    color: var(--bg-main) !important;
    background: var(--text-main);
    border-color: var(--text-main);
}

.btn-icon:focus-visible {
    outline: 3px solid var(--text-main);
    outline-offset: 2px;
}

.dashboard-shell {
    max-width: 1480px;
}

.dashboard-hero {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
}

.dashboard-kicker {
    display: inline-block;
    margin-bottom: 0.45rem;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.dashboard-title {
    font-size: 1.55rem;
    line-height: 1.2;
    margin-bottom: 0.4rem;
}

.dashboard-subtitle,
.section-copy {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.dashboard-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.compact-stat-card {
    min-height: 132px;
}

.section-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

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

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: var(--bg-main);
}

.auth-card {
    width: min(100%, 440px);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
}

.auth-card h2 {
    font-size: 2rem;
}

.auth-card .text-muted {
    color: var(--text-muted) !important;
}

.auth-card .form-label {
    color: var(--text-main) !important;
    letter-spacing: 0.02em;
}

.auth-card .form-control-custom {
    background: var(--bg-card-solid);
    border-color: var(--border-color);
    color: var(--text-main);
}

.auth-card .form-control-custom::placeholder {
    color: var(--text-dim);
}

.auth-card .form-control-custom:focus {
    border-color: var(--text-main);
    box-shadow: 0 0 0 2px var(--border-color);
}

.auth-version {
    margin-top: 1.25rem;
    padding-top: 0.9rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-dim);
    font-size: 0.72rem;
    text-align: center;
}

.auth-version span {
    margin: 0 0.3rem;
}

.audit-log-table details {
    min-width: 240px;
}

.audit-log-table summary {
    cursor: pointer;
    color: var(--text-main);
    font-weight: 600;
}

.audit-json {
    max-width: 460px;
    max-height: 170px;
    overflow: auto;
    margin: 0.55rem 0 0;
    padding: 0.6rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--primary-light);
    color: var(--text-main);
    font: 0.72rem/1.45 ui-monospace, SFMono-Regular, Consolas, monospace;
    white-space: pre-wrap;
    word-break: break-word;
}

.audit-path {
    max-width: 190px;
}

.quick-link-tile {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.95rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.84rem;
    font-weight: 600;
    transition: var(--transition);
}

.quick-link-tile i {
    color: var(--text-main);
}

.quick-link-tile:hover {
    transform: translateY(-2px);
    border-color: var(--text-main);
    box-shadow: var(--shadow-sm);
    color: var(--text-main);
}

.fs-7 {
    font-size: 0.84rem !important;
}

.fs-8 {
    font-size: 0.76rem !important;
}

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

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

/* ==========================================================================
   GLOBAL BOOTSTRAP UTILITY MONOCHROME OVERRIDES
   ========================================================================== */

/* Color Overrides */
.text-primary, .text-success, .text-warning, .text-danger, .text-info, .text-secondary {
    color: var(--text-main) !important;
}

.bg-primary, .bg-success, .bg-warning, .bg-danger, .bg-info {
    background-color: var(--text-main) !important;
    color: var(--bg-main) !important;
}

/* Badge Overrides */
.badge.bg-primary, 
.badge.bg-success, 
.badge.bg-warning, 
.badge.bg-danger, 
.badge.bg-info, 
.badge.bg-info-subtle, 
.badge.bg-danger-subtle, 
.badge.bg-secondary,
.badge.bg-opacity-20 {
    background-color: var(--primary-light) !important;
    color: var(--text-main) !important;
    border: 1px solid var(--border-color) !important;
}

.badge.text-primary, 
.badge.text-success, 
.badge.text-warning, 
.badge.text-danger, 
.badge.text-info, 
.badge.text-danger-emphasis {
    color: var(--text-main) !important;
}

/* Alert Overrides */
.alert-success, .alert-danger, .alert-warning, .alert-info {
    background: var(--bg-card) !important;
    color: var(--text-main) !important;
    border: 1px solid var(--border-color) !important;
}

/* Button Overrides */
.btn-primary, .btn-success, .btn-warning, .btn-danger, .btn-info {
    background-color: var(--text-main) !important;
    color: var(--bg-main) !important;
    border-color: var(--text-main) !important;
}

.btn-primary:hover, .btn-success:hover, .btn-warning:hover, .btn-danger:hover, .btn-info:hover {
    background-color: var(--text-muted) !important;
    border-color: var(--text-muted) !important;
    color: var(--bg-main) !important;
}

.btn-outline-primary, .btn-outline-success, .btn-outline-warning, .btn-outline-danger, .btn-outline-info {
    color: var(--text-main) !important;
    border-color: var(--border-color) !important;
    background: transparent !important;
}

.btn-outline-primary:hover, .btn-outline-success:hover, .btn-outline-warning:hover, .btn-outline-danger:hover, .btn-outline-info:hover {
    background: var(--text-main) !important;
    color: var(--bg-main) !important;
}

@media (max-width: 991.98px) {
    .dashboard-hero {
        flex-direction: column;
        align-items: flex-start;
    }

    .quick-links-grid {
        grid-template-columns: 1fr;
    }
}

/* Printable Document Layouts */
@media print {
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    html, body {
        background: #ffffff !important;
        color: #0f172a !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .app-sidebar, .app-navbar, .no-print, header, nav, .btn, .alert {
        display: none !important;
    }

    .app-main {
        margin-left: 0 !important;
        padding: 0 !important;
    }

    .app-body {
        padding: 0 !important;
    }

    .printable-invoice {
        box-shadow: none !important;
        border: none !important;
        padding: 0 !important;
        margin: 0 !important;
        max-width: 100% !important;
        width: 100% !important;
        background: #ffffff !important;
        color: #0f172a !important;
    }

    .printable-invoice .bg-light {
        background-color: #f8fafc !important;
        border: 1px solid #e2e8f0 !important;
    }

    /* Crisp table lines and row striping */
    .table-bordered {
        border: 1px solid #cbd5e1 !important;
    }

    .table-bordered td,
    .table-bordered tbody th {
        border: 1px solid #e2e8f0 !important;
        color: #0f172a !important;
    }

    .table-striped > tbody > tr:nth-of-type(odd) > * {
        background-color: #f8fafc !important;
    }

    /* Preserve dark headers & footers in print - must override table-bordered */
    .table-dark,
    thead.table-dark,
    tfoot.table-dark,
    .table-dark th,
    .table-dark td,
    tr.table-dark,
    tr.table-dark td,
    tr.table-dark th,
    .table-bordered thead.table-dark th,
    .table-bordered tfoot tr.table-dark td,
    .table-bordered tr.table-dark td {
        background-color: #1e293b !important;
        color: #ffffff !important;
        border-color: #334155 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .table-dark .text-white,
    tr.table-dark .text-white,
    tr.table-dark td,
    tr.table-dark th,
    .table-bordered thead.table-dark th,
    .table-bordered tfoot tr.table-dark td {
        color: #ffffff !important;
    }

    /* Badges in print */
    .badge.bg-primary {
        background-color: #1d4ed8 !important;
        color: #ffffff !important;
        border: 1px solid #1e40af !important;
    }

    .badge.bg-success {
        background-color: #15803d !important;
        color: #ffffff !important;
        border: 1px solid #166534 !important;
    }

    .text-muted {
        color: #64748b !important;
    }

    @page {
        size: A4 portrait;
        margin: 10mm 12mm;
    }
}
