/* ============================================================
   CANNAVA — Premium Design System v2
   "Dark Apothecary" — Covetable. Considered. Crafted.
   ============================================================ */

/* ── Google Fonts loaded via cannalytica-head.php ─────────── */

/* ============================================================
   1. DESIGN TOKENS — Recreational Dark (default)
   ============================================================ */
:root,
[data-mode="recreational"][data-theme="dark"],
[data-mode="recreational"] {
  --bg:            #0a0a0f;
  --bg-elevated:   #111118;
  --surface:       #16161f;
  --card:          #1c1c28;
  --card-hover:    #21212f;
  --border:        #2a2a3d;
  --border-subtle: #1f1f2e;
  --border-strong: #3a3a55;

  --accent:        #7ece4a;
  --accent-dim:    rgba(126,206,74,0.12);
  --accent-glow:   rgba(126,206,74,0.25);
  --accent2:       #e8a23a;
  --accent2-dim:   rgba(232,162,58,0.12);
  --accent3:       #4ab8e8;
  --accent3-dim:   rgba(74,184,232,0.12);
  --accent-purple: #9d6fe8;
  --accent-med:    #b06ce8;
  --accent-med-dim:rgba(176,108,232,0.12);

  --primary:       var(--accent);
  --primary-text:  #0a0a0f;
  --danger:        #e85555;
  --danger-dim:    rgba(232,85,85,0.12);
  --success:       #4ace8a;
  --warning:       #e8c23a;

  --text:          #e8e8f0;
  --text-2:        #a0a0b8;
  --text-3:        #60607a;
  --muted:         #60607a;

  --sidebar-w:     240px;
  --sidebar-w-collapsed: 64px;
  --radius:        14px;
  --radius-sm:     8px;
  --radius-lg:     20px;
  --radius-full:   999px;

  --shadow-sm:     0 1px 3px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.3);
  --shadow:        0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg:     0 12px 40px rgba(0,0,0,0.6);
  --shadow-glow:   0 0 24px var(--accent-glow);

  --glass-bg:      rgba(255,255,255,0.04);
  --glass-border:  rgba(255,255,255,0.08);
  --glass-blur:    blur(16px);

  --gradient-primary:    linear-gradient(135deg, #7ece4a, #a0e870);
  --gradient-bg:         radial-gradient(ellipse 60% 50% at 10% 0%, rgba(126,206,74,0.06) 0%, transparent 50%),
                         radial-gradient(ellipse 40% 60% at 90% 100%, rgba(157,111,232,0.05) 0%, transparent 50%);
  --gradient-card:       linear-gradient(135deg, rgba(255,255,255,0.03) 0%, rgba(255,255,255,0.01) 100%);
  --gradient-accent:     linear-gradient(135deg, var(--accent), #a0e870);
  --gradient-sidebar:    linear-gradient(180deg, #111118 0%, #0e0e18 100%);

  --sidebar-bg:    #111118;
  --sidebar-border:#1f1f2e;
  --nav-active-bg: rgba(126,206,74,0.1);
  --nav-active:    var(--accent);
  --nav-text:      var(--text-3);
  --nav-text-hover:var(--text-2);

  --font-display:  'Syne', sans-serif;
  --font-sans:     'Inter', system-ui, sans-serif;
  --font-mono:     'DM Mono', monospace;
}

/* ── Recreational Light ───────────────────────────────────── */
[data-mode="recreational"][data-theme="light"] {
  --bg:            #f4f4f0;
  --bg-elevated:   #ffffff;
  --surface:       #ffffff;
  --card:          #ffffff;
  --card-hover:    #f8f8f4;
  --border:        #e2e2da;
  --border-subtle: #ebebE4;
  --border-strong: #c8c8be;

  --text:          #1a1a14;
  --text-2:        #48483a;
  --text-3:        #88887a;
  --muted:         #88887a;

  --glass-bg:      rgba(0,0,0,0.02);
  --glass-border:  rgba(0,0,0,0.06);
  --shadow-sm:     0 1px 3px rgba(0,0,0,0.08);
  --shadow:        0 4px 16px rgba(0,0,0,0.1);
  --shadow-lg:     0 12px 40px rgba(0,0,0,0.12);

  --sidebar-bg:    #1c1c28;
  --sidebar-border:#2a2a3d;
  --nav-text:      #a0a0b8;
  --nav-text-hover:#e8e8f0;
  --gradient-bg:   none;
  --gradient-card: none;
  --gradient-sidebar: linear-gradient(180deg, #1c1c28 0%, #16161f 100%);
}

/* ── Medical Dark ─────────────────────────────────────────── */
[data-mode="medical"],
[data-mode="medical"][data-theme="dark"] {
  --bg:            #080d14;
  --bg-elevated:   #0d1520;
  --surface:       #111e2e;
  --card:          #162336;
  --card-hover:    #1c2a40;
  --border:        #1e3048;
  --border-subtle: #172540;
  --border-strong: #2a4060;

  --accent:        #34c98a;
  --accent-dim:    rgba(52,201,138,0.12);
  --accent-glow:   rgba(52,201,138,0.2);
  --accent2:       #e8a23a;
  --accent2-dim:   rgba(232,162,58,0.12);
  --accent3:       #4a9eff;
  --accent3-dim:   rgba(74,158,255,0.12);
  --accent-purple: #a78bfa;
  --accent-med:    #a78bfa;
  --accent-med-dim:rgba(167,139,250,0.12);

  --primary:       var(--accent);
  --primary-text:  #080d14;
  --danger:        #e85555;
  --danger-dim:    rgba(232,85,85,0.12);
  --success:       #34c98a;
  --warning:       #e8c23a;

  --text:          #e0eaf8;
  --text-2:        #8aa0bc;
  --text-3:        #485870;
  --muted:         #485870;

  --shadow-sm:     0 1px 3px rgba(0,0,0,0.5);
  --shadow:        0 4px 16px rgba(0,0,0,0.6);
  --shadow-lg:     0 12px 40px rgba(0,0,0,0.7);
  --shadow-glow:   0 0 24px var(--accent-glow);

  --glass-bg:      rgba(255,255,255,0.03);
  --glass-border:  rgba(255,255,255,0.06);

  --gradient-primary: linear-gradient(135deg, #34c98a, #60e0a8);
  --gradient-bg:   radial-gradient(ellipse 60% 50% at 10% 0%, rgba(52,201,138,0.05) 0%, transparent 50%),
                   radial-gradient(ellipse 40% 60% at 90% 100%, rgba(74,158,255,0.04) 0%, transparent 50%);
  --gradient-card: linear-gradient(135deg, rgba(255,255,255,0.02) 0%, rgba(255,255,255,0.01) 100%);
  --gradient-accent: linear-gradient(135deg, #34c98a, #60e0a8);
  --gradient-sidebar: linear-gradient(180deg, #0d1520 0%, #0a1018 100%);

  --sidebar-bg:    #0d1520;
  --sidebar-border:#1e3048;
  --nav-active-bg: rgba(52,201,138,0.1);
  --nav-active:    var(--accent);
  --nav-text:      var(--text-3);
  --nav-text-hover:var(--text-2);

  --font-display:  'Inter', system-ui, sans-serif;
  --font-sans:     'Inter', system-ui, sans-serif;
  --font-mono:     'DM Mono', monospace;
}

/* ── Medical Light ─────────────────────────────────────────── */
[data-mode="medical"][data-theme="light"] {
  --bg:            #f0f7ff;
  --bg-elevated:   #ffffff;
  --surface:       #ffffff;
  --card:          #ffffff;
  --card-hover:    #f4faff;
  --border:        #d0e4f8;
  --border-subtle: #e0eff8;
  --border-strong: #a8c8e8;

  --text:          #0a1828;
  --text-2:        #2a4860;
  --text-3:        #607888;
  --muted:         #607888;

  --glass-bg:      rgba(0,0,0,0.02);
  --glass-border:  rgba(0,0,0,0.05);
  --shadow-sm:     0 1px 3px rgba(0,20,40,0.08);
  --shadow:        0 4px 16px rgba(0,20,40,0.1);
  --shadow-lg:     0 12px 40px rgba(0,20,40,0.12);

  --sidebar-bg:    #0d1520;
  --sidebar-border:#1e3048;
  --nav-text:      #8aa0bc;
  --nav-text-hover:#e0eaf8;
  --gradient-bg:   none;
  --gradient-card: none;
  --gradient-sidebar: linear-gradient(180deg, #0d1520 0%, #080d14 100%);
}

/* ── Admin ─────────────────────────────────────────────────── */
[data-mode="admin"] {
  --bg:            #09090e;
  --bg-elevated:   #0f0f16;
  --surface:       #131320;
  --card:          #18182a;
  --card-hover:    #1e1e32;
  --border:        #252538;
  --border-subtle: #1a1a2c;
  --border-strong: #333355;
  --accent:        #4a9eff;
  --accent-dim:    rgba(74,158,255,0.12);
  --accent-glow:   rgba(74,158,255,0.2);
  --accent2:       #e8c23a;
  --accent3:       #34c98a;
  --accent-med:    #a78bfa;
  --accent-med-dim:rgba(167,139,250,0.12);
  --primary:       var(--accent);
  --primary-text:  #ffffff;
  --danger:        #e85555;
  --danger-dim:    rgba(232,85,85,0.12);
  --success:       #34c98a;
  --warning:       #e8c23a;
  --text:          #d8d8f0;
  --text-2:        #8888a8;
  --text-3:        #484868;
  --muted:         #484868;
  --glass-bg:      rgba(255,255,255,0.03);
  --glass-border:  rgba(255,255,255,0.07);
  --shadow-sm:     0 1px 3px rgba(0,0,0,0.5);
  --shadow:        0 4px 16px rgba(0,0,0,0.6);
  --shadow-lg:     0 12px 40px rgba(0,0,0,0.7);
  --shadow-glow:   0 0 24px rgba(74,158,255,0.2);
  --gradient-primary:  linear-gradient(135deg, #4a9eff, #70b8ff);
  --gradient-bg:   radial-gradient(ellipse 50% 40% at 5% 5%, rgba(74,158,255,0.05) 0%, transparent 50%);
  --gradient-card: linear-gradient(135deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
  --gradient-sidebar:  linear-gradient(180deg, #0f0f16 0%, #09090e 100%);
  --sidebar-bg:    #0f0f16;
  --sidebar-border:#1a1a2c;
  --nav-active-bg: rgba(74,158,255,0.1);
  --nav-active:    var(--accent);
  --nav-text:      var(--text-3);
  --nav-text-hover:var(--text-2);
  --font-display:  'Inter', system-ui, sans-serif;
  --font-sans:     'Inter', system-ui, sans-serif;
  --font-mono:     'DM Mono', monospace;
}

/* ============================================================
   2. TYPE SCALE
   ============================================================ */
:root {
  --text-xs:    11px;
  --text-sm:    13px;
  --text-base:  15px;
  --text-lg:    18px;
  --text-xl:    22px;
  --text-2xl:   28px;
  --text-3xl:   36px;
  --text-hero:  48px;
  --sidebar-w:  240px;
  --sidebar-w-collapsed: 64px;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  height: 100%;
}

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

/* Ambient gradient background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: var(--gradient-bg);
  pointer-events: none;
  z-index: 0;
}

/* ============================================================
   4. TYPOGRAPHY
   ============================================================ */
h1, h2, h3, .display {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--text);
}
[data-mode="medical"] h1,
[data-mode="medical"] h2,
[data-mode="medical"] h3,
[data-mode="medical"] .display {
  letter-spacing: -0.01em;
  font-weight: 600;
}
h4, h5, h6 {
  font-family: var(--font-sans);
  font-weight: 600;
  color: var(--text);
}
.label, label {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
code, .mono {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

/* ============================================================
   5. LAYOUT — SIDEBAR + CONTENT
   ============================================================ */
.app-shell {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* ── Left Sidebar ─────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  height: 100vh;
  background: var(--gradient-sidebar);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 50;
  transition: width 0.25s cubic-bezier(0.4,0,0.2,1),
              transform 0.3s cubic-bezier(0.4,0,0.2,1);
  overflow: hidden;
  overflow-y: auto;
  scrollbar-width: none;
}
.sidebar::-webkit-scrollbar { display: none; }

/* Sidebar brand */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--sidebar-border);
  text-decoration: none;
  flex-shrink: 0;
  min-height: 72px;
}
.sidebar-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 8px var(--accent-glow));
}
.sidebar-wordmark {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.02em;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
}
[data-mode="medical"] .sidebar-wordmark {
  font-size: 18px;
  font-weight: 600;
}
.sidebar-health {
  font-size: 11px;
  color: var(--accent-med);
  font-weight: 600;
  display: block;
  margin-top: 2px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Sidebar nav */
.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
}
.sidebar-nav::-webkit-scrollbar { display: none; }

.nav-section-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  padding: 12px 10px 6px;
  white-space: nowrap;
  overflow: hidden;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--nav-text);
  text-decoration: none;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
  white-space: nowrap;
  overflow: hidden;
  position: relative;
  margin-bottom: 2px;
}

.nav-item:hover {
  color: var(--nav-text-hover);
  background: var(--glass-bg);
}

.nav-item.active {
  color: var(--nav-active);
  background: var(--nav-active-bg);
  font-weight: 600;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 20%;
  height: 60%;
  width: 3px;
  background: var(--nav-active);
  border-radius: 0 3px 3px 0;
}

.nav-item-icon {
  font-size: 18px;
  flex-shrink: 0;
  width: 24px;
  text-align: center;
  line-height: 1;
}

.nav-item-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-item.nav-med { color: color-mix(in srgb, var(--nav-text) 70%, var(--accent-med) 30%); }
.nav-item.nav-med:hover { color: var(--accent-med); }
.nav-item.nav-med.active { color: var(--accent-med); background: var(--accent-med-dim); }
.nav-item.nav-med.active::before { background: var(--accent-med); }

.nav-divider {
  height: 1px;
  background: var(--sidebar-border);
  margin: 8px 10px;
}

/* Sidebar footer */
.sidebar-footer {
  padding: 12px 10px;
  border-top: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  overflow: hidden;
}
.sidebar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--nav-active-bg);
  border: 1px solid var(--nav-active);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
.sidebar-username {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-mode-badge {
  font-size: 10px;
  color: var(--text-3);
  white-space: nowrap;
}

/* Theme toggle + sign out row */
.sidebar-actions {
  display: flex;
  gap: 6px;
}
.sidebar-action-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  border: 1px solid var(--border);
  background: none;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
}
.sidebar-action-btn:hover {
  color: var(--text-2);
  background: var(--glass-bg);
  border-color: var(--border-strong);
}
.sidebar-action-btn.danger {
  color: var(--danger);
  border-color: rgba(232,85,85,0.25);
}
.sidebar-action-btn.danger:hover {
  background: var(--danger-dim);
  border-color: var(--danger);
}

/* Sidebar toggle button (collapse) */
.sidebar-toggle {
  position: absolute;
  right: -12px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--border-strong);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--text-3);
  transition: all 0.2s;
  z-index: 51;
}
.sidebar-toggle:hover {
  background: var(--card-hover);
  color: var(--accent);
  border-color: var(--accent);
}

/* Collapsed sidebar */
.sidebar.collapsed {
  width: var(--sidebar-w-collapsed);
}
.sidebar.collapsed .nav-item-label,
.sidebar.collapsed .nav-section-label,
.sidebar.collapsed .sidebar-wordmark,
.sidebar.collapsed .sidebar-username,
.sidebar.collapsed .sidebar-mode-badge {
  opacity: 0;
  width: 0;
}
.sidebar.collapsed .sidebar-brand { justify-content: center; padding: 20px 14px; }
.sidebar.collapsed .sidebar-user  { justify-content: center; }
.sidebar.collapsed .sidebar-actions { flex-direction: column; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 10px 0; }
.sidebar.collapsed .nav-item::before { display: none; }
.sidebar.collapsed .sidebar-action-btn { justify-content: center; }
.sidebar.collapsed .nav-section-label { display: none; }

/* ── Main content ─────────────────────────────────────────── */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  transition: margin-left 0.25s cubic-bezier(0.4,0,0.2,1);
  position: relative;
  z-index: 1;
}

.main-content.collapsed {
  margin-left: var(--sidebar-w-collapsed);
}

.page-wrap {
  max-width: 1060px;
  margin: 0 auto;
  padding: 36px 32px 80px;
}

.page-wrap-sm  { max-width: 720px; }
.page-wrap-md  { max-width: 860px; }
.page-wrap-lg  { max-width: 1200px; }

/* Mobile overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 49;
}
.sidebar-overlay.open { display: block; }

/* Mobile top bar */
.mobile-topbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: 52px;
  background: var(--sidebar-bg);
  border-bottom: 1px solid var(--sidebar-border);
  position: sticky;
  top: 0;
  z-index: 40;
}
.mobile-topbar-brand {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: -0.02em;
}
.mobile-menu-btn {
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
}
.mobile-menu-btn span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-2);
  border-radius: 2px;
  transition: all 0.2s;
}
.mobile-menu-btn.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.mobile-menu-btn.open span:nth-child(2) { opacity: 0; }
.mobile-menu-btn.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ============================================================
   6. CARDS
   ============================================================ */
