/* ==========================================================================
   KṬP THAWHLAWM - MINIMALIST EDITORIAL DESIGN SYSTEM (v6)
   Apple Bottom Sheets, FAB, Rudder, Receipts, Timeline, Forecast, Period Lock
   ========================================================================== */

:root {
    --bg-canvas: #fbfbfa;
    --bg-surface: #ffffff;
    --bg-surface-subtle: #f7f6f3;
    --bg-input: #ffffff;
    
    --border-color: #eaeaea;
    --border-subtle: rgba(0, 0, 0, 0.05);
    --border-focus: #111111;
    
    --text-primary: #111111;
    --text-secondary: #575653;
    --text-muted: #8c8b88;
    
    --accent-dark: #111111;
    --accent-dark-hover: #262626;
    
    /* Muted Spot Pastels */
    --pastel-green-bg: #edf3ec;
    --pastel-green-text: #1f6c38;
    --pastel-green-border: #cbe4c8;
    
    --pastel-amber-bg: #fbf3db;
    --pastel-amber-text: #8c5800;
    --pastel-amber-border: #f0e0b0;
    
    --pastel-red-bg: #fdebec;
    --pastel-red-text: #9f2f2d;
    --pastel-red-border: #f5c2c4;
    
    --pastel-blue-bg: #e1f3fe;
    --pastel-blue-text: #1f6c9f;
    --pastel-blue-border: #bcdff5;

    --radius-xs: 4px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-sheet: 22px 22px 0 0;
    
    --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

/* ==========================================================================
   BASE & RESET (Strict Tabular Figures & Anti-Horizontal Scroll)
   ========================================================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    background-color: var(--bg-canvas);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Tabular Numeric Figures for Zero Layout Jitter */
.bento-value, 
.ranking-pct, 
.ranking-amt, 
.data-table td, 
.mobile-metric-val, 
.chip-month-amt, 
.status-pill,
.forecast-stat-val,
.history-stat-val,
.receipt-val {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.25;
}

/* Text Utilities */
.text-emerald { color: var(--pastel-green-text) !important; }
.text-rose { color: var(--pastel-red-text) !important; }
.text-amber { color: var(--pastel-amber-text) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-danger { color: var(--pastel-red-text); }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.flex-1 { flex: 1; }

/* Buttons with Tactile Spring Press */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    font-family: var(--font-body);
    font-size: 0.8125rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    cursor: pointer;
    background: var(--bg-surface);
    color: var(--text-primary);
    text-decoration: none;
    white-space: nowrap;
    transition: transform 100ms ease-out, background-color 150ms ease, border-color 150ms ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--accent-dark);
    color: #ffffff;
    border-color: var(--accent-dark);
}
.btn-primary:hover {
    background: var(--accent-dark-hover);
    border-color: var(--accent-dark-hover);
}

.btn-secondary {
    background: var(--bg-surface);
    color: var(--text-primary);
    border-color: var(--border-color);
}
.btn-secondary:hover {
    background: var(--bg-surface-subtle);
    border-color: #d1d0cb;
}

.btn-whatsapp {
    background: #eafaf1;
    color: #128c7e;
    border: 1px solid #c2eed5;
}
.btn-whatsapp:hover {
    background: #d5f4e4;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 0.75rem;
}

.btn-lg {
    padding: 11px 20px;
    font-size: 0.9375rem;
}

.btn-block {
    width: 100%;
}

/* ==========================================================================
   1. PULL-TO-REFRESH SPRING INDICATOR
   ========================================================================== */
.pull-refresh-indicator {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    z-index: 150;
    transition: height 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
    opacity: 0;
    pointer-events: none;
}

.pull-refresh-indicator.active {
    height: 46px;
    opacity: 1;
}

