/* ===== Design Tokens — Light Analytics Dashboard ===== */
:root {
    --bg-body: #eeedf5;
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f9f8ff;
    --bg-input: #f5f4fa;
    --bg-modal: #ffffff;

    --text-primary: #1e1b4b;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;

    --accent-blue: #6366f1;
    --accent-blue-light: #818cf8;
    --accent-blue-glow: rgba(99, 102, 241, 0.18);
    --accent-purple: #8b5cf6;
    --accent-green: #10b981;
    --accent-green-bg: rgba(16, 185, 129, 0.1);
    --accent-orange: #f59e0b;
    --accent-orange-bg: rgba(245, 158, 11, 0.1);
    --accent-red: #ef4444;
    --accent-red-bg: rgba(239, 68, 68, 0.08);
    --accent-cyan: #06b6d4;

    --border-color: #e5e7eb;
    --border-subtle: rgba(99, 102, 241, 0.1);
    --border-light: #f0eff5;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    --shadow-card:
        0 2px 12px rgba(99, 102, 241, 0.06), 0 1px 4px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.12);

    --sidebar-width: 72px;
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
}

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family:
        "Inter",
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-tap-highlight-color: transparent;
}

/* ===== Sidebar ===== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 0;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    box-shadow: 2px 0 20px rgba(99, 102, 241, 0.05);
}

.sidebar-logo {
    width: 42px;
    height: 42px;
    background: linear-gradient(
        135deg,
        var(--accent-blue),
        var(--accent-purple)
    );
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    margin-bottom: 28px;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
    transition: transform var(--transition-normal);
}
.sidebar-logo:hover {
    transform: scale(1.08);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    flex: 1;
}

.sidebar-btn {
    width: 44px;
    height: 44px;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-normal);
    position: relative;
}
.sidebar-btn::before {
    content: "";
    position: absolute;
    left: -14px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 0;
    background: var(--accent-blue);
    border-radius: 0 3px 3px 0;
    transition: height var(--transition-normal);
}
.sidebar-btn:hover {
    background: rgba(99, 102, 241, 0.08);
    color: var(--accent-blue);
}
.sidebar-btn.active {
    background: rgba(99, 102, 241, 0.1);
    color: var(--accent-blue);
}
.sidebar-btn.active::before {
    height: 22px;
}

.sidebar-bottom {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin-top: auto;
}
.sidebar-btn-logout:hover {
    background: var(--accent-red-bg) !important;
    color: var(--accent-red) !important;
}

/* ===== Main Content ===== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

/* ===== Top Header ===== */
.top-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-light);
    padding: 18px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
    gap: 16px;
    flex-wrap: wrap;
}
.header-left {
    display: flex;
    align-items: center;
    gap: 32px;
}
.greeting h1 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}
.greeting-sub {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-icon-btn {
    width: 40px;
    height: 40px;
    border: 1px solid var(--border-light);
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
}
.header-icon-btn:hover {
    background: rgba(99, 102, 241, 0.06);
    border-color: rgba(99, 102, 241, 0.2);
    color: var(--accent-blue);
}

.notif-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: var(--accent-red);
    border-radius: 50%;
    border: 2px solid white;
}

.header-avatar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px 6px 10px;
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    border-radius: 24px;
    color: var(--text-secondary);
    font-size: 0.82rem;
    cursor: default;
}
.user-email-text {
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-primary);
    font-weight: 500;
}

/* ===== Theme Toggle ===== */
.theme-toggle {
    width: 40px;
    height: 40px;
    border: 1px solid var(--border-light);
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}
.theme-toggle:hover {
    background: rgba(99, 102, 241, 0.06);
    border-color: rgba(99, 102, 241, 0.2);
    color: var(--accent-blue);
}

/* ===== Pages ===== */
.page-view {
    animation: fadeInPage 0.3s ease;
}
@keyframes fadeInPage {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== Dashboard Body ===== */
.dashboard-body {
    padding: 28px 32px 60px;
}

/* ===== Dashboard Grid ===== */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 20px;
}
.dashboard-left {
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.dashboard-right {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ===== Panel ===== */
.panel {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    overflow: hidden;
}
.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border-light);
    flex-wrap: wrap;
    gap: 10px;
}
.panel-header h2 {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}
.panel-body {
    padding: 14px 22px 18px;
}
.panel-empty {
    padding: 28px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.88rem;
}
.btn-text {
    font-family: inherit;
    background: none;
    border: none;
    color: var(--accent-blue);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: color var(--transition-fast);
}
.btn-text:hover {
    color: var(--accent-blue-light);
}

/* ===== Stats ===== */
.stats-section {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 22px;
    display: flex;
    gap: 16px;
    align-items: center;
    box-shadow: var(--shadow-card);
    transition: all var(--transition-normal);
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.1);
}
.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.stat-total .stat-icon {
    background: linear-gradient(
        135deg,
        rgba(99, 102, 241, 0.1),
        rgba(139, 92, 246, 0.08)
    );
    color: var(--accent-blue);
}
.stat-active .stat-icon {
    background: linear-gradient(
        135deg,
        rgba(16, 185, 129, 0.1),
        rgba(6, 182, 212, 0.08)
    );
    color: var(--accent-green);
}
.stat-unpaid .stat-icon {
    background: linear-gradient(
        135deg,
        rgba(245, 158, 11, 0.1),
        rgba(249, 115, 22, 0.08)
    );
    color: var(--accent-orange);
}
.stat-earned .stat-icon {
    background: linear-gradient(
        135deg,
        rgba(236, 72, 153, 0.1),
        rgba(139, 92, 246, 0.08)
    );
    color: var(--accent-purple);
}
.stat-info {
    display: flex;
    flex-direction: column;
}
.stat-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
}
.stat-value {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

/* ===== Reminders ===== */
.reminder-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    margin-bottom: 10px;
    transition: all var(--transition-fast);
}
.reminder-card.overdue {
    background: var(--accent-orange-bg);
    border-color: rgba(245, 158, 11, 0.2);
}
.reminder-card.critical {
    background: var(--accent-red-bg);
    border-color: rgba(239, 68, 68, 0.2);
    animation: pulseBorder 2s ease infinite;
}
@keyframes pulseBorder {
    0%,
    100% {
        border-color: rgba(239, 68, 68, 0.2);
    }
    50% {
        border-color: rgba(239, 68, 68, 0.5);
    }
}
.reminder-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.reminder-card:not(.overdue) .reminder-icon {
    background: rgba(99, 102, 241, 0.1);
    color: var(--accent-blue);
}
.reminder-card.overdue .reminder-icon {
    background: rgba(245, 158, 11, 0.2);
    color: var(--accent-orange);
}
.reminder-card.critical .reminder-icon {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
}
.reminder-info {
    flex: 1;
    min-width: 0;
}
.reminder-name {
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text-primary);
}
.reminder-detail {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-top: 2px;
}
.reminder-amount {
    text-align: right;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--accent-orange);
    flex-shrink: 0;
}
.reminder-card.critical .reminder-amount {
    color: var(--accent-red);
}

