/**
 * MediCore — Design System
 * Premium Medical SaaS — Figma Design Language
 * 
 * Based on: Figma 4.fig — Approved Visual Direction
 * Direction: Light Sky Blue + Cyan + White Healthcare
 * Typography: Cairo (Arabic) + Inter (English)
 */

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

/* ═══════════════════════════════════════════════════════════════
   2. DESIGN TOKENS — LIGHT MODE (Default)
═══════════════════════════════════════════════════════════════ */
:root {
    /* Primary — Sky Blue (Figma Approved) */
    --color-primary:          #38BDF8;
    --color-primary-hover:    #0284C7;
    --color-primary-dark:     #0369A1;
    --color-primary-light:    #E0F2FE;
    --color-primary-muted:    #BAE6FD;

    /* Secondary — Soft Blue */
    --color-secondary:        #7DD3FC;
    --color-secondary-hover:  #38BDF8;
    --color-secondary-light:  #F0F9FF;

    /* Accent — Cyan */
    --color-accent:           #22D3EE;
    --color-accent-hover:     #06B6D4;
    --color-accent-light:     #ECFEFF;

    /* Backgrounds */
    --color-bg:               #F8FCFF;
    --color-surface:          #FFFFFF;
    --color-surface-elevated: #FFFFFF;
    --color-surface-hover:    #F0F9FF;

    /* Borders */
    --color-border:           #E0F2FE;
    --color-border-strong:    #BAE6FD;
    --color-border-focus:     #38BDF8;

    /* Text */
    --color-text-primary:     #0F172A;
    --color-text-secondary:   #475569;
    --color-text-muted:       #94A3B8;
    --color-text-on-primary:  #FFFFFF;
    --color-text-link:        #0284C7;

    /* Semantic */
    --color-success:          #22C55E;
    --color-success-light:    #DCFCE7;
    --color-success-dark:     #15803D;

    --color-warning:          #F59E0B;
    --color-warning-light:    #FFFBEB;
    --color-warning-dark:     #92400E;

    --color-error:            #EF4444;
    --color-error-light:      #FEE2E2;
    --color-error-dark:       #B91C1C;

    --color-info:             #38BDF8;
    --color-info-light:       #E0F2FE;
    --color-info-dark:        #0284C7;

    /* Sidebar — Light (Figma Approved) */
    --sidebar-bg:             #FFFFFF;
    --sidebar-text:           #475569;
    --sidebar-text-active:    #0284C7;
    --sidebar-item-active:    #E0F2FE;
    --sidebar-item-hover:     #F0F9FF;
    --sidebar-accent:         #38BDF8;
    --sidebar-border:         #E0F2FE;
    --sidebar-width:          260px;
    --sidebar-collapsed-width: 68px;

    /* Topbar */
    --topbar-bg:              #FFFFFF;
    --topbar-border:          #E0F2FE;
    --topbar-height:          62px;

    /* ─── Spacing Scale ─── */
    --space-1:   4px;
    --space-2:   8px;
    --space-3:   12px;
    --space-4:   16px;
    --space-5:   20px;
    --space-6:   24px;
    --space-8:   32px;
    --space-10:  40px;
    --space-12:  48px;
    --space-16:  64px;

    /* ─── Border Radius ─── */
    --radius-xs:  4px;
    --radius-sm:  6px;
    --radius-md:  10px;
    --radius-lg:  14px;
    --radius-xl:  20px;
    --radius-full: 9999px;

    /* ─── Shadows ─── */
    --shadow-xs:  0 1px 2px rgba(15,23,42,0.05);
    --shadow-sm:  0 1px 4px rgba(15,23,42,0.07), 0 1px 2px rgba(56,189,248,0.04);
    --shadow-md:  0 4px 12px rgba(15,23,42,0.08), 0 2px 4px rgba(56,189,248,0.06);
    --shadow-lg:  0 10px 28px rgba(15,23,42,0.10), 0 4px 8px rgba(56,189,248,0.06);
    --shadow-xl:  0 20px 48px rgba(15,23,42,0.12), 0 8px 16px rgba(56,189,248,0.07);
    --shadow-focus: 0 0 0 3px rgba(56,189,248,0.25);
    --shadow-focus-accent: 0 0 0 3px rgba(34,211,238,0.22);

    /* ─── Typography Scale ─── */
    --font-arabic:   'Cairo', 'Segoe UI', sans-serif;
    --font-latin:    'Inter', 'Segoe UI', sans-serif;
    --font-mono:     'Fira Code', 'Consolas', monospace;

    --text-xs:     12px;
    --text-sm:     14px;
    --text-base:   16px;
    --text-md:     17px;
    --text-lg:     20px;
    --text-xl:     22px;
    --text-2xl:    26px;
    --text-3xl:    32px;
    --text-4xl:    38px;

    --weight-light:   300;
    --weight-normal:  400;
    --weight-medium:  500;
    --weight-semibold: 600;
    --weight-bold:    700;
    --weight-extrabold: 800;

    --line-tight:    1.25;
    --line-snug:     1.375;
    --line-normal:   1.5;
    --line-relaxed:  1.625;

    /* ─── Transitions ─── */
    --transition-fast:   150ms ease;
    --transition-base:   200ms ease;
    --transition-slow:   300ms ease;

    /* ─── Z-index ─── */
    --z-sidebar:  100;
    --z-topbar:   200;
    --z-dropdown: 300;
    --z-modal:    400;
    --z-toast:    500;
    --z-tooltip:  600;
}

