/* CSS VARIABLES & DESIGN TOKENS */
:root {
    --bg-dark: #090d16;
    --bg-sidebar: #101625;
    --card-bg: rgba(20, 28, 47, 0.6);
    --card-border: rgba(255, 255, 255, 0.07);
    --card-hover-border: rgba(99, 102, 241, 0.4);
    
    --primary: #6366f1;
    --primary-grad: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    --cyan-grad: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
    --success-grad: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --danger-grad: linear-gradient(135deg, #f43f5e 0%, #e11d48 100%);
    --warning-grad: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);

    --accent-cyan: #06b6d4;
    --accent-purple: #a855f7;
    --success: #10b981;
    --danger: #f43f5e;
    --warning: #f59e0b;
    --muted: #64748b;
    --light: #f8fafc;
    --white: #ffffff;
    
    --font-ui: 'Inter', 'Sarabun', sans-serif;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.15);
    --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.3);
}

/* RESET & BASE */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-ui);
}

body {
    background-color: var(--bg-dark);
    color: var(--light);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
    background-image: 
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.08) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(168, 85, 247, 0.08) 0px, transparent 50%);
    background-attachment: fixed;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* HELPERS */
.text-muted { color: var(--muted) !important; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-cyan { color: var(--accent-cyan) !important; }
.text-yellow { color: var(--warning) !important; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.font-bold { font-weight: 700; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mr-2 { margin-right: 0.5rem; }
.hide { display: none !important; }
.full-width { width: 100% !important; }

/* UTILITY SHAPES */
.glass {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    box-shadow: var(--shadow-card);
}

.glass-bottom {
    border-bottom: 1px solid var(--card-border);
    backdrop-filter: blur(12px);
}

/* BADGES */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-success { background: rgba(16, 185, 129, 0.15); color: var(--success); border: 1px solid rgba(16, 185, 129, 0.2); }
.badge-danger { background: rgba(244, 63, 94, 0.15); color: var(--danger); border: 1px solid rgba(244, 63, 94, 0.2); }
.badge-warning { background: rgba(245, 158, 11, 0.15); color: var(--warning); border: 1px solid rgba(245, 158, 11, 0.2); }
.badge-muted { background: rgba(100, 116, 139, 0.15); color: var(--muted); border: 1px solid rgba(100, 116, 139, 0.2); }

/* BUTTONS */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-smooth);
    border: none;
    outline: none;
}
.btn-primary {
    background: var(--primary-grad);
    color: var(--white);
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
}
.btn-primary:hover {
    filter: brightness(1.15);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}
.btn-success {
    background: var(--success-grad);
    color: var(--white);
}
.btn-success:hover {
    filter: brightness(1.15);
    transform: translateY(-1px);
}
.btn-danger {
    background: var(--danger-grad);
    color: var(--white);
}
.btn-danger:hover {
    filter: brightness(1.15);
    transform: translateY(-1px);
}
.btn-warning {
    background: var(--warning-grad);
    color: var(--white);
}
.btn-warning:hover {
    filter: brightness(1.15);
    transform: translateY(-1px);
}
.btn-outline {
    background: transparent;
    color: var(--light);
    border: 1px solid rgba(255, 255, 255, 0.15);
}
.btn-outline:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.3);
}
.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
}

/* LOCK SCREEN */
.lock-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    background: rgba(5, 7, 13, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}
.lock-screen.active {
    opacity: 1;
    pointer-events: auto;
}
.lock-card {
    padding: 2.5rem;
    border-radius: 20px;
    width: 100%;
    max-width: 400px;
    text-align: center;
}
.lock-logo-wrapper {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    background: var(--primary-grad);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4);
}
.lock-logo-icon {
    color: var(--white);
    width: 32px;
    height: 32px;
}
.lock-title {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(to right, #ffffff, #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.passcode-dots {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin: 2rem 0 1rem;
}
.passcode-dots .dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    transition: var(--transition-smooth);
}
.passcode-dots .dot.active {
    background: var(--accent-cyan);
    border-color: var(--accent-cyan);
    box-shadow: 0 0 10px var(--accent-cyan);
    transform: scale(1.15);
}
.lock-message {
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
    min-height: 20px;
}
.error-text { color: var(--danger); }
.keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    max-width: 280px;
    margin: 0 auto;
}
.key-btn {
    height: 60px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--light);
    font-size: 1.5rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}
