/* ===================================================
   Harbo Cure Pharma - Premium CSS with Dark Mode
   =================================================== */

/* ===== Light Theme Variables ===== */
:root,
[data-theme="light"] {
    --primary: #10b981;
    --primary-dark: #059669;
    --primary-glow: rgba(16, 185, 129, 0.25);
    --primary-light: #d1fae5;

    --bg: #f0f4f8;
    --bg-card: #ffffff;
    --bg-sidebar: #ffffff;
    --sidebar-text: #1e293b;
    --sidebar-text-muted: #64748b;
    --sidebar-hover: rgba(0, 0, 0, 0.04);
    --sidebar-divider: #e2e8f0;
    --sidebar-card-bg: rgba(0, 0, 0, 0.03);
    --bg-input: #ffffff;
    --bg-hover: #f8fafc;
    --bg-search: #f5f7fa;

    --text: #1e293b;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-inverse: #f1f5f9;

    --border: #e2e8f0;
    --border-light: #f1f5f9;

    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --purple: #8b5cf6;

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.08);
    --shadow-material: 0 10px 30px -5px rgba(0, 0, 0, 0.15);

    --topbar-bg: rgba(255, 255, 255, 0.85);
    --modal-bg: rgba(15, 23, 42, 0.4);
    --bnav-bg: rgba(255, 255, 255, 0.95);
}

/* ===== Dark Theme Variables ===== */
[data-theme="dark"] {
    --bg: #0f172a;
    --bg-card: #1e293b;
    --bg-sidebar: #020617;
    --sidebar-text: #e2e8f0;
    --sidebar-text-muted: #94a3b8;
    --sidebar-hover: rgba(255, 255, 255, 0.06);
    --sidebar-divider: rgba(255, 255, 255, 0.06);
    --sidebar-card-bg: rgba(255, 255, 255, 0.06);
    --bg-input: #334155;
    --bg-hover: #334155;
    --bg-search: #1e293b;

    --text: #e2e8f0;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    --text-inverse: #f1f5f9;

    --border: #334155;
    --border-light: #1e293b;

    --shadow-xs: 0 1px 3px rgba(0, 0, 0, 0.2);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.4);

    --topbar-bg: rgba(30, 41, 59, 0.9);
    --modal-bg: rgba(0, 0, 0, 0.6);
    --bnav-bg: rgba(30, 41, 59, 0.95);
}

/* ===== Constants ===== */
:root {
    --radius: 16px;
    --radius-sm: 10px;
    --radius-full: 999px;
    --font-bn: 'Noto Sans Bengali', 'Poppins', sans-serif;
    --font-en: 'Poppins', 'Noto Sans Bengali', sans-serif;
    --sidebar-w: 280px;
    --topbar-h: 68px;
    --bnav-h: 68px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);

    /* Font Sizes - Adjusted for better visibility */
    --fs-xs: 0.8rem;
    --fs-sm: 0.9rem;
    --fs-md: 1rem;
    --fs-lg: 1.15rem;
    --fs-xl: 1.3rem;
    --fs-2xl: 1.6rem;

    /* Spacing */
    --p-sm: 0.6rem;
    --p-md: 1.2rem;
    --p-lg: 1.6rem;

    /* Dynamic Scale Variables */
    --essential-font-scale: 1;
}

/* ===== Reset ===== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-bn);
    font-size: var(--fs-md);
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    line-height: 1.5;
    transition: background 0.3s, color 0.3s;
}

/* ===== Utility ===== */
.hidden {
    display: none !important;
}

.d-none-mobile {
    display: inline;
}

.pos-relative {
    position: relative;
}

.mb-4 {
    margin-bottom: 1.5rem;
}

.mb-6 {
    margin-bottom: 2rem;
}

.mt-4 {
    margin-top: 1.5rem;
}

.w-100 {
    width: 100%;
}

.req {
    color: var(--danger);
}

/* ===== Typography ===== */
h1,
h2,
h3,
h4 {
    font-family: var(--font-en);
    font-weight: 700;
    color: var(--text);
    line-height: 1.3;
    letter-spacing: -0.01em;
}

.page-title {
    font-size: var(--fs-2xl);
    font-weight: 800;
}

.page-sub {
    font-size: var(--fs-md);
}

a {
    text-decoration: none;
    color: inherit;
}

/* ===== Animations ===== */
.fade-in {
    animation: fadeIn 0.35s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes slideIn {
    to {
        transform: translateX(0);
    }
}

@keyframes modalIn {
    from {
        transform: scale(0.95) translateY(20px);
        opacity: 0;
    }

    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

@keyframes pulseGlow {

    0%,
    100% {
        box-shadow: 0 0 0 0 var(--primary-glow);
    }

    50% {
        box-shadow: 0 0 0 8px transparent;
    }
}

/* ===== Dot Waving Loader ===== */
.dot-waving {
    display: inline-flex;
    gap: 4px;
    align-items: center;
}

.dot-waving span {
    width: 6px;
    height: 6px;
    background: var(--primary);
    border-radius: 50%;
    animation: wave 1.2s linear infinite;
}

.dot-waving span:nth-child(2) {
    animation-delay: -1.1s;
}

.dot-waving span:nth-child(3) {
    animation-delay: -0.9s;
}

@keyframes wave {

    0%,
    60%,
    100% {
        transform: translateY(0);
    }

    30% {
        transform: translateY(-4px);
    }
}

/* ===== Buttons ===== */
button {
    cursor: pointer;
    font-family: inherit;
    transition: var(--transition);
    border: none;
    background: none;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.88rem;
    padding: 11px 22px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 22px var(--primary-glow);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-success {
    background: linear-gradient(135deg, #10b981, #047857);
    color: #fff;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 22px rgba(16, 185, 129, 0.35);
}

.btn-outline {
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1.5px solid var(--border);
}

.btn-outline:hover {
    background: var(--bg-hover);
    border-color: var(--text-muted);
}

.btn-outline-accent {
    background: transparent;
    color: var(--primary);
    border: 2px dashed var(--primary);
    border-radius: var(--radius-sm);
    padding: 14px 20px;
    font-weight: 600;
    width: 100%;
    font-size: 0.92rem;
}

.btn-outline-accent:hover {
    background: var(--primary-light);
    color: var(--primary-dark);
}

[data-theme="dark"] .btn-outline-accent:hover {
    background: rgba(16, 185, 129, 0.15);
}

.btn-sm {
    padding: 8px 14px;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 14px 32px;
    font-size: 0.95rem;
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn-x {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    background: var(--bg-hover);
}

.btn-x:hover {
    background: var(--border);
    color: var(--text);
}

.btn-icon-sm {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    background: var(--bg-hover);
    font-size: 0.9rem;
}

.btn-icon-sm:hover {
    background: var(--border);
    color: var(--text);
}

.btn-icon-sm.danger:hover {
    color: var(--danger);
    background: #fef2f2;
}

[data-theme="dark"] .btn-icon-sm.danger:hover {
    background: rgba(239, 68, 68, 0.15);
}

/* ===== Form Elements ===== */
label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-secondary);
    letter-spacing: 0.03em;
}

.input {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: inherit;
    background: var(--bg-input);
    color: var(--text);
    transition: var(--transition);
    appearance: none;
    -webkit-appearance: none;
}

.input::placeholder {
    color: var(--text-muted);
}

.input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.input-lg {
    padding: 14px 18px;
    font-size: 1rem;
}

select.input {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2394a3b8' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 34px;
    cursor: pointer;
}

textarea.input {
    resize: vertical;
    min-height: 70px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.fg-full {
    grid-column: 1/-1;
}

/* ===== Loader ===== */
.global-loader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(240, 244, 248, 0.85);
    backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
}

[data-theme="dark"] .global-loader {
    background: rgba(15, 23, 42, 0.85);
}

.loader-content {
    position: relative;
    width: 65px;
    height: 65px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pulse-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 3px solid var(--primary-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loader-icon {
    font-size: 26px;
    color: var(--primary);
}

.loader-text {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ===== Toast ===== */
.toast-container {
    position: fixed;
    bottom: 80px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--bg-card);
    color: var(--text);
    padding: 13px 20px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
    font-size: 0.88rem;
    border-left: 4px solid var(--primary);
    transform: translateX(120%);
    animation: slideIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    max-width: 340px;
}

.toast.error {
    border-left-color: var(--danger);
}

.toast.error i {
    color: var(--danger);
}

.toast.info {
    border-left-color: var(--info);
}

.toast i {
    color: var(--primary);
    font-size: 1.05rem;
    flex-shrink: 0;
}

/* ===== Layout ===== */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* ===== Sidebar ===== */
.sidebar {
    width: var(--sidebar-w);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--sidebar-divider);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    z-index: 1100;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(4px);
    z-index: 1050;
    display: none;
}

.sidebar-header {
    padding: 24px 22px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), #34d399);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #fff;
    box-shadow: 0 4px 14px var(--primary-glow);
}

.brand-name {
    font-family: var(--font-en);
    font-weight: 800;
    font-size: 1.15rem;
    display: block;
    letter-spacing: -0.03em;
    color: var(--sidebar-text);
}

.brand-sub {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 500;
    display: block;
    margin-top: -2px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.sidebar-close {
    color: var(--text-muted);
    font-size: 1.15rem;
    display: none;
}

.sidebar-user-card {
    margin: 8px 18px 18px;
    padding: 14px;
    background: var(--sidebar-card-bg);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #34d399);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #fff;
}

.su-name {
    display: block;
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--sidebar-text);
}

.su-role {
    display: block;
    font-size: 0.72rem;
    color: var(--primary);
    font-weight: 500;
    letter-spacing: 0.05em;
}

.nav-menu {
    flex: 1;
    padding: 0 12px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text-muted);
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
}

.nav-item i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
}

.nav-item:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text);
}