/* ═══════════════════════════════════════════════════════════════
   3. DARK MODE TOKENS
═══════════════════════════════════════════════════════════════ */
[data-theme="dark"] {
    --color-primary:          #38BDF8;
    --color-primary-hover:    #7DD3FC;
    --color-primary-dark:     #BAE6FD;
    --color-primary-light:    #0C2340;
    --color-primary-muted:    #164E63;

    --color-secondary:        #7DD3FC;
    --color-secondary-hover:  #BAE6FD;
    --color-secondary-light:  #0C2A40;

    --color-accent:           #22D3EE;
    --color-accent-hover:     #67E8F9;
    --color-accent-light:     #083344;

    --color-bg:               #0F172A;
    --color-surface:          #162033;
    --color-surface-elevated: #1E293B;
    --color-surface-hover:    #1A2B40;

    --color-border:           #1E3048;
    --color-border-strong:    #2A4060;
    --color-border-focus:     #38BDF8;

    --color-text-primary:     #F8FAFC;
    --color-text-secondary:   #CBD5E1;
    --color-text-muted:       #94A3B8;
    --color-text-on-primary:  #0F172A;
    --color-text-link:        #7DD3FC;

    --color-success:          #4ADE80;
    --color-success-light:    #14532D;
    --color-success-dark:     #BBF7D0;

    --color-warning:          #FBBF24;
    --color-warning-light:    #78350F;
    --color-warning-dark:     #FEF3C7;

    --color-error:            #F87171;
    --color-error-light:      #7F1D1D;
    --color-error-dark:       #FEE2E2;

    --color-info:             #38BDF8;
    --color-info-light:       #0C2340;
    --color-info-dark:        #BAE6FD;

    --sidebar-bg:             #0F172A;
    --sidebar-text:           #94A3B8;
    --sidebar-text-active:    #38BDF8;
    --sidebar-item-active:    rgba(56, 189, 248, 0.15);
    --sidebar-item-hover:     rgba(56, 189, 248, 0.06);
    --sidebar-accent:         #38BDF8;
    --sidebar-border:         rgba(56, 189, 248, 0.1);

    --topbar-bg:              #162033;
    --topbar-border:          #1E3048;

    --shadow-xs:  0 1px 2px rgba(0,0,0,0.2);
    --shadow-sm:  0 1px 4px rgba(0,0,0,0.25);
    --shadow-md:  0 4px 12px rgba(0,0,0,0.3);
    --shadow-lg:  0 10px 28px rgba(0,0,0,0.35);
    --shadow-xl:  0 20px 48px rgba(0,0,0,0.4);
}

/* ═══════════════════════════════════════════════════════════════
   4. CSS RESET & BASE
═══════════════════════════════════════════════════════════════ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: var(--text-base);
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-arabic);
    font-size: var(--text-base);
    font-weight: var(--weight-normal);
    line-height: var(--line-normal);
    color: var(--color-text-primary);
    background-color: var(--color-bg);
    direction: rtl;
    text-align: start;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color var(--transition-slow), color var(--transition-slow);
}

/* LTR / English Mode */
[dir="ltr"], [dir="ltr"] body, [lang="en"], .ltr {
    font-family: var(--font-latin);
    direction: ltr;
    text-align: start;
}

/* RTL / Arabic Mode */
[dir="rtl"], [dir="rtl"] body, [lang="ar"] {
    font-family: var(--font-arabic);
    direction: rtl;
    text-align: start;
}

/* ─── Links ─── */
a {
    color: var(--color-text-link);
    text-decoration: none;
    transition: color var(--transition-fast), opacity var(--transition-fast);
}
a:hover { opacity: 0.8; }
a:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
    border-radius: var(--radius-xs);
}

/* ─── Images ─── */
img, svg { max-width: 100%; display: block; }

/* ─── Lists ─── */
ul, ol { list-style: none; }

/* ─── Tables ─── */
table { border-collapse: collapse; width: 100%; }

/* ─── Form elements ─── */
button, input, select, textarea {
    font-family: inherit;
    font-size: inherit;
}

/* ─── Scrollbar (Webkit) ─── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--color-border-strong);
    border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover { background: var(--color-text-muted); }

/* ═══════════════════════════════════════════════════════════════
   5. TYPOGRAPHY UTILITIES
═══════════════════════════════════════════════════════════════ */
.h1 { font-size: var(--text-3xl); font-weight: var(--weight-bold);     line-height: var(--line-tight); }
.h2 { font-size: var(--text-2xl); font-weight: var(--weight-semibold); line-height: var(--line-tight); }
.h3 { font-size: var(--text-xl);  font-weight: var(--weight-semibold); line-height: var(--line-snug); }
.h4 { font-size: var(--text-lg);  font-weight: var(--weight-semibold); line-height: var(--line-snug); }
.h5 { font-size: var(--text-md);  font-weight: var(--weight-medium);   line-height: var(--line-normal); }

