/* =============================================
   HealthChat CRM — Premium Light Professional Theme
   WhatsApp Healthcare Automation Admin Panel
   ============================================= */

/* ---- CSS Variables / Design Tokens ---- */
:root {
    /* Background layers — Clean Light */
    --bg-body: #f0f2f5;
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --bg-input: #f4f6f8;
    --bg-hover: #f0f3f7;
    --bg-active: #e8ecf4;
    --bg-surface: #fafbfc;

    /* Text — High Contrast */
    --text-primary: #1a1d26;
    --text-secondary: #4a5568;
    --text-muted: #8895a7;
    --text-white: #1a1d26;

    /* Accent Colors — Premium Indigo */
    --primary: #5b5fc7;
    --primary-hover: #4a4eb8;
    --primary-glow: rgba(91, 95, 199, 0.1);
    --primary-rgb: 91, 95, 199;

    --success: #0d9f6e;
    --success-bg: rgba(13, 159, 110, 0.08);
    --warning: #e8890c;
    --warning-bg: rgba(232, 137, 12, 0.08);
    --danger: #dc3545;
    --danger-bg: rgba(220, 53, 69, 0.08);
    --info: #2f80ed;
    --info-bg: rgba(47, 128, 237, 0.08);
    --purple: #7c3aed;
    --purple-bg: rgba(124, 58, 237, 0.08);
    --teal: #0891b2;
    --teal-bg: rgba(8, 145, 178, 0.08);
    --emerald: #059669;
    --emerald-bg: rgba(5, 150, 105, 0.08);

    /* Borders — Subtle */
    --border: #e2e8f0;
    --border-light: #edf2f7;

    /* Sizing */
    --sidebar-width: 250px;
    --sidebar-collapsed: 70px;
    --topbar-height: 60px;
    --radius: 10px;
    --radius-sm: 6px;
    --radius-lg: 16px;

    /* Shadows — Soft & Professional */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.07);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.08);
    --shadow-glow: 0 0 20px rgba(91,95,199,0.1);

    /* Transitions */
    --transition: all 0.2s ease;
    --transition-slow: all 0.3s ease;
}

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary-hover); }

h1, h2, h3, h4 { font-weight: 600; line-height: 1.3; color: var(--text-white); }

code {
    background: var(--bg-input);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85em;
    color: var(--primary-hover);
}

/* ---- App Layout ---- */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    box-shadow: 2px 0 8px rgba(0,0,0,0.04);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: var(--transition-slow);
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.2rem;
    border-bottom: 1px solid var(--border);
    height: var(--topbar-height);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.logo-icon {
    color: var(--primary);
    font-size: 1.8rem;
}

.logo-text {
    font-weight: 700;
    font-size: 1.15rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    display: none;
}

.sidebar-toggle:hover { background: var(--bg-hover); color: var(--text-primary); }

.sidebar-nav {
    flex: 1;
    padding: 0.8rem 0.6rem;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.8rem;
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
    margin-bottom: 2px;
    position: relative;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--primary-glow);
    color: var(--primary);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--primary);
    border-radius: 0 3px 3px 0;
}

.nav-item .material-icons-round { font-size: 1.25rem; }

.nav-badge {
    background: var(--danger);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    margin-left: auto;
    min-width: 20px;
    text-align: center;
}

.nav-divider {
    height: 1px;
    background: var(--border);
    margin: 0.8rem 0.8rem;
}

.sidebar-footer {
    padding: 0.8rem;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex: 1;
    min-width: 0;
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--purple));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.user-details { min-width: 0; }
.user-name { display: block; font-size: 0.8rem; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { display: block; font-size: 0.7rem; color: var(--text-muted); }

.logout-btn { padding: 0.4rem !important; }

/* ---- Main Content ---- */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: var(--transition-slow);
}

/* ---- Top Bar ---- */
.topbar {
    height: var(--topbar-height);
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(12px);
}

.topbar-left { display: flex; align-items: center; gap: 1rem; }
.page-title { font-size: 1.15rem; font-weight: 600; }
.business-name { font-size: 0.85rem; color: var(--text-muted); }
.mobile-menu-btn { display: none; background: none; border: none; color: var(--text-secondary); cursor: pointer; padding: 4px; }