.key-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}
.key-btn:active {
    transform: scale(0.95);
}
.key-btn.secondary-btn {
    font-size: 1rem;
    background: transparent;
    border: none;
    color: var(--muted);
}
.key-btn.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--light);
}

/* MAIN APP WRAPPER & SIDEBAR */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}
.sidebar {
    width: 260px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    border-right: 1px solid var(--card-border);
}
.sidebar-brand {
    padding: 1.5rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid var(--card-border);
}
.brand-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--primary-grad);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3);
}
.brand-icon i {
    width: 20px;
    height: 20px;
    color: var(--white);
}
.brand-text {
    display: flex;
    flex-direction: column;
}
.brand-name {
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: 0.5px;
}
.brand-tag {
    font-size: 0.7rem;
    color: var(--muted);
    font-weight: 500;
}
.sidebar-menu {
    padding: 1.5rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex-grow: 1;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.8rem 1rem;
    border-radius: 10px;
    color: var(--muted);
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    text-align: left;
    transition: var(--transition-smooth);
}
.nav-item i {
    width: 18px;
    height: 18px;
}
.nav-item:hover {
    color: var(--light);
    background: rgba(255, 255, 255, 0.05);
}
.nav-item.active {
    color: var(--white);
    background: var(--primary-grad);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.25);
}
.sidebar-footer {
    padding: 1rem 0.75rem;
    border-top: 1px solid var(--card-border);
}
.lock-app-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.75rem;
    background: rgba(244, 63, 94, 0.1);
    color: var(--danger);
    border: 1px solid rgba(244, 63, 94, 0.15);
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: var(--transition-smooth);
}
.lock-app-btn:hover {
    background: var(--danger);
    color: var(--white);
}
.system-time {
    text-align: center;
    font-size: 0.75rem;
    color: var(--muted);
    margin-top: 0.75rem;
}

/* MAIN CONTENT */
.main-content {
    flex-grow: 1;
    margin-left: 260px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
.main-header {
    height: 70px;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 90;
}
.header-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--white);
}
.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.month-selector {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.85rem;
    color: var(--accent-cyan);
}
.content-body {
    padding: 2rem;
    flex-grow: 1;
}
.tab-content {
    display: none;
    animation: fadeIn 0.4s ease;
}
.tab-content.active {
    display: block;
}

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

/* DASHBOARD TAB Styles */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}
.stat-card {
    padding: 1.5rem;
    border-radius: 16px;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    transition: var(--transition-smooth);
}
.stat-card:hover {
    border-color: var(--card-hover-border);
    transform: translateY(-2px);
}
.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.stat-icon.icon-cyan { background: rgba(6, 182, 212, 0.15); color: var(--accent-cyan); }
.stat-icon.icon-green { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.stat-icon.icon-blue { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }
.stat-icon.icon-yellow { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.stat-info h3 {
    font-size: 0.85rem;
    color: var(--muted);
    font-weight: 500;
}
.stat-info p {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--white);
}

.dashboard-middle-grid {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}
@media (max-width: 900px) {
    .dashboard-middle-grid {
        grid-template-columns: 1fr;
    }
}
.revenue-card, .status-summary-card {
    padding: 1.5rem;
    border-radius: 16px;
}
.card-header-v {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}
.card-header-v h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--white);
}
.revenue-details {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}
.rev-main {
    display: flex;
    flex-direction: column;
}
.rev-label {
    font-size: 0.85rem;
    color: var(--muted);
}
.rev-val {
    font-size: 2.2rem;
    font-weight: 700;
}
.rev-divider {
    height: 1px;
    background: var(--card-border);
}
.rev-sub-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
.rev-sub-item {
    display: flex;
    flex-direction: column;
}
.sub-label {
    font-size: 0.75rem;
    color: var(--muted);
}
.sub-val {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--light);
}

