/* ============================================
   Mind-Well | style.css  v2.0
   Global Styles — Mental Health Platform
   UPGRADED: Better typography, refined variables,
   improved components, polished auth pages
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=Playfair+Display:wght@600;700;800&display=swap');

/* ============================================
   CSS CUSTOM PROPERTIES
   ============================================ */
:root {
    /* Brand Colors */
    --primary:       #18A89A;
    --primary-dark:  #12887C;
    --primary-light: #E0F5F3;
    --primary-rgb:   24,168,154;
    --secondary:     #5B8DEF;
    --secondary-rgb: 91,141,239;
    --accent:        #7ECA9C;
    --accent-warm:   #F4A26B;

    /* Surface / Background */
    --bg:        #F2F5FB;
    --surface:   #FFFFFF;
    --surface-2: #EFF3FA;
    --surface-3: #E8EDF7;

    /* Borders */
    --border:       #DDE3EE;
    --border-focus: var(--primary);

    /* Text */
    --text:       #18243E;
    --text-muted: #5D6E8A;
    --text-light: #8FA0BB;

    /* Semantic */
    --danger:  #E53E3E;
    --warning: #D97706;
    --success: #0D9E6B;
    --info:    #2563EB;

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-sm: 0 1px 4px rgba(0,0,0,0.06), 0 2px 8px rgba(0,0,0,0.04);
    --shadow:    0 4px 16px rgba(0,0,0,0.08), 0 1px 4px rgba(0,0,0,0.04);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.12), 0 4px 12px rgba(0,0,0,0.06);
    --shadow-xl: 0 24px 64px rgba(0,0,0,0.16);

    /* Radii */
    --radius-xs: 4px;
    --radius-sm: 8px;
    --radius:    12px;
    --radius-lg: 18px;
    --radius-xl: 24px;

    /* Typography */
    --font-base:    'DM Sans', system-ui, sans-serif;
    --font-display: 'Playfair Display', Georgia, serif;

    /* Font Scale */
    --fs-xs:  0.72rem;
    --fs-sm:  0.85rem;
    --fs-base:1rem;
    --fs-md:  1.1rem;
    --fs-lg:  1.22rem;
    --fs-xl:  1.5rem;
    --fs-2xl: 1.9rem;
    --fs-3xl: 2.5rem;

    /* Layout */
    --sidebar-width: 248px;
    --nav-height:    64px;
    --page-pad:      28px;

    /* Motion */
    --transition: 0.18s cubic-bezier(.4,0,.2,1);
    --transition-slow: 0.35s cubic-bezier(.4,0,.2,1);
}

/* ============================================
   DARK MODE
   ============================================ */
body[data-theme="dark"] {
    --bg:        #0C1525;
    --surface:   #162032;
    --surface-2: #1D2C42;
    --surface-3: #243350;
    --border:    #2D3F5A;
    --text:      #E8EFF9;
    --text-muted:#8FA0BB;
    --text-light:#5D6E8A;
    --primary-light: #0F2E2B;
    --shadow-sm: 0 1px 4px rgba(0,0,0,0.25), 0 2px 8px rgba(0,0,0,0.18);
    --shadow:    0 4px 16px rgba(0,0,0,0.35), 0 1px 4px rgba(0,0,0,0.2);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.5);
}

/* ============================================
   HIGH CONTRAST
   ============================================ */
body[data-contrast="high"] {
    --primary:      #006860;
    --primary-dark: #004D47;
    --bg:           #FFFFFF;
    --surface:      #FFFFFF;
    --surface-2:    #F5F5F5;
    --border:       #000000;
    --text:         #000000;
    --text-muted:   #111111;
    --text-light:   #333333;
}
body[data-theme="dark"][data-contrast="high"] {
    --bg:       #000000;
    --surface:  #0A0A0A;
    --surface-2:#111111;
    --border:   #FFFFFF;
    --text:     #FFFFFF;
    --text-muted:#DDDDDD;
}
body[data-contrast="high"] .card,
body[data-contrast="high"] .stat-card,
body[data-contrast="high"] .article-list-item,
body[data-contrast="high"] .post-card {
    border: 2px solid #000 !important;
}
body[data-theme="dark"][data-contrast="high"] .card,
body[data-theme="dark"][data-contrast="high"] .stat-card {
    border: 2px solid #FFF !important;
}
body[data-contrast="high"] .btn-primary {
    background: #005A54 !important;
    outline: 2px solid #000;
}

