/* ============================================================
   Business Tracker — Shared Stylesheet
   All sub-pages: Dashboard, Pipeline, Listings, Buyers, Sales,
   Leads, Appointments, Sources, Pending Deals, Settings.

   Sits on Clarify's light tool-page theme (body.tool-page).
   Uses global design tokens from styles.css where possible;
   tracker-specific tokens are namespaced --bt-*.

   Canadian spelling throughout (colour, neighbourhood, centre).
   ============================================================ */

/* ---------- Tokens ---------- */
:root {
    /* Tracker-specific colour palette */
    --bt-primary: #2563eb;
    --bt-primary-hover: #1d4ed8;
    --bt-primary-soft: rgba(37, 99, 235, 0.08);
    --bt-primary-border: rgba(37, 99, 235, 0.25);

    --bt-success: #16a34a;
    --bt-success-soft: rgba(22, 163, 74, 0.08);
    --bt-success-border: rgba(22, 163, 74, 0.25);

    --bt-warning: #d97706;
    --bt-warning-soft: rgba(217, 119, 6, 0.08);
    --bt-warning-border: rgba(217, 119, 6, 0.25);

    --bt-danger: #dc2626;
    --bt-danger-hover: #b91c1c;
    --bt-danger-soft: rgba(220, 38, 38, 0.06);
    --bt-danger-border: rgba(220, 38, 38, 0.25);

    /* Surfaces — inherited from Clarify globals where sensible */
    --bt-sidebar-bg: #f8f9fa;
    --bt-sidebar-border: #e8e8e8;
    --bt-sidebar-width: 240px;
    --bt-sidebar-collapsed: 56px;

    /* Typography + motion — reference the global tokens */
    --bt-font: var(--font-primary, -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif);
    --bt-radius: 12px;
    --bt-radius-sm: 8px;
    --bt-radius-lg: 16px;
}


/* ============================================================
   1. Layout — flex container with sidebar + main content
   ============================================================ */