.text-xs      { font-size: var(--text-xs); }
.text-sm      { font-size: var(--text-sm); }
.text-base    { font-size: var(--text-base); }
.text-md      { font-size: var(--text-md); }
.text-lg      { font-size: var(--text-lg); }
.text-xl      { font-size: var(--text-xl); }

.text-primary   { color: var(--color-text-primary); }
.text-secondary { color: var(--color-text-secondary); }
.text-muted     { color: var(--color-text-muted); }
.text-accent    { color: var(--color-accent); }
.text-error     { color: var(--color-error); }
.text-success   { color: var(--color-success); }
.text-warning   { color: var(--color-warning); }

.font-normal   { font-weight: var(--weight-normal); }
.font-medium   { font-weight: var(--weight-medium); }
.font-semibold { font-weight: var(--weight-semibold); }
.font-bold     { font-weight: var(--weight-bold); }

.truncate {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* ═══════════════════════════════════════════════════════════════
   6. BUTTONS
═══════════════════════════════════════════════════════════════ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-5);
    font-family: inherit;
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    line-height: 1.5;
    border: 1.5px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition:
        background-color var(--transition-fast),
        border-color var(--transition-fast),
        color var(--transition-fast),
        box-shadow var(--transition-fast),
        transform var(--transition-fast);
    user-select: none;
    -webkit-user-select: none;
}

.btn:focus-visible {
    outline: none;
    box-shadow: var(--shadow-focus);
}

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

.btn:disabled, .btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Sizes */
.btn-xs { padding: 4px 10px; font-size: var(--text-xs); border-radius: var(--radius-xs); }
.btn-sm { padding: 6px 14px; font-size: var(--text-sm); }
.btn-lg { padding: 12px 28px; font-size: var(--text-md); }
.btn-xl { padding: 14px 36px; font-size: var(--text-lg); }

/* Variants */
.btn-primary {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
    color: var(--color-text-on-primary);
}
.btn-primary:hover {
    background-color: var(--color-primary-hover);
    border-color: var(--color-primary-hover);
    box-shadow: var(--shadow-sm);
}

.btn-accent {
    background-color: var(--color-accent);
    border-color: var(--color-accent);
    color: #fff;
}
.btn-accent:hover {
    background-color: var(--color-accent-hover);
    border-color: var(--color-accent-hover);
    box-shadow: var(--shadow-sm);
}

.btn-secondary {
    background-color: var(--color-surface);
    border-color: var(--color-border);
    color: var(--color-text-primary);
}
.btn-secondary:hover {
    background-color: var(--color-surface-hover);
    border-color: var(--color-border-strong);
    box-shadow: var(--shadow-xs);
}

.btn-ghost {
    background-color: transparent;
    border-color: transparent;
    color: var(--color-text-secondary);
}
.btn-ghost:hover {
    background-color: var(--color-surface-hover);
    color: var(--color-text-primary);
}

.btn-danger {
    background-color: var(--color-error);
    border-color: var(--color-error);
    color: #fff;
}
.btn-danger:hover {
    background-color: var(--color-error-dark);
    border-color: var(--color-error-dark);
}

.btn-danger-ghost {
    background-color: transparent;
    border-color: transparent;
    color: var(--color-error);
}
.btn-danger-ghost:hover {
    background-color: var(--color-error-light);
}

.btn-success {
    background-color: var(--color-success);
    border-color: var(--color-success);
    color: #fff;
}
.btn-success:hover { background-color: var(--color-success-dark); }

/* Icon Button */
.btn-icon {
    padding: 8px;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
}
.btn-icon.btn-sm { width: 30px; height: 30px; padding: 5px; }
.btn-icon.btn-lg { width: 44px; height: 44px; padding: 10px; }

/* Full width */
.btn-block { width: 100%; }

/* Loading state */
.btn.loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}
.btn.loading::after {
    content: '';
    position: absolute;
    inset: 50% auto auto 50%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-color: rgba(255,255,255,0.3) rgba(255,255,255,0.3) #fff #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* Clear file selection feedback, shared by medical uploads and profile forms. */
.file-picker { display:flex; align-items:center; gap:var(--space-3); min-height:44px; padding:var(--space-2); border:1px dashed var(--color-border-strong); border-radius:var(--radius-sm); background:var(--color-surface-hover); }
.file-picker-input { position:absolute; width:1px; height:1px; opacity:0; overflow:hidden; }
.file-picker-button { display:inline-flex; align-items:center; justify-content:center; padding:7px 13px; border-radius:var(--radius-xs); background:var(--color-primary); color:#fff; font-size:var(--text-sm); font-weight:var(--weight-semibold); cursor:pointer; }
.file-picker-button:hover { background:var(--color-primary-hover); }
.file-picker-name { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--color-text-secondary); font-size:var(--text-sm); }
@media (max-width: 640px) { .file-picker { align-items:stretch; flex-direction:column; } .file-picker-button { width:100%; } }


/* ═══════════════════════════════════════════════════════════════
   7. FORM ELEMENTS
═══════════════════════════════════════════════════════════════ */

/* Label */
.form-label {
    display: block;
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    color: var(--color-text-primary);
    margin-bottom: var(--space-1);
}
.form-label .required {
    color: var(--color-error);
    margin-inline-start: 2px;
}

/* Input / Textarea / Select */
.form-input,
.form-select,
.form-textarea {
    display: block;
    width: 100%;
    padding: 9px 14px;
    font-family: inherit;
    font-size: var(--text-sm);
    font-weight: var(--weight-normal);
    color: var(--color-text-primary);
    background-color: var(--color-surface);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-sm);
    line-height: 1.5;
    transition:
        border-color var(--transition-fast),
        box-shadow var(--transition-fast),
        background-color var(--transition-base);
    outline: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-focus);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--color-text-muted);
    font-weight: var(--weight-normal);
}

