/* ===== CSS Variables / Design Tokens ===== */
:root {
    --bg-primary: #0a0e1a;
    --bg-secondary: #111827;
    --bg-card: #1a1f35;
    --bg-card-hover: #222845;
    --bg-modal: #1e2340;
    --bg-input: #151a2e;

    --text-primary: #f0f2f8;
    --text-secondary: #8892b0;
    --text-muted: #5a6380;

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

    --border-color: rgba(99, 102, 241, 0.15);
    --border-subtle: rgba(255, 255, 255, 0.06);

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

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.15);

    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.4s ease;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ===== Background Decorations ===== */
.bg-decoration {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.bg-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.4;
    animation: float 20s ease-in-out infinite;
}

.blob-1 {
    width: 500px;
    height: 500px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.1));
    top: -150px;
    right: -100px;
    animation-delay: 0s;
}

.blob-2 {
    width: 400px;
    height: 400px;
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.1), rgba(99, 102, 241, 0.08));
    bottom: -100px;
    left: -100px;
    animation-delay: -7s;
}

.blob-3 {
    width: 300px;
    height: 300px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.12), rgba(236, 72, 153, 0.08));
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -14s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(30px, -40px) scale(1.05); }
    50% { transform: translate(-20px, 20px) scale(0.95); }
    75% { transform: translate(20px, 30px) scale(1.02); }
}

/* ===== App Container ===== */
.app-container {
    position: relative;
    z-index: 1;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px 60px;
}

/* ===== Header ===== */
.app-header {
    padding: 24px 0;
    margin-bottom: 8px;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.3);
}

.app-title {
    font-size: 1.6rem;
    font-weight: 800;
    background: linear-gradient(135deg, #fff, var(--accent-blue-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
}

.app-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 400;
}

#appContent {
    display: none;
}

#appContent.visible {
    display: block;
}

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

.current-date {
    font-size: 0.82rem;
    color: var(--text-secondary);
    padding: 8px 12px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    white-space: nowrap;
}

.user-email {
    font-size: 0.82rem;
    color: var(--text-secondary);
    padding: 8px 12px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ===== Buttons ===== */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(99, 102, 241, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: var(--accent-blue);
}

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

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(239, 68, 68, 0.4);
}

.btn-green {
    background: linear-gradient(135deg, var(--accent-green), #059669) !important;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3) !important;
}

.btn-green:hover {
    box-shadow: 0 6px 25px rgba(16, 185, 129, 0.4) !important;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    background: transparent;
    color: var(--text-secondary);
}

.btn-icon:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.btn-icon.btn-icon-green:hover { color: var(--accent-green); background: rgba(16, 185, 129, 0.1); }
.btn-icon.btn-icon-blue:hover { color: var(--accent-blue-light); background: rgba(99, 102, 241, 0.1); }
.btn-icon.btn-icon-orange:hover { color: var(--accent-orange); background: rgba(245, 158, 11, 0.1); }
.btn-icon.btn-icon-red:hover { color: var(--accent-red); background: rgba(239, 68, 68, 0.1); }

.btn-show-all {
    width: 100%;
    padding: 10px;
    margin-top: 8px;
    background: transparent;
    border: 1px dashed var(--border-subtle);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-show-all:hover {
    border-color: var(--accent-blue-light);
    color: var(--accent-blue-light);
}

/* ===== Stats Section ===== */
.stats-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 22px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.stat-total::before { background: linear-gradient(90deg, var(--accent-blue), var(--accent-purple)); }
.stat-active::before { background: linear-gradient(90deg, var(--accent-cyan), var(--accent-blue)); }
.stat-unpaid::before { background: linear-gradient(90deg, var(--accent-orange), var(--accent-red)); }
.stat-earned::before { background: linear-gradient(90deg, var(--accent-green), var(--accent-cyan)); }

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-glow);
    border-color: var(--border-color);
}

.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: rgba(99, 102, 241, 0.12); color: var(--accent-blue-light); }
.stat-active .stat-icon { background: rgba(6, 182, 212, 0.12); color: var(--accent-cyan); }
.stat-unpaid .stat-icon { background: rgba(245, 158, 11, 0.12); color: var(--accent-orange); }
.stat-earned .stat-icon { background: rgba(16, 185, 129, 0.12); color: var(--accent-green); }

.stat-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.stat-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

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

/* ===== Section Headers ===== */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.section-header h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
}

.section-header h2 svg {
    color: var(--accent-blue-light);
}

/* ===== Filter Tabs ===== */
.filter-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    padding: 3px;
    border: 1px solid var(--border-subtle);
}

.filter-tab {
    padding: 6px 16px;
    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: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    color: white;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

/* ===== Reminders ===== */
.reminders-section {
    margin-bottom: 28px;
}

.reminders-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.reminder-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.08), rgba(239, 68, 68, 0.05));
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: var(--radius-md);
    animation: slideIn 0.3s ease;
}

