/* OneGrid (FigmaGridComponent) */

.one-grid {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1;
}

.one-grid__card {
    border-radius: 12px;
    border-color: var(--app-border);
    box-shadow: none;
}

.one-grid__scroll-host {
    overflow-x: auto;
    /* UI parity: tables should scroll horizontally only; the page handles vertical scrolling. */
    overflow-y: hidden;
    min-width: 0;
    min-height: 0;
    max-width: 100%;
    scrollbar-gutter: stable both-edges;
    scrollbar-color: color-mix(in srgb, var(--color-neutral-500) 35%, transparent) transparent;
    scrollbar-width: thin;
}

/* Row action dropdown (kebab) fallback.
   Some menus are rendered from RenderFragments in .razor.cs; keep a global style so
   the panel is absolutely positioned even if scoped CSS misses it. */
details.oc-row-menu {
    position: relative;
}

details.oc-row-menu > summary {
    list-style: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

details.oc-row-menu > summary::-webkit-details-marker {
    display: none;
}

details.oc-row-menu .oc-row-menu__panel {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    min-width: 12rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-medium, 0 10px 24px rgb(15 23 42 / 0.10), 0 2px 6px rgb(15 23 42 / 0.06));
    padding: 0.35rem;
    z-index: 2700;
    pointer-events: auto;
}

details.oc-row-menu[open] > summary {
    border-color: color-mix(in srgb, var(--primary) 26%, transparent);
    background: color-mix(in srgb, var(--primary-light) 70%, #ffffff 30%);
    color: var(--primary);
}

details.oc-row-menu .oc-row-menu__item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.55rem 0.65rem;
    border-radius: 10px;
    font-size: 0.84rem;
    color: var(--text-gray-700);
    text-decoration: none;
    white-space: nowrap;
}

details.oc-row-menu button.oc-row-menu__item {
    background: transparent;
    border: 0;
    text-align: left;
    cursor: pointer;
}

details.oc-row-menu .oc-row-menu__item:hover {
    background: var(--accent);
    color: var(--text-dark);
}

details.oc-row-menu .oc-row-menu__item svg {
    width: 16px;
    height: 16px;
}

/* Utility: allow dropdowns/menus to overflow grid container (use sparingly) */
.one-grid:has(details.oc-row-menu[open]) .one-grid__card,
.one-grid:has(details.oc-row-menu[open]) .one-grid__scroll-host {
    overflow: visible !important;
}

.one-grid--allow-overflow .one-grid__card {
    overflow: visible !important;
}

.one-grid--allow-overflow .one-grid__scroll-host {
    overflow: visible !important;
}

.one-grid__scroll-host::-webkit-scrollbar {
    height: 12px;
    width: 12px;
}

.one-grid__scroll-host::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--color-neutral-500) 35%, transparent);
    border-radius: 999px;
    border: 3px solid transparent;
    background-clip: padding-box;
}

.one-grid__scroll-host::-webkit-scrollbar-thumb:hover {
    background: color-mix(in srgb, var(--color-neutral-600) 45%, transparent);
    border: 3px solid transparent;
    background-clip: padding-box;
}

.one-grid__scroll-host::-webkit-scrollbar-track {
    background: transparent;
}

.one-grid .one-grid__table {
    /* Match UI DataTable: prevent action/ending columns from wrapping into visual breakage. */
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
    table-layout: auto;
}

.one-grid__toolbar-row {
    padding: 14px 20px;
    border-bottom: 1px solid var(--app-divider);
    background: var(--app-surface);
}

.one-grid__query-panel {
    border-bottom: 1px solid var(--app-divider);
    background: var(--app-surface);
}

.one-grid__query-filters {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 28px;
    flex-wrap: wrap;
}

.one-grid__query-block {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.one-grid__query-block--right {
    margin-left: auto;
}

.one-grid__query-head-placeholder {
    visibility: hidden;
    pointer-events: none;
}

.one-grid__query-combo {
    height: 40px;
    border-radius: 12px;
    box-shadow: none;
}

.one-grid__stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--app-divider);
    border-radius: 14px;
    background: color-mix(in srgb, var(--app-brand) 4%, var(--app-surface));
}

.one-grid__stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 12px 14px;
    border: 1px solid var(--app-divider);
    border-radius: 12px;
    background: var(--app-surface);
    box-shadow: none;
}

.one-grid__stat-label {
    font-size: 12px;
    color: var(--color-neutral-600);
}

.one-grid__stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--color-neutral-900);
    letter-spacing: 0.01em;
}

.one-grid__stat--primary {
    background: color-mix(in srgb, var(--app-brand) 6%, var(--app-surface));
    border-color: color-mix(in srgb, var(--app-brand) 22%, var(--app-divider));
}

.one-grid__stat--primary .one-grid__stat-label {
    color: var(--app-brand);
}

.one-grid__stat--primary .one-grid__stat-value {
    color: var(--app-text);
}