@keyframes pulse {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* ===== Dashboard Panels ===== */
.dash-renter-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-light);
    transition: background var(--transition-fast);
}
.dash-renter-item:last-child {
    border-bottom: none;
}
.dash-renter-item:hover {
    background: var(--bg-card-hover);
    margin: 0 -22px;
    padding: 12px 22px;
    border-radius: var(--radius-sm);
}
.dash-renter-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 0.72rem;
    flex-shrink: 0;
}
.dash-renter-info {
    flex: 1;
    min-width: 0;
}
.dash-renter-name {
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text-primary);
}
.dash-renter-sub {
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dash-renter-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
}
.dash-renter-badge.unpaid {
    background: var(--accent-orange-bg);
    color: var(--accent-orange);
}
.dash-renter-badge.paid {
    background: var(--accent-green-bg);
    color: var(--accent-green);
}

/* Account Summary */
.account-summary-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-light);
}
.account-summary-item:last-child {
    border-bottom: none;
}
.account-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 0.65rem;
    flex-shrink: 0;
}
.account-summary-info {
    flex: 1;
    min-width: 0;
}
.account-summary-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
}
.account-summary-count {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.account-summary-bar {
    width: 60px;
    height: 6px;
    background: var(--bg-input);
    border-radius: 3px;
    overflow: hidden;
    flex-shrink: 0;
}
.account-summary-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}
.account-summary-pct {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    width: 32px;
    text-align: right;
    flex-shrink: 0;
}

/* Recent Payments */
.recent-payment-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-light);
}
.recent-payment-item:last-child {
    border-bottom: none;
}
.recent-payment-icon {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 0.68rem;
    flex-shrink: 0;
}
.recent-payment-info {
    flex: 1;
    min-width: 0;
}
.recent-payment-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
}
.recent-payment-detail {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.recent-payment-amount {
    font-weight: 700;
    font-size: 0.88rem;
    color: var(--accent-green);
    flex-shrink: 0;
}

/* ===== Renters Table ===== */
.table-container {
    overflow-x: auto;
}
.renters-table {
    width: 100%;
    border-collapse: collapse;
}
.renters-table thead th {
    padding: 12px 16px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    font-weight: 600;
    text-align: left;
    white-space: nowrap;
    border-bottom: 2px solid var(--border-light);
    background: var(--bg-input);
    user-select: none;
}
.renters-table thead th.sortable {
    cursor: pointer;
    transition: color var(--transition-fast);
}
.renters-table thead th.sortable:hover {
    color: var(--accent-blue);
}
.renters-table thead th.sortable::after {
    content: " ⇅";
    font-size: 0.7rem;
    opacity: 0.4;
}
.renters-table thead th.sort-asc::after {
    content: " ▲";
    opacity: 1;
    color: var(--accent-blue);
}
.renters-table thead th.sort-desc::after {
    content: " ▼";
    opacity: 1;
    color: var(--accent-blue);
}
.renters-table tbody tr {
    border-bottom: 1px solid var(--border-light);
    transition: background var(--transition-fast);
}
.renters-table tbody tr:hover {
    background: var(--bg-card-hover);
}
.renters-table tbody td {
    padding: 14px 16px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.renter-name-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}
.renter-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 0.65rem;
    flex-shrink: 0;
}
.renter-name-cell span {
    font-weight: 600;
    color: var(--text-primary);
}

.account-badge {
    background: rgba(99, 102, 241, 0.08);
    color: var(--accent-blue);
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 600;
}

/* Expire Badge */
.expire-badge {
    display: inline-block;
    background: rgba(245, 158, 11, 0.12);
    color: var(--accent-orange);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.68rem;
    font-weight: 600;
    margin-left: 6px;
}
.expire-badge.expired {
    background: var(--accent-red-bg);
    color: var(--accent-red);
}

/* Progress Bar */
.days-progress {
    display: flex;
    align-items: center;
    gap: 8px;
}
.days-progress-bar {
    flex: 1;
    height: 6px;
    background: var(--bg-input);
    border-radius: 3px;
    overflow: hidden;
    min-width: 60px;
}
.days-progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}
.days-progress-text {
    font-size: 0.78rem;
    font-weight: 700;
    min-width: 32px;
}

.amount-unpaid {
    color: var(--accent-orange) !important;
    font-weight: 600 !important;
}
.amount-paid {
    color: var(--accent-green) !important;
    font-weight: 600 !important;
}

