:root {
    --ib-surface-0: #272A31;
    --ib-surface-1: #201E21;
    --ib-surface-2: #2E3138;
    --ib-surface-3: #353941;
    --ib-surface-border: rgba(255, 255, 255, 0.13);
    --ib-surface-border-strong: rgba(255, 255, 255, 0.22);
    --ib-focus-ring: #ABDB22;
    --ib-radius-sm: 0.35rem;
    --ib-radius-md: 0.55rem;
    --ib-radius-lg: 0.8rem;
    --ib-shadow-raised: 0 10px 28px rgba(0, 0, 0, 0.2);
    --ib-control-height: 2.5rem;
    --ib-table-row-height: 3rem;
}

.ib-sheet-label-list {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem;
}

.ib-sheet-label {
    display: inline-flex;
    align-items: center;
    padding: 0.2em 0.5em;
    border: 1px solid var(--ib-secondary-green) !important;
    border-radius: 999px;
    background-color: var(--ib-secondary-green) !important;
    color: #fff !important;
    line-height: 1.2;
}

.labelBadgesContainer .e-multi-select-wrapper .e-chips {
    border-color: var(--ib-secondary-green) !important;
    background-color: var(--ib-secondary-green) !important;
    color: #fff !important;
}

.labelBadgesContainer .e-multi-select-wrapper .e-chips .e-chipcontent,
.labelBadgesContainer .e-multi-select-wrapper .e-chips .e-chips-close {
    color: #fff !important;
}

.e-input-group.e-control-wrapper.ib-filterable-select {
    min-height: var(--ib-control-height);
    border: 1px solid var(--ib-surface-border-strong) !important;
    border-radius: var(--ib-radius-sm) !important;
    background: var(--ib-surface-2) !important;
    color: var(--ib-text-primary) !important;
    box-shadow: none !important;
    transition: border-color 120ms ease, background-color 120ms ease, box-shadow 120ms ease;
}

.e-input-group.e-control-wrapper.ib-filterable-select:hover:not(.e-disabled) {
    border-color: color-mix(in srgb, var(--ib-secondary-green) 62%, var(--ib-surface-border)) !important;
    background: var(--ib-surface-3) !important;
}

.e-input-group.e-control-wrapper.ib-filterable-select.e-input-focus,
.e-input-group.e-control-wrapper.ib-filterable-select:focus-within {
    border-color: var(--ib-focus-ring) !important;
    background: var(--ib-surface-3) !important;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--ib-focus-ring) 22%, transparent) !important;
}

.e-input-group.e-control-wrapper.ib-filterable-select input.e-input {
    min-height: calc(var(--ib-control-height) - 2px);
    padding-inline: 0.75rem;
    background: transparent !important;
    color: var(--ib-text-primary) !important;
    font: inherit;
}

.e-input-group.e-control-wrapper.ib-filterable-select input.e-input::placeholder {
    color: var(--ib-text-muted) !important;
    opacity: 1;
}

.e-input-group.e-control-wrapper.ib-filterable-select .e-input-group-icon {
    border-color: var(--ib-surface-border) !important;
    background: transparent !important;
    color: var(--ib-text-muted) !important;
}

.e-input-group.e-control-wrapper.ib-filterable-select .e-input-group-icon:hover {
    color: var(--ib-secondary-green) !important;
}

.e-ddl.e-popup.ib-filterable-select {
    overflow: hidden;
    border: 1px solid var(--ib-surface-border-strong) !important;
    border-radius: var(--ib-radius-md) !important;
    background: var(--ib-surface-1) !important;
    color: var(--ib-text-primary) !important;
    box-shadow: var(--ib-shadow-raised) !important;
}

.e-ddl.e-popup.ib-filterable-select .e-content,
.e-ddl.e-popup.ib-filterable-select .e-dropdownbase,
.e-ddl.e-popup.ib-filterable-select .e-list-parent {
    background: var(--ib-surface-1) !important;
    color: var(--ib-text-primary) !important;
}

.e-ddl.e-popup.ib-filterable-select .e-list-item {
    min-height: 2.35rem;
    padding: 0.55rem 0.75rem;
    border: 0;
    background: transparent !important;
    color: var(--ib-text-primary) !important;
    font: inherit;
}

.e-ddl.e-popup.ib-filterable-select .e-list-item.e-hover,
.e-ddl.e-popup.ib-filterable-select .e-list-item.e-item-focus {
    background: var(--ib-surface-3) !important;
    color: var(--ib-secondary-green) !important;
}