.form-input.is-invalid,
.form-select.is-invalid,
.form-textarea.is-invalid {
    border-color: var(--color-error);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}

.form-input.is-valid,
.form-select.is-valid {
    border-color: var(--color-success);
}

.form-input:disabled,
.form-select:disabled,
.form-textarea:disabled {
    background-color: var(--color-surface-hover);
    color: var(--color-text-muted);
    cursor: not-allowed;
}

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

/* ─── Unified File Input Styling (Choose File Button) ─── */
input[type="file"], .form-file-input {
    padding: 6px 10px;
    background-color: var(--color-surface);
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    transition: border-color var(--transition-fast), background-color var(--transition-fast), box-shadow var(--transition-fast);
    display: block;
    width: 100%;
    box-sizing: border-box;
}

input[type="file"]:hover, .form-file-input:hover {
    border-color: var(--color-primary);
    background-color: rgba(56, 189, 248, 0.06);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.12);
}

input[type="file"]::file-selector-button,
input[type="file"]::-webkit-file-upload-button {
    background-color: var(--color-primary);
    color: #ffffff;
    border: none;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    margin-right: 12px;
    font-family: inherit;
    font-size: var(--text-xs);
    font-weight: var(--weight-bold);
    cursor: pointer;
    transition: background-color var(--transition-fast);
}

[dir="rtl"] input[type="file"]::file-selector-button,
[dir="rtl"] input[type="file"]::-webkit-file-upload-button {
    margin-right: 0;
    margin-left: 12px;
}

input[type="file"]::file-selector-button:hover,
input[type="file"]::-webkit-file-upload-button:hover {
    background-color: var(--color-primary-dark);
}

.form-select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235A6B7C' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 12px center;
    padding-left: 36px;
    padding-right: 14px;
}
[dir="ltr"] .form-select, html[dir="ltr"] .form-select {
    background-position: right 12px center;
    padding-right: 36px;
    padding-left: 14px;
}
[dir="rtl"] .form-select, html[dir="rtl"] .form-select {
    background-position: left 12px center;
    padding-left: 36px;
    padding-right: 14px;
}

/* Form group */
.form-group { margin-bottom: var(--space-5); }

/* Help / Error text */
.form-hint {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    margin-top: var(--space-1);
}
.form-error {
    font-size: var(--text-xs);
    color: var(--color-error);
    margin-top: var(--space-1);
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Input with icon */
.input-group {
    position: relative;
    display: flex;
    align-items: center;
}
.input-icon {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-muted);
    pointer-events: none;
    width: 18px;
    height: 18px;
}
.input-icon-start {
    inset-inline-start: 12px;
}
.input-icon-end {
    inset-inline-end: 12px;
}
.input-group .form-input.has-icon-start { padding-inline-start: 40px; padding-inline-end: 14px; }
.input-group .form-input.has-icon-end   { padding-inline-end: 40px; padding-inline-start: 14px; }

/* Checkbox / Radio */
.form-check {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
    font-size: var(--text-sm);
}
.form-check input[type="checkbox"],
.form-check input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--color-primary);
    cursor: pointer;
    flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════
   8. CARDS
═══════════════════════════════════════════════════════════════ */
.card {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: box-shadow var(--transition-base);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--color-border);
    gap: var(--space-4);
}

.card-title {
    font-size: var(--text-md);
    font-weight: var(--weight-semibold);
    color: var(--color-text-primary);
    line-height: 1.3;
}

.card-body { padding: var(--space-6); }
.card-body-sm { padding: var(--space-4); }

.card-footer {
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--color-border);
    background-color: var(--color-surface-hover);
}

/* Stat card */
.stat-card {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-5) var(--space-6);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: flex-start;
    gap: var(--space-4);
    transition: box-shadow var(--transition-base), transform var(--transition-base);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 22px;
}
.stat-icon-primary { background-color: var(--color-primary-light); color: var(--color-primary); }
.stat-icon-accent  { background-color: var(--color-accent-light);  color: var(--color-accent); }
.stat-icon-success { background-color: var(--color-success-light); color: var(--color-success); }
.stat-icon-warning { background-color: var(--color-warning-light); color: var(--color-warning); }
.stat-icon-error   { background-color: var(--color-error-light);   color: var(--color-error); }
.stat-icon-info    { background-color: var(--color-info-light);    color: var(--color-info); }