/* Status Badge */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}
.status-badge.active {
    background: var(--accent-green-bg);
    color: var(--accent-green);
}
.status-badge.ended {
    background: var(--bg-input);
    color: var(--text-muted);
}
.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* Urgency Classes */
.status-badge.urgency-critical {
    background: var(--accent-red-bg);
    color: var(--accent-red);
    animation: pulseBadge 2s ease infinite;
}
.status-badge.urgency-warning {
    background: var(--accent-orange-bg);
    color: var(--accent-orange);
}
.status-badge.urgency-ok {
    background: var(--accent-green-bg);
    color: var(--accent-green);
}
.status-badge.urgency-info {
    background: rgba(99, 102, 241, 0.08);
    color: var(--accent-blue);
}
@keyframes pulseBadge {
    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
    50% {
        box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.15);
    }
}

/* Actions */
.actions-cell {
    display: flex;
    gap: 4px;
    align-items: center;
    flex-wrap: wrap;
}
.btn-icon {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border: none;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}
.btn-icon-green {
    background: var(--accent-green-bg);
    color: var(--accent-green);
}
.btn-icon-green:hover {
    background: var(--accent-green);
    color: #fff;
}
.btn-icon-blue {
    background: rgba(99, 102, 241, 0.08);
    color: var(--accent-blue);
}
.btn-icon-blue:hover {
    background: var(--accent-blue);
    color: #fff;
}
.btn-icon-orange {
    background: var(--accent-orange-bg);
    color: var(--accent-orange);
}
.btn-icon-orange:hover {
    background: var(--accent-orange);
    color: #fff;
}
.btn-icon-red {
    background: var(--accent-red-bg);
    color: var(--accent-red);
}
.btn-icon-red:hover {
    background: var(--accent-red);
    color: #fff;
}
.btn-icon-whatsapp {
    background: rgba(37, 211, 102, 0.1);
    color: #25d366;
}
.btn-icon-whatsapp:hover {
    background: #25d366;
    color: #fff;
}

/* ===== Pagination ===== */
.pagination-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px 22px;
    border-top: 1px solid var(--border-light);
}
.pagination-btn {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    font-size: 1.1rem;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    font-family: inherit;
}
.pagination-btn:hover:not(:disabled) {
    background: var(--accent-blue);
    color: white;
    border-color: var(--accent-blue);
}
.pagination-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}
.pagination-info {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* ===== Empty State ===== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}
.empty-icon {
    margin-bottom: 16px;
    color: var(--border-color);
}
.empty-state p {
    color: var(--text-muted);
    font-size: 0.92rem;
}

/* ===== Buttons ===== */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    background: linear-gradient(
        135deg,
        var(--accent-blue),
        var(--accent-purple)
    );
    color: white;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
}
.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
}
.btn-primary.btn-sm {
    padding: 7px 14px;
    font-size: 0.82rem;
}
.btn-primary.btn-green {
    background: linear-gradient(135deg, var(--accent-green), #059669);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}
.btn-secondary:hover {
    background: var(--bg-input);
    color: var(--text-primary);
    border-color: var(--accent-blue);
}

.btn-danger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    background: linear-gradient(135deg, var(--accent-red), #dc2626);
    color: white;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.2);
}
.btn-danger:hover {
    opacity: 0.9;
}

/* ===== Filter Tabs ===== */
.filter-tabs {
    display: flex;
    gap: 2px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    padding: 3px;
}
.filter-tab {
    padding: 7px 14px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: all var(--transition-fast);
}
.filter-tab:hover {
    color: var(--text-primary);
}
.filter-tab.active {
    background: white;
    color: var(--text-primary);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    font-weight: 600;
}

/* ===== Search Bar ===== */
.search-bar-container {
    padding: 16px 22px 12px;
}
.search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    transition: border-color var(--transition-fast);
}
.search-bar:focus-within {
    border-color: var(--accent-blue);
}
.search-bar input {
    flex: 1;
    border: none;
    background: none;
    font-family: inherit;
    font-size: 0.88rem;
    color: var(--text-primary);
    outline: none;
}
.search-bar input::placeholder {
    color: var(--text-muted);
}
.search-bar svg {
    color: var(--text-muted);
    flex-shrink: 0;
}

/* ===== Payment History ===== */
.view-toggle {
    display: flex;
    gap: 4px;
}
.view-toggle-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 14px;
    border: 1px solid var(--border-light);
    background: transparent;
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
}
.view-toggle-btn.active {
    background: rgba(99, 102, 241, 0.08);
    color: var(--accent-blue);
    border-color: rgba(99, 102, 241, 0.2);
    font-weight: 600;
}

.payment-list {
    padding: 8px 22px 14px;
}
.payment-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-light);
    transition: background var(--transition-fast);
}
.payment-item:last-of-type {
    border-bottom: none;
}
.payment-item-icon {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.payment-item-info {
    flex: 1;
    min-width: 0;
}
.payment-item-name {
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text-primary);
}
.payment-item-detail {
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.payment-item-amount {
    font-weight: 700;
    font-size: 0.92rem;
    color: var(--accent-green);
    white-space: nowrap;
}

.btn-show-all {
    display: block;
    width: 100%;
    padding: 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    color: var(--accent-blue);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 12px;
    transition: all var(--transition-fast);
}
.btn-show-all:hover {
    background: rgba(99, 102, 241, 0.06);
    border-color: rgba(99, 102, 241, 0.2);
}

/* ===== Payment Calendar ===== */
.calendar-container {
    margin: 8px 0;
}
.calendar-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.calendar-nav button {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    font-size: 1.1rem;
    cursor: pointer;
    color: var(--text-primary);
    transition: all var(--transition-fast);
    font-family: inherit;
}
.calendar-nav button:hover {
    background: var(--bg-input);
}
.calendar-nav h3 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
}
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}
.calendar-day-header {
    text-align: center;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    padding: 6px 0;
    text-transform: uppercase;
}
.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.82rem;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    position: relative;
    cursor: default;
    transition: background var(--transition-fast);
}
.calendar-day.empty {
    visibility: hidden;
}
.calendar-day.today {
    background: rgba(99, 102, 241, 0.08);
    color: var(--accent-blue);
    font-weight: 700;
}
.calendar-day.has-payment {
    background: var(--accent-green-bg);
    color: var(--accent-green);
    font-weight: 600;
    cursor: pointer;
}
.calendar-dot {
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--accent-green);
}