.nav-item.active {
    background: rgba(16, 185, 129, 0.15);
    color: var(--primary);
    font-weight: 600;
}

.nav-divider {
    height: 1px;
    background: var(--sidebar-divider);
    margin: 10px 16px;
}

.sidebar-footer {
    padding: 18px 22px;
    color: var(--text-muted);
    font-size: 0.7rem;
    text-align: center;
}

/* ===== Main Content ===== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: var(--transition);
}

/* ===== Topbar ===== */
.topbar {
    height: var(--topbar-h);
    background: var(--topbar-bg);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.hamburger {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    color: var(--text-secondary);
}

.hamburger:hover {
    background: var(--bg-hover);
}

.topbar-title {
    font-size: 1.2rem;
    color: var(--text);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

/* Theme Toggle */
.theme-toggle {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    color: var(--text-secondary);
    background: var(--bg-hover);
    transition: var(--transition);
    border: 1.5px solid var(--border);
}

.theme-toggle:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: var(--primary-light);
}

[data-theme="dark"] .theme-toggle:hover {
    background: rgba(16, 185, 129, 0.15);
}

.topbar-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 0.95rem;
    position: relative;
}

.topbar-btn:hover {
    background: var(--bg-hover);
    color: var(--primary);
}

/* ===== Theme Pill Toggle ===== */
.theme-pill {
    position: relative;
    width: 56px;
    height: 28px;
    border-radius: 20px;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 7px;
    transition: background 0.4s ease;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.2);
    outline: none;
}

[data-theme="dark"] .theme-pill {
    background: linear-gradient(135deg, #1e293b, #334155);
}

.theme-pill-sun, .theme-pill-moon {
    font-size: 0.7rem;
    z-index: 2;
    transition: all 0.3s ease;
}

.theme-pill-sun {
    color: #fff;
}

.theme-pill-moon {
    color: rgba(255,255,255,0.4);
}

[data-theme="dark"] .theme-pill-sun {
    color: rgba(255,255,255,0.3);
}

[data-theme="dark"] .theme-pill-moon {
    color: #fbbf24;
}

.theme-pill-slider {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    transition: transform 0.35s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

[data-theme="dark"] .theme-pill-slider {
    transform: translateX(28px);
    background: #1e293b;
    box-shadow: 0 2px 6px rgba(0,0,0,0.4), inset 0 0 0 2px #fbbf24;
}

/* ===== Recent Patient Cards ===== */
.see-more-link {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    background: var(--primary-light);
}

.see-more-link:hover {
    color: var(--primary-dark);
    transform: translateX(3px);
    background: rgba(16, 185, 129, 0.15);
}

.recent-patient-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 0;
}

#picker-patient-list.recent-patient-cards {
    gap: 0px;
    padding: 0px;
}