.card {
  background: var(--card);
  background-image: var(--gradient-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}
.card-hover:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}
.card-glow:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-dim), var(--shadow-glow);
}

/* Glassmorphism card */
.card-glass {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}

/* Accent left border card */
.card-accent {
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.card-accent-med {
  border-left: 3px solid var(--accent-med);
  border-radius: 0 var(--radius) var(--radius) 0;
}

/* ============================================================
   7. FORMS
   ============================================================ */
label, .field-label {
  display: block;
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 7px;
}

input:not([type=range]):not([type=checkbox]):not([type=radio]):not([type=file]),
select,
textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  line-height: 1.5;
  transition: border-color 0.15s, box-shadow 0.15s;
  appearance: none;
  -webkit-appearance: none;
}

input:not([type=range]):not([type=checkbox]):not([type=radio]):not([type=file]):focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

input::placeholder, textarea::placeholder { color: var(--text-3); }

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23606070' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

textarea { resize: vertical; min-height: 80px; }

/* Checkbox */
input[type=checkbox] {
  width: 16px !important;
  height: 16px !important;
  appearance: checkbox !important;
  -webkit-appearance: checkbox !important;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
  border-radius: 3px;
}

/* ============================================================
   8. BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
  text-decoration: none;
  line-height: 1;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  transition: background 0.15s;
}
.btn:hover::after { background: rgba(255,255,255,0.05); }
.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--gradient-primary);
  color: var(--primary-text);
  box-shadow: 0 2px 8px var(--accent-glow);
}
.btn-primary:hover {
  box-shadow: 0 4px 16px var(--accent-glow);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--glass-bg);
  color: var(--text-2);
  border: 1px solid var(--border);
  backdrop-filter: var(--glass-blur);
}
.btn-secondary:hover {
  border-color: var(--border-strong);
  color: var(--text);
  background: var(--card);
}

.btn-ghost {
  background: none;
  color: var(--text-3);
  border: 1px solid transparent;
}
.btn-ghost:hover {
  color: var(--text-2);
  background: var(--glass-bg);
  border-color: var(--border);
}

.btn-danger {
  background: var(--danger-dim);
  color: var(--danger);
  border: 1px solid rgba(232,85,85,0.3);
}
.btn-danger:hover { background: rgba(232,85,85,0.2); }

.btn-med {
  background: linear-gradient(135deg, var(--accent-med), color-mix(in srgb, var(--accent-med) 80%, white 20%));
  color: #fff;
  box-shadow: 0 2px 8px var(--accent-med-dim);
}
.btn-med:hover {
  box-shadow: 0 4px 16px var(--accent-med-dim);
  transform: translateY(-1px);
}

.btn-lg { padding: 13px 28px; font-size: var(--text-base); }
.btn-sm { padding: 6px 14px; font-size: var(--text-xs); }
.btn-full { width: 100%; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

/* ============================================================
   9. BADGES
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  letter-spacing: 0.04em;
}
.badge-indica         { background: rgba(157,111,232,0.15); color: #b090f0; border: 1px solid rgba(157,111,232,0.3); }
.badge-sativa         { background: rgba(232,162,58,0.15);  color: #f0b060; border: 1px solid rgba(232,162,58,0.3); }
.badge-hybrid         { background: var(--accent-dim);       color: var(--accent); border: 1px solid rgba(126,206,74,0.3); }
.badge-cbd            { background: var(--accent3-dim);      color: var(--accent3); border: 1px solid rgba(74,184,232,0.3); }
.badge-other          { background: var(--glass-bg);         color: var(--text-3); border: 1px solid var(--border); }
.badge-med            { background: var(--accent-med-dim);   color: var(--accent-med); border: 1px solid rgba(167,139,250,0.3); }
.badge-success        { background: rgba(74,206,138,0.15);   color: var(--success); border: 1px solid rgba(74,206,138,0.3); }
.badge-danger         { background: var(--danger-dim);       color: var(--danger); border: 1px solid rgba(232,85,85,0.3); }

/* ============================================================
   10. SLIDERS
   ============================================================ */