.stat-body { flex: 1; min-width: 0; }
.stat-value {
    font-size: var(--text-2xl);
    font-weight: var(--weight-bold);
    color: var(--color-text-primary);
    line-height: 1.2;
}
.stat-label {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    margin-top: 2px;
}
.stat-trend {
    font-size: var(--text-xs);
    margin-top: var(--space-1);
    display: flex;
    align-items: center;
    gap: 3px;
}
.trend-up   { color: var(--color-success); }
.trend-down { color: var(--color-error); }

/* ═══════════════════════════════════════════════════════════════
   9. TABLES
═══════════════════════════════════════════════════════════════ */
.table-wrapper,
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
    background-color: var(--color-surface);
    width: 100%;
}

.card-body.p-0 > .table-wrapper,
.card-body.p-0 > .table-responsive,
.card.p-0 > .table-wrapper,
.card.p-0 > .table-responsive {
    border: none;
    border-radius: 0;
    box-shadow: none;
}

.table,
.data-table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
    text-align: start;
}

.table thead,
.data-table thead {
    background-color: var(--color-surface-hover);
}

.table th,
.data-table th {
    padding: 12px 16px;
    text-align: start;
    font-size: var(--text-xs);
    font-weight: var(--weight-bold);
    color: var(--color-text-secondary);
    letter-spacing: 0.03em;
    border-bottom: 1px solid var(--color-border);
    white-space: nowrap;
    vertical-align: middle;
}

.table td,
.data-table td {
    padding: 13px 16px;
    text-align: start;
    font-size: var(--text-sm);
    color: var(--color-text-primary);
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
}

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

.table tbody tr,
.data-table tbody tr {
    transition: background-color var(--transition-fast);
}

.table tbody tr:hover,
.data-table tbody tr:hover {
    background-color: var(--color-surface-hover);
}

/* Table actions column */
.table .col-actions,
.data-table .col-actions {
    width: 120px;
    text-align: center;
}

/* Sortable column */
.table th.sortable,
.data-table th.sortable {
    cursor: pointer;
    user-select: none;
}
.table th.sortable:hover,
.data-table th.sortable:hover { color: var(--color-primary); }

/* ═══════════════════════════════════════════════════════════════
   10. BADGES
═══════════════════════════════════════════════════════════════ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    border-radius: var(--radius-full);
    white-space: nowrap;
    border: 1px solid transparent;
}

.badge-primary { background: var(--color-primary-light); color: var(--color-primary); border-color: var(--color-primary-muted); }
.badge-accent  { background: var(--color-accent-light);  color: var(--color-accent);  border-color: rgba(34,211,238,0.25); }
.badge-success { background: var(--color-success-light); color: var(--color-success); border-color: rgba(22,163,74,0.25); }
.badge-warning { background: var(--color-warning-light); color: var(--color-warning); border-color: rgba(217,119,6,0.25); }
.badge-error   { background: var(--color-error-light);   color: var(--color-error);   border-color: rgba(220,38,38,0.25); }
.badge-info    { background: var(--color-info-light);    color: var(--color-info);    border-color: rgba(37,99,235,0.25); }
.badge-muted   { background: var(--color-surface-hover); color: var(--color-text-muted); border-color: var(--color-border); }

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

/* ═══════════════════════════════════════════════════════════════
   11. TABS
═══════════════════════════════════════════════════════════════ */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--color-border);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: 10px 18px;
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    flex-shrink: 0;
    color: var(--color-text-secondary);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    white-space: nowrap;
    cursor: pointer;
    text-decoration: none;
    transition: color var(--transition-fast), border-color var(--transition-fast);
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    font-family: inherit;
}

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

.tab-item.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
    font-weight: var(--weight-semibold);
}

.tab-badge {
    background: var(--color-primary-light);
    color: var(--color-primary);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    padding: 1px 7px;
    border-radius: var(--radius-full);
    min-width: 20px;
    text-align: center;
}
.tab-item.active .tab-badge {
    background: var(--color-primary);
    color: #fff;
}

/* ═══════════════════════════════════════════════════════════════
   12. ALERTS
═══════════════════════════════════════════════════════════════ */
.alert {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    font-size: var(--text-sm);
}
.alert-icon { flex-shrink: 0; width: 20px; height: 20px; margin-top: 1px; }

.alert-success { background: var(--color-success-light); border-color: rgba(22,163,74,0.3); color: var(--color-success-dark); }
.alert-warning { background: var(--color-warning-light); border-color: rgba(217,119,6,0.3); color: var(--color-warning-dark); }
.alert-error   { background: var(--color-error-light);   border-color: rgba(220,38,38,0.3); color: var(--color-error-dark); }
.alert-info    { background: var(--color-info-light);    border-color: rgba(37,99,235,0.3); color: var(--color-info-dark); }

