.enigma-table-responsive {
    overflow-x: auto;
}

.enigma-sticky-action {
    position: sticky !important;
    right: 0 !important;
    z-index: 2 !important;
    background-color: #ffffff !important;
    box-shadow: -4px 0 8px -2px rgba(15, 23, 42, 0.10) !important;
}

thead .enigma-sticky-action,
thead th.enigma-sticky-action {
    z-index: 3 !important;
    background-color: #f8f9fa !important;
}

/* Keep white bg on hover and active states so content doesn't bleed through */
.table-hover > tbody > tr:hover > td.enigma-sticky-action,
.table-hover > tbody > tr:hover > th.enigma-sticky-action {
    background-color: #f0f8ff !important;
}

/* Also cover themed/custom table rows */
tr.trading-row-active > td.enigma-sticky-action {
    background-color: #ffffff !important;
}
.table > tbody > tr > td.enigma-sticky-action {
    background-color: #ffffff !important;
}

.enigma-btn-square {
    width: 2rem !important;
    height: 2rem !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 6px !important;
}

/* ── Global modal scrollability ─────────────────────────────────────────────
   Ensures ALL modals are scrollable regardless of modal-dialog-scrollable class.
   The modal body scrolls; header and footer stay fixed. */
.modal-dialog .modal-content {
    max-height: calc(100vh - 3.5rem);
    display: flex;
    flex-direction: column;
}
.modal-dialog .modal-body {
    overflow-y: auto;
    flex: 1 1 auto;
}
.modal-dialog .modal-header,
.modal-dialog .modal-footer {
    flex-shrink: 0;
}

/* Action square buttons — white background + colored border (outline style) */
.enigma-btn-square {
    background-color: #fff !important;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease !important;
}

