/* Bookkeeper2d - Nebular-like theme (light/dark) */

:root {
    --bk-primary: #3366ff;
    --bk-primary-hover: #598bff;
    --bk-success: #00d68f;
    --bk-info: #0095ff;
    --bk-warning: #ffaa00;
    --bk-danger: #ff3d71;
    --bk-radius: 0.25rem;
    --bk-font: "Open Sans", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.theme-default {
    --bk-bg: #f7f9fc;
    --bk-surface: #ffffff;
    --bk-surface-2: #edf1f7;
    --bk-border: #e4e9f2;
    --bk-text: #222b45;
    --bk-text-hint: #8f9bb3;
    --bk-header-bg: #ffffff;
    --bk-sidebar-bg: #ffffff;
    --bk-shadow: 0 0.5rem 1rem 0 rgba(44, 51, 73, 0.1);
}

.theme-corporate {
    --bk-bg: #eef1f7;
    --bk-surface: #ffffff;
    --bk-surface-2: #edf1f7;
    --bk-border: #d9dfeb;
    --bk-text: #222b45;
    --bk-text-hint: #8f9bb3;
    --bk-header-bg: #ffffff;
    --bk-sidebar-bg: #ffffff;
    --bk-shadow: 0 0.5rem 1rem 0 rgba(44, 51, 73, 0.08);
}

.theme-dark {
    --bk-bg: #151a30;
    --bk-surface: #222b45;
    --bk-surface-2: #1a2138;
    --bk-border: #101426;
    --bk-text: #ffffff;
    --bk-text-hint: #8f9bb3;
    --bk-header-bg: #1a2138;
    --bk-sidebar-bg: #1a2138;
    --bk-shadow: 0 0.5rem 1rem 0 rgba(0, 0, 0, 0.25);
}

.theme-cosmic {
    --bk-bg: #252547;
    --bk-surface: #323259;
    --bk-surface-2: #2a2a52;
    --bk-border: #252547;
    --bk-text: #ffffff;
    --bk-text-hint: #a4abb3;
    --bk-header-bg: #323259;
    --bk-sidebar-bg: #252547;
    --bk-shadow: 0 0.5rem 1rem 0 rgba(0, 0, 0, 0.3);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    font-family: var(--bk-font), serif;
    background: var(--bk-bg);
    color: var(--bk-text);
    font-size: 14px;
    line-height: 1.5;
}

.bk-app {
    min-height: 100vh;
    background: var(--bk-bg);
    color: var(--bk-text);
}

a { color: var(--bk-primary); text-decoration: none; }
a:hover { color: var(--bk-primary-hover); }

/* Typography */
.h1 { font-size: 1.75rem; font-weight: 700; line-height: 2.25rem; }
.h2 { font-size: 1.5rem; font-weight: 700; line-height: 2rem; }
.h3 { font-size: 1.25rem; font-weight: 700; line-height: 1.75rem; }
.h5 { font-size: 1rem; font-weight: 700; line-height: 1.375rem; }
.title { font-size: 1.5rem; font-weight: 700; }
.subtitle, .sub-title { color: var(--bk-text-hint); }
.label { color: var(--bk-text); font-size: 0.875rem; font-weight: 600; }
.bk-muted { color: var(--bk-text-hint); }
.bk-account-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

/* Layout */
.bk-layout { display: flex; flex-direction: column; min-height: 100vh; }
.bk-layout-body { display: flex; flex: 1; }

.bk-header {
    height: 3.75rem;
    background: var(--bk-header-bg);
    border-bottom: 1px solid var(--bk-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    position: sticky;
    top: 0;
    z-index: 20;
}

.bk-header-left, .bk-header-right { display: flex; align-items: center; gap: 0.75rem; }

.bk-logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--bk-text);
    letter-spacing: 0.01em;
}
.bk-logo span { color: var(--bk-primary); }
.bk-logo:hover { color: var(--bk-text); }