.pull-refresh-content {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.spin {
    animation: spinAnim 0.75s linear infinite;
}

@keyframes spinAnim {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ==========================================================================
   2. AUTHENTICATION SCREEN
   ========================================================================== */
.auth-wrapper {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: var(--bg-canvas);
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px 28px;
    animation: fadeIn 0.25s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 24px;
}

.auth-logo-box {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    background: var(--bg-surface-subtle);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
}
.auth-logo-box img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.auth-badge {
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    text-transform: uppercase;
}

.auth-title {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.auth-subtitle {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-row {
    display: flex;
    gap: 10px;
}

.input-field,
.select-field {
    width: 100%;
    padding: 9px 12px;
    font-family: var(--font-body);
    font-size: 0.875rem;
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    outline: none;
    transition: border-color 0.15s ease;
}

.input-field:focus,
.select-field:focus {
    border-color: var(--border-focus);
}

.select-sm {
    padding: 5px 8px;
    font-size: 0.75rem;
}

.password-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.password-input-wrap input {
    padding-right: 36px;
}

.btn-toggle-pwd {
    position: absolute;
    right: 6px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
}

.alert-error {
    background: var(--pastel-red-bg);
    border: 1px solid var(--pastel-red-border);
    color: var(--pastel-red-text);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    margin-bottom: 12px;
}

.auth-demo-box {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.demo-title {
    font-size: 0.6875rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.demo-buttons {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
}

.btn-demo {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    background: var(--bg-surface-subtle);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.75rem;
    color: var(--text-primary);
    text-align: left;
    transition: background-color 0.15s ease;
}
.btn-demo:hover {
    background: #eae9e5;
}
.btn-demo span {
    font-family: var(--font-mono);
    color: var(--text-muted);
    font-size: 0.6875rem;
}

/* ==========================================================================
   3. APP NAVIGATION
   ========================================================================== */
.app-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

.app-navbar {
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
}

.navbar-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.navbar-left {
    display: flex;
    align-items: center;
    min-width: 90px;
}

.navbar-logo {
    width: 68px;
    height: 68px;
    border-radius: var(--radius-sm);
    object-fit: contain;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.12));
    transition: transform 0.2s ease;
}

.navbar-logo:hover {
    transform: scale(1.04);
}

.navbar-brand-centered {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    flex: 1;
    gap: 2px;
}

.navbar-brand-title-main {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.6rem;
    letter-spacing: -0.01em;
    color: var(--text-primary);
    line-height: 1.15;
    text-align: center;
}

.navbar-brand-branch {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.01em;
    line-height: 1.2;
    text-align: center;
}

.navbar-brand-fp {
    font-family: var(--font-heading);
    font-weight: 900;
    font-size: 1.08rem;
    letter-spacing: 0.14em;
    color: var(--primary, #0f172a);
    text-transform: uppercase;
    line-height: 1.2;
    text-align: center;
    margin-top: 2px;
}

.navbar-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-width: 90px;
    gap: 10px;
}

.nav-logout-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 0.95rem;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    color: var(--danger);
    border: 1px solid rgba(220, 38, 38, 0.2);
    background: rgba(220, 38, 38, 0.04);
    cursor: pointer;
    transition: all 0.15s ease;
}

.nav-logout-btn:hover {
    background: rgba(220, 38, 38, 0.1);
    border-color: rgba(220, 38, 38, 0.4);
    color: #b91c1c;
}

/* ==========================================================================
   4. SEGMENTED CONTROLS & PILL FILTER RUDDERS
   ========================================================================== */
.view-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 16px;
    width: 100%;
    box-sizing: border-box;
}

.segmented-control-wrap {
    margin-bottom: 16px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.segmented-control {
    display: inline-flex;
    background: var(--bg-surface-subtle);
    border: 1px solid var(--border-color);
    padding: 3px;
    border-radius: var(--radius-sm);
    gap: 2px;
    white-space: nowrap;
}

.segment-btn {
    padding: 6px 14px;
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition: all 120ms ease;
}

.segment-btn.active {
    background: var(--bg-surface);
    color: var(--text-primary);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

/* Segmented Pill Filter Rudder */
.pill-rudder-wrap {
    margin-bottom: 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.pill-rudder {
    display: inline-flex;
    background: var(--bg-surface-subtle);
    border: 1px solid var(--border-color);
    border-radius: 9999px;
    padding: 2px;
    gap: 2px;
}

.pill-rudder-btn {
    padding: 4px 12px;
    font-family: var(--font-body);
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-radius: 9999px;
    cursor: pointer;
    transition: all 100ms ease-out;
    -webkit-tap-highlight-color: transparent;
}

.pill-rudder-btn:active {
    transform: scale(0.95);
}

.pill-rudder-btn.active {
    background: var(--accent-dark);
    color: #ffffff;
}

.tab-content {
    display: none;
}
.tab-content.active {
    display: block;
    animation: fadeIn 0.2s ease-out;
}

/* ==========================================================================
   5. ULTRA-COMPACT KPI RIBBON STRIP & FORECAST CARD
   ========================================================================== */
.kpi-compact-strip {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    margin-bottom: 14px;
}

.kpi-compact-strip-4 {
    grid-template-columns: repeat(4, 1fr) !important;
}

.kpi-compact-item {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 7px 12px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 50px;
    box-sizing: border-box;
}

.kpi-compact-highlight {
    background: var(--pastel-green-bg);
    border-color: var(--pastel-green-border);
}

.kpi-compact-lbl-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
}

.kpi-compact-lbl {
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kpi-compact-pct {
    font-size: 0.6875rem;
    font-weight: 800;
    line-height: 1.1;
}

.kpi-compact-val {
    font-family: var(--font-heading);
    font-size: 1.125rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
    margin-top: 2px;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .kpi-compact-strip {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
        margin-bottom: 10px;
    }
    .kpi-compact-strip .kpi-compact-item:nth-child(4) {
        grid-column: span 1;
    }
    .kpi-compact-strip .kpi-compact-item:nth-child(5) {
        grid-column: span 2;
    }
    .kpi-compact-strip-4 {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    .kpi-compact-strip-4 .kpi-compact-item {
        grid-column: auto !important;
    }
    .kpi-compact-item {
        padding: 6px 8px;
        min-height: 44px;
    }
    .kpi-compact-val {
        font-size: 0.9375rem;
    }
}

/* Forecast Pacing Bento Card */
.forecast-bento-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 18px;
    margin-bottom: 16px;
}

.forecast-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.forecast-metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    background: var(--bg-surface-subtle);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin-bottom: 14px;
}

.forecast-stat-lbl {
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
}

.forecast-stat-val {
    font-size: 1.0625rem;
    font-family: var(--font-heading);
    font-weight: 700;
    margin-top: 2px;
}

.forecast-bar-wrap {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.forecast-bar-track {
    width: 100%;
    height: 8px;
    background: var(--border-color);
    border-radius: 9999px;
    overflow: hidden;
    position: relative;
}

.forecast-bar-current {
    height: 100%;
    background: #111111;
    border-radius: 9999px;
    position: absolute;
    left: 0;
    top: 0;
    z-index: 2;
}

.forecast-bar-projected {
    height: 100%;
    background: #86efac;
    border-radius: 9999px;
    position: absolute;
    left: 0;
    top: 0;
    z-index: 1;
}

.forecast-legend {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 0.6875rem;
    color: var(--text-secondary);
}

.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    vertical-align: middle;
    margin-right: 4px;
}
.legend-dot.current { background: #111111; }
.legend-dot.projected { background: #86efac; }
.legend-target { margin-left: auto; font-weight: 700; }

/* ==========================================================================
   6. CHARTS & CONTENT CARDS
   ========================================================================== */
.charts-bento-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.bento-chart-card,
.content-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 18px;
    margin-bottom: 16px;
    width: 100%;
    box-sizing: border-box;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 12px;
}

.card-header.flex-wrap {
    flex-wrap: wrap;
}

.card-title {
    font-size: 1rem;
    font-weight: 700;
}

.card-subtitle {
    font-size: 0.6875rem;
    color: var(--text-secondary);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.search-input {
    padding: 6px 10px;
    font-family: var(--font-body);
    font-size: 0.75rem;
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    outline: none;
    min-width: 180px;
}
.search-input:focus {
    border-color: var(--border-focus);
}

.chart-container {
    position: relative;
    height: 240px;
    width: 100%;
}
.chart-container-compact {
    height: 180px;
}

/* ==========================================================================
   7. BRANCH BANNER & RANKINGS
   ========================================================================== */
.branch-header-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.branch-badge {
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    display: block;
    margin-bottom: 2px;
}

.branch-title {
    font-size: 1.25rem;
    font-weight: 800;
}

.branch-leader {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.branch-header-buttons {
    display: flex;
    gap: 8px;
}

/* Rankings */
.rankings-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
}

.ranking-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: var(--bg-surface-subtle);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
}

.ranking-item-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ranking-num {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    font-size: 0.6875rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ranking-name {
    font-size: 0.8125rem;
    font-weight: 700;
}

.ranking-manager {
    font-size: 0.6875rem;
    color: var(--text-muted);
}

.ranking-item-right {
    text-align: right;
}

.ranking-pct {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 0.9375rem;
    color: var(--pastel-green-text);
}

.ranking-amt {
    font-size: 0.625rem;
    color: var(--text-muted);
}

/* ==========================================================================
   8. DESKTOP DATA TABLES (Visible on >768px)
   ========================================================================== */
.table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
}

.matrix-scroll {
    max-height: 520px;
    overflow: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
    text-align: left;
}

.data-table th {
    background: var(--bg-surface-subtle);
    color: var(--text-secondary);
    font-weight: 700;
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.data-table tbody tr:hover {
    background: var(--bg-surface-subtle);
}

.matrix-table th,
.matrix-table td {
    text-align: right;
    padding: 10px 10px;
    font-size: 0.875rem;
}

.matrix-table th:first-child,
.matrix-table td:first-child,
.matrix-table th:nth-child(2),
.matrix-table td:nth-child(2),
.matrix-table th:nth-child(3),
.matrix-table td:nth-child(3),
.matrix-table th:last-child,
.matrix-table td:last-child {
    text-align: left;
}

.col-sticky-1 {
    position: sticky;
    left: 0;
    z-index: 2;
    background: var(--bg-surface);
    width: 36px;
}

.col-sticky-2 {
    position: sticky;
    left: 36px;
    z-index: 2;
    background: var(--bg-surface);
    font-weight: 700;
    min-width: 160px;
    cursor: pointer;
}
.col-sticky-2:hover {
    text-decoration: underline;
}

.matrix-cell-paid {
    color: var(--pastel-green-text);
    font-weight: 700;
    font-size: 0.875rem;
    cursor: pointer;
    border-radius: var(--radius-xs);
    padding: 4px 6px;
    transition: background-color 0.15s ease;
}
.matrix-cell-paid:hover {
    background: var(--pastel-green-bg);
}

.matrix-cell-empty {
    color: var(--text-muted);
    font-size: 0.875rem;
    cursor: pointer;
    border-radius: var(--radius-xs);
    padding: 4px 6px;
}
.matrix-cell-empty:hover {
    background: var(--bg-surface-subtle);
}

.matrix-cell-locked {
    color: #a1a09c;
    background: #f7f6f3;
    cursor: not-allowed;
    border-radius: var(--radius-xs);
    padding: 4px 6px;
    opacity: 0.75;
}

.matrix-cell-pct {
    font-size: 0.875rem;
    font-weight: 800;
}

/* Status & Surplus Pills */
.status-pill {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 9999px;
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.status-paid {
    background: var(--pastel-green-bg);
    color: var(--pastel-green-text);
    border: 1px solid var(--pastel-green-border);
}

.status-surplus {
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #bbf7d0;
    font-weight: 800;
}

.status-partial {
    background: var(--pastel-amber-bg);
    color: var(--pastel-amber-text);
    border: 1px solid var(--pastel-amber-border);
}

.status-unpaid {
    background: var(--pastel-red-bg);
    color: var(--pastel-red-text);
    border: 1px solid var(--pastel-red-border);
}

.progress-bar-wrap {
    width: 60px;
    height: 5px;
    background: var(--border-color);
    border-radius: 9999px;
    overflow: hidden;
    display: inline-block;
    vertical-align: middle;
    margin-right: 6px;
}
.progress-bar-fill {
    height: 100%;
    background: var(--accent-dark);
}

/* ==========================================================================
   9. MOBILE LEDGER CARDS & DIRECT ACTIONS
   ========================================================================== */
.mobile-only-cards {
    display: none;
}

.mobile-member-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px;
    width: 100%;
    box-sizing: border-box;
}

.mobile-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}

.mobile-card-name {
    font-size: 0.9375rem;
    font-weight: 700;
    line-height: 1.2;
    cursor: pointer;
}
.mobile-card-name:hover {
    text-decoration: underline;
}

.mobile-card-contact-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
}

.btn-contact-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 3px 8px;
    font-size: 0.6875rem;
    font-weight: 700;
    border-radius: var(--radius-xs);
    text-decoration: none;
    cursor: pointer;
    transition: transform 100ms ease;
    -webkit-tap-highlight-color: transparent;
}
.btn-contact-action:active {
    transform: scale(0.94);
}

.btn-call {
    background: var(--bg-surface-subtle);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-member-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 2px 6px;
    font-size: 0.6875rem;
    font-weight: 700;
    height: 24px;
    min-height: 24px;
    border-radius: var(--radius-xs);
    line-height: 1;
}
.btn-member-action i,
.btn-member-action svg {
    width: 12px;
    height: 12px;
}

.btn-icon-xs {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    min-height: 24px;
    min-width: 24px;
    padding: 0;
    border-radius: var(--radius-xs);
}
.btn-icon-xs i,
.btn-icon-xs svg {
    width: 12px;
    height: 12px;
}

.mobile-metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    background: var(--bg-surface-subtle);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px 8px;
    margin-bottom: 10px;
}

.mobile-metric-item {
    text-align: center;
}
.mobile-metric-lbl {
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
}
.mobile-metric-val {
    font-size: 0.8125rem;
    font-weight: 800;
}

.mobile-progress-row {
    margin-bottom: 12px;
}
.mobile-progress-bar {
    width: 100%;
    height: 4px;
    background: var(--border-color);
    border-radius: 9999px;
    overflow: hidden;
}
.mobile-progress-fill {
    height: 100%;
    background: #111111;
}

/* 12-Month Touch Chips Grid */
.mobile-months-wrap {
    border-top: 1px dashed var(--border-color);
    padding-top: 10px;
}

.mobile-months-title {
    font-size: 0.6875rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.mobile-months-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
}

.mobile-month-chip {
    padding: 8px 3px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    text-align: center;
    cursor: pointer;
    font-size: 0.78rem;
    line-height: 1.2;
    -webkit-tap-highlight-color: transparent;
    transition: transform 100ms ease-out;
    min-height: 52px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}
.mobile-month-chip:active {
    transform: scale(0.94);
}

.mobile-month-chip.paid {
    background: var(--pastel-green-bg);
    border-color: var(--pastel-green-border);
    color: var(--pastel-green-text);
    font-weight: 700;
}

.mobile-month-chip.unpaid {
    color: var(--text-muted);
    background: var(--bg-surface-subtle);
}

.mobile-month-chip.locked {
    background: #f1f0eb;
    color: #8c8b88;
    border-color: #e0ded8;
    cursor: not-allowed;
    opacity: 0.8;
}

.chip-month-name {
    font-weight: 800;
    font-size: 0.78rem;
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    margin-bottom: 2px;
}
.chip-month-amt {
    font-size: 0.78rem;
    font-weight: 800;
    font-family: var(--font-mono);
}

.mobile-info-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px;
    margin-bottom: 8px;
}

/* ==========================================================================
   10. PERIOD LOCK (THLA KHARNA) CONTROL CARDS
   ========================================================================== */
.lock-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
}