/* ---- Page Content ---- */
.page-content { padding: 1.5rem; flex: 1; }

/* ---- Cards ---- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 1.5rem;
    transition: var(--transition);
}

.card:hover { box-shadow: var(--shadow-sm); }

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.card-header h3 { font-size: 0.95rem; font-weight: 600; }
.card-body { padding: 1.25rem; }

/* ---- Stats Grid ---- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.stat-primary .stat-icon { background: var(--primary-glow); color: var(--primary); }
.stat-success .stat-icon { background: var(--success-bg); color: var(--success); }
.stat-warning .stat-icon { background: var(--warning-bg); color: var(--warning); }
.stat-info .stat-icon { background: var(--info-bg); color: var(--info); }
.stat-purple .stat-icon { background: var(--purple-bg); color: var(--purple); }
.stat-teal .stat-icon { background: var(--teal-bg); color: var(--teal); }
.stat-emerald .stat-icon { background: var(--emerald-bg); color: var(--emerald); }
.stat-danger .stat-icon { background: var(--danger-bg); color: var(--danger); }

.stat-info span { display: block; }
.stat-value { font-size: 1.5rem; font-weight: 700; color: var(--text-white); line-height: 1.2; }
.stat-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }

/* ---- Dashboard Grid ---- */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: 1.5rem;
}

/* ---- Tables ---- */
.table-responsive { overflow-x: auto; }

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.table thead th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.table tbody td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
    vertical-align: middle;
}

.table tbody tr { transition: var(--transition); }
.table tbody tr:hover { background: var(--bg-hover); }
.table tbody tr:last-child td { border-bottom: none; }

.total-row td { font-weight: 600; color: var(--text-white) !important; border-top: 1px solid var(--border-light); }

.link { color: var(--primary); font-weight: 500; }
.link:hover { color: var(--primary-hover); text-decoration: underline; }

/* ---- Badges ---- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-primary { background: var(--primary-glow); color: var(--primary-hover); }
.badge-secondary { background: rgba(107,114,128,0.15); color: #9ca3af; }
.badge-purple { background: var(--purple-bg); color: var(--purple); }
.badge-emerald { background: var(--emerald-bg); color: var(--emerald); }

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 1.1rem;
    border: none;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn .material-icons-round { font-size: 1.1rem; }

.btn-primary {
    background: var(--primary);
    color: white;
}
.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: var(--shadow-glow);
    color: white;
    transform: translateY(-1px);
}

.btn-success { background: var(--success); color: white; }
.btn-success:hover { opacity: 0.9; color: white; }
.btn-warning { background: var(--warning); color: #1a1a1a; }
.btn-warning:hover { opacity: 0.9; color: #1a1a1a; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { opacity: 0.9; color: white; }

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-light);
}

.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.8rem; }
.btn-sm .material-icons-round { font-size: 0.95rem; }
.btn-full { width: 100%; justify-content: center; }

.action-btns { display: flex; gap: 0.25rem; }

/* ---- Forms ---- */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="url"],
input[type="number"],
input[type="time"],
input[type="date"],
input[type="file"],
textarea,
.form-select {
    width: 100%;
    padding: 0.6rem 0.85rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    transition: var(--transition);
    outline: none;
}

input:focus, textarea:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

input::placeholder, textarea::placeholder { color: var(--text-muted); }

textarea { resize: vertical; min-height: 80px; }

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%234a5568'%3E%3Cpath d='M7 10l5 5 5-5H7z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 1.5rem;
    padding-right: 2rem;
}

.form-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.flex-1 { flex: 1; min-width: 150px; }
.flex-2 { flex: 2; min-width: 200px; }

.input-icon {
    position: relative;
}

.input-icon .material-icons-round {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.1rem;
    color: var(--text-muted);
    pointer-events: none;
}

.input-icon input {
    padding-left: 2.5rem;
}

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.88rem;
    color: var(--text-secondary);
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

/* ---- Page Header ---- */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.page-header-left { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }

