/* ============================================================
   STYLES.CSS — Hospital Admin Panel Design System
   Color Palette: Indigo + Teal — 2026 Modern Hospital SaaS
   ============================================================ */

/* ---------- IMPORTS ---------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ---------- CSS VARIABLES ---------- */
:root {
    /* Brand - Deep & Professional */
    --primary: #2563EB;
    --primary-light: #60A5FA;
    --primary-dark: #1E40AF;
    /* Reduced bg opacity for "calm" feel */
    --primary-bg: rgba(37, 99, 235, 0.04);
    --primary-bg-hover: rgba(37, 99, 235, 0.08);

    /* Accents - Muted & Purposeful */
    --teal: #059669;
    --teal-light: #34D399;
    --teal-bg: rgba(16, 185, 129, 0.04);

    --amber: #D97706;
    --amber-light: #FBBF24;
    --amber-bg: rgba(245, 158, 11, 0.06);

    --red: #DC2626;
    --red-light: #F87171;
    --red-bg: rgba(220, 38, 38, 0.04);

    --purple: #7C3AED;
    --purple-bg: rgba(124, 58, 237, 0.04);

    /* Surfaces */
    --bg: #F8FAFC;
    --surface: #FFFFFF;
    --surface-hover: #F1F5F9;

    /* Sidebar - Light/Clean/Medical */
    --sidebar-bg: #FFFFFF;
    --sidebar-border: #E2E8F0;
    --sidebar-text: #475569;
    /* Darker slate for better readability */
    --sidebar-text-active: #2563EB;
    --sidebar-bg-active: #EFF6FF;
    --sidebar-bg-hover: #F8FAFC;

    /* Text - High Contrast */
    --text-primary: #0F172A;
    /* Deeper black */
    --text-secondary: #334155;
    /* Darker gray */
    --text-muted: #64748B;
    /* Darker muted */
    --text-inverse: #FFFFFF;

    /* Borders */
    --border: #E2E8F0;
    --border-light: #F1F5F9;

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -1px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -2px rgba(15, 23, 42, 0.04);

    /* Layout */
    --sidebar-width: 260px;
    --sidebar-collapsed: 72px;
    --topbar-height: 64px;

    --radius: 8px;
    --radius-sm: 4px;
    --radius-lg: 12px;
    --radius-full: 9999px;

    /* Transitions */
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    line-height: 1.6;
    overflow: hidden;
    height: 100vh;
}

a {
    text-decoration: none;
    color: inherit;
}

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
}

input,
select,
textarea {
    font-family: inherit;
    font-size: inherit;
}

ul {
    list-style: none;
}

/* ---------- LAYOUT ---------- */
.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ---------- SIDEBAR ---------- */
/* ---------- SIDEBAR (Light/Clean) ---------- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    /* Separator */
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: var(--transition);
    overflow: hidden;
    box-shadow: none;
    /* Removed shadow for flat look */
}

.sidebar-header {
    padding: 20px 22px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 72px;
}

.sidebar-logo {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--primary), var(--teal));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: white;
    font-size: 16px;
    flex-shrink: 0;
    letter-spacing: -0.5px;
}

.sidebar-brand {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-brand h2 {
    color: var(--text-primary);
    font-size: 15px;
    /* Slightly larger */
    font-weight: 800;
    white-space: nowrap;
    letter-spacing: -0.2px;
}

.sidebar-brand span {
    color: var(--text-secondary);
    /* Darker for readability */
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0.8;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
    overflow-x: hidden;
}

.nav-section-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-muted);
    padding: 16px 14px 8px;
    opacity: 0.5;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-radius: var(--radius);
    color: var(--sidebar-text);
    /* Muted slate */
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 2px;
    white-space: nowrap;
    position: relative;
    border-left: 3px solid transparent;
    /* Indicator */
}

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

.nav-item.active {
    background: var(--sidebar-bg-active);
    color: var(--sidebar-text-active);
    border-left-color: var(--sidebar-text-active);
    /* Active indicator */
    box-shadow: none;
}