/* Patient List Picker Modal Item */
.picker-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    transition: all 0.2s ease;
}
.picker-item:last-child {
    border-bottom: none;
}
.picker-item:hover {
    background: var(--bg-hover);
}
.pi-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 1.1rem;
    flex-shrink: 0;
}
.pi-avatar.green { background: linear-gradient(135deg, #10b981, #059669); }
.pi-avatar.blue { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.pi-avatar.amber { background: linear-gradient(135deg, #f59e0b, #d97706); }
.pi-avatar.purple { background: linear-gradient(135deg, #8b5cf6, #7c3aed); }
.pi-avatar.pink { background: linear-gradient(135deg, #ec4899, #db2777); }

.pi-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.pi-name {
    font-weight: 600;
    color: var(--text-dark);
    font-size: 1.05rem;
}
.pi-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
}
.pi-action {
    color: var(--primary);
    opacity: 0;
    transition: opacity 0.2s;
}
.picker-item:hover .pi-action {
    opacity: 1;
}

.rp-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 18px;
    border-radius: var(--radius-md);
    background: var(--bg-card);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.rp-card:hover {
    border-color: var(--primary);
    background: var(--bg-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(16, 185, 129, 0.1);
}

[data-theme="dark"] .rp-card:hover {
    background: rgba(16, 185, 129, 0.05);
}



.rp-avatar {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 1.1rem;
    flex-shrink: 0;
    box-shadow: var(--shadow-xs);
}

.rp-avatar.green { background: linear-gradient(135deg, #10b981, #059669); }
.rp-avatar.blue { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.rp-avatar.amber { background: linear-gradient(135deg, #f59e0b, #d97706); }
.rp-avatar.purple { background: linear-gradient(135deg, #8b5cf6, #7c3aed); }
.rp-avatar.pink { background: linear-gradient(135deg, #ec4899, #db2777); }

.rp-info {
    flex: 1;
    min-width: 0;
}

.rp-name {
    display: block;
    font-weight: 700;
    color: var(--text);
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.rp-meta {
    display: flex;
    gap: 12px;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.rp-action-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-hover);
    color: var(--text-muted);
    transition: var(--transition);
}

.rp-card:hover .rp-action-icon {
    background: var(--primary);
    color: #fff;
    transform: translateX(2px);
}

.see-more-link {
    font-size: 0.82rem;
    color: var(--primary);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
    padding: 6px 12px;
    border-radius: 20px;
    background: var(--bg-hover);
}

.see-more-link:hover {
    background: var(--primary-light);
    transform: translateX(4px);
}

.notif-dot {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 10px;
    background: var(--danger);
    color: #fff;
    font-size: 0.65rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-card);
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.4);
    animation: pulseBadge 2s infinite;
}

@keyframes pulseBadge {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }

    70% {
        box-shadow: 0 0 0 6px rgba(239, 68, 68, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 9px;
    cursor: pointer;
    padding: 5px 10px 5px 5px;
    border-radius: var(--radius-full);
}

.topbar-user:hover {
    background: var(--bg-hover);
}

.topbar-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #34d399);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 14px;
}

.tu-name {
    display: block;
    font-weight: 600;
    font-size: 0.82rem;
    color: var(--text);
}

.tu-role {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 500;
}

.profile-dd {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    min-width: 170px;
    padding: 6px;
    z-index: 200;
    animation: fadeIn 0.2s ease-out;
}

.profile-dd a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.88rem;
    color: var(--text-secondary);
    transition: var(--transition);
}

.profile-dd a:hover {
    background: var(--bg-hover);
    color: var(--primary);
}

.profile-dd a i {
    width: 18px;
    text-align: center;
}

/* ===== Content ===== */
.content-wrapper {
    flex: 1;
    padding: 0 28px 28px 28px;
    overflow-y: auto;
}

.page-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 20px 24px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: var(--radius);
    color: #fff;
    gap: 12px;
    flex-wrap: wrap;
    box-shadow: 0 6px 20px var(--primary-glow);
    position: relative;
    overflow: hidden;
}

.page-head::before {
    content: '';
    position: absolute;
    right: -30px;
    top: -30px;
    width: 130px;
    height: 130px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    pointer-events: none;
}

.page-head::after {
    content: '';
    position: absolute;
    left: -20px;
    bottom: -20px;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(255,255,255,0.07);
    pointer-events: none;
}

.page-title {
    font-size: 1.3rem;
    margin-bottom: 2px;
    color: #fff;
    font-weight: 700;
    position: relative;
    z-index: 1;
}

.page-sub {
    color: rgba(255,255,255,0.85);
    font-size: 0.82rem;
    position: relative;
    z-index: 1;
}

.page-head .btn {
    position: relative;
    z-index: 1;
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    color: #fff;
    backdrop-filter: blur(8px);
    box-shadow: none;
    font-size: 0.82rem;
    padding: 9px 18px;
    border-radius: 12px;
    white-space: nowrap;
}

.page-head .btn:hover {
    background: rgba(255,255,255,0.35);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* ===== Welcome Banner ===== */
.welcome-banner {
    background: linear-gradient(135deg, #10b981, #059669, #047857);
    color: #fff;
    border-radius: var(--radius);
    padding: 28px 32px;
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.welcome-banner::before {
    content: '';
    position: absolute;
    right: -25px;
    top: -25px;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
}

.welcome-banner::after {
    content: '';
    position: absolute;
    right: 35px;
    bottom: -35px;
    width: 110px;
    height: 110px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.07);
}

.wb-text h2 {
    color: #fff;
    font-size: 1.4rem;
    margin-bottom: 6px;
}

.wb-text p {
    opacity: 0.9;
    font-size: 0.9rem;
}

.wb-art {
    font-size: 52px;
    opacity: 0.25;
    z-index: 1;
}

/* ===== Dashboard Feature Cards (Ultra Premium) ===== */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    margin-bottom: 35px;
}

.feature-card {
    background: var(--bg-card);
    border-radius: 24px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 22px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 1px solid var(--border-light);
    box-shadow: 0 10px 25px rgba(0,0,0,0.05);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(8px);
}

.feature-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0,0,0,0.12);
    border-color: var(--primary);
}

.fc-icon {
    width: 76px;
    height: 76px;
    border-radius: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    flex-shrink: 0;
    overflow: hidden;
}

.fc-icon svg {
    width: 40px;
    height: 40px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.feature-card:hover .fc-icon svg {
    transform: scale(1.15) rotate(-5deg);
}

.f-blue .fc-icon {
    background: linear-gradient(135deg, #6366f1, #3b82f6);
    color: #fff;
    box-shadow: 0 10px 25px rgba(59, 130, 246, 0.5), inset 0 2px 5px rgba(255,255,255,0.3);
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.f-green .fc-icon {
    background: linear-gradient(135deg, #10b981, #34d399);
    color: #fff;
    box-shadow: 0 10px 25px rgba(16, 185, 129, 0.5), inset 0 2px 5px rgba(255,255,255,0.3);
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.f-amber .fc-icon {
    background: linear-gradient(135deg, #f59e0b, #fbbf24);
    color: #fff;
    box-shadow: 0 10px 25px rgba(245, 158, 11, 0.5), inset 0 2px 5px rgba(255,255,255,0.3);
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.f-purple .fc-icon {
    background: linear-gradient(135deg, #8b5cf6, #a78bfa);
    color: #fff;
    box-shadow: 0 10px 25px rgba(139, 92, 246, 0.5), inset 0 2px 5px rgba(255,255,255,0.3);
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.feature-card:hover .fc-icon {
    transform: scale(1.1) rotate(-3deg);
    filter: brightness(1.1);
}

.fc-body h3 {
    font-size: 1.25rem;
    font-weight: 800;
    margin-bottom: 4px;
    color: var(--text);
}

.fc-body p {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 600;
}

.feature-card::after {
    content: '';
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    background: linear-gradient(225deg, rgba(255,255,255,0.1) 0%, transparent 50%);
    pointer-events: none;
}

/* ===== Stats ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 22px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 18px;
    box-shadow: var(--shadow-xs);
    border: 1px solid var(--border-light);
    cursor: pointer;
    transition: var(--transition);
    overflow: hidden;
}

.stat-card.tool-stat {
    border-left: 4px solid var(--primary);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.si {
    width: 68px;
    height: 68px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    flex-shrink: 0;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 8px 15px rgba(0,0,0,0.1);
}

.si.green {
    background: linear-gradient(135deg, #a7f3d0, #10b981);
    color: #fff;
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.25);
}

.si.blue {
    background: linear-gradient(135deg, #bfdbfe, #3b82f6);
    color: #fff;
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.25);
}

.si.amber {
    background: linear-gradient(135deg, #fde68a, #f59e0b);
    color: #fff;
    box-shadow: 0 8px 20px rgba(245, 158, 11, 0.25);
}

.si.purple {
    background: linear-gradient(135deg, #ddd6fe, #8b5cf6);
    color: #fff;
    box-shadow: 0 8px 20px rgba(139, 92, 246, 0.25);
}

.stat-info {
    flex: 1;
}

.stat-num {
    display: block;
    font-family: var(--font-en);
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1;
}

.stat-lbl {
    display: block;
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-top: 3px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.stat-arrow {
    color: var(--text-muted);
    font-size: 0.7rem;
    opacity: 0;
    transition: var(--transition);
}

.stat-card:hover .stat-arrow {
    opacity: 1;
    transform: translateX(3px);
}

/* ===== Easy BMI Premium Redesign ===== */
.bmi-form-vertical {
    padding: 10px 0;
}

.bmi-group-box {
    background: rgba(var(--primary-rgb, 59, 130, 246), 0.03);
    border: 1px solid var(--border-light);
    border-radius: 20px;
    padding: 20px;
    transition: all 0.3s ease;
}

.bmi-group-box:focus-within {
    border-color: var(--primary);
    background: rgba(var(--primary-rgb, 59, 130, 246), 0.06);
    box-shadow: 0 10px 20px rgba(var(--primary-rgb, 59, 130, 246), 0.1);
}

.bmi-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.bmi-header-row label {
    font-weight: 800;
    font-size: 1.05rem;
    color: var(--text);
    margin: 0;
}

.unit-switch {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-hover);
    padding: 4px 10px;
    border-radius: 30px;
    border: 1px solid var(--border-light);
}

.unit-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
}

/* Switch Premium */
.switch-premium {
    position: relative;
    display: inline-block;
    width: 34px;
    height: 18px;
}

.switch-premium input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-premium .slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: var(--border);
    transition: .4s;
    border-radius: 34px;
}

.switch-premium .slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

.switch-premium input:checked + .slider {
    background-color: var(--primary);
}

.switch-premium input:checked + .slider:before {
    transform: translateX(16px);
}

/* Input Premium */
.input-glow-wrap {
    position: relative;
    flex: 1;
}

.input-premium {
    width: 100%;
    height: 58px;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 16px;
    padding: 0 20px;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
    transition: all 0.3s;
    outline: none;
}

.input-premium:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(var(--primary-rgb, 59, 130, 246), 0.15);
}

.input-unit-hint {
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--primary);
    opacity: 0.6;
    pointer-events: none;
}

.bmi-dual-inputs {
    display: flex;
    gap: 12px;
}

.bmi-calc-btn-premium {
    height: 60px;
    font-size: 1.15rem;
    font-weight: 800;
    border-radius: 18px;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    box-shadow: 0 10px 25px rgba(59, 130, 246, 0.4);
    border: none;
    color: #fff;
    cursor: pointer;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
}

.bmi-calc-btn-premium:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px rgba(59, 130, 246, 0.5);
}

.btn-shine {
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(120deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: all 0.6s;
}

.bmi-calc-btn-premium:hover .btn-shine {
    left: 100%;
}

.input-with-icon .input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-glow);
}

.bmi-calc-btn {
    height: 54px;
    font-size: 1.1rem;
    font-weight: 700;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.bmi-result-box {
    margin-top: 30px;
    padding: 25px;
    background: var(--bg-card);
    border-radius: 20px;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-md);
    transform-origin: top;
    animation: slideDown 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes slideDown {
    from { opacity: 0; transform: scaleY(0.8); }
    to { opacity: 1; transform: scaleY(1); }
}

.bmi-gauge-wrap {
    text-align: center;
    position: relative;
    margin-bottom: 20px;
}

#bmi-value {
    font-size: 3.2rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--primary), #3b82f6);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1;
}

#bmi-status {
    font-size: 1.2rem;
    font-weight: 700;
    margin-top: 5px;
}

.bmi-gauge {
    position: relative;
    width: 100%;
    height: 20px;
    background: #e2e8f0;
    border-radius: 10px;
    margin-top: 25px;
    overflow: hidden;
}

.gauge-base {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    display: flex;
}

.gauge-fill {
    position: absolute;
    top: 0; left: 0; height: 100%;
    background: linear-gradient(to right, #3b82f6, #10b981, #f59e0b, #ef4444);
    width: 100%;
    opacity: 0.3;
}

.gauge-needle {
    position: absolute;
    top: 0; left: 24.2%; /* Dynamic */
    width: 4px;
    height: 100%;
    background: var(--text);
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
    transition: left 1s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 5;
}

.gauge-needle::after {
    content: '';
    position: absolute;
    top: -8px; left: -6px;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 10px solid var(--text);
}

.bmi-info-cards {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 15px;
}

.bmi-info-card {
    padding: 15px;
    background: var(--bg-hover);
    border-radius: 15px;
    display: flex;
    flex-direction: column;
}

.bmi-info-card.highlighted {
    background: var(--primary-light);
    border: 1.5px solid var(--primary);
}

.bmi-info-card .lbl { font-size: 0.8rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; }
.bmi-info-card .val { font-size: 1rem; color: var(--text); font-weight: 700; margin-top: 4px; }

.bmi-health-guide h5 { font-size: 1rem; font-weight: 800; margin-bottom: 12px; }
.bmi-table { width: 100%; border-collapse: collapse; }
.bmi-table td { padding: 10px 12px; font-size: 0.9rem; border-bottom: 1px solid var(--border-light); }
.bmi-table tr:last-child td { border-bottom: none; }
.bmi-table tr.active { background: var(--primary-light); font-weight: 700; }

.bmi-advice-alert {
    display: flex;
    gap: 12px;
    background: #fffbeb;
    padding: 15px;
    border-radius: 12px;
    border-left: 5px solid #f59e0b;
}

.bmi-advice-alert i { color: #f59e0b; font-size: 1.2rem; }
.bmi-advice-alert p { font-size: 0.88rem; color: #92400e; line-height: 1.5; margin: 0; }

[data-theme="dark"] .bmi-advice-alert { background: #451a03; border-color: #f59e0b; }
[data-theme="dark"] .bmi-advice-alert p { color: #fed7aa; }

/* ===== Material Icon Enhancements ===== */
.material-icon-wrap {
    width: 65px !important;
    height: 65px !important;
    font-size: 28px !important;
    border-radius: 18px !important;
    box-shadow: 0 8px 16px -4px rgba(0,0,0,0.15), inset 0 -4px 0 rgba(0,0,0,0.1);
    position: relative;
    overflow: hidden;
}

.material-icon-wrap::after {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(135deg, rgba(255,255,255,0.2), transparent);
}

.qa-icon.material-icon-wrap {
    width: 58px !important;
    height: 58px !important;
    font-size: 24px !important;
}


/* ===== Cards ===== */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: var(--p-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

/* Stepper Header */
.rx-stepper-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 24px;
    position: relative;
    padding: 10px 0;
}

.rx-stepper-header::before {
    content: '';
    position: absolute;
    top: 30px;
    left: 40px;
    right: 40px;
    height: 2px;
    background: var(--border);
    z-index: 1;
}

.rx-step-indicator {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.rsi-num {
    width: 40px;
    height: 40px;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: var(--fs-md);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.rx-step-indicator {
    cursor: pointer;
}

.rx-step-indicator:hover .rsi-num {
    border-color: var(--primary);
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15);
}

.rsi-label {
    font-size: var(--fs-xs);
    font-weight: 600;
    color: var(--text-muted);
    transition: all 0.3s;
}

.rx-step-indicator.active .rsi-num {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 0 0 4px var(--primary-glow);
    transform: scale(1.1);
}

.rx-step-indicator.active .rsi-label {
    color: var(--primary);
}

.rx-step-indicator.completed .rsi-num {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}

.rx-step-indicator.completed .rsi-label {
    color: var(--text);
}

/* Rx Step Content */
.rx-step-card {
    display: none; /* Hidden by default for stepper */
}

.rx-step-card.active {
    display: block;
    animation: fadeIn 0.4s ease-out;
}

/* Stepper Action Bar */
.rx-stepper-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.card-head {
    padding: 18px 22px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-light);
}

.card-head h3 {
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 0;
    color: var(--text);
}

.card-head h3 i {
    color: var(--primary);
    font-size: 0.9rem;
}

.chart-wrap {
    height: 280px;
    padding: 18px 22px 22px;
}

/* ===== Tables ===== */
.tbl-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 13px 18px;
    background: var(--bg-hover);
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--border);
}

td {
    padding: 13px 18px;
    font-size: 0.86rem;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-secondary);
    font-weight: 500;
}

tbody tr {
    transition: var(--transition);
}

tbody tr:hover {
    background: var(--bg-hover);
}

tbody tr:last-child td {
    border-bottom: none;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 11px;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 600;
}

.badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
}

.badge-success::before {
    background: #059669;
}

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: #d97706;
}

.badge-warning::before {
    background: #d97706;
}

.badge-info {
    background: rgba(59, 130, 246, 0.1);
    color: #2563eb;
}

.badge-info::before {
    background: #2563eb;
}

/* Search */
.search-box {
    padding: 14px 18px;
    position: relative;
    border-bottom: 1px solid var(--border-light);
}

.search-box i {
    position: absolute;
    left: 32px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.85rem;
}

.search-box input {
    width: 100%;
    padding: 11px 14px 11px 38px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-full);
    font-size: 0.88rem;
    font-family: inherit;
    background: var(--bg-search);
    color: var(--text);
    transition: var(--transition);
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
    background: var(--bg-input);
}

/* Autocomplete */
.ac-list {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 220px;
    overflow-y: auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    z-index: 200;
}

.ac-item {
    padding: 11px 15px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-light);
    transition: var(--transition);
    font-size: 0.88rem;
}

.ac-item:hover {
    background: var(--bg-hover);
    padding-left: 18px;
}

.ac-item:last-child {
    border-bottom: none;
}

/* =============================
   PRESCRIPTION DESIGN - Premium
   ============================= */
.rx-steps {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.rx-step-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-xs);
    overflow: hidden;
}

.rx-step-head {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 24px;
    background: var(--bg-hover);
    border-bottom: 1px solid var(--border-light);
}

.step-num {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-en);
    font-weight: 800;
    font-size: 0.9rem;
    flex-shrink: 0;
    box-shadow: 0 3px 10px var(--primary-glow);
}

.rx-step-head h4 {
    font-size: 1rem;
    margin: 0;
    color: var(--text);
}

.step-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.rx-step-body {
    padding: 24px;
}

/* Patient Select */
.patient-select-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ps-search label {
    font-size: 0.85rem;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    font-weight: 600;
}

.ps-divider {
    text-align: center;
    position: relative;
    margin: 4px 0;
}

.ps-divider::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 1px;
    background: var(--border);
}

.ps-divider span {
    background: var(--bg-card);
    position: relative;
    padding: 0 16px;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 600;
}

/* Selected Patient Card */
.sp-card {
    background: var(--bg-card);
    border: 2px solid var(--primary);
    border-radius: var(--radius);
    padding: 20px;
    position: relative;
    margin-top: 16px;
    animation: fadeIn 0.3s ease-out;
}

.sp-badge {
    position: absolute;
    top: -1px;
    right: 20px;
    background: var(--primary);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 0 0 8px 8px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.sp-main {
    display: flex;
    align-items: center;
    gap: 18px;
}

.sp-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #fff;
    flex-shrink: 0;
}

[data-theme="dark"] .sp-avatar {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.3), var(--primary));
}

.sp-details h4 {
    color: var(--primary-dark);
    font-size: 1.1rem;
    margin-bottom: 6px;
}

[data-theme="dark"] .sp-details h4 {
    color: var(--primary);
}

.sp-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 4px;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.sp-meta i {
    width: 14px;
    text-align: center;
    color: var(--primary);
    margin-right: 2px;
    font-size: 0.78rem;
}

.sp-change {
    position: absolute;
    bottom: 12px;
    right: 14px;
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    background: var(--bg-hover);
}

.sp-change:hover {
    background: var(--bg-card);
    color: var(--primary);
    border: 1px solid var(--primary);
}

/* =============================
   PREMIUM PATIENT CARDS
   ============================= */
.patient-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    padding: 10px 0;
}

/* Patient Management Cards */
.patient-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 1.2rem;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
}

.patient-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}

.pc-head {
    display: flex;
    align-items: center;
    gap: 15px;
}

.pc-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 700;
    flex-shrink: 0;
}

.pc-info h4 {
    font-size: 1.05rem;
    margin-bottom: 4px;
    color: var(--text);
}

.pc-id {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
}

.pc-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    font-size: 0.88rem;
}

.pc-meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
}

