/* assets/css/style.css - Vita Nova Physical Therapy Clinic Design System */

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

:root {
    --primary: #0284c7;
    --primary-hover: #0369a1;
    --primary-light: #e0f2fe;
    --primary-glow: rgba(2, 132, 199, 0.25);

    --secondary: #0ea5e9;
    --accent: #06b6d4;
    --accent-light: #ecfeff;

    --success: #10b981;
    --success-light: #d1fae5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --info: #3b82f6;
    --info-light: #dbeafe;

    /* Sidebar Dimensions */
    --sidebar-collapsed: 76px;
    --sidebar-expanded: 270px;

    /* Light Theme (Default) */
    --sidebar-bg: #0f172a;
    --sidebar-hover: #1e293b;
    --sidebar-active: #0284c7;
    --sidebar-text: #94a3b8;
    --sidebar-text-bright: #f8fafc;

    --bg-main: #f8fafc;
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --topbar-bg: #ffffff;
    --table-header: #f8fafc;
    --table-hover: #f1f5f9;
    --input-bg: #ffffff;
    --input-border: #cbd5e1;

    --sheet-bg: #ffffff;
    --sheet-border: #0284c7;
    --ruled-line: #cbd5e1;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;

    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.03);

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

/* ========================================================
   DARK THEME (دۆخی تاریک)
======================================================== */
[data-theme="dark"],
body.dark-theme {
    --bg-main: #0b1120;
    --card-bg: #151e33;
    --border-color: #1e293b;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --topbar-bg: #0f172a;
    --sidebar-bg: #090e1a;
    --sidebar-hover: #17223b;
    --sidebar-active: #0284c7;
    --sidebar-text: #94a3b8;
    --sidebar-text-bright: #ffffff;

    --table-header: #0f172a;
    --table-hover: #1a253e;
    --input-bg: #0f172a;
    --input-border: #334155;

    --sheet-bg: #151e33;
    --sheet-border: #38bdf8;
    --ruled-line: #334155;

    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.5);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

body[dir="rtl"] {
    font-family: 'Vazirmatn', 'Segoe UI', Tahoma, sans-serif;
}

.app-layout {
    display: flex;
    min-height: 100vh;
    position: relative;
}

/* ========================================================
   CSS SIDEBAR - ICON ONLY BY DEFAULT, EXPANDS ON HOVER
======================================================== */
.sidebar {
    width: var(--sidebar-collapsed);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    z-index: 1050;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
    transition: width 0.32s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
    overflow-x: hidden;
    overflow-y: auto;
}

body[dir="ltr"] .sidebar {
    left: 0;
}

body[dir="rtl"] .sidebar {
    right: 0;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
}

/* Sidebar Hover / Expanded State */
.sidebar:hover,
.sidebar.is-hovered {
    width: var(--sidebar-expanded);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.35);
}

/* Brand Section */
.sidebar-brand {
    height: 72px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: linear-gradient(180deg, rgba(2, 132, 199, 0.14) 0%, rgba(15, 23, 42, 0) 100%);
    text-decoration: none;
    flex-shrink: 0;
}

.brand-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, #0284c7 0%, #06b6d4 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 22px;
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.45);
    flex-shrink: 0;
}

.brand-text {
    opacity: 0;
    max-width: 0;
    overflow: hidden;
    white-space: nowrap;
    transition: opacity 0.25s ease, max-width 0.3s ease, transform 0.25s ease;
    transform: translateX(8px);
}

body[dir="rtl"] .brand-text {
    transform: translateX(-8px);
}

.sidebar:hover .brand-text {
    opacity: 1;
    max-width: 190px;
    transform: translateX(0);
}

.brand-text h2 {
    font-size: 1.15rem;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: -0.3px;
    line-height: 1.2;
}

.brand-text span {
    font-size: 0.7rem;
    color: var(--secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
    display: block;
}

/* Navigation List */
.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    overflow-x: hidden;
}

.nav-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #64748b;
    padding: 8px 12px 2px;
    font-weight: 700;
    opacity: 0;
    height: 0;
    overflow: hidden;
    transition: opacity 0.25s ease, height 0.25s ease, padding 0.25s ease;
    white-space: nowrap;
}

.sidebar:hover .nav-label {
    opacity: 1;
    height: auto;
    padding: 8px 12px 2px;
}

/* Nav Item Styling */
.nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    height: 48px;
    padding: 0 14px;
    border-radius: var(--radius-md);
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 500;
    transition: var(--transition);
    position: relative;
    user-select: none;
    overflow: hidden;
}

.nav-icon-wrap {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: var(--transition);
}

.nav-icon-wrap svg {
    width: 22px;
    height: 22px;
}

.nav-text {
    opacity: 0;
    max-width: 0;
    overflow: hidden;
    white-space: nowrap;
    transition: opacity 0.22s ease, max-width 0.28s ease, transform 0.22s ease;
    transform: translateX(10px);
}

body[dir="rtl"] .nav-text {
    transform: translateX(-10px);
}

.sidebar:hover .nav-text {
    opacity: 1;
    max-width: 170px;
    transform: translateX(0);
}

/* Hover & Micro-actions */
.nav-item:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text-bright);
}

.nav-item:hover .nav-icon-wrap {
    transform: scale(1.12);
    color: #38bdf8;
}

/* Active Page Item */
.nav-item.active {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.4);
}

.nav-item.active .nav-icon-wrap {
    color: #ffffff !important;
    background: rgba(255, 255, 255, 0.25) !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25) !important;
}

/* Colorful Standard Sidebar Icons */
.nav-icon-wrap.icon-indigo {
    color: #818cf8;
    background: rgba(99, 102, 241, 0.16);
    border-radius: 8px;
    padding: 3px;
}

.nav-icon-wrap.icon-emerald {
    color: #34d399;
    background: rgba(16, 185, 129, 0.16);
    border-radius: 8px;
    padding: 3px;
}

.nav-icon-wrap.icon-amber {
    color: #fbbf24;
    background: rgba(245, 158, 11, 0.16);
    border-radius: 8px;
    padding: 3px;
}

.nav-icon-wrap.icon-sky {
    color: #38bdf8;
    background: rgba(14, 165, 233, 0.16);
    border-radius: 8px;
    padding: 3px;
}

.nav-icon-wrap.icon-rose {
    color: #fb7185;
    background: rgba(244, 63, 94, 0.16);
    border-radius: 8px;
    padding: 3px;
}

.nav-icon-wrap.icon-violet {
    color: #a78bfa;
    background: rgba(139, 92, 246, 0.16);
    border-radius: 8px;
    padding: 3px;
}

.nav-icon-wrap.icon-teal {
    color: #2dd4bf;
    background: rgba(20, 184, 166, 0.16);
    border-radius: 8px;
    padding: 3px;
}

/* Active Click Action Effect */
.nav-item:active,
.nav-item.item-pressed {
    transform: scale(0.92) !important;
    transition: transform 0.1s ease;
}

.nav-click-ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(56, 189, 248, 0.45);
    transform: scale(0);
    animation: ripplePulse 0.5s linear;
    pointer-events: none;
}

@keyframes ripplePulse {
    to {
        transform: scale(2.6);
        opacity: 0;
    }
}

/* Nav Badge */
.nav-badge {
    margin-inline-start: auto;
    font-size: 0.72rem;
    background: #0ea5e9;
    color: #ffffff;
    padding: 2px 7px;
    border-radius: var(--radius-full);
    font-weight: 700;
    opacity: 0;
    max-width: 0;
    overflow: hidden;
    transition: opacity 0.25s ease, max-width 0.25s ease;
}

.sidebar:hover .nav-badge {
    opacity: 1;
    max-width: 50px;
}

/* Tooltip for Icon-only Mode (When Sidebar is Collapsed) */
.sidebar:not(:hover) .nav-item[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: #0f172a;
    color: #ffffff;
    padding: 6px 12px;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 2000;
    pointer-events: none;
    animation: tooltipFadeIn 0.18s ease forwards;
}

body[dir="ltr"] .sidebar:not(:hover) .nav-item[data-tooltip]:hover::after {
    left: calc(100% + 12px);
}

body[dir="rtl"] .sidebar:not(:hover) .nav-item[data-tooltip]:hover::after {
    right: calc(100% + 12px);
}

@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: translateY(-50%) scale(0.92);
    }

    to {
        opacity: 1;
        transform: translateY(-50%) scale(1);
    }
}

/* ========================================================
   SIDEBAR FOOTER & DARK/LIGHT MODE TOGGLE
======================================================== */
.sidebar-footer {
    padding: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(15, 23, 42, 0.6);
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-shrink: 0;
}

/* Theme Toggle Button */
.theme-toggle-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 44px;
    padding: 0 12px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    color: var(--sidebar-text-bright);
    cursor: pointer;
    text-align: left;
    transition: var(--transition);
    position: relative;
    user-select: none;
    width: 100%;
}

.theme-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: #38bdf8;
}

.theme-toggle-btn:active,
.theme-toggle-btn.theme-clicked {
    transform: scale(0.93);
}

.theme-toggle-icons {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
}

.icon-sun,
.icon-moon {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
}

.icon-sun {
    color: #fbbf24;
    opacity: 1;
    transform: rotate(0) scale(1);
}

.icon-moon {
    color: #38bdf8;
    opacity: 0;
    transform: rotate(-90deg) scale(0.5);
}

/* Dark mode active icon states */
.theme-toggle-btn.is-dark .icon-sun {
    opacity: 0;
    transform: rotate(90deg) scale(0.5);
}

.theme-toggle-btn.is-dark .icon-moon {
    opacity: 1;
    transform: rotate(0) scale(1);
}

.theme-text {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--sidebar-text-bright);
    opacity: 0;
    max-width: 0;
    overflow: hidden;
    white-space: nowrap;
    transition: opacity 0.25s ease, max-width 0.28s ease;
}

.sidebar:hover .theme-text {
    opacity: 1;
    max-width: 130px;
}