/* ============================================
   RESET & BASE
   ============================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── HTML root: controls the rem baseline for EVERY element ──
   All --fs-* variables are in rem, so scaling here propagates
   automatically to headings, paragraphs, buttons, forms, cards,
   sidebars — everything — without touching individual rules.   */
html {
    scroll-behavior: smooth;
    font-size: 100%;          /* 100% = 16px browser default      */
}

/* Font Scale — 6 levels for full low-vision support
   Setting font-size on <html> changes what 1rem equals globally.
   ─────────────────────────────────────────────────────────────
   Level    | html %  | 1rem =  | Relative to normal
   ────────────────────────────────────────────────
   small    | 87.5%   | 14px    | −12.5%
   default  | 100%    | 16px    |  base  ← default
   medium   | 112.5%  | 18px    | +12.5%
   large    | 125%    | 20px    | +25%
   xlarge   | 143.75% | 23px    | +43.75%
   xxlarge  | 168.75% | 27px    | +68.75%
   ───────────────────────────────────────────────────────────── */
html[data-fontsize="small"]   { font-size:  87.5%; }
html[data-fontsize="default"] { font-size:  100%;  }
html[data-fontsize="medium"]  { font-size:  112.5%;}
html[data-fontsize="large"]   { font-size:  125%;  }
html[data-fontsize="xlarge"]  { font-size:  143.75%;}
html[data-fontsize="xxlarge"] { font-size:  168.75%;}

body {
    font-family: var(--font-base);
    background: var(--bg);
    color: var(--text);
    font-size: var(--fs-base);    /* 1rem — scales with html root */
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    transition: background var(--transition-slow), color var(--transition);
    min-height: 100vh;
}

/* Sidebar width grows with font so nav labels don't clip */
html[data-fontsize="medium"]  .sidebar { width: 256px; }
html[data-fontsize="medium"]  .main-content { margin-left: 256px; }
html[data-fontsize="large"]   .sidebar { width: 268px; }
html[data-fontsize="large"]   .main-content { margin-left: 268px; }
html[data-fontsize="xlarge"]  .sidebar { width: 284px; }
html[data-fontsize="xlarge"]  .main-content { margin-left: 284px; }
html[data-fontsize="xxlarge"] .sidebar { width: 310px; }
html[data-fontsize="xxlarge"] .main-content { margin-left: 310px; }

a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; display: block; }
ul { list-style: none; }
button { font-family: var(--font-base); }

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-light); }

/* ============================================
   LAYOUT
   ============================================ */
.page-wrapper { display: flex; min-height: 100vh; }

/* ── Sidebar ── */
.sidebar {
    width: var(--sidebar-width);
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: background var(--transition-slow), border-color var(--transition), transform 0.3s ease;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-brand {
    padding: 22px 18px 18px;
    border-bottom: 1px solid var(--border);
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 3px;
    text-decoration: none;
}

.brand-logo .logo-icon {
    width: 38px; height: 38px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    color: white;
    font-size: 1.25rem;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(var(--primary-rgb),0.35);
}

.brand-logo .logo-text {
    font-family: var(--font-display);
    font-size: 1.32rem;
    color: var(--text);
    font-weight: 700;
    line-height: 1;
}

.brand-tagline {
    font-size: 0.68rem;
    color: var(--text-light);
    padding-left: 50px;   /* 40px icon + 10px gap */
    letter-spacing: 0.02em;
}

.sidebar-nav { padding: 14px 10px; flex: 1; }

.nav-section-label {
    font-size: 0.66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-light);
    padding: 10px 10px 4px;
    margin-top: 4px;
    display: block;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--transition);
    margin-bottom: 1px;
    line-height: 1.4;
}

