/**
 * Water Factory Management System - Stylesheet
 * ສະບັບສະໄຕລ໌ຫຼັກ (Mobile-first Responsive)
 */

/* ================================
   CSS Variables
   ================================ */
:root {
    --primary: #0066cc;
    --primary-dark: #0052a3;
    --primary-light: #e6f0fa;
    --secondary: #6c757d;
    --success: #28a745;
    --danger: #dc3545;
    --warning: #ffc107;
    --info: #17a2b8;
    --light: #f8f9fa;
    --dark: #343a40;
    --white: #ffffff;
    --border: #dee2e6;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.15);
    --radius: 8px;
    --radius-sm: 4px;
    --transition: all 0.3s ease;
    --font-family: 'Segoe UI', 'Lao Sans Pro', 'Phetsarath OT', 'Saysettha OT', sans-serif;
    --header-height: 56px;
    --sidebar-width: 260px;
}

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

body {
    font-family: var(--font-family);
    background-color: #f0f2f5;
    color: var(--dark);
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ================================
   App Container
   ================================ */
.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ================================
   Header
   ================================ */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--white);
    display: flex;
    align-items: center;
    padding: 0 16px;
    z-index: 1000;
    box-shadow: var(--shadow);
}

.menu-toggle {
    background: none;
    border: none;
    color: var(--white);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 8px;
    margin-right: 12px;
    border-radius: var(--radius-sm);
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.menu-toggle:hover {
    background: rgba(255,255,255,0.15);
}

.app-title {
    flex: 1;
    font-size: 1.1rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-menu {
    display: flex;
    align-items: center;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255,255,255,0.3);
}

.user-avatar-placeholder {
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 1rem;
}

/* ================================
   Sidebar
   ================================ */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--white);
    z-index: 1100;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.sidebar.active {
    transform: translateX(0);
}

.sidebar-header {
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--white);
}

.logo {
    display: flex;
    align-items: center;
    font-size: 1.1rem;
    font-weight: 700;
    gap: 10px;
}

.logo i {
    font-size: 1.5rem;
}

.sidebar-close {
    background: none;
    border: none;
    color: var(--white);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-close:hover {
    background: rgba(255,255,255,0.15);
}

.sidebar-user {
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border);
    background: var(--primary-light);
}

.sidebar-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.sidebar-avatar-placeholder {
    background: var(--primary);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.sidebar-user-name {
    font-weight: 600;
    color: var(--dark);
    font-size: 0.95rem;
}

.sidebar-user-role {
    font-size: 0.8rem;
    color: var(--secondary);
}

.sidebar-nav {
    flex: 1;
    padding: 8px 0;
}

.sidebar-nav ul {
    list-style: none;
}

.sidebar-nav li {
    margin: 2px 0;
}

.sidebar-nav .nav-section {
    padding: 12px 16px 4px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--secondary);
}

.sidebar-nav .nav-divider {
    height: 1px;
    background: var(--border);
    margin: 8px 16px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: var(--dark);
    gap: 12px;
    font-size: 0.9rem;
    transition: var(--transition);
    min-height: 44px;
}

.sidebar-nav a:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.sidebar-nav a.active {
    background: var(--primary);
    color: var(--white);
    border-radius: 0;
}

.sidebar-nav a i {
    width: 24px;
    text-align: center;
    font-size: 1rem;
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1050;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* ================================
   Main Content
   ================================ */
.main-content {
    margin-top: var(--header-height);
    padding: 16px;
    min-height: calc(100vh - var(--header-height));
}

/* ================================
   Cards
   ================================ */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 16px;
    overflow: hidden;
}

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

.card-header h2,
.card-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--dark);
}

.card-body {
    padding: 16px;
}

.card-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    background: var(--light);
}

/* ================================
   Forms
   ================================ */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--dark);
}

.form-label .required {
    color: var(--danger);
}

.form-control,
.form-select {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: var(--font-family);
    background: var(--white);
    transition: var(--transition);
    min-height: 44px;
}

.form-control:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0,102,204,0.15);
}

