/* ==============================================================================
   TALLY — MODERN FINTECH & EXPENSE LEDGER DESIGN SYSTEM
   Theme: Midnight Slate & Electric Emerald / Coral Accents
   ============================================================================== */

:root {
    /* Color Palette */
    --bg-base: #090d16;
    --bg-surface: #0f172a;
    --bg-card: #141f36;
    --bg-card-hover: #1a2744;
    --bg-glass: rgba(19, 29, 51, 0.75);
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-medium: rgba(255, 255, 255, 0.15);
    --border-focus: rgba(99, 102, 241, 0.6);

    /* Text Colors */
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-inverse: #0f172a;

    /* Brand & Accent Colors */
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-glow: rgba(99, 102, 241, 0.25);

    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.12);
    --success-border: rgba(16, 185, 129, 0.25);

    --danger: #f43f5e;
    --danger-bg: rgba(244, 63, 94, 0.12);
    --danger-border: rgba(244, 63, 94, 0.25);

    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.12);

    --whatsapp-green: #25D366;
    --whatsapp-hover: #1eb956;
    --whatsapp-bg: rgba(37, 211, 102, 0.12);
    --whatsapp-border: rgba(37, 211, 102, 0.25);

    /* Typography */
    --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 24px var(--primary-glow);

    /* Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 9999px;

    /* Transitions */
    --transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Reset & Box Sizing */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font-sans);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    background-image: 
        radial-gradient(at 15% 15%, rgba(99, 102, 241, 0.1) 0px, transparent 50%),
        radial-gradient(at 85% 85%, rgba(16, 185, 129, 0.08) 0px, transparent 50%);
    background-attachment: fixed;
}

/* Monospace Helper */
.font-mono {
    font-family: var(--font-mono);
    letter-spacing: -0.02em;
}

/* Utilities */
.hidden { display: none !important; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.flex-1 { flex: 1; }

/* ==============================================================================
   BUTTONS
   ============================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: var(--font-sans);
    font-size: 0.875rem;
    font-weight: 600;
    padding: 10px 18px;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}
.btn-primary:hover {
    background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
}

.btn-secondary {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}
.btn-secondary:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-1px);
}

.btn-glass {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-medium);
}
.btn-glass:hover {
    background: var(--bg-card-hover);
    border-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}

.btn-whatsapp {
    background: #25D366;
    color: #ffffff;
    font-weight: 700;
    box-shadow: 0 4px 14px rgba(37, 211, 102, 0.35);
}
.btn-whatsapp:hover {
    background: #1eb956;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.5);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8125rem;
    border-radius: var(--radius-sm);
}

/* ==============================================================================
   HEADER & NAVIGATION
   ============================================================================== */
.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(9, 13, 22, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-subtle);
}

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

.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Brand Logo */
.brand-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.logo-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, #6366f1 0%, #10b981 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 0 16px rgba(99, 102, 241, 0.4);
}

.brand-name {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    background: linear-gradient(to right, #ffffff, #cbd5e1);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-badge {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    padding: 2px 6px;
    border-radius: 4px;
}

/* Group Selector Dropdown */
.group-selector-wrap {
    position: relative;
}

.group-dropdown-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    padding: 6px 14px;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.875rem;
    font-weight: 600;
}
.group-dropdown-btn:hover {
    background: var(--bg-card);
    border-color: var(--border-medium);
}

.group-name-label {
    max-width: 160px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dropdown-chevron {
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

.group-dropdown-menu, .profile-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 240px;
    background: var(--bg-surface);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 8px;
    z-index: 110;
    display: none;
    backdrop-filter: blur(16px);
}

.group-dropdown-menu.show, .profile-dropdown-menu.show {
    display: block;
    animation: dropIn 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

.dropdown-section-title {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    padding: 6px 10px;
}

.groups-menu-list {
    max-height: 200px;
    overflow-y: auto;
}

.group-item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.875rem;
    transition: var(--transition);
}
.group-item-row:hover {
    background: var(--bg-card-hover);
}
.group-item-row.active {
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary);
    font-weight: 600;
}

.dropdown-divider {
    height: 1px;
    background: var(--border-subtle);
    margin: 6px 0;
}