.one-grid__search {
    width: clamp(220px, 28vw, 360px);
    flex: 1 1 220px;
    max-width: 100%;
    border: 0;
    background: transparent;
    box-shadow: none;
    padding: 0;
}

.one-grid__search:focus-within {
    width: clamp(220px, 28vw, 360px);
    border: 0;
    background: transparent;
    box-shadow: none;
}

@media (max-width: 640px) {
    .one-grid__search {
        width: 100%;
        flex: 1 1 100%;
        transition: none;
    }

    .one-grid__search:focus-within {
        width: 100%;
    }
}

.one-grid__btn {
    height: 40px;
}

.one-grid__btn.one-grid__btn--outline {
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    box-shadow: none;
}

.one-grid__btn.one-grid__btn--outline:hover {
    background: var(--app-divider);
}

.one-grid__btn.one-grid__btn--active {
    background: color-mix(in srgb, var(--app-brand) 10%, var(--app-surface));
    border-color: color-mix(in srgb, var(--app-brand) 30%, var(--app-border));
    color: var(--app-brand);
}

.one-grid__btn.one-grid__btn--danger-outline {
    border-color: color-mix(in srgb, var(--app-error) 35%, var(--app-border));
    color: var(--app-error);
}

.one-grid__btn.one-grid__btn--danger-outline:hover {
    background: color-mix(in srgb, var(--app-error) 10%, var(--app-surface));
}

.one-grid__btn.one-grid__btn--primary {
    background: var(--app-brand);
    color: var(--app-on-accent);
    box-shadow: none;
}

.one-grid__btn.one-grid__btn--primary:hover {
    background: var(--app-brand-hover);
    box-shadow: none;
}

.one-grid__btn.one-grid__btn--icon {
    width: 40px;
    padding-left: 0;
    padding-right: 0;
}

.one-grid__search-input {
    height: 40px;
    background: var(--app-surface);
    border-radius: 12px;
    padding-left: 2.5rem;
    padding-right: 2.5rem;
    transition: box-shadow 150ms ease, border-color 150ms ease;
    box-shadow: none;
}

.one-grid__search:focus-within .one-grid__search-input {
    border-color: color-mix(in srgb, var(--app-brand) 55%, var(--app-border));
    box-shadow: var(--app-focus-ring);
}

.one-grid__icon-btn {
    height: 40px;
    width: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    border: 1px solid var(--app-border);
    background: var(--app-surface);
    box-shadow: none;
    transition: background-color 150ms ease, box-shadow 150ms ease, border-color 150ms ease;
}

.one-grid__icon-btn:hover {
    background: var(--app-divider);
    border-color: var(--app-border);
    box-shadow: none;
}

.one-grid__icon-btn:focus-visible {
    outline: none;
    box-shadow: var(--app-focus-ring);
}

.one-grid__icon-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    box-shadow: none;
}

.one-grid__icon-btn--active {
    border-color: color-mix(in srgb, var(--app-brand) 55%, var(--app-border));
    background: color-mix(in srgb, var(--app-brand) 10%, var(--app-surface));
    box-shadow: none;
}

.one-grid__icon-btn--batch {
    position: relative;
}

.one-grid__icon-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 18px;
    height: 18px;
    padding: 0 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    background: var(--color-primary-600);
    color: var(--app-on-accent);
    font-size: 11px;
    font-weight: 700;
    box-shadow: none;
}

.one-grid__icon-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid color-mix(in srgb, var(--app-text-muted) 45%, transparent);
    border-top-color: var(--color-primary-600);
    border-radius: 9999px;
    animation: one-grid-spin 0.8s linear infinite;
}

/* Tooltip (used by action icons / toolbar) */
.one-tooltip {
    position: fixed;
    z-index: 9999;
    max-width: 260px;
    padding: 8px 10px;
    border-radius: 10px;
    background: var(--app-tooltip-bg);
    color: var(--app-tooltip-text);
    font-size: 12px;
    line-height: 1.35;
    box-shadow: var(--shadow-medium);
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 120ms ease, transform 120ms ease;
    pointer-events: none;
    user-select: none;
    letter-spacing: 0.01em;
}

.one-tooltip--show {
    opacity: 1;
    transform: translateY(0);
}

.one-tooltip::after {
    content: "";
    position: absolute;
    width: 0;
    height: 0;
    border: 6px solid transparent;
}

.one-tooltip[data-placement="top"]::after {
    bottom: -12px;
    left: 50%;
    transform: translateX(-50%);
    border-top-color: var(--app-tooltip-bg);
}

.one-tooltip[data-placement="bottom"]::after {
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    border-bottom-color: var(--app-tooltip-bg);
}

@keyframes one-grid-spin {
    to {
        transform: rotate(360deg);
    }
}

.one-grid__icon-btn--sm {
    height: 40px;
    width: 40px;
    border-radius: 12px;
    box-shadow: none;
}

.one-grid__icon-btn--sm:hover {
    box-shadow: none;
}

