/* =============================================
   Dr Pro AI - Design System
   Brand Blue (#324C97) & Mint Mist (#E0F0F0)
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Figtree:wght@400;500;600;700;800&family=Noto+Sans:wght@400;500;600;700&display=swap');

:root {
    /* Brand - primary (logo blue) */
    --primary: #324C97;
    --primary-light: #4A64B0;
    --primary-dark: #263A78;
    --primary-darker: #1B2A58;
    --primary-50: #EEF1F9;
    --primary-100: #DCE3F3;
    --primary-rgb: 50, 76, 151;

    /* Brand - secondary (mint mist) */
    --secondary: #E0F0F0;
    --secondary-light: #F0F8F8;
    --secondary-dark: #C3E1E1;
    --secondary-ink: #1F5C5C;

    /* Accent - deep teal drawn from the secondary hue */
    --accent: #1A8585;
    --accent-light: #5BBDBD;
    --accent-dark: #116464;

    /* Status (text tones meet 4.5:1 on their light fills) */
    --success: #138A5B;
    --success-light: #DFF5EB;
    --warning: #B4690E;
    --warning-light: #FDF1DC;
    --danger: #C8382F;
    --danger-light: #FCE6E4;
    --info: #2F6BC4;
    --info-light: #E2ECFA;

    /* Neutrals - cool slate to sit with the brand blue */
    --white: #ffffff;
    --gray-50: #F7F9FC;
    --gray-100: #EFF3F8;
    --gray-200: #E2E8F0;
    --gray-300: #CBD5E1;
    --gray-400: #94A3B8;
    --gray-500: #64748B;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1E293B;
    --gray-900: #0F172A;

    /* Surfaces */
    --bg: #F3F7F9;
    --surface: #ffffff;
    --border: #E3E9F1;

    /* Elevation (blue-tinted, soft) */
    --shadow-sm: 0 1px 2px rgba(27, 42, 88, 0.06);
    --shadow: 0 1px 3px rgba(27, 42, 88, 0.08), 0 1px 2px rgba(27, 42, 88, 0.04);
    --shadow-md: 0 6px 16px -4px rgba(27, 42, 88, 0.12), 0 2px 6px -2px rgba(27, 42, 88, 0.06);
    --shadow-lg: 0 16px 32px -8px rgba(27, 42, 88, 0.18), 0 4px 10px -4px rgba(27, 42, 88, 0.08);
    --shadow-xl: 0 28px 56px -12px rgba(27, 42, 88, 0.28);
    --ring: 0 0 0 3px rgba(var(--primary-rgb), 0.22);

    /* Radii */
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    /* Motion */
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --transition: all 0.18s var(--ease-out);
    --transition-slow: all 0.3s var(--ease-out);

    /* Type */
    --font-family: 'Noto Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-heading: 'Figtree', 'Noto Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    /* Layout */
    --sidebar-width: 272px;
    --header-height: 68px;
}

/* =============================================
   Reset & Base
   ============================================= */

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg);
    color: var(--gray-800);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img,
svg {
    max-width: 100%;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1.25;
    letter-spacing: -0.01em;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.875rem; }

p {
    margin-bottom: 1rem;
}

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

a:hover {
    color: var(--primary-dark);
}

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

button,
[role="button"],
.nav-item,
.user-menu {
    cursor: pointer;
    touch-action: manipulation;
}

/* Keyboard focus - visible, on-brand */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.sidebar :focus-visible {
    outline-color: var(--secondary);
}

::selection {
    background: var(--primary-100);
    color: var(--primary-darker);
}

/* Money / data columns don't jitter */
.stat-value,
.table td,
.tabular {
    font-variant-numeric: tabular-nums;
}

.skip-link {
    position: absolute;
    left: 1rem;
    top: -100px;
    z-index: 5000;
    background: var(--primary);
    color: var(--white);
    padding: 0.6rem 1rem;
    border-radius: var(--radius);
    font-weight: 600;
}

.skip-link:focus {
    top: 1rem;
    color: var(--white);
}

/* =============================================
   Brand
   ============================================= */

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    text-decoration: none;
}

.brand-mark {
    width: 48px;
    height: auto;
    display: block;
}

.brand-name {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.25rem;
    letter-spacing: -0.02em;
    color: var(--primary);
    line-height: 1;
    white-space: nowrap;
}

.brand-name .brand-ai {
    color: var(--accent);
}

.brand-tagline {
    display: block;
    font-family: var(--font-family);
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--gray-500);
    margin-top: 0.3rem;
}

/* =============================================
   Layout
   ============================================= */

.container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

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