.quick-status-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-top: 1rem;
}
.action-card-btn {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 1rem 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: var(--light);
    cursor: pointer;
    transition: var(--transition-smooth);
}
.action-card-btn i {
    width: 24px;
    height: 24px;
}
.action-card-btn span {
    font-size: 0.75rem;
    font-weight: 500;
}
.action-card-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--card-hover-border);
    transform: translateY(-2px);
}

/* TABLES SYSTEM */
.dashboard-table-card {
    padding: 1.5rem;
    border-radius: 16px;
    margin-top: 1.5rem;
}
.table-wrapper {
    width: 100%;
    overflow-x: auto;
}
.table-v {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.85rem;
}
.table-v th {
    padding: 0.75rem 1rem;
    font-weight: 600;
    color: var(--muted);
    border-bottom: 2px solid var(--card-border);
    font-size: 0.8rem;
    text-transform: uppercase;
}
.table-v td {
    padding: 0.9rem 1rem;
    border-bottom: 1px solid var(--card-border);
    color: var(--light);
}
.table-v tbody tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

/* FLOOR MAP TAB Styles */
.floor-selector-bar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    background: rgba(255, 255, 255, 0.02);
    padding: 0.35rem;
    border-radius: 10px;
    border: 1px solid var(--card-border);
    width: fit-content;
}
.floor-btn {
    padding: 0.5rem 1.25rem;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--muted);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-smooth);
}
.floor-btn:hover {
    color: var(--light);
}
.floor-btn.active {
    background: var(--primary-grad);
    color: var(--white);
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.2);
}

.legend-bar {
    display: flex;
    gap: 1.5rem;
    padding: 0.75rem 1.25rem;
    border-radius: 10px;
    margin-bottom: 1.5rem;
    font-size: 0.8rem;
    width: fit-content;
}
.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}
.bg-green { background-color: var(--success); box-shadow: 0 0 8px var(--success); }
.bg-danger { background-color: var(--danger); box-shadow: 0 0 8px var(--danger); }
.bg-yellow { background-color: var(--warning); box-shadow: 0 0 8px var(--warning); }

.floors-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}
.floor-row {
    animation: fadeIn 0.4s ease;
}
.floor-row-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--accent-cyan);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.floor-row-title::after {
    content: '';
    flex-grow: 1;
    height: 1px;
    background: linear-gradient(to right, rgba(6, 182, 212, 0.3), transparent);
}
.rooms-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 1rem;
}
.room-card {
    padding: 1.25rem 1rem;
    border-radius: 14px;
    cursor: pointer;
    text-align: center;
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 100px;
}
.room-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
}
/* Room card statuses */
.room-card.available {
    background: rgba(16, 185, 129, 0.05);
    border: 1px solid rgba(16, 185, 129, 0.15);
}
.room-card.available::before { background: var(--success-grad); }
.room-card.available:hover {
    background: rgba(16, 185, 129, 0.1);
    border-color: var(--success);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.2);
}

.room-card.occupied {
    background: rgba(244, 63, 94, 0.05);
    border: 1px solid rgba(244, 63, 94, 0.15);
}
.room-card.occupied::before { background: var(--danger-grad); }
.room-card.occupied:hover {
    background: rgba(244, 63, 94, 0.1);
    border-color: var(--danger);
    box-shadow: 0 0 15px rgba(244, 63, 94, 0.2);
}

.room-card.maintenance {
    background: rgba(245, 158, 11, 0.05);
    border: 1px solid rgba(245, 158, 11, 0.15);
}
.room-card.maintenance::before { background: var(--warning-grad); }
.room-card.maintenance:hover {
    background: rgba(245, 158, 11, 0.1);
    border-color: var(--warning);
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.2);
}