/* Keep status components and text readable on the dark surfaces. */
[data-theme="dark"] .badge-accent  { border-color: rgba(94,234,212,.45); }
[data-theme="dark"] .badge-success { border-color: rgba(74,222,128,.45); }
[data-theme="dark"] .badge-warning { border-color: rgba(251,191,36,.5); }
[data-theme="dark"] .badge-error   { border-color: rgba(248,113,113,.5); }
[data-theme="dark"] .badge-info    { border-color: rgba(96,165,250,.5); }
[data-theme="dark"] .alert-success, [data-theme="dark"] .alert-warning,
[data-theme="dark"] .alert-error, [data-theme="dark"] .alert-info { color: var(--color-text-primary); }
[data-theme="dark"] .form-input::placeholder,
[data-theme="dark"] .form-textarea::placeholder { color: var(--color-text-muted); opacity: 1; }
[data-theme="dark"] .table thead th,
[data-theme="dark"] .data-table thead th { background: var(--color-surface-elevated); color: var(--color-text-primary); }
[data-theme="dark"] .text-muted { color: var(--color-text-muted) !important; }

/* ═══════════════════════════════════════════════════════════════
   13. MODALS
═══════════════════════════════════════════════════════════════ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 20, 30, 0.55);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    z-index: var(--z-modal);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-base), visibility var(--transition-base);
}
.modal-overlay.open {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--color-surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.95) translateY(10px);
    transition: transform var(--transition-slow);
}
.modal-overlay.open .modal { transform: scale(1) translateY(0); }

.modal-sm  { max-width: 380px; }
.modal-lg  { max-width: 720px; }
.modal-xl  { max-width: 960px; }

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--color-border);
}
.modal-title {
    font-size: var(--text-lg);
    font-weight: var(--weight-semibold);
    color: var(--color-text-primary);
}
.modal-close {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color var(--transition-fast), color var(--transition-fast);
}
.modal-close:hover { background-color: var(--color-surface-hover); color: var(--color-text-primary); }

.modal-body   { padding: var(--space-6); }
.modal-footer {
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-3);
    background-color: var(--color-surface-hover);
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

/* ═══════════════════════════════════════════════════════════════
   14. TOASTS
═══════════════════════════════════════════════════════════════ */
.toast-container {
    position: fixed;
    top: 20px;
    inset-inline-end: 20px;
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    pointer-events: none;
    max-width: 360px;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-4);
    background: var(--color-surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--color-border);
    font-size: var(--text-sm);
    pointer-events: auto;
    animation: toastIn 0.25s ease forwards;
    max-width: 360px;
}
[dir="ltr"] .toast { animation-name: toastInLtr; }

.toast-success { border-inline-start: 4px solid var(--color-success); }
.toast-error   { border-inline-start: 4px solid var(--color-error); }
.toast-warning { border-inline-start: 4px solid var(--color-warning); }
.toast-info    { border-inline-start: 4px solid var(--color-info); }

.toast-icon { flex-shrink: 0; width: 20px; height: 20px; }
.toast-text { flex: 1; }
.toast-title { font-weight: var(--weight-semibold); color: var(--color-text-primary); }
.toast-message { color: var(--color-text-secondary); margin-top: 2px; }
.toast-close {
    width: 20px; height: 20px;
    cursor: pointer; color: var(--color-text-muted);
    background: none; border: none;
    padding: 0; display: flex; align-items: center; justify-content: center;
    border-radius: 4px;
    transition: color var(--transition-fast);
}
.toast-close:hover { color: var(--color-text-primary); }

.toast.hiding { animation: toastOut 0.2s ease forwards; }
[dir="ltr"] .toast.hiding { animation-name: toastOutLtr; }

/* ═══════════════════════════════════════════════════════════════
   15. TOOLTIPS
═══════════════════════════════════════════════════════════════ */
[data-tooltip] {
    position: relative;
}
[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    right: 50%;
    transform: translateX(50%);
    background: var(--color-text-primary);
    color: var(--color-surface);
    font-size: var(--text-xs);
    font-weight: var(--weight-medium);
    padding: 5px 10px;
    border-radius: var(--radius-xs);
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--transition-fast);
    z-index: var(--z-tooltip);
    box-shadow: var(--shadow-md);
}
[data-tooltip]:hover::after { opacity: 1; }

/* ═══════════════════════════════════════════════════════════════
   16. DROPDOWNS
═══════════════════════════════════════════════════════════════ */
.dropdown-wrapper { position: relative; display: inline-block; }

.dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    inset-inline-end: 0;
    min-width: 210px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: var(--z-dropdown);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition:
        opacity var(--transition-base),
        visibility var(--transition-base),
        transform var(--transition-base);
}

/* In Topbar: actions are placed against the edge.
   In RTL, topbar-actions is on the LEFT. Dropdowns must align to left:0 so they expand inwards towards the right.
   In LTR, topbar-actions is on the RIGHT. Dropdowns must align to right:0 so they expand inwards towards the left. */
.topbar-actions .dropdown-menu {
    left: 0;
    right: auto;
}
[dir="ltr"] .topbar-actions .dropdown-menu {
    left: auto;
    right: 0;
}

.dropdown-menu.dropdown-menu-wide {
    min-width: 300px;
    max-width: 380px;
}

.dropdown-menu.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--color-surface-hover);
    border-bottom: 1px solid var(--color-border);
    font-size: var(--text-sm);
}