.form-control:disabled,
.form-select:disabled {
    background: #e9ecef;
    opacity: 0.7;
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

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

.form-hint {
    font-size: 0.8rem;
    color: var(--secondary);
    margin-top: 4px;
}

.form-file {
    position: relative;
}

.form-file input[type="file"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.form-file-label {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    background: var(--light);
    color: var(--secondary);
    cursor: pointer;
    transition: var(--transition);
    gap: 8px;
    min-height: 100px;
}

.form-file-label:hover {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
}

.form-file-label i {
    font-size: 1.5rem;
}

/* ================================
   Buttons
   ================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 500;
    font-family: var(--font-family);
    cursor: pointer;
    transition: var(--transition);
    gap: 8px;
    min-height: 44px;
    text-align: center;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

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

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

.btn-secondary {
    background: var(--secondary);
    color: var(--white);
}

.btn-secondary:hover:not(:disabled) {
    background: #545b62;
}

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

.btn-success:hover:not(:disabled) {
    background: #218838;
}

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

.btn-danger:hover:not(:disabled) {
    background: #c82333;
}

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

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

.btn-light {
    background: var(--light);
    color: var(--dark);
    border: 1px solid var(--border);
}

.btn-sm {
    padding: 8px 14px;
    font-size: 0.85rem;
    min-height: 36px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 1.05rem;
}

.btn-block {
    width: 100%;
}

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

/* ================================
   Tables
   ================================ */
.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    background: var(--white);
    min-width: 600px;
}

.table th,
.table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.table th {
    background: var(--light);
    font-weight: 600;
    color: var(--dark);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.table tbody tr:hover {
    background: var(--primary-light);
}

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

.table .text-right {
    text-align: right;
}

.table .text-center {
    text-align: center;
}

.table-responsive {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Compact tables for income/expense and admin */
.table-income,
.table-expense,
.table-daily-sales,
.table-admin {
    min-width: auto;
}

.table-income th,
.table-income td,
.table-expense th,
.table-expense td,
.table-daily-sales th,
.table-daily-sales td,
.table-admin th,
.table-admin td {
    white-space: nowrap;
}

@media (max-width: 767px) {
    .table-income,
    .table-expense,
    .table-daily-sales,
    .table-admin {
        font-size: 0.8rem;
    }
    .table-income th,
    .table-income td,
    .table-expense th,
    .table-expense td,
    .table-daily-sales th,
    .table-daily-sales td,
    .table-admin th,
    .table-admin td {
        padding: 8px 10px;
    }
    .table-income th:first-child,
    .table-income td:first-child {
        max-width: 100px;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

/* Card-style table for mobile */
.table-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.table-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px;
    border: 1px solid var(--border);
}

.table-card-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.table-card-row:last-child {
    border-bottom: none;
}

.table-card-label {
    font-weight: 600;
    color: var(--secondary);
    font-size: 0.85rem;
}

.table-card-value {
    color: var(--dark);
}

/* ================================
   Alerts
   ================================ */
.alert {
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border-left: 4px solid var(--success);
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
    border-left: 4px solid var(--danger);
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border-left: 4px solid var(--warning);
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border-left: 4px solid var(--info);
}

/* ================================
   Tabs
   ================================ */
.tabs {
    margin-bottom: 16px;
}

.tab-header {
    display: flex;
    border-bottom: 2px solid var(--border);
    gap: 4px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tab-btn {
    padding: 12px 20px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--secondary);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    white-space: nowrap;
    min-height: 44px;
    font-family: var(--font-family);
}

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

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

.tab-panel {
    display: none;
    padding-top: 16px;
}

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

/* ================================
   Badges
   ================================ */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background: #d4edda;
    color: #155724;
}

.badge-danger {
    background: #f8d7da;
    color: #721c24;
}

.badge-warning {
    background: #fff3cd;
    color: #856404;
}

.badge-info {
    background: #d1ecf1;
    color: #0c5460;
}

.badge-secondary {
    background: #e2e3e5;
    color: #383d41;
}

/* ================================
   Stats Cards
   ================================ */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.stat-icon.blue { background: var(--primary-light); color: var(--primary); }
.stat-icon.green { background: #d4edda; color: var(--success); }
.stat-icon.red { background: #f8d7da; color: var(--danger); }
.stat-icon.orange { background: #fff3cd; color: #856404; }

.stat-info {
    flex: 1;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--secondary);
    margin-bottom: 4px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--dark);
}

.stat-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.stat-row:last-child {
    margin-bottom: 0;
}

.stat-row .stat-label {
    font-size: 0.9rem;
    color: var(--secondary);
    margin-bottom: 0;
}

.stat-row .stat-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--dark);
}

/* ================================
   Login Page
   ================================ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, #004080 100%);
    padding: 16px;
}

.login-box {
    width: 100%;
    max-width: 400px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.login-header {
    padding: 32px 24px 16px;
    text-align: center;
}

.login-logo {
    width: 80px;
    height: 80px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    color: var(--white);
    font-size: 2.5rem;
}

.login-header h1 {
    font-size: 1.4rem;
    color: var(--dark);
    margin-bottom: 4px;
}

.login-header p {
    color: var(--secondary);
    font-size: 0.9rem;
}

.login-body {
    padding: 16px 24px 32px;
}

/* ================================
   Profile Page
   ================================ */
.profile-header {
    text-align: center;
    padding: 24px 16px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--white);
    border-radius: var(--radius) var(--radius) 0 0;
    margin: -16px -16px 16px;
}

.profile-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 4px solid rgba(255,255,255,0.3);
    margin: 0 auto 12px;
    object-fit: cover;
    background: var(--white);
}

.profile-name {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.profile-role {
    opacity: 0.9;
    font-size: 0.9rem;
}

.profile-info-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.profile-info-item {
    display: flex;
    justify-content: space-between;
    padding: 12px;
    background: var(--light);
    border-radius: var(--radius-sm);
}

.profile-info-label {
    color: var(--secondary);
    font-size: 0.85rem;
}

.profile-info-value {
    font-weight: 500;
    color: var(--dark);
}

/* ================================
   Chat
   ================================ */
.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--header-height) - 32px);
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f5f5f5;
}