.lock-card {
    background: var(--bg-surface-subtle);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.lock-card.is-locked {
    background: #fdf3f4;
    border-color: #f7c3c6;
}

.lock-card-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.lock-icon-box {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    background: #ffffff;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
}
.lock-card.is-locked .lock-icon-box {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #991b1b;
}

.lock-month-name {
    font-size: 0.875rem;
    font-weight: 700;
}

.lock-status-lbl {
    font-size: 0.6875rem;
    color: var(--text-muted);
}
.lock-card.is-locked .lock-status-lbl {
    color: #b91c1c;
    font-weight: 600;
}

/* ==========================================================================
   11. FLOATING ACTION BUTTON (FAB) & SPEED DIAL
   ========================================================================== */
.mobile-fab-wrap {
    display: block;
    position: fixed;
    bottom: calc(70px + env(safe-area-inset-bottom, 0px));
    right: 18px;
    z-index: 960;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), bottom 0.25s ease;
}

.fab-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #0f172a;
    color: #ffffff;
    border: 2px solid rgba(255, 255, 255, 0.85);
    box-shadow: 0 10px 25px -3px rgba(15, 23, 42, 0.28), 0 4px 10px -2px rgba(15, 23, 42, 0.14);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.15s ease, box-shadow 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.fab-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 14px 30px -4px rgba(15, 23, 42, 0.35);
}