.search-inline {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.search-inline .input-icon { min-width: 220px; }
.search-inline .form-select { min-width: 160px; padding: 0.55rem 2rem 0.55rem 0.75rem; }

/* ---- Alerts ---- */
.alert {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius);
    margin: 0 1.5rem 1rem;
    font-size: 0.88rem;
    animation: slideDown 0.3s ease;
}

.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid rgba(16,185,129,0.2); }
.alert-error { background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(239,68,68,0.2); }

.alert-close {
    margin-left: auto;
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 1.2rem;
    opacity: 0.7;
}
.alert-close:hover { opacity: 1; }

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---- Empty State ---- */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.empty-state .material-icons-round { font-size: 3rem; opacity: 0.3; margin-bottom: 0.5rem; display: block; }
.empty-state h3 { color: var(--text-secondary); font-size: 1.1rem; margin-bottom: 0.5rem; }
.empty-state p { font-size: 0.88rem; margin-bottom: 1rem; }

/* ---- Pagination ---- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1rem 0 0;
    border-top: 1px solid var(--border);
    margin-top: 1rem;
}

.pagination-info { font-size: 0.82rem; color: var(--text-muted); }

/* ---- Conversation List (Dashboard mini) ---- */
.conversation-list-mini { }

.conversation-item-mini {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.5rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
    transition: var(--transition);
    text-decoration: none;
}
.conversation-item-mini:hover { background: var(--bg-hover); color: var(--text-primary); }
.conversation-item-mini:last-child { border-bottom: none; }

.conv-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #a855f7);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
    flex-shrink: 0;
    text-transform: uppercase;
}

.conv-info { flex: 1; min-width: 0; }
.conv-name { font-weight: 500; font-size: 0.88rem; color: var(--text-primary); display: flex; align-items: center; gap: 0.5rem; }
.conv-preview { font-size: 0.8rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-time { font-size: 0.72rem; color: var(--text-muted); flex-shrink: 0; }

.conv-entry { padding: 0.5rem 0; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.conv-entry:last-child { border-bottom: none; }

/* ---- Prices ---- */
.price-original { text-decoration: line-through; color: var(--text-muted); font-size: 0.85rem; margin-right: 0.5rem; }
.price-discount { color: var(--success); font-weight: 600; }

/* ---- Text Utilities ---- */
.text-muted { color: var(--text-muted) !important; }
.text-danger { color: var(--danger) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }

/* ---- Info Box ---- */
.info-box {
    background: var(--info-bg);
    border: 1px solid rgba(59,130,246,0.2);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    margin: 1rem 0;
    font-size: 0.85rem;
    color: var(--info);
}
.info-box code { background: rgba(59,130,246,0.15); color: var(--info); word-break: break-all; }

/* ---- Customer Profile ---- */
.profile-grid {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 1.5rem;
    align-items: start;
}

.profile-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--purple));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0 auto 1rem;
    text-transform: uppercase;
}

.profile-stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin: 1.5rem 0;
    padding: 1rem 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}
.profile-stats div { text-align: center; }
.profile-stats strong { display: block; font-size: 1.2rem; color: var(--text-white); }
.profile-stats span { font-size: 0.75rem; color: var(--text-muted); }

.customer-cell { display: flex; align-items: center; gap: 0.6rem; }

/* ---- Booking Detail ---- */
.booking-detail-grid {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 1.5rem;
    align-items: start;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.detail-item { }
.detail-label { display: block; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin-bottom: 2px; }
.detail-value { font-size: 0.9rem; color: var(--text-primary); font-weight: 500; }

.payment-entry { padding: 0.6rem 0; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 0.25rem; }
.payment-entry:last-child { border-bottom: none; }

/* ---- Settings ---- */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
    align-items: start;
}