.room-number {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--white);
    margin-bottom: 0.25rem;
}
.room-tenant-name {
    font-size: 0.75rem;
    color: var(--light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
.room-status-text {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}
.room-card.available .room-status-text { color: var(--success); }
.room-card.occupied .room-status-text { color: var(--danger); }
.room-card.maintenance .room-status-text { color: var(--warning); }

/* Room card unpaid indicator badge */
.unpaid-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--danger);
    box-shadow: 0 0 8px var(--danger);
}

/* BILLING TAB Filters */
.billing-control-panel {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding: 1.25rem;
    border-radius: 16px;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1.25rem;
}
.billing-filters {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    flex-grow: 1;
}
.input-group-v {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    min-width: 160px;
}
.input-group-v label {
    font-size: 0.75rem;
    color: var(--muted);
    font-weight: 500;
}
.input-group-v input, .input-group-v select {
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--light);
    outline: none;
    font-size: 0.85rem;
    transition: var(--transition-smooth);
}
.input-group-v input:focus, .input-group-v select:focus {
    border-color: var(--accent-cyan);
    background: rgba(255, 255, 255, 0.08);
}

/* SETTINGS TAB */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
}
@media (max-width: 500px) {
    .settings-grid {
        grid-template-columns: 1fr;
    }
}
.settings-card {
    padding: 1.75rem;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}
.settings-card.full-width {
    grid-column: 1 / -1;
}
.settings-card h2 {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--white);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 0.75rem;
}
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 1rem;
}
.form-group label {
    font-size: 0.8rem;
    color: var(--light);
    font-weight: 500;
}
.form-group input, .form-group select, .form-group textarea {
    padding: 0.6rem 0.9rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--white);
    outline: none;
    font-size: 0.9rem;
    transition: var(--transition-smooth);
}
.form-group textarea {
    resize: vertical;
    min-height: 80px;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.15);
}

.batch-rent-setup {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--card-border);
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
}
.batch-rent-setup h3 {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--light);
}
.batch-rent-inputs {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.batch-rent-inputs select, .batch-rent-inputs input {
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--white);
    outline: none;
}
.room-rent-editor-container {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--card-border);
    border-radius: 12px;
}
.room-rent-editor-container table {
    margin: 0;
}

.backup-actions {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}
.btn-group-row {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.danger-zone {
    margin-top: 1.5rem;
    border-top: 1px dashed rgba(244, 63, 94, 0.3);
    padding-top: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.danger-zone h3 {
    color: var(--danger);
    font-size: 0.95rem;
}
.text-xs { font-size: 0.75rem; }

/* DRAWER OVERLAY & PANEL */
.drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    justify-content: flex-end;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.drawer-overlay.active {
    opacity: 1;
    pointer-events: auto;
}
.drawer {
    width: 450px;
    max-width: 90%;
    height: 100%;
    background: var(--bg-sidebar);
    border-left: 1px solid var(--card-border);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.drawer-overlay.active .drawer {
    transform: translateX(0);
}
.drawer-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.drawer-title-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.drawer-room-num {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--white);
}
.drawer-close-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--muted);
    transition: var(--transition-smooth);
    display: flex;
}
.drawer-close-btn:hover {
    color: var(--light);
}
.drawer-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}
.drawer-section {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    animation: fadeIn 0.3s ease;
}
.section-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.maintenance-notice {
    padding: 1rem;
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: 10px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tenant-profile-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 1.25rem;
}
.profile-title, .form-sub-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--white);
    margin-bottom: 0.75rem;
    border-left: 3px solid var(--primary);
    padding-left: 0.5rem;
}
.profile-row {
    display: flex;
    justify-content: space-between;
    padding: 0.4rem 0;
    font-size: 0.85rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}
.profile-row:last-child {
    border-bottom: none;
}
.profile-label { color: var(--muted); }
.profile-val { color: var(--light); font-weight: 500; }