.pc-meta-item i {
    width: 16px;
    color: var(--primary);
    font-size: 0.85rem;
}

.pc-actions {
    display: flex;
    gap: 10px;
    margin-top: 5px;
    padding-top: 15px;
    border-top: 1px solid var(--border-light);
}

.pc-actions button {
    flex: 1;
    font-size: 0.78rem;
    padding: 8px;
}

/* =============================
   MEDICAL TOOLS (BMI, etc)
   ============================= */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
    margin-top: 24px;
}

.tool-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px;
    border: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 20px;
    cursor: pointer;
    transition: var(--transition);
}

.tool-card:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
}

.tool-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    background: var(--primary-light);
    color: var(--primary);
}

.tool-info h4 {
    font-size: 1rem;
    margin-bottom: 4px;
}

.tool-info p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.tip-card {
    background: linear-gradient(135deg, var(--primary), #059669);
    color: #fff;
    padding: 20px;
    border-radius: var(--radius);
    margin-top: 24px;
    display: flex;
    gap: 20px;
    align-items: center;
}

.tip-icon {
    font-size: 2.5rem;
    opacity: 0.4;
}

.tip-content h5 {
    font-size: 0.95rem;
    margin-bottom: 5px;
    color: #fff;
    opacity: 0.9;
}

.tip-content p {
    font-size: 0.9rem;
    line-height: 1.5;
}

/* BMI Calculator Modal Styles */
.bmi-input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 15px;
}

.bmi-result-box {
    margin-top: 20px;
    padding: 20px;
    border-radius: var(--radius);
    text-align: center;
    background: var(--bg-hover);
}

.bmi-value {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--primary);
}

.bmi-status {
    font-weight: 700;
    font-size: 1.1rem;
    margin-top: 5px;
}


.sp-change:hover {
    color: var(--danger);
    background: #fef2f2;
}

[data-theme="dark"] .sp-change:hover {
    background: rgba(239, 68, 68, 0.15);
}

/* Clinical Grid */
.clinical-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.clinical-card {
    background: var(--bg-hover);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 16px;
    transition: var(--transition);
}

.clinical-card:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.cc-label {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 7px;
}

.cc-label i {
    color: var(--primary);
    font-size: 0.9rem;
}