/* Sidebar - deep brand blue */
.sidebar {
    width: var(--sidebar-width);
    background:
        radial-gradient(120% 60% at 0% 0%, rgba(224, 240, 240, 0.10) 0%, transparent 60%),
        linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 55%, var(--primary-darker) 100%);
    color: var(--white);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    height: 100dvh;
    overflow-y: auto;
    z-index: 1000;
    transition: transform 0.3s var(--ease-out);
    display: flex;
    flex-direction: column;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.sidebar-header {
    padding: 1.35rem 1.25rem 1.1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-logo {
    width: 46px;
    height: 46px;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.10);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
}

.sidebar-logo img {
    width: 34px;
    height: auto;
}

.sidebar-brand {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.sidebar-brand small {
    display: block;
    font-family: var(--font-family);
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(224, 240, 240, 0.7);
    margin-top: 0.2rem;
}

.sidebar-nav {
    padding: 0.5rem 0.75rem 1.25rem;
    flex: 1;
}

.nav-section {
    padding: 0.5rem 0.75rem 0.25rem;
    margin-top: 0.85rem;
}

.nav-section-title {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(224, 240, 240, 0.55);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.65rem 0.85rem;
    margin: 2px 0;
    min-height: 44px;
    color: rgba(255, 255, 255, 0.78);
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: var(--radius);
    position: relative;
    transition: background 0.18s var(--ease-out), color 0.18s var(--ease-out);
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--white);
}

.nav-item.active {
    background: var(--secondary);
    color: var(--primary-dark);
    font-weight: 600;
    box-shadow: 0 6px 16px -6px rgba(0, 0, 0, 0.35);
}

.nav-item.active i {
    color: var(--primary);
}

.nav-item i {
    width: 20px;
    text-align: center;
    font-size: 0.95rem;
    opacity: 0.95;
}

/* Pro-plan tag on gated menu items (includes/plan.php) */
.nav-item .nav-pro {
    margin-left: auto;
    padding: 0.1rem 0.45rem;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--accent), #5EEAD4);
    color: var(--primary-darker);
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}


.sidebar-brand .brand-plan { font-weight: 700; color: rgba(255, 255, 255, 0.7); }
.sidebar-brand .brand-plan.is-pro { color: #5EEAD4; }

.nav-item .nav-badge {
    margin-left: auto;
    background: var(--danger);
    color: var(--white);
    font-size: 0.6875rem;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: var(--radius-full);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.sidebar-footer {
    padding: 1rem 1.25rem 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.75rem;
    color: rgba(224, 240, 240, 0.55);
}

.sidebar-overlay {
    display: none;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    overflow-x: hidden;
    max-width: calc(100vw - var(--sidebar-width));
    box-sizing: border-box;
}

/* Header */
.header {
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: saturate(1.6) blur(12px);
    -webkit-backdrop-filter: saturate(1.6) blur(12px);
    min-height: var(--header-height);
    padding: 0.75rem 1.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.menu-toggle {
    display: none;
    width: 44px;
    height: 44px;
    border: 1px solid var(--border);
    background: var(--white);
    border-radius: var(--radius);
    color: var(--primary);
    font-size: 1.05rem;
    align-items: center;
    justify-content: center;
}

.header-search {
    position: relative;
    width: 340px;
    max-width: 100%;
}

.header-search input {
    width: 100%;
    height: 42px;
    padding: 0 1rem 0 2.6rem;
    border: 1px solid var(--border);
    background: var(--gray-50);
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    color: var(--gray-800);
    transition: var(--transition);
}

.header-search input:focus {
    outline: none;
    background: var(--white);
    border-color: var(--primary);
    box-shadow: var(--ring);
}

.header-search i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    font-size: 0.875rem;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    position: relative;
}

.header-icon-btn {
    width: 44px;
    height: 44px;
    border: 1px solid var(--border);
    background: var(--white);
    color: var(--gray-600);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    position: relative;
}

.header-icon-btn:hover {
    background: var(--primary-50);
    color: var(--primary);
    border-color: var(--primary-100);
}

.header-icon-btn .badge {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 19px;
    height: 19px;
    padding: 0 5px;
    background: var(--danger);
    color: var(--white);
    font-size: 0.625rem;
    font-weight: 700;
    border: 2px solid var(--white);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.3rem 0.6rem 0.3rem 0.3rem;
    border-radius: var(--radius-full);
    border: 1px solid transparent;
    transition: var(--transition);
}

.user-menu:hover {
    background: var(--gray-50);
    border-color: var(--border);
}

.user-avatar {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--secondary) 0%, var(--secondary-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--primary);
}

.user-info {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}

.user-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--gray-800);
}

.user-role {
    font-size: 0.75rem;
    color: var(--gray-500);
}