.one-grid__datefilter {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 320px;
}

.one-grid__datefilter-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.one-grid__datefilter-title {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.one-grid__datefilter-title-suffix {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--color-neutral-500);
    font-weight: 600;
}

.one-grid__datefilter-meta {
    font-size: 12px;
    color: var(--color-neutral-600);
    padding-left: 2px;
}

.one-grid__segmented--date {
    width: 100%;
}

.one-grid__datefilter-btn {
    height: 40px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    border-radius: 12px;
    border: 1px solid var(--app-border);
    background: var(--app-surface);
    box-shadow: none;
    transition: background-color 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
    color: var(--app-text);
    max-width: 320px;
}

.one-grid__datefilter-btn:hover {
    background: var(--app-divider);
    box-shadow: none;
}

.one-grid__datefilter-btn:focus-visible {
    outline: none;
    box-shadow: var(--app-focus-ring);
}

.one-grid__datefilter-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.one-grid__datefilter-label {
    font-size: 13px;
    font-weight: 600;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.one-grid__datefilter-clear {
    margin-left: 2px;
    height: 20px;
    width: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    color: var(--color-neutral-500);
    background: var(--app-divider);
    flex: 0 0 auto;
}

.one-grid__datefilter-clear:hover {
    color: var(--color-neutral-700);
    background: var(--app-border);
}

.one-grid__datefilter-input {
    height: 40px;
    padding: 6px 10px;
    font-size: 13px;
    border-radius: 12px;
    border: 1px solid var(--app-border);
    background: var(--app-surface);
    outline: none;
    width: 100%;
}

.one-grid__datefilter-input:focus {
    border-color: color-mix(in srgb, var(--app-brand) 55%, var(--app-border));
    box-shadow: var(--app-focus-ring);
}

.one-grid__thead > tr:first-child {
    background: var(--app-surface);
    border-bottom: 1px solid var(--app-border);
}

.one-grid__thead > tr:first-child > th {
    position: sticky;
    top: 0;
    z-index: 20;
}

.one-grid__th {
    font-weight: 500;
    color: var(--color-neutral-700);
}

.one-grid__sort-btn {
    height: 28px;
    width: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: opacity 150ms ease, background-color 150ms ease;
}

.one-grid__sort-btn:hover {
    background: var(--app-divider);
}

.one-grid__sort-btn--inactive {
    opacity: 0.65;
}

.one-grid__sort-btn--inactive:hover {
    opacity: 1;
}

.one-grid__header-menu-btn {
    height: 28px;
    width: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    color: var(--color-neutral-600);
    opacity: 0.7;
    transition: opacity 150ms ease, background-color 150ms ease;
}

.one-grid__th:hover .one-grid__header-menu-btn {
    opacity: 1;
}

.one-grid__header-menu-btn:hover {
    background: var(--app-divider);
}

.one-grid__filter-cell {
    background: var(--app-surface);
}

.one-grid__filter-control {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 8px;
    align-items: center;
}

.one-grid__filter-control--with-clear {
    grid-template-columns: 32px 40px minmax(0, 1fr);
}

.one-grid__filter-clear-all {
    width: 32px;
    height: 40px;
    margin: 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    border: 1px solid var(--app-border);
    background: var(--app-surface);
    color: var(--color-neutral-600);
    transition: background-color 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.one-grid__filter-clear-all:hover {
    background: var(--app-divider);
}

.one-grid__filter-clear-all:focus-visible {
    outline: none;
    border-color: var(--app-brand);
    box-shadow: var(--app-focus-ring);
}

.one-grid__filter-clear-all:disabled {
    opacity: 0.35;
    cursor: default;
}

.one-grid__filter-clear-all:disabled:hover {
    background: var(--app-surface);
}

.one-grid__filter-op-btn {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    border: 1px solid var(--app-border);
    background: var(--app-surface);
    color: var(--color-neutral-600);
    transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, box-shadow 150ms ease;
}

.one-grid__filter-op-btn:hover {
    background: color-mix(in srgb, var(--app-brand) 4%, var(--app-surface));
}

.one-grid__filter-op-btn:focus-visible {
    outline: none;
    border-color: var(--app-brand);
    box-shadow: var(--app-focus-ring);
}

.one-grid__filter-op-btn--active {
    border-color: color-mix(in srgb, var(--app-brand) 45%, var(--app-border));
    color: var(--app-brand);
}

.one-grid__filter-op-glyph {
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.01em;
}

.one-grid__filter-input {
    width: 100%;
    height: 40px;
    padding: 0 12px;
    font-size: 13px;
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: 12px;
    box-shadow: none;
    outline: none;
}

.one-grid__filter-input:focus {
    border-color: var(--app-brand);
    box-shadow: var(--app-focus-ring);
}

.one-grid__filter-between {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.one-grid__filter-select {
    height: 40px;
    border-radius: 12px;
    box-shadow: none;
    outline: none;
}

.one-grid__filter-select:focus {
    border-color: var(--app-brand);
    box-shadow: var(--app-focus-ring);
}

.one-grid__group-panel {
    padding: 16px 20px;
    border-bottom: 1px solid var(--app-divider);
    background: color-mix(in srgb, var(--app-brand) 4%, var(--app-surface));
}

.one-grid__group-panel--active {
    background: color-mix(in srgb, var(--app-brand) 6%, var(--app-surface));
    box-shadow: none;
}

.one-grid__group-header-row {
    background: var(--app-surface);
}

.one-grid__resize-handle {
    background: transparent;
    transition: background-color 150ms ease;
    z-index: 1;
}

.one-grid__resize-handle::after {
    content: "";
    position: absolute;
    top: 8px;
    bottom: 8px;
    left: 50%;
    width: 1px;
    background: color-mix(in srgb, var(--app-text-muted) 60%, transparent);
    transform: translateX(-0.5px);
    border-radius: 999px;
    opacity: 0.55;
}

.one-grid__th:hover .one-grid__resize-handle {
    background: color-mix(in srgb, var(--app-brand) 12%, transparent);
}

.one-grid__th:hover .one-grid__resize-handle::after {
    background: color-mix(in srgb, var(--app-brand) 85%, transparent);
    opacity: 1;
}

.one-grid__resize-handle:hover {
    background: color-mix(in srgb, var(--app-brand) 35%, transparent);
}

.one-grid__inline-input {
    width: 100%;
    height: 40px;
    padding: 0 12px;
    font-size: 13px;
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: 12px;
    box-shadow: none;
    outline: none;
}

.one-grid__inline-input:focus {
    border-color: var(--app-brand);
    box-shadow: var(--app-focus-ring);
}

.one-grid__inline-input--error {
    border-color: var(--app-error);
    box-shadow: none;
}

.one-grid__inline-select {
    height: 40px;
    border-radius: 12px;
}

.one-grid__inline-select--error {
    border-color: var(--app-error);
    box-shadow: none;
}

.one-grid__inline-error {
    font-size: 11px;
    line-height: 1.2;
    color: var(--color-danger-600);
}

.one-grid__infinite-footer {
    background: var(--app-surface);
}

.one-grid__infinite-load-more {
    height: 32px;
    padding: 0 12px;
    border-radius: 9999px;
    border: 1px solid var(--app-border);
    background: var(--app-surface);
    color: var(--app-text);
    font-size: 12px;
    font-weight: 650;
    transition: background-color 150ms ease, color 150ms ease, box-shadow 150ms ease;
}

.one-grid__infinite-load-more:hover {
    background: var(--app-divider);
}

.one-grid__infinite-load-more:focus-visible {
    outline: none;
    box-shadow: var(--app-focus-ring);
}

.one-grid__infinite-sentinel {
    height: 1px;
}

.one-grid__action-icon:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.one-grid__action-icon--save {
    color: var(--app-success);
}

.one-grid__action-icon--save:hover {
    background: color-mix(in srgb, var(--app-success) 12%, var(--app-surface));
}

.one-grid__action-icon--cancel {
    color: var(--app-text-secondary);
}

.one-grid__action-icon--cancel:hover {
    background: var(--app-divider);
}

.one-grid__action-icon--undo,
.one-grid__action-icon--redo {
    color: var(--color-neutral-600);
}

.one-grid__action-icon--undo:hover,
.one-grid__action-icon--redo:hover {
    background: var(--app-divider);
}

.one-grid__row {
    background: var(--app-surface);
}

.one-grid__row--striped {
    background: color-mix(in srgb, var(--app-text) 2.5%, var(--app-surface));
}

.one-grid__row--selected {
    background: color-mix(in srgb, var(--app-brand) 10%, var(--app-surface));
}

.one-grid__row--active {
    box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--color-primary-600) 25%, transparent);
}

.one-grid__row--detail-open {
    background: color-mix(in srgb, var(--app-brand) 6%, var(--app-surface));
}

.one-grid__row--lines {
    border-bottom: 1px solid var(--app-divider);
}

.one-grid__row--hover:hover {
    background: color-mix(in srgb, var(--app-text) 3%, var(--app-surface));
    box-shadow: none;
}

.one-grid__row--detail-open.one-grid__row--hover:hover {
    box-shadow: none;
}

.one-grid__virtual-row {
    content-visibility: auto;
    contain-intrinsic-size: var(--one-grid-virtual-row-size, 44px);
}

.one-grid__virtual-spacer td {
    padding: 0 !important;
    border: 0 !important;
}

.one-grid__row--selected.one-grid__row--hover:hover {
    background: color-mix(in srgb, var(--app-brand) 10%, var(--app-surface));
}

.one-grid__row--batch-new {
    background: color-mix(in srgb, var(--app-success) 12%, var(--app-surface));
}

.one-grid__row--batch-dirty {
    background: color-mix(in srgb, var(--app-warning) 14%, var(--app-surface));
}

.one-grid__row--batch-deleted {
    opacity: 0.6;
    text-decoration: line-through;
}

.one-grid__row--batch-error {
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--app-error) 40%, transparent);
}

