/* BumiNet OSS Foundation v4
 * Shared tokens and structural safety only. Page composition belongs to Filament
 * or to a page-scoped stylesheet so one screen cannot reshape another screen.
 */
:root {
    --bn-font: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --bn-radius-sm: .75rem;
    --bn-radius-md: 1rem;
    --bn-blue: #2563eb;
    --bn-green: #059669;
    --bn-border-light: #dbe3ef;
    --bn-border-dark: rgba(148, 163, 184, .22);
    --bn-muted-light: #64748b;
    --bn-muted-dark: #a7b3c5;
}

html {
    font-family: var(--bn-font);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

html:not(.dark):not(.fi-dark),
html[data-theme="light"],
html[data-theme-preference="light"] {
    color-scheme: light;
}

html.dark,
html.fi-dark,
html[data-theme="dark"],
html[data-theme-preference="dark"] {
    color-scheme: dark;
}

/* Structural safety. Do not set sidebar offsets, page widths, card colours,
 * table minimum widths, modal widths, or full-width actions here. Filament
 * owns those layouts and applies each modal's requested size.
 */
.fi-main,
.fi-main-ctn,
.fi-page,
.fi-page-content,
.fi-section-content,
.fi-ta-content,
.fi-modal-content,
.fi-form,
.fi-fo-component-ctn {
    min-width: 0;
}

.fi-header-actions,
.fi-ac,
.fi-modal-footer-actions {
    flex-wrap: wrap;
}

.fi-ta-content {
    overflow-x: auto;
    overscroll-behavior-inline: contain;
}

.fi-ta-text,
.fi-ta-text-item,
.fi-badge,
.fi-section-description,
.fi-in-text {
    overflow-wrap: anywhere;
}

@media (max-width: 640px) {
    .fi-header-actions,
    .fi-modal-footer-actions {
        gap: .5rem;
    }

    .fi-modal-window {
        max-height: calc(100dvh - 1rem);
    }
}

/* Reusable detail-page foundation.
 * Add data-bn-detail-grid="true" to a Filament section when its fields need
 * subtle, consistent boundaries. This is shared by all OSS panels.
 */
[data-bn-detail-grid="true"] .fi-in-entry {
    min-width: 0;
    padding: .8rem .9rem;
    border: 1px solid var(--bn-border-light);
    border-radius: .7rem;
    background: transparent;
}

[data-bn-detail-grid="true"] .fi-section-header {
    border-bottom: 1px solid var(--bn-border-light);
}

html.dark [data-bn-detail-grid="true"] .fi-in-entry,
html.fi-dark [data-bn-detail-grid="true"] .fi-in-entry,
html[data-theme="dark"] [data-bn-detail-grid="true"] .fi-in-entry,
html[data-theme-preference="dark"] [data-bn-detail-grid="true"] .fi-in-entry {
    border-color: var(--bn-border-dark);
}

html.dark [data-bn-detail-grid="true"] .fi-section-header,
html.fi-dark [data-bn-detail-grid="true"] .fi-section-header,
html[data-theme="dark"] [data-bn-detail-grid="true"] .fi-section-header,
html[data-theme-preference="dark"] [data-bn-detail-grid="true"] .fi-section-header {
    border-bottom-color: var(--bn-border-dark);
}

@media (max-width: 640px) {
    [data-bn-detail-grid="true"] .fi-in-entry {
        padding: .7rem .75rem;
    }
}

/* Invoice detail: a single readable vertical flow with compact data cells. */
[data-bn-invoice-section="true"] .fi-in-entry {
    min-height: 4.75rem;
}

[data-bn-invoice-section="true"] .fi-in-entry-label-col {
    padding-bottom: .4rem;
    border-bottom: 1px solid color-mix(in srgb, var(--bn-border-light) 70%, transparent);
}

[data-bn-invoice-section="true"] .fi-in-entry-content-col {
    align-content: center;
}

[data-bn-invoice-section="true"] .fi-in-text {
    word-break: normal;
    overflow-wrap: normal;
}

[data-bn-invoice-section="true"] [data-bn-money="true"] .fi-in-text {
    white-space: nowrap;
}

html.dark [data-bn-invoice-section="true"] .fi-in-entry-label-col,
html.fi-dark [data-bn-invoice-section="true"] .fi-in-entry-label-col,
html[data-theme="dark"] [data-bn-invoice-section="true"] .fi-in-entry-label-col,
html[data-theme-preference="dark"] [data-bn-invoice-section="true"] .fi-in-entry-label-col {
    border-bottom-color: var(--bn-border-dark);
}

@media (max-width: 640px) {
    [data-bn-invoice-section="true"] .fi-in-entry {
        min-height: 0;
    }
}