.user-dropdown,
.notification-dropdown {
    border: 1px solid var(--border);
    animation: dropIn 0.18s var(--ease-out);
}

.user-dropdown a {
    transition: background 0.15s ease;
}

.user-dropdown a:hover {
    background: var(--gray-50);
}

@keyframes dropIn {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Page Content */
.page-content {
    padding: 1.75rem;
    max-width: 1600px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.page-title {
    font-family: var(--font-heading);
    font-size: 1.625rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--gray-900);
}

.page-header .text-muted,
.page-subtitle {
    margin: 0.2rem 0 0;
    font-size: 0.9rem;
    color: var(--gray-500);
}

.page-eyebrow {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 0.25rem;
}

.breadcrumb {
    display: flex;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--gray-500);
}

.breadcrumb a {
    color: var(--gray-500);
}

.breadcrumb a:hover {
    color: var(--primary);
}

/* =============================================
   Cards & Panels
   ============================================= */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.card-title {
    font-family: var(--font-heading);
    font-size: 1.0625rem;
    font-weight: 700;
    color: var(--gray-900);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-title > i {
    color: var(--primary);
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    background: var(--gray-50);
}

.card-brand {
    background:
        radial-gradient(90% 120% at 100% 0%, rgba(224, 240, 240, 0.22) 0%, transparent 55%),
        linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--white);
    border: none;
}

.card-brand .card-title,
.card-brand h1,
.card-brand h2,
.card-brand h3 {
    color: var(--white);
}

.card-soft {
    background: var(--secondary-light);
    border-color: var(--secondary-dark);
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.35rem 1.4rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out), border-color 0.2s var(--ease-out);
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-100);
}

.stat-icon {
    width: 52px;
    height: 52px;
    flex-shrink: 0;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

.stat-icon.primary {
    background: var(--primary-50);
    color: var(--primary);
}

.stat-icon.secondary {
    background: var(--secondary);
    color: var(--secondary-ink);
}

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

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

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

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

.stat-content {
    flex: 1;
    min-width: 0;
}

.stat-value {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--gray-900);
    line-height: 1.1;
    margin-bottom: 0.2rem;
    overflow-wrap: anywhere;
}

.stat-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--gray-500);
}

.stat-trend {
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 0.4rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.stat-trend.up {
    color: var(--success);
}

.stat-trend.down {
    color: var(--danger);
}

/* =============================================
   Forms
   ============================================= */

.form-group {
    margin-bottom: 1.1rem;
}

.form-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.4rem;
}

.form-control {
    width: 100%;
    min-height: 44px;
    padding: 0.65rem 0.9rem;
    font-size: 0.9rem;
    color: var(--gray-800);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    background: var(--white);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.form-control:hover:not(:disabled):not(:focus) {
    border-color: var(--gray-400);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--ring);
}

.form-control:disabled,
.form-control[readonly] {
    background: var(--gray-50);
    color: var(--gray-500);
}

.form-control::placeholder {
    color: var(--gray-400);
}

.form-control.is-invalid {
    border-color: var(--danger);
}

.form-control.is-invalid:focus {
    box-shadow: 0 0 0 3px rgba(200, 56, 47, 0.18);
}

.form-control.is-valid {
    border-color: var(--success);
}

.form-text {
    display: block;
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-top: 0.3rem;
}

.form-error {
    font-size: 0.75rem;
    color: var(--danger);
    margin-top: 0.3rem;
}

textarea.form-control {
    min-height: 110px;
    resize: vertical;
    line-height: 1.5;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%2364748B' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.75rem center;
    background-repeat: no-repeat;
    background-size: 1rem;
    padding-right: 2.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.input-icon {
    position: relative;
}

.input-icon > i {
    position: absolute;
    left: 0.95rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    pointer-events: none;
}

.input-icon > .form-control {
    padding-left: 2.6rem;
}

.password-toggle {
    position: absolute;
    right: 0.35rem;
    top: 50%;
    transform: translateY(-50%);
    width: 38px;
    height: 38px;
    border: none;
    background: transparent;
    color: var(--gray-500);
    border-radius: var(--radius-sm);
}

.password-toggle:hover {
    color: var(--primary);
    background: var(--primary-50);
}

/* =============================================
   Buttons
   ============================================= */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 42px;
    padding: 0.6rem 1.2rem;
    font-family: var(--font-heading);
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.2;
    border: 1px solid transparent;
    border-radius: var(--radius);
    transition: background 0.18s var(--ease-out), color 0.18s var(--ease-out), border-color 0.18s var(--ease-out), box-shadow 0.18s var(--ease-out), transform 0.12s var(--ease-out);
    text-decoration: none;
    white-space: nowrap;
    user-select: none;
}