.bt-layout {
    display: flex;
    min-height: 100vh;
    font-family: var(--bt-font);
    color: var(--color-text, #0a0a0a);
    background: var(--color-bg, #ffffff);
}

.bt-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--bt-sidebar-width);
    background: var(--bt-sidebar-bg);
    border-right: 1px solid var(--bt-sidebar-border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow-y: auto;
    overflow-x: hidden;
    transition: width var(--transition-smooth, 0.35s cubic-bezier(0.4, 0, 0.2, 1));
}

.bt-main {
    flex: 1;
    margin-left: var(--bt-sidebar-width);
    padding: 2rem 2.5rem 4rem;
    min-width: 0;
    transition: margin-left var(--transition-smooth, 0.35s cubic-bezier(0.4, 0, 0.2, 1));
}


/* ============================================================
   2. Sidebar navigation
   ============================================================ */

/* Branding area at top of sidebar */
.bt-sidebar-header {
    padding: 1.25rem 1rem 0.75rem;
    border-bottom: 1px solid var(--bt-sidebar-border);
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.bt-sidebar-header h2 {
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Section labels (e.g. "Tracking", "Admin") */
.bt-nav-section-label {
    display: block;
    padding: 1.25rem 1rem 0.4rem;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-muted, #999);
    white-space: nowrap;
    overflow: hidden;
}

/* Individual nav items */
.bt-nav-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 1rem;
    margin: 0.1rem 0.5rem;
    border-radius: var(--bt-radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--color-text-secondary, #666);
    text-decoration: none;
    cursor: pointer;
    transition: background var(--transition-fast, 0.2s ease),
                color var(--transition-fast, 0.2s ease);
    white-space: nowrap;
    overflow: hidden;
    border: none;
    background: none;
    font-family: inherit;
    width: calc(100% - 1rem);
}

.bt-nav-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    stroke: currentColor;
    stroke-width: 1.75;
    fill: none;
}

.bt-nav-item:hover {
    background: rgba(0, 0, 0, 0.04);
    color: var(--color-text, #0a0a0a);
}

.bt-nav-item:focus-visible {
    outline: 2px solid var(--bt-primary);
    outline-offset: -2px;
}

.bt-nav-item.active {
    background: var(--bt-primary-soft);
    color: var(--bt-primary);
    font-weight: 600;
}

.bt-nav-item.active svg {
    stroke: var(--bt-primary);
}

/* Mobile hamburger toggle */
.bt-sidebar-toggle {
    display: none;
    position: fixed;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 200;
    width: 40px;
    height: 40px;
    border-radius: var(--bt-radius-sm);
    border: 1px solid var(--color-card-border, #e8e8e8);
    background: var(--color-bg, #fff);
    color: var(--color-text, #0a0a0a);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: background var(--transition-fast, 0.2s ease);
}

.bt-sidebar-toggle:hover {
    background: var(--color-card-bg, #fafafa);
}

.bt-sidebar-toggle svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

/* Sidebar overlay for mobile */
.bt-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 99;
    opacity: 0;
    transition: opacity var(--transition-smooth, 0.35s ease);
}

.bt-sidebar-overlay.visible {
    display: block;
    opacity: 1;
}


/* ============================================================
   3. Page header
   ============================================================ */

.bt-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.75rem;
    flex-wrap: wrap;
}

.bt-page-title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--color-text, #0a0a0a);
}

.bt-page-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}


/* ============================================================
   4. Filter / search toolbar
   ============================================================ */

.bt-toolbar {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.85rem;
    background: var(--color-card-bg, #fafafa);
    border: 1px solid var(--color-card-border, #e8e8e8);
    border-radius: var(--bt-radius);
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.bt-search-input {
    flex: 1;
    min-width: 200px;
    max-width: 360px;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-card-border, #e8e8e8);
    border-radius: var(--bt-radius-sm);
    font-family: var(--bt-font);
    font-size: 0.85rem;
    background: var(--color-bg, #fff);
    color: var(--color-text, #0a0a0a);
    outline: none;
    transition: border-color var(--transition-fast, 0.2s ease),
                box-shadow var(--transition-fast, 0.2s ease);
}

.bt-search-input::placeholder {
    color: var(--color-text-muted, #999);
}

.bt-search-input:focus {
    border-color: var(--bt-primary);
    box-shadow: 0 0 0 3px var(--bt-primary-soft);
}

.bt-filter-select {
    padding: 0.5rem 2rem 0.5rem 0.75rem;
    border: 1px solid var(--color-card-border, #e8e8e8);
    border-radius: var(--bt-radius-sm);
    font-family: var(--bt-font);
    font-size: 0.82rem;
    background: var(--color-bg, #fff);
    color: var(--color-text, #0a0a0a);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b6b6b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.6rem center;
    background-size: 14px;
    outline: none;
    transition: border-color var(--transition-fast, 0.2s ease);
}

.bt-filter-select:hover {
    border-color: var(--color-text-secondary, #666);
}

.bt-filter-select:focus {
    border-color: var(--bt-primary);
    box-shadow: 0 0 0 3px var(--bt-primary-soft);
}


/* ============================================================
   5. Buttons
   ============================================================ */

.bt-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.55rem 1rem;
    border-radius: var(--bt-radius-sm);
    border: 1px solid var(--color-card-border, #e8e8e8);
    background: var(--color-bg, #fff);
    color: var(--color-text, #0a0a0a);
    font-family: var(--bt-font);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast, 0.2s ease);
    line-height: 1;
    text-decoration: none;
}

.bt-btn:hover:not(:disabled) {
    border-color: var(--color-text-secondary, #666);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.bt-btn:active:not(:disabled) {
    transform: translateY(1px);
}

.bt-btn:focus-visible {
    outline: 2px solid var(--bt-primary);
    outline-offset: 2px;
}

.bt-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.bt-btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
    flex-shrink: 0;
}

/* Primary — blue accent */
.bt-btn-primary {
    background: var(--bt-primary);
    color: #ffffff;
    border-color: var(--bt-primary);
}

.bt-btn-primary:hover:not(:disabled) {
    background: var(--bt-primary-hover);
    border-color: var(--bt-primary-hover);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

/* Secondary — outlined */
.bt-btn-secondary {
    background: var(--color-bg, #fff);
    color: var(--color-text, #0a0a0a);
    border-color: var(--color-card-border, #e8e8e8);
}

.bt-btn-secondary:hover:not(:disabled) {
    background: var(--color-card-bg, #fafafa);
    border-color: var(--color-text-secondary, #666);
}

/* Danger — red for destructive actions */
.bt-btn-danger {
    color: var(--bt-danger);
    border-color: var(--bt-danger-border);
    background: transparent;
}

.bt-btn-danger:hover:not(:disabled) {
    background: var(--bt-danger-soft);
    border-color: var(--bt-danger);
}

/* Small variant */
.bt-btn-sm {
    padding: 0.35rem 0.7rem;
    font-size: 0.75rem;
}


/* ============================================================
   6. Metric cards (Dashboard KPI tiles)
   ============================================================ */

.bt-metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.75rem;
}

.bt-metric-card {
    background: var(--color-bg, #fff);
    border: 1px solid var(--color-card-border, #e8e8e8);
    border-radius: var(--bt-radius);
    padding: 1.25rem;
    transition: box-shadow var(--transition-fast, 0.2s ease),
                border-color var(--transition-fast, 0.2s ease);
}

.bt-metric-card:hover {
    border-color: transparent;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.06);
}

.bt-metric-value {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--color-text, #0a0a0a);
    line-height: 1.2;
    margin-bottom: 0.25rem;
}

.bt-metric-label {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--color-text-muted, #999);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Positive / negative metric colouring */
.bt-metric-value.positive { color: var(--bt-success); }
.bt-metric-value.negative { color: var(--bt-danger); }


/* ============================================================
   7. Data tables
   ============================================================ */

.bt-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--color-card-border, #e8e8e8);
    border-radius: var(--bt-radius);
    background: var(--color-bg, #fff);
}

.bt-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.bt-table th {
    position: sticky;
    top: 0;
    background: var(--color-card-bg, #fafafa);
    padding: 0.7rem 0.85rem;
    text-align: left;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted, #999);
    border-bottom: 1px solid var(--color-card-border, #e8e8e8);
    white-space: nowrap;
}

.bt-table td {
    padding: 0.7rem 0.85rem;
    border-bottom: 1px solid var(--color-card-border, #e8e8e8);
    color: var(--color-text, #0a0a0a);
    vertical-align: middle;
}

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

.bt-table tbody tr:hover {
    background: #f8f8f8;
}

.bt-table tbody tr {
    transition: background var(--transition-fast, 0.2s ease);
}

.bt-table-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.bt-table-actions button {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-text-muted, #999);
    padding: 0.2rem 0.35rem;
    border-radius: 4px;
    transition: color var(--transition-fast, 0.2s ease),
                background var(--transition-fast, 0.2s ease);
}

.bt-table-actions button:hover {
    color: var(--color-text, #0a0a0a);
    background: rgba(0, 0, 0, 0.04);
}

.bt-table-actions button.danger:hover {
    color: var(--bt-danger);
    background: var(--bt-danger-soft);
}


/* ============================================================
   8. Kanban board (Pipeline view)
   ============================================================ */

.bt-kanban {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 1rem;
    /* Horizontal scroll snapping for touch devices */
    -webkit-overflow-scrolling: touch;
}

.bt-kanban-column {
    flex: 0 0 280px;
    min-width: 280px;
    background: var(--color-card-bg, #fafafa);
    border: 1px solid var(--color-card-border, #e8e8e8);
    border-radius: var(--bt-radius);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 200px);
}

.bt-kanban-column-header {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--color-card-border, #e8e8e8);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.bt-kanban-column-header h3 {
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: -0.005em;
}

.bt-kanban-column-header .count {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--color-text-muted, #999);
    background: var(--color-bg, #fff);
    border: 1px solid var(--color-card-border, #e8e8e8);
    border-radius: 999px;
    padding: 0.15rem 0.5rem;
}

.bt-kanban-column-body {
    flex: 1;
    overflow-y: auto;
    padding: 0.6rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.bt-kanban-card {
    background: var(--color-bg, #fff);
    border: 1px solid var(--color-card-border, #e8e8e8);
    border-radius: var(--bt-radius-sm);
    padding: 0.75rem 0.85rem;
    cursor: grab;
    transition: box-shadow var(--transition-fast, 0.2s ease),
                transform var(--transition-fast, 0.2s ease);
}

.bt-kanban-card:hover {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

.bt-kanban-card:active {
    cursor: grabbing;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

.bt-kanban-card .card-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text, #0a0a0a);
    margin-bottom: 0.3rem;
}

.bt-kanban-card .card-meta {
    font-size: 0.72rem;
    color: var(--color-text-muted, #999);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Drag placeholder / drop target indicator */
.bt-kanban-card.dragging {
    opacity: 0.5;
}

.bt-kanban-column.drag-over {
    border-color: var(--bt-primary);
    background: var(--bt-primary-soft);
}


/* ============================================================
   9. Forms
   ============================================================ */

.bt-form {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.bt-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.bt-form-group {
    display: flex;
    flex-direction: column;
}

.bt-form-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-secondary, #666);
    margin-bottom: 0.35rem;
}

.bt-form-input,
.bt-form-select {
    width: 100%;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--color-card-border, #e8e8e8);
    border-radius: var(--bt-radius-sm);
    font-family: var(--bt-font);
    font-size: 0.86rem;
    background: var(--color-bg, #fff);
    color: var(--color-text, #0a0a0a);
    outline: none;
    box-sizing: border-box;
    transition: border-color var(--transition-fast, 0.2s ease),
                box-shadow var(--transition-fast, 0.2s ease);
}

.bt-form-input:focus,
.bt-form-select:focus {
    border-color: var(--bt-primary);
    box-shadow: 0 0 0 3px var(--bt-primary-soft);
}

.bt-form-input::placeholder {
    color: var(--color-text-muted, #999);
}

.bt-form-select {
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    padding-right: 2.2rem;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b6b6b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.6rem center;
    background-size: 14px;
}

.bt-form-hint {
    font-size: 0.72rem;
    color: var(--color-text-muted, #999);
    margin-top: 0.25rem;
}


/* ============================================================
   10. Modals
   ============================================================ */

.bt-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 400;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-fast, 0.2s ease);
}

.bt-modal-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.bt-modal {
    background: var(--color-bg, #fff);
    border-radius: var(--bt-radius-lg);
    padding: 1.5rem;
    max-width: 520px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(10px) scale(0.98);
    transition: transform var(--transition-smooth, 0.35s ease);
}

.bt-modal-overlay.open .bt-modal {
    transform: none;
}

.bt-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.bt-modal-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
}

.bt-modal-header .bt-modal-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-text-muted, #999);
    padding: 0.2rem;
    border-radius: 4px;
    transition: color var(--transition-fast, 0.2s ease);
}

.bt-modal-header .bt-modal-close:hover {
    color: var(--color-text, #0a0a0a);
}

.bt-modal-body {
    font-size: 0.88rem;
    line-height: 1.6;
    color: var(--color-text, #0a0a0a);
}

.bt-modal-footer {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--color-card-border, #e8e8e8);
}


/* ============================================================
   11. Status badges
   ============================================================ */

.bt-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border: 1px solid var(--color-card-border, #e8e8e8);
    background: #f5f5f5;
    color: var(--color-text-muted, #999);
    white-space: nowrap;
}

.bt-badge-active {
    color: var(--bt-success);
    border-color: var(--bt-success-border);
    background: var(--bt-success-soft);
}

.bt-badge-closed {
    color: var(--color-text-muted, #999);
    border-color: var(--color-card-border, #e8e8e8);
    background: #f0f0f0;
}

.bt-badge-pending {
    color: var(--bt-warning);
    border-color: var(--bt-warning-border);
    background: var(--bt-warning-soft);
}

.bt-badge-expired {
    color: var(--bt-danger);
    border-color: var(--bt-danger-border);
    background: var(--bt-danger-soft);
}


/* ============================================================
   12. Charts area
   ============================================================ */

.bt-chart-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 1rem;
    margin-bottom: 1.75rem;
}

.bt-chart-card {
    background: var(--color-bg, #fff);
    border: 1px solid var(--color-card-border, #e8e8e8);
    border-radius: var(--bt-radius);
    padding: 1.25rem;
}

.bt-chart-card h4 {
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 0.85rem;
    color: var(--color-text, #0a0a0a);
}

/* Canvas wrapper — keeps chart aspect ratio sane */
.bt-chart-card canvas {
    width: 100% !important;
    height: auto !important;
    max-height: 280px;
}


/* ============================================================
   13. Empty states
   ============================================================ */

.bt-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 4rem 2rem;
    min-height: 300px;
}

.bt-empty-state-icon {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    border-radius: var(--bt-radius);
    background: var(--color-card-bg, #fafafa);
    border: 1px solid var(--color-card-border, #e8e8e8);
}

.bt-empty-state-icon svg {
    width: 24px;
    height: 24px;
    stroke: var(--color-text-muted, #999);
    stroke-width: 1.5;
    fill: none;
}

.bt-empty-state-text {
    max-width: 360px;
}

.bt-empty-state-text h3 {
    font-size: 1rem;
    font-weight: 650;
    margin-bottom: 0.35rem;
    color: var(--color-text, #0a0a0a);
}

.bt-empty-state-text p {
    font-size: 0.85rem;
    color: var(--color-text-muted, #999);
    line-height: 1.5;
    margin-bottom: 1rem;
}


/* ============================================================
   14. Pagination
   ============================================================ */

.bt-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 1.25rem;
}

.bt-pagination .bt-page-info {
    font-size: 0.82rem;
    color: var(--color-text-muted, #999);
}


/* ============================================================
   15. Toast notification
   ============================================================ */

.bt-toast {
    position: fixed;
    bottom: 1.25rem;
    left: 50%;
    transform: translateX(-50%);
    background: #1c1c1e;
    color: #fff;
    padding: 0.7rem 1.1rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    z-index: 500;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.bt-toast.show { opacity: 1; }
.bt-toast.err { background: var(--bt-danger); }
.bt-toast.ok { background: var(--bt-success); }


/* ============================================================
   Responsive — Tablet (<=1024px): sidebar collapses to icon-only
   ============================================================ */

@media (max-width: 1024px) {
    .bt-sidebar {
        width: var(--bt-sidebar-collapsed);
    }

    .bt-main {
        margin-left: var(--bt-sidebar-collapsed);
        padding: 1.5rem 1.5rem 4rem;
    }

    /* Hide text labels, keep icons centred */
    .bt-sidebar-header h2,
    .bt-nav-section-label,
    .bt-nav-item span {
        display: none;
    }

    .bt-sidebar-header {
        justify-content: center;
        padding: 1rem 0.5rem 0.75rem;
    }

    .bt-nav-item {
        justify-content: center;
        padding: 0.6rem;
        margin: 0.1rem 0.35rem;
        width: calc(100% - 0.7rem);
    }

    .bt-nav-item svg {
        width: 20px;
        height: 20px;
    }

    /* Kanban columns shrink */
    .bt-kanban-column {
        flex: 0 0 240px;
        min-width: 240px;
    }

    /* Form rows collapse to single column */
    .bt-form-row {
        grid-template-columns: 1fr;
    }
}


/* ============================================================
   Responsive — Mobile (<=768px): sidebar hidden, hamburger toggle
   ============================================================ */

@media (max-width: 768px) {
    .bt-sidebar-toggle {
        display: flex;
    }

    .bt-sidebar {
        width: var(--bt-sidebar-width);
        transform: translateX(-100%);
        transition: transform var(--transition-smooth, 0.35s cubic-bezier(0.4, 0, 0.2, 1));
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.12);
    }

    /* Restore full sidebar labels when it slides out */
    .bt-sidebar.open {
        transform: translateX(0);
    }

    .bt-sidebar.open ~ .bt-sidebar-overlay {
        display: block;
        opacity: 1;
    }

    /* Restore text labels when sidebar is expanded on mobile */
    .bt-sidebar.open .bt-sidebar-header h2,
    .bt-sidebar.open .bt-nav-section-label,
    .bt-sidebar.open .bt-nav-item span {
        display: inline;
    }

    .bt-sidebar.open .bt-nav-item {
        justify-content: flex-start;
        padding: 0.55rem 1rem;
        margin: 0.1rem 0.5rem;
        width: calc(100% - 1rem);
    }

    .bt-sidebar.open .bt-sidebar-header {
        justify-content: flex-start;
        padding: 1.25rem 1rem 0.75rem;
    }

    .bt-main {
        margin-left: 0;
        padding: 4rem 1rem 4rem;
    }

    /* Page header stacks on very narrow screens */
    .bt-page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    /* Metric grid — two columns on mobile */
    .bt-metric-grid {
        grid-template-columns: 1fr 1fr;
    }

    /* Kanban — full width columns, scroll horizontally */
    .bt-kanban-column {
        flex: 0 0 260px;
        min-width: 260px;
    }

    /* Chart container — single column */
    .bt-chart-container {
        grid-template-columns: 1fr;
    }

    /* Toolbar wraps */
    .bt-search-input {
        min-width: 0;
        max-width: none;
        flex-basis: 100%;
    }

    /* Table font shrinks slightly */
    .bt-table {
        font-size: 0.8rem;
    }

    .bt-table th,
    .bt-table td {
        padding: 0.55rem 0.65rem;
    }
}

/* Very narrow — metric cards go single column */
@media (max-width: 480px) {
    .bt-metric-grid {
        grid-template-columns: 1fr;
    }

    .bt-modal {
        padding: 1.15rem;
    }
}


/* ============================================================
   Accessibility — reduced motion
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
    .bt-sidebar,
    .bt-main,
    .bt-modal,
    .bt-modal-overlay,
    .bt-kanban-card,
    .bt-nav-item,
    .bt-btn {
        transition: none !important;
    }

    .bt-sidebar {
        transform: none !important;
    }
}