.dropdown-action-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.8125rem;
    font-weight: 600;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-align: left;
    transition: var(--transition);
}
.dropdown-action-btn:hover {
    background: var(--bg-card-hover);
}
.dropdown-action-btn.danger {
    color: var(--danger);
}

/* WhatsApp Pill in Nav */
.whatsapp-pill-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--whatsapp-bg);
    border: 1px solid var(--whatsapp-border);
    color: var(--whatsapp-green);
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-size: 0.8125rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}
.whatsapp-pill-btn:hover {
    background: rgba(37, 211, 102, 0.2);
    border-color: var(--whatsapp-green);
    transform: translateY(-1px);
}

.wa-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--whatsapp-green);
    box-shadow: 0 0 8px var(--whatsapp-green);
}

/* User Session Pill */
.user-session-wrap {
    position: relative;
}

.user-profile-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    padding: 4px 12px 4px 4px;
    border-radius: var(--radius-full);
    cursor: pointer;
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 600;
    transition: var(--transition);
}
.user-profile-btn:hover {
    border-color: var(--border-medium);
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ec4899, #8b5cf6);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6875rem;
    font-weight: 800;
}

.profile-menu-header {
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
}
.profile-menu-header span {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Demo Banner */
.demo-banner {
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.15), rgba(16, 185, 129, 0.15));
    border-bottom: 1px solid rgba(99, 102, 241, 0.2);
    padding: 8px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}
.demo-banner code {
    background: rgba(0, 0, 0, 0.4);
    padding: 2px 6px;
    border-radius: 4px;
    color: #e2e8f0;
    font-family: var(--font-mono);
}
.demo-badge {
    background: #6366f1;
    color: white;
    font-size: 0.6875rem;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
    margin-right: 8px;
}
.demo-banner-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.875rem;
}
.demo-banner-close:hover {
    color: var(--text-primary);
}

/* ==============================================================================
   MAIN CONTAINER & HERO SECTION
   ============================================================================== */
.main-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 28px 24px 60px;
}

.group-hero-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 28px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}
.group-hero-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 300px;
    height: 100%;
    background: radial-gradient(circle at 100% 0%, rgba(99, 102, 241, 0.15), transparent 70%);
    pointer-events: none;
}

.hero-header-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.hero-title-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 6px;
}

.hero-title {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text-primary);
}

.currency-tag {
    font-size: 0.75rem;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    padding: 3px 8px;
    border-radius: var(--radius-full);
}

.hero-desc {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    max-width: 600px;
}

.hero-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* Members Avatar Stack */
.hero-members-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-top: 16px;
    border-top: 1px solid var(--border-subtle);
}

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

.avatar-stack {
    display: flex;
    align-items: center;
}

.member-avatar-pill {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 2px solid var(--bg-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: white;
    margin-left: -8px;
    position: relative;
    cursor: default;
    transition: var(--transition);
}
.member-avatar-pill:first-child {
    margin-left: 0;
}
.member-avatar-pill:hover {
    transform: translateY(-2px) scale(1.1);
    z-index: 10;
}

.add-member-mini-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px dashed var(--border-medium);
    background: none;
    color: var(--text-secondary);
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}
.add-member-mini-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

/* ==============================================================================
   METRICS GRID
   ============================================================================== */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.metric-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}
.metric-card:hover {
    border-color: var(--border-medium);
    transform: translateY(-2px);
}

.metric-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    background: rgba(255, 255, 255, 0.05);
}

.metric-card.positive .positive-icon {
    background: var(--success-bg);
    color: var(--success);
    font-weight: 800;
}

.metric-card.negative .negative-icon {
    background: var(--danger-bg);
    color: var(--danger);
    font-weight: 800;
}

.metric-card.highlight {
    border-color: rgba(99, 102, 241, 0.3);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(15, 23, 42, 0.9));
}

.metric-body {
    display: flex;
    flex-direction: column;
}

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

.metric-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* ==============================================================================
   TABS NAVIGATION
   ============================================================================== */
.ledger-tabs-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 24px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.tab-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    font-weight: 600;
    padding: 12px 18px;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    white-space: nowrap;
}
.tab-btn:hover {
    color: var(--text-primary);
}
.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: rgba(99, 102, 241, 0.06);
}

