/* =============================================================
   TBZ TRMCS — Theme Stylesheet
   Color palette: TBZ Green (#2d6a2d) + Gold (#c8a415)
   Approach: Mobile-first, Bootstrap 5 companion
   ============================================================= */

/* ── 1. Design Tokens ─────────────────────────────────────── */
:root {
    /* Primary — TBZ Green */
    --tbz-primary:        #0f8a5f;
    --tbz-primary-hover:  #0b6b49;
    --tbz-primary-light:  #e7f6ef;

    /* Accent — Gold */
    --tbz-gold:           #c8a415;
    --tbz-gold-hover:     #a88a0f;
    --tbz-gold-light:     #fef3d7;

    /* Layout — app-shell inset (efferd app-shell-3) */
    --tbz-sidebar-width:       16rem;
    --tbz-sidebar-width-icon:  3rem;
    --tbz-sidebar-inset:       0.5rem;
    --tbz-topbar-h:            3.5rem;
    --tbz-radius:              0.625rem;
    --tbz-radius-xl:           0.75rem;

    /* Surfaces */
    --tbz-sidebar-bg:     #f8f9fa;
    --tbz-sidebar-fg:     #1a1d23;
    --tbz-sidebar-accent: #eceff3;
    --tbz-sidebar-accent-fg: #1a1d23;
    --tbz-sidebar-border: #e5e7eb;
    --tbz-topbar-bg:      #ffffff;
    --tbz-body-bg:        #f8f9fa;
    --tbz-inset-bg:       #ffffff;
    --tbz-surface-muted:  #f3f4f6;
    --tbz-surface-elevated: #ffffff;
    --tbz-input-border:   #eceff3;
    --tbz-placeholder:    #9aa3af;
    --tbz-overlay-scrim:  rgba(0, 0, 0, .35);
    --tbz-danger-soft:    #fef2f2;
    --tbz-danger-text:    #dc2626;

    --tbz-table-header-bg:  #f8fafc;
    --tbz-table-row-hover:  #fbfdfb;
    --tbz-table-border:     #edf1f5;
    --tbz-input-bg:         #f8fafc;
    --tbz-input-border-strong: #dbe4ed;
    --tbz-focus-ring:       rgba(15, 138, 95, .12);
    --tbz-kpi-accent-border: #d3efe3;
    --tbz-kpi-icon-bg:      #f3f4f6;
    --tbz-kpi-icon-border:  #eceff3;
    --tbz-kpi-accent-icon-bg: #bfead9;
    --tbz-kpi-icon-fg:      #6b7280;
    --tbz-filter-pill-border: #c9dfc9;
    --tbz-loader-overlay:   rgba(246, 247, 248, .82);
    --tbz-row-stripe:       #f9fafb;
    --tbz-hover-accent:     rgba(15, 138, 95, 0.04);
    --tbz-settings-icon-bg: #f4f7fb;
    --tbz-settings-icon-border: #e3e8ef;
    --tbz-wizard-track:     #e2e8f0;

    /* Typography */
    --tbz-text-dark:      #1a1d23;
    --tbz-text-muted:     #6b7280;
    --tbz-border:         #e5e7eb;
    --tbz-shadow-card:        0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .10);
    --tbz-shadow-card-hover:  0 8px 20px rgba(16, 24, 40, .10);
    --tbz-shadow-float:       0 14px 40px rgba(16, 24, 40, .12);
    --tbz-shadow-inset:       0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);

    /* Module-card icon colours */
    --tbz-mc-green-icon:  #2d6a2d;
    --tbz-mc-gold-icon:   #c8a415;
    --tbz-mc-teal-icon:   #00897b;
    --tbz-mc-blue-icon:   #1a73e8;
    --tbz-mc-orange-icon: #e05a2b;
    --tbz-mc-amber-icon:  #e65c00;
    /* legacy purple kept for backward compat */
    --tbz-mc-purple-icon: #6c5ce7;
}

/* Dark mode — shadcn nova / ui-reference app-shell-3 palette */
html.dark {
    color-scheme: dark;

    --tbz-primary-light:  #123d30;
    --tbz-gold-light:     #3d3410;

    --tbz-sidebar-bg:     oklch(0.205 0 0);
    --tbz-sidebar-fg:     oklch(0.985 0 0);
    --tbz-sidebar-accent: oklch(0.269 0 0);
    --tbz-sidebar-accent-fg: oklch(0.985 0 0);
    --tbz-sidebar-border: oklch(1 0 0 / 10%);
    --tbz-topbar-bg:      oklch(0.205 0 0);
    --tbz-body-bg:        oklch(0.145 0 0);
    --tbz-inset-bg:       oklch(0.205 0 0);
    --tbz-surface-muted:  oklch(0.269 0 0);
    --tbz-surface-elevated: oklch(0.269 0 0);
    --tbz-input-border:   oklch(1 0 0 / 15%);
    --tbz-placeholder:    oklch(0.708 0 0);
    --tbz-overlay-scrim:  rgba(0, 0, 0, .55);

    --tbz-text-dark:      oklch(0.985 0 0);
    --tbz-text-muted:     oklch(0.708 0 0);
    --tbz-border:         oklch(1 0 0 / 10%);

    --tbz-shadow-card:        0 1px 2px rgba(0, 0, 0, .35), 0 1px 3px rgba(0, 0, 0, .25);
    --tbz-shadow-card-hover:  0 8px 20px rgba(0, 0, 0, .35);
    --tbz-shadow-float:       0 14px 40px rgba(0, 0, 0, .45);
    --tbz-shadow-inset:       0 1px 2px rgba(0, 0, 0, .35), 0 1px 3px rgba(0, 0, 0, .25);

    --tbz-danger-soft:    oklch(0.269 0.05 25);
    --tbz-danger-text:    oklch(0.704 0.191 22.216);

    --tbz-table-header-bg:  oklch(0.269 0 0);
    --tbz-table-row-hover:  oklch(0.24 0.02 155);
    --tbz-table-border:     oklch(1 0 0 / 10%);
    --tbz-input-bg:         oklch(0.269 0 0);
    --tbz-input-border-strong: oklch(1 0 0 / 15%);
    --tbz-focus-ring:       color-mix(in srgb, var(--tbz-primary) 28%, transparent);
    --tbz-kpi-accent-border: color-mix(in srgb, var(--tbz-primary) 35%, var(--tbz-border));
    --tbz-kpi-icon-bg:      oklch(0.269 0 0);
    --tbz-kpi-icon-border:  oklch(1 0 0 / 10%);
    --tbz-kpi-accent-icon-bg: color-mix(in srgb, var(--tbz-primary) 40%, oklch(0.269 0 0));
    --tbz-kpi-icon-fg:      oklch(0.708 0 0);
    --tbz-filter-pill-border: color-mix(in srgb, var(--tbz-primary) 35%, var(--tbz-border));
    --tbz-loader-overlay:   rgba(10, 10, 12, .78);
    --tbz-row-stripe:       oklch(0.22 0 0);
    --tbz-hover-accent:     color-mix(in srgb, var(--tbz-primary) 8%, transparent);
    --tbz-settings-icon-bg: oklch(0.269 0 0);
    --tbz-settings-icon-border: oklch(1 0 0 / 10%);
    --tbz-wizard-track:     oklch(0.32 0 0);
}

html.dark .tbz-auth-body {
    background: var(--tbz-body-bg);
}

html.dark .tbz-auth-main .tbz-auth-card {
    background: var(--tbz-inset-bg);
    box-shadow: var(--tbz-shadow-inset) !important;
    border: 1px solid var(--tbz-border);
}

html.dark .tbz-auth-mobile-logo-wrap {
    background: var(--tbz-surface-elevated);
    border: 1px solid var(--tbz-border);
}

html.dark .tbz-auth-mobile-brand h2 {
    color: var(--tbz-text-dark);
}

/* ── 2. Base / Reset ──────────────────────────────────────── */
*,
*::before,
*::after { box-sizing: border-box; }

body {
    background: var(--tbz-body-bg);
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    margin: 0;
    color: var(--tbz-text-dark);
}

/* ── 3. App shell (inset sidebar + content panel) ─────────── */

.tbz-shell {
    display: flex;
    min-height: 100vh;
    min-height: 100svh;
    width: 100%;
    background: var(--tbz-sidebar-bg);
    color: var(--tbz-text-dark);
}

/* Mobile-first: sidebar off-canvas */
.tbz-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1050;
    width: var(--tbz-sidebar-width);
    padding: 0;
    display: flex;
    flex-direction: column;
    color: var(--tbz-sidebar-fg);
    transform: translateX(-100%);
    transition: transform .2s ease, width .2s ease;
}

.tbz-sidebar-inner {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    width: 100%;
    background: var(--tbz-sidebar-bg);
    overflow: hidden;
}

.tbz-sidebar.tbz-sidebar--open {
    transform: translateX(0);
}

/* Desktop: inset floating rail */
@media (min-width: 768px) {
    .tbz-sidebar {
        transform: translateX(0);
        z-index: 30;
        width: var(--tbz-sidebar-width);
        padding: var(--tbz-sidebar-inset);
        pointer-events: none;
    }

    .tbz-sidebar-inner {
        pointer-events: auto;
        border-radius: var(--tbz-radius-xl);
        overflow: hidden;
    }

    body.tbz-sidebar-collapsed .tbz-sidebar {
        width: calc(var(--tbz-sidebar-width-icon) + (var(--tbz-sidebar-inset) * 2));
        transform: none;
    }
}

.tbz-sidebar-header {
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: var(--tbz-topbar-h);
    padding: .5rem;
    flex-shrink: 0;
}

.tbz-sidebar-nav {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: .25rem .5rem .75rem;
    scrollbar-width: thin;
}

.tbz-sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.tbz-sidebar-nav::-webkit-scrollbar-thumb {
    background: var(--tbz-sidebar-border);
    border-radius: 4px;
}

/* Logo block */
.tbz-sidebar-logo {
    display: flex;
    align-items: center;
    gap: .5rem;
    height: 2rem;
    padding: .25rem .5rem;
    margin: 0;
    border-radius: calc(var(--tbz-radius) * 0.8);
    text-decoration: none;
    color: var(--tbz-sidebar-fg);
    overflow: hidden;
    transition: background .15s;
}

.tbz-sidebar-logo:hover {
    background: var(--tbz-sidebar-accent);
    color: var(--tbz-sidebar-accent-fg);
}

.tbz-sidebar-logo .logo-icon {
    width: 2rem;
    height: 2rem;
    background: var(--tbz-primary);
    border-radius: calc(var(--tbz-radius) * 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--tbz-gold);
    font-size: 1rem;
    flex-shrink: 0;
    overflow: hidden;
}

.tbz-sidebar-logo .logo-icon .tbz-logo-img,
.tbz-sidebar-logo .tbz-logo-img {
    width: 2rem !important;
    height: 2rem !important;
    object-fit: contain;
}

.tbz-sidebar-logo .logo-text {
    font-weight: 600;
    font-size: .875rem;
    color: var(--tbz-sidebar-fg);
    line-height: 1.15;
    white-space: nowrap;
}

.tbz-sidebar-logo .logo-sub {
    font-size: .65rem;
    color: var(--tbz-text-muted);
    font-weight: 400;
    white-space: nowrap;
}

/* Section label */
.tbz-nav-section-label {
    display: flex;
    align-items: center;
    height: 2rem;
    padding: 0 .5rem;
    margin-top: .35rem;
    font-size: .75rem;
    font-weight: 500;
    letter-spacing: .02em;
    color: color-mix(in srgb, var(--tbz-sidebar-fg) 70%, transparent);
    text-transform: none;
    overflow: hidden;
    white-space: nowrap;
}

.tbz-nav-section-label.mt-2 {
    margin-top: .75rem;
}

/* Nav links — menu button style */
.tbz-nav-link {
    display: flex;
    align-items: center;
    gap: .5rem;
    height: 2rem;
    padding: .5rem;
    margin: .1rem 0;
    border-radius: calc(var(--tbz-radius) * 0.8);
    color: var(--tbz-sidebar-fg);
    text-decoration: none;
    font-size: .875rem;
    font-weight: 400;
    line-height: 1.25;
    overflow: hidden;
    white-space: nowrap;
    transition: background .15s, color .15s, box-shadow .15s;
}

.tbz-nav-link i {
    font-size: 1rem;
    width: 1rem;
    height: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    opacity: .9;
}

.tbz-nav-link:hover {
    background: var(--tbz-sidebar-accent);
    color: var(--tbz-sidebar-accent-fg);
}

.tbz-nav-link:focus-visible,
.tbz-nav-group-toggle:focus-visible,
.tbz-signout-btn:focus-visible,
.tbz-menu-toggle:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px var(--tbz-inset-bg), 0 0 0 4px color-mix(in srgb, var(--tbz-primary) 35%, transparent);
}

.tbz-nav-link.active {
    background: var(--tbz-primary-light);
    color: var(--tbz-primary) !important;
    font-weight: 500;
}

.tbz-nav-link.active:hover {
    background: var(--tbz-primary-light);
    color: var(--tbz-primary);
}

.tbz-nav-link .badge {
    margin-left: auto;
    font-size: .65rem;
    font-weight: 600;
}

/* ── Sidebar nav group / dropdown (collapsible section) ────── */
.tbz-nav-group-toggle {
    display: flex;
    align-items: center;
    gap: .5rem;
    height: 2rem;
    padding: .5rem;
    margin: .1rem 0;
    border-radius: calc(var(--tbz-radius) * 0.8);
    color: var(--tbz-sidebar-fg);
    font-size: .875rem;
    font-weight: 400;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    line-height: 1.25;
    overflow: hidden;
    white-space: nowrap;
    transition: background .15s, color .15s, box-shadow .15s;
}

.tbz-nav-group-toggle > span {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tbz-nav-group-toggle > i:first-child {
    font-size: 1rem;
    width: 1rem;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.tbz-nav-group-toggle:hover {
    background: var(--tbz-sidebar-accent);
    color: var(--tbz-sidebar-accent-fg);
}

.tbz-nav-group-toggle:not(.collapsed),
.tbz-nav-group-toggle--active {
    color: var(--tbz-sidebar-accent-fg);
    background: var(--tbz-sidebar-accent);
    font-weight: 500;
}

/* Chevron icon that rotates when group is expanded */
.tbz-nav-caret {
    margin-left: auto;
    font-size: .75rem;
    flex-shrink: 0;
    opacity: .7;
    transition: transform .2s ease;
}

.tbz-nav-group-toggle:not(.collapsed) .tbz-nav-caret {
    transform: rotate(90deg);
}

/* Indent child links inside a collapsed nav group */
.tbz-nav-group-body {
    margin: .15rem 0 .15rem .875rem;
    padding: .15rem 0 .15rem .625rem;
    border-left: 1px solid var(--tbz-sidebar-border);
    display: flex;
    flex-direction: column;
    gap: .1rem;
}

.tbz-nav-group-body .tbz-nav-link {
    margin: 0;
    height: 1.75rem;
    padding: .25rem .5rem;
    font-size: .875rem;
    border-radius: calc(var(--tbz-radius) * 0.8);
}

.tbz-nav-group-body .tbz-nav-link.active {
    background: var(--tbz-primary-light);
    color: var(--tbz-primary) !important;
    font-weight: 500;
}

/* Nested sub-groups inside a parent nav section (e.g. Finance → Stop Orders) */
.tbz-nav-subgroup-body {
    margin: .1rem 0 .1rem .35rem;
    padding: .1rem 0 .1rem .5rem;
    border-left: 1px solid var(--tbz-sidebar-border);
    display: flex;
    flex-direction: column;
    gap: .1rem;
}

.tbz-nav-group-toggle--nested {
    margin: 0;
    padding: .25rem .5rem;
    height: 1.75rem;
    width: 100%;
    font-family: inherit;
    font-size: .875rem;
    font-weight: 400;
    color: var(--tbz-sidebar-fg);
    border-radius: calc(var(--tbz-radius) * 0.8);
}

.tbz-nav-group-toggle--nested i:not(.tbz-nav-caret) {
    font-size: 1rem;
    width: 1rem;
    text-align: center;
    flex-shrink: 0;
}

.tbz-nav-group-toggle--nested:hover,
.tbz-nav-group-toggle--nested:not(.collapsed) {
    background: var(--tbz-sidebar-accent);
    color: var(--tbz-sidebar-accent-fg);
}

.tbz-nav-subgroup-body .tbz-nav-link {
    margin: 0;
    padding: .25rem .5rem;
    height: 1.75rem;
    font-size: .8125rem;
}

/* Sidebar footer & sign-out */
.tbz-sidebar-footer {
    margin-top: auto;
    padding: .5rem;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: .35rem;
}

.tbz-signout-btn {
    display: flex;
    align-items: center;
    gap: .5rem;
    width: 100%;
    height: 2rem;
    padding: .5rem;
    border-radius: calc(var(--tbz-radius) * 0.8);
    border: none;
    color: var(--tbz-text-muted);
    background: transparent;
    font-size: .8125rem;
    font-weight: 400;
    text-decoration: none;
    justify-content: flex-start;
    overflow: hidden;
    white-space: nowrap;
    transition: background .15s, color .15s;
}

.tbz-signout-btn i {
    width: 1rem;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.tbz-signout-btn:hover {
    background: var(--tbz-danger-soft);
    color: var(--tbz-danger-text);
}

/* Mobile overlay backdrop */
.tbz-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--tbz-overlay-scrim);
    z-index: 1040;
}

.tbz-sidebar-overlay.tbz-overlay--open {
    display: block;
}

/* Desktop icon-collapsed mode */
@media (min-width: 768px) {
    body.tbz-sidebar-collapsed .tbz-sidebar-logo {
        justify-content: center;
        padding: .25rem;
        width: 2rem;
        margin-inline: auto;
    }

    body.tbz-sidebar-collapsed .tbz-sidebar-logo .logo-text,
    body.tbz-sidebar-collapsed .tbz-sidebar-logo .logo-sub,
    body.tbz-sidebar-collapsed .tbz-sidebar-logo .logo-copy,
    body.tbz-sidebar-collapsed .tbz-nav-section-label,
    body.tbz-sidebar-collapsed .tbz-nav-caret,
    body.tbz-sidebar-collapsed .tbz-nav-link .badge,
    body.tbz-sidebar-collapsed .tbz-nav-link .tbz-nav-label,
    body.tbz-sidebar-collapsed .tbz-nav-group-toggle > span,
    body.tbz-sidebar-collapsed .tbz-nav-group-toggle .tbz-nav-label,
    body.tbz-sidebar-collapsed .tbz-sidebar .collapse,
    body.tbz-sidebar-collapsed .tbz-signout-btn .tbz-signout-label {
        display: none !important;
    }

    body.tbz-sidebar-collapsed .tbz-nav-link,
    body.tbz-sidebar-collapsed .tbz-nav-group-toggle,
    body.tbz-sidebar-collapsed .tbz-signout-btn {
        width: 2rem;
        height: 2rem;
        padding: .5rem;
        margin-inline: auto;
        justify-content: center;
        gap: 0;
    }

    body.tbz-sidebar-collapsed .tbz-nav-link i,
    body.tbz-sidebar-collapsed .tbz-nav-group-toggle > i:first-child,
    body.tbz-sidebar-collapsed .tbz-signout-btn i {
        font-size: 1rem;
        margin: 0;
    }

    body.tbz-sidebar-collapsed .tbz-sidebar-header {
        padding: .5rem .25rem;
    }

    body.tbz-sidebar-collapsed .tbz-sidebar-nav,
    body.tbz-sidebar-collapsed .tbz-sidebar-footer {
        padding-left: .25rem;
        padding-right: .25rem;
    }
}

/* ── 4. Top Bar (inside inset panel) ──────────────────────── */

.tbz-shell-inset {
    position: relative;
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
    min-height: 100vh;
    min-height: 100svh;
    background: var(--tbz-inset-bg);
}

@media (min-width: 768px) {
    .tbz-shell-inset {
        margin: var(--tbz-sidebar-inset) var(--tbz-sidebar-inset) var(--tbz-sidebar-inset) 0;
        margin-left: var(--tbz-sidebar-width);
        min-height: calc(100svh - (var(--tbz-sidebar-inset) * 2));
        border-radius: var(--tbz-radius-xl);
        box-shadow: var(--tbz-shadow-inset);
        overflow: hidden;
        transition: margin-left .2s ease;
    }

    body.tbz-sidebar-collapsed .tbz-shell-inset {
        margin-left: calc(var(--tbz-sidebar-width-icon) + (var(--tbz-sidebar-inset) * 2));
    }
}

.tbz-topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    height: var(--tbz-topbar-h);
    background: color-mix(in srgb, var(--tbz-topbar-bg) 92%, transparent);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--tbz-border);
    display: flex;
    align-items: center;
    padding: 0 1rem;
    gap: .75rem;
    flex-shrink: 0;
}