/* ===== Share Page ===== */
.share-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
}
.share-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    transition: all var(--transition-normal);
}
.share-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.1);
}
.share-card-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}
.share-card-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
}
.share-card-desc {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 16px;
}

/* ===== Skip Day Calendar ===== */
.btn-icon-purple {
    background: rgba(139, 92, 246, 0.1);
    color: var(--accent-purple);
}
.btn-icon-purple:hover {
    background: var(--accent-purple);
    color: #fff;
}

.skip-cal-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding: 0 4px;
}
.skip-cal-nav-btn {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-primary);
    transition: all var(--transition-fast);
}
.skip-cal-nav-btn:hover {
    background: var(--bg-input);
    border-color: var(--accent-purple);
    color: var(--accent-purple);
}

.skip-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: 12px;
}
.skip-cal-header {
    text-align: center;
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--text-muted);
    padding: 6px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.skip-cal-day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 0.82rem;
    border-radius: var(--radius-sm);
    position: relative;
    transition: all var(--transition-fast);
    font-weight: 500;
    cursor: default;
    border: 1px solid transparent;
}
.skip-cal-day.empty {
    visibility: hidden;
}
.skip-cal-day.available {
    color: var(--text-primary);
    background: var(--bg-input);
    cursor: pointer;
}
.skip-cal-day.available:hover {
    background: rgba(139, 92, 246, 0.12);
    border-color: rgba(139, 92, 246, 0.3);
    color: var(--accent-purple);
}
.skip-cal-day.today {
    background: rgba(99, 102, 241, 0.1);
    border-color: rgba(99, 102, 241, 0.3);
    color: var(--accent-blue);
    font-weight: 700;
    cursor: pointer;
}
.skip-cal-day.today:hover {
    background: rgba(139, 92, 246, 0.15);
    border-color: var(--accent-purple);
    color: var(--accent-purple);
}
.skip-cal-day.skipped {
    background: rgba(139, 92, 246, 0.15);
    border-color: rgba(139, 92, 246, 0.4);
    color: var(--accent-purple);
    font-weight: 700;
    cursor: pointer;
    text-decoration: line-through;
    text-decoration-color: var(--accent-purple);
}
.skip-cal-day.skipped:hover {
    background: rgba(139, 92, 246, 0.08);
}
.skip-cal-day.out-of-range {
    color: var(--text-muted);
    opacity: 0.35;
}
.skip-dot {
    position: absolute;
    top: 1px;
    right: 2px;
    font-size: 0.55rem;
    color: var(--accent-purple);
    line-height: 1;
    font-weight: 900;
}

/* Skip day legend */
.skip-cal-legend {
    display: flex;
    justify-content: center;
    gap: 16px;
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.skip-legend-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 3px;
    margin-right: 4px;
    vertical-align: middle;
    border: 1px solid transparent;
}
.skip-legend-dot.available {
    background: var(--bg-input);
    border-color: var(--border-light);
}
.skip-legend-dot.skipped {
    background: rgba(139, 92, 246, 0.2);
    border-color: rgba(139, 92, 246, 0.4);
}
.skip-legend-dot.out-of-range {
    background: var(--border-light);
    opacity: 0.4;
}

/* Skip count badge */
.skip-count-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(139, 92, 246, 0.12);
    color: var(--accent-purple);
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
}

/* Skip badge in table */
.skip-badge-sm {
    display: inline-block;
    background: rgba(139, 92, 246, 0.1);
    color: var(--accent-purple);
    font-size: 0.65rem;
    font-weight: 600;
    padding: 1px 5px;
    border-radius: 4px;
    margin-left: 4px;
    vertical-align: middle;
}

/* ===== Modal ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9000;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.2s ease;
}
.modal-overlay.show {
    display: flex;
    opacity: 1;
}

.modal {
    background: var(--bg-modal);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalSlideIn 0.3s ease;
}
.modal-sm {
    max-width: 420px;
}
.modal-lg {
    max-width: 640px;
}
@keyframes modalSlideIn {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 24px 16px;
    border-bottom: 1px solid var(--border-light);
}
.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}
.modal-close {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--bg-input);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
}
.modal-close:hover {
    background: var(--accent-red-bg);
    color: var(--accent-red);
}

.modal-actions {
    display: flex;
    gap: 10px;
    padding: 16px 24px 24px;
    justify-content: flex-end;
}

/* Form */
.form-group {
    padding: 0 24px;
    margin-bottom: 16px;
}
.form-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 11px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.92rem;
    outline: none;
    transition: all var(--transition-fast);
    box-sizing: border-box;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
    background: var(--bg-card);
}
.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
}
.form-row {
    display: flex;
    gap: 16px;
}
.form-row .form-group {
    flex: 1;
    min-width: 0;
}

/* Payment Modal */
.payment-info {
    padding: 14px 20px;
    margin: 0 24px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.7;
}
.payment-mode-toggle {
    display: flex;
    gap: 8px;
    padding: 0 24px;
    margin-bottom: 16px;
}
.mode-btn {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--border-color);
    background: transparent;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all var(--transition-fast);
}
.mode-btn.active {
    background: rgba(99, 102, 241, 0.08);
    border-color: var(--accent-blue);
    color: var(--accent-blue);
    font-weight: 600;
}

.days-input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}
.days-btn {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    font-size: 1.1rem;
    cursor: pointer;
    color: var(--text-primary);
    transition: all var(--transition-fast);
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
}
.days-btn:hover {
    background: var(--bg-input);
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}
.days-label {
    color: var(--text-secondary);
    font-size: 0.88rem;
}
.days-calc {
    margin-top: 10px;
    padding: 10px 14px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    color: var(--text-secondary);
}
.calc-total {
    font-weight: 700;
    color: var(--accent-blue);
}