.nav-item.active::before {
    display: none;
    /* Removed the elaborate glow bar */
}

.nav-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    opacity: 0.7;
}

.nav-item.active svg {
    opacity: 1;
}

.nav-badge {
    margin-left: auto;
    background: var(--red);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: var(--radius-full);
    min-width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 16px 14px;
    border-top: 1px solid var(--sidebar-border);
    display: flex;
    align-items: center;
    gap: 8px;
    background: #F8FAFC;
    /* Slight contrast footer */
    margin-top: auto;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: var(--radius);
    transition: var(--transition);
    flex: 1;
    cursor: default;
    border: 1px solid transparent;
}

.sidebar-user:hover {
    background: white;
    border-color: var(--border);
    box-shadow: var(--shadow-xs);
}

.logout-btn-sidebar {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    color: var(--text-muted);
    transition: var(--transition);
    border: 1px solid transparent;
    cursor: pointer;
    background: transparent;
}

.logout-btn-sidebar:hover {
    background: #FEF2F2;
    /* Soft red bg */
    color: var(--red);
    border-color: #FEE2E2;
}

.logout-btn-sidebar svg {
    width: 18px;
    height: 18px;
}

.user-avatar-sm {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

.sidebar-user-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-user-info strong {
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.sidebar-user-info span {
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0.9;
    /* More visible */
}

/* ---------- MAIN AREA ---------- */
.main-area {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    transition: var(--transition);
}

/* ---------- TOPBAR ---------- */
.topbar {
    height: var(--topbar-height);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.menu-toggle {
    display: none;
    width: 38px;
    height: 38px;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    transition: var(--transition);
}

.menu-toggle:hover {
    background: var(--bg);
}

.topbar-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.role-switcher {
    display: flex;
    align-items: center;
    background: var(--border-light);
    /* Segmented control background */
    border-radius: 8px;
    padding: 4px;
    gap: 0;
    border: 1px solid var(--border);
}

.role-btn {
    padding: 6px 16px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    transition: var(--transition);
    white-space: nowrap;
    flex: 1;
    text-align: center;
}

.role-btn.active {
    background: var(--surface);
    color: var(--text-primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    font-weight: 700;
    transform: scale(1.02);
}

.role-btn:hover:not(.active) {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.5);
}

.topbar-search {
    position: relative;
}

.topbar-search input {
    width: 220px;
    padding: 8px 14px 8px 36px;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    font-size: 13px;
    background: var(--bg);
    transition: var(--transition);
    color: var(--text-primary);
}

.topbar-search input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--surface);
    width: 280px;
    box-shadow: 0 0 0 3px var(--primary-bg);
}

.topbar-search input::placeholder {
    color: var(--text-muted);
}

.topbar-search svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-muted);
}

.topbar-btn {
    position: relative;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    transition: var(--transition);
}

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

.topbar-btn svg {
    width: 20px;
    height: 20px;
}

.notification-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: var(--red);
    border-radius: 50%;
    border: 2px solid var(--surface);
}

/* ---------- CONTENT AREA ---------- */
.content-area {
    flex: 1;
    overflow-y: auto;
    padding: 28px;
    scroll-behavior: smooth;
}

.content-area::-webkit-scrollbar {
    width: 6px;
}

.content-area::-webkit-scrollbar-track {
    background: transparent;
}

.content-area::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 10px;
}

.content-area::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ---------- PAGE HEADER ---------- */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 16px;
}