.fab-btn:active {
    transform: scale(0.90);
}

.fab-btn.open {
    transform: rotate(45deg) scale(1.02);
    background: #1e293b;
}

.fab-speed-dial {
    position: absolute;
    bottom: 58px;
    right: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-end;
    animation: speedDialIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes speedDialIn {
    from { opacity: 0; transform: translateY(14px) scale(0.92); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.fab-action-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    color: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: 9999px;
    font-family: var(--font-body);
    font-size: 0.8125rem;
    font-weight: 700;
    box-shadow: 0 10px 25px -4px rgba(15, 23, 42, 0.12), 0 2px 6px -1px rgba(15, 23, 42, 0.06), 0 0 0 1px rgba(0, 0, 0, 0.05);
    cursor: pointer;
    white-space: nowrap;
    transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.15s ease;
}
.fab-action-item:hover {
    transform: translateX(-3px) scale(1.02);
}
.fab-action-item:active {
    transform: scale(0.94);
}

/* ==========================================================================
   12. MOBILE BOTTOM NAVIGATION RUDDER (FOOT-ALIGNED TAB BAR)
   ========================================================================== */
.mobile-bottom-rudder {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: calc(56px + env(safe-area-inset-bottom, 0px));
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-top: 1px solid var(--border-color);
    border-radius: 0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.04);
    z-index: 950;
    padding: 2px 4px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-sizing: border-box;
}

.rudder-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    height: 100%;
    align-items: center;
}