.dropdown-header-user {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 12px 14px;
    background: var(--color-surface-hover);
    border-bottom: 1px solid var(--color-border);
}
.dropdown-header-user .font-semibold {
    color: var(--color-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dropdown-header-user .text-muted {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 170px;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 9px 14px;
    font-size: var(--text-sm);
    color: var(--color-text-primary);
    cursor: pointer;
    transition: background-color var(--transition-fast);
    border: none;
    background: none;
    width: 100%;
    text-align: start;
    font-family: inherit;
    text-decoration: none;
    box-sizing: border-box;
}
.dropdown-item:hover { background-color: var(--color-surface-hover); color: var(--color-text-primary); }
.dropdown-item.danger { color: var(--color-error); }
.dropdown-item.danger:hover { background-color: var(--color-error-light); color: var(--color-error-dark, #b91c1c); }
.dropdown-divider { height: 1px; background: var(--color-border); margin: 4px 0; }

/* ═══════════════════════════════════════════════════════════════
   17. PAGINATION
═══════════════════════════════════════════════════════════════ */
.pagination {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    font-size: var(--text-sm);
}

.page-item {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 var(--space-2);
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--color-text-secondary);
    font-weight: var(--weight-medium);
    border: 1px solid transparent;
    transition:
        background-color var(--transition-fast),
        color var(--transition-fast),
        border-color var(--transition-fast);
    text-decoration: none;
}
.page-item:hover { background-color: var(--color-surface-hover); color: var(--color-primary); }
.page-item.active {
    background-color: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}
.page-item.disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }

/* ═══════════════════════════════════════════════════════════════
   18. EMPTY / LOADING / ERROR STATES
═══════════════════════════════════════════════════════════════ */
.state-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: var(--space-16) var(--space-6);
    gap: var(--space-4);
}

.state-icon {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-2);
}
.state-icon-empty   { background: var(--color-surface-hover); color: var(--color-text-muted); }
.state-icon-error   { background: var(--color-error-light);   color: var(--color-error); }
.state-icon-success { background: var(--color-success-light); color: var(--color-success); }

.state-title {
    font-size: var(--text-lg);
    font-weight: var(--weight-semibold);
    color: var(--color-text-primary);
}
.state-desc {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    max-width: 360px;
    line-height: var(--line-relaxed);
}

/* Skeleton loading */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--color-surface-hover) 25%,
        var(--color-border) 50%,
        var(--color-surface-hover) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}
.skeleton-text  { height: 14px; }
.skeleton-title { height: 20px; }
.skeleton-avatar { width: 40px; height: 40px; border-radius: 50%; }

/* Page loading spinner */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2.5px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
.spinner-sm { width: 14px; height: 14px; border-width: 2px; }
.spinner-lg { width: 32px; height: 32px; border-width: 3px; }

/* ═══════════════════════════════════════════════════════════════
   19. UTILITY CLASSES
═══════════════════════════════════════════════════════════════ */
/* Display */
.flex    { display: flex; }
.inline-flex { display: inline-flex; }
.hidden  { display: none !important; }
.block   { display: block; }
.grid    { display: grid; }
.grid > * { min-width: 0; }
.grid-2  { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3  { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4  { grid-template-columns: repeat(4, minmax(0, 1fr)); }

@media (max-width: 1024px) {
    .grid-3,
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
    .grid-2,
    .grid-3,
    .grid-4 { grid-template-columns: minmax(0, 1fr); }
}

/* Flex */
.items-center   { align-items: center; }
.items-start    { align-items: flex-start; }
.items-end      { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-end    { justify-content: flex-end; }
.justify-between { justify-content: space-between; }
.justify-start  { justify-content: flex-start; }
.flex-1         { flex: 1; }
.flex-wrap      { flex-wrap: wrap; }
.gap-1          { gap: var(--space-1); }
.gap-2          { gap: var(--space-2); }
.gap-3          { gap: var(--space-3); }
.gap-4          { gap: var(--space-4); }
.gap-5          { gap: var(--space-5); }
.gap-6          { gap: var(--space-6); }

/* Spacing */
.mt-2  { margin-top: var(--space-2); }
.mt-4  { margin-top: var(--space-4); }
.mt-6  { margin-top: var(--space-6); }
.mb-4  { margin-bottom: var(--space-4); }
.mb-6  { margin-bottom: var(--space-6); }
.p-4   { padding: var(--space-4); }
.p-6   { padding: var(--space-6); }

/* Width */
.w-full { width: 100%; }

/* Border radius */
.rounded    { border-radius: var(--radius-sm); }
.rounded-md { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-full { border-radius: var(--radius-full); }

/* Shadow */
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }

/* Colors */
.bg-surface { background-color: var(--color-surface); }
.bg-primary { background-color: var(--color-primary); }
.border-b   { border-bottom: 1px solid var(--color-border); }

/* Overflow */
.overflow-hidden { overflow: hidden; }
.overflow-auto   { overflow: auto; }

/* Cursor */
.cursor-pointer { cursor: pointer; }

/* Position */
.relative { position: relative; }
.absolute { position: absolute; }

/* ═══════════════════════════════════════════════════════════════
   20. ANIMATIONS
═══════════════════════════════════════════════════════════════ */
@keyframes spin {
    to { transform: rotate(360deg); }
}

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

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

@keyframes toastInLtr {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toastOut {
    to {
        opacity: 0;
        transform: translateX(30px);
        max-height: 0;
        padding: 0;
        margin: 0;
    }
}

@keyframes toastOutLtr {
    to {
        opacity: 0;
        transform: translateX(-30px);
        max-height: 0;
        padding: 0;
        margin: 0;
    }
}

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

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(20px); }
    to   { opacity: 1; transform: translateX(0); }
}

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

/* ═══════════════════════════════════════════════════════════════
   21. FOCUS VISIBLE (Accessibility)
═══════════════════════════════════════════════════════════════ */
:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}
:focus:not(:focus-visible) {
    outline: none;
}

/* ═══════════════════════════════════════════════════════════════
   22. DIVIDER
═══════════════════════════════════════════════════════════════ */
.divider {
    height: 1px;
    background: var(--color-border);
    margin: var(--space-4) 0;
}
.divider-text {
    position: relative;
    text-align: center;
    color: var(--color-text-muted);
    font-size: var(--text-xs);
    margin: var(--space-4) 0;
}
.divider-text::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0; right: 0;
    height: 1px;
    background: var(--color-border);
}
.divider-text span {
    position: relative;
    background: var(--color-surface);
    padding: 0 var(--space-3);
}