.page-header-left h1 {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.page-header-left p {
    font-size: 13.5px;
    color: var(--text-secondary);
    margin-top: 2px;
}

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

/* ---------- BUTTONS ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 18px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    transition: var(--transition);
    white-space: nowrap;
    border: none;
    cursor: pointer;
    line-height: 1.4;
}

.btn svg {
    width: 16px;
    height: 16px;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 1px 2px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--surface);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg);
    border-color: var(--text-muted);
}

/* Status Colors - Stronger for light mode */
.s-new {
    background: #DBEAFE;
    /* Blue 100 */
    color: #1E40AF;
    /* Blue 800 */
}

.s-contacted {
    background: #E0E7FF;
    /* Indigo 100 */
    color: #3730A3;
    /* Indigo 800 */
}

.s-appointment-fixed {
    background: #F3E8FF;
    /* Purple 100 */
    color: #6B21A8;
    /* Purple 800 */
}

.s-visited {
    background: #ECFEFF;
    /* Cyan 100 */
    color: #0E7490;
    /* Cyan 800 */
}

.s-surgery-advised {
    background: #FEF3C7;
    /* Amber 100 */
    color: #92400E;
    /* Amber 800 */
}

.s-surgery-completed {
    background: #D1FAE5;
    /* Emerald 100 */
    color: #065F46;
    /* Emerald 800 */
}

.s-follow-up {
    background: #FFEDD5;
    /* Orange 100 */
    color: #9A3412;
    /* Orange 800 */
}

.s-closed {
    background: #F1F5F9;
    /* Slate 100 */
    color: #475569;
    /* Slate 600 */
}

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

.btn-teal:hover {
    background: #059669;
}

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

.btn-amber:hover {
    background: #D97706;
}

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

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

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: 8px 12px;
}

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

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-icon {
    width: 34px;
    height: 34px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
}

/* ---------- CARDS ---------- */
.card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
    border: 1px solid var(--border-light);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-sm);
}

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

.card-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.2px;
}

.card-body {
    padding: 22px;
}

/* ---------- KPI CARDS ---------- */
.kpi-grid {
    display: grid;
    gap: 24px;
    margin-bottom: 28px;
}

.kpi-focus {
    grid-column: 1 / -1;
}

.kpi-focus-card {
    background: #FFFBEB;
    /* Flat soft amber */
    border: 1px solid #FCD34D;
    /* Sharper border */
    border-radius: var(--radius);
    /* Sharper radius */
    padding: 20px 24px;
    /* Reduced height by ~30% */
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.kpi-focus-card:hover {
    border-color: #F59E0B;
    box-shadow: var(--shadow-sm);
}

.kpi-focus-info h3 {
    font-size: 12px;
    font-weight: 700;
    color: #B45309;
    /* Deep amber text */
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.kpi-focus-info .kpi-focus-number {
    font-size: 32px;
    /* Anchor visual */
    font-weight: 800;
    color: #1E293B;
    /* High contrast dark */
    line-height: 1.1;
    letter-spacing: -1px;
}

.kpi-focus-info .kpi-focus-sub {
    font-size: 13px;
    color: #78350F;
    font-weight: 500;
}

.kpi-focus-action .btn {
    background: transparent;
    color: #92400E;
    border: 1px solid #D97706;
    /* Outline style */
    box-shadow: none;
    font-weight: 600;
}

.kpi-focus-action .btn:hover {
    background: #FEF3C7;
    border-color: #B45309;
}

.kpi-secondary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

/* Clean/Minimal KPI Card */
.kpi-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 20px;
    border: 1px solid var(--border);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.kpi-card:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-sm);
}

.kpi-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.kpi-card-icon {
    width: 32px;
    /* Smaller icon */
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.8;
    /* Reduced opacity */
}

.kpi-card-icon svg {
    width: 16px;
    height: 16px;
}

.kpi-card-value {
    font-size: 34px;
    /* Increased from 30px */
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
    margin-top: 4px;
}

.kpi-card-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 600;
}

/* Specific styling for primary metric to "shout" */
.kpi-card.highlight .kpi-card-value {
    color: var(--primary);
}

.kpi-card:not(.highlight) .kpi-card-value {
    color: var(--text-primary);
}

.kpi-card:not(.highlight) .kpi-card-icon {
    background: var(--bg) !important;
    color: var(--text-secondary) !important;
}