.one-grid__cell--batch-error {
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--app-error) 40%, transparent);
    background: color-mix(in srgb, var(--app-error) 10%, var(--app-surface));
}

.one-grid__cell--selected {
    background: color-mix(in srgb, var(--app-brand) 12%, var(--app-surface));
}

.one-grid__cell--active {
    box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--app-brand) 70%, transparent);
    position: relative;
    z-index: 2;
    background: color-mix(in srgb, var(--app-brand) 16%, var(--app-surface));
}

/* Tree grid */
.one-tree-grid .one-grid__card {
    box-shadow: none;
    border-color: var(--app-border);
    border-radius: 12px;
    background: var(--app-surface);
}

.one-tree-grid .one-grid__thead > tr:first-child {
    background: var(--app-surface);
    border-bottom: 1px solid var(--app-divider);
}

.one-tree-grid .one-grid__th {
    font-weight: 500;
    color: var(--app-text-secondary);
}

.one-tree-grid .one-grid__search {
    width: 260px;
    transition: none;
}

.one-tree-grid .one-grid__search:focus-within {
    width: 260px;
}

.one-tree-grid .one-grid__search-input {
    border-radius: 10px;
    box-shadow: none;
}

.one-tree-grid .one-grid__search:focus-within .one-grid__search-input {
    box-shadow: none;
}