input[type=range] {
  width: 100%;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border);
  border-radius: var(--radius-full);
  outline: none;
  cursor: pointer;
  --c: var(--accent);
  background: linear-gradient(to right, var(--c) 0%, var(--c) var(--pct,50%), var(--border) var(--pct,50%));
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--c, var(--accent));
  cursor: pointer;
  box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px color-mix(in srgb, var(--c, var(--accent)) 30%, transparent);
  transition: box-shadow 0.15s, transform 0.1s;
}
input[type=range]:hover::-webkit-slider-thumb { transform: scale(1.15); }
input[type=range]::-moz-range-thumb {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
}
.slider-label-row { display:flex; justify-content:space-between; align-items:center; margin-bottom:8px; }
.slider-label { font-family:var(--font-sans); font-size:var(--text-xs); font-weight:600; color:var(--text-3); text-transform:uppercase; letter-spacing:0.08em; }
.slider-val { font-family:var(--font-display); font-size:20px; font-weight:700; color:var(--accent); min-width:28px; text-align:right; }
.slider-row { display:flex; align-items:center; gap:12px; }
.slider-row input[type=range] { flex:1; }

/* ============================================================
   11. EFFECT CHIPS
   ============================================================ */
.effects-grid, .e-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 4px;
}
.effect-chip, .e-chip {
  display: flex;
  align-items: center;
  height: 30px;
  padding: 0 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--glass-bg);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
  transition: all 0.15s;
  user-select: none;
  white-space: nowrap;
  -webkit-appearance: none;
  appearance: none;
  outline: none;
  box-shadow: none;
}
.effect-chip:hover, .e-chip:hover { border-color: var(--border-strong); color: var(--text-2); }
.effect-chip.checked, .e-chip.checked { border-color: var(--accent); background: var(--accent-dim); color: var(--accent); font-weight: 600; }
.effect-chip.neg.checked, .e-chip.neg.checked { border-color: var(--danger); background: var(--danger-dim); color: var(--danger); }
.effect-chip input, .e-chip input { display: none; }

