/* Bootstrap Compatibility Layer for JadUI Migration */
/* Provides Bootstrap utility classes without Bootstrap dependency */

/* ===== Layout / Display ===== */
.d-none {
    display: none !important;
}

.d-block {
    display: block !important;
}

.d-inline {
    display: inline !important;
}

.d-inline-block {
    display: inline-block !important;
}

.d-flex {
    display: flex !important;
}

.d-inline-flex {
    display: inline-flex !important;
}

/* ===== Flex ===== */
.flex-row {
    flex-direction: row !important;
}

.flex-column {
    flex-direction: column !important;
}

.flex-wrap {
    flex-wrap: wrap !important;
}

.flex-nowrap {
    flex-wrap: nowrap !important;
}

.flex-grow-1 {
    flex-grow: 1 !important;
}

.flex-grow-0 {
    flex-grow: 0 !important;
}

.flex-shrink-0 {
    flex-shrink: 0 !important;
}

.flex-shrink-1 {
    flex-shrink: 1 !important;
}

.flex-fill {
    flex: 1 1 auto !important;
}

.justify-content-start {
    justify-content: flex-start !important;
}

.justify-content-end {
    justify-content: flex-end !important;
}

.justify-content-center {
    justify-content: center !important;
}

.justify-content-between {
    justify-content: space-between !important;
}

.justify-content-around {
    justify-content: space-around !important;
}

.align-items-start {
    align-items: flex-start !important;
}

.align-items-end {
    align-items: flex-end !important;
}

.align-items-center {
    align-items: center !important;
}

.align-items-baseline {
    align-items: baseline !important;
}

.align-items-stretch {
    align-items: stretch !important;
}

.gap-0 {
    gap: 0 !important;
}

.gap-1 {
    gap: 4px !important;
}

.gap-2 {
    gap: 8px !important;
}

.gap-3 {
    gap: 12px !important;
}

.gap-4 {
    gap: 16px !important;
}

.gap-5 {
    gap: 24px !important;
}

/* ===== Sizing ===== */
.w-100 {
    width: 100% !important;
}

.h-100 {
    height: 100% !important;
}

/* ===== Position ===== */
.position-relative {
    position: relative !important;
}

.position-absolute {
    position: absolute !important;
}

.position-fixed {
    position: fixed !important;
}

.position-sticky {
    position: sticky !important;
}

.top-0 {
    top: 0 !important;
}

.bottom-0 {
    bottom: 0 !important;
}

.start-0 {
    left: 0 !important;
}

.end-0 {
    right: 0 !important;
}

/* ===== Spacing ===== */
.m-0 {
    margin: 0 !important;
}

.m-1 {
    margin: 4px !important;
}

.m-2 {
    margin: 8px !important;
}

.m-3 {
    margin: 12px !important;
}

.m-4 {
    margin: 16px !important;
}

.m-5 {
    margin: 24px !important;
}

.me-0 {
    margin-right: 0 !important;
}

.me-1 {
    margin-right: 4px !important;
}

.me-2 {
    margin-right: 8px !important;
}

.me-3 {
    margin-right: 12px !important;
}

.me-4 {
    margin-right: 16px !important;
}

.me-5 {
    margin-right: 24px !important;
}

.ms-0 {
    margin-left: 0 !important;
}

.ms-1 {
    margin-left: 4px !important;
}

.ms-2 {
    margin-left: 8px !important;
}

.ms-3 {
    margin-left: 12px !important;
}

.ms-4 {
    margin-left: 16px !important;
}

.ms-5 {
    margin-left: 24px !important;
}

.ms-auto {
    margin-left: auto !important;
}

.mt-0 {
    margin-top: 0 !important;
}

.mt-1 {
    margin-top: 4px !important;
}

.mt-2 {
    margin-top: 8px !important;
}

.mt-3 {
    margin-top: 12px !important;
}

.mt-4 {
    margin-top: 16px !important;
}

.mt-5 {
    margin-top: 24px !important;
}

.mb-0 {
    margin-bottom: 0 !important;
}

.mb-1 {
    margin-bottom: 4px !important;
}

.mb-2 {
    margin-bottom: 8px !important;
}

