:root {
    /* ── Argentina-inspired palette ── */
    --accent:       #75AADB;
    --accent-dark:  #5A96CC;
    --success:      #16a34a;
    --danger:       #dc2626;
    --warning:      #d97706;

    --bg-main:      #E8ECF1;
    --bg-sidebar:   #ffffff;
    --bg-card:      #ffffff;
    --auth-bg:      #16213E;

    --text-main:    #16213E;
    --text-muted:   #64748b;
    --text-faint:   #94a3b8;

    --border:       #dde2e9;
    --border-focus: #75AADB;

    --radius-sm:    6px;
    --radius-md:    10px;
    --radius-lg:    14px;

    --shadow-sm:    0 1px 3px rgba(0,0,0,.06);
    --shadow-md:    0 4px 12px rgba(0,0,0,.07);

    --transition:   all 0.2s ease;
}

[data-theme="dark"] {
    --bg-main:      #0f172a;
    --bg-sidebar:   #1e293b;
    --bg-card:      #1e293b;
    --text-main:    #f1f5f9;
    --text-muted:   #94a3b8;
    --text-faint:   #64748b;
    --border:       #334155;
}


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

body {
    font-family: 'Inter', 'Outfit', system-ui, sans-serif;
    font-size: 13px;
    line-height: 1.5;
    background: var(--bg-main);
    color: var(--text-main);
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.2s, color 0.2s;
}

.auth-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    height: 100vh;
    width: 100vw;
    position: fixed;
    top: 0;
    left: 0;
    padding: 0;
    margin: 0;
    z-index: 9999;

    /* Fallback background color */
    background: var(--auth-bg);

    /* Background image */
    background-image: url('assets/Background.jpeg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;

    overflow: hidden;
}


.auth-page::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(22, 33, 62, 0.92) 0%, rgba(26, 58, 92, 0.88) 50%, rgba(22, 33, 62, 0.92) 100%);
    z-index: 0;
}


.auth-container {
    width: 90%;
    max-width: 400px;
    margin: auto;

    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2.5rem 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    position: relative;
    z-index: 1;
}

.status-message {
    padding: 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    margin: 1rem 0;
    text-align: center;
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* --- Brand block --- */
.auth-brand {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-logo {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #75AADB, #16213E);
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.4rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* --- Simple brand text --- */
.auth-brand h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.02em;
}

.auth-brand p {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
}

/* --- Word rotator - display all words in sequence --- */
.auth-word-rotator {
    display: inline-block;
    min-width: 80px;
    color: var(--accent);
    font-weight: 600;
}

.auth-word-rotator .word {
    display: none;
}

.auth-word-rotator .word.active {
    display: inline;
    animation: wordFade 3s ease-in-out;
}

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

/* --- Form (dark-adapted) --- */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.auth-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.auth-field label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    cursor: default;
    display: block;
}

.auth-field input,
.auth-container input[type="email"],
.auth-container input[type="password"],
.auth-container input[type="text"],
.auth-container input[type="number"] {
    width: 100%;
    padding: 0.65rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-main);
    color: var(--text-main);
    font-size: 0.85rem;
    outline: none;
    transition: all 0.25s ease;
}

.auth-field input::placeholder,
.auth-container input::placeholder {
    color: var(--text-faint);
}

.auth-field input:focus,
.auth-container input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(117, 170, 219, 0.15);
    background: var(--bg-card);
}

/* --- Submit button with shimmer --- */
.auth-btn {
    width: 100%;
    padding: 0.7rem 1rem;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    letter-spacing: 0.01em;
}

.auth-btn::after {
    display: none;
}

.auth-btn:hover {
    background: var(--accent-dark);
}

.auth-btn:active {
    background: var(--accent-dark);
}

