/* Design System & Variables */
:root {
    --primary-color: #6366f1; /* Indigo */
    --primary-hover: #4f46e5;
    --primary-gradient: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    --bg-color: #f8fafc;
    --surface-color: #ffffff;
    --border-color: #e2e8f0;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #06b6d4;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --font-sans: 'Sarabun', 'Outfit', system-ui, -apple-system, sans-serif;
    --sidebar-width: 260px;
    --header-height: 70px;
}

/* Dark Mode Overrides */
[data-theme="dark"] {
    --bg-color: #0b0f19;
    --surface-color: #161e2e;
    --border-color: #2d3748;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.5);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.5);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.5);
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    transition: background-color 0.3s, color 0.3s;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
}

/* Layout Elements */
.app-header {
    height: var(--header-height);
    background-color: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    transition: background-color 0.3s, border-color 0.3s;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    font-size: 28px;
    color: var(--primary-color);
    background: rgba(99, 102, 241, 0.1);
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
}

.logo-text h1 {
    font-size: 18px;
    font-family: 'Outfit', sans-serif;
    color: var(--primary-color);
    line-height: 1.2;
}

.logo-text p {
    font-size: 12px;
    color: var(--text-muted);
}

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

.role-selector-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.role-select {
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background-color: var(--surface-color);
    color: var(--text-main);
    font-weight: 500;
    cursor: pointer;
    outline: none;
}

.theme-toggle {
    cursor: pointer;
    font-size: 20px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: var(--bg-color);
    transition: background-color 0.3s;
}

.theme-toggle:hover {
    background-color: var(--border-color);
}

.main-container {
    display: flex;
    margin-top: var(--header-height);
    min-height: calc(100vh - var(--header-height));
}

/* Sidebar Styling */
.app-sidebar {
    width: var(--sidebar-width);
    background-color: var(--surface-color);
    border-right: 1px solid var(--border-color);
    position: fixed;
    top: var(--header-height);
    bottom: 0;
    left: 0;
    z-index: 40;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 20px 0;
    transition: background-color 0.3s, border-color 0.3s;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0 12px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
    font-size: 14px;
    position: relative;
}

.nav-item i {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.nav-item:hover {
    background-color: var(--bg-color);
    color: var(--primary-color);
}

.nav-item.active {
    background-color: rgba(99, 102, 241, 0.08);
    color: var(--primary-color);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 4px;
    background-color: var(--primary-color);
    border-radius: 0 4px 4px 0;
}

.badge {
    padding: 2px 6px;
    font-size: 11px;
    font-weight: bold;
    border-radius: 10px;
    margin-left: auto;
}

.pending-payments-count {
    background-color: var(--warning-color);
    color: #ffffff;
}

.danger-badge {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
    font-size: 12px;
    padding: 4px 8px;
}

.sidebar-footer {
    padding: 0 24px;
    font-size: 11px;
    color: var(--text-muted);
}

/* Content Area Styling */
.app-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 30px;
    overflow-y: auto;
}

/* Views display controls */
.content-view {
    display: none;
    animation: fadeIn 0.4s ease-out;
}

.content-view.active {
    display: block;
}

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

.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.view-header h2 {
    font-size: 24px;
    font-weight: 700;
}

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