/* Hide trends for noise reduction unless critical */
.kpi-card-trend {
    font-size: 11px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* ---------- STATUS PILLS ---------- */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
    letter-spacing: 0.2px;
}

.status-pill::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-new {
    background: var(--primary-bg);
    color: var(--primary);
}

.status-new::before {
    background: var(--primary);
}

.status-contacted {
    background: var(--purple-bg);
    color: var(--purple);
}

.status-contacted::before {
    background: var(--purple);
}

.status-appointment-fixed {
    background: #DBEAFE;
    color: #1E40AF;
}

.status-appointment-fixed::before {
    background: #1E40AF;
}

.status-visited {
    background: var(--teal-bg);
    color: #059669;
}

.status-visited::before {
    background: #059669;
}

.status-surgery-advised {
    background: var(--amber-bg);
    color: #D97706;
}

.status-surgery-advised::before {
    background: #D97706;
}

.status-surgery-completed {
    background: #D1FAE5;
    color: #065F46;
}

.status-surgery-completed::before {
    background: #065F46;
}

.status-follow-up {
    background: #FEF3C7;
    color: #92400E;
}

.status-follow-up::before {
    background: #92400E;
}

.status-closed {
    background: var(--bg);
    color: var(--text-muted);
}

.status-closed::before {
    background: var(--text-muted);
}

/* ---------- TABLES ---------- */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius);
}

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

table th {
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    padding: 12px 16px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

table td {
    padding: 14px 16px;
    font-size: 13.5px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

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

table tr:hover td {
    background: var(--surface-hover);
}

.table-name {
    font-weight: 600;
    color: var(--text-primary);
}

.table-sub {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.table-actions {
    display: flex;
    gap: 6px;
}

/* ---------- FORMS ---------- */
.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
    letter-spacing: 0.1px;
}

.form-label .required {
    color: var(--red);
    margin-left: 2px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13.5px;
    color: var(--text-primary);
    background: var(--surface);
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-bg);
}

.form-control::placeholder {
    color: var(--text-muted);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2364748B' viewBox='0 0 16 16'%3E%3Cpath d='M4.646 5.646a.5.5 0 0 1 .708 0L8 8.293l2.646-2.647a.5.5 0 0 1 .708.708l-3 3a.5.5 0 0 1-.708 0l-3-3a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

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

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

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

/* ---------- MODAL ---------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 620px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: translateY(20px) scale(0.98);
    transition: var(--transition);
}

.modal-overlay.active .modal {
    transform: translateY(0) scale(1);
}

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

.modal-sm {
    max-width: 440px;
}

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

.modal-header h3 {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.2px;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    color: var(--text-muted);
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--bg);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

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

/* ---------- TABS ---------- */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--border-light);
    margin-bottom: 24px;
    gap: 0;
    overflow-x: auto;
}

.tab {
    padding: 12px 20px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    white-space: nowrap;
}

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

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

/* ---------- FILTER BAR ---------- */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-bar .form-control {
    width: auto;
    min-width: 160px;
    padding: 8px 14px;
    font-size: 12.5px;
}

.search-input {
    position: relative;
}

.search-input input {
    padding-left: 36px;
    width: 260px;
}

.search-input svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-muted);
}

/* ---------- DOCTOR WORKLOAD CARDS (Denser) ---------- */
.doctor-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
    /* Tighter gap */
}

.doctor-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    /* Reduced padding */
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.doctor-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.doctor-card-top {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 0;
}

.doctor-avatar {
    width: 36px;
    /* Smaller avatar */
    height: 36px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    color: white;
    flex-shrink: 0;
}

.doctor-card-info h4 {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0;
    margin-bottom: 2px;
}

.doctor-card-info span {
    font-size: 11px;
    color: var(--text-muted);
    /* De-emphasized specialty */
}

.doctor-card-capacity {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg);
    padding: 6px 10px;
    border-radius: 4px;
}

.capacity-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.capacity-indicator.green {
    background: var(--teal);
}

.capacity-indicator.yellow {
    background: var(--amber);
}