.nav-item:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.nav-item.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white !important;
    box-shadow: 0 4px 14px rgba(var(--primary-rgb),0.32);
    font-weight: 600;
}

.nav-item .nav-icon {
    font-size: 1rem;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 14px 10px;
    border-top: 1px solid var(--border);
}

/* Sidebar User Card */
.sidebar-user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    border: 1px solid var(--border);
    text-decoration: none;
    transition: all var(--transition);
    margin-bottom: 10px;
}
.sidebar-user-card:hover {
    background: var(--primary-light);
    border-color: var(--primary);
}

.user-avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex; align-items: center; justify-content: center;
    color: white;
    font-weight: 700;
    font-size: var(--fs-sm);
    flex-shrink: 0;
}

.user-avatar-lg {
    width: 72px; height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex; align-items: center; justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 1.8rem;
    flex-shrink: 0;
    box-shadow: 0 4px 16px rgba(var(--primary-rgb),0.3);
}

.user-info .user-name {
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--text);
    line-height: 1.25;
}
.user-info .user-role {
    font-size: var(--fs-xs);
    color: var(--text-muted);
}

/* ── Main Content ── */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    max-width: calc(100vw - var(--sidebar-width));
}

/* ── Topbar ── */
.topbar {
    height: var(--nav-height);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--page-pad);
    position: sticky;
    top: 0;
    z-index: 90;
    transition: background var(--transition-slow);
}

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

.topbar-left h1 {
    font-size: var(--fs-lg);
    font-weight: 700;
    color: var(--text);
    line-height: 1;
}

.topbar-breadcrumb {
    font-size: var(--fs-xs);
    color: var(--text-muted);
    margin-top: 2px;
}

.topbar-actions { display: flex; align-items: center; gap: 6px; }

/* ── Page Body ── */
.page-body {
    padding: var(--page-pad);
    flex: 1;
    max-width: 1400px;
}

/* ============================================
   COMPONENTS
   ============================================ */

/* ── Card ── */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: background var(--transition-slow), border-color var(--transition);
    overflow: hidden;
}

.card-hover {
    transition: all var(--transition);
}
.card-hover:hover {
    box-shadow: var(--shadow);
    border-color: rgba(var(--primary-rgb),0.25);
    transform: translateY(-2px);
}

.card-header {
    padding: 20px 22px 0;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

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

.card-subtitle {
    font-size: var(--fs-sm);
    color: var(--text-muted);
    margin-top: 3px;
    line-height: 1.5;
}

.card-body { padding: 20px 22px; }

/* ── Stat Cards ── */
.stat-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 20px;
    border: 1px solid var(--border);
    display: flex;
    align-items: flex-start;
    gap: 14px;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    opacity: 0;
    transition: opacity var(--transition);
}

.stat-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.stat-card:hover::after { opacity: 1; }

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

.stat-icon.teal   { background: rgba(var(--primary-rgb),0.12); }
.stat-icon.blue   { background: rgba(var(--secondary-rgb),0.12); }
.stat-icon.green  { background: rgba(13,158,107,0.12); }
.stat-icon.orange { background: rgba(244,162,107,0.15); }
.stat-icon.purple { background: rgba(139,92,246,0.12); }
body[data-theme="dark"] .stat-icon.teal   { background: rgba(var(--primary-rgb),0.18); }
body[data-theme="dark"] .stat-icon.blue   { background: rgba(var(--secondary-rgb),0.18); }
body[data-theme="dark"] .stat-icon.green  { background: rgba(13,158,107,0.18); }
body[data-theme="dark"] .stat-icon.orange { background: rgba(244,162,107,0.18); }