.billing-action-panel {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 1.25rem;
}
.billing-action-panel h3 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}
.bill-status-indicator {
    padding: 0.75rem;
    border-radius: 8px;
    font-size: 0.8rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* FORMS IN DRAWER */
.form-container {
    animation: fadeIn 0.3s ease;
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--card-border);
    padding: 1.25rem;
    border-radius: 12px;
    margin-top: 1rem;
}
.form-header-v {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 0.5rem;
}
.form-header-v h3 {
    font-size: 0.95rem;
    font-weight: 600;
}
.form-row {
    display: flex;
    gap: 0.75rem;
}
.form-row .col {
    flex: 1;
}

/* Toggle Switch */
.form-toggle-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
    flex-shrink: 0;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .4s;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}
.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: var(--white);
    transition: .4s;
    border-radius: 50%;
}
.toggle-switch input:checked + .slider {
    background-color: var(--success);
}
.toggle-switch input:checked + .slider:before {
    transform: translateX(24px);
}
.toggle-label-desc {
    display: flex;
    flex-direction: column;
}
.toggle-label-desc span {
    font-size: 0.85rem;
    font-weight: 500;
}
.desc-text {
    font-size: 0.7rem;
}

/* REALTIME PREVIEW BOX */
.billing-preview-box {
    padding: 1rem;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.2);
    margin-top: 1rem;
}
.billing-preview-box h4 {
    font-size: 0.8rem;
    color: var(--light);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.preview-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    padding: 0.25rem 0;
}
.preview-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 0.5rem 0;
}
.total-row {
    font-size: 1rem !important;
    font-weight: 700;
    color: var(--white);
}

/* MODALS SYSTEM (Invoice & Bulk Utility) */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}
.modal-card {
    width: 100%;
    max-width: 680px;
    border-radius: 16px;
    overflow: hidden;
    animation: modalSlideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}
.modal-card.bulk-modal {
    max-width: 1000px;
}
@keyframes modalSlideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
.modal-header-v {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--card-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0,0,0,0.15);
}
.modal-header-v h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--white);
}
.modal-actions {
    display: flex;
    gap: 0.5rem;
}

/* INVOICE PAPER (PRINT STYLE AND DESIGN) */
.invoice-paper {
    background: #ffffff;
    color: #1e293b;
    padding: 2.5rem;
    overflow-y: auto;
    font-family: 'Sarabun', 'Inter', sans-serif;
    font-size: 0.85rem;
}
.invoice-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}
.invoice-brand {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
    margin-bottom: 0.25rem;
}
.invoice-title-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}
.invoice-meta-row {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}
.invoice-meta-row .lbl { color: #64748b; }
.invoice-divider {
    height: 2px;
    background: #e2e8f0;
    margin: 1.5rem 0;
}
.invoice-parties {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 1.5rem;
}
.party-box {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.party-title {
    font-size: 0.75rem;
    color: #64748b;
    font-weight: 600;
    text-transform: uppercase;
}
.text-md { font-size: 1rem; font-weight: 600; color: #0f172a; }
.text-sm { font-size: 0.85rem; }
.text-xs { font-size: 0.75rem; }

.invoice-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
}
.invoice-table th {
    background: #f1f5f9;
    color: #475569;
    padding: 0.6rem 0.8rem;
    font-weight: 600;
    font-size: 0.8rem;
    border-bottom: 2px solid #cbd5e1;
}
.invoice-table td {
    padding: 0.75rem 0.8rem;
    border-bottom: 1px solid #e2e8f0;
    color: #334155;
}
.invoice-summary-section {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 2rem;
    align-items: flex-start;
}
.invoice-note-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 0.75rem 1rem;
    border-radius: 8px;
}
.note-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: #475569;
}
.invoice-totals {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.75rem;
}
.total-row-v {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}
.total-row-v span {
    font-size: 0.8rem;
    color: #64748b;
}
.total-row-v strong {
    color: var(--primary);
}
.invoice-status-stamp {
    display: inline-block;
    padding: 0.4rem 1rem;
    border: 2px solid #f43f5e;
    color: #f43f5e;
    font-weight: 700;
    border-radius: 6px;
    transform: rotate(-3deg);
    font-size: 0.9rem;
    letter-spacing: 0.5px;
    margin-top: 0.25rem;
}
.invoice-status-stamp.paid {
    border-color: #10b981;
    color: #10b981;
}
.invoice-signatures {
    display: flex;
    justify-content: space-between;
    margin-top: 3.5rem;
    padding: 0 1rem;
}
.signature-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 160px;
}
.sig-line {
    width: 100%;
    border-bottom: 1px solid #94a3b8;
    margin-bottom: 0.5rem;
}
.signature-box span {
    font-size: 0.75rem;
    color: #64748b;
}