.one-grid__tree-content {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    width: 100%;
    padding-left: calc(var(--tree-depth, 0) * 16px);
}

.one-grid__tree-toggle,
.one-grid__tree-toggle-placeholder {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    flex: 0 0 auto;
}

.one-grid__tree-toggle {
    color: var(--app-text-secondary);
    transition: background-color 150ms ease, color 150ms ease, opacity 150ms ease;
}

.one-grid__tree-toggle:hover {
    background: var(--app-divider);
    color: var(--app-text);
}

.one-grid__tree-toggle:focus-visible {
    outline: none;
    box-shadow: var(--app-focus-ring);
}

.one-grid__tree-toggle:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.one-grid__tree-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.one-tree-grid__tree-text--parent {
    font-weight: 700;
    color: var(--color-neutral-900);
}

.one-grid__batch-error-indicator {
    color: var(--app-error);
    display: inline-flex;
    align-items: center;
}

.one-grid__avatar {
    height: 32px;
    width: 32px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    color: var(--app-on-accent);
    flex: 0 0 auto;
}

.one-grid__avatar--indigo {
    background: var(--app-accent-indigo);
}

.one-grid__avatar--purple {
    background: var(--app-accent-purple);
}

.one-grid__avatar--blue {
    background: var(--app-brand);
}

.one-grid__avatar--emerald {
    background: var(--app-success);
}

.one-grid__avatar--amber {
    background: var(--color-warning-600);
}

.one-grid__badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid transparent;
    box-shadow: none;
    line-height: 1;
}

.one-grid__badge--customer {
    background: color-mix(in srgb, var(--app-brand) 12%, var(--app-surface));
    color: var(--app-brand-hover);
    border-color: color-mix(in srgb, var(--app-brand) 26%, var(--app-border));
}

.one-grid__badge--supplier {
    background: color-mix(in srgb, var(--app-warning) 14%, var(--app-surface));
    color: color-mix(in srgb, var(--app-warning) 75%, var(--app-text));
    border-color: color-mix(in srgb, var(--app-warning) 30%, var(--app-border));
}

.one-grid__badge--both {
    background: color-mix(in srgb, var(--app-accent-purple) 14%, var(--app-surface));
    color: color-mix(in srgb, var(--app-accent-purple) 75%, var(--app-text));
    border-color: color-mix(in srgb, var(--app-accent-purple) 30%, var(--app-border));
}

.one-grid__action-icon {
    height: 40px;
    width: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: transparent;
    transition: background-color 150ms ease, color 150ms ease;
}

.one-grid__action-icon svg {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
    display: block;
}

.one-grid__action-icon:focus-visible {
    outline: none;
    box-shadow: var(--app-focus-ring);
}

.one-grid__action-icon--view {
    color: var(--app-brand);
}

.one-grid__action-icon--view:hover {
    background: color-mix(in srgb, var(--app-brand) 12%, var(--app-surface));
}

.one-grid__action-icon--edit {
    color: var(--app-success);
}

.one-grid__action-icon--edit:hover {
    background: color-mix(in srgb, var(--app-success) 12%, var(--app-surface));
}

.one-grid__action-icon--delete {
    color: var(--app-error);
}

.one-grid__action-icon--delete:hover {
    background: color-mix(in srgb, var(--app-error) 12%, var(--app-surface));
}

.one-grid__action-icon--add {
    color: var(--app-accent-indigo);
}