.terpene-chip {
  display: flex;
  align-items: center;
  height: 30px;
  padding: 0 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--glass-bg);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
  transition: all 0.15s;
  user-select: none;
  white-space: nowrap;
  -webkit-appearance: none;
  appearance: none;
  outline: none;
}
.terpene-chip:hover { border-color: var(--accent-med); color: var(--text-2); }
.terpene-chip.checked { border-color: var(--accent-med); background: var(--accent-med-dim); color: var(--accent-med); }

/* ============================================================
   12. STAT CARDS
   ============================================================ */
.stat-card {
  background: var(--card);
  background-image: var(--gradient-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  position: relative;
  overflow: hidden;
}
.stat-label {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 10px;
}
.stat-val {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  letter-spacing: -0.02em;
}
[data-mode="medical"] .stat-val { font-family: var(--font-sans); }
.stat-sub {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  color: var(--text-3);
  margin-top: 6px;
}

/* Stats grid */
.stats-grid,
.home-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
@media (max-width: 900px) { .stats-grid, .home-stats { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .stats-grid, .home-stats { grid-template-columns: 1fr 1fr; gap: 10px; } }

/* ============================================================
   13. TABS
   ============================================================ */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 28px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  padding: 10px 18px;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-3);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  letter-spacing: 0.01em;
  margin-bottom: -1px;
}
.tab:hover { color: var(--text-2); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

/* ============================================================
   14. ALERTS
   ============================================================ */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  margin-bottom: 16px;
  border: 1px solid transparent;
  line-height: 1.5;
  font-family: var(--font-sans);
}
.alert-success { background: rgba(74,206,138,0.1); border-color: rgba(74,206,138,0.3); color: var(--success); }
.alert-error   { background: var(--danger-dim); border-color: rgba(232,85,85,0.3); color: var(--danger); }
.alert-info    { background: var(--accent3-dim); border-color: rgba(74,184,232,0.3); color: var(--accent3); }
.alert-med     { background: var(--accent-med-dim); border-color: rgba(167,139,250,0.3); color: var(--accent-med); }