.capacity-indicator.red {
    background: var(--red);
}

.capacity-text {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
}

.progress-bar-thin {
    height: 4px;
    background: var(--border);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-top: auto;
}

/* ---------- PATIENT PIPELINE ---------- */
/* ---------- PATIENT PIPELINE (Directional) ---------- */
.pipeline-container {
    display: flex;
    gap: 0;
    /* Connected flow */
    overflow-x: auto;
    padding: 4px 4px 12px 4px;
    scroll-snap-type: x mandatory;
}

.pipeline-stage {
    flex: 1;
    min-width: 140px;
    padding: 16px 24px 16px 32px;
    /* Extra left padding for arrow shape */
    background: var(--surface);
    border-right: 1px solid white;
    cursor: pointer;
    position: relative;
    clip-path: polygon(0% 0%, 90% 0%, 100% 50%, 90% 100%, 0% 100%, 10% 50%);
    margin-left: -18px;
    /* Overlap for arrow effect */
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.05));
    scroll-snap-align: start;
}

.pipeline-stage:first-child {
    clip-path: polygon(0% 0%, 90% 0%, 100% 50%, 90% 100%, 0% 100%);
    margin-left: 0;
    padding-left: 16px;
}

.pipeline-stage:hover {
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
    transform: translateY(-2px);
    z-index: 10;
}