.theme-switch-indicator {
    margin-inline-start: auto;
    width: 36px;
    height: 20px;
    background: #334155;
    border-radius: var(--radius-full);
    position: relative;
    transition: var(--transition);
    opacity: 0;
    overflow: hidden;
    flex-shrink: 0;
}

.sidebar:hover .theme-switch-indicator {
    opacity: 1;
}

.switch-ball {
    width: 16px;
    height: 16px;
    background: #ffffff;
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.28s ease;
}

body[dir="rtl"] .switch-ball {
    left: auto;
    right: 2px;
}

.theme-toggle-btn.is-dark .theme-switch-indicator {
    background: #0284c7;
}

.theme-toggle-btn.is-dark .switch-ball {
    transform: translateX(16px);
}

body[dir="rtl"] .theme-toggle-btn.is-dark .switch-ball {
    transform: translateX(-16px);
}

/* Sidebar Log Out Button (under Dark Mode) */
.logout-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 44px;
    padding: 0 12px;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-md);
    color: #f87171;
    text-decoration: none;
    cursor: pointer;
    text-align: left;
    transition: var(--transition);
    position: relative;
    user-select: none;
    width: 100%;
}

.logout-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}

.logout-btn:active {
    transform: scale(0.95);
}

.logout-icon-wrap {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #f87171;
    transition: color 0.2s ease, transform 0.2s ease;
}

.logout-btn:hover .logout-icon-wrap {
    color: #ffffff;
    transform: translateX(2px);
}

body[dir="rtl"] .logout-btn:hover .logout-icon-wrap {
    transform: translateX(-2px);
}

.logout-text {
    font-size: 0.86rem;
    font-weight: 700;
    color: #f87171;
    opacity: 0;
    max-width: 0;
    overflow: hidden;
    white-space: nowrap;
    transition: opacity 0.25s ease, max-width 0.28s ease, color 0.2s ease;
}

.logout-btn:hover .logout-text {
    color: #ffffff;
}

.sidebar:hover .logout-text {
    opacity: 1;
    max-width: 140px;
}

/* Clinic Motto Badge in Footer */

.clinic-motto-badge {
    text-align: center;
    font-size: 0.74rem;
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.08);
    border: 1px dashed rgba(56, 189, 248, 0.3);
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    opacity: 0;
    height: 0;
    overflow: hidden;
    padding: 0;
    transition: opacity 0.25s ease, height 0.25s ease, padding 0.25s ease;
    white-space: nowrap;
}

.sidebar:hover .clinic-motto-badge {
    opacity: 1;
    height: auto;
    padding: 6px 8px;
}

/* ========================================================
   MAIN CONTENT AREA LAYOUT (Padded for Collapsed Sidebar)
======================================================== */
.main-wrapper {
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin 0.32s cubic-bezier(0.4, 0, 0.2, 1);
}

body[dir="ltr"] .main-wrapper {
    margin-left: var(--sidebar-collapsed);
}

body[dir="rtl"] .main-wrapper {
    margin-right: var(--sidebar-collapsed);
}

/* Topbar Header */
.topbar {
    height: 72px;
    background: var(--topbar-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 900;
    box-shadow: var(--shadow-sm);
    transition: background 0.3s ease, border-color 0.3s ease;
}

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

.toggle-sidebar-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 22px;
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
}

.page-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-primary);
}

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

/* Language Switcher Buttons */
.lang-switcher {
    display: flex;
    background: var(--bg-main);
    padding: 4px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
    gap: 2px;
}

.lang-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--text-secondary);
    transition: var(--transition);
}

/* Single Circle Language Dropdown Switcher */
.lang-dropdown-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.lang-circle-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--card-bg);
    border: 1.5px solid var(--border-color);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.25rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    -webkit-tap-highlight-color: transparent;
}

.lang-circle-btn:hover,
.lang-circle-btn.active {
    border-color: #0284c7;
    background: #e0f2fe;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.2);
}

[data-theme="dark"] .lang-circle-btn {
    background: #1e293b;
    border-color: #334155;
}

[data-theme="dark"] .lang-circle-btn:hover,
[data-theme="dark"] .lang-circle-btn.active {
    background: rgba(2, 132, 199, 0.25);
    border-color: #38bdf8;
}

.lang-circle-btn:active {
    transform: scale(0.95);
}

.lang-current-flag {
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Floating Dropdown Menu */
.lang-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 170px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 10px 25px -3px rgba(0, 0, 0, 0.15), 0 4px 10px rgba(0, 0, 0, 0.05);
    padding: 6px;
    z-index: 10000;
    display: none;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

body[dir="rtl"] .lang-dropdown-menu {
    right: auto;
    left: 0;
}

.lang-dropdown-menu.show {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.lang-dropdown-header {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    padding: 6px 10px 4px;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 4px;
}

.lang-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-primary);
    font-size: 0.88rem;
    font-weight: 600;
    transition: background 0.15s ease, color 0.15s ease;
}

.lang-dropdown-item:hover {
    background: rgba(2, 132, 199, 0.08);
    color: #0284c7;
}

.lang-dropdown-item.active {
    background: #e0f2fe;
    color: #0284c7;
    font-weight: 700;
}

[data-theme="dark"] .lang-dropdown-item.active {
    background: rgba(2, 132, 199, 0.25);
    color: #38bdf8;
}

.lang-item-flag {
    font-size: 1.1rem;
    line-height: 1;
}

.lang-item-title {
    flex: 1;
}

.lang-item-check {
    font-weight: 800;
    color: #0284c7;
}

/* User Profile Widget Styling */
/* User Profile Wrapper & Interactive Dropdown (matching Image 2) */
.user-profile-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.user-profile-widget {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 14px 4px 5px;
    background: var(--card-bg);
    border-radius: 9999px;
    border: 1.5px solid var(--border-color);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
    transition: all 0.2s ease;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    user-select: none;
    cursor: pointer;
}