/* Premium Card Panel styling */
.card-panel {
    background-color: var(--surface-color);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    transition: background-color 0.3s, border-color 0.3s;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.panel-header h3 {
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* KPI Summary Cards Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.kpi-card {
    background-color: var(--surface-color);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 130px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s;
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 6px;
    height: 100%;
}

.kpi-card.purple::before { background-color: var(--primary-color); }
.kpi-card.red::before { background-color: var(--danger-color); }
.kpi-card.green::before { background-color: var(--success-color); }
.kpi-card.blue::before { background-color: var(--info-color); }

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

.kpi-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}

.kpi-icon {
    font-size: 20px;
    opacity: 0.2;
}

.kpi-value {
    font-size: 24px;
    font-weight: 800;
    margin: 8px 0;
    font-family: 'Outfit', sans-serif;
}

.kpi-footer {
    font-size: 11px;
}

.kpi-trend {
    font-weight: 600;
}

.kpi-trend.positive { color: var(--success-color); }
.kpi-trend.negative { color: var(--danger-color); }
.kpi-subtext { color: var(--text-muted); }

/* Dashboard layout grid */
.dashboard-panels {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

.panel-left {
    display: flex;
    flex-direction: column;
}

/* UI Form Controls & Buttons */
.form-control {
    display: block;
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    font-family: var(--font-sans);
    color: var(--text-main);
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    outline: none;
    transition: border-color 0.2s;
}

.form-control:focus {
    border-color: var(--primary-color);
}

.form-control-inline {
    padding: 8px 12px;
    font-size: 14px;
    font-family: var(--font-sans);
    color: var(--text-main);
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    outline: none;
    cursor: pointer;
}

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

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 6px;
}

.filter-bar {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    background-color: var(--bg-color);
    padding: 12px;
    border-radius: var(--radius-sm);
}

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

.filter-group label {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.filter-group select, .filter-group input {
    min-width: 150px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font-sans);
    border-radius: var(--radius-sm);
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s;
    outline: none;
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn-primary {
    background: var(--primary-gradient);
    color: #ffffff;
}

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

.btn-success {
    background-color: var(--success-color);
    color: #ffffff;
}

.btn-success:hover {
    background-color: #059669;
}

.btn-warning {
    background-color: var(--warning-color);
    color: #ffffff;
}

.btn-warning:hover {
    background-color: #d97706;
}

.btn-danger {
    background-color: var(--danger-color);
    color: #ffffff;
}

.btn-danger:hover {
    background-color: #dc2626;
}

.btn-info {
    background-color: var(--info-color);
    color: #ffffff;
}

.btn-info:hover {
    background-color: #0891b2;
}

.btn-outline {
    background-color: transparent;
    border-color: var(--border-color);
    color: var(--text-main);
}

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

.btn-danger-outline {
    background-color: transparent;
    border-color: var(--danger-color);
    color: var(--danger-color);
}

.btn-danger-outline:hover {
    background-color: rgba(239, 68, 68, 0.05);
}

.btn-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-xs {
    padding: 4px 8px;
    font-size: 11px;
}

/* Room Grid Preview map */
.room-grid-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 10px;
}

.room-grid-box {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 13px;
    border-radius: var(--radius-sm);
    color: #ffffff;
    cursor: pointer;
    position: relative;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s;
}

.room-grid-box:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
}

.room-grid-box span.room-no {
    font-size: 12px;
}

.room-grid-box span.room-tenant {
    font-size: 9px;
    font-weight: 400;
    max-width: 90%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    opacity: 0.9;
}

.room-grid-box.occupied { background-color: var(--primary-color); }
.room-grid-box.available { background-color: var(--success-color); }
.room-grid-box.maintenance { background-color: var(--warning-color); }
.room-grid-box.overdue { background-color: var(--danger-color); }

.room-status-legend {
    display: flex;
    gap: 12px;
    font-size: 12px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.dot.occupied { background-color: var(--primary-color); }
.dot.available { background-color: var(--success-color); }
.dot.maintenance { background-color: var(--warning-color); }
.dot.overdue { background-color: var(--danger-color); }

/* Table design style */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
    font-size: 14px;
    text-align: left;
}

.table th, .table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    font-weight: 600;
    color: var(--text-muted);
    background-color: rgba(0, 0, 0, 0.02);
}

[data-theme="dark"] .table th {
    background-color: rgba(255, 255, 255, 0.02);
}

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

.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(0, 0, 0, 0.01);
}

[data-theme="dark"] .table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(255, 255, 255, 0.01);
}