.rudder-grid-5 {
    grid-template-columns: repeat(5, 1fr) !important;
}

.rudder-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: #64748b;
    cursor: pointer;
    height: 100%;
    padding: 4px 0;
    position: relative;
    transition: color 0.15s ease, transform 0.12s cubic-bezier(0.34, 1.56, 0.64, 1);
    -webkit-tap-highlight-color: transparent;
}

.rudder-item:active {
    transform: scale(0.92);
}

.rudder-item.active {
    color: #0f172a;
}

.rudder-icon {
    width: 20px;
    height: 20px;
    stroke-width: 2.2px;
    transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1), color 0.15s ease;
}

.rudder-item.active .rudder-icon {
    transform: translateY(-1px) scale(1.08);
    color: #0f172a;
    stroke-width: 2.5px;
}

.rudder-label {
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    transition: color 0.15s ease;
}

.rudder-item.active .rudder-label {
    color: #0f172a;
    font-weight: 800;
}

/* ==========================================================================
   13. DIGITAL RECEIPT SLIP & HISTORY TIMELINE
   ========================================================================== */
.receipt-slip-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px 18px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    margin-bottom: 16px;
}

.receipt-brand-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.receipt-logo-wrap {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-xs);
    background: var(--bg-surface-subtle);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3px;
}
.receipt-logo-wrap img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.receipt-brand-title {
    font-size: 0.9375rem;
    font-weight: 800;
    letter-spacing: -0.01em;
}