.tab-btn.whatsapp-tab-highlight {
    color: var(--whatsapp-green);
}
.tab-btn.whatsapp-tab-highlight.active {
    border-bottom-color: var(--whatsapp-green);
    background: var(--whatsapp-bg);
}

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

/* ==============================================================================
   TAB 1: EXPENSES LEDGER LIST
   ============================================================================== */
.ledger-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.search-input-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    padding: 8px 16px;
    border-radius: var(--radius-full);
    min-width: 280px;
    flex: 1;
    max-width: 450px;
}
.search-input-wrap svg {
    color: var(--text-muted);
}
.search-input-wrap input {
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.875rem;
    width: 100%;
}
.search-input-wrap input::placeholder {
    color: var(--text-muted);
}

.ledger-filter-tags {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-pill {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: var(--transition);
}
.filter-pill:hover {
    border-color: var(--border-medium);
}
.filter-pill.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.expenses-ledger-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Expense Card */
.expense-item-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    transition: var(--transition);
}
.expense-item-card:hover {
    border-color: var(--border-medium);
    background: var(--bg-card);
    transform: translateX(2px);
}

.expense-left-col {
    display: flex;
    align-items: center;
    gap: 16px;
}

.expense-date-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 48px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    text-align: center;
}
.date-month {
    font-size: 0.625rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--primary);
}
.date-day {
    font-size: 1.125rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.1;
}

.expense-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.expense-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.expense-meta-tags {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 0.75rem;
    color: var(--text-muted);
}
.expense-meta-tags strong {
    color: var(--text-secondary);
}

.tag-split-info {
    background: rgba(255, 255, 255, 0.06);
    padding: 2px 8px;
    border-radius: 4px;
}

.expense-right-col {
    display: flex;
    align-items: center;
    gap: 24px;
}

.expense-total-display {
    text-align: right;
    display: flex;
    flex-direction: column;
}
.total-label {
    font-size: 0.6875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 700;
}
.total-num {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
}

.expense-personal-share {
    text-align: right;
    min-width: 120px;
    display: flex;
    flex-direction: column;
}
.share-label {
    font-size: 0.6875rem;
    text-transform: uppercase;
    font-weight: 700;
}
.share-num {
    font-size: 1.125rem;
    font-weight: 800;
}

.expense-actions-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}
.expense-actions-btn:hover {
    color: var(--danger);
    background: var(--danger-bg);
}

/* ==============================================================================
   TAB 2: BALANCES & DEBT SIMPLIFICATION
   ============================================================================== */
.balances-dual-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.balance-column-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.balance-column-card.highlight-card {
    background: linear-gradient(180deg, rgba(99, 102, 241, 0.06) 0%, rgba(15, 23, 42, 0.9) 100%);
    border-color: rgba(99, 102, 241, 0.25);
}

.column-card-header {
    margin-bottom: 20px;
}
.column-card-header h3 {
    font-size: 1.125rem;
    font-weight: 800;
    color: var(--text-primary);
}
.column-card-header .subtext {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.header-badge-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.badge-mini {
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary);
    font-size: 0.6875rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: var(--radius-full);
}

.net-balances-list, .debts-settle-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Individual Net Row */
.net-balance-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
}

.member-identity {
    display: flex;
    align-items: center;
    gap: 12px;
}

.member-name {
    font-size: 0.9375rem;
    font-weight: 700;
}

/* Debt Settle Row ("A owes B") */
.debt-settle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.08);
    gap: 12px;
}

.debt-flow {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9375rem;
}

.debtor-name {
    font-weight: 700;
    color: var(--danger);
}

.debt-arrow {
    color: var(--text-muted);
    font-size: 1.125rem;
}

.creditor-name {
    font-weight: 700;
    color: var(--success);
}

.debt-action-wrap {
    display: flex;
    align-items: center;
    gap: 14px;
}

.debt-amount {
    font-size: 1.125rem;
    font-weight: 800;
    color: var(--text-primary);
}

/* ==============================================================================
   TAB 3: SETTLEMENTS HISTORY
   ============================================================================== */
.settlements-history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.settlement-item-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.settlement-meta {
    display: flex;
    align-items: center;
    gap: 14px;
}

.settlement-icon {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--success-bg);
    color: var(--success);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