/* ---- INBOX LAYOUT ---- */
.inbox-layout {
    display: grid;
    grid-template-columns: 300px 1fr 260px;
    gap: 0;
    height: calc(100vh - var(--topbar-height) - 3rem);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.inbox-sidebar {
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.inbox-filters {
    display: flex; gap: 0.35rem; padding: 0.75rem 0.6rem;
    border-bottom: 1px solid var(--border); overflow-x: auto; flex-shrink: 0;
}
.filter-pill, .filter-btn {
    padding: 0.38rem 0.85rem; border-radius: 20px; font-size: 0.75rem; font-weight: 500;
    color: var(--text-muted); white-space: nowrap; transition: var(--transition);
    text-decoration: none; border: 1px solid var(--border); background: transparent;
}
.filter-pill:hover, .filter-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.filter-pill.active, .filter-btn.active { background: var(--primary); color: white; border-color: var(--primary); }

.conversation-list { flex: 1; overflow-y: auto; }
.conversation-item {
    display: flex; gap: 0.6rem; padding: 0.7rem 0.8rem;
    border-bottom: 1px solid var(--border-light); cursor: pointer;
    transition: var(--transition); text-decoration: none; color: inherit;
}
.conversation-item:hover { background: #f0f3f7; }
.conversation-item.active { background: #e8ecf4; border-left: 3px solid var(--primary); }

.conv-content { flex: 1; min-width: 0; }
.conv-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2px; }
.conv-bottom { display: flex; justify-content: space-between; align-items: center; }
.conv-badges { margin-top: 4px; display: flex; gap: 4px; flex-wrap: wrap; }
.conv-unread-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); flex-shrink: 0; }
.conv-badge { font-size: 0.6rem; font-weight: 600; padding: 1px 8px; border-radius: 10px; }
.conv-badge-ai { background: #e6f7ef; color: #0d9f6e; }
.conv-badge-paused { background: #fef3cd; color: #e8890c; }
.conv-badge-agent { background: #e8ecf4; color: var(--primary); }
.unread-badge { background: var(--primary); color: white; font-size: 0.65rem; font-weight: 700; width: 20px; height: 20px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* Chat Area */
.inbox-chat { display: flex; flex-direction: column; overflow: hidden; }
.chat-header { display: flex; align-items: center; justify-content: space-between; padding: 0.7rem 1rem; border-bottom: 1px solid var(--border); flex-shrink: 0; background: #fff; }
.chat-header-info { display: flex; align-items: center; gap: 0.6rem; }
.chat-header-actions { display: flex; gap: 0.4rem; align-items: center; }

.chat-ai-badge { display: inline-flex; align-items: center; gap: 4px; padding: 5px 12px; border-radius: 20px; font-size: 0.72rem; font-weight: 600; border: none; cursor: pointer; transition: var(--transition); }
.chat-ai-badge.ai-active { background: #e6f7ef; color: #0d9f6e; }
.chat-ai-badge.ai-active:hover { background: #ccf0de; }
.chat-ai-badge.ai-paused { background: #fef3cd; color: #e8890c; }
.chat-ai-badge.ai-paused:hover { background: #fde68a; }

.chat-more-menu { position: relative; }
.chat-dropdown { display: none; position: absolute; right: 0; top: 100%; margin-top: 4px; background: white; border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-md); min-width: 180px; z-index: 50; overflow: hidden; }
.chat-dropdown.show { display: block; }
.dropdown-item { display: flex; align-items: center; gap: 8px; padding: 0.6rem 1rem; font-size: 0.82rem; color: var(--text-primary); text-decoration: none; transition: var(--transition); }
.dropdown-item:hover { background: var(--bg-hover); }
.dropdown-item .material-icons-round { font-size: 18px; color: var(--text-muted); }

.btn-icon { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 0.4rem; border-radius: 50%; transition: var(--transition); display: flex; align-items: center; }
.btn-icon:hover { color: var(--primary); background: var(--bg-hover); }
.btn-icon .material-icons-round { font-size: 22px; }

.chat-messages { flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: 0.5rem; background: #e8e0d8; background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23d5cdc4' fill-opacity='0.3'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E"); }

.message { display: flex; max-width: 75%; }
.message-incoming { align-self: flex-start; }
.message-outgoing { align-self: flex-end; }
.message-bubble { padding: 0.55rem 0.8rem; border-radius: 12px; font-size: 0.88rem; line-height: 1.5; }
.message-incoming .message-bubble { background: #ffffff; border-bottom-left-radius: 4px; color: var(--text-primary); box-shadow: 0 1px 2px rgba(0,0,0,0.08); }
.message-outgoing .message-bubble { background: linear-gradient(135deg, #5b5fc7, #7c3aed); color: white; border-bottom-right-radius: 4px; box-shadow: 0 1px 3px rgba(91,95,199,0.25); }
.message-sender { display: block; font-size: 0.68rem; font-weight: 600; margin-bottom: 2px; opacity: 0.65; }
.message-meta { display: flex; align-items: center; justify-content: flex-end; gap: 4px; margin-top: 2px; }
.message-time { font-size: 0.62rem; opacity: 0.55; }
.message-status { font-size: 0.6rem; opacity: 0.55; }
.message-status.status-read { color: #53bdeb; opacity: 1; }

.chat-date-divider { text-align: center; margin: 0.6rem 0; }
.chat-date-divider span { background: rgba(255,255,255,0.85); color: var(--text-muted); font-size: 0.68rem; padding: 3px 14px; border-radius: 8px; font-weight: 500; box-shadow: 0 1px 2px rgba(0,0,0,0.06); }

.chat-input { padding: 0.6rem 0.8rem; border-top: 1px solid var(--border); flex-shrink: 0; background: #fff; }
.chat-file-form { padding: 0; }
.file-upload-bar { display: flex; align-items: center; gap: 0.4rem; padding: 0.5rem 0.75rem; background: var(--bg-hover); border-radius: 12px; margin-bottom: 0.4rem; }
.file-upload-bar input[type="file"] { flex: 0 0 auto; font-size: 0.78rem; max-width: 180px; }
.file-caption-input { flex: 1; padding: 0.4rem 0.7rem; background: #fff; border: 1px solid var(--border); border-radius: 18px; color: var(--text-primary); font-size: 0.82rem; outline: none; }
.file-caption-input:focus { border-color: var(--primary); }

.chat-form { display: flex; gap: 0.4rem; align-items: center; }
.chat-form input { flex: 1; padding: 0.6rem 1rem; background: var(--bg-input); border: 1px solid var(--border); border-radius: 24px; color: var(--text-primary); font-family: inherit; font-size: 0.88rem; outline: none; }
.chat-form input:focus { border-color: var(--primary); }
.chat-form .btn-send { border-radius: 50%; padding: 0.55rem; min-width: 40px; height: 40px; }

/* Right Panel */
.inbox-customer-panel { border-left: 1px solid var(--border); overflow-y: auto; background: #fafbfc; }
.panel-profile-header { text-align: center; padding: 1.5rem 1rem 1rem; border-bottom: 1px solid var(--border); }
.panel-avatar { width: 64px; height: 64px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), #7c3aed); color: white; display: flex; align-items: center; justify-content: center; font-size: 1.6rem; font-weight: 700; margin: 0 auto 0.5rem; text-transform: uppercase; }
.panel-name { font-size: 1rem; font-weight: 600; margin: 0; color: var(--text-primary); }
.panel-phone { font-size: 0.8rem; color: var(--text-muted); margin: 2px 0 0; }
.panel-email { font-size: 0.72rem; color: var(--text-muted); }
.panel-stats-row { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--border); }
.panel-stat-box { text-align: center; padding: 0.75rem 0.5rem; border-right: 1px solid var(--border); }
.panel-stat-box:last-child { border-right: none; }
.panel-stat-num { display: block; font-weight: 700; font-size: 1rem; color: var(--text-primary); }
.panel-stat-text { display: block; font-size: 0.65rem; color: var(--text-muted); margin-top: 1px; }

.panel-section { padding: 0.75rem 1rem; border-bottom: 1px solid var(--border); }
.panel-section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; }
.panel-section-header h4 { font-size: 0.82rem; font-weight: 600; color: var(--text-primary); margin: 0; }
.panel-section-title { font-size: 0.82rem; font-weight: 600; margin-bottom: 0.4rem; color: var(--text-primary); }
.panel-see-all { font-size: 1.2rem; color: var(--text-muted); text-decoration: none; font-weight: 700; }
.panel-see-all:hover { color: var(--primary); }

.panel-booking-card { display: block; padding: 0.55rem 0.6rem; border-radius: 8px; margin-bottom: 0.4rem; background: #fff; border: 1px solid var(--border-light); text-decoration: none; color: inherit; transition: var(--transition); }
.panel-booking-card:hover { border-color: var(--primary); box-shadow: 0 2px 6px rgba(91,95,199,0.08); }
.panel-booking-row { display: flex; justify-content: space-between; align-items: center; }
.panel-booking-id { font-size: 0.72rem; font-weight: 700; color: var(--primary); }
.panel-booking-detail { font-size: 0.7rem; color: var(--text-muted); margin-top: 1px; }
.panel-booking-price { font-size: 0.7rem; font-weight: 600; color: var(--text-primary); }
.panel-booking-date { font-size: 0.65rem; color: var(--text-muted); }

.panel-view-all { display: block; text-align: center; padding: 0.6rem; font-size: 0.78rem; font-weight: 500; color: var(--primary); border: 1px solid var(--border); border-radius: 8px; margin-top: 0.5rem; text-decoration: none; transition: var(--transition); }
.panel-view-all:hover { background: var(--primary-glow); border-color: var(--primary); }

.panel-addr-card { padding: 0.45rem 0.55rem; border-radius: 6px; margin-bottom: 0.3rem; background: #fff; border: 1px solid var(--border-light); }
.panel-report-card { display: flex; align-items: center; gap: 0.5rem; padding: 0.4rem 0.55rem; border-radius: 6px; margin-bottom: 0.3rem; background: #fff; border: 1px solid var(--border-light); }


/* ---- Auth Pages ---- */
.auth-body {
    background: var(--bg-body);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.auth-container {
    position: relative;
    width: 100%;
    max-width: 420px;
    padding: 2rem;
    z-index: 1;
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    position: relative;
    z-index: 2;
    box-shadow: var(--shadow-lg);
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-logo {
    font-size: 3rem;
    color: var(--primary);
    display: block;
    margin-bottom: 0.5rem;
}

.auth-header h1 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.auth-header p {
    color: var(--text-muted);
    font-size: 0.88rem;
}

.auth-form .form-group { margin-bottom: 1.25rem; }
.auth-form label { font-size: 0.82rem; font-weight: 500; color: var(--text-secondary); margin-bottom: 0.4rem; display: block; }

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}
.auth-footer a { font-size: 0.85rem; color: var(--text-muted); }
.auth-footer a:hover { color: var(--primary); }

/* ---- Auth Background Decoration ---- */
.auth-bg-decoration {
    position: fixed;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.bg-circle {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.15;
}

.bg-circle-1 {
    width: 400px;
    height: 400px;
    background: var(--primary);
    top: -100px;
    right: -100px;
    animation: floatCircle 15s ease-in-out infinite;
}

.bg-circle-2 {
    width: 300px;
    height: 300px;
    background: var(--purple);
    bottom: -50px;
    left: -50px;
    animation: floatCircle 20s ease-in-out infinite reverse;
}

.bg-circle-3 {
    width: 200px;
    height: 200px;
    background: var(--teal);
    top: 50%;
    left: 50%;
    animation: floatCircle 12s ease-in-out infinite;
}

@keyframes floatCircle {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(30px, -20px); }
    50% { transform: translate(-20px, 30px); }
    75% { transform: translate(20px, 20px); }
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ---- Responsive ---- */
@media (max-width: 1024px) {
    .inbox-layout { grid-template-columns: 260px 1fr; }
    .inbox-customer-panel { display: none; }
    .booking-detail-grid { grid-template-columns: 1fr; }
    .profile-grid { grid-template-columns: 1fr; }
    .dashboard-grid { grid-template-columns: 1fr; }
    .settings-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        z-index: 200;
    }
    .sidebar.mobile-open { transform: translateX(0); box-shadow: var(--shadow-lg); }
    .main-content { margin-left: 0; }
    .mobile-menu-btn { display: block; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .inbox-layout { grid-template-columns: 1fr; height: auto; }
    .inbox-sidebar { max-height: 300px; }
    .form-row { flex-direction: column; }
    .page-header { flex-direction: column; align-items: stretch; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .topbar { padding: 0 1rem; }
    .page-content { padding: 1rem; }
}