/* --- Footer links --- */
.auth-footer {
    margin-top: 1.25rem;
    text-align: center;
    font-size: 0.78rem;
    color: var(--text-muted);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.auth-footer a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.auth-footer a:hover { color: #93c5fd; text-decoration: underline; }

.auth-portals {
    margin-top: 0.75rem;
    text-align: center;
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.25);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
}

.auth-portals a {
    color: rgba(255, 255, 255, 0.4);
    text-decoration: none;
    transition: color 0.2s;
}

.auth-portals a:hover { color: #8FBDE8; }

/* --- Success Panel --- */
.success-panel {
    display: none;
    text-align: center;
    animation: fadeUp 0.35s ease-out;
}

.success-icon {
    width: 64px;
    height: 64px;
    background: rgba(22, 163, 74, 0.12);
    color: #16a34a;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    margin-bottom: 1rem;
}

.success-panel h3 {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: #fff;
}

.success-panel p {
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}


/* =========================================================
   DASHBOARD LAYOUT
   ========================================================= */

.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 220px;
    flex-shrink: 0;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    padding: 1.5rem 0.75rem;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
    padding: 0 0.5rem;
    margin-bottom: 1.75rem;
}

.logo i { color: var(--accent); font-size: 1.1rem; }

nav {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

nav a {
    text-decoration: none;
    color: var(--text-muted);
    padding: 0.55rem 0.75rem;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.82rem;
    font-weight: 500;
    transition: var(--transition);
    cursor: pointer;
}

nav a i { width: 16px; text-align: center; font-size: 0.85rem; }

nav a:hover { background: var(--bg-main); color: var(--text-main); }

nav a.active {
    background: #eff6ff;
    color: var(--accent);
    font-weight: 600;
}

[data-theme="dark"] nav a.active { background: #1e3a5f; }

.logout-btn {
    padding: 0.75rem 0 0;
    border-top: 1px solid var(--border);
    margin-top: 0.5rem;
}

/* Top Nav / Header */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.top-nav h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
}

.content-body {
    padding: 1.5rem;
    flex-grow: 1;
    overflow-y: auto;
}

/* View Management */
.content-view { display: none !important; }
.content-view.active { display: block !important; }

/* Section headers */
.welcome-section { margin-bottom: 1.25rem; }
.welcome-section h2 { font-size: 1.1rem; font-weight: 700; margin-bottom: 0.2rem; }
.welcome-section p { font-size: 0.8rem; color: var(--text-muted); }

/* =========================================================
   STATS / CARDS
   ========================================================= */

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

.stat-card {
    background: var(--bg-card);
    padding: 1.1rem 1.25rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.85rem;
    transition: var(--transition);
}

.stat-card:hover {
    box-shadow: var(--shadow-sm);
    border-color: #cbd5e1;
}

.stat-icon {
    width: 40px;
    height: 40px;
    background: #eff6ff;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    font-size: 1rem;
    flex-shrink: 0;
}

.stat-info { flex: 1; min-width: 0; }

.stat-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    display: block;
    margin-bottom: 0.2rem;
}

.stat-info h3, .stat-info h4 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.settings-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    margin-bottom: 0.75rem;
}

/* =========================================================
   TABLES
   ========================================================= */

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

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.data-table th,
.data-table td {
    padding: 0.6rem 0.85rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--bg-main);
}

.data-table tr:hover td { background: var(--bg-main); }

/* =========================================================
   BUTTONS
   ========================================================= */

.btn-primary {
    background: var(--accent);
    border: none;
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    transition: var(--transition);
}

.btn-primary:hover { background: var(--accent-dark); }

.btn-secondary {
    background: var(--bg-main);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    transition: var(--transition);
}

.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

.btn-danger {
    background: var(--danger);
    color: #fff;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.8rem;
}

.btn-danger:hover { background: #b91c1c; }

.btn-text {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.8rem;
    padding: 0.4rem 0.75rem;
    transition: var(--transition);
    width: 100%;
    text-align: left;
    border-radius: var(--radius-sm);
}

.btn-text:hover { color: var(--text-main); background: var(--bg-main); }

.btn-block { width: 100%; }

.icon-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    padding: 0.4rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

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

/* =========================================================
   FORM ELEMENTS
   ========================================================= */

.form-group {
    margin-bottom: 0.85rem;
    position: relative;
}

.form-group label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: default;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-main);
    color: var(--text-main);
    font-size: 0.82rem;
    outline: none;
    transition: border-color 0.15s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(117, 170, 219, 0.12);
}

.form-group i {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-faint);
    font-size: 0.8rem;
    pointer-events: none;
}

textarea {
    width: 100%;
    padding: 0.6rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-main);
    color: var(--text-main);
    font-size: 0.82rem;
    outline: none;
    min-height: 90px;
    font-family: inherit;
    transition: border-color 0.15s;
    resize: vertical;
}

textarea:focus { border-color: var(--accent); }

input[type="checkbox"] {
    width: 14px;
    height: 14px;
    cursor: pointer;
    accent-color: var(--accent);
}

label { cursor: pointer; color: var(--text-main); display: flex; align-items: center; }

/* =========================================================
   STATUS BADGES
   ========================================================= */