.btn:active:not(:disabled) {
    transform: scale(0.98);
}

.btn:disabled,
.btn.is-loading {
    opacity: 0.55;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
    box-shadow: 0 4px 12px -4px rgba(var(--primary-rgb), 0.55);
}

.btn-primary:hover {
    background: var(--primary-dark);
    color: var(--white);
}

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

.btn-secondary:hover {
    background: var(--secondary-dark);
    color: var(--primary-darker);
}

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

.btn-accent:hover {
    background: var(--accent-dark);
    color: var(--white);
}

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

.btn-success:hover {
    background: #0F7049;
    color: var(--white);
}

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

.btn-danger:hover {
    background: #A92C24;
    color: var(--white);
}

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

.btn-outline {
    background: var(--white);
    border-color: var(--gray-300);
    color: var(--gray-700);
}

.btn-outline:hover {
    background: var(--primary-50);
    border-color: var(--primary-100);
    color: var(--primary);
}

.btn-ghost {
    background: transparent;
    color: var(--primary);
}

.btn-ghost:hover {
    background: var(--primary-50);
}

.btn-sm {
    min-height: 34px;
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
}

.btn-lg {
    min-height: 50px;
    padding: 0.85rem 1.75rem;
    font-size: 1rem;
}

.btn-block {
    width: 100%;
}

.btn-icon {
    width: 40px;
    height: 40px;
    min-height: 40px;
    padding: 0;
}

.btn .spinner-sm {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

/* =============================================
   Tables
   ============================================= */

.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

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

.table th,
.table td {
    padding: 0.9rem 1.1rem;
    text-align: left;
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
}

.table th {
    background: var(--gray-50);
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--gray-500);
    white-space: nowrap;
    border-bottom: 1px solid var(--border);
}

.table tbody tr {
    transition: background 0.15s ease;
}

.table tbody tr:hover {
    background: var(--secondary-light);
}

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

.table td {
    font-size: 0.875rem;
    color: var(--gray-700);
}

.table td strong {
    color: var(--gray-900);
}

/* =============================================
   Badges, Chips & Status
   ============================================= */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.22rem 0.7rem;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.4;
    border-radius: var(--radius-full);
    white-space: nowrap;
}

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

.badge-secondary {
    background: var(--secondary);
    color: var(--secondary-ink);
}

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

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

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

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

.badge-gray {
    background: var(--gray-100);
    color: var(--gray-600);
}

.badge-dot::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 34px;
    padding: 0.35rem 0.85rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--gray-700);
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    transition: var(--transition);
}

.chip:hover {
    border-color: var(--primary-100);
    color: var(--primary);
}

.chip.active {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--white);
}

/* =============================================
   Alerts
   ============================================= */

.alert {
    padding: 0.9rem 1.1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    font-size: 0.9rem;
    border: 1px solid transparent;
}

.alert > i {
    margin-top: 0.2rem;
}

.alert-success {
    background: var(--success-light);
    color: #0B5C3C;
    border-color: #B5E6CF;
}

.alert-warning {
    background: var(--warning-light);
    color: #7A4508;
    border-color: #F5D7A4;
}

.alert-danger {
    background: var(--danger-light);
    color: #8E231C;
    border-color: #F4BCB6;
}

.alert-info {
    background: var(--info-light);
    color: #1E4A8C;
    border-color: #BCD3F2;
}

/* =============================================
   Empty states
   ============================================= */

.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--gray-500);
}

.empty-state-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 1rem;
    border-radius: 50%;
    background: var(--secondary);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
}

.empty-state h3,
.empty-state h4 {
    color: var(--gray-800);
    margin-bottom: 0.35rem;
}

.empty-state p {
    max-width: 380px;
    margin: 0 auto 1.25rem;
    font-size: 0.9rem;
}

/* =============================================
   Modal
   ============================================= */

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

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

.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal.show {
    display: flex;
}

.modal-overlay .modal {
    position: relative;
    display: block;
    background: var(--white);
    max-width: 500px;
    max-height: 90vh;
    border-radius: var(--radius-lg);
    transform: scale(0.96);
    transition: var(--transition);
}

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

.modal-content {
    background: var(--white);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-xl);
    animation: modalSlideIn 0.26s var(--ease-out);
}

.modal-content.small {
    max-width: 500px;
}

.modal-content.large {
    max-width: 1100px;
}