.one-grid__action-icon--add:hover {
    background: color-mix(in srgb, var(--app-accent-indigo) 12%, var(--app-surface));
}

.one-grid__row-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: nowrap;
}

.one-grid__row-actions--end {
    justify-content: flex-end;
}

.one-grid__cell--nowrap {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.one-grid__cell--wrap {
    white-space: normal;
    word-break: break-word;
}

.one-grid__cell--selection {
    position: sticky;
    left: 0;
    z-index: 15;
    background: inherit;
}

.one-grid__thead .one-grid__cell--selection {
    z-index: 35;
}

.one-grid__cell--actions {
    position: sticky;
    right: 0;
    z-index: 14;
    background: inherit;
    box-shadow: inset 1px 0 0 var(--app-divider);
}

.one-grid__thead .one-grid__cell--actions {
    z-index: 40;
}

.one-grid__th--actions,
.one-grid__td--actions {
    width: var(--oc-actions-col-width, 240px) !important;
    min-width: var(--oc-actions-col-width, 240px) !important;
    max-width: var(--oc-actions-col-width, 240px) !important;
    white-space: nowrap;
    vertical-align: middle;
}

.one-grid__td--actions .one-grid__row-actions {
    width: 100%;
    justify-content: flex-end;
    flex-wrap: nowrap;
}

.one-grid__td--actions .one-grid__row-actions > * {
    flex: 0 0 auto;
}

.exchange-rates-grid .one-grid__th--actions,
.exchange-rates-grid .one-grid__td--actions {
    width: 72px !important;
    min-width: 72px !important;
}

.one-grid__checkbox-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    cursor: pointer;
    user-select: none;
    transition: background-color 150ms ease, box-shadow 150ms ease;
}

.one-grid__checkbox-wrap:hover {
    background: color-mix(in srgb, var(--app-text) 4%, var(--app-surface));
}

.one-grid__checkbox-wrap:focus-within {
    box-shadow: var(--app-focus-ring);
}

.one-grid__cell--pinned {
    position: sticky;
    z-index: 12;
    background: inherit;
    box-shadow: inset -1px 0 0 var(--app-divider);
}

.one-grid__thead .one-grid__cell--pinned {
    z-index: 30;
    box-shadow: inset -1px 0 0 var(--app-divider);
}

.one-grid__modal-scroll {
    max-height: 500px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.one-grid__colcfg-width {
    width: 84px;
    height: 40px;
    padding: 0 12px;
    font-size: 13px;
    border: 1px solid var(--app-border);
    border-radius: 12px;
    outline: none;
    background: var(--app-surface);
}

.one-grid__settings-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.one-grid__settings-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

@media (min-width: 640px) {
    .one-grid__settings-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    .one-grid__settings-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.one-grid__settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--app-divider);
    background: var(--app-bg);
}

.one-grid__settings-row--stack {
    flex-direction: column;
    align-items: stretch;
}

.one-grid__segmented {
    display: flex;
    align-items: stretch;
    width: 100%;
    border: 1px solid var(--app-border);
    border-radius: 12px;
    padding: 0;
    background: var(--app-surface);
    box-shadow: none;
    gap: 0;
}

.one-grid__segmented-btn {
    flex: 1 1 0;
    min-width: 0;
    height: 40px;
    padding: 0 12px;
    font-size: 13px;
    font-weight: 650;
    border-radius: 0;
    border: none;
    outline: none;
    background: transparent;
    color: var(--app-text-secondary);
    transition: background-color 150ms ease, color 150ms ease, box-shadow 150ms ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.one-grid__segmented-btn + .one-grid__segmented-btn {
    border-left: 1px solid var(--app-divider);
}

.one-grid__segmented-btn:first-child {
    border-top-left-radius: 11px;
    border-bottom-left-radius: 11px;
}

.one-grid__segmented-btn:last-child {
    border-top-right-radius: 11px;
    border-bottom-right-radius: 11px;
}

.one-grid__segmented-btn:hover {
    background: color-mix(in srgb, var(--app-text) 4%, var(--app-surface));
    color: var(--app-text);
}

.one-grid__segmented-btn:focus-visible {
    box-shadow: var(--app-focus-ring);
    position: relative;
    z-index: 1;
}

.one-grid__segmented-btn--active {
    background: color-mix(in srgb, var(--app-brand) 10%, var(--app-surface));
    color: var(--app-text);
    box-shadow: none;
}

.one-grid__switch {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.one-grid__switch input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.one-grid__switch-slider {
    width: 44px;
    height: 24px;
    border-radius: 999px;
    background: var(--app-divider);
    transition: background-color 150ms ease;
    position: relative;
}

.one-grid__switch-slider::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 999px;
    background: var(--app-surface);
    transition: transform 150ms ease;
    box-shadow: var(--shadow-soft);
}

.one-grid__switch input:checked + .one-grid__switch-slider::after {
    transform: translateX(20px);
}

.one-grid__switch input:checked + .one-grid__switch-slider {
    background: var(--app-brand);
}

.one-grid__advfilter-rules {
    max-height: 400px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.one-grid__advfilter-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border-radius: 12px;
    background: color-mix(in srgb, var(--app-text) 2.5%, var(--app-surface));
    border: 1px solid var(--app-border);
}

.one-grid__advfilter-select {
    height: 36px;
    padding: 6px 10px;
    font-size: 13px;
    border-radius: 10px;
    border: 1px solid var(--color-neutral-300);
    background: var(--app-surface);
    outline: none;
}

.one-grid__advfilter-select:focus {
    border-color: color-mix(in srgb, var(--app-brand) 55%, var(--app-border));
    box-shadow: var(--app-focus-ring);
}

.one-grid__advfilter-input {
    height: 36px;
    padding: 6px 10px;
    font-size: 13px;
    border-radius: 10px;
    border: 1px solid var(--color-neutral-300);
    background: var(--app-surface);
    outline: none;
    flex: 1 1 auto;
    min-width: 180px;
}

.one-grid__advfilter-input:focus {
    border-color: color-mix(in srgb, var(--app-brand) 55%, var(--app-border));
    box-shadow: var(--app-focus-ring);
}

.one-grid__advfilter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    padding: 6px 8px;
    border-radius: 10px;
    border: 1px solid var(--color-neutral-200);
    background: color-mix(in srgb, var(--app-text) 2%, var(--app-surface));
    flex: 1 1 auto;
    min-width: 220px;
}