/* Outline variants keep white bg, show solid on hover */
.btn-outline-primary.enigma-btn-square  { background-color: #fff !important; }
.btn-outline-danger.enigma-btn-square   { background-color: #fff !important; }
.btn-outline-secondary.enigma-btn-square{ background-color: #fff !important; }
.btn-outline-warning.enigma-btn-square  { background-color: #fff !important; }
.btn-outline-info.enigma-btn-square     { background-color: #fff !important; }
.btn-outline-success.enigma-btn-square  { background-color: #fff !important; }

.btn-outline-primary.enigma-btn-square:hover   { background-color: #4b9828 !important; color: #fff !important; }
.btn-outline-danger.enigma-btn-square:hover    { background-color: #dc3545 !important; color: #fff !important; }
.btn-outline-secondary.enigma-btn-square:hover { background-color: #6c757d !important; color: #fff !important; }
.btn-outline-warning.enigma-btn-square:hover   { background-color: #ffc107 !important; color: #000 !important; }
.btn-outline-info.enigma-btn-square:hover      { background-color: #0dcaf0 !important; color: #000 !important; }
.btn-outline-success.enigma-btn-square:hover   { background-color: #198754 !important; color: #fff !important; }

/* Trading desk domestic: single-line cells; horizontal scroll via .table-responsive */
.enigma-hub-domestic-table th:not(.enigma-sticky-action),
.enigma-hub-domestic-table td:not(.enigma-sticky-action) {
    white-space: nowrap;
    vertical-align: middle;
}

.table-hover.enigma-hub-domestic-table > tbody > tr:hover > td.enigma-sticky-action {
    background-color: #fff !important;
}

tr.trading-row-active > td.enigma-sticky-action {
    background-color: #fff !important;
}

.enigma-hub-domestic-table .enigma-sticky-action {
    min-width: 8.5rem;
}

/* Domestic hub: white cell backgrounds; sticky actions stay on top when scrolling horizontally */
.enigma-hub-domestic-table > thead > tr > th {
    background-color: #fff !important;
    border-bottom: 1px solid var(--tb-border-color, #dee2e6);
}

.enigma-hub-domestic-table > tbody > tr > td {
    background-color: #fff !important;
}

.table-hover.enigma-hub-domestic-table > tbody > tr:hover > td {
    background-color: #fff !important;
}

.enigma-hub-domestic-table > tbody > tr.trading-row-active > td {
    background-color: #fff !important;
}

.table-hover.enigma-hub-domestic-table > tbody > tr.trading-row-active:hover > td {
    background-color: #fff !important;
}

/* Trading desk: step / status pills — light weight, thin border */
.enigma-hub-domestic-table .hub-trade-badge {
    border-width: 1px !important;
    font-weight: 400;
    font-size: 0.75rem;
    line-height: 1.3;
    padding: 0.2rem 0.55rem;
    white-space: nowrap;
}

/* Brand theme: primary green (#4b9828) overrides Velzon default blue */
:root,
[data-bs-theme="light"] {
    --tb-primary: #4b9828;
    --tb-primary-rgb: 75, 152, 40;
    --tb-primary-text-emphasis: #3c7a1f;
    --tb-primary-bg-subtle: #e9f4e4;
    --tb-primary-border-subtle: #b5d9a4;
    --tb-focus-ring-color: rgba(75, 152, 40, 0.25);
}

html[data-theme="default"][data-bs-theme="light"],
html[data-theme="default"] {
    --tb-primary: #4b9828;
    --tb-primary-rgb: 75, 152, 40;
    --tb-primary-bg-subtle: rgba(75, 152, 40, 0.15);
    --tb-primary-border-subtle: rgba(75, 152, 40, 0.3);
    --tb-primary-text-emphasis: #3c7a1f;
    --tb-link-color: #4b9828;
    --tb-link-color-rgb: 75, 152, 40;
    --tb-link-hover-color: #3c7a1f;
    --tb-link-hover-color-rgb: 60, 122, 31;
}

.btn-primary {
    --tb-btn-color: #fff;
    --tb-btn-bg: #4b9828;
    --tb-btn-border-color: #4b9828;
    --tb-btn-hover-color: #fff;
    --tb-btn-hover-bg: #3f8422;
    --tb-btn-hover-border-color: #3a7a1f;
    --tb-btn-focus-shadow-rgb: 75, 152, 40;
    --tb-btn-active-color: #fff;
    --tb-btn-active-bg: #3a7a1f;
    --tb-btn-active-border-color: #356f1c;
    --tb-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
    --tb-btn-disabled-color: #fff;
    --tb-btn-disabled-bg: #4b9828;
    --tb-btn-disabled-border-color: #4b9828;
}

.btn-outline-primary {
    --tb-btn-color: #4b9828;
    --tb-btn-border-color: #4b9828;
    --tb-btn-hover-color: #fff;
    --tb-btn-hover-bg: #4b9828;
    --tb-btn-hover-border-color: #4b9828;
    --tb-btn-focus-shadow-rgb: 75, 152, 40;
    --tb-btn-active-color: #fff;
    --tb-btn-active-bg: #4b9828;
    --tb-btn-active-border-color: #4b9828;
    --tb-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
    --tb-btn-disabled-color: #4b9828;
    --tb-btn-disabled-bg: transparent;
    --tb-btn-disabled-border-color: #4b9828;
    --tb-gradient: none;
}

.link-primary:focus,
.link-primary:hover {
    color: rgba(60, 122, 31, var(--tb-link-opacity, 1)) !important;
    -webkit-text-decoration-color: rgba(60, 122, 31, var(--tb-link-underline-opacity, 1)) !important;
    text-decoration-color: rgba(60, 122, 31, var(--tb-link-underline-opacity, 1)) !important;
}

.text-bg-primary {
    color: #fff !important;
    background-color: rgba(75, 152, 40, var(--tb-bg-opacity, 1)) !important;
}

/* Login: tight vertical rhythm around the logo */
.login-brand-logo {
    line-height: 0;
    margin-top: 0;
    margin-bottom: 0.25rem;
}

.login-brand-logo img {
    display: block;
    margin-left: auto;
    margin-right: auto;
}

/* Light sidebar: centered logo (max 100px), pin control, menu spacing */
.enigma-sidebar-brand {
    position: relative !important;
    min-height: 84px !important;
    height: auto !important;
    padding: 0.65rem 2.25rem 0.65rem 0.75rem !important;
    background: transparent !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.enigma-sidebar-brand .enigma-sidebar-pin {
    position: absolute;
    top: 50%;
    right: 0.35rem;
    transform: translateY(-50%);
    float: none !important;
    z-index: 2;
}

.enigma-sidebar-brand .logo.logo-dark {
    min-height: 0;
}

/* Single sidebar image (avoids Velzon .logo-sm / .logo-lg both showing when overrides clash) */
.enigma-sidebar-brand .enigma-sidebar-logo-single {
    display: block;
    margin-left: auto;
    margin-right: auto;
    max-width: 128px;
    width: auto;
    height: auto;
    max-height: 68px;
    object-fit: contain;
}

html[data-sidebar-size="sm"] .enigma-sidebar-brand .enigma-sidebar-logo-single,
html[data-sidebar-size="sm-hover"] .enigma-sidebar-brand .enigma-sidebar-logo-single {
    max-width: 64px;
    max-height: 52px;
}

.app-menu.navbar-menu #scrollbar > .container-fluid {
    padding-top: 0.5rem;
    padding-bottom: 1rem;
}

.app-menu .navbar-nav .nav-item > .menu-link {
    padding-top: 0.625rem;
    padding-bottom: 0.625rem;
}

.app-menu .menu-dropdown .nav-link {
    padding-top: 0.45rem;
    padding-bottom: 0.45rem;
}

.horizontal-logo .enigma-topbar-logo {
    max-height: 28px;
    width: auto;
    object-fit: contain;
}

/* -------------------------------------------------------------------------
   Shubham-inspired app surfaces (main content) — applies project-wide
   ------------------------------------------------------------------------- */
.main-content .page-content .card {
    border: 0;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.main-content .page-content .card > .card-header {
    background: #f8fafc;
    border-bottom: 1px solid rgba(15, 23, 42, 0.1);
    color: #0f172a;
}

.main-content .page-content .card > .card-header h5,
.main-content .page-content .card > .card-header h6 {
    color: #0f172a;
}

.enigma-kv-table {
    --enigma-kv-pad-y: 0.45rem;
    --enigma-kv-pad-x: 0.75rem;
}

.enigma-kv-table td,
.enigma-kv-table th {
    padding: var(--enigma-kv-pad-y) var(--enigma-kv-pad-x) !important;
    vertical-align: middle;
    white-space: nowrap !important;
    word-break: keep-all;
}

.enigma-kv-table td:first-child,
.enigma-kv-table th:first-child {
    min-width: 18rem;
}

.enigma-kv-table td:last-child,
.enigma-kv-table th:last-child {
    width: 1%;
}

/* Domestic workflow page: never wrap table cells; scroll horizontally instead */
.trade-workflow-page .table-responsive {
    overflow-x: auto;
}

.trade-workflow-page table.table th,
.trade-workflow-page table.table td {
    white-space: nowrap !important;
    word-break: keep-all;
}

.main-content .page-content .page-title-box {
    margin-bottom: 0.25rem;
}

/* Dashboard / dense KPI layouts (shubhamforwarders-e2s) */
.dash-page {
    --dash-border: rgba(15, 23, 42, 0.08);
    --dash-radius: 18px;
}

.dash-page .card > .card-header {
    background: #f1f5f9;
    border-bottom: 1px solid rgba(15, 23, 42, 0.12);
    color: #0f172a;
}

.dash-page .card > .card-header h5,
.dash-page .card > .card-header h6 {
    color: #0f172a;
}

.dash-page .card > .card-header .text-muted {
    color: #64748b !important;
}

.dash-filter-card {
    border: 1px solid var(--dash-border);
    border-radius: var(--dash-radius);
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

/* P&L report — summary KPI strip (top of page) */
.pl-summary-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
}

.pl-summary-strip__item {
    min-width: 0;
}

.pl-summary-kpi {
    --pl-kpi-accent: #0d6efd;
    border: 1px solid var(--dash-border);
    border-radius: var(--dash-radius);
    background: linear-gradient(145deg, #ffffff 0%, #f8fafc 55%, #f1f5f9 100%);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
    overflow: hidden;
    position: relative;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.pl-summary-kpi::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--pl-kpi-accent);
    border-radius: var(--dash-radius) 0 0 var(--dash-radius);
}

.pl-summary-kpi:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.pl-summary-kpi--count { --pl-kpi-accent: #64748b; }
.pl-summary-kpi--gross { --pl-kpi-accent: #0d6efd; }
.pl-summary-kpi--profit { --pl-kpi-accent: #198754; }
.pl-summary-kpi--net { --pl-kpi-accent: #0aa2c0; }

.pl-summary-kpi .card-body {
    padding: 1.1rem 1.15rem 1.1rem 1.35rem;
}

.pl-summary-kpi .kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    flex-shrink: 0;
}

.pl-summary-kpi .kpi-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    margin-bottom: 0.2rem;
}

.pl-summary-kpi .kpi-value {
    font-size: clamp(1.15rem, 2vw, 1.45rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pl-summary-kpi .kpi-hint {
    font-size: 0.7rem;
    color: #94a3b8;
    margin-top: 0.35rem;
    line-height: 1.3;
}

.dash-filter-card .row.g-2 {
    margin-bottom: 0 !important;
}

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

@media (max-width: 575.98px) {
    .pl-summary-strip {
        grid-template-columns: 1fr;
    }

    .pl-summary-kpi .kpi-value {
        white-space: normal;
    }
}

/* Dashboard: six KPI cards in one row */
.dash-kpi-strip {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.65rem;
    min-width: 0;
    overflow-x: auto;
    padding-bottom: 0.15rem;
}

.dash-kpi-strip__item {
    flex: 1 1 0;
    min-width: 9.5rem;
    max-width: none;
}

.dash-kpi-strip .dash-kpi .kpi-icon {
    width: 36px;
    height: 36px;
    font-size: 1.1rem;
    border-radius: 10px;
}

.dash-kpi-strip .dash-kpi .kpi-value {
    font-size: 1.1rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dash-kpi-strip .dash-kpi .kpi-label {
    font-size: 0.68rem;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.dash-kpi-strip .dash-kpi .card-body {
    padding: 0.65rem 0.75rem !important;
}

.dash-recent-payments-wrap .table > :not(caption) > * > * {
    padding-left: 1rem;
    padding-right: 1rem;
}

.dash-recent-payments-wrap .table > thead > tr > th:first-child,
.dash-recent-payments-wrap .table > tbody > tr > td:first-child {
    padding-left: 1.25rem;
}

.dash-recent-payments-wrap .table > thead > tr > th:last-child,
.dash-recent-payments-wrap .table > tbody > tr > td:last-child {
    padding-right: 1.25rem;
}

@media (min-width: 992px) {
    .dash-recent-payments-wrap .table > :not(caption) > * > * {
        padding-left: 1.15rem;
        padding-right: 1.15rem;
    }

    .dash-recent-payments-wrap .table > thead > tr > th:first-child,
    .dash-recent-payments-wrap .table > tbody > tr > td:first-child {
        padding-left: 1.5rem;
    }

    .dash-recent-payments-wrap .table > thead > tr > th:last-child,
    .dash-recent-payments-wrap .table > tbody > tr > td:last-child {
        padding-right: 1.5rem;
    }
}

.dash-kpi {
    border: 1px solid var(--dash-border);
    border-radius: var(--dash-radius);
    background: #fff;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.dash-kpi .card-body {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.dash-kpi:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
}

a.dash-kpi-link {
    display: block;
    text-decoration: none;
    color: inherit;
    height: 100%;
}

a.dash-kpi-link:hover {
    color: inherit;
}

.dash-kpi .kpi-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.dash-kpi .kpi-value {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.dash-kpi .kpi-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
    color: #64748b;
}

.dash-kpi .kpi-hint {
    font-size: 0.7rem;
    color: #94a3b8;
    margin-top: 0.2rem;
    line-height: 1.3;
}

.dash-panel {
    border: 1px solid var(--dash-border);
    border-radius: var(--dash-radius);
    background: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    overflow: hidden;
}

.dash-panel .card-header {
    background: rgba(15, 34, 58, 0.03);
    border-bottom: 1px solid var(--dash-border);
    padding: 1rem 1.25rem;
}

.main-content .page-content .card.dash-panel > .card-header {
    background: rgba(15, 34, 58, 0.03);
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    padding: 1rem 1.25rem;
}

.dash-chart-wrap {
    min-height: 260px;
    position: relative;
}

/* -------------------------------------------------------------------------
   Screenshot-style list tables (rounded, soft header, clean rows)
   ------------------------------------------------------------------------- */
.enigma-ui-table-wrap {
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 12px;
    overflow-x: auto;
    overflow-y: hidden;
    background: #fff;
}

.enigma-ui-table {
    margin-bottom: 0;
}

.enigma-ui-table > thead > tr > th {
    background: #f1f5f9;
    color: #475569;
    font-weight: 600;
    font-size: 0.75rem;
    letter-spacing: 0.01em;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08) !important;
    border-right: 1px solid rgba(15, 23, 42, 0.08);
    padding: 0.65rem 0.9rem;
    white-space: nowrap;
    vertical-align: middle;
}

.enigma-ui-table > tbody > tr > td {
    padding: 0.75rem 0.9rem;
    border-top: 1px solid rgba(15, 23, 42, 0.06);
    border-right: 1px solid rgba(15, 23, 42, 0.06);
    color: #0f172a;
    white-space: nowrap;
    vertical-align: middle;
    background: #fff;
}

.enigma-ui-table > thead > tr > th:last-child,
.enigma-ui-table > tbody > tr > td:last-child {
    border-right: 0;
}

.enigma-ui-table > tbody > tr:hover > td {
    background: #f8fafc;
}

.enigma-col-narrow {
    width: 1%;
}

.enigma-col-action {
    width: 1%;
    min-width: 6.5rem;
}

.enigma-link-action {
    color: #2563eb;
    text-decoration: none;
    font-weight: 600;
}

.enigma-link-action:hover {
    color: #1d4ed8;
    text-decoration: underline;
}