.status-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.status-paid   { background: #dcfce7; color: var(--success); }
.status-pending { background: #fef3c7; color: var(--warning); }
.status-overdue { background: #fee2e2; color: var(--danger); }

/* =========================================================
   NOTIFICATIONS
   ========================================================= */

.notifications-list { margin-top: 0.85rem; }

.notification-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    cursor: pointer;
    transition: var(--transition);
}

.notification-item:hover { background: var(--bg-main); }
.notification-item.unread { border-left: 3px solid var(--accent); }

.notification-content h4 { font-size: 0.82rem; margin-bottom: 0.15rem; }

.notification-content p { color: var(--text-muted); font-size: 0.76rem; }

.notification-time { font-size: 0.68rem; color: var(--text-faint); white-space: nowrap; }

/* =========================================================
   MODALS
   ========================================================= */

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal-content {
    background: var(--bg-card);
    padding: 1.25rem;
    border-radius: var(--radius-md);
    max-width: 480px;
    width: 100%;
    position: relative;
    box-shadow: var(--shadow-md);
}

.modal-content h3 { font-size: 0.95rem; font-weight: 700; margin-bottom: 1rem; }

.close {
    position: absolute;
    top: 0.85rem;
    right: 1rem;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
}

.close:hover { color: var(--danger); }

.qr-close-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.6rem;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid var(--danger);
    background: var(--danger);
    color: #fff;
    font-size: 1.3rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    padding: 0;
}

.qr-close-btn:hover {
    background: #c0392b;
    border-color: #c0392b;
    transform: scale(1.1);
}

/* =========================================================
   PAYMENT
   ========================================================= */

.payment-actions {
    background: var(--bg-card);
    padding: 1.25rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.payment-methods {
    display: flex;
    gap: 0.75rem;
    margin: 0.75rem 0;
    flex-wrap: wrap;
}

.method-btn {
    flex: 1;
    padding: 0.7rem;
    background: var(--bg-main);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    transition: var(--transition);
}

.method-btn:hover, .method-btn.selected {
    border-color: var(--accent);
    color: var(--accent);
}

.manual-mpesa {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

.manual-mpesa input {
    flex: 1;
    min-width: 180px;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-main);
    color: var(--text-main);
    font-size: 0.82rem;
    outline: none;
}

.manual-mpesa button {
    padding: 0.55rem 1rem;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    transition: var(--transition);
}

.manual-mpesa button:hover { background: var(--accent-dark); }

/* =========================================================
   PROFILE
   ========================================================= */

.profile-section { display: flex; gap: 1.5rem; flex-wrap: wrap; }

.profile-avatar-container { position: relative; }

.profile-avatar-container img {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border);
}

.avatar-upload-btn {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--accent);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
}

.profile-info { flex: 1; }
.profile-info p { margin-bottom: 0.35rem; font-size: 0.82rem; }

/* =========================================================
   QR CODE PAYMENT
   ========================================================= */

.qr-payment {
    text-align: center;
}

.qr-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    margin-bottom: 1.25rem;
}

.qr-header i {
    font-size: 1.4rem;
    color: #75AADB;
}

.qr-header h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
}

.qr-details {
    background: var(--bg-main);
    border-radius: var(--radius-sm);
    padding: 0.85rem 1rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
}

.qr-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.35rem 0;
}

.qr-detail-row + .qr-detail-row {
    border-top: 1px solid var(--border);
}

.qr-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
}

.qr-value {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: 0.03em;
}

.qr-amount-row {
    margin-bottom: 1.25rem;
    text-align: left;
}

.qr-amount-row label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
}

.qr-amount-row input {
    width: 100%;
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-main);
    color: var(--text-main);
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    outline: none;
    transition: border-color 0.15s;
}

.qr-amount-row input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.qr-code-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 1rem 0;
    min-height: 180px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem;
}

.qr-code-container img,
.qr-code-container canvas,
.qr-code-container table {
    display: block;
    margin: 0 auto;
}

.qr-instructions {
    background: var(--bg-main);
    border-radius: var(--radius-sm);
    padding: 0.85rem 1rem;
    margin: 1rem 0;
    text-align: left;
    border: 1px solid var(--border);
}

.qr-instructions p {
    font-size: 0.8rem;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.qr-instructions ol {
    margin: 0;
    padding-left: 1.2rem;
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.7;
}

.qr-instructions ol li strong {
    color: var(--text-main);
}

.qr-verify {
    border-top: 1px solid var(--border);
    padding-top: 1rem;
    margin-top: 0.5rem;
}

.qr-verify p {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

/* =========================================================
   MISC
   ========================================================= */

.badge {
    background: var(--danger);
    color: #fff;
    border-radius: 20px;
    padding: 0.1rem 0.45rem;
    font-size: 0.65rem;
    font-weight: 700;
    margin-left: auto;
}

.header-actions { display: flex; gap: 0.5rem; align-items: center; }

#profile-avatar { transition: transform 0.2s; }
#profile-avatar:hover { transform: scale(1.05); }

body.no-select { user-select: none; }

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 768px) {
    .app-container { flex-direction: column; }

    .sidebar {
        width: 100%;
        height: auto;
        position: static;
        flex-direction: row;
        flex-wrap: wrap;
        padding: 0.75rem;
    }

    .sidebar nav { flex-direction: row; flex-wrap: wrap; }

    .content-body { padding: 1rem; }

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

    .profile-section { flex-direction: column; align-items: center; text-align: center; }

    .payment-methods, .manual-mpesa { flex-direction: column; }

    .modal-content { padding: 1rem; }
}

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

/* =========================================================
   UTILITIES MANAGEMENT
   ========================================================= */

.utility-forms-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.utility-form-card {
    padding: 1.25rem;
}

.utility-form-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.utility-form-header i {
    font-size: 1.1rem;
}

.utility-form-header h3 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
}

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