/* Detail Modal */
.detail-content {
    padding: 20px 24px;
}
.detail-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}
.detail-stat {
    background: var(--bg-input);
    padding: 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
}
.detail-stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}
.detail-stat-value {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 4px;
}
.detail-payments-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 16px 0 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-light);
}
.detail-payment-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-light);
    gap: 8px;
}
.detail-payment-date {
    font-size: 0.85rem;
    color: var(--text-primary);
    font-weight: 500;
}
.detail-payment-note {
    font-size: 0.82rem;
    color: var(--text-muted);
}
.detail-payment-amount {
    font-weight: 700;
    font-size: 0.88rem;
    color: var(--accent-green);
}
.detail-notes {
    margin-top: 16px;
    padding: 14px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Confirm Modal */
.confirm-message {
    padding: 16px 24px;
    font-size: 0.92rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ===== Toast ===== */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    animation: toastSlideIn 0.3s ease;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-primary);
    max-width: 400px;
    min-width: 260px;
}
.toast.success {
    border-left: 4px solid var(--accent-green);
}
.toast.error {
    border-left: 4px solid var(--accent-red);
}
.toast.info {
    border-left: 4px solid var(--accent-blue);
}
.toast.warning {
    border-left: 4px solid var(--accent-orange);
}
.toast-icon {
    flex-shrink: 0;
}
.toast.success .toast-icon {
    color: var(--accent-green);
}
.toast.error .toast-icon {
    color: var(--accent-red);
}
.toast.info .toast-icon {
    color: var(--accent-blue);
}
.toast.warning .toast-icon {
    color: var(--accent-orange);
}
@keyframes toastSlideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Toast Undo Button */
.toast-undo-btn {
    background: none;
    border: 1px solid var(--accent-blue);
    color: var(--accent-blue);
    padding: 3px 10px;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    margin-left: auto;
    white-space: nowrap;
    transition: all var(--transition-fast);
}
.toast-undo-btn:hover {
    background: var(--accent-blue);
    color: white;
}

/* ===== Settings ===== */
.settings-card {
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 16px;
}
.settings-label {
    font-weight: 700;
    font-size: 0.88rem;
    color: var(--text-primary);
    display: block;
}
.settings-desc {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 2px;
    margin-bottom: 8px;
    line-height: 1.5;
}
.settings-input {
    padding: 9px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.88rem;
    outline: none;
    transition: all var(--transition-fast);
    box-sizing: border-box;
}
.settings-input:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

/* Widget Checkbox */
.widget-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.88rem;
    color: var(--text-primary);
    cursor: pointer;
    padding: 6px 0;
}
.widget-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-blue);
    cursor: pointer;
}

/* Activity Log */
.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-light);
}
.activity-item:last-child {
    border-bottom: none;
}
.activity-icon {
    font-size: 1rem;
    flex-shrink: 0;
    margin-top: 2px;
}
.activity-info {
    flex: 1;
    min-width: 0;
}
.activity-detail {
    font-size: 0.82rem;
    color: var(--text-primary);
}
.activity-time {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ===== Reports Page ===== */
.report-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
.report-stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-card);
    text-align: center;
    transition: all var(--transition-normal);
}
.report-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.1);
}
.report-stat-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 6px;
}
.report-stat-value {
    font-size: 1.3rem;
    font-weight: 800;
}

.report-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.report-table {
    width: 100%;
    border-collapse: collapse;
}
.report-table thead th {
    padding: 10px 16px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    font-weight: 600;
    text-align: left;
    border-bottom: 2px solid var(--border-light);
    background: var(--bg-input);
}
.report-table tbody tr {
    border-bottom: 1px solid var(--border-light);
}
.report-table tbody td {
    padding: 10px 16px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Pie Legend */
.pie-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid var(--border-light);
}
.pie-legend-item:last-child {
    border-bottom: none;
}
.pie-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    flex-shrink: 0;
}
.pie-legend-name {
    flex: 1;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
}
.pie-legend-value {
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* ===== App Footer Badge ===== */
.app-footer-badge {
    position: fixed;
    bottom: 16px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(99, 102, 241, 0.12);
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    z-index: 90;
    transition: all var(--transition-normal);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    letter-spacing: 0.02em;
}
.app-footer-badge svg {
    color: var(--accent-blue);
    opacity: 0.7;
}
.app-footer-badge span {
    color: var(--accent-blue);
    font-weight: 700;
    opacity: 0.8;
}
.app-footer-badge:hover {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(99, 102, 241, 0.25);
    color: var(--text-secondary);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.1);
}
.app-footer-badge:hover svg,
.app-footer-badge:hover span {
    opacity: 1;
}

/* ===== Dark Mode ===== */
[data-theme="dark"] {
    --bg-body: #0f172a;
    --bg-sidebar: #1a2332;
    --bg-card: #1e293b;
    --bg-card-hover: #253347;
    --bg-input: #253347;
    --bg-modal: #1e293b;

    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --border-color: #334155;
    --border-subtle: rgba(99, 102, 241, 0.15);
    --border-light: #2a3a4e;

    --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.2), 0 1px 4px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.4);
}
[data-theme="dark"] .notif-dot {
    border-color: var(--bg-card);
}
[data-theme="dark"] .filter-tab.active {
    background: var(--bg-card);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}