.stat-content {}
.stat-value {
    font-size: 1.9rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1;
    letter-spacing: -0.02em;
}
.stat-label {
    font-size: var(--fs-xs);
    color: var(--text-muted);
    margin-top: 5px;
    font-weight: 500;
}
.stat-trend {
    font-size: var(--fs-xs);
    color: var(--success);
    margin-top: 2px;
    font-weight: 600;
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font-size: var(--fs-sm);
    font-weight: 600;
    font-family: var(--font-base);
    cursor: pointer;
    border: none;
    transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap;
    line-height: 1;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 14px rgba(var(--primary-rgb),0.3);
}
.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(var(--primary-rgb),0.42);
    transform: translateY(-1px);
    color: white;
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
    background: var(--surface-2);
    color: var(--text-muted);
    border: 1px solid var(--border);
}
.btn-secondary:hover {
    background: var(--surface-3);
    color: var(--text);
    border-color: var(--text-light);
}

.btn-danger  { background: var(--danger);  color: white; }
.btn-danger:hover  { opacity: 0.88; color: white; transform: translateY(-1px); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { opacity: 0.88; color: white; transform: translateY(-1px); }
.btn-warning { background: var(--warning); color: white; }

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.btn-white {
    background: rgba(255,255,255,0.18);
    color: white;
    border: 1.5px solid rgba(255,255,255,0.38);
    backdrop-filter: blur(8px);
}
.btn-white:hover { background: rgba(255,255,255,0.28); color: white; }

.btn-sm { padding: 6px 13px; font-size: var(--fs-xs); }
.btn-lg { padding: 13px 26px; font-size: var(--fs-base); border-radius: 10px; }

.btn-icon {
    width: 34px; height: 34px;
    padding: 0;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
    font-size: 0.85rem;
    font-family: var(--font-base);
}
.btn-icon:hover { background: var(--surface-3); color: var(--text); }

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

.form-label {
    display: block;
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
    letter-spacing: 0.01em;
}

.form-label .required { color: var(--danger); margin-left: 2px; }

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: var(--fs-sm);
    font-family: var(--font-base);
    background: var(--surface);
    color: var(--text);
    transition: all var(--transition);
    outline: none;
    line-height: 1.5;
}
.form-control:hover:not(:focus) { border-color: var(--text-light); }
.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb),0.14);
}
.form-control::placeholder { color: var(--text-light); }
.form-control.is-invalid { border-color: var(--danger); }
.form-control.is-invalid:focus { box-shadow: 0 0 0 3px rgba(229,62,62,0.14); }
textarea.form-control { resize: vertical; min-height: 100px; line-height: 1.7; }
select.form-control { cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238FA0BB' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }

.form-hint { font-size: var(--fs-xs); color: var(--text-muted); margin-top: 4px; }
.invalid-feedback { font-size: var(--fs-xs); color: var(--danger); margin-top: 4px; }
.char-counter { font-size: var(--fs-xs); color: var(--text-muted); text-align: right; margin-top: 4px; }

/* Input with icon */
.input-icon-wrapper { position: relative; }
.input-icon-wrapper .form-control { padding-left: 40px; }
.input-icon-wrapper .input-icon {
    position: absolute;
    left: 13px; top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    font-size: 0.95rem;
    pointer-events: none;
    line-height: 1;
}
.input-icon-wrapper .toggle-pass {
    position: absolute;
    right: 12px; top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: var(--text-muted);
    background: none; border: none;
    font-size: 0.95rem;
    padding: 0; transition: color var(--transition);
}
.input-icon-wrapper .toggle-pass:hover { color: var(--primary); }

/* ── Badges ── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.badge-primary { background: var(--primary-light); color: var(--primary-dark); }
.badge-success { background: #D1FAE5; color: #065F46; }
.badge-warning { background: #FEF3C7; color: #92400E; }
.badge-danger  { background: #FEE2E2; color: #991B1B; }
.badge-neutral { background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border); }
.badge-blue    { background: #DBEAFE; color: #1E40AF; }
body[data-theme="dark"] .badge-success { background: rgba(16,185,129,0.18); color: #6EE7B7; }
body[data-theme="dark"] .badge-warning { background: rgba(245,158,11,0.18); color: #FCD34D; }
body[data-theme="dark"] .badge-danger  { background: rgba(239,68,68,0.18);  color: #FCA5A5; }
body[data-theme="dark"] .badge-blue    { background: rgba(37,99,235,0.18);   color: #93C5FD; }

/* ── Alerts ── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: var(--fs-sm);
    margin-bottom: 16px;
    border: 1px solid transparent;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    line-height: 1.6;
}
.alert-success { background: #ECFDF5; color: #065F46; border-color: #A7F3D0; }
.alert-danger  { background: #FEF2F2; color: #991B1B; border-color: #FECACA; }
.alert-warning { background: #FFFBEB; color: #92400E; border-color: #FDE68A; }
.alert-info    { background: #EFF6FF; color: #1E40AF; border-color: #BFDBFE; }
body[data-theme="dark"] .alert-success { background: rgba(16,185,129,0.1); color: #6EE7B7; border-color: rgba(16,185,129,0.3); }
body[data-theme="dark"] .alert-danger  { background: rgba(239,68,68,0.1);  color: #FCA5A5; border-color: rgba(239,68,68,0.3); }
body[data-theme="dark"] .alert-warning { background: rgba(245,158,11,0.1); color: #FCD34D; border-color: rgba(245,158,11,0.3); }
body[data-theme="dark"] .alert-info    { background: rgba(37,99,235,0.1);  color: #93C5FD; border-color: rgba(37,99,235,0.3); }

/* ── Grids ── */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px,1fr)); gap: 20px; }