/* ============================================================
   15. PROGRESS BARS
   ============================================================ */
.progress-bar { height: 6px; background: var(--border); border-radius: var(--radius-full); overflow: hidden; }
.progress-fill { height: 100%; background: var(--gradient-primary); border-radius: var(--radius-full); transition: width 0.6s cubic-bezier(0.4,0,0.2,1); }

/* ============================================================
   16. SECTION HEADINGS
   ============================================================ */
.section-title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: -0.01em;
}
[data-mode="medical"] .section-title { font-family: var(--font-sans); font-size: var(--text-lg); font-weight: 700; }
.section-sub { font-family: var(--font-sans); font-size: var(--text-sm); color: var(--text-3); margin-bottom: 20px; }
.divider { border: none; border-top: 1px solid var(--border); margin: 28px 0; }

/* ============================================================
   17. EMPTY STATES
   ============================================================ */
.empty-state { text-align: center; padding: 48px 24px; }
.empty-icon { font-size: 40px; margin-bottom: 12px; display: block; opacity: 0.7; }
.empty-text { font-family: var(--font-sans); font-size: var(--text-sm); color: var(--text-3); line-height: 1.7; max-width: 320px; margin: 0 auto; }
.empty-cta { display: inline-flex; align-items: center; gap: 6px; margin-top: 16px; font-size: var(--text-xs); font-weight: 600; color: var(--accent); text-decoration: none; border: 1px solid var(--accent-dim); border-radius: var(--radius-sm); padding: 7px 16px; transition: all 0.15s; font-family: var(--font-sans); }
.empty-cta:hover { background: var(--accent-dim); }