/* ==============================================================================
   TAB 4: WHATSAPP BOT & INTERACTIVE SIMULATOR
   ============================================================================== */
.whatsapp-layout-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 28px;
}

.wa-info-panel {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 28px;
}

.wa-panel-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--whatsapp-bg);
    border: 1px solid var(--whatsapp-border);
    color: var(--whatsapp-green);
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
    margin-bottom: 16px;
}

.wa-info-panel h2 {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 12px;
    letter-spacing: -0.02em;
}

.wa-description {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    line-height: 1.6;
    margin-bottom: 24px;
}

.wa-code-card {
    background: var(--bg-card);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 24px;
}

.code-label {
    font-size: 0.8125rem;
    color: var(--text-muted);
    font-weight: 600;
    display: block;
    margin-bottom: 8px;
}

.code-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-surface);
    border: 1px dashed var(--whatsapp-border);
    border-radius: var(--radius-sm);
    padding: 10px 16px;
    margin-bottom: 12px;
}

.code-text {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    color: var(--whatsapp-green);
}

.code-instructions {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
}
.code-instructions code {
    background: rgba(0, 0, 0, 0.4);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--whatsapp-green);
}

.wa-commands-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 20px;
}
.wa-commands-card h3 {
    font-size: 0.9375rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.commands-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.commands-list li {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}
.commands-list code {
    background: rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: var(--font-mono);
}

/* WhatsApp In-Browser Simulator */
.wa-simulator-card {
    background: #0b141a;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    height: 600px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.wa-sim-header {
    background: #202c33;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.wa-sim-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #00a884;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.wa-sim-meta {
    flex: 1;
    display: flex;
    flex-direction: column;
}
.wa-sim-meta strong {
    font-size: 0.9375rem;
    color: #e9edef;
}
.wa-sim-status {
    font-size: 0.6875rem;
    color: #8696a0;
    display: flex;
    align-items: center;
    gap: 4px;
}
.wa-sim-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #00a884;
}

.btn-clear-sim {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #8696a0;
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}
.btn-clear-sim:hover {
    color: #e9edef;
    border-color: rgba(255, 255, 255, 0.25);
}

.wa-sim-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background-color: #0b141a;
    background-image: radial-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 16px 16px;
}

.sim-msg {
    display: flex;
    max-width: 85%;
}
.sim-msg.bot {
    align-self: flex-start;
}
.sim-msg.user {
    align-self: flex-end;
}

.sim-bubble {
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.875rem;
    line-height: 1.45;
    position: relative;
    word-break: break-word;
}
.sim-msg.bot .sim-bubble {
    background: #202c33;
    color: #e9edef;
    border-top-left-radius: 2px;
}
.sim-msg.user .sim-bubble {
    background: #005c4b;
    color: #e9edef;
    border-top-right-radius: 2px;
}

.sim-time {
    display: block;
    font-size: 0.625rem;
    color: rgba(255, 255, 255, 0.5);
    text-align: right;
    margin-top: 4px;
}

.sim-quick-actions {
    background: #111b21;
    padding: 8px 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.quick-cmd-pill {
    background: #202c33;
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #8696a0;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition);
}
.quick-cmd-pill:hover {
    color: #e9edef;
    border-color: #00a884;
    background: rgba(0, 168, 132, 0.15);
}

.wa-sim-footer {
    background: #202c33;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.wa-sim-footer input {
    flex: 1;
    background: #2a3942;
    border: none;
    outline: none;
    color: #e9edef;
    font-family: var(--font-sans);
    font-size: 0.875rem;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
}

.sim-send-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #00a884;
    border: none;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}
.sim-send-btn:hover {
    background: #029474;
    transform: scale(1.05);
}

/* ==============================================================================
   MODALS & FORMS
   ============================================================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 20px;
    overflow-y: auto;
}

.modal-dialog {
    background: var(--bg-surface);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 520px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalScale 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-dialog.auth-dialog {
    max-width: 450px;
}

.modal-header {
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-subtle);
}
.modal-header h3 {
    font-size: 1.125rem;
    font-weight: 800;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.125rem;
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
}
.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--text-secondary);
}

.form-group input, .form-group select {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    outline: none;
    transition: var(--transition);
}
.form-group input:focus, .form-group select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

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

.helper-text {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Split Segmented Control */
.split-type-segmented {
    display: flex;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 4px;
    gap: 4px;
}