/* ═══════════════════════════════════════════════════════════════
   23. AVATAR
═══════════════════════════════════════════════════════════════ */
.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: var(--weight-semibold);
    color: #fff;
    flex-shrink: 0;
    background: var(--color-primary);
    text-transform: uppercase;
}
.avatar-xs { width: 24px; height: 24px; font-size: 9px; }
.avatar-sm { width: 32px; height: 32px; font-size: 12px; }
.avatar-md { width: 40px; height: 40px; font-size: 14px; }
.avatar-lg { width: 48px; height: 48px; font-size: 18px; }
.avatar-xl { width: 64px; height: 64px; font-size: 24px; }

/* Avatar colors by role */
.avatar-admin     { background: linear-gradient(135deg, #0284C7, #38BDF8); }
.avatar-doctor    { background: linear-gradient(135deg, #22D3EE, #38BDF8); }
.avatar-secretary { background: linear-gradient(135deg, #7C3AED, #9F67FA); }
.avatar-patient   { background: linear-gradient(135deg, #22C55E, #4ADE80); }

/* ═══════════════════════════════════════════════════════════════
   24. SEARCH BOX
═══════════════════════════════════════════════════════════════ */
.search-box {
    position: relative;
    display: flex;
    align-items: center;
}
.search-box .search-icon {
    position: absolute;
    inset-inline-start: 12px;
    color: var(--color-text-muted);
    pointer-events: none;
    width: 18px;
    height: 18px;
}

.search-box .form-input {
    padding-inline-start: 40px;
    padding-inline-end: 14px;
    background-color: var(--color-bg);
}

/* ═══════════════════════════════════════════════════════════════
   25. SECTION HEADER
═══════════════════════════════════════════════════════════════ */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-5);
    gap: var(--space-4);
    flex-wrap: wrap;
}
.section-title {
    font-size: var(--text-xl);
    font-weight: var(--weight-semibold);
    color: var(--color-text-primary);
}
.section-subtitle {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    margin-top: 2px;
}

/* ═══════════════════════════════════════════════════════════════
   26. GLOBAL RESPONSIVE MEDIA QUERIES & TOUCH OPTIMIZATIONS
═══════════════════════════════════════════════════════════════ */
/* Viewport Safety */
html, body {
    max-width: 100%;
    overflow-x: clip;
}

@media (max-width: 768px) {
    .w-full-mobile { width: 100% !important; }
    .flex-col-mobile { flex-direction: column !important; align-items: stretch !important; }
    .hide-mobile { display: none !important; }
    .show-mobile { display: block !important; }
}

@media (max-width: 640px) {
    /* Modals & Dialogs */
    .modal-overlay {
        padding: 12px;
    }
    .modal {
        max-width: 100% !important;
        width: 100% !important;
        border-radius: var(--radius-lg);
        max-height: 85vh;
    }
    .modal-header {
        padding: var(--space-4);
    }
    .modal-body {
        padding: var(--space-4);
    }
    .modal-footer {
        padding: var(--space-3) var(--space-4);
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-2);
    }
    .modal-footer .btn {
        width: 100%;
        justify-content: center;
    }

    /* Cards */
    .card-header,
    .card-body,
    .card-footer {
        padding: var(--space-4);
    }

    /* Toasts */
    .toast-container {
        left: 12px;
        right: 12px;
        max-width: none;
        top: 12px;
    }
    .toast {
        max-width: 100%;
    }

    /* Tables */
    .table th,
    .table td,
    .data-table th,
    .data-table td {
        padding: 10px 12px;
        font-size: var(--text-xs);
    }
}

@media (max-width: 480px) {
    .card-header,
    .card-body,
    .card-footer {
        padding: var(--space-3);
    }
    .page-title {
        font-size: var(--text-xl);
    }
    .alert {
        padding: 10px 12px;
        font-size: var(--text-xs);
    }
    /* Buttons & Form controls touch size */
    .btn {
        min-height: 38px;
    }
    .form-input,
    .form-select {
        font-size: 14px;
    }
}