.reminder-card.overdue {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.08), rgba(239, 68, 68, 0.04));
    border-color: rgba(239, 68, 68, 0.25);
}

.reminder-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-orange);
}

.reminder-card.overdue .reminder-icon {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
}

.reminder-info {
    flex: 1;
}

.reminder-name {
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--text-primary);
}

.reminder-detail {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.reminder-amount {
    font-weight: 700;
    font-size: 1rem;
    color: var(--accent-orange);
    white-space: nowrap;
}

.reminder-card.overdue .reminder-amount {
    color: var(--accent-red);
}

/* ===== Table ===== */
.table-section {
    margin-bottom: 28px;
    position: relative;
}

.table-container {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: visible;
    overflow-x: auto;
}

/* Clip only the top corners for the rounded card look */
.table-container > table {
    border-radius: 0;
}

.table-container::before {
    content: '';
    display: block;
    position: absolute;
    inset: 0;
    border-radius: var(--radius-lg);
    pointer-events: none;
}

.renters-table {
    width: 100%;
    border-collapse: collapse;
}

.renters-table thead th {
    padding: 14px 16px;
    text-align: left;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--border-subtle);
    white-space: nowrap;
}

.renters-table tbody tr {
    transition: background var(--transition-fast);
    border-bottom: 1px solid var(--border-subtle);
}

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

.renters-table tbody tr:hover {
    background: rgba(99, 102, 241, 0.04);
}

.renters-table td {
    padding: 14px 16px;
    font-size: 0.88rem;
    color: var(--text-primary);
    vertical-align: middle;
    white-space: nowrap;
}

.renter-name-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.renter-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: white;
    flex-shrink: 0;
}

.account-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    background: rgba(99, 102, 241, 0.1);
    color: var(--accent-blue-light);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
}

.status-badge.active {
    background: rgba(16, 185, 129, 0.12);
    color: var(--accent-green);
}

.status-badge.ended {
    background: rgba(107, 114, 142, 0.12);
    color: var(--text-secondary);
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
}

.status-badge.active .status-dot {
    background: var(--accent-green);
    box-shadow: 0 0 6px var(--accent-green);
    animation: pulse 2s ease-in-out infinite;
}

.status-badge.ended .status-dot {
    background: var(--text-muted);
}

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

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

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

.actions-cell {
    display: flex;
    gap: 4px;
    flex-wrap: nowrap;
    align-items: center;
    min-width: unset;
}

.btn-icon svg {
    pointer-events: none;
}

/* Sticky actions column */
.renters-table th:last-child,
.renters-table td:last-child {
    position: sticky;
    right: 0;
    background: var(--bg-card);
    z-index: 2;
    box-shadow: -4px 0 12px rgba(0,0,0,0.25);
    min-width: 160px;
    width: 160px;
}

.renters-table tbody tr:hover td:last-child {
    background: #1e2444;
}

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-icon {
    color: var(--text-muted);
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.empty-state p {
    font-size: 0.88rem;
    color: var(--text-muted);
}

/* ===== Modal ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.modal-overlay.show {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    background: var(--bg-modal);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    animation: modalSlideUp 0.3s ease;
}

.modal-sm { max-width: 440px; }
.modal-lg { max-width: 640px; }

@keyframes modalSlideUp {
    from { opacity: 0; transform: translateY(20px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 22px 24px 0;
}

.modal-header h3 {
    font-size: 1.15rem;
    font-weight: 700;
}

.modal-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--accent-red);
}

/* ===== Form ===== */
form {
    padding: 20px 24px 24px;
}

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

.form-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.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;
    transition: all var(--transition-fast);
    outline: none;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px var(--accent-blue-glow);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 8px;
}

.modal > .modal-actions {
    padding: 0 24px 24px;
}

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

.payment-info {
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    padding: 14px;
    margin-bottom: 16px;
    border: 1px solid var(--border-subtle);
    font-size: 0.88rem;
    line-height: 1.8;
    color: var(--text-secondary);
}

.payment-info strong {
    color: var(--text-primary);
}

/* ===== Payment Mode Toggle ===== */
.payment-mode-toggle {
    display: flex;
    gap: 4px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    padding: 3px;
    border: 1px solid var(--border-subtle);
    margin-bottom: 16px;
}

.mode-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 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);
}

.mode-btn:hover {
    color: var(--text-primary);
}