.table-bordered th, .table-bordered td {
    border: 1px solid var(--border-color);
}

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-danger { color: var(--danger-color); }
.text-success { color: var(--success-color); }
.text-warning { color: var(--warning-color); }
.text-primary { color: var(--primary-color); }
.text-muted { color: var(--text-muted); }

/* Billing & Payment Status Badges */
.status-pill {
    display: inline-flex;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 12px;
}

.status-pill.unpaid { background-color: rgba(245, 158, 11, 0.1); color: var(--warning-color); }
.status-pill.paid { background-color: rgba(16, 185, 129, 0.1); color: var(--success-color); }
.status-pill.overdue { background-color: rgba(239, 68, 68, 0.1); color: var(--danger-color); }
.status-pill.partial { background-color: rgba(6, 182, 212, 0.1); color: var(--info-color); }

.status-pill.active { background-color: rgba(16, 185, 129, 0.1); color: var(--success-color); }
.status-pill.inactive { background-color: rgba(100, 116, 139, 0.1); color: var(--text-muted); }
.status-pill.available { background-color: rgba(16, 185, 129, 0.1); color: var(--success-color); }
.status-pill.occupied { background-color: rgba(99, 102, 241, 0.1); color: var(--primary-color); }
.status-pill.maintenance { background-color: rgba(245, 158, 11, 0.1); color: var(--warning-color); }

/* Dialog Modal Styling */
.modal-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 100;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease-out;
}

.modal-backdrop.show {
    display: flex;
    opacity: 1;
}

.modal-dialog {
    background-color: var(--surface-color);
    border-radius: var(--radius-md);
    width: 100%;
    max-width: 500px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    transform: scale(0.95);
    transition: transform 0.2s ease-out;
}

.modal-backdrop.show .modal-dialog {
    transform: scale(1);
}

.modal-lg {
    max-width: 800px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.modal-close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted);
}

.modal-body {
    padding: 24px;
    max-height: 70vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Tabs styles in Reports */
.tab-container {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
    gap: 8px;
}

.tab-btn {
    padding: 10px 20px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-weight: 600;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

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

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Simulated upload container */
.simulated-upload-box {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-sm);
    padding: 20px;
    text-align: center;
    cursor: pointer;
    background-color: rgba(0, 0, 0, 0.01);
    transition: background-color 0.2s;
}

.simulated-upload-box:hover {
    background-color: rgba(99, 102, 241, 0.02);
}

.simulated-upload-box p {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 8px;
}

/* LINE chat notification simulator box */
.line-chat-simulator {
    background-color: #8c9bb0;
    border-radius: var(--radius-md);
    width: 100%;
    max-width: 350px;
    margin: 0 auto;
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.line-chat-header {
    background-color: #24292e;
    color: #ffffff;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.line-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.line-title {
    font-size: 13px;
    font-weight: 600;
}

.line-chat-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    min-height: 250px;
}

.line-message-bubble {
    background-color: #ffffff;
    border-radius: 12px;
    padding: 12px;
    max-width: 90%;
    align-self: flex-start;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    position: relative;
}

.line-message-bubble::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 10px;
    width: 0;
    height: 0;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-right: 6px solid #ffffff;
}

.line-message-text {
    font-size: 12px;
    white-space: pre-wrap;
    color: #000000;
}

.line-message-liff-btn {
    margin-top: 10px;
    border-top: 1px solid #e2e8f0;
    padding-top: 8px;
    color: #06c755; /* LINE Green */
    font-weight: bold;
    font-size: 11px;
    text-align: center;
    cursor: pointer;
}