@media (min-width: 768px) {
    .tbz-topbar {
        left: auto;
        right: auto;
        padding: 0 1.5rem;
    }
}

/* Sidebar toggle button */
.tbz-menu-toggle {
    background: transparent;
    border: 1px solid var(--tbz-border);
    padding: 0;
    width: 2rem;
    height: 2rem;
    color: var(--tbz-text-dark);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    border-radius: calc(var(--tbz-radius) * 0.8);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background .15s, border-color .15s, color .15s;
}

.tbz-menu-toggle:hover {
    background: var(--tbz-primary-light);
    border-color: color-mix(in srgb, var(--tbz-primary) 30%, var(--tbz-border));
    color: var(--tbz-primary);
}

/* Theme toggle (ui-reference: press D) */
.tbz-theme-toggle {
    background: transparent;
    border: 1px solid var(--tbz-border);
    padding: 0;
    width: 2rem;
    height: 2rem;
    color: var(--tbz-text-dark);
    font-size: .95rem;
    line-height: 1;
    cursor: pointer;
    border-radius: calc(var(--tbz-radius) * 0.8);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background .15s, border-color .15s, color .15s;
}

.tbz-theme-toggle:hover {
    background: var(--tbz-sidebar-accent);
    border-color: color-mix(in srgb, var(--tbz-primary) 30%, var(--tbz-border));
    color: var(--tbz-primary);
}

.tbz-theme-toggle .tbz-theme-icon-light {
    display: none;
}

html.dark .tbz-theme-toggle .tbz-theme-icon-dark {
    display: none;
}

html.dark .tbz-theme-toggle .tbz-theme-icon-light {
    display: inline-flex;
}

.tbz-theme-toggle--floating {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1100;
    background: var(--tbz-surface-elevated);
    box-shadow: var(--tbz-shadow-inset);
}

.tbz-topbar-search {
    flex: 1;
    max-width: 520px;
    display: flex;
    align-items: center;
    gap: .5rem;
    background: var(--tbz-surface-muted);
    border: 1px solid var(--tbz-input-border);
    border-radius: calc(var(--tbz-radius) * 0.8);
    padding: .35rem .75rem;
    height: 2rem;
    box-shadow: none;
}

.tbz-topbar-search i {
    color: var(--tbz-placeholder);
    font-size: 1rem;
}

.tbz-topbar-search-btn {
    -webkit-appearance: none;
    appearance: none;
    border: 0;
    border-radius: 0;
    background: transparent;
    padding: 0;
    margin: 0;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
    cursor: pointer;
    color: inherit;
}

.tbz-topbar-search-btn:hover i,
.tbz-topbar-search-btn:focus-visible i {
    color: var(--tbz-primary);
}

.tbz-topbar-search-btn:focus-visible {
    outline: none;
}

.tbz-topbar-search-input {
    width: 100%;
    border: 0;
    outline: none;
    background: transparent;
    font-size: .9rem;
    color: var(--tbz-text-dark);
}

.tbz-topbar-search-input::placeholder {
    color: var(--tbz-placeholder);
}

.tbz-topbar-search:focus-within {
    border-color: color-mix(in srgb, var(--tbz-primary) 35%, var(--tbz-border));
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--tbz-primary) 12%, transparent);
    background: var(--tbz-surface-elevated);
}

.tbz-topbar-actions {
    display: flex;
    align-items: center;
    gap: .6rem;
}

@media (min-width: 576px) {
    .tbz-topbar-actions {
        gap: 1rem;
    }
}

.tbz-datetime {
    display: none; /* hidden on very small screens */
    align-items: center;
    gap: .4rem;
    font-size: .82rem;
    color: var(--tbz-text-muted);
    white-space: nowrap;
}

@media (min-width: 640px) {
    .tbz-datetime {
        display: flex;
    }
}

.tbz-user-chip {
    display: flex;
    align-items: center;
    gap: .4rem;
    padding: .2rem .45rem .2rem .2rem;
    border-radius: calc(var(--tbz-radius) * 0.8);
    border: 1px solid var(--tbz-border);
    background: var(--tbz-surface-elevated);
    cursor: pointer;
    text-decoration: none;
    color: var(--tbz-text-dark);
    font-size: .8125rem;
    height: 2rem;
}

.tbz-user-chip:hover {
    border-color: color-mix(in srgb, var(--tbz-primary) 30%, var(--tbz-border));
    color: var(--tbz-text-dark);
    background: var(--tbz-sidebar-accent);
}

