:root {
    --brand: #1A7FBF;
    --brand-dark: #156aa0;
    --secondary: #29B6A8;
    --accent: #F4A83A;
    --danger: #E84C4C;
    --bg: #F5F8FC;
    --surface: #FFFFFF;
    --text: #1D2B3A;
    --muted: #6B7C93;
    --radius: 12px;
    --shadow: 0 6px 20px rgba(26, 127, 191, .08);
    --shadow-sm: 0 2px 8px rgba(29, 43, 58, .06);
}

* {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5 {
    font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
    font-weight: 700;
    color: var(--text);
}

body {
    background: var(--bg);
    color: var(--text);
    font-size: .95rem;
}

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

a:hover { color: #135f8f; }

/* Buttons & brand colors */
.btn-primary {
    --bs-btn-bg: var(--brand);
    --bs-btn-border-color: var(--brand);
    --bs-btn-hover-bg: #156aa0;
    --bs-btn-hover-border-color: #156aa0;
    --bs-btn-active-bg: #135f8f;
    --bs-btn-disabled-bg: var(--brand);
    --bs-btn-disabled-border-color: var(--brand);
}

.btn-secondary {
    --bs-btn-bg: var(--secondary);
    --bs-btn-border-color: var(--secondary);
    --bs-btn-hover-bg: #229a8e;
    --bs-btn-hover-border-color: #229a8e;
    --bs-btn-color: #fff;
    --bs-btn-hover-color: #fff;
}

.btn-accent {
    --bs-btn-bg: var(--accent);
    --bs-btn-color: #4a3208;
    --bs-btn-border-color: var(--accent);
    --bs-btn-hover-bg: #e89b27;
    --bs-btn-hover-border-color: #e89b27;
    --bs-btn-hover-color: #4a3208;
}

.btn-outline-primary {
    --bs-btn-color: var(--brand);
    --bs-btn-border-color: var(--brand);
    --bs-btn-hover-bg: var(--brand);
    --bs-btn-hover-border-color: var(--brand);
}

.text-brand { color: var(--brand) !important; }
.text-secondary-2 { color: var(--secondary) !important; }
.bg-brand { background: var(--brand) !important; }
.bg-brand-soft { background: rgba(26,127,191,.08) !important; }
.bg-secondary-soft { background: rgba(41,182,168,.10) !important; }
.bg-accent-soft { background: rgba(244,168,58,.12) !important; }

/* Cards */
.card {
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    background: var(--surface);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid #eef2f7;
    font-weight: 600;
    padding: 1rem 1.25rem;
}

.stat-card {
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    background: var(--surface);
    display: flex;
    align-items: center;
    gap: 1rem;
    height: 100%;
}

.stat-card .stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-size: 1.35rem;
    flex-shrink: 0;
}

.stat-card .stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1;
    font-family: 'Plus Jakarta Sans', sans-serif;
}

.stat-card .stat-label {
    color: var(--muted);
    font-size: .82rem;
}

/* Forms */
.form-control, .form-select {
    border-radius: 10px;
    border-color: #e1e8f0;
    padding: .55rem .85rem;
}

.form-control:focus, .form-select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 .2rem rgba(26,127,191,.12);
}

.form-label { font-weight: 500; font-size: .88rem; color: #344a5e; }

/* Sidebar (admin + patient) */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 256px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    position: fixed;
    top: 0; bottom: 0; left: 0;
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: transform .25s ease;
}

.sidebar-brand {
    padding: 1.15rem 1.25rem;
    display: flex;
    align-items: center;
    gap: .6rem;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--brand);
    border-bottom: 1px solid #eef2f7;
}

.sidebar-nav { padding: .75rem; overflow-y: auto; flex: 1; }

.sidebar-nav .nav-link {
    color: #44566b;
    border-radius: 10px;
    padding: .6rem .8rem;
    display: flex;
    align-items: center;
    gap: .7rem;
    font-weight: 500;
    margin-bottom: .15rem;
}

.sidebar-nav .nav-link i { width: 20px; text-align: center; }

.sidebar-nav .nav-link:hover { background: var(--bg); color: var(--brand); }

.sidebar-nav .nav-link.active {
    background: var(--brand);
    color: #fff;
    box-shadow: 0 4px 12px rgba(26,127,191,.28);
}

.sidebar-nav .nav-section {
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #9aa9bb;
    padding: .9rem .8rem .3rem;
    font-weight: 600;
}

.main-area { flex: 1; margin-left: 256px; min-width: 0; }

.topbar {
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    padding: .7rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1030;
}

.content { padding: 1.5rem; }

.avatar-sm { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; }
.avatar-lg { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; }

.sidebar-toggle { display: none; }

@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-area { margin-left: 0; }
    .sidebar-toggle { display: inline-flex; }
}

/* Public site */
.navbar-public {
    background: rgba(255,255,255,.95);
    backdrop-filter: blur(8px);
    box-shadow: var(--shadow-sm);
}

.navbar-public .navbar-brand {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 700;
    color: var(--brand);
}

.hero {
    background: linear-gradient(135deg, rgba(26,127,191,.10), rgba(41,182,168,.10));
    padding: 4.5rem 0;
}

.hero h1 { font-size: clamp(2rem, 4vw, 3.1rem); line-height: 1.1; }

.section { padding: 3.5rem 0; }

.service-icon {
    width: 60px; height: 60px;
    border-radius: 14px;
    display: grid; place-items: center;
    font-size: 1.5rem;
    background: rgba(26,127,191,.10);
    color: var(--brand);
    margin-bottom: 1rem;
}

.step-circle {
    width: 64px; height: 64px;
    border-radius: 50%;
    display: grid; place-items: center;
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--brand);
    color: #fff;
    margin: 0 auto 1rem;
}

.footer {
    background: var(--text);
    color: #c8d4e0;
    padding: 3rem 0 1.5rem;
}

.footer a { color: #c8d4e0; }
.footer a:hover { color: #fff; }

.announcement-bar {
    background: var(--accent);
    color: #4a3208;
    padding: .5rem 0;
    font-weight: 500;
    overflow: hidden;
    white-space: nowrap;
}

.announcement-bar span { display: inline-block; animation: ticker 22s linear infinite; }

@keyframes ticker {
    0% { transform: translateX(100%); }
    100% { transform: translateX(-100%); }
}

/* Misc */
.badge { font-weight: 600; padding: .4em .65em; border-radius: 7px; }
.table > :not(caption) > * > * { padding: .75rem .9rem; }
.empty-state { padding: 3rem 1rem; text-align: center; color: var(--muted); }
.empty-state i { font-size: 2.5rem; opacity: .4; margin-bottom: .75rem; }

.select2-container--bootstrap-5 .select2-selection { border-color: #e1e8f0; min-height: 42px; }

.rx-row { background: var(--bg); border-radius: 10px; padding: .75rem; margin-bottom: .6rem; }

.auth-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, rgba(26,127,191,.12), rgba(41,182,168,.12));
    padding: 1.5rem;
}

.auth-card { width: 100%; max-width: 460px; }