.segment-btn {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.8125rem;
    font-weight: 700;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}
.segment-btn.active {
    background: var(--bg-surface);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

/* Split Members Checklist */
.split-members-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.btn-text-action {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
}

.split-members-checklist {
    max-height: 180px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--bg-card);
    padding: 12px;
    border-radius: var(--radius-md);
}

.split-member-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}
.split-member-row:hover {
    background: var(--bg-surface);
}

.member-check-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.split-calc-display {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-secondary);
}

.split-custom-input {
    width: 90px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    text-align: right;
    font-size: 0.875rem;
}

.split-summary-bar {
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    font-size: 0.875rem;
    text-align: center;
    color: var(--text-primary);
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 8px;
}

/* WhatsApp Modal Details */
.modal-wa-title {
    display: flex;
    align-items: center;
    gap: 8px;
}
.modal-desc {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.linking-code-banner {
    background: var(--bg-card);
    border: 1px dashed var(--whatsapp-border);
    border-radius: var(--radius-md);
    padding: 16px;
    text-align: center;
}
.linking-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
}
.linking-number {
    font-size: 2rem;
    font-weight: 800;
    color: var(--whatsapp-green);
    letter-spacing: 0.15em;
    margin-top: 4px;
}

/* Auth Alert Banner inside Modal */
.auth-alert-banner {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    line-height: 1.5;
    animation: fadeIn 0.2s ease-in-out;
}
.auth-alert-banner.info {
    background: rgba(99, 102, 241, 0.12);
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: var(--text-primary);
}
.auth-alert-banner.error {
    background: rgba(244, 63, 94, 0.12);
    border: 1px solid rgba(244, 63, 94, 0.3);
    color: #fca5a5;
}
.auth-alert-banner .alert-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
    line-height: 1.2;
}
.auth-alert-banner .alert-content {
    flex: 1;
    min-width: 0;
}
.auth-alert-banner .alert-title {
    display: block;
    color: var(--text-primary);
    font-weight: 700;
    margin-bottom: 4px;
    font-size: 0.9375rem;
}
.auth-alert-banner .alert-content p {
    margin: 0;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.45;
}
.auth-alert-banner .alert-actions {
    margin-top: 10px;
}
.auth-alert-banner .alert-subnote {
    margin-top: 10px;
    font-size: 0.78125rem;
    color: var(--text-muted);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 8px;
    line-height: 1.45;
}
.auth-alert-banner .alert-subnote strong {
    color: var(--text-primary);
    font-weight: 600;
    display: inline;
}

/* Auth Toggle Link */
.auth-toggle-link {
    text-align: center;
    padding: 4px 0;
}
.auth-toggle-link a {
    color: var(--primary);
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
    display: inline-block;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
}
.auth-toggle-link a:hover {
    color: #818cf8;
    background: rgba(99, 102, 241, 0.12);
}

#btnHeaderLogout {
    transition: var(--transition);
}
#btnHeaderLogout:hover {
    color: var(--danger);
    border-color: var(--danger-border);
    background: var(--danger-bg);
}

/* Button Spinner */
.spinner-icon {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spinBtn 0.7s linear infinite;
    vertical-align: middle;
    margin-right: 6px;
}
@keyframes spinBtn {
    to { transform: rotate(360deg); }
}

.btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none !important;
}

.modal-steps-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.step-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}
.step-num {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 800;
    flex-shrink: 0;
}
.step-item code {
    background: rgba(0, 0, 0, 0.4);
    color: var(--whatsapp-green);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: var(--font-mono);
}

.phone-direct-link-box {
    background: var(--bg-card);
    padding: 14px;
    border-radius: var(--radius-md);
}
.phone-direct-link-box label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 8px;
}
.phone-input-row {
    display: flex;
    gap: 10px;
}
.phone-input-row input {
    flex: 1;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
}

.auth-toggle-link {
    text-align: center;
    font-size: 0.8125rem;
}
.auth-toggle-link a {
    color: var(--primary);
    text-decoration: none;
}
.auth-toggle-link a:hover {
    text-decoration: underline;
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    background: var(--bg-surface);
    border: 1px dashed var(--border-medium);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}