/* ── Tables ── */
.table-wrapper { overflow-x: auto; border-radius: var(--radius-sm); }
table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
th {
    text-align: left;
    padding: 11px 14px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
    white-space: nowrap;
}
td {
    padding: 13px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface-2); }

/* ── Section Headers ── */
.section-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
}
.section-title {
    font-size: var(--fs-xl);
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.01em;
    line-height: 1.2;
}
.section-subtitle {
    font-size: var(--fs-sm);
    color: var(--text-muted);
    margin-top: 4px;
    line-height: 1.5;
}

/* ── Divider ── */
.divider { height: 1px; background: var(--border); margin: 20px 0; }
.divider-v { width: 1px; background: var(--border); }

/* ── Empty State ── */
.empty-state {
    text-align: center;
    padding: 56px 20px;
    color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 2.8rem; margin-bottom: 14px; opacity: 0.45; }
.empty-state h3 { font-size: var(--fs-lg); color: var(--text); margin-bottom: 8px; font-weight: 700; }
.empty-state p { font-size: var(--fs-sm); max-width: 320px; margin: 0 auto; line-height: 1.6; }

/* ── Utility ── */
.flex          { display: flex; }
.flex-center   { display: flex; align-items: center; justify-content: center; }
.flex-between  { display: flex; align-items: center; justify-content: space-between; }
.flex-col      { display: flex; flex-direction: column; }
.items-center  { align-items: center; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; } .gap-5 { gap: 24px; }
.mt-1{margin-top:4px;} .mt-2{margin-top:8px;} .mt-3{margin-top:12px;} .mt-4{margin-top:16px;} .mt-5{margin-top:24px;} .mt-6{margin-top:32px;}
.mb-1{margin-bottom:4px;} .mb-2{margin-bottom:8px;} .mb-3{margin-bottom:12px;} .mb-4{margin-bottom:16px;} .mb-5{margin-bottom:24px;} .mb-6{margin-bottom:32px;}
.text-muted    { color: var(--text-muted); }
.text-center   { text-align: center; }
.text-right    { text-align: right; }
.text-xs  { font-size: var(--fs-xs); }
.text-sm  { font-size: var(--fs-sm); }
.text-md  { font-size: var(--fs-md); }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.fw-800 { font-weight: 800; }
.w-100  { width: 100%; }
.d-none { display: none; }