.pipeline-stage-count {
    font-size: 24px;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.pipeline-stage-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

/* Muted Colors - Only Active/Attn stages get color */
.pipeline-stage {
    background: #F8FAFC;
}

.pipeline-stage .pipeline-stage-count {
    color: var(--text-secondary);
}

/* High Attention Stages */
.pipeline-stage.s-surgery-advised {
    background: #FFFBEB;
    z-index: 5;
}

.pipeline-stage.s-surgery-advised .pipeline-stage-count {
    color: #D97706;
}

.pipeline-stage.s-surgery-advised .pipeline-stage-label {
    color: #92400E;
}

.pipeline-stage.s-follow-up {
    background: #FFF7ED;
    z-index: 5;
}

.pipeline-stage.s-follow-up .pipeline-stage-count {
    color: #EA580C;
}

/* Active/Positive Stages */
.pipeline-stage.s-surgery-completed {
    background: #F0FDF4;
}

.pipeline-stage.s-surgery-completed .pipeline-stage-count {
    color: #059669;
}

.pipeline-stage.s-visited {
    background: #F0F9FF;
}

.pipeline-stage.s-visited .pipeline-stage-count {
    color: #0284C7;
}

/* ---------- PROFILE ---------- */
.profile-header {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 28px;
    background: var(--surface);
    border-radius: var(--radius-lg);
    margin-bottom: 24px;
    box-shadow: var(--shadow-xs);
    border: 1px solid var(--border-light);
}

.profile-avatar {
    width: 72px;
    height: 72px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    font-weight: 800;
    color: white;
    flex-shrink: 0;
}

.profile-info h2 {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.profile-meta {
    display: flex;
    gap: 20px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.profile-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}

.profile-meta-item svg {
    width: 15px;
    height: 15px;
    opacity: 0.6;
}

.profile-actions {
    margin-left: auto;
    display: flex;
    gap: 10px;
}

/* ---------- WHATSAPP STYLES ---------- */
.wa-message {
    background: #DCF8C6;
    border-radius: 10px 10px 10px 2px;
    padding: 12px 16px;
    max-width: 500px;
    font-size: 13.5px;
    line-height: 1.5;
    position: relative;
    box-shadow: var(--shadow-xs);
}

.wa-message-time {
    font-size: 10px;
    color: #6B8E5A;
    text-align: right;
    margin-top: 6px;
}

.wa-template-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 12px;
    transition: var(--transition);
}

.wa-template-card:hover {
    border-color: var(--teal);
}

.wa-template-name {
    font-weight: 700;
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.wa-template-body {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.wa-variable {
    background: var(--teal-bg);
    color: var(--teal);
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 12px;
}

/* ---------- CALENDAR / APPOINTMENT GRID ---------- */
.calendar-grid {
    display: grid;
    grid-template-columns: 80px repeat(auto-fit, minmax(200px, 1fr));
    gap: 1px;
    background: var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.calendar-header {
    background: var(--bg);
    padding: 12px 14px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.calendar-time {
    background: var(--surface);
    padding: 14px 10px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    text-align: right;
    border-right: 2px solid var(--border-light);
}

.calendar-cell {
    background: var(--surface);
    padding: 8px;
    min-height: 60px;
    transition: var(--transition);
}

.calendar-cell:hover {
    background: var(--surface-hover);
}

.calendar-appointment {
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 4px;
    cursor: pointer;
    border-left: 3px solid;
    transition: var(--transition);
}

.calendar-appointment:hover {
    transform: scale(1.02);
}

.calendar-appointment.scheduled {
    background: var(--primary-bg);
    border-color: var(--primary);
    color: var(--primary);
}

.calendar-appointment.completed {
    background: var(--teal-bg);
    border-color: var(--teal);
    color: #059669;
}

/* ---------- APPOINTMENT LIST VIEW ---------- */
.appointment-list-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    transition: var(--transition);
}

.appointment-list-item:last-child {
    border-bottom: none;
}

.appointment-list-item:hover {
    background: var(--surface-hover);
}

.appointment-time-block {
    text-align: center;
    padding: 8px 14px;
    background: var(--bg);
    border-radius: var(--radius);
    min-width: 70px;
}

.appointment-time-block .time {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.appointment-time-block .period {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* ---------- EMPTY STATE ---------- */
.empty-state {
    text-align: center;
    padding: 60px 40px;
    color: var(--text-muted);
}

.empty-state svg {
    width: 64px;
    height: 64px;
    opacity: 0.3;
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.empty-state p {
    font-size: 13px;
    max-width: 320px;
    margin: 0 auto;
}

/* ---------- TOAST / NOTIFICATION ---------- */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 14px 20px;
    box-shadow: var(--shadow-lg);
    border-left: 4px solid var(--teal);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 320px;
    animation: slideInRight 0.3s ease;
    font-size: 13.5px;
    font-weight: 500;
}

.toast.error {
    border-left-color: var(--red);
}

.toast.warning {
    border-left-color: var(--amber);
}

.toast.info {
    border-left-color: var(--primary);
}

.toast svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.toast.success svg {
    color: var(--teal);
}

.toast.error svg {
    color: var(--red);
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ---------- GRID HELPERS ---------- */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 24px;
}

.grid-60-40 {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 24px;
}

/* ---------- TOGGLE SWITCH ---------- */
.toggle-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.toggle {
    position: relative;
    width: 44px;
    height: 24px;
    cursor: pointer;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--border);
    border-radius: var(--radius-full);
    transition: var(--transition);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: white;
    top: 3px;
    left: 3px;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.toggle input:checked+.toggle-slider {
    background: var(--teal);
}

.toggle input:checked+.toggle-slider::before {
    transform: translateX(20px);
}

.toggle-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

/* ---------- BACK BUTTON ---------- */
.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 20px;
    cursor: pointer;
    transition: var(--transition);
    padding: 6px 0;
}

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

.back-btn svg {
    width: 18px;
    height: 18px;
}

/* ---------- SECTION SPACING ---------- */
.section {
    margin-bottom: 28px;
}

.section-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
    margin-bottom: 16px;
}

/* ---------- BADGE ---------- */
.badge {
    display: inline-flex;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
}

.badge-blue {
    background: var(--primary-bg);
    color: var(--primary);
}

.badge-teal {
    background: var(--teal-bg);
    color: var(--teal);
}

.badge-amber {
    background: var(--amber-bg);
    color: var(--amber);
}

.badge-red {
    background: var(--red-bg);
    color: var(--red);
}

/* ---------- MOBILE SIDEBAR OVERLAY ---------- */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 99;
}

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

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

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

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

    .grid-60-40 {
        grid-template-columns: 1fr;
    }

    .kpi-secondary {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-xl);
    }

    .main-area {
        margin-left: 0;
    }

    .menu-toggle {
        display: flex;
    }

    .content-area {
        padding: 20px 16px;
    }

    .topbar {
        padding: 0 16px;
    }

    .topbar-search {
        display: none;
    }

    .role-switcher {
        display: none;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .page-header-left h1 {
        font-size: 20px;
    }

    .form-row,
    .form-row-3 {
        grid-template-columns: 1fr;
    }

    .kpi-secondary {
        grid-template-columns: 1fr 1fr;
    }

    .kpi-focus-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .pipeline-container {
        flex-wrap: wrap;
    }

    .pipeline-stage {
        min-width: calc(50% - 6px);
        flex: unset;
    }

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

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

    .profile-actions {
        margin-left: 0;
    }

    .profile-meta {
        justify-content: center;
    }

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

    .modal {
        max-width: 100%;
        max-height: 100%;
        border-radius: 0;
    }

    .tabs {
        gap: 0;
    }

    .tab {
        padding: 10px 14px;
        font-size: 12px;
    }

    .toast {
        min-width: auto;
        margin: 0 16px;
    }

    .calendar-grid {
        grid-template-columns: 60px 1fr;
    }
}

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

    .pipeline-stage {
        min-width: 100%;
    }

    .content-area {
        padding: 16px 12px;
    }

    .page-header-left h1 {
        font-size: 18px;
    }
}

/* ---------- MISC UTILITIES ---------- */
.text-muted {
    color: var(--text-muted);
}

.text-secondary {
    color: var(--text-secondary);
}

.text-primary {
    color: var(--text-primary);
}

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

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

.fw-600 {
    font-weight: 600;
}

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

.fw-800 {
    font-weight: 800;
}

.mt-4 {
    margin-top: 4px;
}

.mt-8 {
    margin-top: 8px;
}

.mt-16 {
    margin-top: 16px;
}

.mt-24 {
    margin-top: 24px;
}

.mb-8 {
    margin-bottom: 8px;
}

.mb-16 {
    margin-bottom: 16px;
}

.mb-24 {
    margin-bottom: 24px;
}

.d-flex {
    display: flex;
}

.align-center {
    align-items: center;
}

.gap-8 {
    gap: 8px;
}

.gap-12 {
    gap: 12px;
}

.gap-16 {
    gap: 16px;
}

.hidden {
    display: none !important;
}

/* Doctor avatar color rotation */
.avatar-1 {
    background: linear-gradient(135deg, #2563EB, #1D4ED8);
}

.avatar-2 {
    background: linear-gradient(135deg, #10B981, #059669);
}

.avatar-3 {
    background: linear-gradient(135deg, #8B5CF6, #7C3AED);
}

.avatar-4 {
    background: linear-gradient(135deg, #F59E0B, #D97706);
}

.avatar-5 {
    background: linear-gradient(135deg, #EF4444, #DC2626);
}

.avatar-6 {
    background: linear-gradient(135deg, #06B6D4, #0891B2);
}

.avatar-7 {
    background: linear-gradient(135deg, #EC4899, #DB2777);
}

.avatar-8 {
    background: linear-gradient(135deg, #6366F1, #4F46E5);
}

.avatar-9 {
    background: linear-gradient(135deg, #14B8A6, #0D9488);
}

.avatar-10 {
    background: linear-gradient(135deg, #F97316, #EA580C);
}

/* ---------- SETTINGS LIST ---------- */
.settings-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border-light);
}

.settings-item:last-child {
    border-bottom: none;
}

.settings-item-info h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.settings-item-info p {
    font-size: 12.5px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* ---------- REPORT SUMMARY CARDS ---------- */
.report-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.report-summary-card {
    padding: 18px;
    border-radius: var(--radius);
    text-align: center;
}

.report-summary-card .value {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -1px;
}

.report-summary-card .label {
    font-size: 12px;
    font-weight: 500;
    margin-top: 4px;
}

/* ---------- LOGIN OVERLAY ---------- */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #F1F5F9;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    background: white;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-logo {
    width: 48px;
    height: 48px;
    background: var(--primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    margin: 0 auto 20px;
}

.login-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.login-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.login-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.login-btn-option {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: white;
    color: var(--text-primary);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.login-btn-option:hover {
    border-color: var(--primary);
    background: var(--primary-bg);
    color: var(--primary);
}

.login-doctor-select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-top: 12px;
    margin-bottom: 12px;
    outline: none;
    font-family: inherit;
}

.login-back-btn {
    font-size: 13px;
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    margin-top: 16px;
    text-decoration: underline;
}
/* ---------- REDESIGNED DOCTOR CARD ---------- */
.doctor-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

.doctor-card-new {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.doctor-card-new:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
}

.doc-header {
    display: flex;
    align-items: start;
    gap: 16px;
}

.doc-avatar-large {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}

.doc-info h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
    line-height: 1.3;
}

.doc-info p {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.doc-badge {
    position: absolute;
    top: 24px;
    right: 24px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--teal);
    border: 2px solid var(--surface);
    box-shadow: 0 0 0 1px #A7F3D0;
}

.doc-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 16px;
    background: var(--bg);
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
}

.doc-stat-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.doc-stat-label {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.doc-stat-val {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}

.doc-actions {
    margin-top: auto;
    display: flex;
    gap: 10px;
    padding-top: 16px;
    border-top: 1px solid var(--border-light);
}


/* ---------- WHATSAPP AUTOMATION DASHBOARD ---------- */
.wa-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.wa-stat-card {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.wa-stat-title {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 700;
    letter-spacing: 0.5px;
}

.wa-stat-value {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-primary);
}

.wa-stat-card.active-stat {
    border-color: var(--primary-light);
    background: var(--surface);
}

.wa-stat-card.active-stat .wa-stat-value {
    color: var(--primary);
}

/* ---------- ENHANCED TABLE ---------- */
.table-container table th {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.phone-col {
    font-family: monospace;
    color: var(--text-muted);
    font-size: 13px;
}

.action-icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 6px;
    border-radius: 4px;
    transition: var(--transition);
}

.action-icon-btn:hover {
    background: var(--bg);
    color: var(--primary);
}

/* ---------- AUTOMATION TEMPLATE CARDS ---------- */
.wa-template-group {
    margin-bottom: 24px;
}

.wa-group-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
    padding-left: 4px;
    border-left: 3px solid var(--primary);
}

.wa-auto-card {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    margin-bottom: 12px;
    overflow: hidden;
    transition: var(--transition);
}

.wa-auto-card:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-sm);
}

.wa-auto-header {
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    background: var(--surface);
}

.wa-auto-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.wa-auto-name {
    font-weight: 700;
    font-size: 14px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.wa-auto-trigger {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.wa-auto-trigger svg {
    width: 12px;
    height: 12px;
    color: var(--primary);
}

.wa-auto-body {
    padding: 0 16px 16px 16px;
    display: none;
    border-top: 1px solid var(--border-light);
    background: var(--bg-light);
    margin-top: 10px;
    padding-top: 16px;
}

.wa-auto-card.expanded .wa-auto-body {
    display: block;
}

.wa-preview-bubble {
    background: #DCF8C6;
    padding: 12px;
    border-radius: 8px;
    font-size: 13.5px;
    line-height: 1.5;
    color: #111B21;
    position: relative;
    box-shadow: 0 1px 0.5px rgba(0,0,0,0.13);
}

.wa-preview-bubble::after {
    content: '';
    position: absolute;
    top: 0;
    left: -8px;
    width: 0;
    height: 0;
    border: 8px solid transparent;
    border-top-color: #DCF8C6;
    border-right-color: #DCF8C6;
}