.one-grid__advfilter-chip {
    padding: 6px 10px;
    font-size: 12px;
    border-radius: 999px;
    border: 1px solid var(--color-neutral-300);
    background: var(--app-surface);
    color: var(--color-neutral-700);
    transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}

.one-grid__advfilter-chip:hover {
    background: var(--app-divider);
}

.one-grid__advfilter-chip--active {
    background: color-mix(in srgb, var(--app-brand) 12%, var(--app-surface));
    border-color: color-mix(in srgb, var(--app-brand) 35%, var(--app-border));
    color: var(--app-brand);
}

.one-grid__advfilter-remove {
    height: 36px;
    width: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    border: 1px solid color-mix(in srgb, var(--app-error) 35%, var(--app-border));
    color: var(--app-error);
    background: var(--app-surface);
}

.one-grid__advfilter-remove:hover {
    background: color-mix(in srgb, var(--app-error) 10%, var(--app-surface));
}

.one-grid__add-rule-btn {
    width: 100%;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border-radius: 12px;
    border: 2px dashed var(--app-border);
    background: var(--app-surface);
    color: var(--app-text-secondary);
    font-weight: 600;
    transition: border-color 150ms ease, background-color 150ms ease, color 150ms ease;
}

.one-grid__add-rule-btn:hover {
    border-color: color-mix(in srgb, var(--app-brand) 55%, var(--app-border));
    background: color-mix(in srgb, var(--app-brand) 10%, var(--app-surface));
    color: var(--app-brand);
}

/* Table base */
.one-grid table {
    border-collapse: collapse;
}

.one-grid table:not(.one-grid__table) {
    table-layout: fixed;
    width: 100%;
}

/* Summaries (footer/group aggregates) */
.one-grid__summary-footer {
    background: var(--app-surface);
}

.one-grid__summary-row {
    background: color-mix(in srgb, var(--app-text) 2.5%, var(--app-surface));
}

.one-grid__group-footer-row {
    background: color-mix(in srgb, var(--app-text) 1.8%, var(--app-surface));
}

.one-grid__summary-cell {
    vertical-align: top;
}

.one-grid__summary-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--color-neutral-600);
    margin-bottom: 6px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.one-grid__summary-lines {
    display: grid;
    gap: 4px;
}

.one-grid__summary-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 12px;
    line-height: 1.2;
}

.one-grid__summary-line-label {
    color: var(--color-neutral-500);
    font-size: 11px;
}

.one-grid__summary-line-value {
    font-weight: 600;
    color: var(--color-neutral-800);
    white-space: nowrap;
}

/* Summary configuration modal */
.one-grid__summary-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.one-grid__summary-option {
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--color-neutral-200);
    background: var(--color-neutral-50);
    transition: border-color 150ms ease, background-color 150ms ease;
}

.one-grid__summary-option:hover {
    border-color: var(--color-neutral-300);
    background: var(--app-surface);
}

.one-grid__summary-option--disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* Master-detail (inline detail rows) */
.one-grid__detail-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    color: var(--app-text-secondary);
    transition: background-color 150ms ease, color 150ms ease;
}

.one-grid__detail-toggle:hover {
    background: var(--app-divider);
    color: var(--app-text);
}

.one-grid__detail-toggle--open,
.one-grid__detail-toggle--open:hover {
    background: color-mix(in srgb, var(--app-brand) 10%, var(--app-surface));
    color: var(--app-brand);
}

.one-grid__detail-row {
    background: color-mix(in srgb, var(--app-brand) 4%, var(--app-bg));
}