.bk-icon-btn {
    background: transparent;
    border: none;
    color: var(--bk-text);
    cursor: pointer;
    padding: 0.4rem;
    border-radius: var(--bk-radius);
    display: inline-flex;
    align-items: center;
}
.bk-icon-btn:hover { background: var(--bk-surface-2); }

.bk-icon { width: 20px; height: 20px; display: inline-block; flex: none; }

/* Sidebar */
.bk-sidebar {
    width: 260px;
    background: var(--bk-sidebar-bg);
    border-right: 1px solid var(--bk-border);
    padding: 1rem 0;
    flex: none;
}
.bk-menu { display: flex; flex-direction: column; }
.bk-menu-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 1.25rem;
    color: var(--bk-text);
    font-weight: 600;
    font-size: 0.875rem;
}
.bk-menu-item:hover { background: var(--bk-surface-2); color: var(--bk-primary); }
.bk-menu-item.active { color: var(--bk-primary); border-right: 3px solid var(--bk-primary); }
.bk-menu-child { padding-left: 2.75rem; font-weight: 500; }
.bk-menu-children { border-top: 1px solid var(--bk-border); border-bottom: 1px solid var(--bk-border); }
.bk-menu-arrow {
    margin-left: auto;
    font-size: 0.65rem;
    color: var(--bk-text-hint);
    transition: transform 0.2s ease;
}
.bk-menu-group.expanded .bk-menu-arrow { transform: rotate(90deg); }

/* Desktop: the burger collapses the sidebar into an icon-only "minimal" mode.
   The same `open` class drives the mobile drawer below, so the two behaviors
   are separated by media query. */
@media (min-width: 901px) {
    .bk-sidebar { transition: width 0.2s ease; }
    .bk-sidebar.open { width: 64px; }
    .bk-sidebar.open .bk-menu-title { display: none; }
    .bk-sidebar.open .bk-menu-children { display: none; }
    .bk-sidebar.open .bk-menu-arrow { display: none; }
    .bk-sidebar.open .bk-menu-item { justify-content: center; padding-left: 0.5rem; padding-right: 0.5rem; }
    .bk-sidebar.open .bk-menu-item.active { border-right: none; }
}

/* Content / footer */
.bk-content { flex: 1; padding: 1.5rem; min-width: 0; }
.bk-page { display: flex; flex-direction: column; gap: 1.25rem; max-width: 1400px; }
.bk-page-narrow { max-width: 720px; width: 100%; margin: 0 auto; }

.bk-footer {
    padding: 0.75rem 1.5rem;
    border-top: 1px solid var(--bk-border);
    color: var(--bk-text-hint);
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1.25rem;
}

.bk-footer-versions {
    display: flex;
    gap: 1.25rem;
}

/* Card */
.bk-card {
    background: var(--bk-surface);
    border: 1px solid var(--bk-border);
    border-radius: var(--bk-radius);
    box-shadow: var(--bk-shadow);
    overflow: hidden;
}
.bk-card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--bk-border);
}
.bk-card-body { padding: 1.25rem; }

.bk-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

/* Toolbar / search */
.bk-toolbar { margin-bottom: 1rem; display: flex; gap: 0.75rem; align-items: center; }
.bk-input-search { max-width: 320px; }
.bk-filter-select { width: 180px; flex: none; }

/* Table */
.bk-table-wrap { overflow-x: auto; }
.bk-table { width: 100%; border-collapse: collapse; }
.bk-table th, .bk-table td {
    padding: 0.65rem 0.9rem;
    border-bottom: 1px solid var(--bk-border);
    text-align: left;
    vertical-align: middle;
}
.bk-table th {
    background: var(--bk-surface-2);
    color: var(--bk-text);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-weight: 700;
}
/* Zebra striping: every other body row gets a subtle tint (theme-adaptive). */
.bk-table tbody tr:nth-child(even) {
    background-color: color-mix(in srgb, var(--bk-surface-2) 50%, transparent);
}
.bk-table tbody tr:hover { background: var(--bk-surface-2); }
.bk-table-total td {
    border-top: 2px solid var(--bk-border);
    background: var(--bk-surface-2);
    font-weight: 700;
}
.bk-table-empty { padding: 2rem; text-align: center; color: var(--bk-text-hint); }
.bk-row-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* Sortable table headers */
.bk-th-sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}
.bk-th-sortable:hover { color: var(--bk-primary); }
.bk-sort-indicator {
    display: inline-block;
    width: 1em;
    margin-left: 0.25rem;
    color: var(--bk-primary);
    font-size: 0.7rem;
}