/* ============================================================
   18. MEDICAL COMPONENTS
   ============================================================ */
.med-section {
  background: var(--accent-med-dim);
  border: 1px solid rgba(167,139,250,0.2);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 4px;
}
.med-section-title {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--accent-med);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.med-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  background: var(--accent-med-dim);
  color: var(--accent-med);
  border: 1px solid rgba(167,139,250,0.28);
}
.relief-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 600;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  margin: 8px 0;
}
.relief-pill.good  { background: rgba(74,206,138,0.1); color: var(--success); border: 1px solid rgba(74,206,138,0.25); }
.relief-pill.none  { background: var(--glass-bg); color: var(--text-3); border: 1px solid var(--border); }
.relief-pill.worse { background: var(--danger-dim); color: var(--danger); border: 1px solid rgba(232,85,85,0.25); }
.symptom-slider input[type=range] { --c: var(--accent-med); }

/* ============================================================
   19. TYPE PILLS (form)
   ============================================================ */
.type-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.type-pill {
  padding: 7px 16px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--glass-bg);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-3);
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
  white-space: nowrap;
  line-height: 1.4;
  -webkit-appearance: none;
  appearance: none;
  outline: none;
}
.type-pill:hover { border-color: var(--border-strong); color: var(--text-2); background: var(--card); }
.type-pill.indica.active  { background: rgba(157,111,232,0.15); border-color: #9d6fe8; color: #c0a0f8; }
.type-pill.sativa.active  { background: rgba(232,162,58,0.15);  border-color: #e8a23a; color: #f0c080; }
.type-pill.hybrid.active  { background: var(--accent-dim);       border-color: var(--accent); color: var(--accent); }
.type-pill.cbd.active     { background: var(--accent3-dim);      border-color: var(--accent3); color: var(--accent3); }
.type-pill.other.active   { background: var(--glass-bg);         border-color: var(--border-strong); color: var(--text-2); }

/* ============================================================
   20. FORM LAYOUT
   ============================================================ */
.form-section {
  background: var(--card);
  background-image: var(--gradient-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 16px;
}
.form-section-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text);
  margin-bottom: 22px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
  letter-spacing: -0.01em;
}
[data-mode="medical"] .form-section-title { font-family: var(--font-sans); font-size: var(--text-base); font-weight: 700; color: var(--accent); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-full { grid-column: 1 / -1; }
.label-hint { font-size: var(--text-xs); color: var(--text-3); font-weight: 400; text-transform: none; letter-spacing: 0; }
.input-hero { font-family: var(--font-display) !important; font-size: 20px !important; font-weight: 700 !important; padding: 14px 16px !important; }
[data-mode="medical"] .input-hero { font-family: var(--font-sans) !important; font-size: 16px !important; font-weight: 600 !important; }

/* ============================================================
   21. THEME TOGGLE (dark/light)
   ============================================================ */
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 2px;
  width: 100%;
}
.theme-toggle-btn {
  flex: 1;
  padding: 5px 8px;
  border-radius: var(--radius-full);
  border: none;
  background: none;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}
.theme-toggle-btn.active {
  background: var(--card);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* ============================================================
   22. 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(--border-strong); }

/* ============================================================
   23. UTILITY CLASSES
   ============================================================ */
.text-accent  { color: var(--accent) !important; }
.text-accent2 { color: var(--accent2) !important; }
.text-accent3 { color: var(--accent3) !important; }
.text-med     { color: var(--accent-med) !important; }
.text-danger  { color: var(--danger) !important; }
.text-muted   { color: var(--text-3) !important; }
.text-success { color: var(--success) !important; }
.text-2       { color: var(--text-2) !important; }

.font-display { font-family: var(--font-display) !important; }
.font-mono    { font-family: var(--font-mono) !important; }

.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.flex-wrap { flex-wrap: wrap; } .flex-1 { flex: 1; }
.w-full { width: 100%; }
.text-center { text-align: center; }
.hidden { display: none !important; }

/* ============================================================
   24. RESPONSIVE — SIDEBAR MOBILE
   ============================================================ */
@media (max-width: 860px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-content,
  .main-content.collapsed {
    margin-left: 0;
  }
  .mobile-topbar { display: flex; }
  .sidebar-toggle { display: none; }
  .page-wrap { padding: 24px 16px 80px; }
}

@media (max-width: 480px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-full { grid-column: 1; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .page-wrap { padding: 16px 12px 60px; }
}

/* Home stat card aliases */
.home-stat-card  { background:var(--card);background-image:var(--gradient-card);border:1px solid var(--border);border-radius:var(--radius);padding:20px 22px;position:relative;overflow:hidden; }
.home-stat-label { font-family:var(--font-sans);font-size:var(--text-xs);font-weight:600;color:var(--text-3);text-transform:uppercase;letter-spacing:0.1em;margin-bottom:10px; }
.home-stat-val   { font-family:var(--font-display);font-size:32px;font-weight:700;color:var(--accent);line-height:1;letter-spacing:-0.02em; }
[data-mode="medical"] .home-stat-val { font-family:var(--font-sans); }
.home-stat-sub   { font-family:var(--font-sans);font-size:var(--text-xs);color:var(--text-3);margin-top:6px; }
.home-stat-sub a { color:var(--accent);text-decoration:none; }
.home-stat-sub a:hover { text-decoration:underline; }
[data-mode="medical"] .home-stat-card { border-left:3px solid var(--accent);border-radius:0 var(--radius) var(--radius) 0; }