.receipt-brand-sub {
    font-size: 0.6875rem;
    color: var(--text-muted);
}

.receipt-perforated-line {
    border-top: 1px dashed var(--border-color);
    margin: 14px -18px;
    position: relative;
}

.receipt-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.receipt-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8125rem;
}

.receipt-lbl {
    color: var(--text-secondary);
}

.receipt-val {
    color: var(--text-primary);
}

.receipt-qr-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px;
    background: var(--bg-surface-subtle);
    border-radius: var(--radius-sm);
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.receipt-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* History Timeline Sheet */
.history-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    background: var(--bg-surface-subtle);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px;
    margin-bottom: 16px;
}

.history-stat-box {
    text-align: center;
}
.history-stat-lbl {
    font-size: 0.5625rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
}
.history-stat-val {
    font-size: 0.875rem;
    font-weight: 700;
}

.history-timeline {
    position: relative;
    border-left: 2px solid var(--border-color);
    margin-left: 12px;
    padding-left: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-height: 50vh;
    overflow-y: auto;
}

.history-timeline-item {
    position: relative;
}

.history-timeline-node {
    position: absolute;
    left: -23px;
    top: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent-dark);
    border: 2px solid #ffffff;
}

.history-timeline-title {
    font-size: 0.8125rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.history-timeline-notes {
    font-size: 0.6875rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.history-timeline-meta {
    font-size: 0.625rem;
    color: var(--text-muted);
}

/* ==========================================================================
   14. APPLE-STYLE BOTTOM SHEETS / MODALS
   ========================================================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1100;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 440px;
    padding: 24px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
}

.sheet-drag-handle {
    display: none;
    width: 36px;
    height: 4px;
    background: #d1d0cb;
    border-radius: 9999px;
    margin: 0 auto 16px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.modal-title {
    font-size: 1.125rem;
    font-weight: 700;
}

.btn-modal-close {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--border-color);
}

.toast-container {
    position: fixed;
    bottom: 74px;
    right: 20px;
    z-index: 1200;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: var(--accent-dark);
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 320px;
    animation: toastIn 0.25s ease-out;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   15. RESPONSIVE BREAKPOINTS (Mobile Bottom Sheet & Rudder Activation)
   ========================================================================== */
@media (max-width: 768px) {
    .hide-on-mobile {
        display: none !important;
    }

    .desktop-only {
        display: none !important;
    }

    .navbar-container {
        padding: 8px 12px;
        gap: 8px;
    }

    .navbar-left {
        min-width: auto;
    }

    .navbar-logo {
        width: 54px;
        height: 54px;
    }

    .navbar-brand-title-main {
        font-size: 1.325rem;
        line-height: 1.15;
    }

    .navbar-brand-branch {
        font-size: 0.975rem;
        line-height: 1.15;
    }

    .navbar-brand-fp {
        font-size: 0.875rem;
        letter-spacing: 0.1em;
        line-height: 1.15;
    }

    .navbar-right {
        min-width: auto;
    }

    .nav-logout-btn span {
        display: none;
    }

    .nav-logout-btn {
        padding: 6px 8px;
    }

    .mobile-only-cards {
        display: flex;
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }

    /* Activate FAB & Rudder */
    .mobile-fab-wrap {
        display: block;
        bottom: calc(70px + env(safe-area-inset-bottom, 0px));
        right: 18px;
    }

    .mobile-bottom-rudder {
        display: block;
    }

    .view-container {
        padding: 12px;
        padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)); /* Space for bottom tab bar */
    }

    .charts-bento-grid {
        grid-template-columns: 1fr;
    }

    .branch-header-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding: 14px;
    }

    .branch-header-buttons {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: flex-start;
        gap: 8px;
    }

    /* Transform Modals into Apple-style Bottom Sheets */
    .modal-overlay {
        align-items: flex-end;
        padding: 0;
    }

    .modal-card.bottom-sheet-card {
        max-width: 100%;
        width: 100%;
        border-radius: var(--radius-sheet);
        padding: 16px 20px 28px;
        max-height: 85vh;
        animation: sheetSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    }

    .sheet-drag-handle {
        display: block;
    }

    @keyframes sheetSlideUp {
        from { transform: translateY(100%); }
        to { transform: translateY(0); }
    }

    .header-actions {
        width: 100%;
    }
    .header-actions .search-input {
        width: 100%;
        min-width: 100%;
    }
}