/* ============================================
   AUTH PAGES — REDESIGNED
   ============================================ */
.auth-page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
}

@media (max-width: 860px) {
    .auth-page { grid-template-columns: 1fr; }
    .auth-panel { display: none; }
}

/* Left visual panel */
.auth-panel {
    background: linear-gradient(160deg, var(--primary) 0%, #0D7B6E 40%, var(--secondary) 100%);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 48px 52px;
    color: white;
    position: relative;
    overflow: hidden;
}

.auth-panel::before {
    content: '';
    position: absolute;
    width: 500px; height: 500px;
    border-radius: 50%;
    background: rgba(255,255,255,0.06);
    bottom: -200px; right: -200px;
}
.auth-panel::after {
    content: '';
    position: absolute;
    width: 300px; height: 300px;
    border-radius: 50%;
    background: rgba(255,255,255,0.06);
    top: -100px; left: -100px;
}

.auth-panel-content { position: relative; z-index: 1; }

.auth-panel-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 48px;
}
.auth-panel-brand .logo-icon {
    width: 44px; height: 44px;
    background: rgba(255,255,255,0.2);
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.3);
}
.auth-panel-brand .logo-name {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
}

.auth-panel h2 {
    font-family: var(--font-display);
    font-size: 2.2rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 16px;
    color: white;
}
.auth-panel p {
    font-size: var(--fs-sm);
    opacity: 0.82;
    line-height: 1.7;
    max-width: 360px;
}

.auth-panel-features {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 40px;
}
.auth-feature-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}
.auth-feature-icon {
    width: 36px; height: 36px;
    background: rgba(255,255,255,0.15);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
    border: 1px solid rgba(255,255,255,0.2);
}
.auth-feature-text strong {
    display: block;
    font-size: var(--fs-sm);
    font-weight: 600;
    color: white;
    line-height: 1.3;
}
.auth-feature-text span {
    font-size: var(--fs-xs);
    opacity: 0.72;
    line-height: 1.5;
}

.auth-panel-footer {
    position: relative; z-index: 1;
}
.auth-panel-quote {
    background: rgba(255,255,255,0.1);
    border-left: 3px solid rgba(255,255,255,0.5);
    padding: 14px 18px;
    border-radius: 0 8px 8px 0;
    font-size: var(--fs-sm);
    font-style: italic;
    opacity: 0.85;
    line-height: 1.6;
}

/* Right form panel */
.auth-form-panel {
    background: var(--surface);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 40px;
    overflow-y: auto;
}
body[data-theme="dark"] .auth-form-panel { background: var(--bg); }

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

.auth-logo-mobile {
    display: none;
    text-align: center;
    margin-bottom: 32px;
}
@media (max-width: 860px) {
    .auth-logo-mobile { display: block; }
    .auth-form-panel { padding: 40px 24px; }
    .auth-form-box { max-width: 440px; }
}

.auth-heading {
    margin-bottom: 28px;
}
.auth-heading h2 {
    font-size: var(--fs-2xl);
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.02em;
    line-height: 1.2;
    margin-bottom: 6px;
}
.auth-heading p {
    font-size: var(--fs-sm);
    color: var(--text-muted);
    line-height: 1.6;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
    color: var(--text-muted);
    font-size: var(--fs-xs);
}
.auth-divider::before, .auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.auth-link-row {
    text-align: center;
    margin-top: 20px;
    font-size: var(--fs-sm);
    color: var(--text-muted);
}

.auth-demo-box {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    margin-top: 20px;
    font-size: var(--fs-xs);
    color: var(--text-muted);
    line-height: 1.7;
}
.auth-demo-box strong { color: var(--text); }