body[dir="rtl"] .user-profile-widget {
    padding: 4px 5px 4px 14px;
}


    .user-profile-widget:hover,
    .user-profile-widget[aria-expanded="true"] {
        border-color: #0284c7;
        box-shadow: 0 4px 14px rgba(2, 132, 199, 0.18);
        transform: translateY(-1px);
    }


    .user-profile-widget:active {
        transform: translateY(0);
    }

    .avatar {
        width: 36px;
        height: 36px;
        border-radius: 50%;
        background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
        color: #ffffff;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: 800;
        font-size: 0.84rem;
        letter-spacing: 0.5px;
        box-shadow: 0 2px 6px rgba(2, 132, 199, 0.35);
        flex-shrink: 0;
    }

    .user-name {
        font-size: 0.88rem;
        font-weight: 700;
        color: var(--text-primary);
        line-height: 1.2;
        white-space: nowrap;
    }

    .user-role-badge {
        font-size: 0.72rem;
        color: var(--text-secondary);
        display: block;
        line-height: 1.2;
        margin-top: 2px;
        white-space: nowrap;
    }

    /* User Profile Dropdown Card (matching Image 2) */
    .user-profile-dropdown {
        position: absolute;
        top: calc(100% + 10px);
        left: 0;
        width: 290px;
        max-width: calc(100vw - 28px);
        background: var(--card-bg, #ffffff);
        border-radius: 20px;
        padding: 20px 20px 16px 20px;
        box-shadow: 0 16px 40px -6px rgba(0, 0, 0, 0.16), 0 0 0 1px rgba(0, 0, 0, 0.05);
        border: 1px solid var(--border-color, #e2e8f0);
        z-index: 1200;
        direction: ltr !important;
        text-align: left !important;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transform: translateY(-8px) scale(0.97);
        transform-origin: top left;
        transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.2s;
    }

    body[dir="ltr"] .user-profile-dropdown {
        left: auto;
        right: 0;
        transform-origin: top right;
    }

    .user-profile-dropdown.show {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: translateY(0) scale(1);
    }

    /* Dropdown Header Info matching Image 2 */
    .dropdown-user-header {
        display: flex;
        align-items: flex-start;
        gap: 14px;
        text-align: left;
        direction: ltr;
    }

    .dropdown-user-avatar {
        width: 48px;
        height: 48px;
        border-radius: 50%;
        background: linear-gradient(135deg, #0284c7 0%, #06b6d4 100%);
        color: #ffffff;
        font-size: 1.4rem;
        font-weight: 800;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        box-shadow: 0 4px 14px rgba(2, 132, 199, 0.35);
        user-select: none;
    }

    .dropdown-user-info {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
        flex: 1;
        min-width: 0;
        text-align: left;
    }

    .dropdown-user-title {
        font-size: 1rem;
        font-weight: 800;
        color: var(--text-primary, #0f172a);
        margin: 0;
        line-height: 1.3;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        width: 100%;
    }

    .dropdown-user-handle {
        font-size: 0.84rem;
        font-weight: 500;
        color: var(--text-secondary, #64748b);
        font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
        line-height: 1.2;
    }

    .dropdown-role-badge {
        display: inline-flex;
        align-items: center;
        margin-top: 4px;
        padding: 2.5px 11px;
        border-radius: 9999px;
        font-size: 0.74rem;
        font-weight: 700;
        color: #dc2626;
        background-color: #fef2f2;
        border: 1px solid #fecaca;
        line-height: 1.3;
        letter-spacing: 0.2px;
    }

    [data-theme="dark"] .dropdown-role-badge,
    body.dark-theme .dropdown-role-badge {
        color: #f87171;
        background-color: rgba(239, 68, 68, 0.14);
        border-color: rgba(239, 68, 68, 0.32);
    }

    .dropdown-divider {
        margin: 14px 0 10px 0;
        border: none;
        border-top: 1px solid var(--border-color, #f1f5f9);
        width: 100%;
    }

    /* Dropdown Menu Items */
    .dropdown-menu-list {
        display: flex;
        flex-direction: column;
        gap: 6px;
        direction: ltr;
    }

    .profile-menu-item {
        display: flex;
        align-items: center;
        gap: 14px;
        width: 100%;
        padding: 8px 10px;
        border-radius: 14px;
        border: none;
        background: transparent;
        cursor: pointer;
        text-decoration: none;
        font-family: inherit;
        transition: background 0.18s ease, transform 0.18s ease;
        text-align: left;
        direction: ltr;
        box-sizing: border-box;
    }

    .profile-menu-item:hover {
        background: var(--table-hover, #f8fafc);
        transform: translateX(3px);
    }

    .profile-menu-item.profile-menu-logout:hover {
        background: #fff1f2;
    }

    [data-theme="dark"] .profile-menu-item.profile-menu-logout:hover,
    body.dark-theme .profile-menu-item.profile-menu-logout:hover {
        background: rgba(239, 68, 68, 0.12);
    }

    .profile-icon-box {
        width: 42px;
        height: 42px;
        border-radius: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        transition: transform 0.18s ease;
    }

    .profile-menu-item:hover .profile-icon-box {
        transform: scale(1.06);
    }

    .profile-icon-blue {
        background: #e0f2fe;
        color: #0284c7;
    }

    [data-theme="dark"] .profile-icon-blue,
    body.dark-theme .profile-icon-blue {
        background: rgba(2, 132, 199, 0.2);
        color: #38bdf8;
    }

    .profile-icon-red {
        background: #fee2e2;
        color: #ef4444;
    }

    [data-theme="dark"] .profile-icon-red,
    body.dark-theme .profile-icon-red {
        background: rgba(239, 68, 68, 0.2);
        color: #f87171;
    }

    .profile-menu-text {
        font-size: 0.98rem;
        font-weight: 700;
        color: var(--text-primary, #0f172a);
        line-height: 1.2;
    }

    /* Change Password Modal Dialog */
    .user-modal-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(15, 23, 42, 0.55);
        backdrop-filter: blur(6px);
        -webkit-backdrop-filter: blur(6px);
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 2000;
        padding: 16px;
        animation: userModalFadeIn 0.22s ease-out;
    }

    @keyframes userModalFadeIn {
        from {
            opacity: 0;
        }

        to {
            opacity: 1;
        }
    }

    .user-modal-dialog {
        background: var(--card-bg, #ffffff);
        border-radius: 20px;
        width: 100%;
        max-width: 440px;
        box-shadow: 0 25px 60px -12px rgba(0, 0, 0, 0.28), 0 0 0 1px var(--border-color, #e2e8f0);
        border: 1px solid var(--border-color, #e2e8f0);
        overflow: hidden;
        animation: userModalPop 0.26s cubic-bezier(0.16, 1, 0.3, 1);
    }

    @keyframes userModalPop {
        from {
            opacity: 0;
            transform: scale(0.94) translateY(8px);
        }

        to {
            opacity: 1;
            transform: scale(1) translateY(0);
        }
    }

    .user-modal-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 20px 24px;
        border-bottom: 1px solid var(--border-color, #f1f5f9);
        background: var(--card-bg, #ffffff);
    }

    .user-modal-title-wrap {
        display: flex;
        align-items: center;
        gap: 12px;
    }

    .user-modal-icon-badge {
        width: 42px;
        height: 42px;
        border-radius: 12px;
        background: #e0f2fe;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }

    [data-theme="dark"] .user-modal-icon-badge,
    body.dark-theme .user-modal-icon-badge {
        background: rgba(2, 132, 199, 0.22);
    }

    .user-modal-title {
        font-size: 1.05rem;
        font-weight: 800;
        color: var(--text-primary, #0f172a);
        margin: 0;
        line-height: 1.3;
    }

    .user-modal-subtitle {
        font-size: 0.78rem;
        color: var(--text-secondary, #64748b);
        margin: 2px 0 0;
    }

    .user-modal-close {
        background: transparent;
        border: none;
        font-size: 1.75rem;
        line-height: 1;
        color: var(--text-secondary, #94a3b8);
        cursor: pointer;
        padding: 4px 8px;
        border-radius: 8px;
        transition: all 0.18s ease;
    }

    .user-modal-close:hover {
        color: #ef4444;
        background: #fee2e2;
    }

    [data-theme="dark"] .user-modal-close:hover,
    body.dark-theme .user-modal-close:hover {
        background: rgba(239, 68, 68, 0.2);
    }

    .user-modal-body {
        padding: 22px 24px 16px;
        display: flex;
        flex-direction: column;
        gap: 16px;
    }

    .user-modal-alert {
        padding: 10px 14px;
        border-radius: 10px;
        font-size: 0.85rem;
        font-weight: 600;
        display: flex;
        align-items: center;
        gap: 8px;
        line-height: 1.4;
    }

    .user-modal-alert.alert-error {
        background-color: #fef2f2;
        border: 1px solid #fecaca;
        color: #b91c1c;
    }

    .user-modal-alert.alert-success {
        background-color: #ecfdf5;
        border: 1px solid #a7f3d0;
        color: #047857;
    }

    [data-theme="dark"] .user-modal-alert.alert-error,
    body.dark-theme .user-modal-alert.alert-error {
        background-color: rgba(239, 68, 68, 0.15);
        border-color: rgba(239, 68, 68, 0.35);
        color: #fca5a5;
    }

    [data-theme="dark"] .user-modal-alert.alert-success,
    body.dark-theme .user-modal-alert.alert-success {
        background-color: rgba(16, 185, 129, 0.15);
        border-color: rgba(16, 185, 129, 0.35);
        color: #6ee7b7;
    }

    .user-form-group {
        display: flex;
        flex-direction: column;
        gap: 6px;
        text-align: start;
    }

    .user-form-label {
        font-size: 0.84rem;
        font-weight: 700;
        color: var(--text-primary, #0f172a);
    }

    .user-input-password-wrap {
        position: relative;
        display: flex;
        align-items: center;
    }

    .user-input-password-wrap .user-form-input {
        width: 100%;
        padding: 11px 40px 11px 14px;
        border-radius: 12px;
        border: 1.5px solid var(--border-color, #cbd5e1);
        background: var(--input-bg, #ffffff);
        color: var(--text-primary, #0f172a);
        font-size: 0.92rem;
        transition: all 0.2s ease;
        box-sizing: border-box;
    }

    body[dir="rtl"] .user-input-password-wrap .user-form-input {
        padding: 11px 14px 11px 40px;
    }

    .user-input-password-wrap .user-form-input:focus {
        outline: none;
        border-color: #0284c7;
        box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
    }

    .user-btn-eye {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        right: 12px;
        background: transparent;
        border: none;
        cursor: pointer;
        color: var(--text-secondary, #94a3b8);
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 4px;
        border-radius: 6px;
        transition: color 0.18s;
    }

    body[dir="rtl"] .user-btn-eye {
        right: auto;
        left: 12px;
    }

    .user-btn-eye:hover,
    .user-btn-eye.active {
        color: #0284c7;
    }

    .user-pass-hint {
        display: flex;
        align-items: center;
        gap: 6px;
        font-size: 0.74rem;
        color: var(--text-secondary, #64748b);
        line-height: 1.3;
    }

    .user-modal-footer {
        display: flex;
        align-items: center;
        justify-content: flex-end;
        gap: 12px;
        padding: 16px 24px;
        border-top: 1px solid var(--border-color, #f1f5f9);
        background: var(--card-bg, #ffffff);
    }

    /* Content Container */
    .content-body {
        flex: 1;
        padding: 28px;
        max-width: 1400px;
        width: 100%;
        margin: 0 auto;
    }

    /* Stats Cards Grid */
    .stats-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
        gap: 20px;
        margin-bottom: 28px;
    }

    .stat-card {
        background: var(--card-bg);
        border-radius: var(--radius-lg);
        padding: 22px;
        border: 1px solid var(--border-color);
        box-shadow: var(--shadow-sm);
        display: flex;
        align-items: center;
        gap: 18px;
        transition: var(--transition);
        position: relative;
        overflow: hidden;
    }

    .stat-card:hover {
        transform: translateY(-3px);
        box-shadow: var(--shadow-md);
        border-color: #38bdf8;
    }

    .stat-icon {
        width: 56px;
        height: 56px;
        border-radius: var(--radius-md);
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 26px;
        flex-shrink: 0;
        transition: transform 0.25s ease, box-shadow 0.25s ease;
    }

    .stat-card:hover .stat-icon {
        transform: scale(1.08) rotate(3deg);
    }

    .stat-icon.blue {
        background: linear-gradient(135deg, #0284c7 0%, #38bdf8 100%) !important;
        color: #ffffff !important;
        box-shadow: 0 6px 18px rgba(2, 132, 199, 0.35);
    }

    .stat-icon.teal {
        background: linear-gradient(135deg, #0d9488 0%, #2dd4bf 100%) !important;
        color: #ffffff !important;
        box-shadow: 0 6px 18px rgba(13, 148, 136, 0.35);
    }

    .stat-icon.green {
        background: linear-gradient(135deg, #059669 0%, #34d399 100%) !important;
        color: #ffffff !important;
        box-shadow: 0 6px 18px rgba(16, 185, 129, 0.35);
    }

    .stat-icon.amber {
        background: linear-gradient(135deg, #d97706 0%, #fbbf24 100%) !important;
        color: #ffffff !important;
        box-shadow: 0 6px 18px rgba(245, 158, 11, 0.35);
    }

    .stat-icon.purple {
        background: linear-gradient(135deg, #7c3aed 0%, #a78bfa 100%) !important;
        color: #ffffff !important;
        box-shadow: 0 6px 18px rgba(124, 58, 237, 0.35);
    }

    .stat-icon.rose {
        background: linear-gradient(135deg, #e11d48 0%, #fb7185 100%) !important;
        color: #ffffff !important;
        box-shadow: 0 6px 18px rgba(225, 29, 72, 0.35);
    }

    [data-theme="dark"] .stat-icon.blue {
        box-shadow: 0 6px 20px rgba(2, 132, 199, 0.45);
    }

    [data-theme="dark"] .stat-icon.teal {
        box-shadow: 0 6px 20px rgba(13, 148, 136, 0.45);
    }

    [data-theme="dark"] .stat-icon.green {
        box-shadow: 0 6px 20px rgba(16, 185, 129, 0.45);
    }

    [data-theme="dark"] .stat-icon.amber {
        box-shadow: 0 6px 20px rgba(245, 158, 11, 0.45);
    }

    .stat-info {
        flex: 1;
    }

    .stat-label {
        font-size: 0.82rem;
        color: var(--text-secondary);
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        margin-bottom: 4px;
    }

    .stat-value {
        font-size: 1.65rem;
        font-weight: 800;
        color: var(--text-primary);
        line-height: 1.2;
    }

    .stat-meta {
        font-size: 0.75rem;
        color: var(--text-muted);
        margin-top: 4px;
    }

    /* Standard Content Card */
    .content-card {
        background: var(--card-bg);
        border-radius: var(--radius-lg);
        border: 1px solid var(--border-color);
        box-shadow: var(--shadow-sm);
        margin-bottom: 24px;
        overflow: hidden;
        transition: var(--transition);
    }

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

    .card-title {
        font-size: 1.1rem;
        font-weight: 700;
        color: var(--text-primary);
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .card-body {
        padding: 24px;
    }

    /* Clinic Hero Banner Card */
    .clinic-hero-card {
        background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
        border-radius: var(--radius-lg);
        color: #ffffff;
        padding: 32px;
        margin-bottom: 28px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        box-shadow: 0 10px 25px rgba(2, 132, 199, 0.3);
        position: relative;
        overflow: hidden;
    }

    .clinic-hero-card::after {
        content: '';
        position: absolute;
        right: -40px;
        top: -40px;
        width: 250px;
        height: 250px;
        background: radial-gradient(circle, rgba(255, 255, 255, 0.18) 0%, rgba(255, 255, 255, 0) 70%);
        border-radius: 50%;
    }

    .hero-left h1 {
        font-size: 1.75rem;
        font-weight: 800;
        margin-bottom: 6px;
    }

    .hero-left p {
        font-size: 1rem;
        opacity: 0.9;
        max-width: 600px;
        margin-bottom: 16px;
    }

    .hero-motto {
        display: inline-block;
        background: rgba(255, 255, 255, 0.2);
        backdrop-filter: blur(8px);
        padding: 6px 16px;
        border-radius: var(--radius-full);
        font-weight: 600;
        font-size: 0.9rem;
        border: 1px solid rgba(255, 255, 255, 0.3);
    }

    .hero-actions {
        display: flex;
        gap: 12px;
        z-index: 1;
    }

    /* Buttons */
    .btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        padding: 10px 20px;
        border-radius: var(--radius-md);
        font-size: 0.9rem;
        font-weight: 600;
        text-decoration: none;
        border: none;
        cursor: pointer;
        transition: var(--transition);
        font-family: inherit;
        user-select: none;
    }

    .btn:active {
        transform: scale(0.96);
    }

    .btn-primary {
        background: var(--primary);
        color: #ffffff;
        box-shadow: 0 4px 10px rgba(2, 132, 199, 0.25);
    }

    .btn-primary:hover {
        background: var(--primary-hover);
        transform: translateY(-1px);
        box-shadow: 0 6px 14px rgba(2, 132, 199, 0.35);
    }

    .btn-light {
        background: #ffffff;
        color: var(--primary);
        box-shadow: var(--shadow-sm);
    }

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

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

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

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

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

    .btn-sm {
        padding: 6px 12px;
        font-size: 0.8rem;
        border-radius: var(--radius-sm);
    }

    /* ========================================================
   TABLE ACTION ICON BUTTONS & VISIT COUNT PILL
======================================================== */
    .table-actions-group {
        display: flex;
        gap: 6px;
        align-items: center;
        flex-wrap: nowrap;
    }

    .btn-action-icon {
        width: 32px;
        height: 32px;
        padding: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 7px;
        border: 1px solid transparent;
        text-decoration: none;
        cursor: pointer;
        transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
        flex-shrink: 0;
    }

    .btn-action-icon svg {
        pointer-events: none;
    }

    .btn-action-icon:hover {
        transform: translateY(-2px);
        box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
    }

    .btn-action-icon:active {
        transform: translateY(0);
    }

    /* Re-visit: Professional Emerald Green */
    .btn-action-revisit {
        background: #ecfdf5;
        color: #059669;
        border-color: #a7f3d0;
    }

    .btn-action-revisit:hover {
        background: #10b981;
        color: #ffffff;
        border-color: #10b981;
    }

    [data-theme="dark"] .btn-action-revisit {
        background: rgba(16, 185, 129, 0.15);
        color: #34d399;
        border-color: rgba(16, 185, 129, 0.3);
    }

    [data-theme="dark"] .btn-action-revisit:hover {
        background: #10b981;
        color: #ffffff;
    }

    /* View: Primary Sky Blue */
    .btn-action-view {
        background: #f0f9ff;
        color: #0284c7;
        border-color: #bae6fd;
    }

    .btn-action-view:hover {
        background: #0284c7;
        color: #ffffff;
        border-color: #0284c7;
    }

    [data-theme="dark"] .btn-action-view {
        background: rgba(2, 132, 199, 0.15);
        color: #38bdf8;
        border-color: rgba(2, 132, 199, 0.3);
    }

    [data-theme="dark"] .btn-action-view:hover {
        background: #0284c7;
        color: #ffffff;
    }

    /* Print: Slate / Neutral */
    .btn-action-print {
        background: #f1f5f9;
        color: #475569;
        border-color: #cbd5e1;
    }

    .btn-action-print:hover {
        background: #475569;
        color: #ffffff;
        border-color: #475569;
    }

    [data-theme="dark"] .btn-action-print {
        background: rgba(148, 163, 184, 0.12);
        color: #cbd5e1;
        border-color: rgba(148, 163, 184, 0.25);
    }

    [data-theme="dark"] .btn-action-print:hover {
        background: #64748b;
        color: #ffffff;
    }

    /* Edit: Amber / Warm */
    .btn-action-edit {
        background: #fffbeb;
        color: #d97706;
        border-color: #fde68a;
    }

    .btn-action-edit:hover {
        background: #f59e0b;
        color: #ffffff;
        border-color: #f59e0b;
    }

    [data-theme="dark"] .btn-action-edit {
        background: rgba(245, 158, 11, 0.15);
        color: #fbbf24;
        border-color: rgba(245, 158, 11, 0.3);
    }

    [data-theme="dark"] .btn-action-edit:hover {
        background: #f59e0b;
        color: #ffffff;
    }

    /* Delete: Crimson / Red */
    .btn-action-delete {
        background: #fef2f2;
        color: #dc2626;
        border-color: #fecaca;
    }

    .btn-action-delete:hover {
        background: #ef4444;
        color: #ffffff;
        border-color: #ef4444;
    }

    [data-theme="dark"] .btn-action-delete {
        background: rgba(239, 68, 68, 0.15);
        color: #f87171;
        border-color: rgba(239, 68, 68, 0.3);
    }

    [data-theme="dark"] .btn-action-delete:hover {
        background: #ef4444;
        color: #ffffff;
    }

    /* Key / Password: Violet */
    .btn-action-key {
        background: #f5f3ff;
        color: #7c3aed;
        border-color: #ddd6fe;
    }

    .btn-action-key:hover {
        background: #7c3aed;
        color: #ffffff;
        border-color: #7c3aed;
    }

    [data-theme="dark"] .btn-action-key {
        background: rgba(124, 58, 237, 0.15);
        color: #a78bfa;
        border-color: rgba(124, 58, 237, 0.3);
    }

    [data-theme="dark"] .btn-action-key:hover {
        background: #7c3aed;
        color: #ffffff;
    }

    /* Shield / Permissions: Indigo */
    .btn-action-shield {
        background: #eef2ff;
        color: #4f46e5;
        border-color: #c7d2fe;
    }

    .btn-action-shield:hover {
        background: #4f46e5;
        color: #ffffff;
        border-color: #4f46e5;
    }

    [data-theme="dark"] .btn-action-shield {
        background: rgba(79, 70, 229, 0.15);
        color: #818cf8;
        border-color: rgba(79, 70, 229, 0.3);
    }

    [data-theme="dark"] .btn-action-shield:hover {
        background: #4f46e5;
        color: #ffffff;
    }


    /* Visits Column: Only icon + count */
    .btn-visit-count {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        padding: 4px 10px;
        background: rgba(2, 132, 199, 0.08);
        color: #0284c7;
        border: 1.5px solid rgba(2, 132, 199, 0.3);
        border-radius: 20px;
        font-weight: 800;
        font-size: 0.88rem;
        cursor: pointer;
        transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
        white-space: nowrap;
    }

    .btn-visit-count:hover {
        background: #0284c7;
        color: #ffffff;
        border-color: #0284c7;
        transform: translateY(-1.5px);
        box-shadow: 0 3px 8px rgba(2, 132, 199, 0.25);
    }

    .btn-visit-count:active {
        transform: translateY(0);
    }

    [data-theme="dark"] .btn-visit-count {
        background: rgba(56, 189, 248, 0.12);
        color: #38bdf8;
        border-color: rgba(56, 189, 248, 0.3);
    }

    [data-theme="dark"] .btn-visit-count:hover {
        background: #0284c7;
        color: #ffffff;
        border-color: #0284c7;
    }

    /* ========================================================
   GLOBAL INSTANT FLOATING TOOLTIP FOR ALL ICONS
======================================================== */
    #app-tooltip {
        position: fixed;
        z-index: 999999;
        background: #0f172a;
        color: #ffffff;
        padding: 6px 12px;
        border-radius: 7px;
        font-size: 0.8rem;
        font-weight: 700;
        pointer-events: none;
        white-space: nowrap;
        opacity: 0;
        transform: translateY(4px) scale(0.95);
        transition: opacity 0.16s cubic-bezier(0.4, 0, 0.2, 1), transform 0.16s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 0 10px 25px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
        border: 1px solid rgba(255, 255, 255, 0.18);
        font-family: inherit;
        line-height: 1.25;
        text-align: center;
    }

    #app-tooltip::after {
        content: '';
        position: absolute;
        top: 100%;
        left: 50%;
        transform: translateX(-50%);
        border-width: 5px 5px 0 5px;
        border-style: solid;
        border-color: #0f172a transparent transparent transparent;
    }

    #app-tooltip.flipped::after {
        top: auto;
        bottom: 100%;
        border-width: 0 5px 5px 5px;
        border-color: transparent transparent #0f172a transparent;
    }

    #app-tooltip.visible {
        opacity: 1;
        transform: translateY(0) scale(1);
    }

    [data-theme="dark"] #app-tooltip {
        background: #1e293b;
        border-color: rgba(56, 189, 248, 0.35);
        color: #f8fafc;
        box-shadow: 0 10px 25px -3px rgba(0, 0, 0, 0.6);
    }

    [data-theme="dark"] #app-tooltip::after {
        border-color: #1e293b transparent transparent transparent;
    }

    [data-theme="dark"] #app-tooltip.flipped::after {
        border-color: transparent transparent #1e293b transparent;
    }

    /* ========================================================
   THE PHYSICAL VITA NOVA REGISTRATION SHEET DESIGN
======================================================== */
    .vita-sheet-container {
        background: #ffffff;
        border: 2px solid #0284c7;
        border-radius: 14px;
        box-shadow: 0 4px 25px rgba(2, 132, 199, 0.08);
        padding: 24px 28px;
        max-width: 920px;
        margin: 0 auto 30px;
        color: #000000;
        direction: rtl;
        box-sizing: border-box;
        display: flex;
        flex-direction: column;
        min-height: 1050px;
        transition: background 0.3s ease, border-color 0.3s ease;
    }

    [data-theme="dark"] .vita-sheet-container {
        background: #0f172a;
        border-color: #0284c7;
        color: #f8fafc;
    }

    /* Sheet Header: 3-column Grid (Right: Kurdish | Center: Logo | Left: English) */
    .sheet-header {
        display: grid;
        grid-template-columns: 1fr auto 1fr;
        align-items: center;
        padding-bottom: 14px;
        margin-bottom: 16px;
        border-bottom: 2px solid #0284c7;
        width: 100%;
        direction: rtl;
    }

    [data-theme="dark"] .sheet-header {
        border-bottom-color: #0284c7;
    }

    /* Right Column: Kurdish Clinic Title */
    .sheet-header-right {
        display: flex;
        justify-content: flex-start;
        align-items: center;
        text-align: right;
    }

    .sheet-kurdish-brand {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        line-height: 1.15;
    }

    .sheet-ku-title {
        color: #0284c7;
        font-size: 2.1rem;
        font-weight: 900;
        line-height: 1.1;
        margin: 0;
        letter-spacing: -0.5px;
        font-family: 'Vazirmatn', sans-serif;
    }

    .sheet-ku-sub {
        color: #0284c7;
        font-size: 0.82rem;
        font-weight: 700;
        margin-top: 3px;
        white-space: nowrap;
    }

    /* Center Column: Logo */
    .sheet-header-center {
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0 16px;
    }

    .sheet-logo-spine {
        width: 52px;
        height: 52px;
        color: #0284c7;
        stroke: #0284c7;
        display: block;
    }

    /* Left Column: English Clinic Title */
    .sheet-header-left {
        display: flex;
        justify-content: flex-end;
        align-items: center;
        text-align: left;
        direction: ltr;
    }

    .sheet-english-brand {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        line-height: 1.15;
    }

    .sheet-en-title {
        color: #0284c7;
        font-size: 1.85rem;
        font-weight: 900;
        line-height: 1.1;
        margin: 0;
        letter-spacing: -0.5px;
        font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    }

    .sheet-en-sub {
        color: #0284c7;
        font-size: 0.72rem;
        font-weight: 800;
        letter-spacing: 0.8px;
        margin-top: 3px;
        white-space: nowrap;
    }

    /* Form Grid / Table matching the sheet */
    .sheet-grid-table {
        width: 100%;
        border-collapse: collapse;
        border: 1.5px solid #0284c7;
        margin-bottom: 18px;
        direction: rtl;
    }

    .sheet-grid-table td {
        border: 1.5px solid #0284c7;
        padding: 6px 10px;
        vertical-align: middle;
        background: #ffffff;
        color: #000000;
    }

    [data-theme="dark"] .sheet-grid-table td {
        background: #0f172a;
        color: #f8fafc;
    }

    .sheet-th-cell {
        background-color: #0284c7 !important;
        color: #ffffff !important;
        font-weight: 700 !important;
        font-size: 0.88rem !important;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        width: 88px;
        text-align: center !important;
        white-space: nowrap;
    }

    .sheet-input-clean {
        width: 100%;
        border: none;
        outline: none;
        font-size: 0.95rem;
        font-family: inherit;
        font-weight: 600;
        color: inherit;
        background: transparent;
        padding: 4px 6px;
        direction: rtl;
    }

    .sheet-age-pill {
        background: rgba(2, 132, 199, 0.12);
        color: #0284c7;
        border: 1px solid rgba(2, 132, 199, 0.35);
        border-radius: 6px;
        padding: 2px 10px;
        font-weight: 700;
        font-size: 0.84rem;
        white-space: nowrap;
        display: inline-flex;
        align-items: center;
        gap: 4px;
    }

    .sheet-code-text {
        color: #0284c7;
        font-weight: 800;
        font-size: 1.1rem;
        text-align: center;
        display: block;
    }

    .sheet-gender-styled {
        display: flex;
        align-items: center;
        justify-content: space-around;
        gap: 16px;
        font-weight: 700;
        font-size: 0.88rem;
        direction: ltr;
    }

    .gender-radio-item {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        cursor: pointer;
    }

    .gender-circle {
        width: 15px;
        height: 15px;
        border: 2px solid #0284c7;
        border-radius: 50%;
        display: inline-block;
        position: relative;
        background: #ffffff;
        box-sizing: border-box;
    }

    .gender-radio-item.selected .gender-circle::after {
        content: '';
        position: absolute;
        width: 7px;
        height: 7px;
        background: #0284c7;
        border-radius: 50%;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
    }

    /* ========================================================
   MODERN STANDARD GENDER SELECTOR & BIRTH CALENDAR INPUT
======================================================== */
    .sheet-gender-selector {
        display: flex;
        align-items: center;
        gap: 8px;
        width: 100%;
    }

    .gender-pill-label {
        flex: 1;
        margin: 0;
        cursor: pointer;
        user-select: none;
        position: relative;
        display: block;
    }

    .gender-pill-label input[type="radio"] {
        position: absolute;
        opacity: 0;
        width: 0;
        height: 0;
        pointer-events: none;
    }

    .gender-pill-box {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        padding: 6px 10px;
        border-radius: 8px;
        border: 1.5px solid #cbd5e1;
        background: #f8fafc;
        color: #64748b;
        font-size: 0.82rem;
        font-weight: 700;
        letter-spacing: 0.5px;
        transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    }

    [data-theme="dark"] .gender-pill-box {
        background: #1e293b;
        border-color: #334155;
        color: #94a3b8;
    }

    .gender-pill-label:hover .gender-pill-box {
        border-color: #94a3b8;
        background: #f1f5f9;
    }

    [data-theme="dark"] .gender-pill-label:hover .gender-pill-box {
        background: #334155;
        border-color: #64748b;
    }

    /* Checked Male (Clinical Blue) */
    .gender-pill-label.male input[type="radio"]:checked+.gender-pill-box {
        background: #e0f2fe;
        border-color: #0284c7;
        color: #0369a1;
        box-shadow: 0 2px 8px rgba(2, 132, 199, 0.2);
    }

    [data-theme="dark"] .gender-pill-label.male input[type="radio"]:checked+.gender-pill-box {
        background: rgba(2, 132, 199, 0.25);
        border-color: #38bdf8;
        color: #38bdf8;
    }

    /* Checked Female (Rose Red / Pink) */
    .gender-pill-label.female input[type="radio"]:checked+.gender-pill-box {
        background: #ffe4e6;
        border-color: #f43f5e;
        color: #be123c;
        box-shadow: 0 2px 8px rgba(244, 63, 94, 0.2);
    }

    [data-theme="dark"] .gender-pill-label.female input[type="radio"]:checked+.gender-pill-box {
        background: rgba(244, 63, 94, 0.25);
        border-color: #fb7185;
        color: #fb7185;
    }

    .gender-pill-label:active .gender-pill-box {
        transform: scale(0.96);
    }

    /* Sheet Birth Calendar Box */
    .sheet-birth-box {
        display: flex;
        align-items: center;
        gap: 8px;
        width: 100%;
    }

    .sheet-date-input {
        flex: 1;
        border: none;
        outline: none;
        background: transparent;
        font-size: 0.95rem;
        font-weight: 700;
        color: inherit;
        cursor: pointer;
        padding: 4px 6px;
        border-radius: 6px;
        font-family: inherit;
        direction: ltr;
        text-align: right;
        transition: background 0.2s ease;
    }

    .sheet-date-input:focus,
    .sheet-date-input:hover {
        background: rgba(2, 132, 199, 0.08);
    }

    .sheet-age-badge {
        font-weight: 800;
        color: #0284c7;
        background: rgba(2, 132, 199, 0.12);
        padding: 3px 10px;
        border-radius: 6px;
        font-size: 0.82rem;
        white-space: nowrap;
        border: 1px solid rgba(2, 132, 199, 0.3);
    }

    /* Treatment Program Section */
    .treatment-banner {
        background: #0284c7;
        color: #ffffff;
        text-align: center;
        font-weight: 700;
        font-size: 0.95rem;
        padding: 6px 12px;
        letter-spacing: 0.5px;
        border: 1.5px solid #0284c7;
    }

    .treatment-grid-box {
        border: 1.5px solid #0284c7;
        border-top: none;
        padding: 16px 20px;
        display: grid;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 10px 20px;
        margin-bottom: 22px;
        background: #ffffff;
        direction: ltr !important;
    }

    [data-theme="dark"] .treatment-grid-box {
        background: #0f172a;
    }

    .treatment-item-box {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 8px;
        direction: ltr !important;
        font-size: 0.88rem;
        font-weight: 600;
        color: #1e293b;
        padding: 3px 0;
        cursor: pointer;
        user-select: none;
    }

    [data-theme="dark"] .treatment-item-box {
        color: #f1f5f9;
    }

    .treat-sq-box {
        width: 16px;
        height: 16px;
        border: 1.5px solid #64748b;
        border-radius: 3px;
        background: #ffffff;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        cursor: pointer;
    }

    .treat-sq-box.checked {
        background: #0284c7;
        border-color: #0284c7;
        color: #ffffff;
    }

    /* Ruled Lines Sections (Store: and Need:) */
    .sheet-ruled-section {
        margin-bottom: 18px;
        direction: rtl;
    }

    .sheet-ruled-label {
        font-size: 1.05rem;
        font-weight: 800;
        color: #000000;
        text-align: right;
        margin-bottom: 4px;
    }

    [data-theme="dark"] .sheet-ruled-label {
        color: #f8fafc;
    }

    /* Sheet Page Table Layout (for Screen & Multi-page Print Header/Footer) */
    .sheet-page-table {
        width: 100%;
        border-collapse: collapse;
        border: none;
        margin: 0;
        padding: 0;
    }

    .sheet-page-table>thead,
    .sheet-page-table>tbody,
    .sheet-page-table>tfoot,
    .sheet-page-table>thead>tr,
    .sheet-page-table>tbody>tr,
    .sheet-page-table>tfoot>tr,
    .sheet-page-table>thead>tr>td,
    .sheet-page-table>tbody>tr>td,
    .sheet-page-table>tfoot>tr>td {
        display: block;
        width: 100%;
        border: none;
        padding: 0;
        margin: 0;
    }

    .sheet-ruled-paper {
        width: 100%;
        background: #f8fafc;
        border: 1.5px solid #cbd5e1;
        border-radius: 8px;
        padding: 8px 12px;
        line-height: 1.6;
        font-size: 0.95rem;
        color: #0f172a;
        outline: none;
        text-align: right;
        direction: rtl;
        white-space: pre-wrap;
        word-break: break-word;
        font-family: 'Vazirmatn', -apple-system, sans-serif;
        box-sizing: border-box;
        field-sizing: content;
        height: auto;
        min-height: 70px;
        overflow-y: hidden;
        resize: vertical;
        transition: border-color 0.2s ease, background 0.2s ease;
    }

    .sheet-ruled-paper:focus {
        border-color: #0284c7;
        background: #ffffff;
        box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.12);
    }

    [data-theme="dark"] .sheet-ruled-paper {
        background: #1e293b;
        border-color: #334155;
        color: #f8fafc;
    }

    [data-theme="dark"] .sheet-ruled-paper:focus {
        border-color: #0284c7;
        background: #0f172a;
    }

    .store-paper {
        min-height: 90px;
    }

    .need-paper {
        min-height: 60px;
    }

    /* Bottom Signature & Motto Section (Anchored to Bottom) */
    .sheet-bottom-section {
        margin-top: auto;
        padding-top: 20px;
        width: 100%;
    }

    /* Physiotherapist Signature Line */
    .sheet-therapist-container {
        display: flex;
        justify-content: flex-start;
        align-items: flex-end;
        gap: 12px;
        margin-top: 10px;
        direction: ltr !important;
    }

    .sheet-therapist-text {
        font-weight: 800;
        font-size: 1rem;
        color: #000000;
        font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
        white-space: nowrap;
    }

    [data-theme="dark"] .sheet-therapist-text {
        color: #f8fafc;
    }

    .sheet-therapist-line-wrap {
        border-bottom: 1.5px solid #000000;
        min-width: 260px;
        display: flex;
        justify-content: center;
        align-items: center;
        padding-bottom: 2px;
    }

    [data-theme="dark"] .sheet-therapist-line-wrap {
        border-bottom-color: #f8fafc;
    }

    .sheet-therapist-input {
        border: none;
        outline: none;
        background: transparent;
        width: 100%;
        text-align: center;
        font-weight: 700;
        font-size: 1rem;
        color: #000000;
        font-family: inherit;
    }

    [data-theme="dark"] .sheet-therapist-input {
        color: #f8fafc;
    }

    .sheet-therapist-line {
        font-weight: 700;
        font-size: 1rem;
        color: #000000;
        text-align: center;
        display: block;
        width: 100%;
    }

    [data-theme="dark"] .sheet-therapist-line {
        border-bottom-color: #f8fafc;
        color: #f8fafc;
    }

    /* Sheet Footer with Motto */
    .sheet-bottom-footer {
        text-align: center;
        margin-top: 18px;
        padding-top: 4px;
    }

    .sheet-bottom-motto-row {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 16px;
        color: #0284c7;
        font-weight: 800;
        font-size: 1.18rem;
        font-family: 'Vazirmatn', sans-serif;
    }

    .motto-line {
        display: inline-block;
        width: 65px;
        height: 2px;
        background-color: #0284c7;
    }

    .motto-text {
        white-space: nowrap;
    }

    .sheet-bottom-motto::after {
        right: -30px;
    }

    /* ========================================================
   TABLES & DATA LISTS
======================================================== */
    .data-table-wrapper {
        width: 100%;
        overflow-x: auto;
    }

    .data-table {
        width: 100%;
        border-collapse: collapse;
        text-align: left;
    }

    body[dir="rtl"] .data-table {
        text-align: right;
    }

    .data-table th {
        background: var(--table-header);
        padding: 12px 16px;
        font-size: 0.8rem;
        font-weight: 700;
        color: var(--text-secondary);
        text-transform: uppercase;
        letter-spacing: 0.5px;
        border-bottom: 1px solid var(--border-color);
    }

    .data-table td {
        padding: 14px 16px;
        font-size: 0.9rem;
        border-bottom: 1px solid var(--border-color);
        vertical-align: middle;
    }

    .data-table tr:hover {
        background: var(--table-hover);
    }

    /* Badges */
    .badge {
        display: inline-flex;
        align-items: center;
        padding: 4px 10px;
        border-radius: var(--radius-full);
        font-size: 0.75rem;
        font-weight: 700;
    }

    .badge-success {
        background: var(--success-light);
        color: var(--success);
    }

    .badge-warning {
        background: var(--warning-light);
        color: var(--warning);
    }

    .badge-danger {
        background: var(--danger-light);
        color: var(--danger);
    }

    .badge-info {
        background: var(--info-light);
        color: var(--info);
    }

    .badge-secondary {
        background: var(--bg-main);
        color: var(--text-secondary);
        border: 1px solid var(--border-color);
    }

    [data-theme="dark"] .badge-success {
        background: rgba(16, 185, 129, 0.2);
        color: #34d399;
    }

    [data-theme="dark"] .badge-warning {
        background: rgba(245, 158, 11, 0.2);
        color: #fbbf24;
    }

    [data-theme="dark"] .badge-danger {
        background: rgba(239, 68, 68, 0.2);
        color: #f87171;
    }

    [data-theme="dark"] .badge-info {
        background: rgba(59, 130, 246, 0.2);
        color: #60a5fa;
    }

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

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

    .form-control {
        width: 100%;
        padding: 10px 14px;
        font-size: 0.9rem;
        border: 1px solid var(--input-border);
        border-radius: var(--radius-md);
        background: var(--input-bg);
        color: var(--text-primary);
        font-family: inherit;
        transition: var(--transition);
    }

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

    /* Filter Card */
    .filter-card {
        background: var(--card-bg);
        border-radius: var(--radius-lg);
        padding: 18px 24px;
        border: 1px solid var(--border-color);
        margin-bottom: 24px;
        box-shadow: var(--shadow-sm);
    }

    /* Progress Bar */
    .progress-bar-wrap {
        height: 8px;
        background: var(--border-color);
        border-radius: var(--radius-full);
        overflow: hidden;
        margin-top: 6px;
    }

    .progress-bar-fill {
        height: 100%;
        background: linear-gradient(90deg, #0284c7, #06b6d4);
        border-radius: var(--radius-full);
    }

    /* Treatment Tags */
    .treatment-tag {
        display: inline-block;
        background: var(--primary-light);
        color: var(--primary-hover);
        font-size: 0.75rem;
        font-weight: 600;
        padding: 2px 8px;
        border-radius: var(--radius-sm);
        margin: 2px;
    }

    [data-theme="dark"] .treatment-tag {
        background: rgba(2, 132, 199, 0.25);
        color: #38bdf8;
        border: 1px solid rgba(56, 189, 248, 0.3);
    }

    /* Alert Notification */
    .alert {
        padding: 14px 18px;
        border-radius: var(--radius-md);
        font-size: 0.9rem;
        margin-bottom: 20px;
        display: flex;
        align-items: center;
        gap: 12px;
    }

    .alert-success {
        background: #ecfdf5;
        color: #065f46;
        border: 1px solid #a7f3d0;
    }

    [data-theme="dark"] .alert-success {
        background: rgba(16, 185, 129, 0.15);
        color: #6ee7b7;
        border-color: rgba(16, 185, 129, 0.3);
    }

    /* Screen/Print Form Dual Display Helper */
    .form-print-only {
        display: none !important;
    }

    /* ========================================================
   PRINT STYLES (EXACT 1:1 A4 PHYSICAL PAPER SHEET)
======================================================== */
    @page {
        size: A4 portrait;
        margin: 8mm 10mm 8mm 10mm;
    }

    @media print {

        *,
        *::before,
        *::after {
            -webkit-print-color-adjust: exact !important;
            print-color-adjust: exact !important;
        }

        html,
        body {
            background: #ffffff !important;
            color: #000000 !important;
            margin: 0 !important;
            padding: 0 !important;
            font-size: 11.5px !important;
            height: auto !important;
        }

        .sidebar,
        .sidebar-backdrop,
        .mobile-bottom-bar,
        #mobileBottomBar,
        .topbar,
        .btn-action-no-print,
        .lang-dropdown-wrapper,
        .user-profile-wrapper,
        .user-profile-dropdown,
        .user-profile-widget,
        .user-modal-overlay,
        .toggle-sidebar-btn,
        .filter-card,
        .stats-grid,
        .page-title,
        .alert,
        #calendarBtn,
        #ageBadge,
        .form-screen-only {
            display: none !important;
            visibility: hidden !important;
            opacity: 0 !important;
        }

        .form-print-only {
            display: block !important;
        }

        span.form-print-only,
        strong.form-print-only {
            display: inline-block !important;
        }

        .sheet-print-text {
            font-size: 0.95rem !important;
            color: #000000 !important;
            padding: 3px 6px !important;
            line-height: 1.35 !important;
            word-break: break-word !important;
        }

        .treat-print-box {
            font-family: monospace !important;
            font-size: 0.95rem !important;
            margin-inline-end: 4px !important;
            color: #0284c7 !important;
            font-weight: 700 !important;
        }

        .app-layout {
            display: block !important;
        }

        .main-wrapper {
            margin: 0 !important;
            padding: 0 !important;
            width: 100% !important;
        }

        .content-body {
            margin: 0 !important;
            padding: 0 !important;
            max-width: 100% !important;
            width: 100% !important;
        }

        .vita-sheet-container {
            background: #ffffff !important;
            border: 2px solid #0284c7 !important;
            border-radius: 8px !important;
            box-shadow: none !important;
            margin: 0 auto !important;
            padding: 10px 14px !important;
            width: 100% !important;
            max-width: 100% !important;
            color: #000000 !important;
            box-sizing: border-box !important;
            direction: rtl !important;
            -webkit-box-decoration-break: clone !important;
            box-decoration-break: clone !important;
            min-height: auto !important;
            height: auto !important;
            display: block !important;
        }

        .sheet-page-table {
            display: table !important;
            width: 100% !important;
            border-collapse: collapse !important;
            border: none !important;
        }

        .sheet-page-table>thead {
            display: table-header-group !important;
        }

        .sheet-page-table>tfoot {
            display: table-footer-group !important;
        }

        .sheet-page-table>tbody {
            display: table-row-group !important;
        }

        .sheet-page-table>thead>tr,
        .sheet-page-table>tfoot>tr,
        .sheet-page-table>tbody>tr {
            display: table-row !important;
        }

        .sheet-page-table>thead>tr>td,
        .sheet-page-table>tfoot>tr>td,
        .sheet-page-table>tbody>tr>td {
            display: table-cell !important;
            border: none !important;
            padding: 0 !important;
        }

        .treatment-grid-box {
            display: grid !important;
            grid-template-columns: repeat(3, 1fr) !important;
            gap: 6px 16px !important;
            padding: 10px 14px !important;
            margin-bottom: 12px !important;
            direction: ltr !important;
        }

        .treatment-item-box {
            display: flex !important;
            align-items: center !important;
            justify-content: space-between !important;
            gap: 6px !important;
            direction: ltr !important;
            padding: 1px 0 !important;
        }

        .treat-name {
            font-size: 0.85rem !important;
            color: #000000 !important;
            font-weight: 600 !important;
        }

        .treat-sq-box {
            width: 15px !important;
            height: 15px !important;
            border: 1.5px solid #000000 !important;
            background: #ffffff !important;
        }

        .treat-sq-box.checked {
            background: #000000 !important;
        }

        .sheet-ruled-section {
            margin-bottom: 8px !important;
        }

        .sheet-header {
            border-bottom: 2px solid #0284c7 !important;
            padding-bottom: 12px !important;
            margin-bottom: 14px !important;
            display: grid !important;
            grid-template-columns: 1fr auto 1fr !important;
            align-items: center !important;
            width: 100% !important;
            direction: rtl !important;
        }

        .sheet-header-right {
            display: flex !important;
            justify-content: flex-start !important;
            align-items: center !important;
            text-align: right !important;
        }

        .sheet-kurdish-brand {
            display: flex !important;
            flex-direction: column !important;
            align-items: flex-start !important;
            line-height: 1.15 !important;
        }

        .sheet-ku-title {
            color: #0284c7 !important;
            font-size: 2.1rem !important;
            font-weight: 900 !important;
            line-height: 1.1 !important;
            margin: 0 !important;
            font-family: 'Vazirmatn', sans-serif !important;
        }

        .sheet-ku-sub {
            color: #0284c7 !important;
            font-size: 0.82rem !important;
            font-weight: 700 !important;
            margin-top: 2px !important;
            white-space: nowrap !important;
        }

        .sheet-header-center {
            display: flex !important;
            align-items: center !important;
            justify-content: center !important;
            padding: 0 16px !important;
        }

        .sheet-logo-spine {
            color: #0284c7 !important;
            stroke: #0284c7 !important;
            width: 48px !important;
            height: 48px !important;
            display: block !important;
        }

        .sheet-header-left {
            display: flex !important;
            justify-content: flex-end !important;
            align-items: center !important;
            text-align: left !important;
            direction: ltr !important;
        }

        .sheet-english-brand {
            display: flex !important;
            flex-direction: column !important;
            align-items: flex-start !important;
            line-height: 1.15 !important;
        }

        .sheet-en-title {
            font-size: 1.8rem !important;
            font-weight: 900 !important;
            color: #0284c7 !important;
            margin: 0 !important;
            line-height: 1.1 !important;
            letter-spacing: -0.5px !important;
        }

        .sheet-en-sub {
            color: #0284c7 !important;
            font-size: 0.72rem !important;
            font-weight: 800 !important;
            letter-spacing: 0.8px !important;
            margin-top: 2px !important;
            white-space: nowrap !important;
        }

        .sheet-grid-table {
            border: 1.5px solid #0284c7 !important;
            border-collapse: collapse !important;
            width: 100% !important;
            margin-bottom: 14px !important;
            direction: rtl !important;
        }

        .sheet-grid-table td {
            border: 1.5px solid #0284c7 !important;
            padding: 5px 8px !important;
            font-size: 0.88rem !important;
            color: #000000 !important;
            background: #ffffff !important;
        }

        .sheet-th-cell {
            background-color: #0284c7 !important;
            color: #ffffff !important;
            font-weight: 700 !important;
            font-size: 0.85rem !important;
            width: 86px !important;
            text-align: center !important;
        }

        .sheet-age-pill {
            background: rgba(2, 132, 199, 0.12) !important;
            color: #0284c7 !important;
            border: 1px solid rgba(2, 132, 199, 0.35) !important;
            border-radius: 6px !important;
            padding: 1px 8px !important;
            font-weight: 700 !important;
            font-size: 0.82rem !important;
            display: inline-flex !important;
        }

        .sheet-code-text {
            color: #0284c7 !important;
            font-weight: 800 !important;
            font-size: 1.05rem !important;
        }

        .treatment-banner {
            background-color: #0284c7 !important;
            color: #ffffff !important;
            text-align: center !important;
            font-weight: 700 !important;
            font-size: 0.92rem !important;
            padding: 5px 10px !important;
            border: 1.5px solid #0284c7 !important;
        }

        .treatment-grid-box {
            border: 1.5px solid #0284c7 !important;
            border-top: none !important;
            background: #ffffff !important;
            padding: 12px 18px !important;
            display: grid !important;
            grid-template-columns: repeat(3, 1fr) !important;
            gap: 8px 18px !important;
            margin-bottom: 14px !important;
            direction: rtl !important;
        }

        .treatment-item-box {
            display: flex !important;
            justify-content: flex-end !important;
            align-items: center !important;
            gap: 8px !important;
            direction: ltr !important;
            font-size: 0.82rem !important;
            font-weight: 600 !important;
            color: #000000 !important;
        }

        .treat-sq-box {
            width: 15px !important;
            height: 15px !important;
            border: 1.5px solid #64748b !important;
            border-radius: 3px !important;
            background: #ffffff !important;
            display: inline-flex !important;
            align-items: center !important;
            justify-content: center !important;
        }

        .treat-sq-box.checked {
            background: #0284c7 !important;
            border-color: #0284c7 !important;
            color: #ffffff !important;
        }

        .sheet-ruled-section {
            margin-bottom: 8px !important;
            direction: rtl !important;
            page-break-inside: auto !important;
        }

        .sheet-ruled-label {
            font-size: 0.95rem !important;
            font-weight: 800 !important;
            color: #0284c7 !important;
            margin-bottom: 2px !important;
            text-align: right !important;
        }

        .sheet-ruled-paper {
            background: transparent !important;
            background-image: none !important;
            border: none !important;
            box-shadow: none !important;
            padding: 2px 0 !important;
            margin: 0 !important;
            min-height: 0 !important;
            height: auto !important;
            max-height: none !important;
            font-size: 0.92rem !important;
            line-height: 1.55 !important;
            color: #000000 !important;
            text-align: right !important;
            direction: rtl !important;
            white-space: pre-wrap !important;
            word-break: break-word !important;
            overflow: visible !important;
            display: block !important;
        }

        .sheet-ruled-paper.store-paper,
        .store-paper,
        .sheet-ruled-paper.need-paper,
        .need-paper {
            min-height: 0 !important;
            height: auto !important;
            max-height: none !important;
            background: transparent !important;
            background-image: none !important;
            border: none !important;
        }

        .sheet-bottom-section {
            margin-top: auto !important;
            padding-top: 10px !important;
            width: 100% !important;
        }

        .sheet-therapist-container {
            display: flex !important;
            justify-content: flex-start !important;
            align-items: flex-end !important;
            gap: 12px !important;
            margin-top: 8px !important;
            direction: ltr !important;
        }

        .sheet-therapist-text {
            font-size: 0.95rem !important;
            font-weight: 800 !important;
            color: #000000 !important;
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
            white-space: nowrap !important;
        }

        .sheet-therapist-line-wrap {
            border-bottom: 1.5px solid #000000 !important;
            min-width: 250px !important;
            display: flex !important;
            justify-content: center !important;
            padding-bottom: 2px !important;
        }

        .sheet-therapist-line {
            border-bottom: 1.5px solid #000000 !important;
            min-width: 250px !important;
            text-align: center !important;
            color: #000000 !important;
            font-weight: 700 !important;
            font-size: 0.95rem !important;
            display: block !important;
        }

        .sheet-bottom-footer {
            text-align: center !important;
            margin-top: 10px !important;
            padding-top: 2px !important;
        }

        .sheet-bottom-motto-row {
            display: inline-flex !important;
            align-items: center !important;
            justify-content: center !important;
            gap: 14px !important;
            color: #0284c7 !important;
            font-weight: 800 !important;
            font-size: 1.05rem !important;
        }

        .motto-line {
            display: inline-block !important;
            width: 55px !important;
            height: 2px !important;
            background-color: #0284c7 !important;
        }
    }

    /* ========================================================
   TABLET & MOBILE RESPONSIVENESS SYSTEM
   Strict Preservation of Desktop (> 1024px): Zero Regressions
======================================================== */

    /* Tablet & Mid-Size Screens (iPad / Android Tablets <= 1024px) */
    @media (max-width: 1024px) {
        .treatment-grid-box {
            grid-template-columns: repeat(3, 1fr) !important;
        }

        /* Tablet panel stacking when appropriate */
        div[style*="grid-template-columns: 2fr 1fr"],
        div[style*="grid-template-columns:2fr 1fr"] {
            grid-template-columns: 1fr !important;
            gap: 20px !important;
        }

        .app-modal-dialog,
        div[style*="max-height:90vh"],
        div[style*="max-height: 90vh"] {
            max-height: 94vh !important;
            max-width: 95vw !important;
        }
    }

    /* Mobile & Touch Optimizations (iPhone & Android <= 768px) */
    @media (max-width: 768px) {

        /* 1. Prevent iOS Safari auto-zooming by setting 16px font-size on mobile inputs */
        input,
        select,
        textarea,
        button {
            font-size: 16px !important;
        }

        /* 2. Topbar Touch-friendly Horizontal Scrolling */
        .topbar {
            padding: 10px 14px !important;
            gap: 10px !important;
        }

        .topbar-right {
            display: flex !important;
            align-items: center !important;
            gap: 8px !important;
            max-width: 100% !important;
            flex-shrink: 0 !important;
        }

        .lang-dropdown-wrapper {
            flex-shrink: 0 !important;
        }

        .user-profile-widget {
            padding: 3px 10px 3px 4px !important;
            gap: 7px !important;
            flex-shrink: 0 !important;
        }

        body[dir="rtl"] .user-profile-widget {
            padding: 3px 4px 3px 10px !important;
        }

        .user-details {
            display: flex !important;
            flex-direction: column !important;
        }

        .user-name {
            font-size: 0.82rem !important;
            font-weight: 700 !important;
            max-width: 125px !important;
            overflow: hidden !important;
            text-overflow: ellipsis !important;
            white-space: nowrap !important;
        }

        .user-role-badge {
            display: none !important;
        }

        /* 3. Stack Multi-column Form Grids into a Single Clean Column on Smaller Screens */
        div[style*="grid-template-columns: 1fr 1fr"],
        div[style*="grid-template-columns:1fr 1fr"],
        div[style*="grid-template-columns: 2fr 1fr"],
        div[style*="grid-template-columns:2fr 1fr"],
        div[style*="grid-template-columns: repeat(auto-fit"],
        div[style*="grid-template-columns:repeat(auto-fit"],
        .form-grid,
        .form-grid-4,
        .form-grid-3,
        .form-grid-2 {
            grid-template-columns: 1fr !important;
            gap: 14px !important;
        }

        /* 4. Ensure Modals and Popups fit within Viewport Boundaries (94vh max-height) */
        .app-modal-overlay {
            padding: 12px !important;
            align-items: center !important;
            justify-content: center !important;
        }

        .app-modal-dialog,
        div[style*="max-height:90vh"],
        div[style*="max-height: 90vh"],
        div[style*="max-height: 94vh"],
        div[style*="max-height:94vh"] {
            max-height: 94vh !important;
            width: 96% !important;
            max-width: 96% !important;
            margin: auto !important;
            border-radius: 14px !important;
        }

        .app-modal-body,
        div[style*="overflow-y:auto"],
        div[style*="overflow-y: auto"] {
            max-height: calc(94vh - 70px) !important;
            overflow-y: auto !important;
            -webkit-overflow-scrolling: touch !important;
            padding: 14px !important;
        }

        /* 5. Stack Dual-column Panel Layouts Vertically on Mobile (Queue & Examination, Recent & Stats) */
        .dual-panel-grid,
        .stats-grid {
            grid-template-columns: 1fr !important;
            gap: 14px !important;
        }

        /* 6. Touch-Friendly Horizontal Scrolling for Data Tables */
        .table-responsive,
        .card:has(table),
        div:has(> table.data-table),
        div:has(> table) {
            width: 100% !important;
            overflow-x: auto !important;
            -webkit-overflow-scrolling: touch !important;
            scrollbar-width: thin !important;
        }

        table.data-table th,
        table.data-table td,
        table th,
        table td {
            white-space: nowrap !important;
            padding: 10px 12px !important;
        }

        /* 7. Mobile & Tablet: Replace Sidebar with Floating Facebook-Style Bottom Bar */
        .sidebar,
        .sidebar-backdrop,
        .toggle-sidebar-btn {
            display: none !important;
        }

        body[dir="ltr"] .main-wrapper,
        body[dir="rtl"] .main-wrapper {
            margin-left: 0 !important;
            margin-right: 0 !important;
            width: 100% !important;
            padding-bottom: 86px !important;
            /* Space for floating bottom bar */
        }

        /* Floating Facebook-style Bottom Navigation Bar */
        .mobile-bottom-bar {
            display: flex !important;
            position: fixed !important;
            bottom: 12px !important;
            left: 12px !important;
            right: 12px !important;
            max-width: 600px !important;
            margin: 0 auto !important;
            height: 58px !important;
            background: rgba(255, 255, 255, 0.96) !important;
            backdrop-filter: blur(16px) !important;
            -webkit-backdrop-filter: blur(16px) !important;
            border-radius: 9999px !important;
            border: 1px solid rgba(226, 232, 240, 0.9) !important;
            box-shadow: 0 10px 25px -3px rgba(0, 0, 0, 0.12), 0 4px 10px rgba(0, 0, 0, 0.05) !important;
            z-index: 9999 !important;
            align-items: center !important;
            justify-content: center !important;
            padding: 4px 8px !important;
            box-sizing: border-box !important;
        }

        [data-theme="dark"] .mobile-bottom-bar {
            background: rgba(15, 23, 42, 0.95) !important;
            border-color: rgba(51, 65, 85, 0.8) !important;
            box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5), 0 4px 12px rgba(0, 0, 0, 0.3) !important;
        }

        .mobile-bottom-bar-inner {
            display: flex !important;
            align-items: center !important;
            justify-content: space-around !important;
            width: 100% !important;
            height: 100% !important;
        }

        .bottom-nav-item {
            display: flex !important;
            align-items: center !important;
            justify-content: center !important;
            flex: 1 !important;
            height: 100% !important;
            color: #64748b !important;
            text-decoration: none !important;
            position: relative !important;
            transition: transform 0.15s ease, color 0.15s ease !important;
            -webkit-tap-highlight-color: transparent !important;
        }

        .bottom-nav-item:active {
            transform: scale(0.9) !important;
        }

        /* Active State: The Soft Blue Pill (Matching Facebook Image 2) */
        .bottom-nav-item.active .bottom-nav-icon-box {
            background: #e0f2fe !important;
            color: #0284c7 !important;
            border-radius: 20px !important;
            padding: 6px 14px !important;
        }

        [data-theme="dark"] .bottom-nav-item.active .bottom-nav-icon-box {
            background: rgba(2, 132, 199, 0.25) !important;
            color: #38bdf8 !important;
        }

        .bottom-nav-icon-box {
            position: relative !important;
            display: flex !important;
            align-items: center !important;
            justify-content: center !important;
            padding: 6px 10px !important;
            border-radius: 20px !important;
            transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
        }

        /* Red Notification Badge (Matching Image 2 Red 1 Badge) */
        .bottom-nav-badge {
            position: absolute !important;
            top: -4px !important;
            right: -4px !important;
            background: #ef4444 !important;
            color: #ffffff !important;
            font-size: 11px !important;
            font-weight: 800 !important;
            min-width: 18px !important;
            height: 18px !important;
            line-height: 18px !important;
            text-align: center !important;
            border-radius: 9999px !important;
            padding: 0 4px !important;
            border: 2px solid #ffffff !important;
            box-shadow: 0 2px 6px rgba(239, 68, 68, 0.45) !important;
        }

        [data-theme="dark"] .bottom-nav-badge {
            border-color: #0f172a !important;
        }

        .treatment-grid-box {
            grid-template-columns: repeat(3, 1fr) !important;
            gap: 8px 12px !important;
            padding: 12px 14px !important;
            direction: ltr !important;
        }

        .sheet-header {
            flex-direction: column !important;
            gap: 14px !important;
            text-align: center !important;
        }

        .sheet-brand-right {
            text-align: center !important;
        }

        .vita-sheet-container {
            padding: 14px 10px !important;
            border-radius: 10px !important;
            overflow-x: auto !important;
            -webkit-overflow-scrolling: touch !important;
        }

        .sheet-grid-table {
            min-width: 580px !important;
        }

        .content-body {
            padding: 14px 12px !important;
        }

        .btn {
            min-height: 40px !important;
        }

        .btn-sm {
            min-height: 34px !important;
        }
    }

    /* ========================================================
   DESKTOP PRESERVATION (> 1024px)
   100% Identical Spacing, Design & Zero Regressions
======================================================== */
    .mobile-bottom-bar {
        display: none;
    }

    @media (min-width: 1025px) {

        .toggle-sidebar-btn,
        .mobile-bottom-bar {
            display: none !important;
        }
    }