.clinical-card textarea.input {
    border-color: transparent;
    background: transparent;
    padding: 8px 0;
}

.clinical-card textarea.input:focus {
    background: transparent;
    box-shadow: none;
    border-color: transparent;
}

/* Medicine Add Box */
.med-add-box {
    background: linear-gradient(to bottom right, var(--surface), var(--bg-card));
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.02);
}

.med-add-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.mar-col label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.mar-name {
    flex: 2;
    min-width: 180px;
}

.mar-dose {
    flex: 1;
    min-width: 120px;
}

.mar-dur {
    flex: 0.8;
    min-width: 100px;
}

.mar-inst {
    flex: 1.5;
    min-width: 150px;
}

/* Patient Filter Bar */
.patient-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
    align-items: center;
}

.pfb-search {
    flex: 1;
    min-width: 250px;
    margin-bottom: 0;
}

.pfb-filters {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.pfb-select {
    min-width: 160px;
    background-color: var(--bg-input);
    border: 1px solid var(--border);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.9rem;
    transition: var(--transition);
}

.pfb-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
    outline: none;
}

/* Premium Patient Card*/
.patient-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
}



.patient-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-light);
}

.pc-head {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 16px;
    border-bottom: 1px dashed var(--border-light);
    padding-bottom: 16px;
}

.pc-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #059669);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 700;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.2);
}

.pc-info h4 {
    margin: 0 0 4px 0;
    font-size: 1.15rem;
    color: var(--text);
    font-weight: 700;
}

.pc-id {
    font-size: 0.8rem;
    color: var(--text-muted);
    background: var(--bg-hover);
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.pc-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
    flex-grow: 1;
}

.pc-meta-item {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.pc-meta-item i {
    color: var(--primary);
    opacity: 0.8;
    width: 14px;
    text-align: center;
}

.pc-meta-item.full-width {
    grid-column: 1 / -1;
}

.pc-actions {
    display: flex;
    gap: 10px;
    margin-top: auto;
}

.pc-actions .btn {
    flex: 1;
    padding: 8px;
    font-size: 0.85rem;
}

/* Compact Patient Body */
.pc-body.compact {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
    flex-grow: 1;
}

.pc-info-row {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    flex-wrap: wrap;
}

.pc-info-row span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.pc-info-row span i {
    color: var(--primary);
    opacity: 0.8;
}

@media(max-width: 640px) {
    .pfb-filters {
        width: 100%;
    }
    .pfb-select {
        flex: 1;
    }
    .pc-body {
        grid-template-columns: 1fr;
        gap: 8px;
    }
}


.mar-action {
    flex: 0 0 auto;
}

.btn-add-med {
    height: 44px;
    white-space: nowrap;
}

/* Medicine List */
.rx-med-list {
    margin-top: 20px;
    min-height: 80px;
}

.rx-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.rx-empty i {
    font-size: 2.5rem;
    opacity: 0.3;
    margin-bottom: 12px;
}

.rx-empty p {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 4px;
}

.rx-empty small {
    font-size: 0.82rem;
}

.rx-med-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    transition: var(--transition);
    animation: fadeIn 0.3s ease-out;
}

.rx-med-item:hover {
    border-color: var(--border);
    box-shadow: var(--shadow-xs);
}

.rmi-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

.rmi-info {
    flex: 1;
    min-width: 0;
}

.rmi-name {
    font-weight: 700;
    font-size: 0.92rem;
    color: var(--text);
}

.rmi-type {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-left: 6px;
    font-weight: 500;
}

.rmi-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 3px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.rmi-meta span {
    background: var(--bg-hover);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
}

.rmi-del {
    flex-shrink: 0;
}

/* Action Bar */
.rx-action-bar {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 10px 0 30px;
}

/* ===== Modals ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: var(--modal-bg);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-box {
    background: var(--bg-card);
    width: 100%;
    max-width: 540px;
    border-radius: var(--radius);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid var(--border);
}

.modal-head {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-head h3 {
    margin: 0;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--text);
}

.modal-head h3 i {
    color: var(--primary);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
}

.modal-foot {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--border-light);
}

/* ===== Preview Modal ===== */
.modal-wide {
    max-width: 660px;
}

/* ===== SVG Prescription Template ===== */
/* SVG viewBox: 0 0 595.28 785.83  — all % positions derived from that */
.svg-rx-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
    background: #fff;
    aspect-ratio: 595.28 / 785.83;
}

.svg-rx-bg {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
}

.svg-rx-overlay {
    position: absolute;
    z-index: 2;
    font-family: var(--font-bn);
    color: #231f20;
    box-sizing: border-box;
}

/* Doctor Name Area */
.svg-rx-doctor-name {
    top: 1.5%;      /* ~12px / 785.83 */
    left: 1.3%;     /* ~8px / 595.28 */
    width: 35%;     /* 208/595 */
    height: 13%;    /* 102/785 */
    font-size: clamp(8px, 1.8vw, 14px);
    font-weight: 700;
    color: #fff;
    line-height: 1.3;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    white-space: pre-line;
    display: flex;
    align-items: center;
    padding: 0 8px;
}

/* Patient Info - below the header */
.svg-rx-patient-info {
    top: 15%;       /* 118/785 */
    left: 26%;      /* 155/595 */
    width: 72%;
    height: 6%;     /* 47px band */
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1px 8px;
    font-size: clamp(7px, 1.3vw, 10.5px);
    line-height: 1.4;
    color: #231f20;
    padding: 2px 6px;
}

.svg-rx-patient-info b {
    font-weight: 700;
    color: #000;
}

/* Tests / Investigations Area */
.svg-rx-tests-area {
    top: 21.5%;     /* 169/785 */
    left: 0.8%;     /* small margin */
    width: 25.5%;   /* 152/595 */
    height: 29%;    /* (397-169)/785 = 29% */
    overflow: hidden;
    padding: 5px 7px;
    font-size: clamp(7px, 1.3vw, 10px);
}

.svg-rx-tests-title {
    display: none;
}

.svg-rx-tests-list {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.svg-rx-test-item {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: clamp(6px, 1.15vw, 10px);
    line-height: 1.35;
    color: #333;
}

.svg-rx-test-item::before {
    content: '☐';
    font-size: clamp(7px, 1.2vw, 11px);
    color: #666;
    flex-shrink: 0;
}

/* Advises Area */
.svg-rx-advices-area {
    top: 51%;       /* 400/785 */
    left: 0.8%;
    width: 25.5%;   /* 152/595 */
    height: 44%;    /* (745-400)/785 */
    overflow: hidden;
    padding: 5px 7px;
    font-size: clamp(6px, 1.2vw, 10px);
}

.svg-rx-advices-title {
    display: none;
}

.svg-rx-advices-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.svg-rx-advice-item {
    font-size: clamp(6px, 1.1vw, 10px);
    line-height: 1.35;
    color: #333;
    padding-left: 8px;
    position: relative;
}

.svg-rx-advice-item::before {
    content: '•';
    position: absolute;
    left: 0;
    color: #666;
}

/* Clinical Area (C/C, O/E, Diagnosis) */
.svg-rx-clinical-area {
    top: 21.5%;     /* same as tests area */
    left: 27%;      /* 160/595 */
    width: 20%;     /* narrow column */
    height: 30%;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: clamp(6px, 1.15vw, 10px);
    padding: 2px 4px;
}

.svg-rx-clinical-item {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.svg-rx-clinical-label {
    font-weight: 700;
    color: #00a651;
    text-transform: uppercase;
    font-size: clamp(6px, 1vw, 9px);
    letter-spacing: 0.03em;
    border-bottom: 1px dotted #ccc;
    padding-bottom: 1px;
    margin-bottom: 1px;
}

.svg-rx-clinical-val {
    color: #333;
    white-space: pre-wrap;
    line-height: 1.35;
}

/* Medicines Area (Rx) */
.svg-rx-medicines-area {
    top: 21.5%;     /* same start as tests/clinical */
    left: 47.5%;    /* ~283/595 */
    width: 51%;     /* remaining right portion */
    height: 73%;    /* most of page */
    overflow: hidden;
    padding: 4px 8px;
}

.svg-rx-rx-symbol {
    display: none;
}

.svg-rx-med-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.svg-rx-med-item {
    padding-bottom: 3px;
    border-bottom: 1px dashed #ddd;
}

.svg-rx-med-item:last-child {
    border-bottom: none;
}

.svg-rx-med-name {
    font-weight: 700;
    font-size: clamp(8px, 1.6vw, 13px);
    color: #000;
}

.svg-rx-med-type {
    font-size: clamp(6px, 1vw, 9px);
    color: #666;
    font-style: italic;
    margin-left: 3px;
}

.svg-rx-med-desc {
    font-size: clamp(7px, 1.2vw, 11px);
    color: #444;
    padding-left: 12px;
    line-height: 1.35;
}

.svg-rx-med-instruction {
    font-size: clamp(6px, 1vw, 9px);
    color: #888;
}

/* Footer Area - bottom strip */
.svg-rx-footer-area {
    bottom: 0.3%;
    left: 5%;
    width: 90%;
    text-align: center;
    font-size: clamp(7px, 1.2vw, 11px);
    display: flex;
    flex-direction: column;
    gap: 2px;
    color: #333;
}

.svg-rx-footer-msg {
    display: none;
}

/* ===== Bottom Nav ===== */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bnav-h);
    background: var(--bnav-bg);
    backdrop-filter: blur(16px);
    border-top: 1px solid var(--border);
    z-index: 1000;
    justify-content: space-around;
    align-items: center;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.bnav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    color: var(--text-muted);
    font-size: 0.65rem;
    font-weight: 600;
    padding: 7px 10px;
    border-radius: 8px;
    transition: var(--transition);
}