/* Inline checkbox filter rendered next to a column header */
.bk-header-checkbox {
    width: 15px;
    height: 15px;
    vertical-align: middle;
    cursor: pointer;
    margin-left: 0.4rem;
}

/* Buttons */
.bk-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: var(--bk-radius);
    padding: 0.55rem 1rem;
    font-size: 0.875rem;
    font-weight: 700;
    cursor: pointer;
    line-height: 1.25rem;
    background: var(--bk-surface-2);
    color: var(--bk-text);
    text-transform: none;
}
.bk-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.bk-btn-sm { padding: 0.3rem 0.7rem; font-size: 0.8125rem; }
.bk-btn-lg { padding: 0.75rem 1.25rem; font-size: 1rem; }
.bk-btn-block { width: 100%; }
.bk-btn-primary { background: var(--bk-primary); color: #fff; }
.bk-btn-primary:hover:not(:disabled) { background: var(--bk-primary-hover); color: #fff; }
.bk-btn-success { background: var(--bk-success); color: #fff; }
.bk-btn-success:hover:not(:disabled) { background: #00c581; color: #fff; }
.bk-btn-outline { background: transparent; border-color: var(--bk-border); color: var(--bk-text); }
.bk-btn-outline:hover:not(:disabled) { border-color: var(--bk-primary); color: var(--bk-primary); }

/* Badges */
.bk-badge {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #fff;
}
.bk-badge-success { background: var(--bk-success); }
.bk-badge-danger { background: var(--bk-danger); }
.bk-badge-info { background: var(--bk-info); }
.bk-badge-warning { background: var(--bk-warning); }
.bk-badge-basic { background: var(--bk-text-hint); }

.bk-link { color: var(--bk-primary); font-weight: 600; }
.bk-link:hover { text-decoration: underline; }

/* Pagination */
.bk-pager { display: flex; align-items: center; gap: 1rem; margin-top: 1rem; justify-content: flex-end; flex-wrap: wrap; }
.bk-pager-info { color: var(--bk-text-hint); font-size: 0.875rem; }
.bk-pager-form { display: inline-flex; align-items: center; gap: 0.4rem; }
.bk-pager-input {
    width: 64px;
    padding: 0.3rem 0.5rem;
    border: 1px solid var(--bk-border);
    border-radius: var(--bk-radius);
    background: var(--bk-surface);
    color: var(--bk-text);
    font-size: 0.875rem;
    text-align: center;
}
.bk-pager-input:focus { outline: none; border-color: var(--bk-primary); }
.bk-pager-size {
    width: auto;
    padding: 0.3rem 0.5rem;
    border: 1px solid var(--bk-border);
    border-radius: var(--bk-radius);
    background: var(--bk-surface);
    color: var(--bk-text);
    font-size: 0.875rem;
}

/* Progress */
.bk-progress {
    height: 6px;
    background: var(--bk-surface-2);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 1.25rem;
}
.bk-progress-fill { height: 100%; border-radius: 999px; }
.bk-progress-fill.success { background: var(--bk-success); }
.bk-progress-fill.danger { background: var(--bk-danger); }
.progress-info { display: flex; flex-direction: column; margin-top: 0.5rem; }

/* Pie chart */
.bk-pie-wrap { display: flex; flex-direction: row; align-items: center; gap: 1.5rem; }
.bk-pie {
    width: 260px;
    height: 260px;
    border-radius: 50%;
    position: relative;
    flex: none;
}
.bk-pie-hole {
    position: absolute;
    inset: 50%;
    transform: translate(-50%, -50%);
    width: 50%;
    height: 50%;
    border-radius: 50%;
    background: var(--bk-surface);
}
.bk-legend { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 0; }
.bk-legend li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.25rem;
    border-radius: var(--bk-radius);
    cursor: pointer;
    user-select: none;
}
.bk-legend li:hover { background: var(--bk-surface-2); }
.bk-legend li.is-hidden { opacity: 0.4; }
.bk-legend li.is-hidden .bk-legend-label { text-decoration: line-through; }
.bk-legend-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.bk-legend-label { font-size: 0.875rem; }

/* Forms */
.bk-field { margin-bottom: 1rem; display: flex; flex-direction: column; gap: 0.35rem; }
.bk-input, .bk-select {
    width: 100%;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--bk-border);
    border-radius: var(--bk-radius);
    background: var(--bk-surface);
    color: var(--bk-text);
    font-size: 0.875rem;
    font-family: inherit;
}
.bk-input:focus, .bk-select:focus { outline: none; border-color: var(--bk-primary); }
.bk-checkbox-field { flex-direction: row; }
.bk-checkbox { display: flex; align-items: center; gap: 0.5rem; font-weight: 600; }
.bk-checkbox input { width: 16px; height: 16px; }
.bk-buttons-row { display: flex; gap: 0.75rem; margin-top: 0.5rem; }

/* Alerts / loading */
.bk-alert {
    padding: 0.75rem 1rem;
    border-radius: var(--bk-radius);
    margin-bottom: 1rem;
    font-size: 0.875rem;
}
.bk-alert-danger { background: rgba(255, 61, 113, 0.15); color: var(--bk-danger); border: 1px solid var(--bk-danger); }
.bk-loading { padding: 2rem; text-align: center; color: var(--bk-text-hint); }

/* Auth */
.bk-auth {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.bk-auth .bk-card { width: 100%; max-width: 420px; }
.bk-auth-inner { padding: 1rem 0; }
.bk-auth-inner .title { margin-bottom: 0.25rem; }
.bk-auth-inner .sub-title { margin-bottom: 1.5rem; }

.bk-notfound { max-width: 480px; margin: 0 auto; text-align: center; display: flex; flex-direction: column; gap: 0.75rem; align-items: center; padding: 2rem 0; }

/* Reports */
.bk-report-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.bk-period-selector { display: flex; flex-direction: column; gap: 0.5rem; min-width: 240px; }
.bk-date-range { display: flex; align-items: center; gap: 0.5rem; }
.bk-date-sep { color: var(--bk-text-hint); }
.bk-report-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-top: 1rem; align-items: start; }
@media (max-width: 900px) {
    .bk-report-grid { grid-template-columns: 1fr; }
    .bk-sidebar { display: none; }
    .bk-sidebar.open { display: block; position: fixed; z-index: 30; top: 3.75rem; bottom: 0; left: 0; }
}

/* Toasts */
.bk-toast-host {
    position: fixed;
    top: 4.25rem;
    right: 1rem;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 360px;
}
.bk-toast {
    background: var(--bk-surface);
    color: var(--bk-text);
    border: 1px solid var(--bk-border);
    border-radius: var(--bk-radius);
    padding: 0.75rem 1rem;
    box-shadow: var(--bk-shadow);
    position: relative;
}
.bk-toast-title { font-weight: 700; }
.bk-toast-body { font-size: 0.875rem; color: var(--bk-text-hint); }
.bk-toast-close {
    position: absolute;
    top: 0.25rem;
    right: 0.5rem;
    background: none;
    border: none;
    color: var(--bk-text-hint);
    cursor: pointer;
    font-size: 1rem;
}
.bk-toast-success { border-left: 4px solid var(--bk-success); }
.bk-toast-info { border-left: 4px solid var(--bk-info); }
.bk-toast-warning { border-left: 4px solid var(--bk-warning); }
.bk-toast-danger { border-left: 4px solid var(--bk-danger); }

/* SVG charts */
.bk-chart-wrap { width: 100%; margin-top: 1rem; }
.bk-chart { width: 100%; height: auto; display: block; }
.bk-chart-gridline { stroke: var(--bk-border); stroke-width: 1; }
.bk-chart-axis-label { fill: var(--bk-text-hint); font-size: 11px; }
.bk-chart-area { stroke: none; animation: bk-fade-in 0.8s cubic-bezier(0.22, 1, 0.36, 1) both; }
.bk-chart-line {
    fill: none;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 1200;
    stroke-dashoffset: 1200;
    animation: bk-line-draw 1.1s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.bk-chart-dot {
    stroke: var(--bk-surface);
    stroke-width: 2;
    transform-box: fill-box;
    transform-origin: center;
    transition: transform 0.15s ease;
    animation: bk-fade-in 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.bk-chart-dot:hover { transform: scale(1.6); }
.bk-chart-bar {
    stroke: none;
    transform-box: fill-box;
    transform-origin: 50% 100%;
    transition: opacity 0.15s ease;
    animation: bk-grow-y 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.bk-chart-bar:hover { opacity: 0.8; }
.bk-chart-legend { display: flex; gap: 0.25rem; flex-wrap: wrap; margin-top: 0.5rem; }
.bk-chart-legend-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.875rem;
    padding: 0.2rem 0.4rem;
    border-radius: var(--bk-radius);
    cursor: pointer;
    user-select: none;
}
.bk-chart-legend-item:hover { background: var(--bk-surface-2); }
.bk-chart-legend-item.is-hidden { opacity: 0.4; }
.bk-chart-legend-swatch { width: 12px; height: 12px; border-radius: 3px; flex: none; }

/* Chart tooltip */
.bk-chart-tooltip {
    position: fixed;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--bk-surface);
    border: 1px solid var(--bk-border);
    border-radius: var(--bk-radius);
    box-shadow: var(--bk-shadow);
    pointer-events: none;
    font-size: 0.875rem;
    white-space: nowrap;
}
.bk-chart-tooltip-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.bk-chart-tooltip-label { color: var(--bk-text-hint); }
.bk-chart-tooltip-value { color: var(--bk-text); font-weight: 700; }

@keyframes bk-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes bk-line-draw { to { stroke-dashoffset: 0; } }
@keyframes bk-grow-y { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes bk-grow-x { from { transform: scaleX(0); } to { transform: scaleX(1); } }

@media (prefers-reduced-motion: reduce) {
    .bk-chart-area, .bk-chart-line, .bk-chart-dot, .bk-chart-bar, .bk-hbar-fill {
        animation: none;
        transition: none;
    }
}

/* Horizontal bar chart */
.bk-hbar { display: flex; flex-direction: column; gap: 0.6rem; }
/* Give charts breathing room when they sit directly below a report table. */
.bk-table + .bk-hbar,
.bk-table + .bk-chart-wrap { margin-top: 1.5rem; }
.bk-hbar-row { display: grid; grid-template-columns: 130px 1fr auto; align-items: center; gap: 0.75rem; }
.bk-hbar-label { font-size: 0.875rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; }
.bk-hbar-track { background: var(--bk-surface-2); border-radius: 999px; height: 10px; overflow: hidden; }
.bk-hbar-fill {
    height: 100%;
    border-radius: 999px;
    transform-origin: left;
    animation: bk-grow-x 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
    transition: width 0.5s ease, filter 0.15s ease;
}
.bk-hbar-row:hover .bk-hbar-fill { filter: brightness(1.08); }
.bk-hbar-row:hover .bk-hbar-label { color: var(--bk-primary); }
.bk-hbar-value { font-size: 0.875rem; white-space: nowrap; text-align: right; min-width: 90px; }

/* ===========================================================================
   Responsive hardening (applies at every width)
   =========================================================================== */

/* Flex/grid children default to `min-width: auto`, which lets wide content
   (tables, selects, long titles) push the page wider than the viewport and
   produce horizontal scrollbars. Allow these containers to shrink. */
.bk-header-left,
.bk-header-right,
.bk-page-header,
.bk-card,
.bk-pie-wrap,
.bk-report-header,
.bk-toolbar,
.bk-buttons-row {
    min-width: 0;
}

/* The theme <select> in the header inherits the form-field `width: 100%`,
   which inflates the header on narrow screens. */
select.bk-select-theme {
    width: auto;
    min-width: 0;
}

/* Hard cap media/table intrinsic sizes. */
img,
svg,
table {
    max-width: 100%;
}

/* Safety net: clip any residual overflow without creating a scroll container
   (unlike `hidden`, `clip` does not break `position: sticky`). */
html,
body {
    overflow-x: clip;
}

/* ===========================================================================
   Mobile layout (phones, <= 640px)
   =========================================================================== */

@media (max-width: 640px) {
    .bk-content { padding: 0.75rem; }
    .bk-page { gap: 1rem; }
    .bk-card-header { padding: 0.85rem 1rem; }
    .bk-card-body { padding: 1rem; }

    /* Header: tighten spacing and let the logo shrink instead of overflowing. */
    .bk-header { padding: 0 0.75rem; gap: 0.5rem; }
    .bk-logo { font-size: 1.1rem; white-space: nowrap; }

    /* Page title + action button stack vertically. */
    .bk-page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    .bk-page-header .bk-btn { width: 100%; }
    .bk-account-header { gap: 0.75rem; }
    .bk-account-header .bk-btn { width: 100%; }

    /* Toolbar: search / filters go full-width and wrap. */
    .bk-toolbar { flex-wrap: wrap; }
    .bk-toolbar .bk-input-search,
    .bk-toolbar .bk-filter-select {
        width: 100%;
        max-width: 100%;
        flex: 1 1 100%;
    }

    /* Pie chart stacks above its legend and stays a circle. */
    .bk-pie-wrap {
        flex-direction: column;
        align-items: center;
    }
    .bk-pie {
        width: min(240px, 90vw);
        height: auto;
        aspect-ratio: 1 / 1;
    }

    /* Horizontal bars: narrower label column so rows fit 320px screens. */
    .bk-hbar-row { grid-template-columns: 84px 1fr auto; gap: 0.5rem; }
    .bk-hbar-value { min-width: 0; }

    /* Reports: period/date selectors go full-width and wrap. */
    .bk-period-selector { min-width: 0; width: 100%; }
    .bk-date-range { flex-wrap: wrap; }

    /* Pagination centers and stays within the viewport. */
    .bk-pager { justify-content: center; }

    /* Toasts span the screen width on small phones. */
    .bk-toast-host { left: 0.75rem; right: 0.75rem; max-width: none; }

    /* Tables become stacked "cards": each row shows its column label on the
       left via `td::before { content: attr(data-label) }` (labels are emitted
       by the `DataTable` component as `data-label`). */
    .bk-table-wrap { overflow-x: visible; }
    .bk-table,
    .bk-table tbody,
    .bk-table tr,
    .bk-table td {
        display: block;
        width: 100%;
    }
    .bk-table thead { display: none; }
    .bk-table tbody tr {
        border: 1px solid var(--bk-border);
        border-radius: var(--bk-radius);
        background: var(--bk-surface);
        box-shadow: var(--bk-shadow);
        margin-bottom: 0.75rem;
        overflow: hidden;
    }
    .bk-table tbody tr:nth-child(even) { background: var(--bk-surface); }
    .bk-table td {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 0.75rem;
        padding: 0.6rem 0.75rem;
        border-bottom: 1px solid var(--bk-border);
    }
    .bk-table td:last-child { border-bottom: none; }
    .bk-table td::before {
        content: attr(data-label);
        flex: none;
        text-align: left;
        font-weight: 700;
        font-size: 0.75rem;
        text-transform: uppercase;
        letter-spacing: 0.03em;
        color: var(--bk-text-hint);
    }
    .bk-table .bk-row-actions { justify-content: flex-end; }
}