/* Accessibility toolbar on auth pages */
.auth-a11y {
    position: fixed;
    top: 12px; right: 12px;
    display: flex; gap: 5px;
    z-index: 999;
}

/* ============================================
   SKIP LINK & FOCUS
   ============================================ */
.skip-link {
    position: absolute;
    top: -60px; left: 12px;
    background: var(--primary);
    color: white;
    padding: 8px 16px;
    border-radius: 0 0 8px 8px;
    font-size: var(--fs-sm);
    font-weight: 600;
    z-index: 9999;
    transition: top 0.2s;
}
.skip-link:focus { top: 0; color: white; }
*:focus-visible { outline: 2.5px solid var(--primary); outline-offset: 2px; }

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.95); }
    to   { opacity: 1; transform: scale(1); }
}

.animate-in {
    animation: fadeInUp 0.38s ease both;
}
.animate-in:nth-child(1) { animation-delay: 0s; }
.animate-in:nth-child(2) { animation-delay: 0.04s; }
.animate-in:nth-child(3) { animation-delay: 0.08s; }
.animate-in:nth-child(4) { animation-delay: 0.12s; }
.animate-in:nth-child(5) { animation-delay: 0.16s; }
.animate-in:nth-child(6) { animation-delay: 0.20s; }

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

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; max-width: 100vw; }
    .page-body { padding: 16px; }
    .topbar { padding: 0 16px; }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .section-header { flex-direction: column; align-items: flex-start; }
}

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

/* ============================================================
   LOGO IMAGE SYSTEM — Mind-Well  (v3 — square app icon)
   New logo: square icon ~156×149px, rounded-rect style.
   Three strict size tiers control every placement.
   ============================================================ */

/* ── Base: applies to every logo-img element ── */
.logo-img {
    display:     block;       /* removes inline bottom gap        */
    object-fit:  contain;     /* never crop or distort            */
    width:        auto !important;  /* height is the driver        */
    flex-shrink:  0;          /* never compress inside flex rows  */
    max-width:    100%;       /* respect parent boundary          */
    border-radius: 10px;      /* matches the icon's own rounding  */
}

/* ── SM — 40px: sidebar, all navbars, footer ── */
.logo-sm {
    height:    40px !important;
    max-width: 40px !important;   /* square: 1:1 ratio lock */
}

/* ── MD — 60px: login / signup panels ── */
.logo-md {
    height:    60px !important;
    max-width: 60px !important;
}

/* ── LG — 90px: landing page hero / large display ── */
.logo-lg {
    height:    90px !important;
    max-width: 90px !important;
}

/* ── Logo container: wraps icon + text in a flex row ── */
.logo-container {
    display:     flex;
    align-items: center;
    gap:         10px;
    height:      auto;
    overflow:    hidden;
    text-decoration: none;
}

/* Wordmark text beside the icon */
.logo-wordmark {
    font-family: var(--font-display);
    font-weight: 700;
    color:       var(--text);
    line-height: 1.1;
    white-space: nowrap;
}
.logo-container.logo-container--sm .logo-wordmark { font-size: 1.18rem; }
.logo-container.logo-container--md .logo-wordmark { font-size: 1.5rem;  }
.logo-container.logo-container--lg .logo-wordmark { font-size: 1.9rem;  }

/* ── Auth-mobile: centred block above form ── */
.logo-img--auth-mobile {
    margin: 0 auto 8px;
}

/* ── Dark mode: icon already has a light bg — add subtle pill ── */
body[data-theme="dark"] .logo-sm,
body[data-theme="dark"] .logo-md,
body[data-theme="dark"] .logo-lg {
    box-shadow: 0 0 0 2px rgba(255,255,255,0.12);
}

/* ── High contrast ── */
body[data-contrast="high"] .logo-img {
    outline:       2px solid currentColor;
    border-radius: 6px;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .logo-sm { height: 34px !important; max-width: 34px !important; }
    .logo-md { height: 50px !important; max-width: 50px !important; }
}