/* ==========================================================================
   MEMBER LOOKUP & BACKUP RESTORE UTILITIES
   ========================================================================== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 9999px;
    font-size: 0.6875rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.02em;
}

.badge-emerald {
    background: rgba(16, 185, 129, 0.12);
    color: var(--emerald);
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.badge-amber {
    background: rgba(245, 158, 11, 0.12);
    color: var(--amber);
    border: 1px solid rgba(245, 158, 11, 0.25);
}

.badge-slate {
    background: rgba(100, 116, 139, 0.12);
    color: var(--text-muted);
    border: 1px solid rgba(100, 116, 139, 0.2);
}

.badge-primary {
    background: rgba(30, 41, 59, 0.08);
    color: var(--primary);
    border: 1px solid rgba(30, 41, 59, 0.18);
}

.spinner-inline {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 2.5px solid rgba(0, 0, 0, 0.1);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.spin {
    animation: spin 1s linear infinite;
}

/* ==========================================================================
   ROUND AVATAR & PHOTO UPLOAD COMPONENT STYLES
   ========================================================================== */
.table-member-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid var(--border-color);
    flex-shrink: 0;
    vertical-align: middle;
}

.table-member-avatar-initials {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #f1f5f9;
    color: #475569;
    font-size: 0.6875rem;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid var(--border-color);
    flex-shrink: 0;
    vertical-align: middle;
}