.bnav-item i {
    font-size: 1.1rem;
}

.bnav-item.active {
    color: var(--primary);
}

.bnav-fab {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 18px var(--primary-glow);
    margin-top: -22px;
    transition: var(--transition);
}

.bnav-fab:hover {
    transform: scale(1.1);
}

/* ===== Print ===== */
.print-only {
    display: none;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(128, 128, 128, 0.2);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(128, 128, 128, 0.35);
}

/* ===== RESPONSIVE ===== */
@media(max-width:1024px) {

    .stats-grid,
    .clinical-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media(max-width:768px) {
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
    }

    .sidebar.active {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }

    .sidebar-overlay.active {
        display: block;
    }

    .sidebar-close {
        display: flex;
    }

    .main-content {
        margin-left: 0;
    }

    .hamburger {
        display: flex;
    }

    .topbar {
        padding: 0 14px;
        height: 52px;
    }

    .topbar-title {
        font-size: 1.05rem;
    }

    .content-wrapper {
        padding: 0 14px 95px !important;
        margin-top: 0 !important;
    }

    .page-section, .page-head {
        margin-top: 0 !important;
    }

    .d-none-mobile {
        display: none !important;
    }

    .bottom-nav {
        display: flex;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .stat-card {
        padding: 16px 14px;
        gap: 12px;
    }

    .stat-num {
        font-size: 1.3rem;
    }

    .si {
        width: 44px;
        height: 44px;
        font-size: 18px;
    }

    .quick-actions {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .feature-card {
        padding: 16px 12px;
        gap: 12px;
        flex-direction: column;
        text-align: center;
        align-items: center;
        justify-content: center;
    }

    .fc-icon {
        width: 52px;
        height: 52px;
        border-radius: 16px;
    }

    .fc-icon svg {
        width: 28px;
        height: 28px;
    }

    .fc-body h3 {
        font-size: 0.95rem;
        margin-bottom: 4px;
    }

    .fc-body p {
        font-size: 0.75rem;
        line-height: 1.3;
    }

    .welcome-banner {
        padding: 22px;
    }

    .wb-text h2 {
        font-size: 1.1rem;
    }

    .wb-art {
        font-size: 36px;
    }

    .clinical-grid {
        grid-template-columns: 1fr;
    }

    .med-add-row {
        display: flex !important;
        flex-direction: column;
        gap: 12px;
    }

    .mar-col {
        width: 100%;
        flex: unset !important;
        min-width: unset !important;
    }

    .page-head {
        flex-direction: column;
        gap: 10px;
    }

    .page-title {
        font-size: 1.25rem;
    }

    .card-head {
        padding: 14px 16px;
    }

    .toast-container {
        bottom: 78px;
        left: 14px;
        right: 14px;
    }

    .toast {
        max-width: 100%;
    }

    .sp-main {
        flex-direction: column;
        text-align: center;
    }

    .sp-meta {
        justify-content: center;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    /* Responsive Tables — Card Layout for Mobile */
    .tbl-wrap {
        overflow-x: visible;
    }

    .tbl-wrap table thead {
        display: none;
    }

    .tbl-wrap table,
    .tbl-wrap table tbody,
    .tbl-wrap table tr,
    .tbl-wrap table td {
        display: block;
        width: 100%;
    }

    .tbl-wrap table tr {
        background: var(--bg-card);
        border: 1px solid var(--border);
        border-radius: var(--radius-sm);
        padding: 12px 14px;
        margin-bottom: 10px;
        position: relative;
    }

    .tbl-wrap table tr:hover {
        border-color: var(--primary);
    }

    .tbl-wrap table td {
        padding: 4px 0;
        border: none;
        text-align: left;
        font-size: 0.88rem;
    }

    .tbl-wrap table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-muted);
        display: inline-block;
        min-width: 90px;
        margin-right: 8px;
        font-size: 0.78rem;
        text-transform: uppercase;
    }

    .tbl-wrap table td:last-child {
        padding-top: 8px;
        margin-top: 6px;
        border-top: 1px solid var(--border);
    }
}

@media(max-width:400px) {
    .quick-actions {
        grid-template-columns: repeat(2, 1fr);
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }
}

@media print {
    @page {
        size: A4 portrait;
        margin: 0;
    }

    body * {
        visibility: hidden;
    }

    #print-template,
    #print-template * {
        visibility: visible;
    }

    #print-template {
        display: flex !important;
        position: fixed;
        left: 0;
        top: 0;
        width: 100vw;
        height: 100vh;
        background: #fff;
        z-index: 100000;
        align-items: center;
        justify-content: center;
    }

    /* Make the print wrapper use the SAME aspect-ratio as preview */
    /* so % positions are identical — no more mismatch */
    .svg-rx-print {
        position: relative;
        width: 100vw;
        height: 100vh;
        /* Maintain SVG aspect ratio (595.28 x 785.83) within A4 viewport */
        aspect-ratio: 595.28 / 785.83;
        max-width: calc(100vh * 595.28 / 785.83);
        margin: auto;
        box-shadow: none;
    }

    .svg-rx-print .svg-rx-bg {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        object-fit: fill;
    }

    .svg-rx-print .svg-rx-doctor-name {
        font-size: 13pt;
        line-height: 1.3 !important;
    }

    .svg-rx-print .svg-rx-patient-info {
        font-size: 9.5pt;
        gap: 1px 8px;
    }

    .svg-rx-print .svg-rx-med-name {
        font-size: 11pt !important;
    }

    .svg-rx-print .svg-rx-med-desc {
        font-size: 9pt !important;
    }

    .svg-rx-print .svg-rx-clinical-label {
        font-size: 8pt !important;
    }

    .svg-rx-print .svg-rx-clinical-val,
    .svg-rx-print .svg-rx-test-item,
    .svg-rx-print .svg-rx-advice-item {
        font-size: 9pt !important;
    }

    .svg-rx-print .svg-rx-med-type {
        font-size: 7pt;
    }

    .svg-rx-print .svg-rx-footer-area {
        font-size: 8pt;
    }

    .bottom-nav {
        display: none !important;
    }
}

/* ===== Settings / Profile Page ===== */
.settings-profile-header {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 24px;
}

.sph-cover {
    height: 140px;
    background: linear-gradient(135deg, #047857, #10b981, #34d399, #047857);
    background-size: 300% 300%;
    animation: gradientShift 8s ease infinite;
}

@keyframes gradientShift {

    0%,
    100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

.sph-cover {
    height: 140px;
    background: linear-gradient(135deg, var(--primary), #047857), url('https://www.transparenttextures.com/patterns/cubes.png');
    background-size: cover;
    background-blend-mode: overlay;
    position: relative;
    border-radius: var(--radius) var(--radius) 0 0;
}

[data-theme="dark"] .sph-cover {
    background: linear-gradient(135deg, #064e3b, #047857), url('https://www.transparenttextures.com/patterns/cubes.png');
    background-blend-mode: overlay;
}

.sph-info {
    display: flex;
    align-items: flex-end;
    gap: 18px;
    padding: 0 24px 20px;
    margin-top: -50px;
    position: relative;
    z-index: 2;
}

.sph-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ffffff, #f0fdf4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.8rem;
    color: var(--primary);
    border: 5px solid var(--bg-card);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.25);
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.sph-avatar:hover {
    transform: scale(1.05);
}

.sph-text {
    padding-bottom: 4px;
}

.sph-text h2 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 4px;
}

.sph-role-badge {
    display: inline-block;
    background: rgba(16, 185, 129, 0.15);
    color: var(--primary);
    border: 1px solid rgba(16, 185, 129, 0.3);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 3px 14px;
    border-radius: 20px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    box-shadow: 0 2px 10px rgba(16, 185, 129, 0.1);
}

.sph-subtitle {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.settings-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: calc(var(--radius) * 1.5);
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
}

.settings-card:hover {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
    border-color: rgba(16, 185, 129, 0.3);
    transform: translateY(-2px);
}

.sc-head {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-hover);
}

.sc-icon {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.1rem;
    flex-shrink: 0;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease;
}

.settings-card:hover .sc-icon {
    transform: scale(1.1) rotate(5deg);
}

.sc-head h3 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
    margin: 0;
}

.sc-head p {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 2px 0 0;
}

.sc-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.sc-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.sc-field label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.sc-field label i {
    font-size: 0.75rem;
    width: 16px;
    text-align: center;
    color: var(--text-muted);
}