/* BULK UTILITY SPECIFICS */
.bulk-form-container {
    padding: 1.5rem;
    overflow-y: auto;
    max-height: calc(90vh - 70px);
}
.bulk-table-wrapper {
    max-height: 450px;
    overflow-y: auto;
    border: 1px solid var(--card-border);
    border-radius: 12px;
}
.bulk-table {
    margin: 0;
    min-width: 850px;
}
.bulk-table input {
    width: 90px;
    padding: 0.4rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--white);
    border-radius: 6px;
    text-align: center;
}
.bulk-table input[type="text"] {
    width: 130px;
    text-align: left;
}
.bulk-table input:focus {
    border-color: var(--accent-cyan);
    outline: none;
}
.bulk-table input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* FILE UPLOAD & OTHER ACTIONS */
.file-upload-btn {
    position: relative;
    overflow: hidden;
}

/* ANIMATION UTILITIES */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
.animate-spin {
    animation: spin 1s linear infinite;
    display: inline-block;
}

/* PRINT MEDIA OVERRIDES */
@media print {
    body * {
        visibility: hidden;
    }
    #invoiceModal, #invoiceModal *, #printableInvoice, #printableInvoice * {
        visibility: visible;
    }
    #invoiceModal {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        background: white;
        height: auto;
    }
    .modal-card {
        box-shadow: none;
        max-width: 100%;
        width: 100%;
        height: auto;
        max-height: none;
        margin: 0;
        border: none;
    }
    .invoice-paper {
        padding: 0;
        width: 100%;
        height: auto;
        color: black !important;
        background: white !important;
    }
    .no-print {
        display: none !important;
    }
}