.empty-icon {
    font-size: 2.5rem;
}
.empty-state h3 {
    font-size: 1.125rem;
    font-weight: 700;
}
.empty-state p {
    font-size: 0.875rem;
    color: var(--text-muted);
    max-width: 400px;
}

/* ==============================================================================
   TOAST NOTIFICATIONS
   ============================================================================== */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--bg-surface);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    padding: 12px 18px;
    box-shadow: var(--shadow-lg);
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideInRight 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.toast.success {
    border-color: var(--success);
}
.toast.error {
    border-color: var(--danger);
}
.toast.wa-notify {
    border-color: var(--whatsapp-green);
    background: #0b141a;
    color: #e9edef;
}

/* ==============================================================================
   ANIMATIONS & RESPONSIVE
   ============================================================================== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes modalScale {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Responsive adjustments */
@media (max-width: 900px) {
    .balances-dual-grid, .insights-layout-grid {
        grid-template-columns: 1fr;
    }
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .header-container {
        padding: 10px 16px;
    }
    .brand-name {
        display: none;
    }
    .metrics-grid {
        grid-template-columns: 1fr;
    }
    .hero-actions {
        width: 100%;
    }
    .hero-actions .btn {
        flex: 1;
    }
    .expense-item-card {
        flex-direction: column;
        align-items: flex-start;
    }
    .expense-right-col {
        width: 100%;
        justify-content: space-between;
        padding-top: 12px;
        border-top: 1px solid var(--border-subtle);
    }
    .stats-metric-strip {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* ==============================================================================
   MODE PILL & LIVE / DEMO STATUS
   ============================================================================== */
.mode-pill-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-medium);
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: var(--radius-full);
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}
.mode-pill-btn:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}
.mode-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--warning);
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.6);
}
.mode-dot.live {
    background: var(--success);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
}
.mode-dot.demo {
    background: var(--warning);
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.6);
}

.demo-banner-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}
.btn-xs {
    padding: 4px 10px;
    font-size: 0.75rem;
    border-radius: 6px;
}

/* ==============================================================================
   SPENDING INSIGHTS & ANALYTICS TAB
   ============================================================================== */
.insights-layout-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}
.insights-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.insights-card.full-width {
    grid-column: 1 / -1;
}
.insights-card-header {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.insights-card-header h3 {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
}
.insights-card-subtitle {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* Category Breakdown */
.category-breakdown-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.category-bar-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.category-bar-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
}
.category-meta-left {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}
.category-meta-right {
    display: flex;
    align-items: center;
    gap: 10px;
}
.category-pct {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.category-track {
    width: 100%;
    height: 8px;
    background: var(--bg-card);
    border-radius: var(--radius-full);
    overflow: hidden;
}
.category-fill {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width 0.4s ease-out;
}

/* Payer Breakdown */
.payer-breakdown-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.payer-row-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    transition: var(--transition);
}
.payer-row-card:hover {
    border-color: var(--border-medium);
    background: var(--bg-card-hover);
}
.payer-left-info {
    display: flex;
    align-items: center;
    gap: 10px;
}
.payer-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.75rem;
    color: #fff;
}
.payer-name {
    font-weight: 600;
    font-size: 0.875rem;
}
.payer-right-info {
    text-align: right;
}
.payer-amount {
    font-weight: 700;
    font-size: 0.9375rem;
    color: var(--text-primary);
}
.payer-share-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Stats Metric Strip */
.stats-metric-strip {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}
.stat-box {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.stat-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 700;
}
.stat-number {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-primary);
}

/* ==============================================================================
   EXPENSE DETAIL MODAL & ROW ENHANCEMENTS
   ============================================================================== */