.e-ddl.e-popup.ib-filterable-select .e-list-item.e-active,
.e-ddl.e-popup.ib-filterable-select .e-list-item.e-active.e-hover {
    background: color-mix(in srgb, var(--ib-secondary-green) 18%, var(--ib-surface-2)) !important;
    color: var(--ib-text-primary) !important;
}

.e-ddl.e-popup.ib-filterable-select .e-nodata {
    padding: 0.75rem;
    background: var(--ib-surface-1) !important;
    color: var(--ib-text-muted) !important;
}

.e-ddl.e-popup.ib-filterable-select .e-content,
.e-ddl.e-popup.ib-filterable-select .e-list-parent {
    scrollbar-width: thin;
    scrollbar-color: rgba(131, 160, 160, 0.7) transparent;
}

.e-ddl.e-popup.ib-filterable-select .e-content::-webkit-scrollbar,
.e-ddl.e-popup.ib-filterable-select .e-list-parent::-webkit-scrollbar {
    width: 0.55rem;
}

.e-ddl.e-popup.ib-filterable-select .e-content::-webkit-scrollbar-thumb,
.e-ddl.e-popup.ib-filterable-select .e-list-parent::-webkit-scrollbar-thumb {
    border: 2px solid transparent;
    border-radius: 999px;
    background: rgba(131, 160, 160, 0.7);
    background-clip: padding-box;
}

.ib-button {
    display: inline-flex;
    min-height: var(--ib-control-height);
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.55rem 0.9rem;
    border: 1px solid transparent;
    border-radius: var(--ib-radius-sm);
    font: inherit;
    font-size: 0.84rem;
    font-weight: 750;
    line-height: 1;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: border-color 120ms ease, background-color 120ms ease, color 120ms ease, box-shadow 120ms ease;
}

.ib-button-primary {
    border-color: var(--ib-secondary-green);
    background: var(--ib-secondary-green);
    color: #17191d;
}

.ib-button-primary:hover:not(:disabled) {
    border-color: color-mix(in srgb, var(--ib-secondary-green) 82%, white);
    background: color-mix(in srgb, var(--ib-secondary-green) 82%, white);
    color: #111317;
}

.ib-button-secondary {
    border-color: var(--ib-surface-border-strong);
    background: var(--ib-surface-2);
    color: var(--ib-text-primary);
}

.ib-button-secondary:hover:not(:disabled) {
    border-color: color-mix(in srgb, var(--ib-secondary-green) 62%, var(--ib-surface-border));
    background: var(--ib-surface-3);
    color: var(--ib-secondary-green);
}

.ib-button:focus-visible {
    outline: 2px solid var(--ib-focus-ring);
    outline-offset: 2px;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--ib-focus-ring) 22%, transparent);
}

.ib-button:disabled,
.ib-button[aria-disabled="true"] {
    opacity: 0.5;
    cursor: not-allowed;
}

.ib-button > .bi { line-height: 1; }

.ib-workbench {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 0;
    padding: 0 0 1.5rem;
}

.ib-workbench > *,
.ib-surface > * {
    min-width: 0;
}

.ib-surface {
    min-width: 0;
    border: 1px solid var(--ib-surface-border);
    border-radius: var(--ib-radius-lg);
    background: var(--ib-surface-1);
    box-shadow: var(--ib-shadow-raised);
}

.ib-workbench-toolbar,
.ib-filter-bar,
.ib-batch-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    min-height: 3.5rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--ib-surface-border);
    border-radius: var(--ib-radius-md);
    background: var(--ib-surface-1);
}

.ib-workbench-toolbar__actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-left: auto;
}

.ib-filter-bar { align-items: end; background: var(--ib-surface-2); }
.ib-batch-bar { border-color: rgba(171, 219, 34, 0.45); background: rgba(171, 219, 34, 0.09); }

.ib-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
    gap: 0.75rem;
}

.ib-summary-card {
    min-width: 0;
    padding: 1rem;
    border: 1px solid var(--ib-surface-border);
    border-radius: var(--ib-radius-md);
    background: var(--ib-surface-1);
}

.ib-summary-card__label { color: var(--ib-text-muted); font-size: 0.82rem; }
.ib-summary-card__value { margin-top: 0.25rem; color: var(--ib-text-primary); font-size: 1.45rem; font-weight: 700; }
.ib-summary-card__detail { margin-top: 0.2rem; color: var(--ib-text-disabled); font-size: 0.85rem; }