.mb-3 {
    margin-bottom: 12px !important;
}

.mb-4 {
    margin-bottom: 16px !important;
}

.mb-5 {
    margin-bottom: 24px !important;
}

.mx-auto {
    margin-left: auto !important;
    margin-right: auto !important;
}

.p-0 {
    padding: 0 !important;
}

.p-1 {
    padding: 4px !important;
}

.p-2 {
    padding: 8px !important;
}

.p-3 {
    padding: 12px !important;
}

.p-4 {
    padding: 16px !important;
}

.p-5 {
    padding: 24px !important;
}

.py-0 {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

.py-1 {
    padding-top: 4px !important;
    padding-bottom: 4px !important;
}

.py-2 {
    padding-top: 8px !important;
    padding-bottom: 8px !important;
}

.py-3 {
    padding-top: 12px !important;
    padding-bottom: 12px !important;
}

.py-4 {
    padding-top: 16px !important;
    padding-bottom: 16px !important;
}

.py-5 {
    padding-top: 24px !important;
    padding-bottom: 24px !important;
}

.px-0 {
    padding-left: 0 !important;
    padding-right: 0 !important;
}

.px-1 {
    padding-left: 4px !important;
    padding-right: 4px !important;
}

.px-2 {
    padding-left: 8px !important;
    padding-right: 8px !important;
}

.px-3 {
    padding-left: 12px !important;
    padding-right: 12px !important;
}

.px-4 {
    padding-left: 16px !important;
    padding-right: 16px !important;
}

.px-5 {
    padding-left: 24px !important;
    padding-right: 24px !important;
}

/* ===== Grid ===== */
.col-auto {
    flex: 0 0 auto;
    width: auto;
}

.col-1 {
    flex: 0 0 8.333333%;
}

.col-2 {
    flex: 0 0 16.666667%;
}

.col-3 {
    flex: 0 0 25%;
}

.col-4 {
    flex: 0 0 33.333333%;
}

.col-5 {
    flex: 0 0 41.666667%;
}

.col-6 {
    flex: 0 0 50%;
}

.col-7 {
    flex: 0 0 58.333333%;
}

.col-8 {
    flex: 0 0 66.666667%;
}

.col-9 {
    flex: 0 0 75%;
}

.col-10 {
    flex: 0 0 83.333333%;
}

.col-11 {
    flex: 0 0 91.666667%;
}

.col-12 {
    flex: 0 0 100%;
}

.row {
    --gutter-x: 24px;
    --gutter-y: 0;
    display: flex;
    flex-wrap: wrap;
    margin-left: calc(var(--gutter-x) * -0.5);
    margin-right: calc(var(--gutter-x) * -0.5);
    margin-top: calc(var(--gutter-y) * -1);
}

.row > * {
    flex-shrink: 0;
    width: 100%;
    max-width: 100%;
    padding-left: calc(var(--gutter-x) * 0.5);
    padding-right: calc(var(--gutter-x) * 0.5);
    margin-top: var(--gutter-y);
    box-sizing: border-box;
}

.g-0 {
    --gutter-x: 0;
    --gutter-y: 0;
}

.g-1 {
    --gutter-x: 4px;
    --gutter-y: 4px;
}

.g-2 {
    --gutter-x: 8px;
    --gutter-y: 8px;
}

.g-3 {
    --gutter-x: 12px;
    --gutter-y: 12px;
}

.g-4 {
    --gutter-x: 16px;
    --gutter-y: 16px;
}

.g-5 {
    --gutter-x: 24px;
    --gutter-y: 24px;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
    color: var(--text-primary, #fff);
    background: var(--surface-secondary, #252525);
}

.btn:hover:not(:disabled) {
    background: var(--surface-hover, #2E2E2E);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 12px;
}

.btn-lg {
    padding: 12px 24px;
    font-size: 15px;
}

.btn-xs {
    padding: 2px 6px;
    font-size: 11px;
}

.btn-primary {
    background: var(--accent-primary, #33B5E5);
    border-color: var(--accent-primary, #33B5E5);
}

.btn-primary:hover:not(:disabled) {
    background: #4cc3f0;
    border-color: #4cc3f0;
}

.btn-secondary {
    background: var(--surface-secondary, #252525);
    border-color: var(--border-default, #3A3A3A);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--surface-hover, #2E2E2E);
}

.btn-success {
    background: var(--success, #4caf50);
    border-color: var(--success, #4caf50);
}

.btn-success:hover:not(:disabled) {
    background: #66bb6a;
    border-color: #66bb6a;
}

.btn-danger {
    background: var(--danger, #f44336);
    border-color: var(--danger, #f44336);
}

.btn-danger:hover:not(:disabled) {
    background: #ef5350;
    border-color: #ef5350;
}

.btn-warning {
    background: var(--warning, #ff9800);
    border-color: var(--warning, #ff9800);
    color: #000;
}

.btn-warning:hover:not(:disabled) {
    background: #ffa726;
    border-color: #ffa726;
}

.btn-info {
    background: var(--info, #2196f3);
    border-color: var(--info, #2196f3);
}

.btn-info:hover:not(:disabled) {
    background: #42a5f5;
    border-color: #42a5f5;
}

.btn-light {
    background: var(--surface-hover, #2E2E2E);
    border-color: var(--border-default, #3A3A3A);
}

.btn-light:hover:not(:disabled) {
    background: var(--surface-secondary, #252525);
}

.btn-outline-primary {
    background: transparent;
    border-color: var(--accent-primary, #33B5E5);
    color: var(--accent-primary, #33B5E5);
}

.btn-outline-primary:hover:not(:disabled) {
    background: var(--accent-primary, #33B5E5);
    color: #fff;
}

.btn-outline-secondary {
    background: transparent;
    border-color: var(--border-default, #3A3A3A);
    color: var(--text-secondary, #A0A0A0);
}

.btn-outline-secondary:hover:not(:disabled) {
    background: var(--surface-hover, #2E2E2E);
    color: var(--text-primary, #fff);
}

.btn-outline-danger {
    background: transparent;
    border-color: var(--danger, #f44336);
    color: var(--danger, #f44336);
}

.btn-outline-danger:hover:not(:disabled) {
    background: var(--danger, #f44336);
    color: #fff;
}

.btn-outline-primary.btn-sm, .btn-outline-secondary.btn-sm, .btn-outline-danger.btn-sm {
    padding: 4px 10px;
    font-size: 12px;
}

.btn-link {
    background: none;
    border: none;
    color: var(--accent-primary, #33B5E5);
    text-decoration: none;
    padding: 4px 8px;
}

.btn-link:hover:not(:disabled) {
    text-decoration: underline;
}

.btn-group {
    display: inline-flex;
}

.btn-group > .btn {
    border-radius: 0;
}

.btn-group > .btn:first-child {
    border-top-left-radius: 4px;
    border-bottom-left-radius: 4px;
}

.btn-group > .btn:last-child {
    border-top-right-radius: 4px;
    border-bottom-right-radius: 4px;
}

.btn-group > .btn:not(:first-child) {
    margin-left: -1px;
}

.btn-group-sm > .btn {
    padding: 4px 10px;
    font-size: 12px;
}

/* ===== Forms ===== */
.form-control {
    display: block;
    width: 100%;
    padding: 8px 12px;
    font-size: 13px;
    line-height: 1.4;
    color: var(--text-primary, #fff);
    background: var(--surface-secondary, #252525);
    border: 1px solid var(--border-default, #3A3A3A);
    border-radius: 4px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-primary, #33B5E5);
    box-shadow: 0 0 0 2px rgba(51, 181, 229, 0.2);
}

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

.form-control:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.form-control-sm {
    padding: 4px 10px;
    font-size: 12px;
}

.form-control-lg {
    padding: 12px 16px;
    font-size: 15px;
}

.form-control-color {
    width: 40px;
    padding: 4px;
    height: auto;
}

.form-select {
    display: block;
    width: 100%;
    padding: 8px 32px 8px 12px;
    font-size: 13px;
    line-height: 1.4;
    color: var(--text-primary, #fff);
    background: var(--surface-secondary, #252525) url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23a0a0a0' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e") no-repeat right 10px center/12px;
    border: 1px solid var(--border-default, #3A3A3A);
    border-radius: 4px;
    appearance: none;
    cursor: pointer;
}

.form-select:focus {
    outline: none;
    border-color: var(--accent-primary, #33B5E5);
}

.form-select-sm {
    padding: 4px 28px 4px 10px;
    font-size: 12px;
}

.form-label {
    display: block;
    margin-bottom: 4px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary, #A0A0A0);
}

.form-text {
    font-size: 11px;
    color: var(--text-muted, #606060);
    margin-top: 2px;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-check-input {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-primary, #33B5E5);
    cursor: pointer;
}

.form-check-label {
    font-size: 13px;
    cursor: pointer;
}

.form-switch .form-check-input {
    width: 36px;
    height: 20px;
}

.input-group {
    display: flex;
    align-items: stretch;
}

.input-group > .form-control {
    border-radius: 0;
}

.input-group > .form-control:first-child {
    border-top-left-radius: 4px;
    border-bottom-left-radius: 4px;
}

.input-group > .form-control:last-child {
    border-top-right-radius: 4px;
    border-bottom-right-radius: 4px;
}

.input-group-text {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    font-size: 13px;
    color: var(--text-secondary, #A0A0A0);
    background: var(--surface-secondary, #252525);
    border: 1px solid var(--border-default, #3A3A3A);
    border-radius: 4px;
}

/* ===== Cards ===== */
.card {
    background: var(--surface-primary, #1A1A1A);
    border: 1px solid var(--border-default, #3A3A3A);
    border-radius: 8px;
    overflow: hidden;
}

.card-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-subtle, #2A2A2A);
    font-weight: 600;
    font-size: 14px;
}

.card-body {
    padding: 16px;
}

.card-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border-subtle, #2A2A2A);
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}

.card-text {
    font-size: 13px;
    color: var(--text-secondary, #A0A0A0);
}

.shadow-sm {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.shadow {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.shadow-lg {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

/* ===== Badges ===== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.bg-primary {
    background: var(--accent-primary, #33B5E5);
    color: #fff;
}

.bg-secondary {
    background: var(--surface-secondary, #252525);
    color: var(--text-secondary, #A0A0A0);
}

.bg-success {
    background: var(--success, #4caf50);
    color: #fff;
}

.bg-danger {
    background: var(--danger, #f44336);
    color: #fff;
}

.bg-warning {
    background: var(--warning, #ff9800);
    color: #000;
}

.bg-info {
    background: var(--info, #2196f3);
    color: #fff;
}

.bg-light {
    background: var(--surface-hover, #2E2E2E);
    color: var(--text-primary, #fff);
}

.bg-dark {
    background: var(--surface-primary, #1A1A1A);
    color: var(--text-primary, #fff);
}

.rounded-pill {
    border-radius: 999px;
}

/* ===== Tables ===== */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: left;
}

.table th, .table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-subtle, #2A2A2A);
}

.table thead th {
    background: var(--surface-secondary, #252525);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-secondary, #A0A0A0);
    position: sticky;
    top: 0;
}

.table tbody tr:hover {
    background: var(--surface-hover, #2E2E2E);
}

.table-sm th, .table-sm td {
    padding: 4px 10px;
    font-size: 12px;
}

/* ===== Lists ===== */
.list-group {
    display: flex;
    flex-direction: column;
}

.list-group-item {
    padding: 10px 14px;
    background: var(--surface-primary, #1A1A1A);
    border: 1px solid var(--border-subtle, #2A2A2A);
    border-radius: 4px;
    margin-bottom: 2px;
    font-size: 13px;
    cursor: default;
    color: var(--text-primary, #fff);
}

.list-group-item-action {
    cursor: pointer;
}

.list-group-item-action:hover {
    background: var(--surface-hover, #2E2E2E);
}

/* Buttons used as list-group items need explicit color override (browser defaults to black) */
button.list-group-item,
button.list-group-item-action {
    color: var(--text-primary, #fff);
    background: var(--surface-primary, #1A1A1A);
    border: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
    font-size: inherit;
}

button.list-group-item-action:hover {
    background: var(--surface-hover, #2E2E2E);
}

button.list-group-item-action:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Popup / context menu card styling */
.popup-menu-card {
    background: var(--surface-secondary, #252525);
    border: 1px solid var(--border-default, #3A3A3A);
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    overflow: hidden;
}

.popup-menu-header {
    padding: 8px 14px;
    background: var(--surface-tertiary, #333);
    border-bottom: 1px solid var(--border-default, #3A3A3A);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary, #A0A0A0);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===== Navbar (full component, not just .nav list) ===== */
.navbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    background: var(--surface-secondary, #252525);
    border-bottom: 1px solid var(--border-default, #3A3A3A);
}

.navbar > .container-fluid {
    display: flex;
    flex-wrap: inherit;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.navbar-brand {
    display: inline-flex;
    align-items: center;
    padding-top: 4px;
    padding-bottom: 4px;
    margin-right: 16px;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary, #fff);
    text-decoration: none;
    white-space: nowrap;
}

.navbar-brand:hover {
    color: var(--accent-primary, #33B5E5);
}

.navbar-toggler {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    font-size: 1rem;
    line-height: 1;
    color: var(--text-secondary, #A0A0A0);
    background: transparent;
    border: 1px solid var(--border-default, #3A3A3A);
    border-radius: 4px;
    cursor: pointer;
}

.navbar-toggler:hover {
    color: var(--text-primary, #fff);
    border-color: var(--border-strong, #4A4A4A);
}

.navbar-toggler-icon {
    display: inline-block;
    width: 1.5em;
    height: 1.5em;
    vertical-align: middle;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.7%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 100%;
}

.navbar-collapse {
    flex-basis: 100%;
    flex-grow: 1;
    align-items: center;
}

/* Desktop: navbar-expand-lg shows full menu */
@media (min-width: 992px) {
    .navbar-expand-lg {
        flex-wrap: nowrap;
        justify-content: flex-start;
    }

    .navbar-expand-lg .navbar-toggler {
        display: none;
    }

    .navbar-expand-lg .navbar-collapse {
        display: flex !important;
        flex-basis: auto;
        justify-content: space-between;
    }

    .navbar-expand-lg .navbar-nav {
        flex-direction: row;
    }

    .navbar-expand-lg .nav-link {
        padding: 8px 12px;
    }
}

/* Mobile: collapsed menu styling */
@media (max-width: 991.98px) {
    .navbar-collapse {
        background: var(--surface-secondary, #252525);
        border-top: 1px solid var(--border-default, #3A3A3A);
        margin: 8px -16px -8px;
        padding: 8px 16px;
    }

    .navbar-nav {
        flex-direction: column;
        gap: 2px;
    }
}

/* ===== Nav (list) ===== */
.nav,
.navbar-nav {
    display: flex;
    gap: 2px;
    list-style: none;
    margin: 0;
    padding: 0;
    flex-direction: row;
    align-items: center;
}

/* Collapse utility (Bootstrap JS replacement base) */
.collapse:not(.show) {
    display: none;
}

.collapse.show {
    display: block;
}

.collapsing {
    height: 0;
    overflow: hidden;
    transition: height 0.35s ease;
}

.nav-item {
    display: block;
}

.nav-link {
    display: block;
    padding: 8px 14px;
    color: var(--text-secondary, #A0A0A0);
    font-size: 13px;
    text-decoration: none;
    border-radius: 4px;
    cursor: pointer;
}

.nav-link:hover {
    color: var(--text-primary, #fff);
    background: var(--surface-hover, #2E2E2E);
}

.nav-link.active {
    color: var(--accent-primary, #33B5E5);
    background: rgba(51, 181, 229, 0.1);
}

/* ===== Navbar background utilities ===== */
.bg-body-tertiary {
    background: var(--surface-secondary, #252525) !important;
}

/* ===== Spacing utilities (missing from compat) ===== */
.p-0 {
    padding: 0 !important;
}

.me-auto {
    margin-right: auto !important;
}

.mb-0 {
    margin-bottom: 0 !important;
}

.mb-1 {
    margin-bottom: 4px !important;
}

.mb-2 {
    margin-bottom: 8px !important;
}

.mb-3 {
    margin-bottom: 12px !important;
}

.mb-4 {
    margin-bottom: 16px !important;
}

.mb-5 {
    margin-bottom: 24px !important;
}

@media (min-width: 992px) {
    .mb-lg-0 {
        margin-bottom: 0 !important;
    }

    .mb-lg-1 {
        margin-bottom: 4px !important;
    }

    .mb-lg-2 {
        margin-bottom: 8px !important;
    }

    .mb-lg-3 {
        margin-bottom: 12px !important;
    }
}

/* ===== Dropdowns ===== */
.dropdown-menu {
    display: none;
    position: absolute;
    z-index: 50;
    min-width: 160px;
    max-width: min(90vw, 320px);
    background: var(--surface-primary, #1A1A1A);
    border: 1px solid var(--border-default, #3A3A3A);
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    padding: 4px;
    overflow: hidden;
}

.dropdown-item {
    display: block;
    padding: 8px 12px;
    color: var(--text-primary, #fff);
    font-size: 13px;
    text-decoration: none;
    border-radius: 4px;
    cursor: pointer;
    background: none;
    border: none;
    width: 100%;
    max-width: 100%;
    text-align: left;
    box-sizing: border-box;
}

.dropdown-item:hover {
    background: var(--surface-hover, #2E2E2E);
}

/* Dropdown items with flex layout need truncation to prevent overflow */
.dropdown-item > span:first-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* When dropdown-item is also a flex container (d-flex class), ensure it
   constrains its children so text-truncate works and badges stay inside */
.dropdown-item.d-flex {
    display: flex !important;
    align-items: center;
    max-width: 100%;
}

.dropdown-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* ===== Spinners ===== */
.spinner-border {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 2px solid var(--border-default, #3A3A3A);
    border-right-color: var(--accent-primary, #33B5E5);
    border-radius: 50%;
    animation: jad-spin 0.75s linear infinite;
}

.spinner-border-sm {
    width: 16px;
    height: 16px;
    border-width: 1.5px;
}

@keyframes jad-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===== Text utilities ===== */
.text-primary {
    color: var(--accent-primary, #33B5E5) !important;
}

.text-secondary {
    color: var(--text-secondary, #A0A0A0) !important;
}

.text-success {
    color: var(--success, #4caf50) !important;
}

.text-danger {
    color: var(--danger, #f44336) !important;
}

.text-warning {
    color: var(--warning, #ff9800) !important;
}

.text-info {
    color: var(--info, #2196f3) !important;
}

.text-muted {
    color: var(--text-muted, #606060) !important;
}

.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.text-center {
    text-align: center !important;
}

.text-end {
    text-align: right !important;
}

.text-start {
    text-align: left !important;
}

.small, .fs-small {
    font-size: 12px !important;
}

.fw-bold {
    font-weight: 700 !important;
}

.fw-semibold {
    font-weight: 600 !important;
}

.fw-normal {
    font-weight: 400 !important;
}

.fw-light {
    font-weight: 300 !important;
}

/* ===== Border utilities ===== */
.border {
    border: 1px solid var(--border-default, #3A3A3A) !important;
}

.border-0 {
    border: none !important;
}

.border-top {
    border-top: 1px solid var(--border-default, #3A3A3A) !important;
}

.border-bottom {
    border-bottom: 1px solid var(--border-default, #3A3A3A) !important;
}

.border-start {
    border-left: 1px solid var(--border-default, #3A3A3A) !important;
}

.border-end {
    border-right: 1px solid var(--border-default, #3A3A3A) !important;
}

.border-info {
    border-color: var(--info, #2196f3) !important;
}

.border-success {
    border-color: var(--success, #4caf50) !important;
}

.border-danger {
    border-color: var(--danger, #f44336) !important;
}

.border-warning {
    border-color: var(--warning, #ff9800) !important;
}

/* ===== Overflow ===== */
.overflow-auto {
    overflow: auto !important;
}

.overflow-hidden {
    overflow: hidden !important;
}

.overflow-visible {
    overflow: visible !important;
}

/* ===== Visibility ===== */
.visible {
    visibility: visible !important;
}

.invisible {
    visibility: hidden !important;
}

/* ===== Opacity ===== */
.opacity-0 {
    opacity: 0 !important;
}

.opacity-25 {
    opacity: 0.25 !important;
}

.opacity-50 {
    opacity: 0.5 !important;
}

.opacity-75 {
    opacity: 0.75 !important;
}

.opacity-100 {
    opacity: 1 !important;
}

/* ===== Position overrides ===== */
.sticky-top {
    position: sticky;
    top: 0;
    z-index: 10;
}

.fixed-top {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
}

.fixed-bottom {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
}

/* ===== Rounded ===== */
.rounded {
    border-radius: 4px !important;
}

.rounded-0 {
    border-radius: 0 !important;
}

.rounded-1 {
    border-radius: 2px !important;
}

.rounded-2 {
    border-radius: 4px !important;
}

.rounded-3 {
    border-radius: 8px !important;
}

/* ===== Responsive display (mobile-first) ===== */
@media (min-width: 576px) {
    .d-sm-none {
        display: none !important;
    }

    .d-sm-block {
        display: block !important;
    }

    .d-sm-flex {
        display: flex !important;
    }
}

@media (min-width: 768px) {
    .d-md-none {
        display: none !important;
    }

    .d-md-block {
        display: block !important;
    }

    .d-md-flex {
        display: flex !important;
    }

    .col-md-3 {
        flex: 0 0 25%;
    }

    .col-md-4 {
        flex: 0 0 33.333333%;
    }

    .col-md-6 {
        flex: 0 0 50%;
    }

    .col-md-8 {
        flex: 0 0 66.666667%;
    }
}

@media (min-width: 992px) {
    .d-lg-none {
        display: none !important;
    }

    .d-lg-block {
        display: block !important;
    }

    .d-lg-flex {
        display: flex !important;
    }
}

@media (min-width: 1200px) {
    .d-xl-none {
        display: none !important;
    }

    .d-xl-block {
        display: block !important;
    }

    .d-xl-flex {
        display: flex !important;
    }

    .col-xl-4 {
        flex: 0 0 33.333333%;
    }
}

/* ===== Container ===== */
.container {
    width: 100%;
    max-width: 1320px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 16px;
    padding-right: 16px;
    box-sizing: border-box;
}

.container-fluid {
    width: 100%;
    padding-left: 16px;
    padding-right: 16px;
    box-sizing: border-box;
}

/* ===== text-bg utilities (used by badges) ===== */
.text-bg-success {
    background: var(--success, #4caf50) !important;
    color: #fff !important;
}

.text-bg-secondary {
    background: var(--surface-secondary, #252525) !important;
    color: var(--text-secondary, #A0A0A0) !important;
}

.text-bg-light {
    background: var(--surface-hover, #2E2E2E) !important;
    color: var(--text-primary, #fff) !important;
}

.text-bg-dark {
    background: var(--surface-primary, #1A1A1A) !important;
    color: var(--text-primary, #fff) !important;
}

.text-bg-primary {
    background: var(--accent-primary, #33B5E5) !important;
    color: #fff !important;
}

.text-bg-danger {
    background: var(--danger, #f44336) !important;
    color: #fff !important;
}

.text-bg-warning {
    background: var(--warning, #ff9800) !important;
    color: #000 !important;
}

/* ===== Alerts ===== */
.alert {
    padding: 12px 16px;
    margin-bottom: 16px;
    border: 1px solid transparent;
    border-radius: 4px;
    font-size: 13px;
}

.alert-danger {
    background: rgba(244, 67, 54, 0.1);
    border-color: rgba(244, 67, 54, 0.3);
    color: #ff5252;
}

.alert-success {
    background: rgba(76, 175, 80, 0.1);
    border-color: rgba(76, 175, 80, 0.3);
    color: #66bb6a;
}

.alert-warning {
    background: rgba(255, 152, 0, 0.1);
    border-color: rgba(255, 152, 0, 0.3);
    color: #ffa726;
}

.alert-info {
    background: rgba(33, 150, 243, 0.1);
    border-color: rgba(33, 150, 243, 0.3);
    color: #42a5f5;
}

/* ===== Close button ===== */
.btn-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-secondary, #A0A0A0);
    font-size: 18px;
    line-height: 1;
}

.btn-close::before {
    content: "×";
}

.btn-close:hover {
    color: var(--text-primary, #fff);
}

/* ===== Table responsive ===== */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-sm th,
.table-sm td {
    padding: 4px 10px;
    font-size: 12px;
}

.align-middle {
    vertical-align: middle !important;
}

/* ===== Dropdown extras ===== */
.dropdown-menu.show {
    display: block;
}

.dropdown-divider {
    height: 0;
    margin: 4px 0;
    overflow: hidden;
    border-top: 1px solid var(--border-default, #3A3A3A);
}

.dropdown-item-text {
    display: block;
    padding: 8px 12px;
    color: var(--text-muted, #606060);
    font-size: 13px;
}

.dropdown-item.disabled,
.dropdown-item:disabled {
    opacity: 0.5;
    pointer-events: none;
    cursor: not-allowed;
}

/* Dropdown toggle caret */
.dropdown-toggle::after {
    display: inline-block;
    margin-left: 6px;
    vertical-align: middle;
    content: "";
    border-top: 4px solid;
    border-right: 4px solid transparent;
    border-bottom: 0;
    border-left: 4px solid transparent;
}

.dropdown-toggle:empty::after {
    margin-left: 0;
}

/* ===== Modal (legacy raw markup support) ===== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    display: none;
    width: 100%;
    height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    outline: 0;
    background: rgba(0, 0, 0, 0.6);
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-dialog {
    position: relative;
    width: auto;
    margin: 16px;
    pointer-events: auto;
    max-width: 500px;
}

.modal-dialog.modal-lg {
    max-width: 800px;
}

.modal-content {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    background: var(--surface-primary, #1A1A1A);
    border: 1px solid var(--border-default, #3A3A3A);
    border-radius: 8px;
    box-shadow: var(--shadow-lg, 0 8px 24px rgba(0, 0, 0, 0.4));
    outline: 0;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-subtle, #2A2A2A);
}

.modal-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary, #fff);
}

.modal-body {
    position: relative;
    flex: 1 1 auto;
    padding: 16px;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--border-subtle, #2A2A2A);
}

/* Fade transition */
.fade {
    transition: opacity 0.15s linear;
}

/* Show utility */
.show {
    display: block;
}

.d-flex.show {
    display: flex !important;
}

/* ===== Nav tabs (used by StockChartCanvasPage) ===== */
.nav-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border-default, #3A3A3A);
    list-style: none;
    margin: 0;
    padding: 0;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
}

.nav-tabs .nav-item {
    display: block;
    margin-bottom: -1px;
}

.nav-tabs .nav-link {
    display: block;
    padding: 8px 16px;
    color: var(--text-secondary, #A0A0A0);
    font-size: 13px;
    text-decoration: none;
    border: 1px solid transparent;
    border-bottom: none;
    border-radius: 4px 4px 0 0;
    background: none;
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.nav-tabs .nav-link:hover {
    color: var(--text-primary, #fff);
    border-color: var(--border-default, #3A3A3A);
    background: var(--surface-hover, #2E2E2E);
}

.nav-tabs .nav-link.active {
    color: var(--accent-primary, #33B5E5);
    background: var(--surface-primary, #1A1A1A);
    border-color: var(--border-default, #3A3A3A);
    border-bottom-color: var(--surface-primary, #1A1A1A);
}

/* ===== List group flush (used by chart context menu) ===== */
.list-group-flush {
    display: flex;
    flex-direction: column;
}

.list-group-flush > .list-group-item {
    border-radius: 0;
    margin-bottom: 0;
    border: none;
    border-bottom: 1px solid var(--border-subtle, #2A2A2A);
}

.list-group-flush > .list-group-item:last-child {
    border-bottom: none;
}

/* ===== Card within popup needs strong shadow for contrast ===== */
.card.shadow-sm {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5) !important;
}

/* ===== Text body (neutral text color) ===== */
.text-body {
    color: var(--text-primary, #fff) !important;
}