.utility-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.55rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.utility-type-badge.water {
    background: #e0f2fe;
    color: #0284c7;
}

.utility-type-badge.wifi {
    background: #f0fdf4;
    color: #16a34a;
}

/* =========================================================
   INVOICE / STATEMENT
   ========================================================= */

.invoice-document {
    padding: 0.5rem;
}

.invoice-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 2px solid var(--border);
    padding-bottom: 1rem;
    margin-bottom: 1.25rem;
}

.invoice-tenant-info {
    display: flex;
    justify-content: space-between;
    background: var(--bg-main);
    padding: 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.25rem;
}

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

.invoice-table th,
.invoice-table td {
    padding: 0.65rem 0.85rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 0.82rem;
}

.invoice-table th {
    background: var(--bg-main);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.invoice-total-row td {
    border-top: 2px solid var(--text-main);
    padding-top: 0.85rem;
    font-weight: 700;
}

/* =========================================================
   TOAST NOTIFICATIONS
   ========================================================= */

.rms-toast {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-md);
    font-size: 0.82rem;
    font-weight: 500;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    z-index: 9999;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
    max-width: 380px;
}

.rms-toast.show {
    transform: translateY(0);
    opacity: 1;
}

.rms-toast-success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.rms-toast-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.rms-toast-info {
    background: #e0f2fe;
    color: #075985;
    border: 1px solid #bae6fd;
}

/* =========================================================
   RESPONSIVE — UTILITY ADDITIONS
   ========================================================= */

@media (max-width: 768px) {
    .utility-forms-row {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .invoice-header,
    .invoice-tenant-info {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .invoice-tenant-info > div:last-child {
        text-align: left;
    }
}

/* =========================================================
   MESSAGES & CHAT
   ========================================================= */

.messages-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.message-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.message-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: transparent;
    transition: background 0.2s ease;
}

.message-item:hover {
    box-shadow: var(--shadow-sm);
    border-color: var(--accent);
}

.message-item.unread::before {
    background: var(--accent);
}

.message-item.unread {
    background: linear-gradient(90deg, rgba(37,99,235,0.03) 0%, transparent 100%);
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.5rem;
    gap: 1rem;
}

.sender-name {
    font-size: 0.85rem;
    color: var(--text-main);
    font-weight: 600;
}

.message-date {
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.message-subject {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 0.3rem;
    line-height: 1.3;
}

.message-preview {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
    line-height: 1.4;
}

.unread-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
}

/* Message Form */
.send-message-form {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.send-message-form h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-main);
}

.message-input-group {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.message-textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-main);
    color: var(--text-main);
    font-size: 0.85rem;
    font-family: inherit;
    min-height: 100px;
    resize: vertical;
    outline: none;
    transition: all 0.2s ease;
}

.message-textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(117, 170, 219, 0.12);
    background: var(--bg-card);
}

.message-button {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 0.65rem 1.25rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
}

.message-button:hover {
    background: var(--accent-dark);
}

.message-button:active {
    background: var(--accent-dark);
}

/* Broadcast Message (Landlord) */
.broadcast-form {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
}

.broadcast-form h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.broadcast-form > p {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

/* Feedback Display (Professional) */
.feedback-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 0.75rem;
    transition: all 0.2s ease;
}

.feedback-item:hover {
    box-shadow: var(--shadow-sm);
    border-color: var(--accent);
}

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

.feedback-subject {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-main);
}

.feedback-from {
    font-size: 0.78rem;
    color: var(--accent);
    font-weight: 500;
}

.feedback-date {
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.feedback-message {
    font-size: 0.82rem;
    color: var(--text-main);
    line-height: 1.5;
    margin: 0.5rem 0;
}

.feedback-category {
    display: inline-block;
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    background: #EFF6FF;
    color: #75AADB;
    border-radius: 12px;
    margin-top: 0.5rem;
    font-weight: 500;
}