.member-name-cell {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.mobile-member-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
    flex-shrink: 0;
}

.mobile-member-avatar-initials {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #0f172a;
    color: #ffffff;
    font-size: 0.8rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.15);
}

.nav-avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

/* Avatar Upload Component in Modals */
.avatar-upload-group {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 14px;
    background: var(--bg-surface-subtle);
    border: 1px dashed #cbd5e1;
    border-radius: var(--radius-md);
    margin-bottom: 14px;
}

.avatar-preview-wrap {
    position: relative;
    width: 52px;
    height: 52px;
    flex-shrink: 0;
}

.avatar-circle-preview {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #0f172a;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
}

.avatar-circle-placeholder {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: #e2e8f0;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed #94a3b8;
    font-size: 1.2rem;
}

.avatar-upload-controls {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.avatar-upload-hint {
    font-size: 0.6875rem;
    color: var(--text-muted);
}

.user-profile-badge {
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    user-select: none;
}
.user-profile-badge:hover {
    background: #e2e8f0;
    border-color: #94a3b8;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
.user-profile-badge:active {
    transform: scale(0.96);
}

.user-avatar-large {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}
.user-avatar-large:hover {
    transform: scale(1.05);
}

.bial-banner-avatar-img {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #0f172a;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
}

.bial-banner-avatar-initials {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: #0f172a;
    color: #ffffff;
    font-size: 0.95rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.2);
}

.profile-edit-tag {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.6875rem;
    font-weight: 700;
    color: #0284c7;
    background: rgba(2, 132, 199, 0.08);
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 6px;
    vertical-align: middle;
}

/* ==========================================================================
   BIAL MONTHLY RECORDS & ALL MONTHS STATEMENT STYLES
   ========================================================================== */
.modal-card-wide {
    max-width: 860px;
    width: 100%;
}

.bial-records-container {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 10px;
}

.records-month-pills {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 6px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.records-pill-btn {
    padding: 6px 12px;
    border-radius: 9999px;
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.records-pill-btn:hover {
    background: var(--bg-surface-subtle);
    border-color: var(--border-subtle);
    color: var(--text-primary);
}

.records-pill-btn.active {
    background: #0f172a;
    color: #ffffff;
    border-color: #0f172a;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.2);
}

.records-summary-card {
    background: var(--bg-surface-subtle);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
}

.records-summary-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    gap: 8px;
}

.records-summary-title {
    font-size: 1.05rem;
    font-weight: 800;
    margin-top: 2px;
}

.records-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.records-stat-box {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xs);
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.records-stat-lbl {
    font-size: 0.6875rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.records-stat-val {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 800;
}

.records-members-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 48vh;
    overflow-y: auto;
    padding-right: 4px;
}

.records-member-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    gap: 12px;
    transition: background 0.12s ease;
}

.records-member-row:hover {
    background: var(--bg-surface-subtle);
}

.records-member-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.records-member-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.records-member-name:hover {
    text-decoration: underline;
}

.records-member-sub {
    font-size: 0.6875rem;
    color: var(--text-muted);
}

.records-member-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.records-paid-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 9999px;
    background: rgba(16, 185, 129, 0.12);
    color: var(--emerald);
    border: 1px solid rgba(16, 185, 129, 0.25);
    font-size: 0.75rem;
    font-weight: 800;
}

.records-unpaid-tag {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 9999px;
    background: rgba(225, 29, 72, 0.08);
    color: var(--rose);
    border: 1px solid rgba(225, 29, 72, 0.2);
    font-size: 0.7rem;
    font-weight: 700;
}

.badge-rose {
    background: rgba(225, 29, 72, 0.12);
    color: var(--rose);
    border: 1px solid rgba(225, 29, 72, 0.25);
}