[data-theme="dark"] .modal {
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
[data-theme="dark"] .toast {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}
[data-theme="dark"] .days-progress-bar {
    background: #334155;
}
[data-theme="dark"] .pagination-btn {
    border-color: #334155;
    background: var(--bg-card);
}
[data-theme="dark"] .app-footer-badge {
    background: rgba(30, 41, 59, 0.75);
    border-color: rgba(99, 102, 241, 0.2);
}

/* ===== Mobile Bottom Nav ===== */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-sidebar);
    border-top: 1px solid var(--border-light);
    z-index: 100;
    padding: 6px 0 env(safe-area-inset-bottom, 4px);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.06);
}
.bottom-nav-inner {
    display: flex;
    justify-content: space-around;
    align-items: center;
    max-width: 600px;
    margin: 0 auto;
}
.bottom-nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 6px 12px;
    border: none;
    background: none;
    color: var(--text-muted);
    font-size: 0.62rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
    border-radius: 8px;
    min-width: 52px;
}
.bottom-nav-btn.active {
    color: var(--accent-blue);
}
.bottom-nav-btn:hover {
    color: var(--accent-blue);
    background: rgba(99, 102, 241, 0.06);
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    .stats-section {
        grid-template-columns: repeat(2, 1fr);
    }
    .report-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    .report-grid {
        grid-template-columns: 1fr;
    }
    #pageSettings .dashboard-body > div {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        display: none;
    }
    .main-content {
        margin-left: 0;
        overflow-x: hidden;
        max-width: 100vw;
    }

    /* ===== Table → Card Layout on Mobile ===== */
    .renters-table {
        min-width: 0;
        width: 100%;
    }
    /* Hide table header */
    .renters-table thead {
        display: none;
    }
    /* Stack rows vertically */
    .renters-table tbody {
        display: flex;
        flex-direction: column;
        gap: 10px;
        padding: 10px 14px 14px;
    }
    /* Each row = card */
    .renters-table tbody tr {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        column-gap: 8px;
        row-gap: 8px;
        padding: 14px;
        border-radius: 14px;
        border: 1px solid var(--border-light) !important;
        border-bottom: 1px solid var(--border-light) !important;
        background: var(--bg-card);
        box-shadow: var(--shadow-card);
    }
    .renters-table tbody tr:hover {
        background: var(--bg-card-hover);
    }
    /* All cells: block flex items, default hidden order */
    .renters-table tbody td {
        display: block;
        padding: 0;
        border: none;
        font-size: 0.82rem;
        white-space: normal;
        order: 99;
    }

    /* === ROW 1: Avatar+Nama (kiri) | Status (kanan) === */
    .renters-table tbody td:nth-child(1) {
        order: 1;
        flex: 1;
        min-width: 140px;
    }
    .renters-table tbody td:nth-child(9) {
        order: 2;
        flex: 0 0 auto;
        margin-left: auto;
    }

    /* === ROW 2: Akun badge — full width, tengah === */
    .renters-table tbody td:nth-child(2) {
        order: 3;
        width: 100%;
        text-align: center;
        padding: 2px 0;
    }
    .renters-table tbody td:nth-child(2) .account-badge {
        display: inline-block;
        white-space: nowrap;
        font-size: 0.8rem;
        padding: 5px 16px;
        border-radius: 20px;
    }

    /* === ROW 3: Bar sisa uang — full width, berwarna === */
    .renters-table tbody td:nth-child(8) {
        order: 4;
        width: 100%;
        text-align: center;
        padding: 7px 16px;
        border-radius: 10px;
        font-weight: 700;
        font-size: 0.85rem;
        border: none;
    }
    /* Unpaid = bar oranye */
    .renters-table tbody .amount-unpaid {
        background: rgba(245, 158, 11, 0.12);
        border: 1px solid rgba(245, 158, 11, 0.25) !important;
        color: var(--accent-orange) !important;
    }
    /* Paid = bar hijau */
    .renters-table tbody .amount-paid {
        background: rgba(16, 185, 129, 0.1);
        border: 1px solid rgba(16, 185, 129, 0.25) !important;
        color: var(--accent-green) !important;
    }

    /* === ROW 4: AKSI — full width === */
    .renters-table tbody td:nth-child(10) {
        order: 5;
        width: 100%;
        padding-top: 10px;
        margin-top: 2px;
        border-top: 1px solid var(--border-light);
    }

    /* Hide: Mulai, Durasi, Tarif, Total, Progress */
    .renters-table tbody td:nth-child(3),
    .renters-table tbody td:nth-child(4),
    .renters-table tbody td:nth-child(5),
    .renters-table tbody td:nth-child(6),
    .renters-table tbody td:nth-child(7) {
        display: none;
    }

    /* Action buttons — horizontal, no wrap */
    .renters-table .actions-cell {
        flex-wrap: nowrap;
        justify-content: flex-start;
        gap: 8px;
        overflow-x: auto;
        padding-bottom: 2px;
    }
    .renters-table .btn-icon {
        width: 34px;
        height: 34px;
        min-width: 34px;
        flex-shrink: 0;
    }
    .renters-table .btn-icon svg {
        width: 16px;
        height: 16px;
    }
    /* Hide low-priority action buttons on mobile */
    .renters-table .actions-cell .btn-icon-whatsapp,
    .renters-table .actions-cell .btn-icon-orange {
        display: none;
    }
    /* Name — truncate if too long */
    .renters-table .renter-name-cell {
        align-items: center;
    }
    .renters-table .renter-name-cell span {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 150px;
        display: inline-block;
        vertical-align: middle;
        font-size: 0.9rem;
        font-weight: 600;
    }
    .bottom-nav {
        display: block;
    }
    .top-header {
        padding: 12px 14px;
        gap: 8px;
    }
    .dashboard-body {
        padding: 14px 12px 90px;
        overflow-x: hidden;
        max-width: 100%;
    }
    .greeting h1 {
        font-size: 1.05rem;
    }
    .greeting p {
        font-size: 0.75rem;
    }
    .header-avatar .user-email-text {
        display: none;
    }
    .header-right {
        gap: 6px;
    }

    /* Notification panel responsive fix */
    #notifPanel {
        position: fixed !important;
        top: 62px !important;
        left: 8px !important;
        right: 8px !important;
        width: auto !important;
        max-width: none !important;
        border-radius: 16px !important;
    }

    /* Stat cards */
    .stats-section {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        max-width: 100%;
    }
    .stat-card {
        padding: 12px;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    .stat-icon {
        width: 32px;
        height: 32px;
    }
    .stat-icon svg {
        width: 16px;
        height: 16px;
    }
    .stat-label {
        font-size: 0.68rem;
    }
    .stat-value {
        font-size: 1rem;
    }

    /* Panels */
    .panel {
        border-radius: 14px;
        max-width: 100%;
        overflow: hidden;
    }
    .panel-header {
        padding: 12px 14px;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    .panel-header h2 {
        font-size: 0.9rem;
    }
    .panel-body {
        padding: 10px 14px 14px;
    }
    .search-bar-container {
        padding: 10px 14px 10px;
    }
    .search-bar {
        padding: 10px 14px;
        font-size: 0.82rem;
    }

    /* Filter tabs compact — scrollable horizontally */
    .filter-tabs {
        gap: 4px;
        align-self: stretch;
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 2px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .filter-tabs::-webkit-scrollbar {
        display: none;
    }
    .filter-tab {
        padding: 6px 12px;
        font-size: 0.72rem;
        white-space: nowrap;
        flex-shrink: 0;
    }

    /* Table responsive — horizontal scroll */
    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -14px;
        padding: 0 14px;
    }
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        max-width: 100%;
    }
    .renters-table {
        min-width: 0;
        font-size: 0.82rem;
    }
    .renter-avatar {
        width: 30px;
        height: 30px;
        font-size: 0.6rem;
    }
    .account-badge {
        font-size: 0.68rem;
        padding: 2px 8px;
    }

    /* Action buttons - 2 rows */
    .actions-cell {
        gap: 3px;
        flex-wrap: wrap;
        justify-content: center;
    }
    .btn-icon {
        width: 26px;
        height: 26px;
        min-width: 26px;
    }
    .btn-icon svg {
        width: 12px;
        height: 12px;
    }

    /* Progress bar */
    .days-progress {
        width: 100%;
        min-width: 60px;
    }
    .days-progress-bar {
        height: 5px;
    }

    /* Modal */
    .modal-overlay {
        padding: 8px;
    }
    .modal {
        max-width: 100%;
        border-radius: 16px;
        margin: 0;
    }
    .modal-header {
        padding: 16px 16px 12px;
    }
    .modal-header h2 {
        font-size: 1rem;
    }
    .form-group {
        padding: 0 16px;
        margin-bottom: 10px;
    }
    .form-group label {
        font-size: 0.78rem;
    }
    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 0.85rem;
        padding: 10px 12px;
    }
    .modal-actions {
        padding: 12px 16px 18px;
        gap: 8px;
    }
    .form-row {
        flex-direction: column;
        gap: 0;
    }

    /* Payment list */
    .payment-list {
        padding: 6px 14px 14px;
    }
    .payment-item {
        padding: 12px 14px;
        gap: 10px;
        flex-wrap: wrap;
    }
    .payment-name {
        font-size: 0.85rem;
    }
    .payment-detail {
        font-size: 0.72rem;
    }
    .payment-amount {
        font-size: 0.88rem;
    }
    .payment-actions {
        gap: 4px;
    }
    .payment-item-name {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }
    .payment-item > div:last-child {
        flex-shrink: 0;
        align-items: center;
    }
    .payment-mode-toggle {
        padding: 0 14px;
    }

    /* Share */
    .share-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .share-card {
        padding: 20px 16px;
    }

    /* Reports */
    .report-stats {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    .report-stat-card {
        padding: 12px;
    }
    .report-stat-value {
        font-size: 0.95rem;
    }
    .report-stat-label {
        font-size: 0.68rem;
    }
    .report-header {
        padding: 14px;
    }
    .pie-chart-section {
        padding: 14px;
    }
    .report-table {
        font-size: 0.78rem;
    }

    /* Settings */
    #pageSettings .dashboard-body > div {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }
    .settings-card {
        padding: 16px 14px;
    }
    /* Simpan button row — prevent wrap, keep proportional */
    .settings-card > div[style*="display:flex"],
    .settings-card > div[style*="display: flex"] {
        flex-wrap: nowrap;
        align-items: center;
        gap: 8px;
    }
    .settings-card .settings-input {
        flex: 1;
        min-width: 0;
    }
    .settings-card .btn-primary.btn-sm,
    .settings-card .btn-secondary {
        flex-shrink: 0;
        white-space: nowrap;
        padding: 10px 14px;
        font-size: 0.8rem;
    }
    .settings-label {
        font-size: 0.82rem;
    }
    .settings-desc {
        font-size: 0.72rem;
    }
    .settings-input {
        font-size: 0.82rem;
        padding: 10px 12px;
    }

    /* Reminders */
    .reminder-item {
        padding: 10px 14px;
        gap: 10px;
        flex-wrap: wrap;
    }
    .reminder-card {
        padding: 12px 14px;
        gap: 10px;
    }

    /* Disable desktop hover negative-margin on touch devices */
    .dash-renter-item:hover {
        margin: 0;
        padding: 12px 0;
        border-radius: 0;
        background: transparent;
    }

    /* Dash renter — stack layout on mobile */
    .dash-renter-item {
        flex-wrap: wrap;
        gap: 8px;
    }
    .dash-renter-info {
        flex: 1;
        min-width: 0;
    }
    .dash-renter-name {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .dash-renter-sub {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }
    .dash-renter-badge {
        font-size: 0.68rem;
        padding: 3px 10px;
        margin-left: auto;
    }

    /* Reminder card — stack amount on mobile */
    .reminder-card {
        flex-wrap: wrap;
        row-gap: 6px;
    }
    .reminder-info {
        flex: 1;
        min-width: 0;
    }
    .reminder-name {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .reminder-amount {
        width: 100%;
        text-align: left;
        font-size: 0.82rem;
        padding-left: 46px;
    }

    /* Recent payments — truncate & keep amount visible */
    .recent-payment-item {
        flex-wrap: nowrap;
    }
    .recent-payment-name {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .recent-payment-detail {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .recent-payment-amount {
        flex-shrink: 0;
        font-size: 0.82rem;
        margin-left: auto;
    }

    /* Account summary — smaller bar */
    .account-summary-bar {
        width: 40px;
    }
    .account-summary-pct {
        width: 26px;
        font-size: 0.7rem;
    }
    .account-summary-name {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .reminder-info {
        font-size: 0.78rem;
    }
    .reminder-days {
        font-size: 0.78rem;
    }
    .reminder-amount {
        font-size: 0.72rem;
    }

    /* Active renters panel */
    .active-renter-item {
        padding: 10px 14px;
    }

    /* Toast */
    .toast-container {
        left: 12px;
        right: 12px;
        bottom: 75px;
    }
    .toast {
        max-width: none;
        min-width: 0;
        font-size: 0.82rem;
        padding: 12px 16px;
    }

    /* Footer badge - hide on mobile */
    .app-footer-badge {
        display: none !important;
    }

    /* Pagination */
    .pagination-controls {
        padding: 10px 14px;
        gap: 6px;
    }
    .pagination-btn {
        width: 30px;
        height: 30px;
        font-size: 0.72rem;
    }

    /* Header buttons */
    .header-actions {
        gap: 4px;
    }
    .btn-action {
        width: 34px;
        height: 34px;
    }

    /* Notes page */
    .notes-area {
        min-height: 200px;
        font-size: 0.88rem;
    }

    /* Detail Modal */
    .detail-stats {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    /* Chart */
    .chart-container {
        padding: 14px;
    }
    .chart-container h3 {
        font-size: 0.88rem;
    }

    /* Urgency badge */
    .urgency-badge {
        font-size: 0.65rem;
        padding: 3px 8px;
    }
}

@media (max-width: 480px) {
    .stats-section {
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }
    .stat-card {
        padding: 10px;
    }
    .stat-value {
        font-size: 0.85rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: 100%;
    }
    .stat-label {
        font-size: 0.62rem;
    }
    .stat-info {
        min-width: 0;
        width: 100%;
    }
    .greeting h1 {
        font-size: 0.95rem;
    }
    .greeting p {
        font-size: 0.7rem;
    }
    .top-header {
        padding: 10px 12px;
    }
    .dashboard-body {
        padding: 12px 10px 90px;
    }
    .panel-header h2 {
        font-size: 0.85rem;
    }
    .report-stats {
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }
    .detail-stats {
        grid-template-columns: 1fr;
    }
    .bottom-nav-btn {
        font-size: 0.58rem;
        min-width: 44px;
        padding: 6px 4px;
        touch-action: manipulation;
    }

    /* Account summary — hide bar on very small screens */
    .account-summary-bar {
        display: none;
    }
    .account-summary-pct {
        width: auto;
        min-width: 28px;
        font-size: 0.72rem;
    }

    /* Dash renter badge — full width row on tiny screens */
    .dash-renter-badge {
        font-size: 0.65rem;
        padding: 3px 10px;
        margin-left: 44px;
    }

    /* Reminder amount — tighter indent */
    .reminder-amount {
        padding-left: 40px;
        font-size: 0.78rem;
    }

    /* Recent payment amount */
    .recent-payment-amount {
        font-size: 0.78rem;
    }
    .bottom-nav-btn svg {
        width: 18px;
        height: 18px;
    }

    /* Notification panel on very small screens */
    #notifPanel {
        left: 4px !important;
        right: 4px !important;
        top: 58px !important;
    }

    /* Modal full-screen on tiny phones */
    .modal {
        max-height: 90vh;
        overflow-y: auto;
    }

    /* Panel header wrap better */
    .panel-header {
        gap: 6px;
    }
    .btn-primary,
    .btn-secondary {
        font-size: 0.78rem;
        padding: 8px 14px;
    }

    /* Settings single-column fix */
    #pageSettings .dashboard-body > div {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }
    .settings-card .btn-primary.btn-sm,
    .settings-card .btn-secondary {
        padding: 9px 12px;
        font-size: 0.75rem;
    }
    /* Table on very small screens — tighten further */
    .renters-table th:nth-child(8),
    .renters-table td:nth-child(8) {
        display: none;
    }
    .renters-table th:nth-child(1),
    .renters-table td:nth-child(1) {
        width: 40%;
    }
    .renters-table th:nth-child(2),
    .renters-table td:nth-child(2) {
        width: 26%;
    }

    /* Payment item wrap fix */
    .payment-item {
        flex-wrap: wrap;
        padding: 10px 12px;
    }
    .payment-item-info {
        min-width: 0;
        flex: 1;
    }
    .payment-item > div:last-child {
        width: 100%;
        padding-left: 46px;
        margin-top: 4px;
        gap: 6px;
        display: flex;
        align-items: center;
    }
}

@media (max-width: 360px) {
    .dashboard-body {
        padding: 10px 8px 90px;
    }
    .stats-section {
        gap: 4px;
    }
    .stat-card {
        padding: 8px;
        flex-direction: row;
        align-items: center;
        gap: 8px;
    }
    .stat-icon {
        width: 28px;
        height: 28px;
        flex-shrink: 0;
    }
    .stat-icon svg {
        width: 14px;
        height: 14px;
    }
    .stat-value {
        font-size: 0.82rem;
    }
    .stat-label {
        font-size: 0.6rem;
    }
    .panel {
        margin-bottom: 10px;
    }
    .panel-header {
        padding: 10px 12px;
    }
    .panel-body {
        padding: 8px 12px 12px;
    }
    .bottom-nav-btn {
        min-width: 40px;
        padding: 5px 2px;
        font-size: 0.55rem;
    }
    .top-header {
        padding: 8px 10px;
    }
    #notifPanel {
        left: 4px !important;
        right: 4px !important;
        top: 54px !important;
    }
}

/* ===== Print ===== */
@media print {
    .sidebar,
    .bottom-nav,
    .top-header,
    .toast-container {
        display: none !important;
    }
    .main-content {
        margin-left: 0 !important;
    }
    .panel {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
}