.mode-btn.active {
    background: linear-gradient(135deg, var(--accent-green), #059669);
    color: white;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

/* ===== Days Input ===== */
.days-input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.days-input-wrapper input {
    width: 80px !important;
    text-align: center;
    font-size: 1.2rem !important;
    font-weight: 700 !important;
    padding: 10px 8px !important;
}

.days-btn {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 1.2rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: inherit;
}

.days-btn:hover {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: white;
}

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

.days-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    margin-left: 4px;
}

.days-calc {
    margin-top: 10px;
    padding: 10px 14px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.08), rgba(6, 182, 212, 0.05));
    border: 1px solid rgba(16, 185, 129, 0.15);
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.days-calc .calc-total {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--accent-green);
}

/* ===== Days Badge in Table ===== */
.days-progress {
    display: flex;
    align-items: center;
    gap: 8px;
}

.days-progress-bar {
    width: 60px;
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    overflow: hidden;
}

.days-progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}

.days-progress-text {
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
}

/* ===== Payment History ===== */
.payment-list {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.payment-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-subtle);
    transition: background var(--transition-fast);
}

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

.payment-item:hover {
    background: rgba(16, 185, 129, 0.04);
}

.payment-item-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: rgba(16, 185, 129, 0.12);
    color: var(--accent-green);
}

.payment-item-info {
    flex: 1;
}

.payment-item-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.payment-item-detail {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.payment-item-amount {
    font-weight: 700;
    font-size: 1rem;
    color: var(--accent-green);
    white-space: nowrap;
}

/* ===== Detail Modal Content ===== */
.detail-content {
    padding: 20px 24px 24px;
}

.detail-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.detail-stat {
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    padding: 14px;
    border: 1px solid var(--border-subtle);
}

.detail-stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.detail-stat-value {
    font-size: 1.15rem;
    font-weight: 700;
    margin-top: 4px;
}

.detail-payments-title {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-subtle);
}

.detail-payment-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 0.85rem;
}

.detail-payment-item:last-child {
    border-bottom: none;
}

.detail-payment-date {
    color: var(--text-secondary);
}

.detail-payment-amount {
    color: var(--accent-green);
    font-weight: 600;
}

.detail-payment-note {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.detail-notes {
    margin-top: 16px;
    padding: 12px 14px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    font-size: 0.88rem;
    color: var(--text-secondary);
}

.detail-notes strong {
    color: var(--text-primary);
    display: block;
    margin-bottom: 4px;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ===== Toast ===== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
    font-size: 0.88rem;
    color: var(--text-primary);
    max-width: 360px;
}

.toast.success { border-color: rgba(16, 185, 129, 0.3); }
.toast.error { border-color: rgba(239, 68, 68, 0.3); }
.toast.warning { border-color: rgba(245, 158, 11, 0.3); }

.toast-icon {
    flex-shrink: 0;
}

.toast.success .toast-icon { color: var(--accent-green); }
.toast.error .toast-icon { color: var(--accent-red); }
.toast.warning .toast-icon { color: var(--accent-orange); }

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

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

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-blue);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .app-container {
        padding: 0 14px 40px;
    }

    .header-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .header-actions {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 8px;
    }

    #userEmail {
        font-size: 0.75rem;
        max-width: 130px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .stats-section {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .stat-card {
        padding: 14px;
        gap: 10px;
    }

    .stat-icon {
        width: 38px;
        height: 38px;
    }

    .stat-value {
        font-size: 1.1rem;
    }

    .stat-label {
        font-size: 0.72rem;
    }

    .table-container {
        overflow-x: auto;
    }

    .renters-table thead {
        display: none;
    }

    .renters-table,
    .renters-table tbody,
    .renters-table tr,
    .renters-table td {
        display: block;
        width: 100%;
    }

    .renters-table tr {
        background: var(--bg-card);
        border: 1px solid var(--border-subtle);
        border-radius: var(--radius-md);
        margin-bottom: 10px;
        padding: 12px;
        white-space: normal;
    }

    .renters-table td {
        padding: 4px 0;
        border: none;
        white-space: normal;
        font-size: 0.85rem;
    }

    .renters-table td:nth-child(4),
    .renters-table td:nth-child(5),
    .renters-table td:nth-child(6),
    .renters-table td:nth-child(7) {
        display: none;
    }

    .renters-table td:last-child {
        position: static;
        box-shadow: none;
        min-width: unset;
        width: 100%;
        padding-top: 8px;
        border-top: 1px solid var(--border-subtle);
        margin-top: 6px;
    }

    .actions-cell {
        justify-content: flex-start;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .detail-stats {
        grid-template-columns: 1fr;
    }

    .filter-tabs {
        overflow-x: auto;
    }

    .modal {
        margin: 10px;
    }
}

@media (max-width: 480px) {
    .stats-section {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .stat-card {
        padding: 12px;
    }

    .current-date {
        display: none;
    }

    .btn-primary {
        padding: 8px 14px;
        font-size: 0.82rem;
    }

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