.expense-item-card {
    cursor: pointer;
}
.expense-category-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 500;
}
.expense-detail-title-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}
.detail-category-icon {
    font-size: 1.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-medium);
}
.detail-expense-date {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.expense-detail-hero {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08) 0%, rgba(16, 185, 129, 0.06) 100%);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}
.detail-amount-sub {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 700;
}
.detail-amount {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-primary);
}
.detail-payer-pill {
    display: inline-block;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    background: var(--bg-card);
    border: 1px solid var(--border-medium);
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.detail-section {
    margin-top: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.detail-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.detail-section-header h4 {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--text-primary);
}
.detail-splits-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.detail-split-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
}
.detail-split-user {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.875rem;
}
.detail-split-amt {
    font-weight: 700;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.modal-footer-split {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}
.modal-footer-right {
    display: flex;
    gap: 10px;
}
.btn-danger-glass {
    background: rgba(244, 63, 94, 0.1);
    color: var(--danger);
    border: 1px solid var(--danger-border);
}
.btn-danger-glass:hover {
    background: rgba(244, 63, 94, 0.2);
    transform: translateY(-1px);
}

/* Auth Modal Demo Divider */
.auth-demo-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 16px 0 12px;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.auth-demo-divider::before, .auth-demo-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border-subtle);
}
.auth-demo-divider span {
    padding: 0 10px;
}
.w-full {
    width: 100%;
}

/* Quick Settle Button inside Smart Settlement list */
.btn-quick-settle {
    padding: 5px 12px;
    border-radius: 6px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}
.btn-quick-settle:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.debt-row-action-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ==============================================================================
   ALL TRIPS & GROUPS MODAL & CARDS
   ============================================================================== */
.btn-all-trips {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(99, 102, 241, 0.12);
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: #c7d2fe;
    font-family: var(--font-sans);
    font-size: 0.8125rem;
    font-weight: 700;
    padding: 6px 14px;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: var(--transition);
}
.btn-all-trips:hover {
    background: rgba(99, 102, 241, 0.22);
    border-color: rgba(99, 102, 241, 0.5);
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

.modal-dialog-wide {
    max-width: 820px;
    width: 100%;
}

.all-trips-title-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}
.trips-title-icon {
    font-size: 1.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border-medium);
}
.modal-subtitle {
    font-size: 0.8125rem;
    color: var(--text-muted);
}
.header-modal-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.trips-grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
    max-height: 65vh;
    overflow-y: auto;
    padding: 4px 2px;
}

.trip-overview-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 18px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 14px;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}
.trip-overview-card:hover {
    border-color: rgba(99, 102, 241, 0.4);
    background: var(--bg-card-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.trip-overview-card.active {
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.12) 0%, rgba(15, 23, 42, 0.8) 100%);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.2);
}

.trip-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}
.trip-card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
}
.trip-badge-active {
    font-size: 0.6875rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(99, 102, 241, 0.2);
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.4);
    white-space: nowrap;
}

.trip-card-desc {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.trip-card-stats {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding-top: 10px;
    border-top: 1px solid var(--border-subtle);
}
.trip-stat-label {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 700;
}
.trip-stat-value {
    font-size: 1.0625rem;
    font-weight: 800;
    color: var(--text-primary);
}

.trip-balance-tag {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    display: inline-block;
}
.trip-balance-tag.positive {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid var(--success-border);
}
.trip-balance-tag.negative {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid var(--danger-border);
}
.trip-balance-tag.neutral {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
}

.trip-members-preview {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
}
.trip-member-avatar-micro {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 0.625rem;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Card to create trip */
.trip-create-quick-card {
    border: 2px dashed var(--border-medium);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 24px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.02);
    transition: var(--transition);
    min-height: 170px;
    color: var(--text-secondary);
}
.trip-create-quick-card:hover {
    border-color: var(--primary);
    color: var(--text-primary);
    background: rgba(99, 102, 241, 0.05);
    transform: translateY(-2px);
}
.trip-create-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border-medium);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: var(--primary);
}

/* ==============================================================================
   NO GROUPS EMPTY HERO (PRODUCTION CLEAN STATE)
   ============================================================================== */
.no-groups-hero {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    min-height: 50vh;
}
.no-groups-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-lg);
    padding: 48px 36px;
    text-align: center;
    max-width: 540px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}
.no-groups-icon {
    font-size: 3rem;
    width: 80px;
    height: 80px;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(16, 185, 129, 0.15) 100%);
    border: 1px solid var(--border-medium);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
}
.no-groups-card h2 {
    font-size: 1.625rem;
    font-weight: 800;
    color: var(--text-primary);
}
.no-groups-card p {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    line-height: 1.6;
}
.btn-lg {
    padding: 14px 28px;
    font-size: 1rem;
    border-radius: var(--radius-md);
}