.sc-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.sc-social-field label i {
    font-size: 0.9rem;
    width: 18px;
}

.settings-save-bar {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 0 40px;
}

.btn-save-settings {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.btn-save-settings:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
}

.btn-save-settings::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.5s, height 0.5s;
}

.btn-save-settings:active::after {
    width: 300px;
    height: 300px;
}

@media(max-width:768px) {
    .settings-grid {
        grid-template-columns: 1fr;
    }

    .sph-cover {
        height: 100px;
    }

    .sph-info {
        margin-top: -40px;
        gap: 14px;
        padding: 0 16px 16px;
    }

    .sph-avatar {
        width: 72px;
        height: 72px;
        font-size: 1.7rem;
    }

    .sph-text h2 {
        font-size: 1.1rem;
    }

    .sc-field-row {
        grid-template-columns: 1fr;
    }

    .settings-save-bar {
        flex-direction: column;
    }
}

/* ===== Chart Filter Buttons ===== */
.chart-filter-btn {
    background: var(--bg-hover);
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 4px 14px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
}

.chart-filter-btn:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: var(--primary-light);
}

.chart-filter-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.35);
}

[data-theme="dark"] .chart-filter-btn.active {
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
}

/* ===== LOGIN PAGE STYLES ===== */
.login-container {
    position: fixed;
    top: 0;
    left: 0;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f4c3a 0%, #0a2e23 40%, #041a14 100%);
    position: relative;
    overflow: hidden;
    padding: 20px;
}

[data-theme="dark"] .login-container {
    background: linear-gradient(135deg, #0a2e23 0%, #020e09 40%, #000 100%);
}

.login-bg-shapes {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 0;
}

.login-shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.4;
    animation: float 12s infinite ease-in-out alternate;
}

.login-shape.shape-1 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, #10b981, transparent 70%);
    top: -150px;
    left: -150px;
}

.login-shape.shape-2 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, #059669, transparent 70%);
    bottom: -100px;
    right: -100px;
    animation-delay: -5s;
}

.login-shape.shape-3 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, #fbbf24, transparent 70%);
    top: 50%;
    left: 60%;
    animation-duration: 15s;
    opacity: 0.2;
}

@keyframes float {
    0% {
        transform: translate(0, 0) scale(1);
    }

    100% {
        transform: translate(30px, 50px) scale(1.1);
    }
}

.login-card {
    position: relative;
    z-index: 1;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 28px;
    padding: 48px 36px 36px;
    width: 92%;
    max-width: 420px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    text-align: center;
    animation: loginCardIn 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes loginCardIn {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.96);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.login-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-bottom: 28px;
}

.login-logo svg {
    width: 72px;
    height: 72px;
    filter: drop-shadow(0 4px 12px rgba(16, 185, 129, 0.3));
    animation: logoPulse 3s ease-in-out infinite;
}

@keyframes logoPulse {

    0%,
    100% {
        transform: scale(1);
        filter: drop-shadow(0 4px 12px rgba(16, 185, 129, 0.3));
    }

    50% {
        transform: scale(1.05);
        filter: drop-shadow(0 6px 20px rgba(16, 185, 129, 0.5));
    }
}

.login-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.login-brand-name {
    font-size: 1.8rem;
    font-weight: 800;
    color: #fff;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.login-brand-sub {
    font-size: 0.85rem;
    font-weight: 600;
    color: #34d399;
    text-transform: uppercase;
    letter-spacing: 3px;
    margin-top: 2px;
}

.login-tagline {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 6px;
    font-weight: 400;
    letter-spacing: 0.5px;
}

.login-title {
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 6px;
    color: #fff;
}

.login-subtitle {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 28px;
}

.login-field {
    position: relative;
    margin-bottom: 18px;
    text-align: left;
}

.login-field i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.35);
    font-size: 1.05rem;
    pointer-events: none;
    transition: color 0.3s;
}

.login-input {
    width: 100%;
    padding: 15px 16px 15px 46px;
    border: 1.5px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.06);
    font-size: 0.95rem;
    font-family: inherit;
    color: #fff;
    transition: all 0.3s;
}

.login-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.login-input:focus {
    outline: none;
    border-color: #10b981;
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.15);
}

.login-input:focus~i,
.login-field:focus-within i {
    color: #34d399;
}

.login-error {
    margin-top: 0;
    margin-bottom: 12px;
    color: #fca5a5;
    font-size: 0.85rem;
    font-weight: 500;
    background: rgba(239, 68, 68, 0.15);
    padding: 10px 14px;
    border-radius: 10px;
    text-align: center;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.login-remember {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    user-select: none;
}

.login-remember input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #10b981;
    cursor: pointer;
}

.login-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #10b981 0%, #059669 50%, #047857 100%);
    color: #fff;
    border: none;
    border-radius: 14px;
    font-size: 1.05rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.35);
    letter-spacing: 0.3px;
}

.login-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    animation: btnShimmer 2.5s infinite;
}

@keyframes btnShimmer {
    0% {
        left: -100%;
    }

    100% {
        left: 100%;
    }
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(16, 185, 129, 0.45);
}

.login-btn:active {
    transform: translateY(0);
}