@keyframes modalSlideIn {
    from { opacity: 0; transform: scale(0.97) translateY(8px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    padding: 1.1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.modal-title {
    font-family: var(--font-heading);
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--gray-900);
}

.modal-close {
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    border-radius: var(--radius);
    font-size: 1.4rem;
    line-height: 1;
    color: var(--gray-500);
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--gray-900);
    background: var(--gray-100);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.modal-overlay .modal-body {
    max-height: 60vh;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    background: var(--gray-50);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* =============================================
   Toasts (window.showToast)
   ============================================= */

.toast-stack {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 11000; /* above page dialogs (9999) and Dr Pro (10600) */
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    min-width: 280px;
    max-width: 380px;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    background: var(--gray-900);
    color: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    font-size: 0.875rem;
    animation: toastIn 0.25s var(--ease-out);
}

.toast.is-leaving {
    animation: toastOut 0.18s ease-in forwards;
}

.toast i {
    margin-top: 0.15rem;
}

.toast-success i { color: #5EE0A8; }
.toast-error i { color: #FF9C93; }
.toast-info i { color: var(--secondary); }

@keyframes toastIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes toastOut {
    to { opacity: 0; transform: translateY(6px); }
}

/* =============================================
   Loading & Spinners
   ============================================= */

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--primary-100);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

.skeleton {
    background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-50) 50%, var(--gray-100) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.3s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

@keyframes shimmer {
    to { background-position: -200% 0; }
}

/* =============================================
   Auth Pages
   ============================================= */

/* A calm, premium sign-in: deep navy brand panel on the left, an airy white form on the right.
   On phones the brand panel becomes a short hero and the form a floating sheet (see the
   768px block below). Shared by login, the register pages and the portal's unlinked page. */

.auth-container {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    background: var(--white);
}

.auth-left {
    flex: 0 0 44%;
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(90% 60% at 100% 0%, rgba(94, 234, 212, 0.16) 0%, transparent 60%),
        radial-gradient(70% 55% at 0% 100%, rgba(26, 133, 133, 0.42) 0%, transparent 65%),
        linear-gradient(160deg, #2C4590 0%, var(--primary-dark) 48%, #141F45 100%);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 3.25rem 3.5rem;
    color: var(--white);
}

.auth-left::before {
    /* a faint light sweep across the panel */
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(115deg, transparent 38%, rgba(255, 255, 255, 0.05) 50%, transparent 62%);
    pointer-events: none;
}

.auth-left::after {
    /* oversized smile watermark */
    content: '';
    position: absolute;
    right: -16%;
    bottom: 4%;
    width: 80%;
    aspect-ratio: 967 / 364;
    background: url('../img/logo-mark-white.png') no-repeat center / contain;
    opacity: 0.06;
    pointer-events: none;
}

.auth-left .brand {
    position: relative;
    z-index: 1;
}

.auth-left .brand-name {
    color: var(--white);
    font-size: 1.4rem;
    letter-spacing: -0.01em;
}

.auth-left .brand-name .brand-ai {
    color: var(--secondary);
}

.auth-branding {
    position: relative;
    z-index: 1;
    max-width: 480px;
}

.auth-left h1 {
    color: var(--white);
    font-size: clamp(2.4rem, 3.2vw, 3.1rem);
    font-weight: 800;
    letter-spacing: -0.035em;
    line-height: 1.08;
    margin-bottom: 1.1rem;
    padding-bottom: 0.06em; /* italic descenders */
}

.auth-left h1 em {
    font-style: italic;
    font-weight: 700;
    color: var(--secondary);
}

.auth-left p {
    color: rgba(224, 240, 240, 0.78);
    max-width: 400px;
    font-size: 1.02rem;
    line-height: 1.6;
}

.auth-features {
    list-style: none;
    margin-top: 2.25rem;
    max-width: 400px;
    border-top: 1px solid rgba(224, 240, 240, 0.18);
}

.auth-features li {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 0.85rem 0;
    border-bottom: 1px solid rgba(224, 240, 240, 0.12);
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.93rem;
}

.auth-features li i {
    width: 20px;
    flex-shrink: 0;
    text-align: center;
    color: var(--secondary);
    font-size: 0.9rem;
}

.auth-left-footer {
    position: relative;
    z-index: 1;
    font-size: 0.78rem;
    letter-spacing: 0.02em;
    color: rgba(224, 240, 240, 0.5);
}

.auth-right {
    flex: 1 1 56%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.75rem;
    padding: 3rem 1.5rem;
    background: var(--white);
}

.auth-form {
    width: 100%;
    max-width: 400px;
}

.auth-form .brand {
    margin-bottom: 2rem;
}

.auth-form h2 {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin-bottom: 0.4rem;
    color: var(--gray-900);
}

.auth-form .subtitle {
    color: var(--gray-500);
    font-size: 0.98rem;
    margin-bottom: 2rem;
}

.auth-form .form-label {
    font-size: 0.8rem;
    color: var(--gray-600);
}

.auth-form .form-control {
    min-height: 54px;
    padding: 0.8rem 1rem;
    font-size: 1rem;
    border-radius: 14px;
    border-color: var(--gray-200);
    background: var(--gray-50);
}

.auth-form .form-control:hover:not(:disabled):not(:focus) {
    border-color: var(--gray-300);
    background: var(--white);
}

.auth-form .form-control:focus {
    background: var(--white);
}

.auth-form .input-icon > i {
    left: 1.05rem;
}

.auth-form .input-icon > .form-control {
    padding-left: 2.85rem;
}

.auth-form .form-control.has-toggle {
    padding-right: 3.1rem;
}

.auth-form .password-toggle {
    right: 0.5rem;
    width: 42px;
    height: 42px;
    border-radius: 10px;
}

.auth-form .auth-submit {
    min-height: 56px;
    margin-top: 1.5rem;
    gap: 0.6rem;
    border-radius: 14px;
    font-size: 1rem;
    letter-spacing: 0.01em;
    box-shadow: 0 14px 28px -12px rgba(var(--primary-rgb), 0.55);
}

.auth-form .auth-submit i {
    font-size: 0.85em;
    transition: transform 0.2s var(--ease-out);
}

.auth-form .auth-submit:hover i {
    transform: translateX(3px);
}

.auth-form .auth-submit:active {
    transform: scale(0.985);
}

/* "New to Dr Pro AI?" - one quiet capsule with the three account types */
.auth-roles {
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.auth-roles-label {
    font-size: 0.8rem;
    color: var(--gray-500);
    text-align: center;
}

.auth-roles-links {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    background: var(--white);
}

.auth-roles-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 48px;
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--gray-700);
    transition: var(--transition);
}

.auth-roles-links a + a {
    border-left: 1px solid var(--border);
}

.auth-roles-links a i {
    font-size: 0.85rem;
    color: var(--primary);
}

.auth-roles-links a:hover {
    background: var(--primary-50);
    color: var(--primary);
}

/* Entrance: the form settles into place, the brand copy fades in */
@media (prefers-reduced-motion: no-preference) {
    .auth-form,
    .auth-roles {
        animation: authRise 0.55s var(--ease-out) both;
    }

    .auth-roles {
        animation-delay: 0.08s;
    }

    .auth-branding {
        animation: authFade 0.6s var(--ease-out) both;
    }
}

@keyframes authRise {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: none; }
}

@keyframes authFade {
    from { opacity: 0; }
    to { opacity: 1; }
}

.auth-links {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.875rem;
    color: var(--gray-500);
}

.auth-links a {
    font-weight: 600;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1.5rem 0;
    color: var(--gray-400);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.auth-mobile-brand {
    display: none;
}

/* =============================================
   Responsive
   ============================================= */

@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: var(--shadow-xl);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.45);
        z-index: 999;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.25s ease, visibility 0.25s;
    }

    .sidebar.open + .sidebar-overlay {
        opacity: 1;
        visibility: visible;
    }

    .main-content {
        margin-left: 0;
        max-width: 100vw;
    }

    .menu-toggle {
        display: inline-flex;
    }

    .auth-left {
        padding: 2.25rem;
    }

    .auth-left h1 {
        font-size: 2.1rem;
    }
}

@media (max-width: 768px) {
    /* Phones: the brand panel becomes a short navy hero and the form a floating white sheet;
       the account-type capsule sits on the navy below the sheet */
    .auth-container {
        flex-direction: column;
        background: linear-gradient(165deg, #2C4590 0%, var(--primary-dark) 45%, #141F45 100%);
    }

    .auth-left {
        flex: 0 0 auto;
        justify-content: flex-start;
        gap: 1.5rem;
        padding: calc(1.4rem + var(--safe-top, env(safe-area-inset-top))) 1.5rem 3.25rem;
    }

    .auth-left::before {
        display: none;
    }

    .auth-left::after {
        right: -28%;
        bottom: -10%;
        width: 105%;
        opacity: 0.08;
    }

    .auth-left .brand-mark {
        width: 44px !important;
    }

    .auth-left .brand-name {
        font-size: 1.2rem;
    }

    .auth-left h1 {
        font-size: 1.75rem;
        margin-bottom: 0.45rem;
    }

    .auth-left p {
        font-size: 0.92rem;
        max-width: 30ch;
    }

    .auth-features,
    .auth-left-footer,
    .auth-mobile-brand {
        display: none;
    }

    .auth-right {
        flex: 1 0 auto;
        justify-content: flex-start;
        gap: 1.25rem;
        margin-top: -1.5rem;
        padding: 0 1rem calc(2rem + var(--safe-bottom, env(safe-area-inset-bottom)));
        background: transparent;
    }

    .auth-form {
        padding: 1.6rem 1.35rem 1.5rem;
        border-radius: 28px;
        background: var(--white);
        box-shadow: 0 24px 48px -24px rgba(10, 18, 48, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.06);
    }

    .auth-form h2 {
        font-size: 1.6rem;
    }

    .auth-form .subtitle {
        font-size: 0.93rem;
        margin-bottom: 1.35rem;
    }

    .auth-roles-label {
        color: rgba(224, 240, 240, 0.7);
    }

    .auth-roles-links {
        background: rgba(255, 255, 255, 0.06);
        border-color: rgba(224, 240, 240, 0.18);
    }

    .auth-roles-links a {
        color: rgba(255, 255, 255, 0.9);
    }

    .auth-roles-links a + a {
        border-left-color: rgba(224, 240, 240, 0.18);
    }

    .auth-roles-links a i {
        color: var(--secondary);
    }

    .auth-roles-links a:hover,
    .auth-roles-links a:active {
        background: rgba(255, 255, 255, 0.12);
        color: var(--white);
    }

    .header {
        padding: 0.6rem 1rem;
    }

    .header-search {
        display: none;
    }

    .user-info {
        display: none;
    }

    .page-content {
        padding: 1rem;
    }

    .page-title {
        font-size: 1.375rem;
    }

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

    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.75rem;
    }

    .stat-card {
        padding: 1rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.65rem;
    }

    .stat-icon {
        width: 42px;
        height: 42px;
        font-size: 1.05rem;
    }

    .stat-value {
        font-size: 1.25rem;
    }

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

    .card-body {
        padding: 1.1rem;
    }

    .toast-stack {
        left: 1rem;
        right: 1rem;
    }

    .toast {
        min-width: 0;
        max-width: none;
    }
}

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

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

@media print {
    .sidebar,
    .sidebar-overlay,
    .header,
    .no-print,
    .toast-stack {
        display: none !important;
    }

    .main-content {
        margin: 0;
        max-width: none;
    }

    body {
        background: var(--white);
    }

    .card {
        box-shadow: none;
        border-color: var(--gray-300);
    }
}

/* =============================================
   Utilities
   ============================================= */

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--gray-500); }
.text-primary { color: var(--primary); }
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.small { font-size: 0.8125rem; }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }

.d-flex { display: flex; }
.d-grid { display: grid; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 1rem; }
.gap-4 { gap: 1.5rem; }
.w-100 { width: 100%; }

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem;
}

.grid-main-side {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: 1.5rem;
}

@media (max-width: 1100px) {
    .grid-2,
    .grid-main-side {
        grid-template-columns: 1fr;
    }
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.hidden {
    display: none !important;
}

/* =============================================
   Header notification panel (assets/js/reminders-bell.js)
   ============================================= */
.notification-wrapper { position: relative; }
.header-icon-btn .badge[hidden] { display: none; }
.notif-panel {
    position: absolute; top: calc(100% + 10px); right: -8px; z-index: 1001;
    width: min(380px, calc(100vw - 32px));
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-xl);
    overflow: hidden; transform-origin: top right;
    animation: notifIn 0.18s var(--ease-out);
}
@keyframes notifIn { from { opacity: 0; transform: translateY(-4px) scale(0.98); } to { opacity: 1; transform: none; } }
.notif-head { display: flex; align-items: center; justify-content: space-between; padding: 0.7rem 0.75rem 0.7rem 1rem; border-bottom: 1px solid var(--border); }
.notif-head strong { font-family: var(--font-heading); font-size: 0.95rem; color: var(--gray-900); }
.notif-body { max-height: min(420px, 60vh); overflow-y: auto; overscroll-behavior: contain; }
.notif-section { padding: 0.6rem 1rem 0.3rem; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--gray-500); }
.notif-item {
    display: flex; gap: 0.7rem; align-items: center; padding: 0.6rem 1rem;
    color: inherit; text-decoration: none; border-left: 3px solid transparent;
    transition: background 0.15s var(--ease-out);
}
.notif-item:hover { background: var(--secondary-light); }
.notif-item.is-overdue { border-left-color: var(--danger); }
.notif-item .icon-tile {
    width: 34px; height: 34px; flex-shrink: 0; border-radius: 10px; font-size: 0.8rem;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--primary-50); color: var(--primary);
}
.notif-item .icon-tile.is-secondary { background: var(--secondary); color: var(--secondary-ink); }
.notif-item .icon-tile.is-success { background: var(--success-light); color: var(--success); }
.notif-item .icon-tile.is-warning { background: var(--warning-light); color: var(--warning); }
.notif-item .icon-tile.is-danger { background: var(--danger-light); color: var(--danger); }
.notif-item .icon-tile.is-info { background: var(--info-light); color: var(--info); }
.notif-item .icon-tile.is-accent { background: var(--secondary); color: var(--accent); }
.notif-item .icon-tile.is-gray { background: var(--gray-100); color: var(--gray-600); }
.notif-text { flex: 1; min-width: 0; }
.notif-title { font-size: 0.85rem; font-weight: 600; color: var(--gray-900); line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.notif-meta { font-size: 0.75rem; color: var(--gray-500); margin-top: 0.1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notif-meta a { color: var(--primary); font-weight: 600; }
.notif-acts { display: flex; gap: 0.3rem; flex-shrink: 0; }
.notif-act {
    width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--border);
    background: var(--surface); color: var(--gray-600); cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    transition: background 0.15s var(--ease-out), color 0.15s var(--ease-out), border-color 0.15s var(--ease-out);
}
.notif-act:hover { background: var(--success-light); color: var(--success); border-color: var(--success-light); }
.notif-act.is-wa { color: #128C7E; }
.notif-act.is-wa:hover { background: #E7F7EF; border-color: #CDEFDD; }
.notif-empty { display: flex; flex-direction: column; align-items: center; gap: 0.3rem; padding: 2rem 1rem; text-align: center; color: var(--gray-500); font-size: 0.85rem; }
.notif-empty i { font-size: 1.6rem; color: var(--success); margin-bottom: 0.25rem; }
.notif-empty strong { color: var(--gray-800); }
.notif-foot { display: flex; flex-direction: column; gap: 0.35rem; align-items: center; padding: 0.65rem 1rem; border-top: 1px solid var(--border); background: var(--gray-50); }
.notif-foot a { color: var(--primary); font-weight: 600; font-size: 0.85rem; }
.notif-alerts-btn { border: 0; background: none; color: var(--accent); font-size: 0.8rem; font-weight: 600; cursor: pointer; min-height: 32px; }
.notif-alerts-btn[hidden] { display: none; }
@media (max-width: 480px) { .notif-panel { position: fixed; top: 64px; right: 16px; left: 16px; width: auto; } }

/* ---------- Header search results (assets/js/global-search.js) ---------- */
.header-search input[type="search"]::-webkit-search-cancel-button { display: none; }
.gs-kbd {
    position: absolute;
    right: 0.7rem;
    top: 50%;
    transform: translateY(-50%);
    padding: 0.12rem 0.4rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--white);
    color: var(--gray-400);
    font: 600 0.66rem var(--font-heading);
    pointer-events: none;
}
.header-search input:focus ~ .gs-kbd { display: none; }
.header-search-open { display: none; }
.gs-panel {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 1002;
    width: min(460px, calc(100vw - 32px));
    max-height: min(70vh, 480px);
    overflow-y: auto;
    padding: 0.4rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}
.gs-panel[hidden] { display: none; }
.gs-group { padding: 0.5rem 0.65rem 0.25rem; font: 800 0.66rem var(--font-heading); letter-spacing: 0.1em; text-transform: uppercase; color: var(--gray-400); }
.gs-item { display: flex; align-items: center; gap: 0.7rem; min-height: 48px; padding: 0.4rem 0.65rem; border-radius: var(--radius); color: var(--gray-800); text-decoration: none; }
.gs-item:hover, .gs-item.is-active { background: var(--primary-50); color: var(--primary-darker); }
.gs-icon { flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--gray-100); color: var(--gray-600); font-size: 0.85rem; }
.gs-icon.is-patient { background: var(--secondary); color: var(--secondary-ink); }
.gs-text { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.25; }
.gs-text strong { font-size: 0.9rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gs-text small { font-size: 0.76rem; color: var(--gray-500); }
.gs-go { color: var(--gray-300); font-size: 0.72rem; }
.gs-item.is-active .gs-go { color: var(--primary); }
.gs-item.is-locked .gs-text strong { color: var(--gray-500); }
.gs-empty { padding: 1rem 0.75rem; color: var(--gray-500); font-size: 0.88rem; }
@media (max-width: 768px) {
    .header-search-open { display: inline-flex; }
    .header-search.is-open {
        display: block;
        position: fixed;
        top: calc(var(--safe-top, 0px) + 10px);
        left: 12px;
        right: 12px;
        width: auto;
        z-index: 1003;
    }
    .header-search.is-open input { height: 48px; background: var(--white); box-shadow: var(--shadow-lg); font-size: 1rem; }
    .header-search.is-open .gs-kbd { display: none; }
    .header-search.is-open .gs-panel { width: 100%; }
}