/* Detail rows use a single detail panel; don't let prefix column separators cut into it */
.one-grid__detail-row .one-grid__cell--detail,
.one-grid__detail-row .one-grid__cell--selection {
    border-right: 0 !important;
}

.one-grid__detail-cell {
    padding: 12px 14px;
    background: color-mix(in srgb, var(--app-brand) 4%, var(--app-bg));
    position: relative;
}

.one-grid__detail-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid var(--app-border);
    background: var(--app-surface);
    box-shadow: none;
}

.one-grid__detail-loading,
.one-grid__detail-empty {
    font-size: 13px;
    color: var(--color-neutral-600);
}

.one-grid__detail-error {
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--color-danger-200);
    background: var(--color-danger-50);
    color: var(--color-danger-700);
    font-size: 13px;
}

.one-grid__detail-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.one-grid__detail-note {
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--app-border);
    background: var(--app-surface);
    font-size: 13px;
    color: var(--app-text-secondary);
    white-space: pre-wrap;
}

.one-grid__detail-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
    align-items: center;
    justify-content: flex-end;
    padding-top: 6px;
    border-top: 1px solid var(--color-neutral-200);
}

.one-grid__detail-total {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-size: 12px;
    color: var(--color-neutral-700);
}

.one-grid__detail-total-label {
    color: var(--color-neutral-500);
}

.one-grid__detail-total-value {
    font-weight: 700;
    color: var(--color-neutral-900);
    white-space: nowrap;
}

.one-grid__detail-total--strong .one-grid__detail-total-value {
    font-weight: 800;
}

.one-grid__subdetail {
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--color-neutral-200);
    background: var(--app-surface);
}

.one-grid__subdetail-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px 14px;
}

.one-grid__subdetail-item {
    min-width: 0;
}

.one-grid__subdetail-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--color-neutral-500);
    letter-spacing: 0.02em;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.one-grid__subdetail-value {
    font-size: 12px;
    color: var(--color-neutral-800);
    word-break: break-word;
}

@media (max-width: 900px) {
    .one-grid__subdetail-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 520px) {
    .one-grid__subdetail-grid {
        grid-template-columns: 1fr;
    }
}

/* Embedded grids (detail grid inside a detail row) */
.one-grid--embedded .one-grid__card {
    border-radius: 12px;
    box-shadow: none;
    border-color: color-mix(in srgb, var(--app-brand) 22%, var(--app-border));
    background: color-mix(in srgb, var(--app-brand) 4%, var(--app-surface));
}

.one-grid--embedded .one-grid__thead > tr:first-child {
    background: var(--app-surface);
    border-bottom: 1px solid var(--app-divider);
}

/* Enterprise theme overrides (reduce gradients/shadows) */
.one-grid__card {
    border: 1px solid var(--app-border);
    box-shadow: none;
    border-color: var(--app-border);
    background: var(--app-surface);
}

.one-grid__toolbar-row,
.one-grid__query-panel {
    background: var(--app-surface);
}

.one-grid__toolbar-row {
    border-bottom: 1px solid var(--app-divider);
}

.one-grid__btn,
.one-grid__search-input,
.one-grid__icon-btn {
    height: 40px;
}

.one-grid__icon-btn {
    width: 40px;
}

.one-grid__btn.one-grid__btn--outline,
.one-grid__search-input,
.one-grid__icon-btn {
    box-shadow: none;
    border-color: var(--app-border);
}

.one-grid__btn.one-grid__btn--outline:hover,
.one-grid__icon-btn:hover {
    background: var(--app-divider);
    box-shadow: none;
}

.one-grid__btn.one-grid__btn--primary {
    background: var(--app-brand);
    box-shadow: none;
}

.one-grid__btn.one-grid__btn--primary:hover {
    background: var(--app-brand-hover);
    box-shadow: none;
}

.one-grid__btn.one-grid__btn--icon {
    width: 40px;
}

.one-grid__thead > tr:first-child {
    background: var(--app-surface);
    border-bottom: 1px solid var(--app-divider);
}

.one-grid__th {
    color: var(--app-text-secondary);
}

.one-grid__row--lines td {
    border-bottom: 1px solid var(--app-divider);
}

.one-grid--embedded .one-grid__card {
    border-color: var(--app-border);
    background: var(--app-surface);
}

.one-grid--embedded .one-grid__thead > tr:first-child {
    background: var(--app-surface);
    border-bottom: 1px solid var(--app-divider);
}

.one-tree-grid__actions {
    opacity: 0;
    transition: opacity 150ms ease;
}

.one-tree-grid__row:hover .one-tree-grid__actions,
.one-tree-grid__row:focus-within .one-tree-grid__actions,
.one-tree-grid__row--active .one-tree-grid__actions {
    opacity: 1;
}

.one-tree-grid .one-grid__row--hover:hover {
    background: color-mix(in srgb, var(--app-text) 3%, var(--app-surface));
}