.login-footer {
    margin-top: 28px;
    padding-top: 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.login-footer small {
    color: rgba(255, 255, 255, 0.3);
    font-size: 0.75rem;
}

/* Prescription History Premium Cards */
.history-cards {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.history-card-premium {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.history-card-premium::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 70%;
    border-radius: 0 4px 4px 0;
}

.history-card-premium.status-done::before { background: var(--success); }
.history-card-premium.status-pending::before { background: var(--warning); }
.history-card-premium.status-new::before { background: var(--info); }

.history-card-premium:hover {
    transform: translateX(6px);
    border-color: var(--primary);
    background: var(--bg-hover);
    box-shadow: var(--shadow-md);
}

.hcp-icon {
    width: 54px;
    height: 54px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.3rem;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.hcp-text {
    flex: 1;
}

.hcp-text h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 3px;
}

.hcp-text p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.hcp-meta {
    display: flex;
    gap: 12px;
    margin-top: 6px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.hcp-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.hcp-actions {
    display: flex;
    gap: 8px;
}

.hcp-actions .btn-icon-sm {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: var(--bg-body);
    border: 1px solid var(--border);
}

.hcp-actions .btn-icon-sm:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.rp-card.status-done { border-left-color: var(--success); }
.rp-card.status-pending { border-left-color: var(--warning); }
.rp-card.status-new { border-left-color: var(--info); }

.rp-avatar {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: #fff;
    font-size: 1.15rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.rp-info { flex: 1; min-width: 0; }
.rp-name { display: block; font-weight: 700; font-size: 1.05rem; color: var(--text); margin-bottom: 4px; }
.rp-meta { display: flex; flex-wrap: wrap; gap: 12px; font-size: 0.8rem; color: var(--text-muted); }
.rp-meta span { display: flex; align-items: center; gap: 4px; }

/* Medicine Table Polish */
.med-row-premium {
    transition: var(--transition);
}
.med-row-premium:hover {
    background: var(--bg-hover);
}
.med-badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
}

/* ===== Ultra-Premium Profile App View ===== */
.profile-app-view {
    padding: 0 !important;
    background: var(--bg-body);
}

.profile-app-header {
    background: linear-gradient(rgba(16, 185, 129, 0.75), rgba(4, 120, 87, 0.85)), url('https://karianaquran.com/wp-content/uploads/2026/01/kariana-quran-cover-or-bacground-design-.png') no-repeat center center / cover;
    padding: 30px 24px 60px 24px;
    border-bottom-left-radius: 36px;
    border-bottom-right-radius: 36px;
    position: relative;
    color: #fff;
    overflow: visible;
    box-shadow: 0 10px 30px var(--primary-glow);
}

.profile-app-header::before {
    content: '';
    position: absolute;
    top: -50px;
    right: -50px;
    width: 250px;
    height: 250px;
    background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.profile-app-header::after {
    content: '';
    position: absolute;
    bottom: -30px;
    left: -20px;
    width: 150px;
    height: 150px;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.pah-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    position: relative;
    z-index: 2;
}

.pah-icon-btn {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.pah-icon-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

/* Settings Hub Styles */
.settings-hub {
    padding: 10px 16px 120px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.settings-menu-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
}

.settings-menu-item:hover {
    transform: translateX(6px);
    border-color: var(--primary);
    background: var(--bg-hover);
    box-shadow: var(--shadow-md);
}

.settings-menu-item:active {
    transform: scale(0.98);
}

.smi-icon {
    width: 50px;
    height: 50px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.smi-text {
    flex: 1;
}

.smi-text h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 2px;
}

.smi-text p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.smi-arrow {
    color: var(--text-muted);
    font-size: 0.9rem;
    opacity: 0.5;
    transition: var(--transition);
}

.settings-menu-item:hover .smi-arrow {
    opacity: 1;
    color: var(--primary);
    transform: translateX(2px);
}

/* Modal Body Field Polish */
.modal-body .sc-field {
    margin-bottom: 20px;
}

.modal-body .sc-field label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.modal-body .sc-field label i {
    width: 20px;
    color: var(--primary);
}

.modal-body .sc-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 480px) {
    .modal-body .sc-field-row {
        grid-template-columns: 1fr;
    }
}

.pah-icon-btn:hover {
    background: rgba(255, 255, 255, 0.35);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.pah-content {
    position: relative;
    z-index: 2;
    padding-right: 100px; /* Space for avatar */
    max-width: 100%;
    box-sizing: border-box;
}

.pah-content h2 {
    font-size: 1.9rem;
    font-weight: 800;
    margin-bottom: 4px;
    letter-spacing: -0.5px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.pah-content p {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 12px;
}

.pah-role-badge {
    display: inline-block;
    padding: 6px 16px;
    background: rgba(255, 255, 255, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    backdrop-filter: blur(4px);
}

.pah-avatar-wrapper {
    position: absolute;
    bottom: -40px;
    right: 32px;
    z-index: 10;
}

.pah-avatar-wrapper .ph-avatar {
    width: 90px;
    height: 90px;
    border-radius: 28px; /* Squircle style */
    background: #fff;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.8rem;
    color: var(--primary);
    border: 4px solid var(--bg-body);
    overflow: hidden;
    position: relative;
}

.pah-avatar-wrapper .ph-edit-btn {
    position: absolute;
    bottom: -6px;
    right: -6px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #10b981;
    color: #fff;
    border: 3px solid var(--bg-body);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
    transition: transform 0.2s;
    z-index: 11;
}

.pah-avatar-wrapper .ph-edit-btn:hover {
    transform: scale(1.1) rotate(5deg);
    background: #059669;
}

.profile-app-body {
    padding: 60px 24px 40px 24px; /* Top padding handles the overlapping avatar */
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 800px;
    margin: 0 auto;
}

.profile-app-body .settings-card {
    background: var(--bg-card);
    border-radius: 24px;
    border: 1px solid var(--border-light);
    box-shadow: 0 8px 24px rgba(0,0,0,0.03);
    overflow: hidden;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.profile-app-body .settings-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 32px rgba(0,0,0,0.06);
    border-color: rgba(59, 130, 246, 0.2);
}

.profile-app-body .sc-head {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 16px;
    background: rgba(0,0,0,0.01);
}

.profile-app-body .sc-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.3rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.profile-app-body .sc-head h3 {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 2px;
}

.profile-app-body .sc-head p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.profile-app-body .sc-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.profile-app-body .sc-field input, 
.profile-app-body .sc-field select, 
.profile-app-body .sc-field textarea {
    border-radius: 12px;
    background: var(--bg-input);
    border: 1px solid transparent;
    padding: 14px 16px;
    color: var(--text);
    transition: all 0.3s;
}

.profile-app-body .sc-field input:focus, 
.profile-app-body .sc-field select:focus, 
.profile-app-body .sc-field textarea:focus {
    background: var(--bg-card);
    border-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.profile-action-bar {
    display: flex;
    justify-content: center;
    gap: 16px;
    padding: 20px 24px 40px 24px;
    max-width: 800px;
    margin: 0 auto;
}

.btn-app-save {
    flex: 2;
    padding: 16px;
    border-radius: 16px;
    font-size: 1.05rem;
    font-weight: 700;
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.25);
}

.btn-app-logout {
    flex: 1;
    padding: 16px;
    border-radius: 16px;
    font-size: 1.05rem;
    font-weight: 700;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    border: none;
    box-shadow: 0 8px 20px rgba(239, 68, 68, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-app-logout:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 25px rgba(239, 68, 68, 0.35);
}

[data-theme="dark"] .profile-app-body .settings-card {
    background: #1e293b;
    border-color: rgba(255,255,255,0.05);
}
[data-theme="dark"] .profile-app-header {
    background: linear-gradient(135deg, var(--primary-dark), #0369a1);
}

/* ===== Premium Range Sliders ===== */
.premium-range {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 5px;
    background: linear-gradient(to right, var(--primary-light), var(--primary));
    outline: none;
    cursor: pointer;
}

.premium-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.35);
    border: 3px solid white;
    transition: transform 0.2s ease;
}

.premium-range::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.premium-range::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    cursor: pointer;
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.35);
}

.purple-range {
    background: linear-gradient(to right, rgba(139,92,246,0.2), #8b5cf6);
}

.purple-range::-webkit-slider-thumb {
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.35);
}

.purple-range::-moz-range-thumb {
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.35);
}

.amber-range {
    background: linear-gradient(to right, rgba(245,158,11,0.2), #f59e0b);
}

.amber-range::-webkit-slider-thumb {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.35);
}

.amber-range::-moz-range-thumb {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.35);
}

/* ===== Global Overflow Prevention ===== */
html, body {
    max-width: 100vw;
    overflow-x: hidden;
}

.app-container,
.main-content,
.content-wrapper,
.page-section {
    max-width: 100%;
    overflow-x: hidden;
}

/* Global input responsive constraint */
input, select, textarea, .input {
    max-width: 100%;
    box-sizing: border-box;
}

/* ===== History Card Premium Layout ===== */
.history-card-premium {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    overflow: hidden;
    max-width: 100%;
}

.history-card-premium:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.history-card-premium.status-done {
    border-left: 3px solid var(--primary);
}

.history-card-premium.status-pending {
    border-left: 3px solid var(--warning);
}

.history-card-premium.status-new {
    border-left: 3px solid var(--info);
}

.hcp-icon {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.2rem;
    font-weight: 700;
    flex-shrink: 0;
}

.hcp-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.hcp-text h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0 0 2px 0;
}

.hcp-text p {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0 0 6px 0;
}

.hcp-meta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.hcp-meta span {
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
}

.hcp-meta span i {
    font-size: 0.7rem;
    color: var(--primary);
}

.hcp-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.btn-icon-sm {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    color: var(--text-secondary);
    background: var(--bg-hover);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
}

.btn-icon-sm:hover {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
}

/* ===== Small Mobile Responsive Overrides (≤ 480px) ===== */
@media (max-width: 480px) {
    .topbar {
        padding: 0 10px;
    }

    .topbar-right {
        gap: 4px;
    }

    .topbar-btn,
    .theme-toggle {
        width: 34px;
        height: 34px;
        font-size: 0.9rem;
    }

    .topbar-avatar {
        width: 32px;
        height: 32px;
    }

    .theme-pill {
        width: 48px;
        height: 24px;
    }

    .theme-pill .pill-icon {
        width: 20px;
        height: 20px;
        font-size: 10px;
    }

    .content-wrapper {
        padding: 0 10px 90px !important;
    }

    .history-card-premium {
        padding: 12px;
        gap: 10px;
    }

    .hcp-icon {
        width: 38px;
        height: 38px;
        min-width: 38px;
        font-size: 1rem;
    }

    .hcp-text h3 {
        font-size: 0.9rem;
    }

    .hcp-text p {
        font-size: 0.75rem;
    }

    .hcp-actions {
        flex-direction: column;
        gap: 4px;
    }

    .btn-icon-sm {
        width: 30px;
        height: 30px;
        font-size: 0.8rem;
    }

    .welcome-banner {
        padding: 16px;
    }

    .wb-text h2 {
        font-size: 1rem;
    }

    .wb-art {
        font-size: 28px;
    }

    .brand h2 {
        font-size: 1rem;
    }

    .brand small {
        font-size: 0.6rem;
    }

    .settings-hub {
        padding: 10px !important;
    }

    .settings-menu-item {
        padding: 12px !important;
    }

    .view-header {
        padding: 18px 14px 30px 14px !important;
    }

    .view-header h2 {
        font-size: 1.2rem !important;
    }

    /* Profile screen */
    .profile-app-header {
        padding: 22px 16px 50px 16px;
    }

    .pah-content {
        padding-right: 10px !important;
    }

    .pah-content h2 {
        font-size: 1.3rem !important;
    }
}

/* ===== Extra Small Mobile (≤ 360px) ===== */
@media (max-width: 360px) {
    .topbar {
        padding: 0 8px;
    }

    .topbar-right {
        gap: 2px;
    }

    .topbar-btn,
    .theme-toggle {
        width: 30px;
        height: 30px;
        font-size: 0.8rem;
    }

    .theme-pill {
        width: 42px;
        height: 22px;
    }

    .content-wrapper {
        padding: 0 8px 90px !important;
    }

    .stat-card {
        padding: 12px 10px;
    }

    .stat-num {
        font-size: 1.1rem;
    }

    .si {
        width: 38px;
        height: 38px;
        font-size: 16px;
    }

    .feature-card {
        padding: 12px 8px;
    }

    .fc-icon {
        width: 44px;
        height: 44px;
    }

    .fc-body h3 {
        font-size: 0.85rem;
    }

    .history-card-premium {
        padding: 10px;
        gap: 8px;
        flex-wrap: wrap;
    }

    .hcp-actions {
        flex-direction: row;
        width: 100%;
        justify-content: flex-end;
    }
}