.chat-message {
    display: flex;
    margin-bottom: 16px;
    max-width: 85%;
}

.chat-message.sent {
    margin-left: auto;
    flex-direction: row-reverse;
}

.chat-message.received {
    margin-right: auto;
}

.chat-bubble {
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 0.95rem;
    word-break: break-word;
}

.chat-message.sent .chat-bubble {
    background: var(--primary);
    color: var(--white);
    border-bottom-right-radius: 4px;
}

.chat-message.received .chat-bubble {
    background: var(--white);
    color: var(--dark);
    border-bottom-left-radius: 4px;
    box-shadow: var(--shadow);
}

.chat-time {
    font-size: 0.7rem;
    opacity: 0.7;
    margin-top: 4px;
    text-align: right;
}

.chat-input-area {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    background: var(--white);
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.chat-input {
    flex: 1;
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 0.95rem;
    resize: none;
    min-height: 44px;
    max-height: 120px;
    font-family: var(--font-family);
}

.chat-input:focus {
    outline: none;
    border-color: var(--primary);
}

.chat-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: var(--primary);
    color: var(--white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.chat-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ================================
   Upload Modal
   ================================ */
.upload-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.upload-modal-content {
    background: var(--white);
    border-radius: var(--radius);
    padding: 40px 32px;
    text-align: center;
    max-width: 320px;
    width: 100%;
    box-shadow: var(--shadow-lg);
}

.upload-spinner {
    width: 56px;
    height: 56px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    margin: 0 auto 20px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.upload-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 16px;
}

.upload-progress-container {
    width: 100%;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.upload-progress-bar {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.3s ease;
}

.upload-percent {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 12px;
}

.upload-warning {
    font-size: 0.8rem;
    color: var(--danger);
}

/* ================================
   Pagination
   ================================ */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 24px;
    padding: 16px;
}

/* ================================
   Empty State
   ================================ */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--secondary);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 1rem;
}

/* ================================
   Status Indicators
   ================================ */
.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 6px;
}

.status-dot.online { background: var(--success); }
.status-dot.offline { background: var(--secondary); }
.status-dot.busy { background: var(--danger); }

/* ================================
   Print Styles
   ================================ */
@media print {
    .app-header,
    .sidebar,
    .sidebar-overlay,
    .menu-toggle,
    .btn-group,
    .pagination {
        display: none !important;
    }
    
    .main-content {
        margin-top: 0;
        padding: 0;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ccc;
    }
}

/* ================================
   Responsive Breakpoints
   ================================ */

/* Tablet (768px+) */
@media (min-width: 768px) {
    :root {
        --header-height: 64px;
    }
    
    .app-title {
        font-size: 1.25rem;
    }
    
    .main-content {
        padding: 24px;
    }
    
    .form-row {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .profile-info-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .chat-message {
        max-width: 70%;
    }
    
    .table-container {
        overflow-x: visible;
    }
    
    .table {
        min-width: auto;
    }
}

/* Desktop (1024px+) */
@media (min-width: 1024px) {
    .menu-toggle,
    .sidebar-close,
    .sidebar-overlay {
        display: none !important;
    }
    
    .sidebar {
        transform: none;
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        box-shadow: none;
        border-right: 1px solid var(--border);
    }
    
    .main-content {
        margin-left: var(--sidebar-width);
    }
    
    .app-header {
        left: var(--sidebar-width);
    }
    
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .form-row {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .form-row.col-2 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .chat-message {
        max-width: 60%;
    }
}

/* Large Desktop (1280px+) */
@media (min-width: 1280px) {
    .main-content {
        max-width: calc(100% - var(--sidebar-width));
    }
}

/* ================================
   Utility Classes
   ================================ */
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: #856404; }
.text-muted { color: var(--secondary); }

.d-none { display: none; }
.d-block { display: block; }
.d-flex { display: flex; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }

.w-100 { width: 100%; }

.font-weight-bold { font-weight: 700; }

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

::-webkit-scrollbar-track {
    background: var(--light);
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* ================================
   PWA Install Button
   ================================ */
.btn-install-pwa {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px 16px;
    background: linear-gradient(135deg, var(--success) 0%, #1e7e34 100%);
    color: var(--white);
    border: none;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 8px;
}

.btn-install-pwa:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-install-pwa.visible {
    display: flex;
}

.login-install-pwa {
    margin-top: 16px;
    background: linear-gradient(135deg, var(--success) 0%, #1e7e34 100%);
}

.install-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(120px);
    background: var(--dark);
    color: var(--white);
    padding: 12px 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 9999;
    transition: transform 0.4s ease;
    max-width: 90vw;
    font-size: 0.95rem;
}

.install-toast.show {
    transform: translateX(-50%) translateY(0);
}

.install-toast button {
    background: var(--primary);
    color: var(--white);
    border: none;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.9rem;
    white-space: nowrap;
}

.install-toast button:hover {
    background: var(--primary-dark);
}