.ib-data-table {
    min-width: 0;
    overflow: auto;
    border: 1px solid var(--ib-surface-border);
    border-radius: var(--ib-radius-md);
    background: var(--ib-surface-1);
    scrollbar-width: thin;
    scrollbar-color: rgba(131, 160, 160, 0.7) transparent;
}

.ib-data-table table {
    width: 100%;
    min-width: var(--ib-table-min-width, 42rem);
    margin: 0;
    border-collapse: collapse;
    color: var(--ib-text-primary);
}

.ib-responsive-table {
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(131, 160, 160, 0.7) transparent;
}

.ib-responsive-table > table {
    width: 100%;
    min-width: var(--ib-table-min-width, 42rem);
}

.ib-table > .table-responsive {
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(131, 160, 160, 0.7) transparent;
}

.ib-table > .table-responsive > .table {
    width: 100%;
    min-width: var(--ib-table-min-width, 48rem);
}

/* Full-page registers opt into a bounded flex chain so the grid pager stays
   visible and only the row region consumes the remaining viewport height. */
.ib-viewport-register {
    display: flex;
    flex: 1 1 0;
    flex-direction: column;
    width: 100%;
    min-width: 0;
    min-height: 0;
    max-height: 100%;
    overflow: hidden;
    box-sizing: border-box;
}

.ib-viewport-register > .ib-workbench-toolbar,
.ib-viewport-register .ib-workbench-toolbar,
.ib-viewport-register .ib-filter-bar,
.ib-viewport-register .ib-batch-bar {
    flex: 0 0 auto;
}

.ib-viewport-register .tabbedView,
.ib-viewport-register .tabbedView > .card {
    flex: 1 1 0;
    width: 100%;
    min-width: 0;
    min-height: 0;
    max-height: 100%;
    overflow: hidden;
}

.ib-viewport-register .tabbedView [role="tabpanel"]:not([hidden]),
.ib-viewport-register .tabbedView [role="tabpanel"]:not([hidden]) > .container-fluid,
.ib-viewport-register .tabbedView > .card > .container-fluid {
    display: flex;
    flex: 1 1 0;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

.ib-viewport-register .ib-table {
    flex: 1 1 0;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

.ib-viewport-register .ib-table > * {
    flex: 0 0 auto;
}

.ib-viewport-register .ib-table > .table-responsive {
    flex: 1 1 0;
    height: auto;
    min-height: 0;
    overflow-x: auto;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}

.ib-viewport-register .ib-table > .table-responsive > .table > thead > tr > th {
    position: sticky;
    top: 0;
    z-index: 3;
    background-color: var(--ib-primary-light);
}

.ib-viewport-register .ib-table > .table-responsive > .table > thead > tr:nth-child(2) > th {
    top: 40px;
}

.ib-data-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    min-height: var(--ib-table-row-height);
    padding: 0.75rem;
    border-bottom: 1px solid var(--ib-surface-border-strong);
    background: var(--ib-surface-2);
    color: var(--ib-text-muted);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-align: left;
    text-transform: uppercase;
    white-space: nowrap;
}

.ib-data-table tbody td {
    min-height: var(--ib-table-row-height);
    padding: 0.75rem;
    border-bottom: 1px solid var(--ib-surface-border);
    background: transparent;
    color: var(--ib-text-primary);
    vertical-align: middle;
}

.ib-data-table tbody tr:hover td { background: rgba(255, 255, 255, 0.045); }
.ib-data-table tbody tr:focus-within td { background: rgba(171, 219, 34, 0.06); }

.ib-empty-state,
.ib-loading-state,
.ib-error-state {
    display: grid;
    place-items: center;
    min-height: 9rem;
    padding: 1.5rem;
    color: var(--ib-text-muted);
    text-align: center;
}

.ib-error-state { color: var(--ib-secondary-danger); }

.ib-status-chip,
.ib-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    min-height: 1.8rem;
    padding: 0.25rem 0.65rem;
    border: 1px solid var(--ib-surface-border-strong);
    border-radius: 999px;
    background: var(--ib-surface-2);
    color: var(--ib-text-primary);
    font-size: 0.78rem;
}

@media (max-width: 1399.98px) {
    .ib-workbench-toolbar,
    .ib-filter-bar,
    .ib-batch-bar,
    .ib-workbench-toolbar__actions {
        min-width: 0;
    }
}

@media (max-width: 1199.98px) {
    .ib-workbench-toolbar__actions {
        width: 100%;
        margin-left: 0;
    }
}

@media (max-width: 700px) {
    .ib-workbench-toolbar,
    .ib-filter-bar,
    .ib-batch-bar { align-items: stretch; }
}