/* MOBILE RESPONSIVE OVERRIDES */
@media (max-width: 768px) {
    /* Main Layout */
    .app-wrapper {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: 65px;
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        z-index: 1000;
        border-right: none;
        border-top: 1px solid var(--card-border);
        flex-direction: row;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
        background: var(--bg-sidebar);
        backdrop-filter: blur(10px);
    }
    
    .sidebar-brand {
        display: none !important;
    }
    
    .sidebar-menu {
        flex-direction: row;
        padding: 0;
        margin: 0;
        gap: 0;
        width: 100%;
        height: 100%;
        justify-content: space-around;
        align-items: center;
    }
    
    .nav-item {
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        padding: 6px 0;
        background: transparent;
        border: none;
        flex-grow: 1;
        border-radius: 0;
        font-size: 0.65rem;
        color: var(--muted);
        height: 100%;
        transition: var(--transition-smooth);
    }
    
    .nav-item i {
        width: 20px;
        height: 20px;
    }
    
    .nav-item.active {
        background: transparent;
        color: var(--accent-cyan);
    }
    
    .nav-item.active::before {
        display: none;
    }
    
    .sidebar-footer {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0 !important;
        padding-bottom: 75px; /* space for bottom nav bar */
    }
    
    .main-header {
        padding: 1rem 1.25rem;
        height: auto;
        min-height: 60px;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 0.5rem;
    }
    
    .header-title {
        font-size: 1.2rem !important;
    }
    
    .header-actions {
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }
    
    #quickStatsOccupancy {
        display: none !important; /* Hide occupancy percentage stats on mobile header to save space */
    }
    
    .month-selector {
        padding: 0.4rem 0.6rem !important;
        font-size: 0.75rem !important;
    }
    
    .lock-header-btn {
        display: flex !important; /* Show header lock button on mobile */
    }
    
    /* Stats Cards Grid */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
        padding: 1rem 1.25rem 0;
    }
    
    .stat-card {
        padding: 1rem !important;
        gap: 0.75rem !important;
    }
    
    .stat-icon {
        width: 36px !important;
        height: 36px !important;
    }
    
    .stat-icon i {
        width: 18px !important;
        height: 18px !important;
    }
    
    .stat-info h3 {
        font-size: 0.7rem !important;
    }
    
    .stat-info p {
        font-size: 1.1rem !important;
    }
    
    /* Content Padding */
    .content-body {
        padding: 1rem 1.25rem !important;
    }
    
    /* Dashboard Revenue Card and Table */
    .dashboard-middle-grid {
        grid-template-columns: 1fr !important;
        gap: 1.25rem !important;
    }
    
    /* Floormap Filter buttons bar */
    .floor-selector-bar {
        overflow-x: auto;
        white-space: nowrap;
        padding-bottom: 8px;
        display: flex;
        gap: 0.5rem;
        -webkit-overflow-scrolling: touch;
    }
    
    .floor-btn {
        flex-shrink: 0;
        padding: 0.5rem 1rem !important;
        font-size: 0.8rem !important;
    }
    
    /* Room Grid spacing */
    .rooms-grid {
        grid-template-columns: repeat(auto-fill, minmax(105px, 1fr)) !important;
        gap: 0.75rem !important;
    }
    
    .room-card {
        padding: 1.1rem 0.5rem !important;
    }
    
    .room-number {
        font-size: 1.2rem !important;
    }
    
    .room-status-text {
        font-size: 0.75rem !important;
    }
    
    /* Form input rows stacking */
    .form-row {
        flex-direction: column !important;
        gap: 0.75rem !important;
    }
    
    /* Settings layout */
    .settings-grid {
        grid-template-columns: 1fr !important;
        gap: 1.25rem !important;
    }
    
    .settings-card {
        padding: 1.25rem !important;
    }
    
    /* Side drawer taking 100% on mobile screens */
    .drawer {
        width: 100% !important;
        max-width: 100% !important;
        border-left: none !important;
    }
    
    /* Modals */
    .modal-card {
        width: 95% !important;
        max-height: 85vh !important;
        border-radius: 12px !important;
    }
    
    .modal-card.bulk-modal {
        width: 95% !important;
    }
    
    .bulk-form-container {
        padding: 1rem !important;
    }
    
    /* Invoice Modal Paper Layout */
    .invoice-paper {
        padding: 1.5rem 1.25rem !important;
    }
    
    .invoice-header {
        flex-direction: column !important;
        gap: 1rem !important;
        align-items: flex-start !important;
    }
    
    .invoice-meta {
        text-align: left !important;
        align-items: flex-start !important;
        width: 100% !important;
    }
    
    .invoice-parties {
        flex-direction: column !important;
        gap: 1rem !important;
    }
    
    .party-box {
        width: 100% !important;
        text-align: left !important;
    }
    
    .party-box.text-right {
        text-align: left !important;
    }
    
    /* Hide specific meter columns in invoice table on mobile to fit the screen width */
    .invoice-table th:nth-child(2),
    .invoice-table th:nth-child(3),
    .invoice-table th:nth-child(4),
    .invoice-table td:nth-child(2),
    .invoice-table td:nth-child(3),
    .invoice-table td:nth-child(4) {
        display: none !important;
    }
    
    .invoice-summary-section {
        flex-direction: column-reverse !important;
        gap: 1.25rem !important;
        align-items: flex-start !important;
    }
    
    .invoice-totals {
        width: 100% !important;
        align-items: flex-start !important;
    }
    
    .total-row-v {
        align-items: flex-start !important;
    }
    
    .invoice-signatures {
        margin-top: 2rem !important;
    }
    
    .signature-box {
        width: 110px !important;
    }
    
    /* Lock screen optimization for mobile */
    .lock-card {
        padding: 1.5rem !important;
        margin: 0 1rem;
    }
}