/* Tenant Portal Frame */
.tenant-mobile-frame {
    width: 375px;
    height: 750px;
    background-color: #000000;
    border-radius: 40px;
    border: 12px solid #334155;
    margin: 0 auto;
    position: relative;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.mobile-notch {
    width: 140px;
    height: 18px;
    background-color: #334155;
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 0 0 15px 15px;
    z-index: 10;
}

.mobile-screen-header {
    height: 50px;
    background-color: #1e293b;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px 0 20px;
    font-size: 14px;
    font-weight: 600;
    border-bottom: 1px solid #334155;
}

.mobile-back-btn {
    cursor: pointer;
    font-size: 12px;
    opacity: 0.8;
}

.mobile-screen-content {
    flex: 1;
    background-color: #f1f5f9;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    color: #0f172a;
}

.tenant-welcome {
    text-align: center;
    margin-top: 60px;
}

.tenant-welcome h2 {
    font-size: 20px;
    margin-top: 16px;
}

.tenant-welcome p {
    font-size: 12px;
    color: #64748b;
    margin-top: 8px;
}

.tenant-section {
    width: 100%;
}

.tenant-profile-header {
    display: flex;
    align-items: center;
    gap: 12px;
    background-color: #ffffff;
    padding: 12px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.tenant-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: rgba(99, 102, 241, 0.1);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.tenant-profile-info h4 {
    font-size: 14px;
    font-weight: bold;
}

.tenant-profile-info p {
    font-size: 11px;
    color: #64748b;
}

.tenant-bill-card {
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    color: #ffffff;
    padding: 18px;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    position: relative;
    box-shadow: var(--shadow-md);
}

.tenant-bill-card .card-title {
    font-size: 12px;
    opacity: 0.8;
}

.bill-status-tag {
    position: absolute;
    top: 18px;
    right: 18px;
    font-size: 11px;
    font-weight: bold;
    padding: 2px 8px;
    border-radius: 10px;
}

.bill-status-tag.unpaid { background-color: var(--warning-color); color: #000; }
.bill-status-tag.paid { background-color: var(--success-color); color: #fff; }
.bill-status-tag.overdue { background-color: var(--danger-color); color: #fff; }

.bill-details-list {
    margin-top: 16px;
}

.bill-detail-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    margin-bottom: 6px;
}

.bill-detail-row span {
    opacity: 0.8;
}

.tenant-hr {
    border: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin: 12px 0;
}

.bill-detail-row.grand-total {
    font-size: 15px;
    font-weight: bold;
}

.bill-detail-row.grand-total span {
    opacity: 1;
}

.due-warning-alert {
    background-color: #fffbeb;
    border: 1px solid #fef3c7;
    color: #b45309;
    padding: 10px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.tenant-action-card {
    background-color: #ffffff;
    border-radius: var(--radius-md);
    padding: 16px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.tenant-action-card h3 {
    font-size: 13px;
    font-weight: bold;
    margin-bottom: 12px;
}

.bank-transfer-info {
    font-size: 12px;
    background-color: #f8fafc;
    padding: 10px;
    border-radius: var(--radius-sm);
}

.copy-btn {
    cursor: pointer;
}

.qr-code-area {
    text-align: center;
    margin-top: 16px;
}

.qr-code-img-wrapper {
    width: 140px;
    height: 140px;
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    margin: 10px auto;
    padding: 5px;
    border-radius: 8px;
}

.qr-code-img-wrapper img {
    width: 100%;
    height: 100%;
}

.qr-amount-tag {
    background-color: #f1f5f9;
    padding: 4px 10px;
    font-size: 11px;
    border-radius: 12px;
}

.tenant-history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    font-size: 12px;
}

.history-left h5 {
    font-weight: bold;
}

.history-left p {
    font-size: 10px;
    color: #64748b;
}

/* Toast alert system styling */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background-color: #1e293b;
    color: #ffffff;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 200;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

/* Utilities helpers */
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; }
.mr-2 { margin-right: 8px; }
.grid-2-cols {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}
.text-center { text-align: center; }
.w-full { width: 100%; }

/* PA HOME BILL STYLES (MATCHES SAMPLE IMAGE PRINT) */
.bill-print-template {
    font-family: 'Sarabun', sans-serif;
    color: #000000;
    background-color: #ffffff;
    padding: 30px;
    border: 1px solid #cbd5e1;
    line-height: 1.4;
    font-size: 13px;
}

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

.bill-apt-name {
    font-size: 16px;
    font-weight: bold;
}

.bill-apt-addr {
    font-size: 12px;
    color: #334155;
    margin-top: 4px;
}

.bill-contact-info, .bill-promptpay-info {
    font-size: 12px;
    margin-top: 2px;
}

.bill-main-title {
    font-size: 20px;
    font-weight: bold;
    border: 1px solid #000;
    padding: 4px 20px;
    display: inline-block;
    letter-spacing: 2px;
    text-align: center;
    margin-bottom: 8px;
}

.bill-sub-header-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.bill-sub-header-table th, .bill-sub-header-table td {
    border: 1px solid #000;
    padding: 3px 6px;
    text-align: left;
}

.bill-sub-header-table th {
    background-color: #f1f5f9;
    font-weight: bold;
}

.bill-red-alert {
    color: #dc2626;
    font-weight: bold;
    font-size: 12px;
}

.bill-tenant-row {
    font-size: 13px;
    border: 1px solid #000;
    padding: 4px 10px;
    background-color: #f8fafc;
}

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

.bill-detail-table th, .bill-detail-table td {
    border: 1px solid #000;
    padding: 6px 10px;
}

.bill-detail-table th {
    background-color: #f1f5f9;
    font-weight: bold;
}

.bill-detail-table tr.subtotal-row td {
    font-weight: bold;
    background-color: #f8fafc;
}

.bill-detail-table tr.grand-total-row td {
    font-weight: bold;
    background-color: #f1f5f9;
}

.thai-baht-text {
    font-style: italic;
    font-size: 13px;
}

.highlight-text {
    color: #dc2626;
    font-weight: bold;
}

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

/* Report grid style */
.table-summary th {
    font-size: 12px;
    white-space: nowrap;
}

.table-summary td {
    font-size: 12px;
}

.bg-total {
    background-color: rgba(99, 102, 241, 0.08);
    font-weight: bold;
}

/* PRINT CSS MEDIA QUERY */
@media print {
    body * {
        visibility: hidden;
    }
    
    .modal-backdrop.show, .modal-backdrop.show .modal-dialog, #bill-print-area, #bill-print-area * {
        visibility: visible;
    }
    
    .modal-backdrop {
        position: absolute;
        left: 0;
        top: 0;
        background-color: #fff;
        display: block !important;
        opacity: 1 !important;
    }
    
    .modal-dialog {
        max-width: 100% !important;
        width: 100% !important;
        box-shadow: none !important;
        border: none !important;
        transform: none !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .modal-body {
        max-height: none !important;
        overflow-y: visible !important;
        padding: 0 !important;
    }
    
    #bill-print-area {
        position: absolute;
        left: 0;
        top: 0;
        width: 100% !important;
        border: none !important;
        padding: 0 !important;
    }
    
    .no-print {
        display: none !important;
    }
}

/* ==========================================
   SECURE LOGIN PAGE STYLING
   ========================================== */
.login-screen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at center, var(--card-bg) 0%, var(--bg-color) 100%);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 99999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.login-screen-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.login-card {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 420px;
    padding: 32px;
    box-sizing: border-box;
    animation: loginBounce 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes loginBounce {
    0% {
        transform: scale(0.9) translateY(20px);
        opacity: 0;
    }
    100% {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.login-header {
    text-align: center;
    margin-bottom: 24px;
}

.login-logo {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 64px;
    height: 64px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    color: #ffffff;
    font-size: 32px;
    margin-bottom: 16px;
    box-shadow: 0 8px 16px rgba(99, 102, 241, 0.2);
}

.login-header h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 24px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 4px;
}

.login-header p {
    font-size: 13px;
    color: var(--text-muted);
}

.login-error-msg {
    background-color: rgba(239, 68, 68, 0.1);
    border-left: 3px solid var(--danger-color);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    margin-top: 12px;
}