.tbz-user-chip .avatar {
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    background: var(--tbz-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .65rem;
    font-weight: 700;
    flex-shrink: 0;
    overflow: hidden;
    border: 1.5px solid color-mix(in srgb, var(--tbz-primary) 35%, #fff);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--tbz-border) 80%, transparent);
}

.tbz-user-chip .avatar.has-photo {
    background: var(--tbz-surface-muted, #f4f7fb);
    border-color: var(--tbz-border);
}

.tbz-user-chip .avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.tbz-user-chip .avatar span {
    line-height: 1;
}

/* Account settings — profile photo editor */
.tbz-avatar-editor {
    display: flex;
    align-items: center;
    gap: 1.15rem;
    padding: 1rem 1.1rem;
    border: 1px solid var(--tbz-border);
    border-radius: calc(var(--tbz-radius) + .15rem);
    background:
      linear-gradient(
        135deg,
        color-mix(in srgb, var(--tbz-primary) 6%, transparent),
        transparent 42%
      ),
      var(--tbz-settings-icon-bg);
}

.tbz-avatar-editor.is-invalid {
    border-color: color-mix(in srgb, #dc3545 45%, var(--tbz-border));
    background:
      linear-gradient(
        135deg,
        color-mix(in srgb, #dc3545 7%, transparent),
        transparent 42%
      ),
      var(--tbz-settings-icon-bg);
}

.tbz-avatar-editor__media {
    flex-shrink: 0;
}

.tbz-avatar-editor__frame {
    position: relative;
    width: 5.5rem;
    height: 5.5rem;
    flex-shrink: 0;
}

.tbz-avatar-editor__ring {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    overflow: hidden;
    background: var(--tbz-primary);
    color: #fff;
    border: 3px solid color-mix(in srgb, #fff 75%, var(--tbz-border));
    box-shadow:
      0 0 0 1px var(--tbz-border),
      0 8px 20px color-mix(in srgb, var(--tbz-text-dark) 8%, transparent);
}

.tbz-avatar-editor.has-photo .tbz-avatar-editor__ring {
    background: var(--tbz-surface-muted, #eef2f6);
}

.tbz-avatar-editor__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.tbz-avatar-editor__placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(160deg, var(--tbz-primary), color-mix(in srgb, var(--tbz-primary) 70%, #0b3d2e));
}

.tbz-avatar-editor__initials {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: .04em;
    line-height: 1;
}

.tbz-avatar-editor__camera {
    position: absolute;
    right: -.1rem;
    bottom: -.05rem;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--tbz-text-dark);
    color: #fff;
    border: 2px solid #fff;
    cursor: pointer;
    font-size: .78rem;
    box-shadow: 0 2px 8px color-mix(in srgb, #000 25%, transparent);
    transition: transform .15s ease, background-color .15s ease;
    z-index: 2;
}

.tbz-avatar-editor__camera:hover,
.tbz-avatar-editor__camera:focus-visible {
    background: var(--tbz-primary);
    transform: scale(1.06);
    outline: none;
}

.tbz-avatar-editor__body {
    flex: 1 1 auto;
    min-width: 0;
    display: grid;
    gap: .7rem;
}

.tbz-avatar-editor__title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .75rem;
}

.tbz-avatar-editor__title {
    color: var(--tbz-text-dark);
    font-size: .95rem;
    font-weight: 700;
    line-height: 1.2;
}

.tbz-avatar-editor__badge {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    padding: .2rem .55rem;
    border-radius: 999px;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .02em;
    text-transform: uppercase;
    color: var(--tbz-text-muted);
    background: color-mix(in srgb, var(--tbz-border) 55%, transparent);
    border: 1px solid var(--tbz-border);
    white-space: nowrap;
}

.tbz-avatar-editor__badge.is-set,
.tbz-avatar-editor.has-photo:not(.is-clearing) .tbz-avatar-editor__badge:not(.is-pending):not(.is-clear) {
    color: #0f8a5f;
    background: color-mix(in srgb, #0f8a5f 12%, transparent);
    border-color: color-mix(in srgb, #0f8a5f 28%, transparent);
}

.tbz-avatar-editor__badge.is-pending {
    color: #9a6700;
    background: color-mix(in srgb, #e8a000 16%, transparent);
    border-color: color-mix(in srgb, #e8a000 30%, transparent);
}

.tbz-avatar-editor__badge.is-clear {
    color: #b42318;
    background: color-mix(in srgb, #dc3545 12%, transparent);
    border-color: color-mix(in srgb, #dc3545 28%, transparent);
}

.tbz-avatar-editor__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
}

.tbz-avatar-editor__actions .btn {
    cursor: pointer;
}

.tbz-avatar-editor__file {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    font-size: .78rem;
    color: var(--tbz-text-muted);
    background: color-mix(in srgb, #fff 70%, var(--tbz-settings-icon-bg));
    border: 1px dashed var(--tbz-border);
    border-radius: .45rem;
    padding: .35rem .6rem;
}

.tbz-avatar-editor__file span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tbz-avatar-editor__error {
    font-size: .8rem;
    color: #b42318;
    background: color-mix(in srgb, #dc3545 8%, transparent);
    border: 1px solid color-mix(in srgb, #dc3545 25%, transparent);
    border-radius: .45rem;
    padding: .45rem .65rem;
}

.tbz-avatar-editor__divider {
    height: 1px;
    margin: 1.15rem 0 1.05rem;
    background: linear-gradient(
      90deg,
      transparent,
      var(--tbz-border) 12%,
      var(--tbz-border) 88%,
      transparent
    );
}

@media (max-width: 575.98px) {
    .tbz-avatar-editor {
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
    }

    .tbz-avatar-editor__title-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .tbz-avatar-editor__frame {
        width: 5rem;
        height: 5rem;
    }
}

html.dark .tbz-avatar-editor__ring {
    border-color: color-mix(in srgb, var(--tbz-border) 80%, #fff);
}

html.dark .tbz-avatar-editor__camera {
    border-color: var(--tbz-surface, #1b1b1b);
}

html.dark .tbz-user-chip .avatar {
    border-color: color-mix(in srgb, var(--tbz-primary) 40%, var(--tbz-border));
}

.tbz-user-chip .uname {
    font-weight: 500;
    display: none;
    line-height: 1.1;
}

.tbz-user-chip .urole {
    font-size: .65rem;
    color: var(--tbz-text-muted);
    display: none;
    line-height: 1.1;
}

@media (min-width: 480px) {
    .tbz-user-chip { gap: .5rem; padding: .2rem .55rem .2rem .2rem; }
    .tbz-user-chip .uname { display: block; }
    .tbz-user-chip .urole { display: block; }
}

.tbz-notif-btn {
    position: relative;
    width: 2rem;
    height: 2rem;
    border-radius: calc(var(--tbz-radius) * 0.8);
    border: 1px solid var(--tbz-border);
    background: var(--tbz-surface-elevated);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--tbz-text-muted);
    text-decoration: none;
    font-size: .95rem;
    flex-shrink: 0;
    transition: background .15s, border-color .15s, color .15s;
}

.tbz-notif-btn:hover {
    border-color: color-mix(in srgb, var(--tbz-primary) 30%, var(--tbz-border));
    color: var(--tbz-primary);
    background: var(--tbz-primary-light);
}

.tbz-notif-btn .badge {
    position: absolute;
    top: -2px;
    right: -2px;
    font-size: .6rem;
    background: var(--tbz-gold) !important;
    color: #fff;
}

/* User dropdown menu */
.tbz-user-dropdown {
    min-width: 180px;
    border-radius: 12px !important;
    border: 0 !important;
}

/* ── 5. Main Content Area — inside inset panel ────────────── */

.tbz-main {
    margin-left: 0;
    padding-top: 0;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    background: var(--tbz-inset-bg);
}

@media (min-width: 768px) {
    .tbz-main {
        margin-left: 0;
    }
}

/* Content padding — grows with viewport */
.tbz-content {
    padding: 1rem;
}

@media (min-width: 576px) {
    .tbz-content {
        padding: 1.25rem;
    }
}

@media (min-width: 992px) {
    .tbz-content {
        padding: 1.5rem;
    }
}

/* Anonymous layout container */
.tbz-anon-container {
    max-width: 960px;
}

/* ── 6. Breadcrumb Bar ────────────────────────────────────── */
.tbz-breadcrumb-bar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .5rem;
    margin-bottom: 1rem;
}

.tbz-breadcrumb {
    font-size: .875rem;
    display: flex;
    align-items: center;
    gap: .35rem;
    color: var(--tbz-text-muted);
}

.tbz-breadcrumb a {
    color: var(--tbz-text-muted);
    text-decoration: none;
}

.tbz-breadcrumb a:hover {
    color: var(--tbz-primary);
}

.tbz-breadcrumb .sep {
    margin: 0 .35rem;
}

.tbz-breadcrumb .current {
    color: var(--tbz-primary);
    font-weight: 600;
}

/* ── 7. Module Cards ──────────────────────────────────────── */
.module-card {
    --mc-accent: var(--tbz-primary);
    --mc-bg1: #f3fbf3;
    --mc-bg2: #e6f6e6;
    border-radius: 14px;
    padding: 1rem 1rem;
    display: flex;
    align-items: center;
    gap: .85rem;
    background: var(--tbz-inset-bg);
    border: 1px solid var(--tbz-border);
    box-shadow: var(--tbz-shadow-card);
    transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease, background-color .16s ease;
    text-decoration: none;
    color: var(--tbz-text-dark);
    position: relative;
    overflow: hidden;
}

.module-card::before,
.module-card::after {
    content: none;
}

.module-card > * {
    position: relative;
    z-index: 1;
}

@media (min-width: 576px) {
    .module-card {
        padding: 1.25rem 1.1rem;
        gap: 1rem;
    }
}

.module-card:hover {
    transform: translateY(-1px);
    border-color: color-mix(in srgb, var(--tbz-text-dark) 10%, var(--tbz-border));
    box-shadow: var(--tbz-shadow-float);
    color: var(--tbz-text-dark);
}

.module-card .mc-icon {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    background: var(--mc-bg1);
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
    box-shadow: none;
    transition: background-color .16s ease;
}

.module-card .mc-body { flex: 1 1 auto; min-width: 0; }

.module-card .mc-desc {
    font-size: .78rem;
    color: var(--tbz-text-muted);
    margin-top: .1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.module-card .mc-arrow {
    color: var(--mc-accent);
    font-size: 1rem;
    flex-shrink: 0;
    opacity: 0;
    transform: translateX(-4px);
    transition: opacity .16s ease, transform .16s ease;
}

.module-card:hover {
    border-color: var(--mc-accent);
}

.module-card:hover .mc-icon { background: var(--mc-bg2); }

.module-card:hover .mc-arrow {
    opacity: 1;
    transform: translateX(0);
}

/* Quick access section header */
.tbz-quick-head {
    display: flex;
    align-items: baseline;
    gap: .6rem;
    margin: 1.5rem 0 .3rem;
}
.tbz-quick-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--tbz-text-dark);
    margin: 0;
}
.tbz-quick-sub {
    font-size: .82rem;
    color: var(--tbz-text-muted);
}

@media (min-width: 576px) {
    .module-card .mc-icon {
        width: 52px;
        height: 52px;
        font-size: 1.4rem;
    }
}

.module-card .mc-label {
    font-size: .7rem;
    color: #5a6272;
    margin-bottom: .1rem;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.module-card .mc-name {
    font-weight: 700;
    font-size: .95rem;
}

@media (min-width: 576px) {
    .module-card .mc-name { font-size: 1rem; }
}

/* Card background variants */
.mc-green  { --mc-accent: var(--tbz-primary); --mc-bg1: #e7f7ea; --mc-bg2: #c9efcf; }
.mc-gold   { --mc-accent: var(--tbz-gold); --mc-bg1: #fff1cc; --mc-bg2: #ffe0a6; }
.mc-teal   { --mc-accent: var(--tbz-mc-teal-icon); --mc-bg1: #dafaf4; --mc-bg2: #baf1e7; }
.mc-blue   { --mc-accent: var(--tbz-mc-blue-icon); --mc-bg1: #deefff; --mc-bg2: #c6e0ff; }
.mc-orange { --mc-accent: var(--tbz-mc-orange-icon); --mc-bg1: #ffe2d7; --mc-bg2: #ffd0c0; }
.mc-amber  { --mc-accent: var(--tbz-mc-amber-icon); --mc-bg1: #fff1d7; --mc-bg2: #ffe0b3; }
/* legacy */
.mc-purple { --mc-accent: var(--tbz-mc-purple-icon); --mc-bg1: #f0ebff; --mc-bg2: #dbd2ff; }

/* Icon colour helpers */
.mc-icon-green  { color: var(--tbz-mc-green-icon); }
.mc-icon-gold   { color: var(--tbz-mc-gold-icon); }
.mc-icon-teal   { color: var(--tbz-mc-teal-icon); }
.mc-icon-blue   { color: var(--tbz-mc-blue-icon); }
.mc-icon-orange { color: var(--tbz-mc-orange-icon); }
.mc-icon-amber  { color: var(--tbz-mc-amber-icon); }
.mc-icon-purple { color: var(--tbz-mc-purple-icon); }

/* ── 9. Content Cards ─────────────────────────────────────── */
.content-card,
.tbz-main .card {
    background: var(--tbz-inset-bg);
    border-radius: 14px;
    border: 1px solid var(--tbz-border);
    overflow: hidden;
    box-shadow: var(--tbz-shadow-card);
    position: relative;
    transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

.content-card:hover,
.tbz-main .card:hover {
    transform: translateY(-1px);
    box-shadow: var(--tbz-shadow-card-hover);
    border-color: color-mix(in srgb, var(--tbz-text-dark) 10%, var(--tbz-border));
}

.content-card.text-center {
    background: radial-gradient(120% 140% at 0% 0%, rgba(45, 106, 45, .08) 0%, rgba(255, 255, 255, 0) 55%),
                radial-gradient(120% 140% at 100% 0%, rgba(200, 164, 21, .10) 0%, rgba(255, 255, 255, 0) 55%),
                linear-gradient(180deg, #ffffff 0%, #fbfcff 100%);
}

.content-card .card-header,
.tbz-main .card > .card-header {
    background: linear-gradient(180deg, var(--tbz-inset-bg) 0%, var(--tbz-surface-muted) 100%);
    border-bottom: 1px solid var(--tbz-border);
    padding: .85rem 1.1rem;
    font-weight: 600;
    font-size: .88rem;
    color: var(--tbz-text-dark);
}

.content-card .card-body,
.tbz-main .card > .card-body {
    padding: 1.1rem;
}

.tbz-main .card > .card-footer {
    background: var(--tbz-surface-muted);
    border-top: 1px solid var(--tbz-border);
    padding: .75rem 1rem;
}

/* App-wide form refinement for authenticated templates */
.tbz-main form label:not(.form-check-label),
.tbz-main form .form-label {
    color: var(--tbz-text-muted);
    font-size: .74rem;
    font-weight: 600;
    letter-spacing: .04em;
    margin-bottom: .35rem;
    text-transform: uppercase;
}

.tbz-main .form-control,
.tbz-main .form-select,
.tbz-main form input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="hidden"]):not([type="file"]),
.tbz-main form select,
.tbz-main form textarea {
    background: var(--tbz-input-bg);
    border: 1px solid var(--tbz-input-border-strong);
    border-radius: .75rem;
    color: var(--tbz-text-dark);
    font-size: .88rem;
    min-height: 42px;
}

.tbz-main form textarea {
    min-height: 100px;
}

.tbz-main .form-control:focus,
.tbz-main .form-select:focus,
.tbz-main form input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="hidden"]):not([type="file"]):focus,
.tbz-main form select:focus,
.tbz-main form textarea:focus {
    background: var(--tbz-surface-elevated);
    border-color: var(--tbz-primary);
    box-shadow: 0 0 0 3px var(--tbz-focus-ring);
}

.tbz-main .form-control::placeholder,
.tbz-main form input::placeholder,
.tbz-main form textarea::placeholder {
    color: var(--tbz-placeholder);
}

/* Reusable async search-select */
.tbz-search-select {
    position: relative;
}

.tbz-search-select-control {
    position: relative;
}

.tbz-search-select-input {
    padding-right: 2rem;
}

.tbz-search-select-clear {
    align-items: center;
    background: transparent;
    border: 0;
    color: var(--tbz-placeholder);
    cursor: pointer;
    display: inline-flex;
    height: 100%;
    justify-content: center;
    position: absolute;
    right: .45rem;
    top: 0;
    width: 1.25rem;
}

.tbz-search-select-clear:hover {
    color: var(--tbz-text-muted);
}

.tbz-search-select-dropdown {
    background: var(--tbz-surface-elevated);
    border: 1px solid var(--tbz-border);
    border-radius: .75rem;
    box-shadow: 0 8px 20px rgba(15, 23, 42, .10);
    left: 0;
    margin-top: .35rem;
    max-height: 260px;
    overflow-y: auto;
    position: absolute;
    right: 0;
    top: 100%;
    z-index: 1060;
}

.tbz-search-select-option {
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--tbz-table-border);
    color: var(--tbz-text-dark);
    cursor: pointer;
    display: block;
    font-size: .86rem;
    padding: .58rem .7rem;
    text-align: left;
    width: 100%;
}

.tbz-search-select-option:last-child {
    border-bottom: 0;
}

.tbz-search-select-option:hover,
.tbz-search-select-option:focus {
    background: var(--tbz-table-header-bg);
}

.tbz-search-select-empty {
    color: var(--tbz-text-muted);
    font-size: .82rem;
    padding: .6rem .7rem;
}

/* App-wide table refinement for authenticated templates */
.table-responsive,
.tbz-table-scroll {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}

.table-responsive > table,
.tbz-table-scroll > table,
.table-responsive > .table,
.tbz-table-scroll > .table {
    margin-bottom: 0;
}

.tbz-main .table-responsive,
.tbz-main .tbz-table-scroll {
    background: var(--tbz-inset-bg);
    border: 1px solid var(--tbz-border);
    border-radius: 12px;
}

.tbz-main .table {
    margin-bottom: 0;
}

.tbz-main .table > :not(caption) > * > * {
    border-bottom: 1px solid var(--tbz-table-border);
    padding: .72rem .85rem;
    vertical-align: middle;
}

.tbz-main .table thead th {
    background: var(--tbz-table-header-bg);
    color: var(--tbz-text-muted);
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.tbz-main .table-hover > tbody > tr:hover > * {
    background: var(--tbz-table-row-hover);
}

.tbz-work-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
}

.tbz-chip {
    display: inline-flex;
    align-items: center;
    padding: .2rem .55rem;
    border-radius: 999px;
    background: var(--tbz-primary-light);
    color: var(--tbz-primary-hover);
    font-size: .72rem;
    font-weight: 600;
}

.tbz-field-label {
    display: block;
    margin-bottom: .35rem;
    font-size: .74rem;
    font-weight: 600;
    color: var(--tbz-text-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
}

.tbz-soft-input {
    background: var(--tbz-input-bg) !important;
    border: 1px solid var(--tbz-input-border-strong) !important;
    border-radius: .75rem !important;
    min-height: 42px;
    font-size: .88rem !important;
}

.tbz-soft-input:focus {
    background: var(--tbz-surface-elevated) !important;
    border-color: var(--tbz-primary) !important;
    box-shadow: 0 0 0 3px var(--tbz-focus-ring) !important;
}

.tbz-data-table {
    margin-bottom: 0;
}

/* ── PWA: Offline / sync status banner ───────────────────── */
#tbz-offline-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10000;
    padding: .55rem 1.25rem;
    text-align: center;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: .78rem;
    font-weight: 500;
    line-height: 1.4;
    border-bottom-width: 1px;
    border-bottom-style: solid;
}

.tbz-offline-banner--offline {
    background: #fff4f4;
    color: #b91c1c;
    border-bottom-color: #fecaca;
}

.tbz-offline-banner--online {
    background: #f0fdf4;
    color: #166534;
    border-bottom-color: #bbf7d0;
}

.tbz-offline-banner--warning {
    background: #fffbeb;
    color: #92400e;
    border-bottom-color: #fde68a;
}

.tbz-offline-banner--success {
    background: var(--tbz-primary-light);
    color: var(--tbz-primary-hover);
    border-bottom-color: #6ee7b7;
}

.tbz-offline-banner--danger {
    background: #fff4f4;
    color: #b91c1c;
    border-bottom-color: #fecaca;
}

/* ── PWA: Update-available banner variant ────────────────── */
.tbz-offline-banner--update {
    background: #eff6ff;
    color: #1e40af;
    border-bottom-color: #bfdbfe;
}

/* Inline action button used inside banners (e.g. "Refresh now") */
.tbz-banner-action-btn {
    display: inline-flex;
    align-items: center;
    padding: .15rem .65rem;
    border: 1.5px solid currentColor;
    border-radius: .4rem;
    background: transparent;
    color: inherit;
    font-size: .75rem;
    font-weight: 700;
    cursor: pointer;
    vertical-align: middle;
    white-space: nowrap;
    transition: background .15s, color .15s;
}

.tbz-banner-action-btn:hover {
    background: rgba(0,0,0,.08);
}

/* Inline link inside banners (e.g. "Sign in again") */
.tbz-banner-link {
    color: inherit;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.tbz-banner-link:hover {
    opacity: .8;
}

/* ── PWA: Install button (Downloads page) ─────────────────── */
#tbz-pwa-install-btn[hidden],
#tbz-pwa-install-done[hidden] {
    display: none !important;
}

.tbz-data-table thead th {
    background: var(--tbz-table-header-bg);
    border-bottom: 1px solid var(--tbz-border);
    color: var(--tbz-text-muted);
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .05em;
    padding: .75rem .85rem;
    text-transform: uppercase;
}

.tbz-data-table tbody td {
    border-bottom: 1px solid #edf1f5;
    font-size: .86rem;
    padding: .7rem .85rem;
    vertical-align: middle;
}

.tbz-data-table tbody tr:last-child td {
    border-bottom: none;
}

.tbz-data-table tbody tr:hover {
    background: var(--tbz-table-row-hover);
}

.tbz-metric-list {
    display: grid;
    gap: .55rem;
}

.tbz-metric-row {
    align-items: center;
    background: var(--tbz-surface-muted);
    border: 1px solid var(--tbz-border);
    border-radius: 10px;
    display: flex;
    font-size: .84rem;
    justify-content: space-between;
    padding: .55rem .7rem;
}

.tbz-metric-row .value {
    color: var(--tbz-text-dark);
    font-weight: 700;
}

/* Stacked variant — label on its own line above the value. Use for rows
   whose value can be long (e.g. destination/origin names) so wrapped text
   never collides with the label. */
.tbz-metric-row--stack {
    flex-direction: column;
    align-items: flex-start;
    gap: .2rem;
}

.tbz-metric-row--stack .value {
    text-align: left;
}

/* ── 10. Progress Bar ─────────────────────────────────────── */
.tbz-quota-progress {
    height: 5px;
    border-radius: 4px;
}

.tbz-quota-bar {
    background: var(--tbz-primary);
}

/* ── 11. Badge helpers ────────────────────────────────────── */
.badge-status-pending {
    background: #fff3cd;
    color: #856404;
}

.badge-status-active,
.badge-status-verified,
.badge-status-approved {
    background: #d1e7dd;
    color: #0a3622;
}

.badge-status-suspended,
.badge-status-rejected,
.badge-status-cancelled,
.badge-status-expired {
    background: #f8d7da;
    color: #58151c;
}

.badge-status-issued,
.badge-status-arrived {
    background: #d1e7dd;
    color: #0a3622;
}

.badge-status-in_transit {
    background: #cfe2ff;
    color: #084298;
}

.tbz-badge-primary {
    background: var(--tbz-primary) !important;
    color: #fff;
}

/* ── 12. Alert helpers ────────────────────────────────────── */
.tbz-alert-warning {
    background: var(--tbz-gold-light);
    color: #856404;
    border: 0;
}

/* Inline link inside a warning alert container */
.tbz-alert-warning a {
    color: #856404;
    font-weight: 600;
    text-decoration: none;
}

.tbz-alert-info {
    background: var(--tbz-primary-light);
    color: var(--tbz-primary-hover);
    border: 0;
}

.tbz-alert-error {
    background: #fce8e1;
    color: #c0392b;
    border: 0;
}

/* ── 13. Buttons — green + gold palette ───────────────────── */
.btn-primary {
    background: var(--tbz-primary);
    border-color: var(--tbz-primary);
    color: #fff;
}

.btn-primary:hover,
.btn-primary:focus {
    background: var(--tbz-primary-hover);
    border-color: var(--tbz-primary-hover);
    color: #fff;
}

.btn-outline-primary {
    color: var(--tbz-primary);
    border-color: var(--tbz-primary);
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
    background: var(--tbz-primary);
    border-color: var(--tbz-primary);
    color: #fff;
}

.btn {
    border-radius: 12px;
    font-weight: 600;
}

.btn-sm {
    border-radius: 10px;
}

/* Link helper */
.tbz-link-primary {
    color: var(--tbz-primary);
    text-decoration: none;
}

.tbz-link-primary:hover {
    color: var(--tbz-primary-hover);
}

/* ── 14. Tables ───────────────────────────────────────────── */
.table {
    font-size: .875rem;
}

.table thead th {
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--tbz-text-muted);
    border-bottom-width: 1px;
}

@media (max-width: 767.98px) {
    .table-responsive,
    .tbz-table-scroll {
        scrollbar-width: thin;
    }
}

/* ── 15. Anonymous Navbar ─────────────────────────────────── */
.tbz-anon-nav {
    background: var(--tbz-inset-bg);
    border-bottom: 1px solid var(--tbz-border);
    padding: .75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

@media (min-width: 576px) {
    .tbz-anon-nav { padding: .75rem 1.5rem; }
}

.tbz-anon-brand {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--tbz-text-dark);
    text-decoration: none;
}

.tbz-anon-brand .logo-icon {
    width: 36px;
    height: 36px;
    background: var(--tbz-primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--tbz-gold);
    font-size: 1rem;
}

/* ── 16. Auth Pages (Login / Register) ───────────────────── */
.tbz-auth-card {
    width: 100%;
    max-width: 420px;
    border-radius: 20px;
    overflow: hidden;
    border: 0;
}

.tbz-auth-card--wide {
    max-width: 480px;
}

.tbz-auth-logo-icon {
    width: 60px;
    height: 60px;
    background: var(--tbz-primary);
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: .75rem;
}

.tbz-auth-logo-icon i {
    color: var(--tbz-gold);
    font-size: 1.8rem;
}

.tbz-form-control {
    background: var(--tbz-body-bg) !important;
    border: 1px solid var(--tbz-border) !important;
    border-radius: .5rem !important;
    padding: .7rem 1rem !important;
    font-size: .9rem;
}

.tbz-form-control:focus {
    background: var(--tbz-primary-light) !important;
    border-color: var(--tbz-primary) !important;
    box-shadow: 0 0 0 3px rgba(45, 106, 45, .15) !important;
    outline: none;
}

/* Django-rendered form fields inside auth card */
.tbz-auth-card input[type=text],
.tbz-auth-card input[type=email],
.tbz-auth-card input[type=password],
.tbz-auth-card select {
    display: block;
    width: 100%;
    padding: .7rem 1rem;
    background: var(--tbz-body-bg);
    border: 1px solid var(--tbz-border);
    border-radius: .5rem;
    font-size: .9rem;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}

.tbz-auth-card input[type=text]:focus,
.tbz-auth-card input[type=email]:focus,
.tbz-auth-card input[type=password]:focus,
.tbz-auth-card select:focus {
    background: var(--tbz-primary-light);
    border-color: var(--tbz-primary);
    box-shadow: 0 0 0 3px rgba(45, 106, 45, .15);
}

.tbz-auth-link {
    color: var(--tbz-primary);
    font-weight: 600;
    text-decoration: none;
}

.tbz-auth-link:hover {
    color: var(--tbz-primary-hover);
}

.tbz-label {
    font-size: .875rem;
    font-weight: 600;
    color: var(--tbz-text-muted);
}

/* Split auth layout */
.tbz-auth-body {
    background: #e9e9ea;
    min-height: 100vh;
}

.tbz-auth-layout {
    min-height: 100vh;
    display: flex;
}

.tbz-auth-branding {
    display: none;
    width: 50%;
    background:
        linear-gradient(rgba(17, 64, 38, .58), rgba(17, 64, 38, .58)),
        url('../images/tobacco_background.jpg') center/cover no-repeat;
    color: #ffffff;
    padding: 3rem 2.5rem;
    flex-direction: column;
    justify-content: space-between;
}

.tbz-auth-brand-top {
    display: flex;
    align-items: center;
    gap: .9rem;
}

.tbz-auth-brand-logo {
    width: 56px;
    height: 56px;
    object-fit: contain;
}

.tbz-auth-brand-name {
    font-size: 1.05rem;
    font-weight: 700;
}

.tbz-auth-brand-copy h1 {
    font-size: clamp(2rem, 2.6vw, 3rem);
    line-height: 1.2;
    margin-bottom: 1rem;
    max-width: 640px;
}

.tbz-auth-brand-copy p {
    font-size: 1.05rem;
    color: rgba(255, 255, 255, .82);
    max-width: 500px;
}

.tbz-auth-brand-foot {
    font-size: .92rem;
    color: rgba(255, 255, 255, .6);
    margin: 0;
}

.tbz-auth-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.25rem;
}

.tbz-auth-form-slot {
    width: 100%;
    max-width: 500px;
}

.tbz-auth-main .tbz-auth-card {
    max-width: 100%;
    border-radius: 14px;
    background: #f4f4f4;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .08) !important;
}

.tbz-auth-main .tbz-auth-card.tbz-auth-card--wide {
    max-width: 100%;
}

.tbz-auth-mobile-brand {
    display: block;
    text-align: center;
    margin-bottom: 1.75rem;
}

.tbz-auth-mobile-logo-wrap {
    width: 54px;
    height: 54px;
    border-radius: 12px;
    background: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
    margin-bottom: .7rem;
}

.tbz-auth-mobile-logo {
    width: 34px;
    height: 34px;
    object-fit: contain;
}

.tbz-auth-mobile-brand h2 {
    font-size: 2rem;
    font-weight: 700;
    margin: 0;
}

.tbz-auth-mobile-foot {
    margin-top: 1rem;
    color: #606773;
    font-size: .95rem;
}

.tbz-auth-input-wrap {
    position: relative;
}

.tbz-auth-input-wrap > i {
    position: absolute;
    left: .75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #2b2b2b;
    font-size: 1rem;
    z-index: 2;
}

.tbz-auth-input-wrap input,
.tbz-auth-input-wrap select,
.tbz-auth-input-wrap textarea,
.tbz-auth-input-wrap .form-control,
.tbz-auth-input-wrap .form-select {
    padding-left: 2.3rem !important;
}

.tbz-auth-eye {
    position: absolute;
    right: .55rem;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    color: #2b2b2b;
    padding: .2rem .35rem;
    border-radius: .35rem;
    line-height: 1;
}

.tbz-auth-eye:hover {
    background: rgba(15, 157, 107, .12);
}

.tbz-auth-main .btn-primary {
    background: var(--tbz-primary);
    border-color: var(--tbz-primary);
}

.tbz-auth-main .btn-primary:hover,
.tbz-auth-main .btn-primary:focus {
    background: var(--tbz-primary-hover);
    border-color: var(--tbz-primary-hover);
}

.tbz-auth-main .tbz-auth-link {
    color: var(--tbz-primary);
}

.tbz-auth-main .tbz-auth-link:hover {
    color: var(--tbz-primary-hover);
}

.tbz-auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.tbz-auth-card .tbz-auth-btn {
    width: 100%;
    min-height: 46px;
    border-radius: .65rem;
    font-weight: 600;
    padding: .62rem 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .35rem;
}

.tbz-auth-card .tbz-auth-btn.is-loading {
    pointer-events: none;
}

.tbz-auth-card .tbz-auth-btn-row {
    display: flex;
    gap: .55rem;
}

.tbz-auth-card .tbz-auth-btn-row .tbz-auth-btn {
    width: 50%;
}

.tbz-auth-footer {
    text-align: center;
    margin-top: 1.1rem;
}

.tbz-auth-steps {
    display: flex;
    align-items: center;
    justify-content: center;
}

.tbz-auth-step {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid #c9ced5;
    color: #8a94a6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .85rem;
    font-weight: 700;
    background: #fff;
}

.tbz-auth-step.active,
.tbz-auth-step.completed {
    background: var(--tbz-primary);
    border-color: var(--tbz-primary);
    color: #fff;
}

.tbz-auth-step-line {
    width: 42px;
    height: 2px;
    background: #c9ced5;
    margin: 0 .45rem;
}

.tbz-auth-note {
    display: flex;
    gap: .55rem;
    align-items: center;
    background: #eaf7f2;
    color: var(--tbz-primary-hover);
    border: 1px solid #c5eadc;
    border-radius: 10px;
    padding: .7rem .8rem;
    font-size: .86rem;
}

@media (min-width: 992px) {
    .tbz-auth-branding {
        display: flex;
        width: 44%;
    }

    .tbz-auth-layout--staff .tbz-auth-branding {
        width: 50%;
    }

    .tbz-auth-main {
        width: 56%;
    }

    .tbz-auth-layout--staff .tbz-auth-main {
        width: 50%;
    }

    .tbz-auth-mobile-brand,
    .tbz-auth-mobile-foot {
        display: none;
    }
}

@media (max-width: 575.98px) {
    .tbz-auth-main {
        padding: 1.25rem .9rem;
    }

    .tbz-auth-mobile-brand h2 {
        font-size: 1.1rem;
    }

    .tbz-auth-main .tbz-auth-card {
        border-radius: 12px;
    }

    .tbz-auth-step-line {
        width: 30px;
        margin: 0 .35rem;
    }

    .tbz-auth-card .tbz-auth-btn-row {
        flex-direction: column;
    }

    .tbz-auth-card .tbz-auth-btn-row .tbz-auth-btn {
        width: 100%;
    }
}

/* ── 17. Form controls (global) ───────────────────────────── */
.form-control:focus,
.form-select:focus {
    border-color: var(--tbz-primary);
    box-shadow: 0 0 0 .2rem rgba(45, 106, 45, .2);
}

/* Generic Django form controls rendered without Bootstrap classes */
.tbz-content form input[type=text],
.tbz-content form input[type=email],
.tbz-content form input[type=number],
.tbz-content form input[type=date],
.tbz-content form input[type=time],
.tbz-content form input[type=datetime-local],
.tbz-content form input[type=password],
.tbz-content form textarea,
.tbz-content form select {
    width: 100%;
    border: 1px solid var(--tbz-border);
    border-radius: .5rem;
    padding: .6rem .8rem;
    background: var(--tbz-input-bg);
    color: var(--tbz-text-dark);
    font-size: .9rem;
}

.tbz-content form input[type=text]:focus,
.tbz-content form input[type=email]:focus,
.tbz-content form input[type=number]:focus,
.tbz-content form input[type=date]:focus,
.tbz-content form input[type=time]:focus,
.tbz-content form input[type=datetime-local]:focus,
.tbz-content form input[type=password]:focus,
.tbz-content form textarea:focus,
.tbz-content form select:focus {
    border-color: var(--tbz-primary);
    box-shadow: 0 0 0 .2rem var(--tbz-focus-ring);
    outline: none;
    background: var(--tbz-surface-elevated);
}

/* Keep prefixed numeric inputs attached; the generic Django input rule above
   sets number fields to width:100%, which otherwise forces wrapping. */
.tbz-content form .tbz-attached-input.input-group {
    align-items: stretch;
    flex-wrap: nowrap;
}

.tbz-content form .tbz-attached-input.input-group > .input-group-text {
    align-items: center;
    border-color: var(--tbz-border);
    border-radius: .5rem 0 0 .5rem;
    display: inline-flex;
    min-height: 42px;
    padding-left: .85rem;
    padding-right: .85rem;
}

.tbz-content form .tbz-attached-input.input-group > input,
.tbz-content form .tbz-attached-input.input-group > .form-control {
    border-left: 0;
    border-radius: 0 .5rem .5rem 0;
    flex: 1 1 auto;
    min-width: 0;
    width: 1%;
}

/* Bootstrap 5 applies appearance:none to .form-control which suppresses the
   native clock/calendar picker indicator in Chromium. Restore it for all
   date and time inputs sitewide so the native picker opens on click. */
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 1;
    display: block;
}

/* ── 18. Page + panel helpers ─────────────────────────────── */
.tbz-page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.tbz-page-title-row {
    display: flex;
    align-items: center;
    gap: .55rem;
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
}

.tbz-page-title-row i {
    color: var(--tbz-primary);
}

.tbz-page-subtitle {
    margin: .15rem 0 0;
    color: var(--tbz-text-muted);
    font-size: .84rem;
}

.tbz-hero-title {
    margin: 0;
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: 0;
}

@media (min-width: 768px) {
    .tbz-hero-title { font-size: 1.9rem; }
}

.tbz-hero-sub {
    margin: .35rem 0 0;
    color: var(--tbz-text-muted);
    font-size: .9rem;
}

.tbz-kpi-card {
    background: var(--tbz-inset-bg);
    border: 1px solid var(--tbz-border);
    border-radius: 14px;
    box-shadow: var(--tbz-shadow-card);
    padding: 1rem 1rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: .35rem;
}

.tbz-kpi-card--accent {
    background: var(--tbz-primary-light);
    border-color: var(--tbz-kpi-accent-border);
}

.tbz-kpi-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .75rem;
}

.tbz-kpi-label {
    font-size: .78rem;
    font-weight: 600;
    color: var(--tbz-text-muted);
}

.tbz-kpi-icon {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    border: 1px solid var(--tbz-kpi-icon-border);
    background: var(--tbz-kpi-icon-bg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--tbz-kpi-icon-fg);
    flex: 0 0 auto;
}

.tbz-kpi-card--accent .tbz-kpi-icon {
    background: var(--tbz-kpi-accent-icon-bg);
    border-color: var(--tbz-kpi-accent-icon-bg);
    color: var(--tbz-primary);
}

.tbz-kpi-value {
    /* Fluid size so large currency figures (e.g. $55,677.40) fit the narrow
       quarter-width KPI columns instead of overflowing. */
    font-size: clamp(1.25rem, 0.9rem + 1vw, 1.6rem);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: 0;
    font-variant-numeric: tabular-nums;
    overflow-wrap: break-word;
}

.tbz-kpi-sub {
    font-size: .82rem;
    color: var(--tbz-text-muted);
    display: flex;
    align-items: center;
    gap: .35rem;
}

.tbz-kpi-sub strong {
    color: var(--tbz-text-dark);
    font-weight: 600;
}

.tbz-form-panel {
    background: var(--tbz-inset-bg);
    border: 1px solid var(--tbz-border);
    border-radius: 14px;
    padding: 1rem;
}

/* Missing levy returns callout (buyer returns list) */
.tbz-missing-returns {
    background: #fffaf0;
    border: 1px solid #f7c948;
    border-radius: 8px;
    overflow: hidden;
}

.tbz-missing-returns__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    flex-wrap: wrap;
    padding: .95rem 1.1rem;
    border-bottom: 1px solid #f7d774;
    background: #fff3c4;
}

.tbz-missing-returns__title {
    display: flex;
    align-items: center;
    gap: .75rem;
}

.tbz-missing-returns__icon {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: #f59e0b;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    flex: 0 0 auto;
}

.tbz-missing-returns__summary {
    align-items: center;
    background: #fffdf6;
    border-bottom: 1px solid #f8e2a2;
    color: #5f3b05;
    display: flex;
    flex-wrap: wrap;
    gap: .65rem 1rem;
    justify-content: space-between;
    padding: .7rem 1.1rem;
}

.tbz-missing-returns__summary-label {
    color: #9a4d00;
    display: block;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.tbz-missing-returns__summary-hint {
    color: #8a6a1f;
    font-size: .78rem;
}

.tbz-missing-returns__body {
    padding: 0 1.1rem .35rem;
    display: flex;
    flex-direction: column;
}

.tbz-missing-returns__floor {
    align-items: center;
    border-top: 1px dashed #f8e2a2;
    display: grid;
    gap: .75rem;
    grid-template-columns: minmax(12rem, 18rem) minmax(0, 1fr);
    padding: .75rem 0;
}

.tbz-missing-returns__floor:first-child {
    border-top: 0;
}

.tbz-missing-returns__floor-name {
    align-items: center;
    color: #93370d;
    display: flex;
    flex-wrap: wrap;
    font-size: .82rem;
    font-weight: 600;
    gap: .4rem;
    min-width: 0;
}

.tbz-missing-returns__count {
    background: #fff;
    border: 1px solid #f8d98b;
    border-radius: 999px;
    color: #8a4b0f;
    font-size: .7rem;
    font-weight: 700;
    padding: .12rem .45rem;
    white-space: nowrap;
}

.tbz-missing-returns__chips {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
}

.tbz-period-chip {
    align-items: center;
    font-family: var(--bs-font-monospace, monospace);
    font-size: .76rem;
    font-weight: 600;
    color: #8a3a00;
    background: #fff;
    border: 1px solid #f5b642;
    border-radius: 999px;
    display: inline-flex;
    gap: .3rem;
    min-height: 28px;
    padding: .2rem .6rem;
    text-decoration: none;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

.tbz-period-chip:hover,
.tbz-period-chip:focus {
    background: #f59e0b;
    border-color: #f59e0b;
    color: #fff;
    outline: none;
}

.tbz-period-chip__month {
    font-family: var(--bs-body-font-family);
    font-weight: 700;
}

.tbz-settings-grid .content-card {
    overflow: hidden;
}

.tbz-settings-header {
    border-bottom: 1px solid var(--tbz-border);
}

.tbz-settings-title {
    align-items: center;
    color: var(--tbz-text-dark);
    display: inline-flex;
    font-size: .95rem;
    font-weight: 700;
    gap: .25rem;
}

.tbz-settings-muted {
    color: var(--tbz-text-muted);
    font-size: .8rem;
    margin-top: .15rem;
}

.tbz-settings-form {
    border-style: dashed;
}

.tbz-settings-stat .card-body {
    align-items: center;
    display: flex;
    gap: .9rem;
}

.tbz-settings-stat-icon {
    align-items: center;
    background: var(--tbz-settings-icon-bg);
    border: 1px solid var(--tbz-settings-icon-border);
    border-radius: 12px;
    display: inline-flex;
    font-size: 1.1rem;
    height: 42px;
    justify-content: center;
    width: 42px;
}

.tbz-settings-stat-label {
    color: var(--tbz-text-muted);
    font-size: .76rem;
    font-weight: 700;
    letter-spacing: .02em;
    text-transform: uppercase;
}

.tbz-settings-stat-value {
    color: var(--tbz-text-dark);
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.2;
}

.tbz-settings-stat-sub {
    color: var(--tbz-text-muted);
    font-size: .78rem;
    margin-top: .2rem;
}

.tbz-field-wrap {
    position: relative;
}

.tbz-field-wrap .tbz-field-icon {
    color: var(--tbz-placeholder);
    left: .7rem;
    line-height: 1;
    pointer-events: none;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
}

.tbz-field-wrap .form-control,
.tbz-field-wrap .form-select,
.tbz-field-wrap input,
.tbz-field-wrap select,
.tbz-field-wrap textarea {
    padding-left: 2.1rem !important;
}

.tbz-settings-security-row {
    align-items: center;
    border-bottom: 1px dashed var(--tbz-table-border);
    display: flex;
    justify-content: space-between;
    padding-bottom: .5rem;
}

.tbz-settings-security-row:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.tbz-col-narrow {
    width: 90px;
}

.tbz-inline-search {
    max-width: 220px;
}

.tbz-sticky-savebar {
    bottom: .75rem;
    position: sticky;
    z-index: 5;
    box-shadow: 0 -4px 16px rgba(15, 23, 42, .08);
}

.tbz-settings-security-label {
    color: var(--tbz-text-dark);
    font-size: .85rem;
    font-weight: 600;
}

.tbz-2fa-setup-box {
    background: var(--tbz-surface-muted);
    border: 1px solid var(--tbz-input-border-strong);
    border-radius: 12px;
    padding: .8rem;
}

.tbz-2fa-qr-wrap {
    align-items: center;
    background: var(--tbz-surface-elevated);
    border: 1px solid var(--tbz-border);
    border-radius: 10px;
    display: flex;
    justify-content: center;
    padding: .6rem;
}

.tbz-2fa-qr-wrap img {
    height: auto;
    max-width: 220px;
    width: 100%;
}

.tbz-2fa-secret {
    background: var(--tbz-surface-muted);
    border: 1px dashed var(--tbz-border);
    border-radius: 8px;
    color: var(--tbz-text-dark);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: .8rem;
    overflow-wrap: anywhere;
    padding: .5rem .6rem;
}

.tbz-password-field {
    position: relative;
}

.tbz-password-field .form-control {
    padding-left: 2.1rem;
    padding-right: 2.2rem;
}

.tbz-password-icon {
    color: var(--tbz-placeholder);
    left: .7rem;
    line-height: 1;
    pointer-events: none;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
}

.tbz-password-eye {
    align-items: center;
    background: transparent;
    border: 0;
    color: var(--tbz-text-muted);
    display: inline-flex;
    height: 100%;
    justify-content: center;
    position: absolute;
    right: .4rem;
    top: 0;
    width: 1.8rem;
}

.tbz-password-eye:hover {
    color: var(--tbz-primary-hover);
}

.tbz-password-eye:focus {
    outline: none;
}

.tbz-password-policy ul {
    margin: 0;
    padding-left: 1.1rem;
}

.tbz-password-policy li {
    color: var(--tbz-text-muted);
    font-size: .82rem;
    margin-bottom: .3rem;
}

.tbz-password-tips {
    margin: 0;
    padding-left: 1.05rem;
}

.tbz-password-tips li {
    color: var(--tbz-text-muted);
    font-size: .82rem;
    margin-bottom: .35rem;
}

.tbz-table-wrap {
    overflow-x: auto;
}

.tbz-empty {
    color: var(--tbz-text-muted);
    text-align: center;
    padding: 1rem;
}

.tbz-metric {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .25rem .55rem;
    border-radius: 999px;
    background: var(--tbz-primary-light);
    color: var(--tbz-primary-hover);
    font-size: .74rem;
    font-weight: 600;
}

.tbz-metric i {
    font-size: .8rem;
}

.tbz-inline-actions {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
}

.tbz-pagination {
    display: flex;
    justify-content: flex-end;
    padding: .8rem 1rem;
    border-top: 1px solid var(--tbz-border);
    background: var(--tbz-inset-bg);
}

.tbz-filter-pills {
    gap: .4rem;
}

.tbz-filter-pills .nav-link,
.tbz-filter-pills .tbz-filter-pill {
    background: var(--tbz-surface-elevated);
    border: 1px solid var(--tbz-filter-pill-border);
    border-radius: .55rem;
    color: var(--tbz-primary);
    display: inline-flex;
    font-weight: 600;
    padding: .42rem .8rem;
    text-decoration: none;
}

.tbz-filter-pills .nav-link:hover,
.tbz-filter-pills .nav-link:focus,
.tbz-filter-pills .tbz-filter-pill:hover,
.tbz-filter-pills .tbz-filter-pill:focus {
    background: var(--tbz-primary-light);
    border-color: var(--tbz-primary);
    color: var(--tbz-primary-hover);
}

.tbz-filter-pills .nav-link.active,
.tbz-filter-pills .show > .nav-link,
.tbz-filter-pills .tbz-filter-pill.active {
    background: var(--tbz-primary);
    border-color: var(--tbz-primary);
    color: var(--tbz-gold);
}

.tbz-filter-pills .nav-link.active:hover,
.tbz-filter-pills .show > .nav-link:hover,
.tbz-filter-pills .tbz-filter-pill.active:hover {
    background: var(--tbz-primary-hover);
    border-color: var(--tbz-primary-hover);
    color: var(--tbz-gold);
}

.tbz-status-filter {
    width: auto;
    min-width: 260px;
    max-width: 360px;
    flex-shrink: 0;
}

.tbz-status-filter > .input-group-text,
.tbz-status-filter > .form-select {
    min-height: 42px;
    border-color: var(--tbz-input-border-strong);
    font-size: .88rem;
}

.tbz-status-filter > .input-group-text {
    background: var(--tbz-surface-elevated);
    color: var(--tbz-primary);
    padding-left: .85rem;
    padding-right: .65rem;
}

.tbz-status-filter > .form-select {
    background: var(--tbz-input-bg);
    border-left: 0;
    padding-left: .15rem;
    padding-right: 2rem;
    font-weight: 600;
    color: var(--tbz-text-dark);
    cursor: pointer;
    box-shadow: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%230f8a5f'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right .85rem center;
    background-size: 14px 10px;
}

.tbz-status-filter > .form-select:focus {
    background-color: var(--tbz-surface-elevated);
    border-color: var(--tbz-primary);
    box-shadow: 0 0 0 3px var(--tbz-focus-ring);
}

.tbz-status-filter.is-active > .input-group-text,
.tbz-status-filter.is-active > .form-select {
    border-color: var(--tbz-kpi-accent-border);
    background-color: var(--tbz-primary-light);
}

.tbz-status-filter.is-active > .form-select {
    color: var(--tbz-primary);
}

.tbz-status-filter__clear {
    background: var(--tbz-surface-elevated);
    border-color: var(--tbz-input-border-strong);
    color: var(--tbz-placeholder);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    transition: color .15s ease, background-color .15s ease;
}

.tbz-status-filter__clear:hover {
    color: var(--tbz-danger-text);
    background: var(--tbz-danger-soft);
}

.tbz-notif-filter-pills .tbz-filter-pill {
    gap: 0.35rem;
}

.tbz-notif-filter-pills .tbz-notif-filter-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.35rem;
    height: 1.35rem;
    padding: 0 0.4rem;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    margin-left: 0.1rem;
    background: rgba(15, 138, 95, 0.15);
    color: var(--tbz-primary);
}

.tbz-notif-filter-pills .tbz-notif-filter-count--muted {
    background: #e5e7eb;
    color: var(--tbz-text-dark);
}

.tbz-notif-filter-pills .tbz-filter-pill.active .tbz-notif-filter-count,
.tbz-notif-filter-pills .tbz-filter-pill.active .tbz-notif-filter-count--muted {
    background: rgba(255, 255, 255, 0.25);
    color: var(--tbz-gold);
}

/* ── 19. Crop Seasons ─────────────────────────────────────── */
.tbz-season-card {
    background: #fff;
    border: 1px solid var(--tbz-border);
    border-radius: 14px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, .04);
    display: flex;
    flex-direction: column;
    gap: .95rem;
    height: 100%;
    padding: 1rem;
}

.tbz-season-card.is-active {
    border-color: rgba(45, 106, 45, .4);
    box-shadow: 0 0 0 1px rgba(45, 106, 45, .12), 0 10px 22px rgba(15, 23, 42, .06);
}

.tbz-season-card-head {
    align-items: flex-start;
    display: flex;
    gap: .75rem;
    justify-content: space-between;
}

.tbz-season-card-title {
    color: var(--tbz-text-dark);
    font-size: 1.65rem;
    font-weight: 700;
    line-height: 1.15;
    margin: 0;
}

.tbz-season-card-subtitle {
    color: #334155;
    font-size: .98rem;
    margin: .3rem 0 0;
}

.tbz-season-card-icon {
    align-items: center;
    background: var(--tbz-primary-light);
    border-radius: 10px;
    color: var(--tbz-primary);
    display: inline-flex;
    font-size: 1rem;
    height: 32px;
    justify-content: center;
    width: 32px;
}

.tbz-season-status {
    background: var(--tbz-primary);
    border-radius: 999px;
    color: var(--tbz-gold);
    display: inline-flex;
    font-size: .72rem;
    font-weight: 700;
    line-height: 1;
    padding: .28rem .62rem;
}

.tbz-season-periods {
    border-top: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
    display: grid;
    gap: .9rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: .85rem 0;
}

.tbz-season-label {
    color: #64748b;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .04em;
    margin-bottom: .2rem;
    text-transform: uppercase;
}

.tbz-season-value {
    color: #0f172a;
    font-size: 1rem;
    font-weight: 600;
}

.tbz-season-actions {
    align-items: center;
    display: flex;
    gap: .55rem;
    justify-content: space-between;
}

.tbz-season-set-btn {
    min-width: 140px;
}

#season-form .form-check-input {
    border-color: #b6c3d1;
}

#season-form .form-check-input:checked {
    background-color: var(--tbz-primary);
    border-color: var(--tbz-primary);
}

@media (max-width: 575.98px) {
    .tbz-season-card-title {
        font-size: 1.35rem;
    }

    .tbz-season-periods {
        grid-template-columns: 1fr;
    }

    .tbz-season-actions {
        align-items: stretch;
        flex-direction: column;
    }
}

/* ── 20. Reusable Wizard ─────────────────────────────────── */
.tbz-wizard-shell,
.tbz-reg-shell {
    display: grid;
    gap: .75rem;
}

.tbz-wizard-header,
.tbz-reg-header {
    align-items: center;
    display: flex;
    gap: .75rem;
    justify-content: space-between;
}

.tbz-wizard-title,
.tbz-reg-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
}

.tbz-wizard-subtitle,
.tbz-reg-subtitle {
    color: var(--tbz-text-muted);
    font-size: .86rem;
}

.tbz-wizard-stepper,
.tbz-reg-stepper {
    display: grid;
    gap: .5rem;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.tbz-wizard-step,
.tbz-reg-step {
    align-items: center;
    background: #fff;
    border: 1px solid #dbe4ed;
    border-radius: 10px;
    color: #64748b;
    display: flex;
    gap: .5rem;
    min-height: 42px;
    padding: .45rem .6rem;
}

.tbz-wizard-step .index,
.tbz-reg-step .index {
    align-items: center;
    background: #e2e8f0;
    border-radius: 999px;
    color: #475569;
    display: inline-flex;
    font-size: .75rem;
    font-weight: 700;
    height: 22px;
    justify-content: center;
    width: 22px;
}

.tbz-wizard-step .label,
.tbz-reg-step .label {
    font-size: .8rem;
    font-weight: 600;
}

.tbz-wizard-step.is-active,
.tbz-reg-step.is-active {
    background: var(--tbz-primary-light);
    border-color: #c9dfc9;
    color: var(--tbz-primary-hover);
}

.tbz-wizard-step.is-active .index,
.tbz-reg-step.is-active .index {
    background: var(--tbz-primary);
    color: #fff;
}

.tbz-wizard-progress,
.tbz-reg-progress {
    background: var(--tbz-wizard-track);
    border-radius: 999px;
    height: 6px;
    overflow: hidden;
}

.tbz-wizard-card .card-header,
.tbz-reg-card .card-header {
    display: grid;
    gap: .2rem;
}

.tbz-wizard-card-title,
.tbz-reg-card-title {
    color: var(--tbz-text-dark);
    font-size: .96rem;
    font-weight: 700;
}

.tbz-wizard-card-subtitle,
.tbz-reg-card-subtitle {
    color: var(--tbz-text-muted);
    font-size: .8rem;
    font-weight: 500;
}

.tbz-wizard-actions,
.tbz-reg-actions {
    border-top: 1px solid var(--tbz-border);
    display: flex;
    justify-content: space-between;
    margin-top: .35rem;
    padding-top: .9rem;
}

/* ── 21. Responsive utilities ─────────────────────────────── */

/* Stack module card row to 1 column on xs, 2 on sm, 4 on xl */
/* (Bootstrap grid handles this via col- classes) */

@media (max-width: 767.98px) {
    .tbz-wizard-stepper,
    .tbz-reg-stepper {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Compact content padding on xs */
@media (max-width: 575.98px) {
    .tbz-breadcrumb-bar { margin-bottom: .75rem; }
    .stat-card { padding: 1rem; }
    .stat-card .sc-value { font-size: 1.35rem; }
    .content-card .card-header { padding: .75rem 1rem; }
    .content-card .card-body { padding: 1rem; }
    .tbz-wizard-header,
    .tbz-reg-header {
        align-items: flex-start;
        flex-direction: column;
    }
    .tbz-wizard-actions,
    .tbz-reg-actions {
        flex-direction: column-reverse;
    }
    .tbz-wizard-actions .btn,
    .tbz-reg-actions .btn {
        width: 100%;
    }
    .tbz-missing-returns__head {
        align-items: stretch;
    }
    .tbz-missing-returns__head .btn {
        width: 100%;
    }
    .tbz-missing-returns__floor {
        align-items: flex-start;
        grid-template-columns: 1fr;
    }
    .tbz-missing-returns__summary {
        align-items: flex-start;
        flex-direction: column;
    }
    .tbz-settings-stat .card-body {
        align-items: flex-start;
    }
}

/* ── 22. Ticket Barcode Scanner ─────────────────────────────── */

.tbz-scanner-viewport {
    align-items: center;
    background: #121926;
    border: 1px dashed #3b4b68;
    border-radius: .75rem;
    display: flex;
    justify-content: center;
    min-height: 220px;
    overflow: hidden;
}

.tbz-scanner-viewport .js-scan-video {
    max-height: 320px;
    object-fit: cover;
    width: 100%;
}

/* ── 23. Sales Floor Capture Workflow ───────────────────────── */

/* Completed step variant (previously-done steps) */
.tbz-capture-step-done {
    background: #f0fdf4;
    border-color: #c9dfc9;
    color: #276749;
}

.tbz-capture-step-done .index {
    background: #276749;
    color: #d1e7dd;
}

/* Live activity pulse dot */
.tbz-live-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    animation: tbz-pulse-live 1.4s ease-in-out infinite;
    vertical-align: middle;
}

@keyframes tbz-pulse-live {
    0%, 100% { opacity: 1; }
    50%       { opacity: .25; }
}

/* Capture form section divider */
.tbz-capture-section-label {
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--tbz-text-muted);
    padding: .5rem 0 .35rem;
    border-bottom: 1px solid var(--tbz-border);
    margin-bottom: .85rem;
}

/* Result card accent borders */
.tbz-result-success {
    border-left: 4px solid #198754;
}

.tbz-result-error {
    border-left: 4px solid #dc3545;
}

/* Extra-small badge text (for inline labels inside headers) */
.tbz-badge-xs {
    font-size: .62rem;
    padding: .15rem .4rem;
    border-radius: .35rem;
}

/* Informational block (e.g. settlement notice, inline hints) */
.tbz-info-block {
    background: var(--tbz-primary-light);
    border-radius: .6rem;
    color: var(--tbz-primary-hover);
    padding: .75rem 1rem;
    font-size: .84rem;
}

/* Grower auto-fill info panel on inspection create form */
.tbz-grower-info-panel {
    background: var(--tbz-primary-light);
    border: 1px solid #c9dfc9;
}

/* ── Grower Detail page (gd-) ───────────────────────────────────── */
.gd-hero {
    border: 1px solid #dcefe4;
    background: linear-gradient(135deg, #f6fffa 0%, #ffffff 60%, #eefbf4 100%);
}

.gd-avatar {
    width: 72px;
    height: 72px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e9f7ef;
    border: 1px solid #ccebd8;
    color: var(--tbz-primary);
    font-size: 1.45rem;
    flex-shrink: 0;
    overflow: hidden;
}

.gd-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
}

.gd-side {
    position: sticky;
    top: 84px;
}

.gd-doc-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .6rem;
    padding: .55rem .7rem;
    border: 1px solid var(--tbz-border);
    border-radius: .55rem;
    text-decoration: none;
    color: inherit;
    background: #fff;
}

.gd-doc-link:hover {
    border-color: #b8d9c6;
    background: var(--tbz-primary-light);
}

.gd-crop-table th,
.gd-crop-table td {
    white-space: nowrap;
}

.gd-crop-table .gd-wrap {
    white-space: normal;
}

.gd-table-note {
    background: var(--tbz-body-bg);
    border-top: 1px solid var(--tbz-border);
    color: var(--tbz-text-muted);
    font-size: .82rem;
}

@media (max-width: 991.98px) {
    .gd-side { position: static; }
}

/* ── Grower Approve page (ga-) ──────────────────────────────────── */
.ga-hero {
    border: 1px solid #dcefe4;
    background: linear-gradient(135deg, #f6fffa 0%, #ffffff 60%, #eefbf4 100%);
}

.ga-avatar {
    width: 72px;
    height: 72px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e9f7ef;
    border: 1px solid #ccebd8;
    color: var(--tbz-primary);
    font-size: 1.45rem;
    flex-shrink: 0;
    overflow: hidden;
}

.ga-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
}

.ga-side {
    position: sticky;
    top: 84px;
}

.ga-checklist-item {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .35rem 0;
    font-size: .875rem;
    border-bottom: 1px solid var(--tbz-border);
}

.ga-checklist-item:last-child { border-bottom: none; }

.ga-check-ok   { color: var(--tbz-primary); }
.ga-check-warn { color: #dc3545; }

.ga-doc-card {
    border: 1px solid var(--tbz-border);
    border-radius: .6rem;
    overflow: hidden;
    background: #fff;
}

.ga-doc-img-wrap {
    display: block;
    width: 100%;
    aspect-ratio: 4/3;
    overflow: hidden;
    background: var(--tbz-primary-light);
}

.ga-doc-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    transition: transform .2s ease;
}

.ga-doc-img-wrap:hover img { transform: scale(1.04); }

.ga-doc-label {
    display: flex;
    align-items: center;
    gap: .3rem;
    padding: .4rem .6rem;
    font-size: .78rem;
    border-top: 1px solid var(--tbz-border);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 991.98px) {
    .ga-side { position: static; }
}

/* ── Reusable file-upload drop zone ─────────────────────────── */
.tbz-file-drop {
    border: 2px dashed var(--tbz-border);
    border-radius: .75rem;
    background: var(--tbz-bg);
    padding: 2rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: border-color .2s, background .2s;
    position: relative;
}
.tbz-file-drop:hover,
.tbz-file-drop.is-dragover {
    border-color: var(--tbz-primary);
    background: var(--tbz-primary-light);
}
.tbz-file-drop input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}
.tbz-file-drop .tbz-file-drop-icon {
    font-size: 2.2rem;
    color: var(--tbz-primary);
    display: block;
    margin-bottom: .5rem;
}
.tbz-file-drop .tbz-file-drop-label {
    font-weight: 600;
    color: var(--tbz-text);
}
.tbz-file-drop .tbz-file-drop-hint {
    font-size: .8rem;
    color: var(--tbz-muted);
    margin-top: .25rem;
}
.tbz-file-drop-preview {
    display: none;
    align-items: center;
    gap: .75rem;
    background: var(--tbz-primary-light);
    border: 1px solid #c9dfc9;
    border-radius: .6rem;
    padding: .6rem .9rem;
    margin-top: .75rem;
    font-size: .85rem;
}
.tbz-file-drop-preview.is-visible {
    display: flex;
}
.tbz-file-drop-preview .tbz-file-name {
    font-weight: 600;
    color: var(--tbz-primary);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tbz-file-drop-preview .tbz-file-size {
    color: var(--tbz-muted);
    white-space: nowrap;
}
.tbz-file-drop-preview .btn-tbz-clear {
    border: none;
    background: none;
    color: var(--tbz-muted);
    padding: 0 .25rem;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
}
.tbz-file-drop-preview .btn-tbz-clear:hover {
    color: #dc3545;
}

/* ── Document Image Cards (profile photo / ID uploads) ─────────── */
.tbz-doc-card {
    border: 1px solid var(--tbz-border);
    border-radius: .75rem;
    overflow: hidden;
    background: #fff;
    display: flex;
    flex-direction: column;
}
.tbz-doc-card__preview {
    height: 180px;
    background: #f4f7f5;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}
.tbz-doc-card__preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
}
.tbz-doc-card__placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .4rem;
    color: #aab8b0;
    font-size: .82rem;
}
.tbz-doc-card__placeholder i {
    font-size: 2.2rem;
}
.tbz-doc-card__footer {
    padding: .6rem .75rem;
    border-top: 1px solid var(--tbz-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    background: #fafcfb;
}
.tbz-doc-card__label {
    font-size: .82rem;
    font-weight: 600;
    color: var(--tbz-text-muted, #6c757d);
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tbz-doc-card__badge {
    font-size: .72rem;
    background: #e6f4ec;
    color: #0f8a5f;
    border: 1px solid #c3e6cb;
    border-radius: .35rem;
    padding: .15rem .45rem;
    white-space: nowrap;
}

/* ── Crop Information: Season Cards ───────────────────────────── */
.tbz-season-header {
    font-size: 1.1rem;
    font-weight: 700;
    color: #2d6a2d;
    padding: .5rem 0 .25rem;
    letter-spacing: .02em;
}
.tbz-season-divider {
    height: 3px;
    background: linear-gradient(90deg, #2d6a2d 60%, transparent);
    margin-bottom: .75rem;
    border-radius: 2px;
}
.tbz-crop-label {
    background: #f8f9fa;
    font-weight: 600;
    font-size: .82rem;
    white-space: nowrap;
    min-width: 90px;
}
.tbz-season-quota-bar {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    padding: .5rem 0;
    margin-top: .25rem;
}
.tbz-quota-pill {
    display: inline-block;
    padding: .35rem .75rem;
    border-radius: 4px;
    font-size: .78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .03em;
}
.tbz-quota-total {
    background: #c8a415;
    color: #fff;
}
.tbz-quota-remaining {
    background: #1a73e8;
    color: #fff;
}

/* ── Pagination (Modern) ───────────────────────────────────── */
.tbz-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    flex-wrap: wrap;
    padding: .9rem 0;
}

.content-card > .tbz-pagination,
.card-body > .tbz-pagination {
    border-top: 1px solid var(--tbz-border);
    margin-top: .15rem;
    padding: .9rem 1rem;
}

.tbz-pagination-meta {
    display: flex;
    align-items: center;
    gap: .5rem;
    color: var(--tbz-text-muted);
    font-size: .82rem;
}

.tbz-pagination-page {
    font-weight: 600;
    color: #344054;
}

.tbz-pagination-total {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
}

.tbz-pagination-total::before {
    content: "";
    width: 4px;
    height: 4px;
    border-radius: 999px;
    background: #c1c7d0;
}

.tbz-pagination .pagination {
    gap: .35rem;
}

.tbz-pagination .page-item .page-link,
.card-footer .page-item .page-link {
    min-width: 2.05rem;
    height: 2.05rem;
    border-radius: .65rem;
    border: 1px solid #e7eaf0;
    background: #fff;
    color: #475467;
    padding: 0 .62rem;
    font-size: .8rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 1px rgba(16, 24, 40, .04);
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease, color .15s ease, background .15s ease;
}

.tbz-pagination .page-item .page-link:hover,
.card-footer .page-item .page-link:hover {
    border-color: #cfd6e3;
    color: var(--tbz-primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 24, 40, .08);
}

.tbz-pagination .page-item.active .page-link,
.card-footer .page-item.active .page-link {
    background: var(--tbz-primary);
    color: #fff;
    border-color: var(--tbz-primary);
    box-shadow: 0 8px 16px rgba(15, 138, 95, .22);
}

.tbz-pagination .page-item.disabled .page-link,
.card-footer .page-item.disabled .page-link {
    color: #98a2b3;
    background: #f9fafb;
    border-color: #edf0f5;
    box-shadow: none;
    transform: none;
}

.tbz-pagination .page-link:focus,
.card-footer .page-link:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(15, 138, 95, .16);
}

.tbz-per-page {
    display: flex;
    align-items: center;
    gap: .5rem;
    color: var(--tbz-text-muted);
    font-size: .82rem;
}

.tbz-per-page-label {
    margin: 0;
    white-space: nowrap;
}

.tbz-per-page-select {
    width: auto;
    padding-top: .15rem;
    padding-bottom: .15rem;
}

@media (max-width: 576px) {
    .tbz-pagination {
        justify-content: center;
    }

    .tbz-pagination-meta {
        width: 100%;
        justify-content: center;
    }

    .tbz-pagination .page-item .page-link {
        min-width: 1.9rem;
        height: 1.9rem;
        font-size: .77rem;
        padding: 0 .5rem;
    }
}

/* ── Sortable table headers ──────────────────────────────────── */
.tbz-sortable-th {
    white-space: nowrap;
}

.tbz-sort-link {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    color: inherit;
    text-decoration: none;
    cursor: pointer;
}

.tbz-sort-link:hover {
    color: var(--tbz-primary);
}

.tbz-sort-link i {
    font-size: .72rem;
    color: #c1c7d0;
}

.tbz-sort-link.active i {
    color: var(--tbz-primary);
}

.tbz-sort-link:hover i {
    color: var(--tbz-primary);
}

/* Sales floor capture wizard */
.sales-capture-wizard .tbz-wizard-header {
    margin-bottom: 1rem;
}

.sales-capture-wizard .tbz-wizard-step-text {
    color: var(--bs-secondary-color, #6c757d);
    font-size: .9rem;
}

.sales-capture-wizard .tbz-wizard-stepper {
    margin-bottom: 1rem;
}

.sales-capture-wizard .tbz-wizard-step {
    transition: all .18s ease;
    border-radius: .75rem;
    padding: .35rem .65rem;
}

.sales-capture-wizard .tbz-wizard-step.is-active {
    background: rgba(25, 135, 84, .08);
}

.sales-capture-wizard .wizard-panel {
    border: 1px solid rgba(15, 23, 42, .06);
    box-shadow: 0 .5rem 1.25rem rgba(15, 23, 42, .06);
}

.sales-capture-wizard .tbz-wizard-actions {
    gap: .5rem;
}

.sales-capture-wizard .tbz-wizard-actions .btn {
    min-width: 10rem;
}

/* Inline QR scan button — matches tbz-soft-input shape */
.tbz-scan-inline-btn {
    border-radius: .75rem;
    border-color: #dbe4ed;
    min-height: 42px;
}

/* Group permit entry selector header */
.tbz-group-permit-header {
    background: rgba(255, 193, 7, .08);
}

/* Validated permit info card header */
.tbz-permit-validated-header {
    background: rgba(25, 135, 84, .07);
}

/* Micro-label above data values (uppercase, tight tracking) */
.tbz-data-label {
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .05em;
}

/* Secondary value beneath a data label */
.tbz-data-value-sm {
    font-size: .75rem;
}

/* Capture table — ticket number cell */
.tbz-capture-ticket-cell {
    font-size: .8rem;
}

/* Capture table — grower name cell (truncate on overflow) */
.tbz-capture-grower-cell {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Bale scan modal video */
.tbz-scan-video {
    max-height: 360px;
    object-fit: cover;
    border-radius: .5rem;
}

/* ── Bale row card layout (mobile) ───────────────────────────── */
@media (max-width: 767.98px) {
    .sales-capture-wizard .bale-row {
        background: #fff;
        border: 1px solid var(--tbz-border);
        border-left: 3px solid var(--tbz-primary);
        border-radius: .75rem;
        box-shadow: 0 1px 4px rgba(16, 24, 40, .06);
        padding: .65rem .75rem .6rem;
        margin-bottom: .65rem;
    }
    .sales-capture-wizard #baleRows .bale-row:last-child {
        margin-bottom: 0;
    }
    .sales-capture-wizard .bale-row-header {
        display: flex;
        align-items: center;
        gap: .5rem;
        padding-bottom: .45rem;
        margin-bottom: .45rem;
        border-bottom: 1px solid var(--tbz-border);
    }
    .sales-capture-wizard .bale-row-number {
        display: inline-flex;
        align-items: center;
        gap: .35rem;
        flex-shrink: 0;
    }
    .sales-capture-wizard .bale-seq {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 1.5rem;
        height: 1.5rem;
        border-radius: 50%;
        background: var(--tbz-primary);
        color: #fff;
        font-size: .7rem;
        font-weight: 700;
        flex-shrink: 0;
        line-height: 1;
    }
    .sales-capture-wizard .bale-label {
        font-size: .7rem;
        font-weight: 600;
        color: var(--tbz-text-muted);
        text-transform: uppercase;
        letter-spacing: .06em;
    }
    /* "Add Bale Row" full-width, comfortable touch target */
    .tbz-add-bale-btn {
        width: 100%;
        padding-top: .55rem;
        padding-bottom: .55rem;
    }
}

@media (min-width: 768px) {
    .bale-row-header { display: none; }
    .tbz-add-bale-btn { width: auto; }
}

/* ── Notifications list (inbox-style) ───────────────────────── */
.tbz-notif-shell {
    width: 100%;
}

.tbz-notif-card {
    border-radius: 14px;
    border: 1px solid var(--tbz-border);
    box-shadow: var(--tbz-shadow-card);
    overflow: hidden;
    background: var(--tbz-inset-bg);
}

.tbz-notif-card .card-body {
    background: var(--tbz-inset-bg);
}

.tbz-notif-card__header {
    padding: 1.1rem 1.25rem 0.75rem;
    border-bottom: 1px solid var(--tbz-border);
    background: var(--tbz-inset-bg);
}

.tbz-notif-card__title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
}

.tbz-notif-card__title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--tbz-text-dark);
}

.tbz-notif-card__title-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 10px;
    background: var(--tbz-primary-light);
    color: var(--tbz-primary);
    font-size: 1.05rem;
}

.tbz-notif-card__menu-btn {
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    border-radius: 50%;
    border: 1px solid var(--tbz-border);
    background: var(--tbz-surface-elevated);
    color: var(--tbz-text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.tbz-notif-card__menu-btn:hover {
    background: var(--tbz-sidebar-accent);
    color: var(--tbz-primary);
    border-color: rgba(15, 138, 95, 0.25);
}

.tbz-notif-card__sub {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding-bottom: 0.35rem;
}

.tbz-notif-detail-modal .tbz-notif-detail-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.35rem;
}

.tbz-notif-detail-modal .tbz-notif-detail-body {
    line-height: 1.55;
}

.tbz-notif-card__count {
    font-size: 0.9rem;
    color: var(--tbz-text-muted);
}

.tbz-notif-card__count-label {
    margin-left: 0.2rem;
}

#tbzNotifTotalCount {
    font-weight: 700;
    color: var(--tbz-text-dark);
}

.tbz-notif-card__search-wrap {
    position: relative;
    flex: 1;
    min-width: 200px;
    max-width: 360px;
}

.tbz-notif-card__search-icon {
    position: absolute;
    left: 0.95rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--tbz-text-muted);
    font-size: 0.95rem;
    pointer-events: none;
}

.tbz-notif-card__search {
    border-radius: 999px;
    padding-left: 2.5rem;
    padding-right: 1rem;
    border: 1px solid var(--tbz-border);
    background: #fafafa;
    font-size: 0.88rem;
}

.tbz-notif-card__search:focus {
    border-color: rgba(15, 138, 95, 0.45);
    box-shadow: 0 0 0 3px rgba(15, 138, 95, 0.12);
    background: #fff;
}

.tbz-notif-tabs {
    display: flex;
    align-items: stretch;
    gap: 0;
    padding: 0 1rem;
    border-bottom: 1px solid var(--tbz-border);
    background: #fff;
}

.tbz-notif-tab {
    position: relative;
    border: none;
    background: none;
    padding: 0.85rem 1rem 0.75rem;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--tbz-text-muted);
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    cursor: pointer;
    transition: color 0.15s;
}

.tbz-notif-tab:hover {
    color: var(--tbz-text-dark);
}

.tbz-notif-tab.active {
    color: var(--tbz-primary);
}

.tbz-notif-tab.active::after {
    content: "";
    position: absolute;
    left: 0.75rem;
    right: 0.75rem;
    bottom: 0;
    height: 3px;
    border-radius: 3px 3px 0 0;
    background: var(--tbz-primary);
}

.tbz-notif-tab__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.35rem;
    height: 1.35rem;
    padding: 0 0.4rem;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    background: var(--tbz-primary);
    color: #fff;
}

.tbz-notif-tab:not(.active) .tbz-notif-tab__badge {
    background: #e5e7eb;
    color: var(--tbz-text-dark);
}

.tbz-notif-tab.active .tbz-notif-tab__badge--muted {
    background: var(--tbz-primary-light);
    color: var(--tbz-primary);
}

.tbz-notif-list {
    background: var(--tbz-inset-bg);
}

.tbz-notif-row {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.95rem 1rem 0.95rem 1.1rem;
    border-bottom: 1px solid var(--tbz-border);
    transition: background 0.12s;
}

.tbz-notif-row:nth-child(even) {
    background: var(--tbz-row-stripe);
}

.tbz-notif-row:hover {
    background: var(--tbz-hover-accent) !important;
}

.tbz-notif-row__dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-top: 0.55rem;
    flex-shrink: 0;
    background: var(--tbz-primary);
    box-shadow: 0 0 0 3px rgba(15, 138, 95, 0.2);
}

.tbz-notif-row--read .tbz-notif-row__dot {
    background: #cbd5e1;
    box-shadow: none;
}

.tbz-notif-row__fav {
    border: none;
    background: none;
    padding: 0.25rem;
    margin-top: 0.2rem;
    color: var(--tbz-text-muted);
    line-height: 1;
    border-radius: 6px;
    flex-shrink: 0;
    transition: color 0.15s, background 0.15s;
}

.tbz-notif-row__fav:hover {
    color: var(--tbz-gold);
    background: var(--tbz-gold-light);
}

.tbz-notif-row--fav .tbz-notif-row__fav {
    color: var(--tbz-gold-hover);
}

.tbz-notif-row__icon-wrap {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--tbz-kpi-icon-bg);
}

.tbz-notif-row__icon {
    font-size: 1.1rem;
}

.tbz-notif-row__icon--email {
    color: var(--tbz-mc-blue-icon);
}

.tbz-notif-row__icon--sms {
    color: var(--tbz-mc-teal-icon);
}

.tbz-notif-row__icon--inapp {
    color: var(--tbz-mc-gold-icon);
}

.tbz-notif-row__body {
    flex: 1;
    min-width: 0;
    text-align: left;
}

.tbz-notif-row__open {
    display: block;
    width: 100%;
    border: none;
    background: none;
    padding: 0;
    text-align: left;
    cursor: pointer;
    border-radius: 8px;
}

.tbz-notif-row__open:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px rgba(15, 138, 95, 0.35);
}

.tbz-notif-row__subject {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--tbz-text-dark);
    margin-bottom: 0.15rem;
}

.tbz-notif-row__preview {
    font-size: 0.83rem;
    color: var(--tbz-text-muted);
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tbz-notif-row__ref {
    display: inline-block;
    margin-top: 0.25rem;
    font-size: 0.72rem;
}

.tbz-notif-row__aside {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
    flex-shrink: 0;
    min-width: 5.5rem;
}

.tbz-notif-row__time {
    font-size: 0.75rem;
    color: var(--tbz-text-muted);
    white-space: nowrap;
}

.tbz-notif-row__actions {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    flex-shrink: 0;
}

.tbz-notif-row__btn {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    transition: transform 0.12s, background 0.15s, color 0.15s;
}

.tbz-notif-row__btn--archive {
    background: #f3f4f6;
    color: var(--tbz-text-muted);
}

.tbz-notif-row__btn--archive:hover {
    background: var(--tbz-primary-light);
    color: var(--tbz-primary);
}

.tbz-notif-row__btn--delete {
    background: rgba(224, 90, 43, 0.12);
    color: var(--tbz-mc-orange-icon);
}

.tbz-notif-row__btn--delete:hover {
    background: rgba(224, 90, 43, 0.22);
    color: #c2410c;
}

.tbz-notif-empty__icon {
    font-size: 2.5rem;
    color: var(--tbz-border);
}

@media (max-width: 767.98px) {
    .tbz-notif-row {
        flex-wrap: wrap;
    }

    .tbz-notif-row__aside {
        flex-direction: row;
        align-items: center;
        width: 100%;
        justify-content: space-between;
        padding-left: calc(10px + 0.65rem + 40px + 0.65rem);
        margin-top: 0.25rem;
    }

    .tbz-notif-row__actions {
        flex-direction: row;
        width: 100%;
        justify-content: flex-end;
        margin-top: 0.35rem;
    }
}

/* ── Permit Detail (pd-*) ─────────────────────────────────────────── */
.pd-hero {
    border: 1px solid #dcefe4;
    background: linear-gradient(135deg, #f6fffa 0%, #ffffff 60%, #eefbf4 100%);
}

.pd-avatar {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e9f7ef;
    border: 1px solid #ccebd8;
    color: var(--tbz-primary);
    font-size: 1.45rem;
    flex-shrink: 0;
}

.pd-side {
    position: sticky;
    top: 84px;
}

.pd-info-row {
    display: flex;
    align-items: flex-start;
    gap: .55rem;
    padding: .55rem 0;
    border-bottom: 1px solid var(--tbz-border);
    font-size: .875rem;
}

.pd-info-row:last-child {
    border-bottom: none;
}

.pd-label {
    min-width: 140px;
    color: var(--tbz-text-muted);
    flex-shrink: 0;
    padding-top: .05rem;
}

.pd-value {
    font-weight: 500;
    color: #1a1a1a;
}

.pd-section-divider {
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--tbz-text-muted);
    padding: .6rem 0 .2rem;
}

@media (max-width: 991.98px) {
    .pd-side { position: static; }
}

/* ── Permit Approve — Decision selector (tbz-decision-*) ─────────── */
.tbz-decision-group {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.tbz-decision-option {
    display: flex;
    align-items: center;
    gap: .6rem;
    width: 100%;
    margin: 0;
    padding: .6rem .85rem;
    border: 1px solid var(--tbz-border);
    border-radius: .5rem;
    cursor: pointer;
    font-weight: 600;
    transition: background-color .15s ease, border-color .15s ease;
}

.tbz-decision-option:hover {
    background-color: rgba(16, 24, 40, .03);
}

.tbz-decision-option .form-check-input {
    margin: 0;
    flex-shrink: 0;
}

.tbz-decision-option--success { color: var(--bs-success, #198754); }
.tbz-decision-option--warning { color: var(--bs-warning, #b8860b); }
.tbz-decision-option--danger  { color: var(--bs-danger, #dc3545); }

.tbz-decision-option--success:has(input:checked) {
    background-color: rgba(25, 135, 84, .08);
    border-color: rgba(25, 135, 84, .4);
}

.tbz-decision-option--warning:has(input:checked) {
    background-color: rgba(184, 134, 11, .08);
    border-color: rgba(184, 134, 11, .4);
}

.tbz-decision-option--danger:has(input:checked) {
    background-color: rgba(220, 53, 69, .08);
    border-color: rgba(220, 53, 69, .4);
}

/* Generic small-caps section label used to break up modal/card content
   (e.g. the permit decision preview modal). */
.tbz-section-divider {
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--tbz-text-muted);
    padding: .1rem 0 .5rem;
}

/* Decision preview card — recap of the decision/office/validity/reason
   inside the "Confirm Permit Decision" modal, colour-coded to match the
   selected .tbz-decision-option. */
.tbz-decision-summary {
    border: 1px solid var(--tbz-border);
    border-radius: .6rem;
    overflow: hidden;
    background: #f8fafc;
}

.tbz-decision-summary-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .55rem .85rem;
    font-size: .84rem;
    border-bottom: 1px solid var(--tbz-border);
}

.tbz-decision-summary-row:last-child {
    border-bottom: none;
}

.tbz-decision-summary-row .value {
    font-weight: 700;
    color: var(--tbz-text-dark);
    text-align: right;
}

.tbz-decision-summary--success { border-color: rgba(25, 135, 84, .35); background: rgba(25, 135, 84, .05); }
.tbz-decision-summary--warning { border-color: rgba(184, 134, 11, .35); background: rgba(184, 134, 11, .05); }
.tbz-decision-summary--danger  { border-color: rgba(220, 53, 69, .35); background: rgba(220, 53, 69, .05); }

.tbz-decision-summary--success .value { color: var(--bs-success, #198754); }
.tbz-decision-summary--warning .value { color: var(--bs-warning, #b8860b); }
.tbz-decision-summary--danger  .value { color: var(--bs-danger, #dc3545); }


/* ── Dark mode: dashboard / tables / KPI refinements ─────── */
html.dark .content-card.text-center {
    background:
        radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--tbz-primary) 12%, transparent) 0%, transparent 55%),
        radial-gradient(120% 140% at 100% 0%, color-mix(in srgb, var(--tbz-gold) 10%, transparent) 0%, transparent 55%),
        linear-gradient(180deg, var(--tbz-inset-bg) 0%, var(--tbz-surface-muted) 100%);
}

html.dark .module-card:hover {
    border-color: color-mix(in srgb, var(--tbz-text-dark) 12%, var(--tbz-border));
}

html.dark .mc-green  { --mc-bg1: #123d30; --mc-bg2: #0f4a36; }
html.dark .mc-gold   { --mc-bg1: #3d3410; --mc-bg2: #4a4012; }
html.dark .mc-teal   { --mc-bg1: #0d3330; --mc-bg2: #0f403b; }
html.dark .mc-blue   { --mc-bg1: #12263d; --mc-bg2: #16304d; }
html.dark .mc-orange { --mc-bg1: #3d2210; --mc-bg2: #4a2a12; }
html.dark .mc-amber  { --mc-bg1: #3d2810; --mc-bg2: #4a3012; }
html.dark .mc-purple { --mc-bg1: #2a2240; --mc-bg2: #332952; }

html.dark .tbz-notif-row--read .tbz-notif-row__dot {
    background: var(--tbz-text-muted);
}

html.dark .badge.bg-light.text-dark,
html.dark .badge.bg-light {
    background-color: var(--tbz-surface-muted) !important;
    color: var(--tbz-text-dark) !important;
    border: 1px solid var(--tbz-border);
}

html.dark .text-muted {
    color: var(--tbz-text-muted) !important;
}

html.dark .tbz-sticky-savebar {
    background: var(--tbz-inset-bg);
    box-shadow: 0 -4px 16px rgba(0, 0, 0, .35);
}

html.dark .tbz-auth-body {
    background: var(--tbz-body-bg);
}

html.dark .tbz-auth-main .tbz-auth-card {
    background: var(--tbz-inset-bg);
}

html.dark .tbz-main .table,
html.dark .tbz-data-table,
html.dark .table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--tbz-text-dark);
    --bs-table-border-color: var(--tbz-table-border);
    --bs-table-striped-bg: var(--tbz-row-stripe);
    --bs-table-hover-bg: var(--tbz-table-row-hover);
    --bs-table-active-bg: var(--tbz-table-row-hover);
    color: var(--tbz-text-dark);
}

html.dark .tbz-kpi-card,
html.dark .tbz-metric-row,
html.dark .module-card,
html.dark .tbz-form-panel {
    color: var(--tbz-text-dark);
}

html.dark .tbz-status-filter > .form-select {
    color: var(--tbz-text-dark);
}

html.dark .dropdown-menu {
    --bs-dropdown-bg: var(--tbz-inset-bg);
    --bs-dropdown-border-color: var(--tbz-border);
    --bs-dropdown-link-color: var(--tbz-text-dark);
    --bs-dropdown-link-hover-bg: var(--tbz-sidebar-accent);
}

html.dark .modal-content {
    background: var(--tbz-inset-bg);
    color: var(--tbz-text-dark);
    border-color: var(--tbz-border);
}

html.dark .tbz-notify-title,
html.dark .tbz-notify-message {
    color: var(--tbz-text-dark);
}

/* =============================================================
   TBZ Layout — Page Loader & Notification Popup
   (Previously inline in base.html)
   ============================================================= */

/* ── Page-loader overlay ─────────────────────────────────── */
#tbz-page-loader {
  position: fixed; inset: 0; z-index: 9998;
  display: flex; align-items: center; justify-content: center;
  background: var(--tbz-loader-overlay);
  backdrop-filter: blur(3px);
  opacity: 0; pointer-events: none;
  transition: opacity .18s ease;
}
#tbz-page-loader.tbz-loader--active {
  opacity: 1; pointer-events: all;
}
.tbz-loader-ring {
  width: 3rem; height: 3rem;
  border: 3px solid var(--tbz-primary-light, #e7f6ef);
  border-top-color: var(--tbz-primary, #0f8a5f);
  border-radius: 50%;
  animation: tbz-spin .75s linear infinite;
}
.tbz-loader-content {
  display: flex; flex-direction: column; align-items: center; gap: .75rem;
}
.tbz-loader-label {
  font-size: .8125rem; font-weight: 500;
  color: var(--tbz-text-muted, #6b7280);
  letter-spacing: .01em;
}
@keyframes tbz-spin { to { transform: rotate(360deg); } }

/* ── Top progress bar ────────────────────────────────────── */
#tbz-nbar {
  position: fixed; top: 0; left: 0; height: 3px; z-index: 9999;
  width: 0%; opacity: 0;
  background: linear-gradient(90deg, var(--tbz-primary,#0f8a5f) 60%, var(--tbz-gold,#c8a415));
  transition: opacity .2s ease;
  box-shadow: 0 0 8px rgba(15,138,95,.5);
}
#tbz-nbar.tbz-nbar--run  { opacity: 1; }
#tbz-nbar.tbz-nbar--done { opacity: 0; transition: opacity .35s ease .1s; }

/* ── Notification Popup ──────────────────────────────────── */
#tbz-notify-backdrop {
  position: fixed; inset: 0; z-index: 10000;
  display: flex; align-items: center; justify-content: center;
  background: rgba(10,12,20,.42);
  backdrop-filter: blur(5px) saturate(1.15);
  -webkit-backdrop-filter: blur(5px) saturate(1.15);
  opacity: 0; pointer-events: none;
  transition: opacity .22s ease;
}
#tbz-notify-backdrop.tbz-notify--active { opacity: 1; pointer-events: all; }
.tbz-notify-card {
  background: var(--tbz-inset-bg);
  border-radius: 1.25rem;
  box-shadow: 0 28px 72px rgba(0,0,0,.22), 0 6px 20px rgba(0,0,0,.1);
  padding: 2.5rem 2rem 1.75rem;
  max-width: 380px;
  width: calc(100vw - 2.5rem);
  position: relative;
  overflow: hidden;
  text-align: center;
  transform: scale(.88);
  opacity: 0;
  transition: transform .32s cubic-bezier(.34,1.4,.64,1), opacity .24s ease;
}
#tbz-notify-backdrop.tbz-notify--active .tbz-notify-card {
  transform: scale(1); opacity: 1;
}
.tbz-notify-icon-wrap {
  width: 5.5rem; height: 5.5rem;
  border-radius: 50%;
  background: var(--tbz-kpi-icon-bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 2.25rem;
  margin: 0 auto 1.5rem;
}
.tbz-notify-title {
  font-size: 1.375rem; font-weight: 700;
  color: #111827; margin-bottom: .625rem;
}
.tbz-notify-message {
  font-size: .9375rem; color: #4b5563;
  line-height: 1.6; word-break: break-word;
  margin-bottom: 1.5rem;
}
.tbz-notify-ok-btn {
  display: inline-block;
  background: #3b82f6; color: #fff;
  border: none; border-radius: .5rem;
  padding: .55rem 2.75rem;
  font-size: .9375rem; font-weight: 500;
  cursor: pointer; letter-spacing: .01em;
  transition: background .15s ease, transform .1s ease;
}
.tbz-notify-ok-btn:hover  { background: #2563eb; }
.tbz-notify-ok-btn:active { transform: scale(.97); }

/* ── Session expiry warning modal ──────────────────────────── */
/* Backdrop — blurred overlay matching the notification popup  */
#tbz-session-modal.show {
  background: rgba(10,12,20,.42);
  backdrop-filter: blur(5px) saturate(1.15);
  -webkit-backdrop-filter: blur(5px) saturate(1.15);
}
#tbz-session-modal + .modal-backdrop { opacity: 0 !important; }

/* Dialog — same card width as .tbz-notify-card */
#tbz-session-modal .modal-dialog {
  max-width: 380px;
}

/* Card surface */
.tbz-session-modal-content {
  border: none;
  border-radius: 1.25rem;
  box-shadow: 0 28px 72px rgba(0,0,0,.22), 0 6px 20px rgba(0,0,0,.1);
  padding: 2.5rem 2rem 1.75rem;
  text-align: center;
  overflow: hidden;
}

/* Strip Bootstrap's default modal-body padding — card handles its own */
#tbz-session-modal .modal-body { padding: 0; }

/* Icon circle — same 5.5 rem as .tbz-notify-icon-wrap, amber tint for urgency */
.tbz-session-icon {
  width: 5.5rem; height: 5.5rem;
  border-radius: 50%;
  background: #fff8e1;
  color: #b45309;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.25rem;
  margin: 0 auto 1.5rem;
}

/* Title — matches .tbz-notify-title */
#tbz-session-modal-title {
  font-size: 1.375rem !important;
  font-weight: 700 !important;
  color: #111827;
  margin-bottom: .625rem !important;
}

/* Body copy — matches .tbz-notify-message */
#tbz-session-modal .modal-body p {
  font-size: .9375rem;
  color: #4b5563;
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

/* Countdown number */
.tbz-session-countdown-value {
  display: inline-block;
  font-size: 2rem;
  font-weight: 700;
  color: var(--tbz-primary, #0f8a5f);
  line-height: 1;
  margin: .125rem 0;
}

/* Primary action button — matches .tbz-notify-ok-btn */
#tbz-session-extend {
  display: block; width: 100%;
  background: #3b82f6; color: #fff;
  border: none; border-radius: .5rem;
  padding: .6rem 1.5rem;
  font-size: .9375rem; font-weight: 500;
  cursor: pointer; letter-spacing: .01em;
  transition: background .15s ease, transform .1s ease;
}
#tbz-session-extend:hover  { background: #2563eb; }
#tbz-session-extend:active { transform: scale(.97); }

/* Secondary action button */
#tbz-session-signout {
  display: block; width: 100%;
  background: transparent; color: #6b7280;
  border: 1px solid #e5e7eb; border-radius: .5rem;
  padding: .6rem 1.5rem;
  font-size: .875rem; font-weight: 400;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
#tbz-session-signout:hover { background: #f9fafb; color: #374151; }

.tbz-checkbox-col { width: 2.5rem; }
.tbz-bulk-checkbox {
  width: 1.25rem;
  height: 1.25rem;
  cursor: pointer;
}

/* ══════════════════════════════════════════════════════════════════
   Report hub (/reports/) — searchable, categorized report launcher
   ══════════════════════════════════════════════════════════════════ */
.rh-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: 1.1rem;
}
.rh-search {
    position: relative;
    flex: 1 1 320px;
    max-width: 480px;
}
.rh-search .bi {
    position: absolute;
    left: .8rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--tbz-text-muted);
    pointer-events: none;
}
.rh-search input {
    padding-left: 2.2rem;
}
.rh-count {
    font-size: .8rem;
    color: var(--tbz-text-muted);
    white-space: nowrap;
}

.rh-section-head {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin: 1.4rem 0 .7rem;
    padding-bottom: .4rem;
    border-bottom: 1px solid var(--tbz-border);
}
.rh-section-head .rh-sec-icon {
    color: var(--tbz-primary);
    font-size: 1rem;
}
.rh-section-head h3 {
    font-size: .92rem;
    font-weight: 700;
    letter-spacing: -.01em;
    color: var(--tbz-text-dark);
    margin: 0;
}
.rh-section-head .rh-sec-count {
    font-size: .72rem;
    font-weight: 600;
    color: var(--tbz-text-muted);
    background: var(--tbz-primary-light);
    border-radius: 20px;
    padding: .08rem .55rem;
}

.rh-card {
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: .6rem;
    padding: .95rem 1rem;
    border: 1px solid var(--tbz-border);
    border-radius: 12px;
    background: var(--tbz-inset-bg);
    color: var(--tbz-text-dark);
    transition: border-color .14s, box-shadow .14s, transform .1s;
}
.rh-card:hover {
    border-color: color-mix(in srgb, var(--tbz-primary) 35%, var(--tbz-border));
    box-shadow: var(--tbz-shadow-card-hover);
    transform: translateY(-2px);
}
.rh-card-top {
    display: flex;
    align-items: flex-start;
    gap: .65rem;
}
.rh-icon {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: var(--tbz-primary-light);
    color: var(--tbz-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}
.rh-title {
    font-size: .9rem;
    font-weight: 700;
    line-height: 1.25;
    color: var(--tbz-text-dark);
}
.rh-desc {
    font-size: .8rem;
    color: var(--tbz-text-muted);
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.rh-inputs {
    display: flex;
    flex-wrap: wrap;
    gap: .3rem;
}
.rh-inputs .badge {
    font-size: .68rem;
    font-weight: 500;
    background: var(--tbz-surface-muted) !important;
    color: var(--tbz-text-muted) !important;
    border: 1px solid var(--tbz-border);
}
.rh-card-foot {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    padding-top: .2rem;
}
.rh-export {
    font-size: .72rem;
    display: inline-flex;
    align-items: center;
    gap: .3rem;
}
.rh-empty {
    display: none;
    text-align: center;
    color: var(--tbz-text-muted);
    padding: 2.5rem 1rem;
}
.rh-empty .bi {
    font-size: 1.6rem;
}

/* Shared report layouts + chart wrappers (Report Center + report pages) */
@media (min-width: 992px) {
    .tbz-layout-4-1 {
        display: flex;
        flex-wrap: nowrap;
    }

    .tbz-layout-4-1 > .tbz-layout-4-1__main {
        flex: 4 1 0;
        max-width: none;
        width: auto;
    }

    .tbz-layout-4-1 > .tbz-layout-4-1__side {
        flex: 1 1 0;
        max-width: none;
        width: auto;
    }
}

.tbz-chart-wrap {
    position: relative;
    min-height: 280px;
}

.tbz-chart-wrap--h220 { height: 220px; min-height: 220px; }
.tbz-chart-wrap--h260 { height: 260px; min-height: 260px; }
.tbz-chart-wrap--h280 { height: 280px; min-height: 280px; }
.tbz-chart-wrap--h300 { height: 300px; min-height: 300px; }
.tbz-chart-wrap--h360 { height: 360px; min-height: 360px; }
.tbz-chart-wrap--min260 { min-height: 260px; }
.tbz-chart-wrap--min280 { min-height: 280px; }
.tbz-chart-wrap--min300 { min-height: 300px; }
.tbz-chart-wrap--min340 { min-height: 340px; }
.tbz-chart-wrap--donut {
    width: 100%;
    max-width: 400px;
    margin-inline: auto;
}

.tbz-report-chart-row { min-height: 280px; }
.tbz-report-chart-row--300 { min-height: 300px; }
.tbz-report-chart-row--320 { min-height: 320px; }
.tbz-report-chart-row--360 { min-height: 360px; }

.tbz-table-scroll-y {
    overflow-y: auto;
}

.tbz-kpi-unit {
    font-size: 1rem;
    font-weight: 400;
}

.tbz-report-thead-accent {
    background: color-mix(in srgb, var(--tbz-primary) 18%, transparent);
}

html.dark .tbz-report-thead-accent {
    background: color-mix(in srgb, var(--tbz-primary) 22%, var(--tbz-surface-muted));
}

.tbz-report-filter-bar .form-select,
.tbz-report-filter-bar .form-control {
    width: auto;
    min-width: 120px;
}

.tbz-report-filter-bar .form-select[name="province"],
.tbz-report-filter-bar .form-select[name="district"] {
    min-width: 140px;
}

/* ══════════════════════════════════════════════════════════════════
   Grower map — filters + layer toggle overlaid on the map so the
   full component height is usable map area (cluster mode).
   ══════════════════════════════════════════════════════════════════ */
.tbz-map-wrap {
    position: relative;
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
}
.tbz-map-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}
.tbz-map-controls {
    position: absolute;
    top: 10px;
    z-index: 700;
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}
.tbz-map-controls--left {
    left: 10px;
    /* keep clear of the right-hand layer toggle on narrow widths */
    max-width: calc(100% - 140px);
}
.tbz-map-controls--right {
    right: 10px;
}
.tbz-map-controls .form-select {
    background-color: #fff;
    box-shadow: 0 1px 5px rgba(0, 0, 0, .22);
}
.tbz-map-controls .btn-group {
    background: #fff;
    border-radius: 7px;
    box-shadow: 0 1px 5px rgba(0, 0, 0, .22);
}

/* ══════════════════════════════════════════════════════════════════
   Dashboard analytics charts (Chart.js canvases)
   ══════════════════════════════════════════════════════════════════ */
.tbz-chart-box {
    position: relative;
    height: 300px;
    width: 100%;
}
.tbz-chart-empty {
    height: 300px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    color: var(--tbz-text-muted);
    font-size: .85rem;
}
.tbz-chart-empty .bi { font-size: 1.6rem; opacity: .6; }

/* ══════════════════════════════════════════════════════════════════
   Dashboard "Quick Access" — vertical module launcher list
   ══════════════════════════════════════════════════════════════════ */
.module-list {
    display: flex;
    flex-direction: column;
}
.module-list-item {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .6rem .55rem;
    border-radius: 10px;
    text-decoration: none;
    color: var(--tbz-text-dark);
    transition: background-color .14s ease;
}
.module-list-item + .module-list-item { margin-top: .15rem; }
.module-list-item:hover { background: var(--mc-bg1); color: var(--tbz-text-dark); }
.module-list-item .mc-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--mc-bg1);
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
    transition: background-color .14s ease;
}
.module-list-item:hover .mc-icon { background: var(--mc-bg2); }
.module-list-item .mc-body { flex: 1 1 auto; min-width: 0; }
.module-list-item .mc-name { font-weight: 700; font-size: .86rem; line-height: 1.2; }
.module-list-item .mc-desc {
    font-size: .72rem;
    color: var(--tbz-text-muted);
    margin-top: .05rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Marketing insight board (3-panel analytics) */
.tbz-insight-board {
    overflow: hidden;
}

.tbz-insight-board-row > .tbz-insight-panel + .tbz-insight-panel {
    border-top: 1px solid var(--tbz-border);
}

@media (min-width: 992px) {
    .tbz-insight-board-row > .tbz-insight-panel + .tbz-insight-panel {
        border-top: 0;
        border-left: 1px solid var(--tbz-border);
    }
}

.tbz-insight-panel-inner {
    padding: 1.15rem 1.25rem 1.25rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: .9rem;
}

.tbz-insight-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
}

.tbz-insight-title {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    font-size: .92rem;
    font-weight: 600;
    color: var(--tbz-text-dark);
}

.tbz-insight-title i {
    color: var(--tbz-text-muted);
    font-size: .95rem;
}

.tbz-insight-link {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    font-size: .78rem;
    color: var(--tbz-text-muted);
    text-decoration: none;
    white-space: nowrap;
}

.tbz-insight-link:hover {
    color: var(--tbz-primary);
}

.tbz-insight-donut-layout {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.tbz-insight-donut-wrap {
    position: relative;
    width: 9.5rem;
    height: 9.5rem;
    flex-shrink: 0;
}

.tbz-insight-donut-wrap canvas {
    width: 100% !important;
    height: 100% !important;
}

.tbz-insight-donut-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    text-align: center;
}

.tbz-insight-donut-value {
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--tbz-text-dark);
}

.tbz-insight-donut-label {
    font-size: .72rem;
    color: var(--tbz-text-muted);
}

.tbz-insight-legend {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: .55rem;
    flex: 1;
    min-width: 0;
}

.tbz-insight-legend li {
    display: grid;
    grid-template-columns: .55rem 1fr auto;
    align-items: center;
    gap: .55rem;
}

.tbz-insight-swatch {
    width: .55rem;
    height: 1rem;
    border-radius: 2px;
}

.tbz-insight-legend-label {
    font-size: .82rem;
    color: var(--tbz-text-muted);
}

.tbz-insight-legend-value {
    font-size: .88rem;
    font-weight: 650;
    color: var(--tbz-text-dark);
    font-variant-numeric: tabular-nums;
}

.tbz-insight-metric-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .75rem;
}

.tbz-insight-metric-value {
    font-size: 1.85rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--tbz-text-dark);
}

.tbz-insight-metric-sub {
    margin-top: .2rem;
    font-size: .78rem;
    color: var(--tbz-text-muted);
}

.tbz-insight-trend {
    display: inline-flex;
    align-items: center;
    gap: .2rem;
    padding: .2rem .55rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 600;
    background: color-mix(in srgb, #94a3b8 16%, transparent);
    color: #475569;
}

.tbz-insight-trend.is-up {
    background: color-mix(in srgb, #22c55e 16%, transparent);
    color: #15803d;
}

.tbz-insight-trend.is-down {
    background: color-mix(in srgb, #ef4444 14%, transparent);
    color: #b91c1c;
}

.tbz-insight-area-wrap {
    height: 7.5rem;
    margin-top: auto;
}

.tbz-insight-area-wrap canvas {
    width: 100% !important;
    height: 100% !important;
}

.tbz-insight-kpi-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .75rem;
}

.tbz-insight-kpi-label {
    font-size: .72rem;
    color: var(--tbz-text-muted);
    margin-bottom: .15rem;
}

.tbz-insight-kpi-value {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--tbz-text-dark);
    font-variant-numeric: tabular-nums;
}

.tbz-insight-mix-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .5rem;
    margin-bottom: .4rem;
}

.tbz-insight-mix-ratio {
    font-size: .75rem;
    color: var(--tbz-text-muted);
    font-variant-numeric: tabular-nums;
}

.tbz-insight-mix-bar {
    display: flex;
    height: .55rem;
    border-radius: 999px;
    overflow: hidden;
    background: color-mix(in srgb, var(--tbz-border) 70%, transparent);
}

.tbz-insight-mix-bought {
    background: #1f2937;
}

.tbz-insight-mix-rejected {
    background: #d1d5db;
}

.tbz-insight-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.tbz-insight-dot {
    display: inline-block;
    width: .55rem;
    height: .55rem;
    border-radius: 50%;
    margin-right: .35rem;
    vertical-align: middle;
}

.tbz-insight-dot.is-dark { background: #1f2937; }
.tbz-insight-dot.is-light { background: #d1d5db; }

.tbz-insight-split-label {
    font-size: .75rem;
    color: var(--tbz-text-muted);
}

.tbz-insight-split-value {
    margin-top: .2rem;
    font-size: 1rem;
    font-weight: 700;
    color: var(--tbz-text-dark);
    font-variant-numeric: tabular-nums;
}

.tbz-insight-footnote {
    margin-top: auto;
    font-size: .72rem;
    color: var(--tbz-text-muted);
}

html.dark .tbz-insight-mix-bought { background: #e5e7eb; }
html.dark .tbz-insight-mix-rejected { background: #4b5563; }
html.dark .tbz-insight-dot.is-dark { background: #e5e7eb; }
html.dark .tbz-insight-dot.is-light { background: #4b5563; }

/* Licensing dashboard insight panels */
.tbz-lic-panel {
    position: relative;
    height: 100%;
    min-height: 22rem;
    display: flex;
    flex-direction: column;
    gap: .9rem;
    padding: 1rem 1.05rem 1.1rem;
    border: 1px solid var(--tbz-border);
    border-radius: calc(var(--tbz-radius) + .1rem);
    background: var(--tbz-surface, #fff);
}

.tbz-lic-panel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
}

.tbz-lic-panel__title {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .03em;
    color: var(--tbz-text-muted);
}

.tbz-lic-panel__title i {
    font-size: .8rem;
}

.tbz-lic-panel__meta {
    font-size: .72rem;
    color: var(--tbz-text-muted);
}

.tbz-lic-mix {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: .55rem;
    margin-top: auto;
}

.tbz-lic-mix__row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: .75rem;
}

.tbz-lic-mix__label {
    font-size: .84rem;
    color: var(--tbz-text-dark);
    font-weight: 500;
}

.tbz-lic-mix__value {
    font-size: .84rem;
    color: var(--tbz-text-muted);
    font-variant-numeric: tabular-nums;
}

.tbz-lic-mix__bar {
    display: flex;
    gap: 2px;
    height: .28rem;
    margin-top: .28rem;
    transition: height .15s ease;
}

.tbz-lic-mix__item:hover .tbz-lic-mix__bar {
    height: .7rem;
}

.tbz-lic-mix__seg {
    flex: 1 1 0;
    border-radius: 1.5px;
    background: color-mix(in srgb, var(--tbz-text-muted) 18%, transparent);
}

.tbz-lic-mix__seg.is-on {
    background: #64748b;
}

.tbz-lic-mix__empty {
    color: var(--tbz-text-muted);
    font-size: .84rem;
    padding: 1rem 0;
}

.tbz-lic-team {
    display: grid;
    gap: .9rem;
    margin-top: auto;
}

.tbz-lic-team__avatars {
    display: flex;
    padding-left: .35rem;
}

.tbz-lic-team__avatar {
    width: 2.55rem;
    height: 2.55rem;
    border-radius: 50%;
    margin-left: -.45rem;
    border: 2px solid var(--tbz-surface, #fff);
    background: #e5e7eb;
    color: #475569;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    font-size: .72rem;
    font-weight: 700;
}

.tbz-lic-team__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tbz-lic-team__avatars--ghost .tbz-lic-team__avatar {
    filter: grayscale(1);
    opacity: .7;
}

.tbz-lic-team__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: .55rem;
}

.tbz-lic-team__list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
}

.tbz-lic-team__name {
    font-size: .84rem;
    font-weight: 600;
    color: var(--tbz-text-dark);
    line-height: 1.2;
}

.tbz-lic-team__sub {
    font-size: .72rem;
    color: var(--tbz-text-muted);
}

.tbz-lic-team__count {
    font-size: .84rem;
    font-weight: 600;
    color: var(--tbz-text-muted);
    font-variant-numeric: tabular-nums;
}

.tbz-lic-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: .55rem;
    padding: .5rem 0 0;
}

.tbz-lic-empty__title {
    font-size: .95rem;
    font-weight: 700;
    color: var(--tbz-text-dark);
}

.tbz-lic-empty__desc {
    font-size: .78rem;
    color: var(--tbz-text-muted);
    max-width: 14rem;
}

.tbz-lic-heat__stats {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .75rem;
}

.tbz-lic-heat__total {
    font-size: 1.55rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--tbz-text-dark);
    font-variant-numeric: tabular-nums;
}

.tbz-lic-heat__peak {
    margin-top: .2rem;
    font-size: .72rem;
    color: var(--tbz-text-muted);
}

.tbz-lic-heat__avg-val {
    font-size: .9rem;
    font-weight: 650;
    color: var(--tbz-text-dark);
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.tbz-lic-heat__avg-label {
    font-size: .7rem;
    color: var(--tbz-text-muted);
    text-align: right;
}

.tbz-lic-heat {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: 1fr auto;
    gap: .35rem .45rem;
    margin: 0;
    min-height: 8.5rem;
    flex: 1;
}

.tbz-lic-heat__days {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    font-size: .62rem;
    color: var(--tbz-text-muted);
    line-height: 1;
}

.tbz-lic-heat__grid {
    display: grid;
    grid-template-columns: repeat(24, minmax(0, 1fr));
    grid-template-rows: repeat(7, minmax(0, 1fr));
    gap: 2px;
    min-height: 7.5rem;
}

.tbz-lic-heat__cell {
    display: block;
    border-radius: 1.2px;
    background: color-mix(in srgb, #64748b calc(var(--heat-opacity) * 100%), transparent);
    min-height: .45rem;
}

.tbz-lic-heat__cell.is-peak {
    outline: 1.5px solid #475569;
    outline-offset: 0;
}

.tbz-lic-heat__hours {
    grid-column: 2;
    display: flex;
    justify-content: space-between;
    font-size: .62rem;
    color: var(--tbz-text-muted);
    font-variant-numeric: tabular-nums;
}

.tbz-lic-heat__legend {
    display: flex;
    align-items: center;
    gap: .4rem;
    font-size: .65rem;
    color: var(--tbz-text-muted);
}

.tbz-lic-heat__scale {
    display: inline-flex;
    gap: 2px;
}

.tbz-lic-heat__scale i {
    width: .45rem;
    height: .45rem;
    border-radius: 1.2px;
    background: color-mix(in srgb, #64748b calc(var(--heat-opacity) * 100%), transparent);
}

.tbz-lic-actions {
    display: grid;
    gap: .15rem;
    margin-top: .15rem;
}

.tbz-lic-action {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .55rem .35rem;
    border-radius: .45rem;
    text-decoration: none;
    color: inherit;
    transition: background-color .12s ease;
}

.tbz-lic-action:hover {
    background: color-mix(in srgb, var(--tbz-border) 45%, transparent);
    color: inherit;
}

.tbz-lic-action__icon {
    width: 1.7rem;
    height: 1.7rem;
    border-radius: .4rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--tbz-border) 55%, transparent);
    color: var(--tbz-text-muted);
    flex-shrink: 0;
    font-size: .85rem;
}

.tbz-lic-action__body {
    flex: 1 1 auto;
    min-width: 0;
    display: grid;
    gap: .05rem;
}

.tbz-lic-action__title {
    font-size: .86rem;
    font-weight: 600;
    color: var(--tbz-text-dark);
    line-height: 1.2;
}

.tbz-lic-action__desc {
    font-size: .72rem;
    color: var(--tbz-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tbz-lic-action__chev {
    color: var(--tbz-text-muted);
    font-size: .85rem;
    flex-shrink: 0;
}

html.dark .tbz-lic-panel {
    background: var(--tbz-surface);
}

html.dark .tbz-lic-mix__seg.is-on,
html.dark .tbz-lic-heat__cell.is-peak {
    outline-color: #cbd5e1;
}

html.dark .tbz-lic-mix__seg.is-on {
    background: #94a3b8;
}

html.dark .tbz-lic-team__avatar {
    border-color: var(--tbz-surface);
}

/* Licensing analytics — issuance / expiry analysis cards */
.tbz-lic-analysis-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: .75rem;
    min-height: 100%;
    padding: 1rem 1rem 1.1rem;
    border: 1px solid var(--tbz-border, #e5e7eb);
    background: var(--tbz-surface, #fff);
    overflow: hidden;
}

.tbz-lic-analysis-mark {
    position: absolute;
    z-index: 1;
    width: 12px;
    height: 12px;
    pointer-events: none;
    color: var(--tbz-text-muted, #9ca3af);
}
.tbz-lic-analysis-mark::before,
.tbz-lic-analysis-mark::after {
    content: "";
    position: absolute;
    background: currentColor;
    opacity: .55;
}
.tbz-lic-analysis-mark::before {
    left: 50%;
    top: 0;
    width: 1px;
    height: 100%;
    transform: translateX(-50%);
}
.tbz-lic-analysis-mark::after {
    top: 50%;
    left: 0;
    width: 100%;
    height: 1px;
    transform: translateY(-50%);
}
.tbz-lic-analysis-mark--tl { top: 0; left: 0; transform: translate(-50%, -50%); }
.tbz-lic-analysis-mark--tr { top: 0; right: 0; transform: translate(50%, -50%); }
.tbz-lic-analysis-mark--bl { bottom: 0; left: 0; transform: translate(-50%, 50%); }
.tbz-lic-analysis-mark--br { bottom: 0; right: 0; transform: translate(50%, 50%); }

.tbz-lic-analysis-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}
.tbz-lic-analysis-head--compact {
    align-items: center;
}

.tbz-lic-analysis-metric {
    display: flex;
    flex-direction: column;
    gap: .2rem;
    min-width: 0;
}

.tbz-lic-analysis-value {
    font-size: 1.65rem;
    font-weight: 650;
    line-height: 1.15;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

.tbz-lic-analysis-sub {
    font-size: .75rem;
    color: var(--tbz-text-muted, #6b7280);
}

.tbz-lic-analysis-legend {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem 1rem;
    list-style: none;
    margin: .55rem 0 0;
    padding: 0;
    font-size: .75rem;
    color: var(--tbz-text-muted, #6b7280);
}
.tbz-lic-analysis-legend li {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
}
.tbz-lic-analysis-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    flex-shrink: 0;
}

.tbz-lic-analysis-controls {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: .45rem;
    flex-shrink: 0;
}

.tbz-lic-range {
    display: inline-flex;
    border: 1px solid var(--tbz-border, #e5e7eb);
    overflow: hidden;
}
.tbz-lic-range__btn {
    padding: .28rem .55rem;
    font-size: .72rem;
    font-weight: 600;
    color: var(--tbz-text-muted, #6b7280);
    text-decoration: none;
    border-left: 1px solid var(--tbz-border, #e5e7eb);
    background: transparent;
    line-height: 1.2;
}
.tbz-lic-range__btn:first-child { border-left: 0; }
.tbz-lic-range__btn:hover {
    background: var(--tbz-muted-bg, #f3f4f6);
    color: var(--tbz-text, #111);
}
.tbz-lic-range__btn.is-active {
    background: var(--tbz-muted-bg, #f3f4f6);
    color: var(--tbz-text, #111);
}

.tbz-lic-analysis-delta {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    font-size: .75rem;
    font-variant-numeric: tabular-nums;
}
.tbz-lic-analysis-delta.is-up { color: #059669; }
.tbz-lic-analysis-delta.is-down { color: #dc2626; }
.tbz-lic-analysis-delta-note {
    color: var(--tbz-text-muted, #6b7280);
    font-weight: 400;
}

.tbz-lic-analysis-chart {
    position: relative;
    width: 100%;
    height: 280px;
}
.tbz-lic-analysis-chart--tall {
    height: 300px;
    margin-top: auto;
}
.tbz-lic-analysis-chart canvas {
    width: 100% !important;
    height: 100% !important;
}

html.dark .tbz-lic-analysis-card {
    background: var(--tbz-surface);
}
html.dark .tbz-lic-range__btn.is-active,
html.dark .tbz-lic-range__btn:hover {
    background: rgba(255,255,255,.06);
}

/* Telemetry — version distribution pie panel */
.tbz-pie-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 100%;
    overflow: hidden;
    border: 1px solid var(--tbz-border, #e5e7eb);
    background: var(--tbz-surface, #fff);
}
.tbz-pie-panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid var(--tbz-border, #e5e7eb);
}
.tbz-pie-panel-value {
    font-size: 1.5rem;
    font-weight: 650;
    line-height: 1.15;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}
.tbz-pie-panel-sub {
    display: block;
    margin-top: .2rem;
    font-size: .75rem;
    color: var(--tbz-text-muted, #6b7280);
}
.tbz-pie-panel-delta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: .2rem;
    font-size: .75rem;
    flex-shrink: 0;
}
.tbz-pie-panel-delta-row {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    font-variant-numeric: tabular-nums;
}
.tbz-pie-panel-delta.is-up .tbz-pie-panel-delta-row { color: #059669; }
.tbz-pie-panel-delta.is-down .tbz-pie-panel-delta-row { color: #dc2626; }
.tbz-pie-panel-delta-note {
    color: var(--tbz-text-muted, #6b7280);
    text-align: right;
}
.tbz-pie-panel-body {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
    min-height: 0;
    flex: 1;
}
@media (min-width: 576px) {
    .tbz-pie-panel-body {
        grid-template-columns: 0.55fr 0.45fr;
        min-height: 16rem;
    }
}
.tbz-pie-panel-chart {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: .75rem;
}
.tbz-pie-panel-chart-inner {
    position: relative;
    width: 100%;
    max-width: 16rem;
    aspect-ratio: 1 / 1;
}
.tbz-pie-panel-chart-inner canvas {
    width: 100% !important;
    height: 100% !important;
}
.tbz-pie-panel-legend {
    list-style: none;
    margin: 0;
    padding: 1rem 1.1rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: .85rem;
}
.tbz-pie-panel-legend-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    font-size: .875rem;
}
.tbz-pie-panel-legend-label {
    display: flex;
    align-items: center;
    gap: .65rem;
    min-width: 0;
}
.tbz-pie-panel-swatch {
    width: .625rem;
    height: .625rem;
    border-radius: 2px;
    flex-shrink: 0;
}
.tbz-pie-panel-legend-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--tbz-text, #111);
}
.tbz-pie-panel-legend-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: .75rem;
    color: var(--tbz-text-muted, #6b7280);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}
.tbz-pie-panel-legend-count {
    min-width: 2ch;
    text-align: right;
}
.tbz-pie-panel-empty {
    padding: 2rem 1rem;
}

html.dark .tbz-pie-panel {
    background: var(--tbz-surface);
}

/* Telemetry — activity / critical-error list card */
.tbz-activity-card {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    border: 1px solid var(--tbz-border, #e5e7eb);
    background: var(--tbz-surface, #fff);
    overflow: hidden;
}
.tbz-activity-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .9rem 1.1rem;
    border-bottom: 1px solid var(--tbz-border, #e5e7eb);
    background: color-mix(in srgb, var(--tbz-muted-bg, #f3f4f6) 55%, transparent);
}
.tbz-activity-card__title {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    font-size: .95rem;
    font-weight: 600;
    color: var(--tbz-text, #111);
}
.tbz-activity-card__title .bi {
    color: var(--tbz-primary, #0f8a5f);
    font-size: 1rem;
}
.tbz-activity-card__link {
    font-size: .8rem;
    color: var(--tbz-text-muted, #6b7280);
    white-space: nowrap;
}
.tbz-activity-card__body {
    display: flex;
    flex-direction: column;
}
.tbz-activity-row {
    display: grid;
    grid-template-columns: minmax(7rem, 1.1fr) minmax(5.5rem, auto) minmax(10rem, 2.2fr) auto minmax(4.5rem, auto) 2rem;
    align-items: center;
    gap: .85rem 1rem;
    padding: .95rem 1.1rem;
    border-bottom: 1px solid var(--tbz-border, #e5e7eb);
}
.tbz-activity-row:last-child {
    border-bottom: 0;
}
.tbz-activity-row:hover {
    background: color-mix(in srgb, var(--tbz-primary, #0f8a5f) 4%, transparent);
}
.tbz-activity-row__id,
.tbz-activity-row__detail {
    display: flex;
    flex-direction: column;
    gap: .15rem;
    min-width: 0;
}
.tbz-activity-row__primary {
    font-weight: 650;
    font-size: .9rem;
    color: var(--tbz-text, #111);
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tbz-activity-row__secondary {
    font-size: .75rem;
    color: var(--tbz-text-muted, #6b7280);
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tbz-activity-row__user {
    color: inherit;
    text-decoration: none;
}
.tbz-activity-row__user:hover {
    color: var(--tbz-primary, #0f8a5f);
}
.tbz-activity-row__detail-top {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    min-width: 0;
    font-size: .875rem;
    font-weight: 600;
    color: var(--tbz-text, #111);
}
.tbz-activity-row__detail-top > span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tbz-activity-row__detail-top .bi {
    color: var(--tbz-text-muted, #6b7280);
    flex-shrink: 0;
}
.tbz-activity-row__date {
    font-size: .875rem;
    font-weight: 500;
    color: var(--tbz-text-muted, #6b7280);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.tbz-activity-status {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-size: .8125rem;
    font-weight: 500;
    color: var(--tbz-text, #111);
    white-space: nowrap;
}
.tbz-activity-status__dot {
    width: .5rem;
    height: .5rem;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--tbz-text-muted, #9ca3af);
}
.tbz-activity-status.is-critical .tbz-activity-status__dot { background: #dc2626; }
.tbz-activity-status.is-error .tbz-activity-status__dot { background: #d97706; }
.tbz-activity-status.is-version .tbz-activity-status__dot { background: var(--tbz-primary, #0f8a5f); }
.tbz-activity-status.is-active .tbz-activity-status__dot { background: #16a34a; }
.tbz-activity-status.is-healthy .tbz-activity-status__dot { background: #16a34a; }
.tbz-activity-status.is-unstable .tbz-activity-status__dot { background: #d97706; }
.tbz-activity-status.is-inoperative .tbz-activity-status__dot { background: #9ca3af; }
.tbz-activity-status.is-inactive .tbz-activity-status__dot { background: #9ca3af; }
.tbz-activity-status.is-label-production .tbz-activity-status__dot { background: #16a34a; }
.tbz-activity-status.is-label-sandbox .tbz-activity-status__dot { background: #0ea5e9; }
.tbz-activity-status.is-label-staging .tbz-activity-status__dot { background: #d97706; }
.tbz-activity-status.is-muted {
    color: var(--tbz-text-muted, #6b7280);
}
.tbz-activity-row__actions {
    display: flex;
    justify-content: flex-end;
}
.tbz-activity-row__menu {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: .35rem;
    color: var(--tbz-text-muted, #6b7280);
    text-decoration: none;
}
.tbz-activity-row__menu:hover {
    background: color-mix(in srgb, var(--tbz-primary, #0f8a5f) 10%, transparent);
    color: var(--tbz-primary, #0f8a5f);
}
.tbz-activity-row__menu.is-disabled {
    opacity: .35;
    pointer-events: none;
}

@media (max-width: 991.98px) {
    .tbz-activity-row {
        grid-template-columns: 1fr auto auto;
        grid-template-areas:
            "id status actions"
            "detail detail detail"
            "date meta meta";
        gap: .45rem .75rem;
    }
    .tbz-activity-row__id { grid-area: id; }
    .tbz-activity-row__status { grid-area: status; }
    .tbz-activity-row__detail { grid-area: detail; }
    .tbz-activity-row__date { grid-area: date; }
    .tbz-activity-row__meta { grid-area: meta; justify-self: end; }
    .tbz-activity-row__actions { grid-area: actions; }
}

html.dark .tbz-activity-card {
    background: var(--tbz-surface);
}
html.dark .tbz-activity-card__head {
    background: rgba(255, 255, 255, .03);
}

/* Shared Grower dashboard analysis cards (Grower Management + performance reports). */
.tbz-grower-dash-row .content-card { height: 100%; }
.tbz-grower-dash-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .85rem 1rem;
    border-bottom: 1px solid var(--tbz-border, #e9ecef);
}
.tbz-grower-dash-head__title {
    display: flex;
    align-items: center;
    gap: .45rem;
    font-weight: 600;
    font-size: .9rem;
    margin: 0;
}
.tbz-grower-dash-head__link {
    font-size: .78rem;
    color: var(--tbz-text-muted);
    text-decoration: none;
    white-space: nowrap;
}
.tbz-grower-dash-head__link:hover { color: var(--tbz-green, #0f8a5f); }
.tbz-grower-province-layout {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    min-height: 220px;
    min-width: 0;
}
.tbz-grower-province-chart {
    position: relative;
    width: 150px;
    height: 150px;
    min-width: 150px;
    max-width: 150px;
    flex: 0 0 150px;
    overflow: hidden;
}
.tbz-grower-province-chart canvas {
    display: block;
    width: 150px !important;
    height: 150px !important;
    max-width: 100%;
    max-height: 100%;
}
.tbz-grower-province-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    pointer-events: none;
    line-height: 1.15;
}
.tbz-grower-province-center strong { font-size: 1.05rem; color: var(--tbz-text-dark); }
.tbz-grower-province-center span { font-size: .72rem; color: var(--tbz-text-muted); }
.tbz-grower-province-legend {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: .55rem;
    min-width: 0;
}
.tbz-grower-province-legend__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    font-size: .82rem;
}
.tbz-grower-province-legend__label {
    display: flex;
    align-items: center;
    gap: .45rem;
    min-width: 0;
}
.tbz-grower-province-legend__swatch {
    width: 4px;
    height: 18px;
    border-radius: 2px;
    flex-shrink: 0;
}

@media (max-width: 575.98px) {
    .tbz-grower-province-layout {
        flex-direction: column;
        align-items: center;
    }

    .tbz-grower-province-legend {
        width: 100%;
    }
}

.tbz-grower-daily-kpi { padding: 1rem 1rem .35rem; }
.tbz-grower-daily-kpi__value {
    font-size: 1.85rem;
    font-weight: 700;
    line-height: 1;
    color: var(--tbz-text-dark);
}
.tbz-grower-daily-kpi__sub {
    font-size: .78rem;
    color: var(--tbz-text-muted);
    margin-top: .2rem;
}
.tbz-grower-daily-kpi__trend {
    display: inline-flex;
    align-items: center;
    gap: .2rem;
    margin-top: .45rem;
    padding: .12rem .45rem;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 600;
    background: rgba(15, 138, 95, .12);
    color: #0f8a5f;
}
.tbz-grower-daily-kpi__trend.is-down {
    background: rgba(220, 53, 69, .1);
    color: #dc3545;
}
.tbz-grower-daily-chart { position: relative; height: 120px; padding: 0 1rem 1rem; }
.tbz-grower-snapshot-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .75rem;
    padding: 1rem;
    border-bottom: 1px solid var(--tbz-border, #e9ecef);
}
.tbz-grower-snapshot-metrics__label {
    font-size: .72rem;
    color: var(--tbz-text-muted);
    margin-bottom: .15rem;
}
.tbz-grower-snapshot-metrics__value {
    font-size: 1rem;
    font-weight: 700;
    color: var(--tbz-text-dark);
}
.tbz-grower-snapshot-bar-wrap { padding: .85rem 1rem .35rem; }
.tbz-grower-snapshot-bar-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: .78rem;
    color: var(--tbz-text-muted);
    margin-bottom: .45rem;
}
.tbz-grower-snapshot-bar {
    display: flex;
    height: 10px;
    border-radius: 999px;
    overflow: hidden;
    background: #ececec;
}
.tbz-grower-snapshot-bar__self { background: rgba(15, 138, 95, .85); }
.tbz-grower-snapshot-bar__sponsored { background: rgba(180, 180, 180, .75); }
.tbz-quality-approved { background: rgba(15, 138, 95, .85); }
.tbz-quality-pending { background: rgba(220, 150, 30, .75); }
.tbz-quality-returned { background: rgba(30, 105, 180, .72); }
.tbz-quality-rejected { background: rgba(220, 53, 69, .72); }
.tbz-grower-snapshot-foot {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .75rem;
    padding: .85rem 1rem 1rem;
}
.tbz-grower-snapshot-foot__item { font-size: .78rem; color: var(--tbz-text-muted); }
.tbz-grower-snapshot-foot__item strong {
    display: block;
    font-size: .95rem;
    color: var(--tbz-text-dark);
    margin-top: .1rem;
}
.tbz-grower-snapshot-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: .35rem;
    vertical-align: middle;
}
